Dumps Validation Fix
- Fixed Vuelidate returning validations always as false
- Activated Dumps Modal Validations only when its open
Change-Id: I87e61f3033f6e4f7ab0cd19859638d686bdc9775
Signed-off-by: Nishant Tiwari <tiwari.nishant@ibm.com>
diff --git a/src/views/Logs/Dumps/DumpsForm.vue b/src/views/Logs/Dumps/DumpsForm.vue
index 17257d1..b27aeba 100644
--- a/src/views/Logs/Dumps/DumpsForm.vue
+++ b/src/views/Logs/Dumps/DumpsForm.vue
@@ -28,7 +28,10 @@
{{ $t('pageDumps.form.initiateDump') }}
</b-button>
</b-form>
- <modal-confirmation @ok="createSystemDump" />
+ <modal-confirmation
+ :require-confirmation="selectedDumpType === 'system'"
+ @ok="createSystemDump"
+ />
</div>
</template>
diff --git a/src/views/Logs/Dumps/DumpsModalConfirmation.vue b/src/views/Logs/Dumps/DumpsModalConfirmation.vue
index 05b868d..fd1cb78 100644
--- a/src/views/Logs/Dumps/DumpsModalConfirmation.vue
+++ b/src/views/Logs/Dumps/DumpsModalConfirmation.vue
@@ -46,6 +46,12 @@
export default {
components: { StatusIcon },
mixins: [VuelidateMixin],
+ props: {
+ requireConfirmation: {
+ type: Boolean,
+ default: false,
+ },
+ },
setup() {
return {
v$: useVuelidate(),
@@ -55,12 +61,17 @@
return {
$t: useI18n().t,
confirmed: false,
+ isOpen: this.requireConfirmation,
};
},
- validations: {
- confirmed: {
- mustBeTrue: (value) => value === true,
- },
+ validations() {
+ return this.isOpen
+ ? {
+ confirmed: {
+ mustBeTrue: (value) => value === true,
+ },
+ }
+ : {};
},
methods: {
closeModal() {
@@ -76,6 +87,7 @@
},
resetForm() {
this.confirmed = false;
+ this.isOpen = false;
this.v$.$reset();
},
},