Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: ignore wrong default.json file while resetting moonraker db #1829

Merged
merged 2 commits into from
Apr 27, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
21 changes: 11 additions & 10 deletions src/components/settings/General/GeneralReset.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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
meteyou marked this conversation as resolved.
Show resolved Hide resolved

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() {
Expand Down
10 changes: 6 additions & 4 deletions src/store/gui/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Loading