mirror of
https://gitlab.com/wgp/dougal/software.git
synced 2025-12-06 08:17:09 +00:00
@@ -36,7 +36,7 @@ async function refreshEvents ({commit, dispatch, state, rootState}, [modifiedAft
|
|||||||
|
|
||||||
/** Return a subset of events from state.events
|
/** Return a subset of events from state.events
|
||||||
*/
|
*/
|
||||||
async function getEvents ({commit, dispatch, state}, [projectId, {sequence, date0, date1, sortBy, sortDesc, itemsPerPage, page, text, label}]) {
|
async function getEvents ({commit, dispatch, state}, [projectId, {sequence, date0, date1, sortBy, sortDesc, itemsPerPage, page, text, label, excludeLabels}]) {
|
||||||
let filteredEvents = [...state.events];
|
let filteredEvents = [...state.events];
|
||||||
|
|
||||||
if (sortBy) {
|
if (sortBy) {
|
||||||
@@ -114,6 +114,10 @@ async function getEvents ({commit, dispatch, state}, [projectId, {sequence, date
|
|||||||
filteredEvents = filteredEvents.filter( event => event.labels?.includes(label) );
|
filteredEvents = filteredEvents.filter( event => event.labels?.includes(label) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (excludeLabels) {
|
||||||
|
filteredEvents = filteredEvents.filter( event => !excludeLabels?.some( label => event.labels?.includes(label) ) );
|
||||||
|
}
|
||||||
|
|
||||||
const count = filteredEvents.length;
|
const count = filteredEvents.length;
|
||||||
|
|
||||||
if (itemsPerPage && itemsPerPage > 0) {
|
if (itemsPerPage && itemsPerPage > 0) {
|
||||||
|
|||||||
@@ -494,17 +494,6 @@ export default {
|
|||||||
rows () {
|
rows () {
|
||||||
const rows = {};
|
const rows = {};
|
||||||
this.items
|
this.items
|
||||||
.filter(i => {
|
|
||||||
return !this.$route.params.sequence || (this.$route.params.sequence == i.sequence)
|
|
||||||
})
|
|
||||||
.filter(i => {
|
|
||||||
for (const label of this.filterableLabels) {
|
|
||||||
if (!this.shownLabels.includes(label) && i.labels.includes(label)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
})
|
|
||||||
.forEach(i => {
|
.forEach(i => {
|
||||||
const key = (i.sequence && i.point) ? (i.sequence+"@"+i.point) : i.tstamp;
|
const key = (i.sequence && i.point) ? (i.sequence+"@"+i.point) : i.tstamp;
|
||||||
if (!rows[key]) {
|
if (!rows[key]) {
|
||||||
@@ -535,6 +524,10 @@ export default {
|
|||||||
.sort( (a, b) => b[1]-a[1] );
|
.sort( (a, b) => b[1]-a[1] );
|
||||||
},
|
},
|
||||||
|
|
||||||
|
filteredLabels () {
|
||||||
|
return this.filterableLabels.filter( label => !this.shownLabels.includes(label) );
|
||||||
|
},
|
||||||
|
|
||||||
presetRemarks () {
|
presetRemarks () {
|
||||||
return this.projectConfiguration?.events?.presetRemarks ?? [];
|
return this.projectConfiguration?.events?.presetRemarks ?? [];
|
||||||
},
|
},
|
||||||
@@ -582,6 +575,10 @@ export default {
|
|||||||
this.fetchEvents();
|
this.fetchEvents();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
filteredLabels () {
|
||||||
|
this.fetchEvents();
|
||||||
|
},
|
||||||
|
|
||||||
itemsPerPage (newVal, oldVal) {
|
itemsPerPage (newVal, oldVal) {
|
||||||
localStorage.setItem(`dougal/prefs/${this.user?.name}/${this.$route.params.project}/${this.$options.name}/items-per-page`, newVal);
|
localStorage.setItem(`dougal/prefs/${this.user?.name}/${this.$route.params.project}/${this.$options.name}/items-per-page`, newVal);
|
||||||
},
|
},
|
||||||
@@ -638,8 +635,10 @@ export default {
|
|||||||
|
|
||||||
async fetchEvents (opts = {}) {
|
async fetchEvents (opts = {}) {
|
||||||
const options = {
|
const options = {
|
||||||
|
sequence: this.$route.params.sequence,
|
||||||
text: this.filter,
|
text: this.filter,
|
||||||
label: this.labelSearch,
|
label: this.labelSearch,
|
||||||
|
excludeLabels: this.filteredLabels,
|
||||||
...this.options
|
...this.options
|
||||||
};
|
};
|
||||||
const res = await this.getEvents([this.$route.params.project, options]);
|
const res = await this.getEvents([this.$route.params.project, options]);
|
||||||
|
|||||||
Reference in New Issue
Block a user