253253 small
254254 :disabled =" disable_remove || deletion_in_progress"
255255 color =" error"
256- @click =" remove_service_log_files "
256+ @click =" show_log_clear_confirm = true; pending_log_clear_type = 'service' "
257257 >
258258 <v-icon left small >
259259 mdi-trash-can
322322 small
323323 :disabled =" disable_remove_mavlink"
324324 color =" error"
325- @click =" remove_mavlink_log_files "
325+ @click =" show_log_clear_confirm = true; pending_log_clear_type = 'mavlink' "
326326 >
327327 <v-icon left small >
328328 mdi-trash-can
453453 @confirm =" onConfirmResetSettings"
454454 />
455455
456+ <warning-dialog
457+ v-model =" show_log_clear_confirm"
458+ :title =" log_clear_confirm_title"
459+ :message =" log_clear_confirm_message"
460+ confirm-label =" Clear logs"
461+ @confirm =" onConfirmClearLogs"
462+ />
463+
456464 <v-dialog width =" 400" :value =" show_reset_dialog" @input =" show_reset_dialog = false" >
457465 <v-card >
458466 <v-card-title class =" text-h6" >
@@ -511,6 +519,8 @@ export default Vue.extend({
511519 mavlink_log_folder_size: null as null | string ,
512520 show_reset_dialog: false ,
513521 show_reset_warning: false ,
522+ show_log_clear_confirm: false ,
523+ pending_log_clear_type: null as null | ' service' | ' mavlink' ,
514524 show_error: false ,
515525 operation_in_progress: false ,
516526 operation_description: ' ' ,
@@ -534,6 +544,15 @@ export default Vue.extend({
534544 + ' This action cannot be undone. Proceed?'
535545 )
536546 },
547+ log_clear_confirm_title(): string {
548+ return this .pending_log_clear_type === ' mavlink' ? ' Clear MAVLink logs?' : ' Clear system logs?'
549+ },
550+ log_clear_confirm_message(): string {
551+ if (this .pending_log_clear_type === ' mavlink' ) {
552+ return ' All MAVLink (autopilot flight) logs will be permanently deleted. This action cannot be undone.'
553+ }
554+ return ' All BlueOS service logs will be permanently deleted. This action cannot be undone.'
555+ },
537556 log_size_warning(): boolean {
538557 const one_hundred_MB = 100 * 2 ** 20
539558 return this .log_size_bytes >= one_hundred_MB
@@ -617,6 +636,14 @@ export default Vue.extend({
617636 this .reset_settings ()
618637 },
619638
639+ onConfirmClearLogs(): void {
640+ if (this .pending_log_clear_type === ' service' ) {
641+ this .remove_service_log_files ()
642+ } else if (this .pending_log_clear_type === ' mavlink' ) {
643+ this .remove_mavlink_log_files ()
644+ }
645+ },
646+
620647 async reset_settings(): Promise <void > {
621648 this .prepare_operation (' Resetting settings...' )
622649
@@ -686,6 +713,8 @@ export default Vue.extend({
686713 this .current_deletion_path = ' '
687714 this .current_deletion_size = 0
688715 this .current_deletion_status = ' '
716+ this .show_log_clear_confirm = false
717+ this .pending_log_clear_type = null
689718 }
690719
691720 this .get_log_folder_size ()
@@ -710,7 +739,11 @@ export default Vue.extend({
710739 this .show_error = true
711740 notifier .pushBackError (' REMOVE_MAVLINK_LOG_FAIL' , error )
712741 })
713- this .operation_in_progress = false
742+ .finally (() => {
743+ this .operation_in_progress = false
744+ this .show_log_clear_confirm = false
745+ this .pending_log_clear_type = null
746+ })
714747 },
715748
716749 async enable_wizard(): Promise <void > {
0 commit comments