Skip to content

Commit

Permalink
new button to force load the default theme
Browse files Browse the repository at this point in the history
  • Loading branch information
HelgeKeck committed Aug 18, 2024
1 parent 178faba commit 15d7be5
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 1 deletion.
32 changes: 31 additions & 1 deletion src/components/settings/GeneralSettings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -291,10 +291,20 @@
outlined
small
color="primary"
class="mr-2"
@click="uploadSettingsFile.click()"
>
{{ $t('app.setting.btn.restore') }}
</app-btn>

<app-btn
outlined
small
color="primary"
@click="handleDefaultSettings"
>
{{ $t('app.setting.btn.default') }}
</app-btn>
</app-setting>
</v-card>

Expand All @@ -312,7 +322,7 @@
import { Component, Mixins, Ref } from 'vue-property-decorator'
import StateMixin from '@/mixins/state'
import type { VInput } from '@/types'
import { SupportedLocales, DateFormats, TimeFormats } from '@/globals'
import { SupportedLocales, DateFormats, TimeFormats, Globals } from '@/globals'
import type { OutputPin } from '@/store/printer/types'
import type { Device } from '@/store/power/types'
import type { PrintEtaCalculation, PrintInProgressLayout, PrintProgressCalculation } from '@/store/config/types'
Expand All @@ -321,6 +331,7 @@ import consola from 'consola'
import { readFileAsTextAsync } from '@/util/file-system-entry'
import { EventBus } from '@/eventBus'
import { isFluiddContent, toFluiddContent } from '@/util/fluidd-content'
import { appInit } from '@/init'
@Component({
components: {}
Expand Down Expand Up @@ -678,6 +689,25 @@ export default class GeneralSettings extends Mixins(StateMixin) {
}
}
async handleDefaultSettings () {
try {
await httpClientActions.serverDatabaseItemDelete(Globals.MOONRAKER_DB.fluidd.NAMESPACE, Globals.MOONRAKER_DB.fluidd.ROOTS.charts.name)
await httpClientActions.serverDatabaseItemDelete(Globals.MOONRAKER_DB.fluidd.NAMESPACE, Globals.MOONRAKER_DB.fluidd.ROOTS.console.name)
await httpClientActions.serverDatabaseItemDelete(Globals.MOONRAKER_DB.fluidd.NAMESPACE, Globals.MOONRAKER_DB.fluidd.ROOTS.layout.name)
await httpClientActions.serverDatabaseItemDelete(Globals.MOONRAKER_DB.fluidd.NAMESPACE, Globals.MOONRAKER_DB.fluidd.ROOTS.macros.name)
await httpClientActions.serverDatabaseItemDelete(Globals.MOONRAKER_DB.fluidd.NAMESPACE, Globals.MOONRAKER_DB.fluidd.ROOTS.uiSettings.name)
const instance = this.$store.getters['config/getCurrentInstance']
const config = await appInit(instance, this.$store.state.config.hostConfig)
if (config.apiConnected && config.apiAuthenticated) {
consola.debug('Activating socket with config', config)
this.$socket.connect(config.apiConfig.socketUrl)
}
} catch (e) {
console.error('handleDefaultSettings failed ' + e)
consola.error('handleDefaultSettings failed', e)
}
}
async handleRestoreSettings () {
try {
if (this.uploadSettingsFile?.files?.length === 1) {
Expand Down
1 change: 1 addition & 0 deletions src/locales/en.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -531,6 +531,7 @@ app:
backup: Backup
reset: Reset
restore: Restore
default: Default
select_theme: Select Theme
camera_type_options:
mjpegadaptive: MJPEG Adaptive
Expand Down

0 comments on commit 15d7be5

Please sign in to comment.