stash
This commit is contained in:
parent
2af52c6991
commit
fbbc72feab
4 changed files with 67 additions and 5 deletions
|
@ -88,6 +88,64 @@ export default (config) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** may only be called from worker */
|
/** may only be called from worker */
|
||||||
|
|
||||||
|
const clone = (obj) => {
|
||||||
|
if (isProxy(obj)) {
|
||||||
|
obj = toRaw(obj);
|
||||||
|
}
|
||||||
|
if (obj === null || typeof obj !== 'object') {
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
if (obj.__proto__ === ({}).__proto__) {
|
||||||
|
return Object.assign({}, obj);
|
||||||
|
}
|
||||||
|
if (obj.__proto__ === [].__proto__) {
|
||||||
|
return obj.slice();
|
||||||
|
}
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
|
||||||
|
const deepEqual = (a, b) => {
|
||||||
|
if (a === b) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (a === null || b === null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (a.__proto__ === ({}).__proto__ && b.__proto__ === ({}).__proto__) {
|
||||||
|
|
||||||
|
if (Object.keys(a).length !== Object.keys(b).length) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
for (let key in b) {
|
||||||
|
if (!(key in a)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (let key in a) {
|
||||||
|
if (!(key in b)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!deepEqual(a[key], b[key])) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (a.__proto__ === [].__proto__ && b.__proto__ === [].__proto__) {
|
||||||
|
if (a.length !== b.length) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
for (let i = 0; i < a.length; i++) {
|
||||||
|
if (!deepEqual(a[i], b[i])) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
const worker_fun = function (self, ctx) {
|
const worker_fun = function (self, ctx) {
|
||||||
/* globals WebSocket, SharedWorker, onconnect, onmessage, postMessage, close, location */
|
/* globals WebSocket, SharedWorker, onconnect, onmessage, postMessage, close, location */
|
||||||
|
|
||||||
|
|
|
@ -140,7 +140,6 @@ const store = createStore({
|
||||||
updateTicket(state, updatedTicket) {
|
updateTicket(state, updatedTicket) {
|
||||||
const ticket = state.tickets.filter(({id}) => id === updatedTicket.id)[0];
|
const ticket = state.tickets.filter(({id}) => id === updatedTicket.id)[0];
|
||||||
Object.assign(ticket, updatedTicket);
|
Object.assign(ticket, updatedTicket);
|
||||||
//triggerRef(state.tickets);
|
|
||||||
state.tickets = [...state.tickets];
|
state.tickets = [...state.tickets];
|
||||||
},
|
},
|
||||||
replaceUsers(state, users) {
|
replaceUsers(state, users) {
|
||||||
|
@ -199,6 +198,9 @@ const store = createStore({
|
||||||
setThumbnail(state, {url, data}) {
|
setThumbnail(state, {url, data}) {
|
||||||
state.thumbnailCache[url] = data;
|
state.thumbnailCache[url] = data;
|
||||||
},
|
},
|
||||||
|
setThumbnail(state, {url, data}) {
|
||||||
|
state.thumbnailCache[url] = data;
|
||||||
|
},
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
async login({commit}, {username, password, remember}) {
|
async login({commit}, {username, password, remember}) {
|
||||||
|
@ -428,7 +430,7 @@ const store = createStore({
|
||||||
]
|
]
|
||||||
}),
|
}),
|
||||||
sharedStatePlugin({
|
sharedStatePlugin({
|
||||||
debug: true,
|
debug: false,
|
||||||
isLoadedKey: "shared_loaded",
|
isLoadedKey: "shared_loaded",
|
||||||
clearingMutation: "logout",
|
clearingMutation: "logout",
|
||||||
afterInit: "afterSharedInit",
|
afterInit: "afterSharedInit",
|
||||||
|
|
|
@ -47,7 +47,7 @@ const http = {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
"Authorization": `Token ${token}`,
|
"Authorization": `Token ${data.token}`,
|
||||||
},
|
},
|
||||||
body: JSON.stringify(data),
|
body: JSON.stringify(data),
|
||||||
});
|
});
|
||||||
|
|
|
@ -23,13 +23,15 @@
|
||||||
>
|
>
|
||||||
<template #actions="{ item }">
|
<template #actions="{ item }">
|
||||||
<div class="btn-group">
|
<div class="btn-group">
|
||||||
<button class="btn btn-success" @click.stop="confirm('return Item?') && markItemReturned(item)" title="returned">
|
<button class="btn btn-success"
|
||||||
|
@click.stop="confirm('return Item?') && markItemReturned(item)" title="returned">
|
||||||
<font-awesome-icon icon="check"/>
|
<font-awesome-icon icon="check"/>
|
||||||
</button>
|
</button>
|
||||||
<button class="btn btn-secondary" @click.stop="openEditingModalWith(item)" title="edit">
|
<button class="btn btn-secondary" @click.stop="openEditingModalWith(item)" title="edit">
|
||||||
<font-awesome-icon icon="edit"/>
|
<font-awesome-icon icon="edit"/>
|
||||||
</button>
|
</button>
|
||||||
<button class="btn btn-danger" @click.stop="confirm('delete Item?') && deleteItem(item)" title="delete">
|
<button class="btn btn-danger" @click.stop="confirm('delete Item?') && deleteItem(item)"
|
||||||
|
title="delete">
|
||||||
<font-awesome-icon icon="trash"/>
|
<font-awesome-icon icon="trash"/>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in a new issue