|
8 | 8 | dense |
9 | 9 | class="mb-4" |
10 | 10 | > |
11 | | - <app-setting |
12 | | - :title="$t('app.setting.label.confirm_dirty_editor_close')" |
13 | | - > |
| 11 | + <app-setting :title="$t('app.setting.label.confirm_dirty_editor_close')"> |
14 | 12 | <v-switch |
15 | 13 | v-model="confirmDirtyEditorClose" |
16 | 14 | hide-details |
|
36 | 34 |
|
37 | 35 | <v-divider /> |
38 | 36 |
|
39 | | - <app-setting |
40 | | - :title="$t('app.setting.label.save_and_restore_view_state')" |
41 | | - > |
| 37 | + <app-setting :title="$t('app.setting.label.save_and_restore_view_state')"> |
42 | 38 | <v-select |
43 | 39 | v-model="restoreViewState" |
44 | 40 | filled |
|
50 | 46 |
|
51 | 47 | <v-divider /> |
52 | 48 |
|
53 | | - <app-setting |
54 | | - :title="$t('app.setting.label.show_code_lens')" |
55 | | - > |
| 49 | + <app-setting :title="$t('app.setting.label.show_code_lens')"> |
56 | 50 | <v-switch |
57 | 51 | v-model="codeLens" |
58 | 52 | hide-details |
|
62 | 56 |
|
63 | 57 | <v-divider /> |
64 | 58 |
|
| 59 | + <app-setting :title="$t('app.setting.label.klipper_save_and_restart_action')"> |
| 60 | + <v-select |
| 61 | + v-model="klipperSaveAndRestartAction" |
| 62 | + filled |
| 63 | + dense |
| 64 | + hide-details="auto" |
| 65 | + :items="availableKlipperSaveAndRestartActions" |
| 66 | + /> |
| 67 | + </app-setting> |
| 68 | + |
| 69 | + <v-divider /> |
| 70 | + |
65 | 71 | <app-setting :title="$t('app.setting.label.reset')"> |
66 | 72 | <app-btn |
67 | 73 | outlined |
|
80 | 86 | import { Component, Mixins } from 'vue-property-decorator' |
81 | 87 | import StateMixin from '@/mixins/state' |
82 | 88 | import { defaultState } from '@/store/config/state' |
83 | | -import type { RestoreViewState } from '@/store/config/types' |
| 89 | +import type { KlipperSaveAndRestartAction, RestoreViewState } from '@/store/config/types' |
84 | 90 |
|
85 | | -@Component({ |
86 | | - components: {} |
87 | | -}) |
| 91 | +@Component({}) |
88 | 92 | export default class FileEditorSettings extends Mixins(StateMixin) { |
89 | 93 | get confirmDirtyEditorClose (): boolean { |
90 | 94 | return this.$typedState.config.uiSettings.editor.confirmDirtyEditorClose |
@@ -153,6 +157,35 @@ export default class FileEditorSettings extends Mixins(StateMixin) { |
153 | 157 | }) |
154 | 158 | } |
155 | 159 |
|
| 160 | + get klipperSaveAndRestartAction (): KlipperSaveAndRestartAction { |
| 161 | + return this.$typedState.config.uiSettings.editor.klipperSaveAndRestartAction |
| 162 | + } |
| 163 | +
|
| 164 | + set klipperSaveAndRestartAction (value: KlipperSaveAndRestartAction) { |
| 165 | + this.$typedDispatch('config/saveByPath', { |
| 166 | + path: 'uiSettings.editor.klipperSaveAndRestartAction', |
| 167 | + value, |
| 168 | + server: true |
| 169 | + }) |
| 170 | + } |
| 171 | +
|
| 172 | + get availableKlipperSaveAndRestartActions (): { value: KlipperSaveAndRestartAction, text: string }[] { |
| 173 | + return [ |
| 174 | + { |
| 175 | + value: 'firmware-restart', |
| 176 | + text: this.$tc('app.setting.label.firmware_restart') |
| 177 | + }, |
| 178 | + { |
| 179 | + value: 'host-restart', |
| 180 | + text: this.$tc('app.setting.label.host_restart') |
| 181 | + }, |
| 182 | + { |
| 183 | + value: 'service-restart', |
| 184 | + text: this.$tc('app.setting.label.service_restart') |
| 185 | + } |
| 186 | + ] |
| 187 | + } |
| 188 | +
|
156 | 189 | handleReset () { |
157 | 190 | this.$typedDispatch('config/saveByPath', { |
158 | 191 | path: 'uiSettings.editor', |
|
0 commit comments