From 455a3aa19489cfbcbdf740077e3274153d6448c4 Mon Sep 17 00:00:00 2001 From: Stefan Dej Date: Tue, 15 Feb 2022 23:34:15 +0100 Subject: [PATCH] feat: multiselect in history jobs (#509) select jobs to show stats only from this jobs and you can delete selected jobs from the history --- .../charts/HistoryAllPrintStatus.vue | 18 ++- src/components/panels/HistoryListPanel.vue | 83 +++++++++++-- .../panels/HistoryStatisticsPanel.vue | 110 ++++++++++++++---- src/locales/en.json | 7 +- src/plugins/vuetify.ts | 4 +- src/store/gui/index.ts | 1 + src/store/gui/types.ts | 2 + src/store/server/history/getters.ts | 103 +++++++++++----- src/store/server/history/types.ts | 16 +++ 9 files changed, 280 insertions(+), 64 deletions(-) diff --git a/src/components/charts/HistoryAllPrintStatus.vue b/src/components/charts/HistoryAllPrintStatus.vue index 8f27b9ab..054116ab 100644 --- a/src/components/charts/HistoryAllPrintStatus.vue +++ b/src/components/charts/HistoryAllPrintStatus.vue @@ -56,17 +56,29 @@ export default class HistoryAllPrintStatus extends Mixins(BaseMixin) { ], } + get selectedJobs() { + return this.$store.state.gui.view.history.selectedJobs ?? [] + } + get allPrintStatusArray() { return this.$store.getters['server/history/getAllPrintStatusArray'] } + get selectedPrintStatusArray() { + return this.$store.getters['server/history/getSelectedPrintStatusArray'] + } + + get printStatusArray() { + return this.selectedJobs.length ? this.selectedPrintStatusArray : this.allPrintStatusArray + } + get chart(): ECharts | null { const historyAllPrintStatus = this.$refs.historyAllPrintStatus return historyAllPrintStatus?.inst ?? null } mounted() { - this.chartOptions.series[0].data = this.allPrintStatusArray + this.chartOptions.series[0].data = this.printStatusArray this.chart?.setOption(this.chartOptions) window.addEventListener('resize', this.eventListenerResize) @@ -81,8 +93,8 @@ export default class HistoryAllPrintStatus extends Mixins(BaseMixin) { if (this.chart) this.chart.dispose() } - @Watch('allPrintStatusArray') - allPrintStatusArrayChanged(newVal: any) { + @Watch('printStatusArray') + printStatusArrayChanged(newVal: any) { this.chart?.setOption({ series: { data: newVal, diff --git a/src/components/panels/HistoryListPanel.vue b/src/components/panels/HistoryListPanel.vue index 43a6b2f2..a407c7dc 100644 --- a/src/components/panels/HistoryListPanel.vue +++ b/src/components/panels/HistoryListPanel.vue @@ -1,3 +1,11 @@ + +