summaryrefslogtreecommitdiff
path: root/src/views/Health/Dumps/DumpsForm.vue
diff options
context:
space:
mode:
authorYoshie Muranaka <yoshiemuranaka@gmail.com>2021-02-23 22:23:52 +0300
committerDerick Montague <derick.montague@ibm.com>2021-03-01 16:45:05 +0300
commitaa5e950b219343fff77ddde855088e694806edf8 (patch)
tree76aa992e83f422fa8e5474b01e77b35a8a4838bb /src/views/Health/Dumps/DumpsForm.vue
parent33d755f4e62beff72101f6ca07e4d31b04e13826 (diff)
downloadwebui-vue-aa5e950b219343fff77ddde855088e694806edf8.tar.xz
Move Dumps page components to main view and store directories
This commit will move away from storing env specific component views and store modules in the env directory. This will help simplify the file structure for dotenv customizations. The env directory will only store modifications to the main store register, router definitions, and app navigation. Pages that are "hidden" by default, like dumps, would still need to be imported and registered in the specific environments. Signed-off-by: Yoshie Muranaka <yoshiemuranaka@gmail.com> Change-Id: Ia5ad76235e00127281f3fa564cb89ec2ca2e0f25
Diffstat (limited to 'src/views/Health/Dumps/DumpsForm.vue')
-rw-r--r--src/views/Health/Dumps/DumpsForm.vue95
1 files changed, 95 insertions, 0 deletions
diff --git a/src/views/Health/Dumps/DumpsForm.vue b/src/views/Health/Dumps/DumpsForm.vue
new file mode 100644
index 00000000..02ec1864
--- /dev/null
+++ b/src/views/Health/Dumps/DumpsForm.vue
@@ -0,0 +1,95 @@
+<template>
+ <div class="form-background p-3">
+ <b-form id="form-new-dump" novalidate @submit.prevent="handleSubmit">
+ <b-form-group
+ :label="$t('pageDumps.form.selectDumpType')"
+ label-for="selectDumpType"
+ >
+ <b-form-select
+ id="selectDumpType"
+ v-model="selectedDumpType"
+ :options="dumpTypeOptions"
+ :state="getValidationState($v.selectedDumpType)"
+ >
+ <template #first>
+ <b-form-select-option :value="null" disabled>
+ {{ $t('global.form.selectAnOption') }}
+ </b-form-select-option>
+ </template>
+ </b-form-select>
+ <b-form-invalid-feedback role="alert">
+ {{ $t('global.form.required') }}
+ </b-form-invalid-feedback>
+ </b-form-group>
+ <alert variant="info" class="mb-3" :show="selectedDumpType === 'system'">
+ {{ $t('pageDumps.form.systemDumpInfo') }}
+ </alert>
+ <b-button variant="primary" type="submit" form="form-new-dump">
+ {{ $t('pageDumps.form.initiateDump') }}
+ </b-button>
+ </b-form>
+ <modal-confirmation @ok="createSystemDump" />
+ </div>
+</template>
+
+<script>
+import { required } from 'vuelidate/lib/validators';
+
+import ModalConfirmation from './DumpsModalConfirmation';
+import Alert from '@/components/Global/Alert';
+
+import BVToastMixin from '@/components/Mixins/BVToastMixin';
+import VuelidateMixin from '@/components/Mixins/VuelidateMixin.js';
+
+export default {
+ components: { Alert, ModalConfirmation },
+ mixins: [BVToastMixin, VuelidateMixin],
+ data() {
+ return {
+ selectedDumpType: null,
+ dumpTypeOptions: [
+ { value: 'bmc', text: this.$t('pageDumps.form.bmcDump') },
+ { value: 'system', text: this.$t('pageDumps.form.systemDump') },
+ ],
+ };
+ },
+ validations() {
+ return {
+ selectedDumpType: { required },
+ };
+ },
+ methods: {
+ handleSubmit() {
+ this.$v.$touch();
+ if (this.$v.$invalid) return;
+ if (this.selectedDumpType === 'system') {
+ this.showConfirmationModal();
+ } else {
+ this.$store
+ .dispatch('dumps/createBmcDump')
+ .then(() =>
+ this.infoToast(this.$t('pageDumps.toast.successStartBmcDump'), {
+ title: this.$t('pageDumps.toast.successStartBmcDumpTitle'),
+ timestamp: true,
+ })
+ )
+ .catch(({ message }) => this.errorToast(message));
+ }
+ },
+ showConfirmationModal() {
+ this.$bvModal.show('modal-confirmation');
+ },
+ createSystemDump() {
+ this.$store
+ .dispatch('dumps/createSystemDump')
+ .then(() =>
+ this.infoToast(this.$t('pageDumps.toast.successStartSystemDump'), {
+ title: this.$t('pageDumps.toast.successStartSystemDumpTitle'),
+ timestamp: true,
+ })
+ )
+ .catch(({ message }) => this.errorToast(message));
+ },
+ },
+};
+</script>