blob: ed81b3a88222e61e6e57cfbfbc1668bc8601c05a [file] [log] [blame]
Yoshie Muranaka22d4d522020-12-03 10:58:35 -08001<template>
2 <div class="form-background p-3">
3 <b-form id="form-new-dump" novalidate @submit.prevent="handleSubmit">
4 <b-form-group
5 :label="$t('pageDumps.form.selectDumpType')"
6 label-for="selectDumpType"
7 >
8 <b-form-select
9 id="selectDumpType"
10 v-model="selectedDumpType"
11 :options="dumpTypeOptions"
12 :state="getValidationState($v.selectedDumpType)"
13 >
14 <template #first>
15 <b-form-select-option :value="null" disabled>
16 {{ $t('global.form.selectAnOption') }}
17 </b-form-select-option>
18 </template>
19 </b-form-select>
20 <b-form-invalid-feedback role="alert">
21 {{ $t('global.form.required') }}
22 </b-form-invalid-feedback>
23 </b-form-group>
24 <b-button variant="primary" type="submit" form="form-new-dump">
25 {{ $t('pageDumps.form.createNewDump') }}
26 </b-button>
27 </b-form>
28 </div>
29</template>
30
31<script>
32import { required } from 'vuelidate/lib/validators';
33
34import BVToastMixin from '@/components/Mixins/BVToastMixin';
35import VuelidateMixin from '@/components/Mixins/VuelidateMixin.js';
36
37export default {
38 mixins: [BVToastMixin, VuelidateMixin],
39 data() {
40 return {
41 selectedDumpType: null,
42 dumpTypeOptions: [
43 { value: 'bmc', text: this.$t('pageDumps.form.bmcDump') },
44 { value: 'system', text: this.$t('pageDumps.form.systemDump') },
45 ],
46 };
47 },
48 validations() {
49 return {
50 selectedDumpType: { required },
51 };
52 },
53 methods: {
54 handleSubmit() {
55 this.$v.$touch();
56 if (this.$v.$invalid) return;
57 this.successToast(this.$t('pageDumps.toast.successStartDump'));
58 },
59 },
60};
61</script>