parent
401b71571f
commit
1a3aab4d41
9 changed files with 90 additions and 98 deletions
|
@ -17,12 +17,12 @@ jobs:
|
|||
- name: Install dependencies
|
||||
working-directory: core
|
||||
run: pip3 install -r requirements.dev.txt
|
||||
- name: Run django tests
|
||||
- name: Run django tests with coverage
|
||||
working-directory: core
|
||||
run: python3 manage.py test
|
||||
- name: Run django coverage
|
||||
run: coverage run manage.py test
|
||||
- name: Evaluate coverage
|
||||
working-directory: core
|
||||
run: coverage manage.py test
|
||||
run: coverage report
|
||||
|
||||
deploy:
|
||||
needs: [ test ]
|
||||
|
|
|
@ -9,6 +9,9 @@ omit =
|
|||
*/tests/*
|
||||
*/migrations/*
|
||||
core/asgi.py
|
||||
core/wsgi.py
|
||||
core/globals.py
|
||||
core/settings.py
|
||||
manage.py
|
||||
mail/socket.py
|
||||
manage.py
|
||||
server.py
|
||||
helper.py
|
|
@ -1,5 +1,6 @@
|
|||
<template>
|
||||
<div style="min-height: 100vh; display: flex; flex-direction: column;">
|
||||
<Lightbox v-if="lightboxHash" :hash="lightboxHash" @close="openLightboxModalWith(null)"/>
|
||||
<AddItemModal v-if="addItemModalOpen && isLoggedIn" @close="closeAddItemModal()" isModal="true"/>
|
||||
<AddTicketModal v-if="addTicketModalOpen && isLoggedIn" @close="closeAddTicketModal()" isModal="true"/>
|
||||
<AddBoxModal v-if="showAddBoxModal && isLoggedIn" @close="closeAddBoxModal()" isModal="true"/>
|
||||
|
@ -16,20 +17,22 @@ import {mapState, mapMutations, mapActions, mapGetters} from 'vuex';
|
|||
import AddTicketModal from "@/components/AddTicketModal.vue";
|
||||
import AddBoxModal from "@/components/AddBoxModal.vue";
|
||||
import AddEventModal from "@/components/AddEventModal.vue";
|
||||
import Lightbox from "@/components/Lightbox.vue";
|
||||
|
||||
export default {
|
||||
name: 'app',
|
||||
components: {AddBoxModal, AddEventModal, Navbar, AddItemModal, AddTicketModal},
|
||||
components: {Lightbox, AddBoxModal, AddEventModal, Navbar, AddItemModal, AddTicketModal},
|
||||
computed: {
|
||||
...mapState(['loadedItems', 'layout', 'toasts', 'showAddBoxModal', 'showAddEventModal']),
|
||||
...mapState(['loadedItems', 'layout', 'toasts', 'showAddBoxModal', 'showAddEventModal', 'lightboxHash']),
|
||||
...mapGetters(['isLoggedIn']),
|
||||
},
|
||||
data: () => ({
|
||||
addItemModalOpen: false,
|
||||
addTicketModalOpen: false
|
||||
addTicketModalOpen: false,
|
||||
}),
|
||||
methods: {
|
||||
...mapMutations(['removeToast', 'createToast', 'closeAddBoxModal', 'openAddBoxModal', 'closeAddEventModal']),
|
||||
...mapMutations(['removeToast', 'createToast', 'closeAddBoxModal', 'openAddBoxModal', 'closeAddEventModal',
|
||||
'openLightboxModalWith']),
|
||||
...mapActions(['loadEvents', 'scheduleAfterInit']),
|
||||
openAddItemModal() {
|
||||
this.addItemModalOpen = true;
|
||||
|
@ -42,7 +45,7 @@ export default {
|
|||
},
|
||||
closeAddTicketModal() {
|
||||
this.addTicketModalOpen = false;
|
||||
}
|
||||
},
|
||||
},
|
||||
created: function () {
|
||||
document.title = document.location.hostname;
|
||||
|
|
|
@ -43,11 +43,11 @@ export default {
|
|||
props: ['label', 'model', 'nameKey', 'uniqueKey', 'options', 'onOptionAdd'],
|
||||
data: ({options, model, nameKey, uniqueKey}) => ({
|
||||
internalName: model[nameKey],
|
||||
selectedOption: options.filter(e => e[uniqueKey] == model[uniqueKey])[0],
|
||||
selectedOption: options.filter(e => e[uniqueKey] === model[uniqueKey])[0],
|
||||
addingOption: false
|
||||
}),
|
||||
computed: {
|
||||
isValid: ({options, nameKey, internalName}) => options.some(e => e[nameKey] == internalName),
|
||||
isValid: ({options, nameKey, internalName}) => options.some(e => e[nameKey] === internalName),
|
||||
sortedOptions: ({
|
||||
options,
|
||||
nameKey
|
||||
|
@ -56,7 +56,7 @@ export default {
|
|||
watch: {
|
||||
internalName(newValue) {
|
||||
if (this.isValid) {
|
||||
if (!this.selectedOption || newValue != this.selectedOption[this.nameKey]) {
|
||||
if (!this.selectedOption || newValue !== this.selectedOption[this.nameKey]) {
|
||||
this.selectedOption = this.options.filter(e => e[this.nameKey] === newValue)[0];
|
||||
}
|
||||
this.model[this.nameKey] = this.selectedOption[this.nameKey];
|
||||
|
|
|
@ -37,6 +37,7 @@ const store = createStore({
|
|||
expiry: null,
|
||||
},
|
||||
|
||||
lightboxHash: null,
|
||||
thumbnailCache: {},
|
||||
fetchedData: {
|
||||
events: 0,
|
||||
|
@ -191,6 +192,9 @@ const store = createStore({
|
|||
state.groups = groups;
|
||||
state.fetchedData = {...state.fetchedData, groups: Date.now()};
|
||||
},
|
||||
openLightboxModalWith(state, hash) {
|
||||
state.lightboxHash = hash;
|
||||
},
|
||||
openAddBoxModal(state) {
|
||||
state.showAddBoxModal = true;
|
||||
},
|
||||
|
@ -355,7 +359,7 @@ const store = createStore({
|
|||
commit('replaceEvents', [...state.events.filter(e => e.id !== event_id)])
|
||||
}
|
||||
},
|
||||
async updateEvent({commit, dispatch, state}, {id, partial_event}){
|
||||
async updateEvent({commit, dispatch, state}, {id, partial_event}) {
|
||||
const {data, success} = await http.patch(`/2/events/${id}/`, partial_event, state.user.token);
|
||||
if (success) {
|
||||
commit('replaceEvents', [...state.events.filter(e => e.id !== id), data])
|
||||
|
@ -369,7 +373,6 @@ const store = createStore({
|
|||
},
|
||||
async changeEvent({dispatch, getters, commit}, eventName) {
|
||||
await router.push({path: `/${eventName.slug}/${getters.getActiveView}/`});
|
||||
//dispatch('loadEventItems');
|
||||
},
|
||||
async changeView({getters}, link) {
|
||||
await router.push({path: `/${getters.getEventSlug}/${link.path}/`});
|
||||
|
|
|
@ -8,15 +8,25 @@
|
|||
<AuthenticatedImage v-if="item.file" cached
|
||||
:src="`/media/2/256/${item.file}/`"
|
||||
class="d-block card-img"
|
||||
@click="openLightboxModalWith(item)"
|
||||
@click="openLightboxModalWith(item.file)"
|
||||
/>
|
||||
<div class="card-body">
|
||||
<h6 class="card-subtitle text-secondary">id: {{ item.id }} box: {{
|
||||
item.box
|
||||
}}</h6>
|
||||
<h6 class="card-subtitle text-secondary">id: {{ item.id }} box: {{ item.box }}</h6>
|
||||
<h6 class="card-title">{{ item.description }}</h6>
|
||||
</div>
|
||||
|
||||
<div class="card-footer">
|
||||
<InputPhoto
|
||||
:model="editingItem"
|
||||
field="file"
|
||||
:on-capture="storeImage"
|
||||
/>
|
||||
<InputString
|
||||
label="description"
|
||||
:model="editingItem"
|
||||
field="description"
|
||||
:validation-fn="str => str && str.length > 0"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -26,7 +36,7 @@
|
|||
<h3>Item #{{ item.id }} - {{ item.description }}</h3>
|
||||
</div>
|
||||
<Timeline :timeline="item.timeline">
|
||||
<template v-slot:timeline_action1>
|
||||
<!--template v-slot:timeline_action1>
|
||||
<span class="timeline-item-icon | faded-icon">
|
||||
<font-awesome-icon icon="comment"/>
|
||||
</span>
|
||||
|
@ -41,47 +51,35 @@
|
|||
</AsyncButton>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</template-->
|
||||
</Timeline>
|
||||
<div class="card-footer d-flex justify-content-between">
|
||||
<button class="btn btn-secondary mr-2" @click="$router.go(-1)">Back</button>
|
||||
<!--button class="btn btn-secondary mr-2" @click="$router.go(-1)">Back</button-->
|
||||
<div class="btn-group">
|
||||
<button class="btn btn-outline-success"
|
||||
@click.stop="confirm('return Item?') && markItemReturned(item)"
|
||||
title="returned">
|
||||
<font-awesome-icon icon="check"/>
|
||||
</button>
|
||||
<button class="btn btn-outline-secondary" @click.stop="openEditingModalWith(item)"
|
||||
title="edit">
|
||||
<font-awesome-icon icon="edit"/>
|
||||
<font-awesome-icon icon="check"/> mark returned
|
||||
</button>
|
||||
<button class="btn btn-outline-danger"
|
||||
@click.stop="confirm('delete Item?') && deleteItem(item)"
|
||||
title="delete">
|
||||
<font-awesome-icon icon="trash"/>
|
||||
<font-awesome-icon icon="trash"/> delete
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<InputCombo
|
||||
label="box"
|
||||
:model="item"
|
||||
:model="editingItem"
|
||||
nameKey="box"
|
||||
uniqueKey="cid"
|
||||
:options="boxes"
|
||||
style="width: auto;"
|
||||
/>
|
||||
<div class="btn-group">
|
||||
<select class="form-control" v-model="selected_state">
|
||||
<option v-for="status in state_options" :value="status.value">{{
|
||||
status.text
|
||||
}}
|
||||
</option>
|
||||
</select>
|
||||
<button class="form-control btn btn-success"
|
||||
@click="changeTicketStatus(item)"
|
||||
:disabled="(selected_state == item.state)">
|
||||
Change Status
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<button type="button" class="btn btn-success" @click="saveEditingItem()">Save Changes
|
||||
</button>
|
||||
{{ editingItem}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -105,21 +103,29 @@
|
|||
</AsyncLoader>
|
||||
</template>
|
||||
|
||||
|
||||
<script>
|
||||
import {mapActions, mapGetters, mapState} from 'vuex';
|
||||
import {mapActions, mapGetters, mapMutations, mapState} from 'vuex';
|
||||
import Timeline from "@/components/Timeline.vue";
|
||||
import ClipboardButton from "@/components/inputs/ClipboardButton.vue";
|
||||
import AsyncLoader from "@/components/AsyncLoader.vue";
|
||||
import InputCombo from "@/components/inputs/InputCombo.vue";
|
||||
import InputString from "@/components/inputs/InputString.vue";
|
||||
import AuthenticatedImage from "@/components/AuthenticatedImage.vue";
|
||||
import InputPhoto from "@/components/inputs/InputPhoto.vue";
|
||||
import Modal from "@/components/Modal.vue";
|
||||
import EditItem from "@/components/EditItem.vue";
|
||||
|
||||
export default {
|
||||
name: 'Item',
|
||||
components: {AuthenticatedImage, InputString, InputCombo, AsyncLoader, ClipboardButton, Timeline},
|
||||
components: {
|
||||
EditItem,
|
||||
Modal, InputPhoto, AuthenticatedImage, InputString, InputCombo, AsyncLoader, ClipboardButton, Timeline
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
newComment: ""
|
||||
newComment: "",
|
||||
editingItem: {},
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
|
@ -131,33 +137,40 @@ export default {
|
|||
return ret ? ret : {};
|
||||
},
|
||||
boxes() {
|
||||
console.log(this.getBoxes);
|
||||
return this.getBoxes.map(obj => ({cid: obj.cid, box: obj.name}));
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
...mapActions(['deleteItem', 'markItemReturned', 'updateTicketPartial', 'postComment']),
|
||||
...mapActions(['loadTickets', 'fetchTicketStates', 'loadUsers', 'scheduleAfterInit']),
|
||||
...mapActions(['loadTickets', 'fetchTicketStates', 'loadUsers', 'scheduleAfterInit', 'updateItem']),
|
||||
...mapActions(['claimShippingVoucher', 'fetchShippingVouchers', 'loadEventItems', 'loadBoxes']),
|
||||
changeTicketStatus(item) {
|
||||
item.state = this.selected_state;
|
||||
this.updateTicketPartial({
|
||||
id: item.id,
|
||||
state: this.selected_state,
|
||||
})
|
||||
},
|
||||
...mapMutations(['openLightboxModalWith']),
|
||||
addCommentAndClear: async function () {
|
||||
await this.postComment({
|
||||
id: this.ticket.id,
|
||||
message: this.newComment
|
||||
})
|
||||
this.newComment = "";
|
||||
}
|
||||
},
|
||||
closeEditingModal() {
|
||||
this.editingItem = null;
|
||||
},
|
||||
async saveEditingItem() { // Saves the edited copy of the item.
|
||||
await this.updateItem(this.editingItem);
|
||||
this.editingItem = {...this.item}
|
||||
},
|
||||
storeImage(image) {
|
||||
this.item.dataImage = image;
|
||||
},
|
||||
confirm(message) {
|
||||
return window.confirm(message);
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
this.scheduleAfterInit(() => [Promise.all([this.loadEventItems(), this.loadBoxes()]).then(() => {
|
||||
this.selected_state = this.item.state;
|
||||
this.selected_assignee = this.item.assigned_to
|
||||
this.editingItem = {...this.item}
|
||||
})]);
|
||||
}
|
||||
};
|
||||
|
|
|
@ -1,19 +1,6 @@
|
|||
<template>
|
||||
<AsyncLoader :loaded="isItemsLoaded">
|
||||
<div class="container-fluid px-xl-5 mt-3">
|
||||
<Modal title="Edit Item" v-if="editingItem" @close="closeEditingModal()">
|
||||
<template #body>
|
||||
<EditItem
|
||||
:item="editingItem"
|
||||
badge="id"
|
||||
/>
|
||||
</template>
|
||||
<template #buttons>
|
||||
<button type="button" class="btn btn-secondary" @click="closeEditingModal()">Cancel</button>
|
||||
<button type="button" class="btn btn-success" @click="saveEditingItem()">Save Changes</button>
|
||||
</template>
|
||||
</Modal>
|
||||
<Lightbox v-if="lightboxHash" :hash="lightboxHash" @close="closeLightboxModal()"/>
|
||||
<div class="row" v-if="layout === 'table'">
|
||||
<div class="col-xl-8 offset-xl-2">
|
||||
<Table
|
||||
|
@ -47,7 +34,7 @@
|
|||
:items="getEventItems"
|
||||
:keyName="'id'"
|
||||
v-slot="{ item }"
|
||||
@itemActivated="showItemDetail"
|
||||
@itemActivated="item => openLightboxModalWith(item.file)"
|
||||
>
|
||||
<AuthenticatedImage v-if="item.file" cached
|
||||
:src="`/media/2/256/${item.file}/`"
|
||||
|
@ -62,7 +49,7 @@
|
|||
@click.stop="confirm('return Item?') && markItemReturned(item)" title="returned">
|
||||
<font-awesome-icon icon="check"/>
|
||||
</button>
|
||||
<button class="btn btn-outline-secondary" @click.stop="openEditingModalWith(item)"
|
||||
<button class="btn btn-outline-secondary" @click.stop="showItemDetail(item)"
|
||||
title="edit">
|
||||
<font-awesome-icon icon="edit"/>
|
||||
</button>
|
||||
|
@ -84,8 +71,7 @@ import Table from '@/components/Table';
|
|||
import Cards from '@/components/Cards';
|
||||
import Modal from '@/components/Modal';
|
||||
import EditItem from '@/components/EditItem';
|
||||
import {mapActions, mapGetters, mapState} from 'vuex';
|
||||
import Lightbox from '../components/Lightbox';
|
||||
import {mapActions, mapGetters, mapMutations} from 'vuex';
|
||||
import AuthenticatedImage from "@/components/AuthenticatedImage.vue";
|
||||
import AsyncLoader from "@/components/AsyncLoader.vue";
|
||||
import router from "@/router";
|
||||
|
@ -96,32 +82,16 @@ export default {
|
|||
lightboxHash: null,
|
||||
editingItem: null,
|
||||
}),
|
||||
components: {AsyncLoader, AuthenticatedImage, Lightbox, Table, Cards, Modal, EditItem},
|
||||
components: {AsyncLoader, AuthenticatedImage, Table, Cards, Modal, EditItem},
|
||||
computed: {
|
||||
...mapState([]),
|
||||
...mapGetters(['getEventItems', 'isItemsLoaded', 'layout']),
|
||||
},
|
||||
methods: {
|
||||
...mapActions(['deleteItem', 'markItemReturned', 'loadEventItems', 'updateItem', 'scheduleAfterInit']),
|
||||
...mapMutations(['openLightboxModalWith']),
|
||||
showItemDetail(item) {
|
||||
router.push({name: 'item', params: {id: item.id}});
|
||||
},
|
||||
openLightboxModalWith(item) {
|
||||
this.lightboxHash = item.file;
|
||||
},
|
||||
closeLightboxModal() { // Closes the editing modal and discards the edited copy of the item.
|
||||
this.lightboxHash = null;
|
||||
},
|
||||
openEditingModalWith(item) { // Opens the editing modal with a copy of the selected item.
|
||||
this.editingItem = item;
|
||||
},
|
||||
closeEditingModal() {
|
||||
this.editingItem = null;
|
||||
},
|
||||
saveEditingItem() { // Saves the edited copy of the item.
|
||||
this.updateItem(this.editingItem);
|
||||
this.closeEditingModal();
|
||||
},
|
||||
confirm(message) {
|
||||
return window.confirm(message);
|
||||
}
|
||||
|
|
|
@ -105,7 +105,7 @@
|
|||
<AuthenticatedImage v-if="item.file" cached
|
||||
:src="`/media/2/256/${item.file}/`"
|
||||
class="d-block card-img"
|
||||
@click="openLightboxModalWith(item)"
|
||||
@click="openLightboxModalWith(item.file)"
|
||||
/>
|
||||
<div class="card-body">
|
||||
<!--h6 class="card-title text-info"><span class="badge badge-primary">{{ item.relation_status }}</span></--h6-->
|
||||
|
@ -126,7 +126,7 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import {mapActions, mapGetters, mapState} from 'vuex';
|
||||
import {mapActions, mapGetters, mapMutations, mapState} from 'vuex';
|
||||
import Timeline from "@/components/Timeline.vue";
|
||||
import ClipboardButton from "@/components/inputs/ClipboardButton.vue";
|
||||
import AsyncLoader from "@/components/AsyncLoader.vue";
|
||||
|
@ -166,6 +166,7 @@ export default {
|
|||
...mapActions(['deleteItem', 'markItemReturned', 'sendMail', 'updateTicketPartial', 'postComment']),
|
||||
...mapActions(['loadTickets', 'fetchTicketStates', 'loadUsers', 'scheduleAfterInit']),
|
||||
...mapActions(['claimShippingVoucher', 'fetchShippingVouchers']),
|
||||
...mapMutations(['openLightboxModalWith']),
|
||||
changeTicketStatus() {
|
||||
this.ticket.state = this.selected_state;
|
||||
this.updateTicketPartial({
|
||||
|
|
|
@ -55,24 +55,23 @@
|
|||
|
||||
<script>
|
||||
import Cards from '@/components/Cards';
|
||||
import Modal from '@/components/Modal';
|
||||
import EditItem from '@/components/EditItem';
|
||||
import {mapActions, mapGetters, mapState} from 'vuex';
|
||||
import Lightbox from '../components/Lightbox';
|
||||
import SlotTable from "@/components/SlotTable.vue";
|
||||
import CollapsableCards from "@/components/CollapsableCards.vue";
|
||||
import AsyncLoader from "@/components/AsyncLoader.vue";
|
||||
import router from "@/router";
|
||||
|
||||
export default {
|
||||
name: 'Tickets',
|
||||
components: {AsyncLoader, Lightbox, SlotTable, Cards, Modal, EditItem, CollapsableCards},
|
||||
components: {AsyncLoader, Lightbox, SlotTable, Cards, CollapsableCards},
|
||||
computed: {
|
||||
...mapGetters(['getEventTickets', 'isTicketsLoaded', 'stateInfo', 'getEventSlug', 'layout']),
|
||||
},
|
||||
methods: {
|
||||
...mapActions(['loadTickets', 'fetchTicketStates', 'scheduleAfterInit']),
|
||||
gotoDetail(ticket) {
|
||||
this.$router.push({name: 'ticket', params: {id: ticket.id}});
|
||||
router.push({name: 'ticket', params: {id: ticket.id}});
|
||||
},
|
||||
formatTicket(ticket) {
|
||||
return {
|
||||
|
|
Loading…
Add table
Reference in a new issue