format tickets in Tickets.vue
This commit is contained in:
parent
6dad675d1e
commit
3a5f35fa5d
7 changed files with 79 additions and 8 deletions
|
@ -74,7 +74,7 @@ export default {
|
|||
// message: JSON.stringify(e),
|
||||
// color: "success"
|
||||
//});
|
||||
console.log(e);
|
||||
//console.log(e);
|
||||
};
|
||||
this.notify_socket.onclose = (e) => {
|
||||
//if (this.socket_toast) {
|
||||
|
@ -86,7 +86,7 @@ export default {
|
|||
// message: JSON.stringify(e),
|
||||
// color: "danger"
|
||||
//});
|
||||
console.log(e);
|
||||
//console.log(e);
|
||||
setTimeout(() => {
|
||||
this.tryConnect();
|
||||
}, 1000);
|
||||
|
@ -101,7 +101,7 @@ export default {
|
|||
// message: JSON.stringify(e),
|
||||
// color: "danger"
|
||||
//});
|
||||
console.log(e);
|
||||
//console.log(e);
|
||||
setTimeout(() => {
|
||||
this.tryConnect();
|
||||
}, 1000);
|
||||
|
|
|
@ -20,7 +20,7 @@ import {default as BoxesAdmin} from "@/views/admin/Boxes.vue"
|
|||
Vue.use(VueRouter);
|
||||
|
||||
const routes = [
|
||||
{path: '/', redirect: '/Camp23/items', meta: {requiresAuth: false}},
|
||||
{path: '/', redirect: '/37C3/items', meta: {requiresAuth: false}},
|
||||
{path: '/login/', name: 'login', component: Login, meta: {requiresAuth: false}},
|
||||
{path: '/register/', name: 'register', component: Register, meta: {requiresAuth: false}},
|
||||
{path: '/howto/', name: 'howto', component: HowTo, meta: {requiresAuth: true}},
|
||||
|
|
|
@ -6,6 +6,7 @@ import router from '../router';
|
|||
|
||||
import * as base64 from 'base-64';
|
||||
import * as utf8 from 'utf8';
|
||||
import {ticketStateColorLookup, ticketStateIconLookup} from "@/utils";
|
||||
|
||||
Vue.use(Vuex);
|
||||
const axios = AxiosBootstrap.create({
|
||||
|
@ -69,7 +70,7 @@ const store = new Vuex.Store({
|
|||
tickets: [],
|
||||
users: [],
|
||||
groups: [],
|
||||
lastEvent: localStorage.getItem('lf_lastEvent') || '36C3',
|
||||
lastEvent: localStorage.getItem('lf_lastEvent') || '37C3',
|
||||
lastUsed: JSON.parse(localStorage.getItem('lf_lastUsed') || '{}'),
|
||||
remember: false,
|
||||
user: null,
|
||||
|
@ -88,6 +89,25 @@ const store = new Vuex.Store({
|
|||
getBoxes: state => state.loadedBoxes,
|
||||
checkPermission: state => (event, perm) => state.userPermissions.includes(`${event}:${perm}`) || state.userPermissions.includes(`*:${perm}`),
|
||||
hasPermissions: state => state.userPermissions.length > 0,
|
||||
stateInfo: state => (slug) => {
|
||||
const obj = state.state_options.filter((s) => s.value === slug)[0];
|
||||
if (obj) {
|
||||
return {
|
||||
color: ticketStateColorLookup(obj.value),
|
||||
icon: ticketStateIconLookup(obj.value),
|
||||
slug: obj.value,
|
||||
text: obj.text,
|
||||
}
|
||||
} else {
|
||||
return {
|
||||
color: 'danger',
|
||||
icon: 'exclamation',
|
||||
slug: slug,
|
||||
text: 'Unknown'
|
||||
}
|
||||
|
||||
}
|
||||
},
|
||||
isLoggedIn(state) {
|
||||
if (!state.local_loaded) {
|
||||
state.remember = localStorage.getItem('remember') === 'true'
|
||||
|
|
27
web/src/utils.js
Normal file
27
web/src/utils.js
Normal file
|
@ -0,0 +1,27 @@
|
|||
function ticketStateColorLookup(ticket) {
|
||||
if (ticket.startsWith('closed_')) {
|
||||
return 'secondary';
|
||||
}
|
||||
if (ticket.startsWith('pending_')) {
|
||||
return 'warning';
|
||||
}
|
||||
if (ticket.startsWith('waiting_')) {
|
||||
return 'primary';
|
||||
}
|
||||
return 'danger';
|
||||
}
|
||||
|
||||
function ticketStateIconLookup(ticket) {
|
||||
if (ticket.startsWith('closed_')) {
|
||||
return 'check';
|
||||
}
|
||||
if (ticket.startsWith('pending_')) {
|
||||
return 'exclamation';
|
||||
}
|
||||
if (ticket.startsWith('waiting_')) {
|
||||
return 'hourglass';
|
||||
}
|
||||
return 'exclamation';
|
||||
}
|
||||
|
||||
export {ticketStateColorLookup, ticketStateIconLookup};
|
Loading…
Add table
Add a link
Reference in a new issue