Skip to content

Commit 4f0ae29

Browse files
Add confirm to maintenance mode
1 parent 3ad246c commit 4f0ae29

File tree

1 file changed

+38
-1
lines changed

1 file changed

+38
-1
lines changed

frontend/kubecloud-v2/pages/admin/system.vue

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,34 @@
5555
prepend-icon="mdi-wrench"
5656
:text="isEnabled ? 'Disable Maintenance Mode' : 'Enable Maintenance Mode'"
5757
:loading="isLoading || isLoadingEnabled"
58-
@click="toggleMaintenanceMode()"
58+
@click="confirmToggleMaintenanceMode()"
5959
/>
6060
</v-card>
61+
62+
<v-dialog :model-value="isRevealed" max-width="500" scrollable @update:model-value="cancel()">
63+
<v-card :style="{ padding: '0 !important' }">
64+
<v-card-title class="px-6 py-4">
65+
<div class="d-flex align-center justify-space-between">
66+
<h3 class="text-h5 font-weight-bold">Enable Maintenance Mode</h3>
67+
</div>
68+
</v-card-title>
69+
70+
<v-divider />
71+
72+
<v-card-text>
73+
<p class="text-body-1 opacity-70">
74+
Enabling maintenance mode will temporarily restrict access to the platform. Are you sure
75+
you want to continue?
76+
</p>
77+
</v-card-text>
78+
<v-divider />
79+
80+
<v-card-actions class="px-6 py-4 flex-row-reverse justify-start">
81+
<v-btn variant="text" color="error" @click="confirm()">Enable</v-btn>
82+
<v-btn variant="plain" @click="cancel()">Cancel</v-btn>
83+
</v-card-actions>
84+
</v-card>
85+
</v-dialog>
6186
</div>
6287
</template>
6388

@@ -77,4 +102,16 @@ const { execute: toggleMaintenanceMode, isLoading } = useAsyncState(
77102
null,
78103
{ immediate: false }
79104
)
105+
106+
const { isRevealed, reveal, cancel, confirm } = useDialog()
107+
async function confirmToggleMaintenanceMode() {
108+
if (!isEnabled.value) {
109+
const { isCanceled } = await reveal()
110+
if (isCanceled) {
111+
return
112+
}
113+
}
114+
115+
await toggleMaintenanceMode()
116+
}
80117
</script>

0 commit comments

Comments
 (0)