diff --git a/src/components/charts/HistoryAllPrintStatus.vue b/src/components/charts/HistoryAllPrintStatusChart.vue similarity index 95% rename from src/components/charts/HistoryAllPrintStatus.vue rename to src/components/charts/HistoryAllPrintStatusChart.vue index 910acdfd..786edd4f 100644 --- a/src/components/charts/HistoryAllPrintStatus.vue +++ b/src/components/charts/HistoryAllPrintStatusChart.vue @@ -5,7 +5,7 @@ :option="chartOptions" :autoresize="true" :init-options="{ renderer: 'svg' }" - style="height: 250px; width: 100%"> + style="height: 200px; width: 100%"> diff --git a/src/components/panels/HistoryStatisticsPanel.vue b/src/components/panels/HistoryStatisticsPanel.vue index ff46db50..8e9261c6 100644 --- a/src/components/panels/HistoryStatisticsPanel.vue +++ b/src/components/panels/HistoryStatisticsPanel.vue @@ -57,11 +57,23 @@ - + + +
+ + + {{ $t('History.Chart') }} + + + {{ $t('History.Table') }} + + +
- +
@@ -84,11 +96,11 @@ import BaseMixin from '@/components/mixins/base' import Panel from '@/components/ui/Panel.vue' import HistoryFilamentUsage from '@/components/charts/HistoryFilamentUsage.vue' import HistoryPrinttimeAvg from '@/components/charts/HistoryPrinttimeAvg.vue' -import HistoryAllPrintStatus from '@/components/charts/HistoryAllPrintStatus.vue' +import HistoryAllPrintStatusChart from '@/components/charts/HistoryAllPrintStatusChart.vue' import { ServerHistoryStateJob } from '@/store/server/history/types' import { mdiChartAreaspline } from '@mdi/js' @Component({ - components: { Panel, HistoryFilamentUsage, HistoryPrinttimeAvg, HistoryAllPrintStatus }, + components: { Panel, HistoryFilamentUsage, HistoryPrinttimeAvg, HistoryAllPrintStatusChart }, }) export default class HistoryStatisticsPanel extends Mixins(BaseMixin) { mdiChartAreaspline = mdiChartAreaspline @@ -177,6 +189,14 @@ export default class HistoryStatisticsPanel extends Mixins(BaseMixin) { this.$store.dispatch('gui/saveSetting', { name: 'view.history.toggleChartCol3', value: newVal }) } + get togglePrintStatus() { + return this.$store.state.gui.view.history.toggleChartCol2 + } + + set togglePrintStatus(newVal) { + this.$store.dispatch('gui/saveSetting', { name: 'view.history.toggleChartCol2', value: newVal }) + } + formatPrintTime(totalSeconds: number) { if (totalSeconds) { let output = '' diff --git a/src/locales/en.json b/src/locales/en.json index 95d7b16c..936d869b 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -303,6 +303,7 @@ "AvgPrinttime": "Print Time - Ø", "Cancel": "Cancel", "CreateNote": "Create Note", + "Chart": "Chart", "Delete": "Delete", "DeleteSelectedQuestion": "Do you really want to delete {count} selected jobs?", "Details": "Details", @@ -354,6 +355,7 @@ "Others": "Others", "server_exit": "Server exit" }, + "Table": "Table", "TitleExportHistory": "Export History", "TitleRefreshHistory": "Refresh History", "TitleSettings": "Settings", diff --git a/src/store/gui/index.ts b/src/store/gui/index.ts index 3a604638..5cb78526 100644 --- a/src/store/gui/index.ts +++ b/src/store/gui/index.ts @@ -199,6 +199,7 @@ export const getDefaultState = (): GuiState => { }, history: { countPerPage: 10, + toggleChartCol2: 'chart', toggleChartCol3: 'filament_usage', hidePrintStatus: [], hideColums: [ diff --git a/src/store/gui/types.ts b/src/store/gui/types.ts index fbac2b52..c5520221 100644 --- a/src/store/gui/types.ts +++ b/src/store/gui/types.ts @@ -138,6 +138,7 @@ export interface GuiState { } history: { countPerPage: number + toggleChartCol2: 'chart' | 'table' toggleChartCol3: string hidePrintStatus: string[] hideColums: string[] diff --git a/src/store/server/history/getters.ts b/src/store/server/history/getters.ts index 821d6869..89f38fa7 100644 --- a/src/store/server/history/getters.ts +++ b/src/store/server/history/getters.ts @@ -66,9 +66,8 @@ export const getters: GetterTree = { : 0 }, - getAllPrintStatusArray(state, getters, rootState) { + getAllPrintStatusArrayAll(state, getters, rootState) { const output: ServerHistoryStateAllPrintStatusEntry[] = [] - const totalCount = state.jobs.length state.jobs.forEach((current) => { const index = output.findIndex((element) => element.name === current.status) @@ -113,6 +112,13 @@ export const getters: GetterTree = { } }) + return output + }, + + getAllPrintStatusArray(state, getters) { + const output: ServerHistoryStateAllPrintStatusEntry[] = [...getters.getAllPrintStatusArrayAll] + const totalCount = state.jobs.length + const otherLimit = totalCount * 0.05 const others = output.filter((entry) => entry.value < otherLimit) if (others.length > 1) {