Skip to content

Commit 6b768ae

Browse files
core: frontend: components: SettingsMenu: Add confirmation dialog for reset settings
Signed-off-by: Patrick José Pereira <patrickelectric@gmail.com>
1 parent dea2305 commit 6b768ae

File tree

1 file changed

+38
-1
lines changed

1 file changed

+38
-1
lines changed

core/frontend/src/components/app/SettingsMenu.vue

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
<v-btn
4444
v-tooltip="'Restores BlueOS services to default configurations'"
4545
class="ma-2"
46-
@click="reset_settings"
46+
@click="confirm_reset_settings"
4747
>
4848
<v-icon left>
4949
mdi-cog-refresh
@@ -158,6 +158,36 @@
158158
</v-card>
159159
</v-card>
160160
</v-dialog>
161+
<v-dialog
162+
v-model="show_reset_warning"
163+
width="fit-content"
164+
@click:outside="show_reset_warning = false"
165+
@keydown.esc="show_reset_warning = false"
166+
>
167+
<v-sheet
168+
color="warning"
169+
outlined
170+
>
171+
<v-card variant="outlined">
172+
<v-card-title class="align-center">
173+
WARNING
174+
</v-card-title>
175+
<v-card-text class="reset-warning-text">
176+
Resetting will restore BlueOS services to their default configurations.
177+
This action cannot be undone. Proceed?
178+
</v-card-text>
179+
<v-card-actions>
180+
<v-btn color="primary" @click="show_reset_warning = false">
181+
Cancel
182+
</v-btn>
183+
<v-spacer />
184+
<v-btn color="warning" @click="reset_settings(); show_reset_warning = false">
185+
Yes, reset settings
186+
</v-btn>
187+
</v-card-actions>
188+
</v-card>
189+
</v-sheet>
190+
</v-dialog>
161191
<v-dialog
162192
width="380"
163193
:value="show_reset_dialog"
@@ -201,6 +231,7 @@ export default Vue.extend({
201231
mavlink_log_folder_size: null as null | string,
202232
show_dialog: false,
203233
show_reset_dialog: false,
234+
show_reset_warning: false,
204235
operation_in_progress: false,
205236
operation_description: '',
206237
operation_error: undefined as undefined | string,
@@ -286,6 +317,9 @@ export default Vue.extend({
286317
})
287318
this.operation_in_progress = false
288319
},
320+
confirm_reset_settings(): void {
321+
this.show_reset_warning = true
322+
},
289323
async reset_settings(): Promise<void> {
290324
this.prepare_operation('Resetting settings...')
291325
@@ -410,4 +444,7 @@ export default Vue.extend({
410444
backdrop-filter: blur(2px);
411445
z-index: 9999 !important;
412446
}
447+
.reset-warning-text {
448+
max-width: 30rem;
449+
}
413450
</style>

0 commit comments

Comments
 (0)