This commit is contained in:
j3d1 2024-07-13 17:28:38 +02:00
parent 8e04cea448
commit 7df9a3f8cc
4 changed files with 41 additions and 8 deletions

View file

@ -73,7 +73,7 @@
import TimelineMail from "@/components/TimelineMail.vue"; import TimelineMail from "@/components/TimelineMail.vue";
import TimelineComment from "@/components/TimelineComment.vue"; import TimelineComment from "@/components/TimelineComment.vue";
import TimelineStateChange from "@/components/TimelineStateChange.vue"; import TimelineStateChange from "@/components/TimelineStateChange.vue";
import {mapGetters} from "vuex"; import {mapActions, mapGetters} from "vuex";
import TimelineAssignment from "@/components/TimelineAssignment.vue"; import TimelineAssignment from "@/components/TimelineAssignment.vue";
import TimelineRelatedItem from "@/components/TimelineRelatedItem.vue"; import TimelineRelatedItem from "@/components/TimelineRelatedItem.vue";
import TimelineShippingVoucher from "@/components/TimelineShippingVoucher.vue"; import TimelineShippingVoucher from "@/components/TimelineShippingVoucher.vue";

View file

@ -47,6 +47,7 @@ const store = createStore({
states: 0, states: 0,
messageTemplates: 0, messageTemplates: 0,
shippingVouchers: 0, shippingVouchers: 0,
userNotificationChannels: 0,
}, },
persistent_loaded: false, persistent_loaded: false,
shared_loaded: false, shared_loaded: false,
@ -241,6 +242,10 @@ const store = createStore({
state.shippingVouchers = codes; state.shippingVouchers = codes;
state.fetchedData = {...state.fetchedData, shippingVouchers: Date.now()}; state.fetchedData = {...state.fetchedData, shippingVouchers: Date.now()};
}, },
setUserNotificationChannels(state, channels) {
state.userNotificationChannels = channels;
state.fetchedData = {...state.fetchedData, userNotificationChannels: Date.now()};
},
}, },
actions: { actions: {
async login({commit}, {username, password, remember}) { async login({commit}, {username, password, remember}) {
@ -536,9 +541,10 @@ const store = createStore({
}, },
async fetchUserNotificationChannels({commit, state}) { async fetchUserNotificationChannels({commit, state}) {
if (!state.user.token) return; if (!state.user.token) return;
if (state.fetchedData.userNotificationChannels > Date.now() - 1000 * 60 * 60 * 24) return;
const {data, success} = await http.get('/2/user_notification_channels/', state.user.token); const {data, success} = await http.get('/2/user_notification_channels/', state.user.token);
if (data && success) { if (data && success) {
state.userNotificationChannels = data; commit('setUserNotificationChannels', data);
} }
}, },
}, },

View file

@ -3,7 +3,7 @@
<div class="container-fluid px-xl-5 mt-3"> <div class="container-fluid px-xl-5 mt-3">
<div class="row"> <div class="row">
<div class="col-xl-8 offset-xl-2"> <div class="col-xl-8 offset-xl-2">
<SlotTable <SlotTable
:columns="['id', 'name', 'state', 'last_activity', 'assigned_to', 'actions', 'actions2']" :columns="['id', 'name', 'state', 'last_activity', 'assigned_to', 'actions', 'actions2']"
:items="tickets.map(formatTicket)" :items="tickets.map(formatTicket)"
:keyName="'id'" :keyName="'id'"

View file

@ -1,9 +1,36 @@
<template> <template>
<ul> <div>
<li v-for="channel in userNotificationChannels" :key="channel.id"> <Table :items="userNotificationChannels.map(channel => ({...channel, username: channel.user.username || {}}))"
{{ channel.id }} - {{ channel.channel_type }} - {{ channel.channel_target }} - {{ channel.event_filter }} - {{ channel.active }} - {{ channel.created }} - {{ channel.user }} :columns="['id', 'username', 'channel_type', 'channel_target', 'event_filter', /*'active', 'created'*/]">
</li> <template #actions="{ item }">
</ul> <div class="btn-group">
<button class="btn btn-danger" @click.stop="">
<font-awesome-icon icon="trash"/>
delete
</button>
</div>
</template>
</Table>
<div class="card bg-dark">
<div class="card-body">
<div class="input-group">
<select class="form-control">
<option value="1">user</option>
<option value="2">admin</option>
</select>
<select class="form-control">
<option value="email">Email</option>
<option value="telegram">Telegram</option>
</select>
<input type="text" class="form-control" placeholder="channel_target">
<input type="text" class="form-control" value="*">
<div class="input-group-append">
<button class="btn btn-primary">Add</button>
</div>
</div>
</div>
</div>
</div>
</template> </template>
<script> <script>