blob: fd1cb78cbb0725220306cec533f025439c1b6d36 [file] [log] [blame]
Yoshie Muranakaf415a082020-12-07 13:04:11 -08001<template>
2 <b-modal
3 id="modal-confirmation"
4 ref="modal"
5 :title="$t('pageDumps.modal.initiateSystemDump')"
6 @hidden="resetForm"
7 >
8 <p>
9 <strong>
10 {{ $t('pageDumps.modal.initiateSystemDumpMessage1') }}
11 </strong>
12 </p>
13 <p>
14 {{ $t('pageDumps.modal.initiateSystemDumpMessage2') }}
15 </p>
16 <p>
17 <status-icon status="danger" />
18 {{ $t('pageDumps.modal.initiateSystemDumpMessage3') }}
19 </p>
Surya Vde23ea22024-07-11 15:19:46 +053020 <b-form-checkbox v-model="confirmed" @input="v$.confirmed.$touch()">
Yoshie Muranakaf415a082020-12-07 13:04:11 -080021 {{ $t('pageDumps.modal.initiateSystemDumpMessage4') }}
22 </b-form-checkbox>
23 <b-form-invalid-feedback
Surya Vde23ea22024-07-11 15:19:46 +053024 :state="getValidationState(v$.confirmed)"
Yoshie Muranakaf415a082020-12-07 13:04:11 -080025 role="alert"
26 >
27 {{ $t('global.form.required') }}
28 </b-form-invalid-feedback>
29 <template #modal-footer="{ cancel }">
30 <b-button variant="secondary" @click="cancel()">
31 {{ $t('global.action.cancel') }}
32 </b-button>
33 <b-button variant="danger" @click="handleSubmit">
34 {{ $t('pageDumps.form.initiateDump') }}
35 </b-button>
36 </template>
37 </b-modal>
38</template>
39
40<script>
41import StatusIcon from '@/components/Global/StatusIcon';
42import VuelidateMixin from '@/components/Mixins/VuelidateMixin.js';
Ed Tanous7d6b44c2024-03-23 14:56:34 -070043import { useVuelidate } from '@vuelidate/core';
Paul Fertser6e53b142025-01-21 16:19:36 +000044import { useI18n } from 'vue-i18n';
Yoshie Muranakaf415a082020-12-07 13:04:11 -080045
46export default {
47 components: { StatusIcon },
48 mixins: [VuelidateMixin],
tiwari-nishante1420032025-09-01 12:11:14 +053049 props: {
50 requireConfirmation: {
51 type: Boolean,
52 default: false,
53 },
54 },
Ed Tanous7d6b44c2024-03-23 14:56:34 -070055 setup() {
56 return {
57 v$: useVuelidate(),
58 };
59 },
Yoshie Muranakaf415a082020-12-07 13:04:11 -080060 data() {
61 return {
Paul Fertser6e53b142025-01-21 16:19:36 +000062 $t: useI18n().t,
Yoshie Muranakaf415a082020-12-07 13:04:11 -080063 confirmed: false,
tiwari-nishante1420032025-09-01 12:11:14 +053064 isOpen: this.requireConfirmation,
Yoshie Muranakaf415a082020-12-07 13:04:11 -080065 };
66 },
tiwari-nishante1420032025-09-01 12:11:14 +053067 validations() {
68 return this.isOpen
69 ? {
70 confirmed: {
71 mustBeTrue: (value) => value === true,
72 },
73 }
74 : {};
Yoshie Muranakaf415a082020-12-07 13:04:11 -080075 },
76 methods: {
77 closeModal() {
78 this.$nextTick(() => {
79 this.$refs.modal.hide();
80 });
81 },
82 handleSubmit() {
Surya Vde23ea22024-07-11 15:19:46 +053083 this.v$.$touch();
84 if (this.v$.$invalid) return;
Yoshie Muranakaf415a082020-12-07 13:04:11 -080085 this.$emit('ok');
86 this.closeModal();
87 },
88 resetForm() {
89 this.confirmed = false;
tiwari-nishante1420032025-09-01 12:11:14 +053090 this.isOpen = false;
Surya Vde23ea22024-07-11 15:19:46 +053091 this.v$.$reset();
Yoshie Muranakaf415a082020-12-07 13:04:11 -080092 },
93 },
94};
95</script>