fix: ignore wrong default.json file while resetting moonraker db (#1829)
This commit is contained in:
@@ -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')
|
||||
|
@@ -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() {
|
||||
|
@@ -236,11 +236,13 @@ export const actions: ActionTree<GuiState, RootState> = {
|
||||
|
||||
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) {
|
||||
|
Reference in New Issue
Block a user