diff --git a/src/components/panels/Machine/LogfilesPanel/LogfilesPanelRolloverDialog.vue b/src/components/panels/Machine/LogfilesPanel/LogfilesPanelRolloverDialog.vue index 2cbb1edab..61ef2eff7 100644 --- a/src/components/panels/Machine/LogfilesPanel/LogfilesPanelRolloverDialog.vue +++ b/src/components/panels/Machine/LogfilesPanel/LogfilesPanelRolloverDialog.vue @@ -65,7 +65,7 @@ export default class LogfilesPanelRolloverDialog extends Mixins(BaseMixin) { selectedRolloverLogs: string[] = [] get loadingRolloverLogs() { - return this.loadings.filter((log) => log.startsWith('rolloverLog_')).length > 0 + return this.loadings.filter((log) => log?.startsWith('rolloverLog_')).length > 0 } @Watch('loadingRolloverLogs') diff --git a/src/components/settings/General/GeneralReset.vue b/src/components/settings/General/GeneralReset.vue index d2553a1be..5f46670fa 100644 --- a/src/components/settings/General/GeneralReset.vue +++ b/src/components/settings/General/GeneralReset.vue @@ -85,17 +85,18 @@ export default class SettingsGeneralTabResetDatabase extends Mixins(BaseMixin, S async loadResetableNamespaces() { this.resetableNamespaces = await this.loadBackupableNamespaces() - if (this.moonrakerComponents.includes('history')) { - this.resetableNamespaces.push({ - value: 'history_jobs', - label: this.$t('Settings.GeneralTab.DbHistoryJobs'), - }) + // stop if history is not enabled + if (!this.moonrakerComponents.includes('history')) return - this.resetableNamespaces.push({ - value: 'history_totals', - label: this.$t('Settings.GeneralTab.DbHistoryTotals'), - }) - } + this.resetableNamespaces.push({ + value: 'history_jobs', + label: this.$t('Settings.GeneralTab.DbHistoryJobs'), + }) + + this.resetableNamespaces.push({ + value: 'history_totals', + label: this.$t('Settings.GeneralTab.DbHistoryTotals'), + }) } closeDialog() { diff --git a/src/store/gui/actions.ts b/src/store/gui/actions.ts index ea4dd7363..1902d6e8a 100644 --- a/src/store/gui/actions.ts +++ b/src/store/gui/actions.ts @@ -236,11 +236,13 @@ export const actions: ActionTree = { const urlDefault = rootGetters['socket/getUrl'] + '/server/files/config/' + themeDir + '/default.json?time=' + Date.now() - const responseDefault = await fetch(urlDefault) + let defaults: any = {} - if (responseDefault) { - defaults = await responseDefault.json() - if (defaults.error?.code === 404) defaults = {} + try { + defaults = await fetch(urlDefault).then((result) => result.json()) + } catch (error) { + window.console.error('Error while fetching/parsing default.json', error) + defaults = {} } for (const key of payload) {