From 3a636f84567dc2fed479e0232e26b16346da448d Mon Sep 17 00:00:00 2001 From: Stefan Dej Date: Thu, 21 Mar 2024 18:32:17 +0100 Subject: [PATCH] WIP Signed-off-by: Stefan Dej --- .../HistoryListPanelDetailMaintenance.vue | 54 ++++- ...ListPanelDetailMaintenanceHistoryEntry.vue | 189 ++++++++++++++++++ ...oryListPanelDetailMaintenanceHistoryTr.vue | 168 ++++++++++++++++ .../History/HistoryListEntryMaintenance.vue | 1 - src/store/gui/maintenance/actions.ts | 1 + src/store/gui/maintenance/types.ts | 1 + 6 files changed, 411 insertions(+), 3 deletions(-) create mode 100644 src/components/dialogs/HistoryListPanelDetailMaintenanceHistoryEntry.vue create mode 100644 src/components/dialogs/HistoryListPanelDetailMaintenanceHistoryTr.vue diff --git a/src/components/dialogs/HistoryListPanelDetailMaintenance.vue b/src/components/dialogs/HistoryListPanelDetailMaintenance.vue index c1035523d..c1008575c 100644 --- a/src/components/dialogs/HistoryListPanelDetailMaintenance.vue +++ b/src/components/dialogs/HistoryListPanelDetailMaintenance.vue @@ -46,8 +46,36 @@ + + + + + + + + + + + + Date + {{ restFilamentText }} + {{ restPrinttimeText }} + {{ restDaysText }} + + + + + + + - + {{ $t('History.Cancel') }} @@ -63,9 +91,11 @@ import BaseMixin from '@/components/mixins/base' import Panel from '@/components/ui/Panel.vue' import { mdiAdjust, mdiAlarm, mdiCalendar, mdiCloseThick, mdiNotebook } from '@mdi/js' import { GuiMaintenanceStateEntry } from '@/store/gui/maintenance/types' +import HistoryListPanelDetailMaintenanceHistoryEntry from '@/components/dialogs/HistoryListPanelDetailMaintenanceHistoryEntry.vue' +import HistoryListPanelDetailMaintenanceHistoryTr from '@/components/dialogs/HistoryListPanelDetailMaintenanceHistoryTr.vue' @Component({ - components: { Panel }, + components: { Panel, HistoryListPanelDetailMaintenanceHistoryEntry, HistoryListPanelDetailMaintenanceHistoryTr }, }) export default class HistoryListPanelDetailMaintenance extends Mixins(BaseMixin) { mdiAdjust = mdiAdjust @@ -199,6 +229,26 @@ export default class HistoryListPanelDetailMaintenance extends Mixins(BaseMixin) return this.$t('History.Performed') } + get allEntries() { + return this.$store.getters['gui/maintenance/getEntries'] ?? [] + } + + get history() { + const array = [] + + let latest_entry_id = this.item.id + while (latest_entry_id) { + const entry = this.allEntries.find((entry: GuiMaintenanceStateEntry) => entry.id === latest_entry_id) + if (!entry) break + array.push(entry) + latest_entry_id = entry.last_entry + } + + window.console.log(array) + + return array + } + closeDialog() { this.$emit('close') } diff --git a/src/components/dialogs/HistoryListPanelDetailMaintenanceHistoryEntry.vue b/src/components/dialogs/HistoryListPanelDetailMaintenanceHistoryEntry.vue new file mode 100644 index 000000000..a781b5757 --- /dev/null +++ b/src/components/dialogs/HistoryListPanelDetailMaintenanceHistoryEntry.vue @@ -0,0 +1,189 @@ + + + diff --git a/src/components/dialogs/HistoryListPanelDetailMaintenanceHistoryTr.vue b/src/components/dialogs/HistoryListPanelDetailMaintenanceHistoryTr.vue new file mode 100644 index 000000000..377f96ce2 --- /dev/null +++ b/src/components/dialogs/HistoryListPanelDetailMaintenanceHistoryTr.vue @@ -0,0 +1,168 @@ + + + diff --git a/src/components/panels/History/HistoryListEntryMaintenance.vue b/src/components/panels/History/HistoryListEntryMaintenance.vue index 8d5037f98..df98df537 100644 --- a/src/components/panels/History/HistoryListEntryMaintenance.vue +++ b/src/components/panels/History/HistoryListEntryMaintenance.vue @@ -83,7 +83,6 @@ export default class HistoryListPanel extends Mixins(BaseMixin) { mdiAlarm = mdiAlarm mdiCalendar = mdiCalendar mdiDelete = mdiDelete - mdiNotebook = mdiNotebook mdiTextBoxSearch = mdiTextBoxSearch detailsDialogBool = false diff --git a/src/store/gui/maintenance/actions.ts b/src/store/gui/maintenance/actions.ts index 269599638..7b741a123 100644 --- a/src/store/gui/maintenance/actions.ts +++ b/src/store/gui/maintenance/actions.ts @@ -88,6 +88,7 @@ export const actions: ActionTree = { end_filament: null, start_printtime: totalPrintTime, end_printtime: null, + last_entry: payload.id, reminder: { ...entry.reminder }, }, diff --git a/src/store/gui/maintenance/types.ts b/src/store/gui/maintenance/types.ts index 9977a0c02..f2144a48e 100644 --- a/src/store/gui/maintenance/types.ts +++ b/src/store/gui/maintenance/types.ts @@ -14,6 +14,7 @@ export interface GuiMaintenanceStateEntry { end_filament: number | null start_printtime: number end_printtime: number | null + last_entry: string | null reminder: { type: null | 'one-time' | 'repeat'