diff --git a/src/components/gcodeviewer/Viewer.vue b/src/components/gcodeviewer/Viewer.vue index 4181ffa6..35ec7a12 100644 --- a/src/components/gcodeviewer/Viewer.vue +++ b/src/components/gcodeviewer/Viewer.vue @@ -39,15 +39,11 @@ - + - - - - mdi-stack-overflow{{ $t('Heightmap.Profiles') }} - - + @@ -199,6 +159,7 @@ import { createComponent } from 'echarts-for-vue' import * as echarts from 'echarts' import {ECharts} from 'echarts/core' import 'echarts-gl' +import Panel from '@/components/ui/Panel.vue' interface HeightmapSerie { type: string @@ -216,6 +177,7 @@ interface HeightmapSerie { @Component({ components: { + Panel, ECharts: createComponent({ echarts }), } }) diff --git a/src/pages/History.vue b/src/pages/History.vue index 8d1923fa..f74e9f30 100644 --- a/src/pages/History.vue +++ b/src/pages/History.vue @@ -6,63 +6,10 @@
- - - - mdi-chart-areaspline{{ $t('History.Statistics') }} - - - - - - - - - {{ $t('History.TotalPrinttime') }} - {{ formatPrintTime(totalPrintTime) }} - - - {{ $t('History.LongestPrinttime') }} - {{ formatPrintTime(longestPrintTime) }} - - - {{ $t('History.AvgPrinttime') }} - {{ formatPrintTime(avgPrintTime) }} - - - {{ $t('History.TotalFilamentUsed') }} - {{ Math.round(totalFilamentUsed / 100) / 10 }} m - - - {{ $t('History.TotalJobs') }} - {{ totalJobsCount }} - - - - - - - - - - -
- - - {{ $t('History.FilamentUsage') }} - - - {{ $t('History.PrinttimeAvg') }} - - -
-
-
-
-
+
- + @@ -74,63 +21,15 @@ import {Component, Mixins} from 'vue-property-decorator' import BaseMixin from '@/components/mixins/base' -import HistoryAllPrintStatus from '@/components/charts/HistoryAllPrintStatus.vue' -import HistoryPrinttimeAvg from '@/components/charts/HistoryPrinttimeAvg.vue' -import HistoryFilamentUsage from '@/components/charts/HistoryFilamentUsage.vue' import HistoryListPanel from '@/components/panels/HistoryListPanel.vue' +import HistoryStatisticsPanel from '@/components/panels/HistoryStatisticsPanel.vue' @Component({ - components: {HistoryListPanel, HistoryFilamentUsage, HistoryPrinttimeAvg, HistoryAllPrintStatus} + components: { + HistoryStatisticsPanel, + HistoryListPanel + } }) export default class PageHistory extends Mixins(BaseMixin) { - get totalPrintTime() { - return 'total_print_time' in this.$store.state.server.history.job_totals ? this.$store.state.server.history.job_totals.total_print_time : 0 - } - - get longestPrintTime() { - return 'longest_print' in this.$store.state.server.history.job_totals ? this.$store.state.server.history.job_totals.longest_print : 0 - } - - get avgPrintTime() { - if (this.totalJobsCount > 0 && this.totalPrintTime > 0) return Math.round(this.totalPrintTime / this.totalJobsCount) - - return 0 - } - - get totalFilamentUsed() { - return 'total_filament_used' in this.$store.state.server.history.job_totals ? this.$store.state.server.history.job_totals.total_filament_used : 0 - } - - get totalJobsCount() { - return 'total_jobs' in this.$store.state.server.history.job_totals ? this.$store.state.server.history.job_totals.total_jobs : 0 - } - - get toggleChart () { - return this.$store.state.gui.history.toggleChartCol3 - } - - set toggleChart(newVal) { - this.$store.dispatch('gui/saveSetting', { name: 'history.toggleChartCol3', value: newVal }) - } - - formatPrintTime(totalSeconds: number) { - if (totalSeconds) { - let output = '' - - const hours = Math.floor(totalSeconds / 3600) - totalSeconds %= 3600 - if (hours) output += ' '+hours+'h' - - const minutes = Math.floor(totalSeconds / 60) - if (minutes) output += ' '+minutes+'m' - - const seconds = totalSeconds % 60 - if (seconds) output += ' '+seconds.toFixed(0)+'s' - - return output - } - - return '--' - } } diff --git a/src/store/gui/actions.ts b/src/store/gui/actions.ts index e1705ae2..746aed5e 100644 --- a/src/store/gui/actions.ts +++ b/src/store/gui/actions.ts @@ -191,6 +191,16 @@ export const actions: ActionTree = { } }, + saveExpandPanel({ commit, dispatch, state }, payload) { + if (!payload.value) commit('addClosePanel', { name: payload.name }) + else commit('removeClosePanel', { name: payload.name }) + + dispatch('updateSettings', { + keyName: 'dashboard.nonExpandPanels', + newVal: state.dashboard.nonExpandPanels + }) + }, + showStatusInHistoryList({ commit, dispatch, state }, name) { const array: string[] = [...state.history.hidePrintStatus] diff --git a/src/store/gui/getters.ts b/src/store/gui/getters.ts index c7a2e0cb..30aa91fa 100644 --- a/src/store/gui/getters.ts +++ b/src/store/gui/getters.ts @@ -102,5 +102,9 @@ export const getters: GetterTree = { return 0 }) + }, + + getPanelExpand: (state) => (name: string) => { + return !state.dashboard.nonExpandPanels?.includes(name) ?? true } } diff --git a/src/store/gui/index.ts b/src/store/gui/index.ts index 3cae369f..0ecdfb3d 100644 --- a/src/store/gui/index.ts +++ b/src/store/gui/index.ts @@ -89,7 +89,8 @@ export const getDefaultState = (): GuiState => { widescreenLayout3: [ { 'name': 'webcam', visable: true }, { 'name': 'miniconsole', visable: true }, - ] + ], + nonExpandPanels: [] }, webcam: { selectedCam: '', diff --git a/src/store/gui/mutations.ts b/src/store/gui/mutations.ts index 7ff30698..143739ec 100644 --- a/src/store/gui/mutations.ts +++ b/src/store/gui/mutations.ts @@ -152,5 +152,15 @@ export const mutations: MutationTree = { setHistoryHidePrintStatus(state, payload) { Vue.set(state.history, 'hidePrintStatus', payload) + }, + + addClosePanel(state, payload) { + const exist = state.dashboard.nonExpandPanels?.includes(payload.name) ?? false + if (!exist) state.dashboard.nonExpandPanels.push(payload.name) + }, + + removeClosePanel(state, payload) { + const index = state.dashboard.nonExpandPanels.indexOf(payload.name) + if (index > -1) state.dashboard.nonExpandPanels.splice(index, 1) } } diff --git a/src/store/server/actions.ts b/src/store/server/actions.ts index b048ff53..5b585525 100644 --- a/src/store/server/actions.ts +++ b/src/store/server/actions.ts @@ -62,7 +62,8 @@ export const actions: ActionTree = { }, initProcStats({ commit }, payload) { - commit('setThrottledState', payload.throttled_state) + if (payload.throttled_state !== null) + commit('setThrottledState', payload.throttled_state) }, setKlippyReady({ dispatch }) {