stash
This commit is contained in:
parent
b81ce42242
commit
1e4b5a111c
3 changed files with 40 additions and 7 deletions
|
@ -73,7 +73,7 @@
|
|||
import TimelineMail from "@/components/TimelineMail.vue";
|
||||
import TimelineComment from "@/components/TimelineComment.vue";
|
||||
import TimelineStateChange from "@/components/TimelineStateChange.vue";
|
||||
import {mapGetters} from "vuex";
|
||||
import {mapActions, mapGetters} from "vuex";
|
||||
import TimelineAssignment from "@/components/TimelineAssignment.vue";
|
||||
import TimelineRelatedItem from "@/components/TimelineRelatedItem.vue";
|
||||
import TimelineShippingVoucher from "@/components/TimelineShippingVoucher.vue";
|
||||
|
|
|
@ -48,6 +48,7 @@ const store = createStore({
|
|||
states: 0,
|
||||
messageTemplates: 0,
|
||||
shippingVouchers: 0,
|
||||
userNotificationChannels: 0,
|
||||
},
|
||||
persistent_loaded: false,
|
||||
shared_loaded: false,
|
||||
|
@ -262,6 +263,10 @@ const store = createStore({
|
|||
state.shippingVouchers = codes;
|
||||
state.fetchedData = {...state.fetchedData, shippingVouchers: Date.now()};
|
||||
},
|
||||
setUserNotificationChannels(state, channels) {
|
||||
state.userNotificationChannels = channels;
|
||||
state.fetchedData = {...state.fetchedData, userNotificationChannels: Date.now()};
|
||||
},
|
||||
},
|
||||
actions: {
|
||||
async login({commit}, {username, password, remember}) {
|
||||
|
@ -544,9 +549,10 @@ const store = createStore({
|
|||
},
|
||||
async fetchUserNotificationChannels({commit, state}) {
|
||||
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);
|
||||
if (data && success) {
|
||||
state.userNotificationChannels = data;
|
||||
commit('setUserNotificationChannels', data);
|
||||
}
|
||||
},
|
||||
},
|
||||
|
|
|
@ -1,9 +1,36 @@
|
|||
<template>
|
||||
<ul>
|
||||
<li v-for="channel in userNotificationChannels" :key="channel.id">
|
||||
{{ channel.id }} - {{ channel.channel_type }} - {{ channel.channel_target }} - {{ channel.event_filter }} - {{ channel.active }} - {{ channel.created }} - {{ channel.user }}
|
||||
</li>
|
||||
</ul>
|
||||
<div>
|
||||
<Table :items="userNotificationChannels.map(channel => ({...channel, username: channel.user.username || {}}))"
|
||||
:columns="['id', 'username', 'channel_type', 'channel_target', 'event_filter', /*'active', 'created'*/]">
|
||||
<template #actions="{ item }">
|
||||
<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>
|
||||
|
||||
<script>
|
||||
|
|
Loading…
Reference in a new issue