Yoshie Muranaka | 92a0a4a | 2020-07-15 10:30:31 -0700 | [diff] [blame] | 1 | <template> |
| 2 | <b-container fluid="xl"> |
| 3 | <page-title :description="$t('pageFirmware.pageDescription')" /> |
Yoshie Muranaka | 92a0a4a | 2020-07-15 10:30:31 -0700 | [diff] [blame] | 4 | <b-row class="mb-4"> |
Yoshie Muranaka | 92a0a4a | 2020-07-15 10:30:31 -0700 | [diff] [blame] | 5 | <b-col md="10" lg="12" xl="8" class="pr-xl-4"> |
Yoshie Muranaka | 98bb24e | 2020-10-06 10:00:19 -0700 | [diff] [blame] | 6 | <!-- Firmware on BMC --> |
| 7 | <page-section :section-title="$t('pageFirmware.firmwareOnBmc')"> |
Yoshie Muranaka | 92a0a4a | 2020-07-15 10:30:31 -0700 | [diff] [blame] | 8 | <b-card-group deck> |
| 9 | <!-- Current FW --> |
| 10 | <b-card header-bg-variant="success"> |
Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 11 | <template #header> |
Yoshie Muranaka | 92a0a4a | 2020-07-15 10:30:31 -0700 | [diff] [blame] | 12 | <dl class="mb-0"> |
| 13 | <dt>{{ $t('pageFirmware.current') }}</dt> |
Yoshie Muranaka | 98bb24e | 2020-10-06 10:00:19 -0700 | [diff] [blame] | 14 | <dd class="mb-0">{{ bmcFirmwareCurrentVersion }}</dd> |
Yoshie Muranaka | 92a0a4a | 2020-07-15 10:30:31 -0700 | [diff] [blame] | 15 | </dl> |
| 16 | </template> |
Yoshie Muranaka | 98bb24e | 2020-10-06 10:00:19 -0700 | [diff] [blame] | 17 | <dl class="my-0"> |
| 18 | <dt>{{ $t('pageFirmware.state') }}:</dt> |
| 19 | <dd>{{ bmcFirmwareCurrentState }}</dd> |
| 20 | </dl> |
Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 21 | <template #footer></template> |
Yoshie Muranaka | 98bb24e | 2020-10-06 10:00:19 -0700 | [diff] [blame] | 22 | </b-card> |
| 23 | |
| 24 | <!-- Backup FW --> |
| 25 | <b-card footer-class="p-0"> |
Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 26 | <template #header> |
Yoshie Muranaka | 98bb24e | 2020-10-06 10:00:19 -0700 | [diff] [blame] | 27 | <dl class="mb-0"> |
| 28 | <dt>{{ $t('pageFirmware.backup') }}</dt> |
| 29 | <dd class="mb-0">{{ bmcFirmwareBackupVersion }}</dd> |
| 30 | </dl> |
| 31 | </template> |
| 32 | <dl class="my-0"> |
| 33 | <dt>{{ $t('pageFirmware.state') }}:</dt> |
| 34 | <dd>{{ bmcFirmwareBackupState }}</dd> |
| 35 | </dl> |
Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 36 | <template #footer> |
Yoshie Muranaka | 98bb24e | 2020-10-06 10:00:19 -0700 | [diff] [blame] | 37 | <b-btn |
| 38 | v-b-modal.modal-reboot-backup-bmc |
| 39 | :disabled="!bmcFirmwareBackupVersion" |
| 40 | variant="link" |
| 41 | size="sm" |
| 42 | > |
| 43 | <icon-switch class="d-none d-sm-inline-block" /> |
| 44 | {{ $t('pageFirmware.makeCurrentVersion') }}</b-btn |
| 45 | > |
| 46 | </template> |
| 47 | </b-card> |
| 48 | </b-card-group> |
| 49 | </page-section> |
| 50 | |
| 51 | <!-- Firmware on Host --> |
| 52 | <page-section :section-title="$t('pageFirmware.firmwareOnHost')"> |
| 53 | <b-card-group deck> |
| 54 | <!-- Current FW --> |
| 55 | <b-card header-bg-variant="success"> |
Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 56 | <template #header> |
Yoshie Muranaka | 98bb24e | 2020-10-06 10:00:19 -0700 | [diff] [blame] | 57 | <dl class="mb-0"> |
| 58 | <dt>{{ $t('pageFirmware.current') }}</dt> |
| 59 | <dd class="mb-0">{{ hostFirmwareCurrentVersion }}</dd> |
| 60 | </dl> |
| 61 | </template> |
| 62 | <!-- State --> |
| 63 | <dl class="my-0"> |
| 64 | <dt>{{ $t('pageFirmware.state') }}:</dt> |
| 65 | <dd>{{ hostFirmwareCurrentState }}</dd> |
| 66 | </dl> |
Yoshie Muranaka | 92a0a4a | 2020-07-15 10:30:31 -0700 | [diff] [blame] | 67 | </b-card> |
| 68 | |
| 69 | <!-- Backup FW --> |
| 70 | <b-card> |
Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 71 | <template #header> |
Yoshie Muranaka | 92a0a4a | 2020-07-15 10:30:31 -0700 | [diff] [blame] | 72 | <dl class="mb-0"> |
| 73 | <dt>{{ $t('pageFirmware.backup') }}</dt> |
Yoshie Muranaka | 98bb24e | 2020-10-06 10:00:19 -0700 | [diff] [blame] | 74 | <dd class="mb-0">{{ hostFirmwareBackupVersion }}</dd> |
Yoshie Muranaka | 92a0a4a | 2020-07-15 10:30:31 -0700 | [diff] [blame] | 75 | </dl> |
| 76 | </template> |
Yoshie Muranaka | 98bb24e | 2020-10-06 10:00:19 -0700 | [diff] [blame] | 77 | <!-- State --> |
| 78 | <dl class="my-0"> |
| 79 | <dt>{{ $t('pageFirmware.state') }}:</dt> |
| 80 | <dd>{{ hostFirmwareBackupState }}</dd> |
| 81 | </dl> |
Yoshie Muranaka | 92a0a4a | 2020-07-15 10:30:31 -0700 | [diff] [blame] | 82 | </b-card> |
| 83 | </b-card-group> |
| 84 | </page-section> |
Yoshie Muranaka | 92a0a4a | 2020-07-15 10:30:31 -0700 | [diff] [blame] | 85 | </b-col> |
| 86 | |
| 87 | <!-- Update code --> |
| 88 | <b-col sm="8" xl="4" class="update-code pl-xl-4"> |
| 89 | <page-section :section-title="$t('pageFirmware.updateCode')"> |
| 90 | <b-form @submit.prevent="onSubmitUpload"> |
Yoshie Muranaka | 98bb24e | 2020-10-06 10:00:19 -0700 | [diff] [blame] | 91 | <b-form-group :label="$t('pageFirmware.form.uploadLocation')"> |
Yoshie Muranaka | 92a0a4a | 2020-07-15 10:30:31 -0700 | [diff] [blame] | 92 | <b-form-radio v-model="isWorkstationSelected" :value="true"> |
| 93 | {{ $t('pageFirmware.form.workstation') }} |
| 94 | </b-form-radio> |
| 95 | <b-form-radio v-model="isWorkstationSelected" :value="false"> |
| 96 | {{ $t('pageFirmware.form.tftpServer') }} |
| 97 | </b-form-radio> |
| 98 | </b-form-group> |
| 99 | |
| 100 | <!-- Workstation Upload --> |
| 101 | <template v-if="isWorkstationSelected"> |
SurenNeware | 978807d | 2020-09-03 18:35:21 +0530 | [diff] [blame] | 102 | <b-form-group :label="$t('pageFirmware.form.imageFile')"> |
Yoshie Muranaka | 92a0a4a | 2020-07-15 10:30:31 -0700 | [diff] [blame] | 103 | <b-form-text id="image-file-help-block"> |
| 104 | {{ $t('pageFirmware.form.onlyTarFilesAccepted') }} |
| 105 | </b-form-text> |
SurenNeware | 978807d | 2020-09-03 18:35:21 +0530 | [diff] [blame] | 106 | <form-file |
Yoshie Muranaka | 92a0a4a | 2020-07-15 10:30:31 -0700 | [diff] [blame] | 107 | id="image-file" |
Yoshie Muranaka | 92a0a4a | 2020-07-15 10:30:31 -0700 | [diff] [blame] | 108 | accept=".tar" |
Yoshie Muranaka | 92a0a4a | 2020-07-15 10:30:31 -0700 | [diff] [blame] | 109 | :state="getValidationState($v.file)" |
SurenNeware | 978807d | 2020-09-03 18:35:21 +0530 | [diff] [blame] | 110 | aria-describedby="image-file-help-block" |
| 111 | @input="onFileUpload($event)" |
| 112 | > |
| 113 | <template #invalid> |
| 114 | <b-form-invalid-feedback role="alert"> |
Yoshie Muranaka | 00f5b79 | 2020-12-07 07:28:50 -0800 | [diff] [blame] | 115 | {{ $t('global.form.required') }} |
SurenNeware | 978807d | 2020-09-03 18:35:21 +0530 | [diff] [blame] | 116 | </b-form-invalid-feedback> |
| 117 | </template> |
| 118 | </form-file> |
Yoshie Muranaka | 92a0a4a | 2020-07-15 10:30:31 -0700 | [diff] [blame] | 119 | </b-form-group> |
| 120 | </template> |
| 121 | |
| 122 | <!-- TFTP Server Upload --> |
| 123 | <template v-else> |
| 124 | <b-form-group |
SurenNeware | 64c20a5 | 2020-10-07 20:30:34 +0530 | [diff] [blame] | 125 | :label="$t('pageFirmware.form.tftpServerAddress')" |
Yoshie Muranaka | 92a0a4a | 2020-07-15 10:30:31 -0700 | [diff] [blame] | 126 | label-for="tftp-ip" |
| 127 | > |
SurenNeware | 64c20a5 | 2020-10-07 20:30:34 +0530 | [diff] [blame] | 128 | <b-form-text id="server-address-help-block"> |
| 129 | {{ $t('pageFirmware.form.tftpServerAddressHelper') }} |
| 130 | </b-form-text> |
Yoshie Muranaka | 92a0a4a | 2020-07-15 10:30:31 -0700 | [diff] [blame] | 131 | <b-form-input |
| 132 | id="tftp-id" |
| 133 | v-model="tftpIpAddress" |
| 134 | type="text" |
Yoshie Muranaka | 92a0a4a | 2020-07-15 10:30:31 -0700 | [diff] [blame] | 135 | :state="getValidationState($v.tftpIpAddress)" |
SurenNeware | 64c20a5 | 2020-10-07 20:30:34 +0530 | [diff] [blame] | 136 | aria-describedby="server-address-help-block" |
Yoshie Muranaka | 92a0a4a | 2020-07-15 10:30:31 -0700 | [diff] [blame] | 137 | @input="$v.tftpIpAddress.$touch()" |
| 138 | /> |
| 139 | <b-form-invalid-feedback role="alert"> |
| 140 | {{ $t('global.form.fieldRequired') }} |
| 141 | </b-form-invalid-feedback> |
| 142 | </b-form-group> |
| 143 | <b-form-group |
| 144 | :label="$t('pageFirmware.form.imageFileName')" |
| 145 | label-for="tftp-file-name" |
| 146 | > |
| 147 | <b-form-input |
| 148 | id="tftp-file-name" |
| 149 | v-model="tftpFileName" |
| 150 | type="text" |
| 151 | :state="getValidationState($v.tftpFileName)" |
Yoshie Muranaka | 92a0a4a | 2020-07-15 10:30:31 -0700 | [diff] [blame] | 152 | @input="$v.tftpFileName.$touch()" |
| 153 | /> |
| 154 | <b-form-invalid-feedback role="alert"> |
| 155 | {{ $t('global.form.fieldRequired') }} |
| 156 | </b-form-invalid-feedback> |
| 157 | </b-form-group> |
| 158 | </template> |
| 159 | |
| 160 | <!-- Info alert --> |
| 161 | <alert variant="info" class="mt-4 mb-5"> |
| 162 | <p class="font-weight-bold mb-1"> |
| 163 | {{ $t('pageFirmware.alert.updateProcess') }} |
| 164 | </p> |
| 165 | <p>{{ $t('pageFirmware.alert.updateProcessInfo') }}</p> |
| 166 | </alert> |
Derick Montague | ad48a0c | 2020-10-30 08:48:09 -0500 | [diff] [blame] | 167 | |
| 168 | <b-btn type="submit" variant="primary"> |
| 169 | {{ $t('pageFirmware.form.uploadAndRebootBmcOrHost') }} |
| 170 | </b-btn> |
Yoshie Muranaka | 92a0a4a | 2020-07-15 10:30:31 -0700 | [diff] [blame] | 171 | </b-form> |
| 172 | </page-section> |
| 173 | </b-col> |
| 174 | </b-row> |
| 175 | |
| 176 | <!-- Modals --> |
| 177 | <modal-upload @ok="uploadFirmware" /> |
Yoshie Muranaka | 98bb24e | 2020-10-06 10:00:19 -0700 | [diff] [blame] | 178 | <modal-reboot-backup-bmc |
| 179 | :current="bmcFirmwareCurrentVersion || '--'" |
| 180 | :backup="bmcFirmwareBackupVersion || '--'" |
| 181 | @ok="switchBmcFirmware" |
Yoshie Muranaka | 92a0a4a | 2020-07-15 10:30:31 -0700 | [diff] [blame] | 182 | /> |
| 183 | </b-container> |
| 184 | </template> |
| 185 | |
| 186 | <script> |
| 187 | import { requiredIf } from 'vuelidate/lib/validators'; |
| 188 | import { mapGetters } from 'vuex'; |
Yoshie Muranaka | 98bb24e | 2020-10-06 10:00:19 -0700 | [diff] [blame] | 189 | import IconSwitch from '@carbon/icons-vue/es/arrows--horizontal/20'; |
Yoshie Muranaka | 92a0a4a | 2020-07-15 10:30:31 -0700 | [diff] [blame] | 190 | |
| 191 | import PageSection from '@/components/Global/PageSection'; |
| 192 | import PageTitle from '@/components/Global/PageTitle'; |
| 193 | import Alert from '@/components/Global/Alert'; |
| 194 | import ModalUpload from './FirmwareModalUpload'; |
Yoshie Muranaka | 98bb24e | 2020-10-06 10:00:19 -0700 | [diff] [blame] | 195 | import ModalRebootBackupBmc from './FirmwareModalRebootBackupBmc'; |
SurenNeware | 978807d | 2020-09-03 18:35:21 +0530 | [diff] [blame] | 196 | import FormFile from '@/components/Global/FormFile'; |
Yoshie Muranaka | 92a0a4a | 2020-07-15 10:30:31 -0700 | [diff] [blame] | 197 | |
| 198 | import VuelidateMixin from '@/components/Mixins/VuelidateMixin.js'; |
SurenNeware | ba91c49 | 2020-10-27 14:18:54 +0530 | [diff] [blame] | 199 | import LoadingBarMixin, { loading } from '@/components/Mixins/LoadingBarMixin'; |
Yoshie Muranaka | 92a0a4a | 2020-07-15 10:30:31 -0700 | [diff] [blame] | 200 | import BVToastMixin from '@/components/Mixins/BVToastMixin'; |
| 201 | |
| 202 | export default { |
| 203 | name: 'Firmware', |
| 204 | components: { |
| 205 | Alert, |
Yoshie Muranaka | 98bb24e | 2020-10-06 10:00:19 -0700 | [diff] [blame] | 206 | IconSwitch, |
| 207 | ModalRebootBackupBmc, |
Yoshie Muranaka | 92a0a4a | 2020-07-15 10:30:31 -0700 | [diff] [blame] | 208 | ModalUpload, |
| 209 | PageSection, |
Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 210 | PageTitle, |
SurenNeware | 978807d | 2020-09-03 18:35:21 +0530 | [diff] [blame] | 211 | FormFile, |
Yoshie Muranaka | 92a0a4a | 2020-07-15 10:30:31 -0700 | [diff] [blame] | 212 | }, |
| 213 | mixins: [BVToastMixin, LoadingBarMixin, VuelidateMixin], |
Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 214 | beforeRouteLeave(to, from, next) { |
| 215 | this.hideLoader(); |
| 216 | this.clearRebootTimeout(); |
| 217 | next(); |
| 218 | }, |
Yoshie Muranaka | 92a0a4a | 2020-07-15 10:30:31 -0700 | [diff] [blame] | 219 | data() { |
| 220 | return { |
| 221 | isWorkstationSelected: true, |
| 222 | file: null, |
| 223 | tftpIpAddress: null, |
| 224 | tftpFileName: null, |
Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 225 | timeoutId: null, |
SurenNeware | ba91c49 | 2020-10-27 14:18:54 +0530 | [diff] [blame] | 226 | loading: loading, |
Yoshie Muranaka | 92a0a4a | 2020-07-15 10:30:31 -0700 | [diff] [blame] | 227 | }; |
| 228 | }, |
| 229 | computed: { |
Yoshie Muranaka | 92a0a4a | 2020-07-15 10:30:31 -0700 | [diff] [blame] | 230 | ...mapGetters('firmware', [ |
Yoshie Muranaka | 98bb24e | 2020-10-06 10:00:19 -0700 | [diff] [blame] | 231 | 'bmcFirmwareCurrentVersion', |
| 232 | 'bmcFirmwareCurrentState', |
| 233 | 'bmcFirmwareBackupVersion', |
| 234 | 'bmcFirmwareBackupState', |
| 235 | 'hostFirmwareCurrentVersion', |
| 236 | 'hostFirmwareCurrentState', |
| 237 | 'hostFirmwareBackupVersion', |
Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 238 | 'hostFirmwareBackupState', |
| 239 | ]), |
Yoshie Muranaka | 92a0a4a | 2020-07-15 10:30:31 -0700 | [diff] [blame] | 240 | }, |
| 241 | watch: { |
Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 242 | isWorkstationSelected: function () { |
Yoshie Muranaka | 92a0a4a | 2020-07-15 10:30:31 -0700 | [diff] [blame] | 243 | this.$v.$reset(); |
| 244 | this.file = null; |
| 245 | this.tftpIpAddress = null; |
| 246 | this.tftpFileName = null; |
Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 247 | }, |
Yoshie Muranaka | 92a0a4a | 2020-07-15 10:30:31 -0700 | [diff] [blame] | 248 | }, |
| 249 | created() { |
| 250 | this.startLoader(); |
| 251 | this.$store.dispatch('firmware/getUpdateServiceApplyTime'); |
Yoshie Muranaka | 98bb24e | 2020-10-06 10:00:19 -0700 | [diff] [blame] | 252 | this.$store |
| 253 | .dispatch('firmware/getFirmwareInformation') |
| 254 | .finally(() => this.endLoader()); |
Yoshie Muranaka | 92a0a4a | 2020-07-15 10:30:31 -0700 | [diff] [blame] | 255 | }, |
Yoshie Muranaka | 92a0a4a | 2020-07-15 10:30:31 -0700 | [diff] [blame] | 256 | validations() { |
| 257 | return { |
| 258 | file: { |
Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 259 | required: requiredIf(function () { |
Yoshie Muranaka | 92a0a4a | 2020-07-15 10:30:31 -0700 | [diff] [blame] | 260 | return this.isWorkstationSelected; |
Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 261 | }), |
Yoshie Muranaka | 92a0a4a | 2020-07-15 10:30:31 -0700 | [diff] [blame] | 262 | }, |
| 263 | tftpIpAddress: { |
Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 264 | required: requiredIf(function () { |
Yoshie Muranaka | 92a0a4a | 2020-07-15 10:30:31 -0700 | [diff] [blame] | 265 | return !this.isWorkstationSelected; |
Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 266 | }), |
Yoshie Muranaka | 92a0a4a | 2020-07-15 10:30:31 -0700 | [diff] [blame] | 267 | }, |
| 268 | tftpFileName: { |
Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 269 | required: requiredIf(function () { |
Yoshie Muranaka | 92a0a4a | 2020-07-15 10:30:31 -0700 | [diff] [blame] | 270 | return !this.isWorkstationSelected; |
Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 271 | }), |
| 272 | }, |
Yoshie Muranaka | 92a0a4a | 2020-07-15 10:30:31 -0700 | [diff] [blame] | 273 | }; |
| 274 | }, |
| 275 | methods: { |
SurenNeware | 978807d | 2020-09-03 18:35:21 +0530 | [diff] [blame] | 276 | onFileUpload(file) { |
| 277 | this.file = file; |
| 278 | this.$v.file.$touch(); |
| 279 | }, |
Yoshie Muranaka | 92a0a4a | 2020-07-15 10:30:31 -0700 | [diff] [blame] | 280 | uploadFirmware() { |
| 281 | const startTime = this.$options.filters.formatTime(new Date()); |
| 282 | this.setRebootTimeout(360000); //6 minute timeout |
| 283 | this.infoToast( |
| 284 | this.$t('pageFirmware.toast.infoUploadStartTimeMessage', { startTime }), |
Yoshie Muranaka | f92e296 | 2021-02-09 12:41:53 -0800 | [diff] [blame^] | 285 | { title: this.$t('pageFirmware.toast.infoUploadStartTimeTitle') } |
Yoshie Muranaka | 92a0a4a | 2020-07-15 10:30:31 -0700 | [diff] [blame] | 286 | ); |
| 287 | if (this.isWorkstationSelected) { |
| 288 | this.dispatchWorkstationUpload(); |
| 289 | } else { |
| 290 | this.dispatchTftpUpload(); |
| 291 | } |
| 292 | }, |
| 293 | dispatchWorkstationUpload() { |
| 294 | this.$store |
| 295 | .dispatch('firmware/uploadFirmware', this.file) |
Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 296 | .then((success) => |
Yoshie Muranaka | f92e296 | 2021-02-09 12:41:53 -0800 | [diff] [blame^] | 297 | this.infoToast(success, { |
| 298 | title: this.$t('pageFirmware.toast.successUploadTitle'), |
| 299 | }) |
Yoshie Muranaka | 92a0a4a | 2020-07-15 10:30:31 -0700 | [diff] [blame] | 300 | ) |
| 301 | .catch(({ message }) => { |
| 302 | this.errorToast(message); |
| 303 | this.clearRebootTimeout(); |
| 304 | }); |
| 305 | }, |
| 306 | dispatchTftpUpload() { |
| 307 | const data = { |
| 308 | address: this.tftpIpAddress, |
Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 309 | filename: this.tftpFileName, |
Yoshie Muranaka | 92a0a4a | 2020-07-15 10:30:31 -0700 | [diff] [blame] | 310 | }; |
| 311 | this.$store |
| 312 | .dispatch('firmware/uploadFirmwareTFTP', data) |
Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 313 | .then((success) => |
Yoshie Muranaka | f92e296 | 2021-02-09 12:41:53 -0800 | [diff] [blame^] | 314 | this.infoToast(success, { |
| 315 | title: this.$t('pageFirmware.toast.successUploadTitle'), |
| 316 | }) |
Yoshie Muranaka | 92a0a4a | 2020-07-15 10:30:31 -0700 | [diff] [blame] | 317 | ) |
| 318 | .catch(({ message }) => { |
| 319 | this.errorToast(message); |
| 320 | this.clearRebootTimeout(); |
| 321 | }); |
| 322 | }, |
Yoshie Muranaka | 98bb24e | 2020-10-06 10:00:19 -0700 | [diff] [blame] | 323 | switchBmcFirmware() { |
Yoshie Muranaka | 92a0a4a | 2020-07-15 10:30:31 -0700 | [diff] [blame] | 324 | this.setRebootTimeout(); |
| 325 | this.$store |
Yoshie Muranaka | 98bb24e | 2020-10-06 10:00:19 -0700 | [diff] [blame] | 326 | .dispatch('firmware/switchBmcFirmware') |
Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 327 | .then((success) => |
Yoshie Muranaka | f92e296 | 2021-02-09 12:41:53 -0800 | [diff] [blame^] | 328 | this.infoToast(success, { title: this.$t('global.status.success') }) |
Yoshie Muranaka | 92a0a4a | 2020-07-15 10:30:31 -0700 | [diff] [blame] | 329 | ) |
| 330 | .catch(({ message }) => { |
| 331 | this.errorToast(message); |
| 332 | this.clearRebootTimeout(); |
| 333 | }); |
| 334 | }, |
| 335 | setRebootTimeout(timeoutMs = 60000) { |
| 336 | // Set a timeout to disable page interactions while |
| 337 | // an upload or BMC reboot is in progress |
| 338 | this.startLoader(); |
| 339 | this.timeoutId = setTimeout(() => { |
| 340 | this.endLoader(); |
| 341 | this.infoToast( |
| 342 | this.$t('pageFirmware.toast.infoRefreshApplicationMessage'), |
Yoshie Muranaka | f92e296 | 2021-02-09 12:41:53 -0800 | [diff] [blame^] | 343 | { |
| 344 | title: this.$t('pageFirmware.toast.infoRefreshApplicationTitle'), |
| 345 | refreshAction: true, |
| 346 | } |
Yoshie Muranaka | 92a0a4a | 2020-07-15 10:30:31 -0700 | [diff] [blame] | 347 | ); |
| 348 | }, timeoutMs); |
| 349 | }, |
| 350 | clearRebootTimeout() { |
| 351 | if (this.timeoutId) { |
| 352 | clearTimeout(this.timeoutId); |
| 353 | this.endLoader(); |
| 354 | } |
| 355 | }, |
| 356 | onSubmitUpload() { |
| 357 | this.$v.$touch(); |
| 358 | if (this.$v.$invalid) return; |
| 359 | this.$bvModal.show('modal-upload'); |
Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 360 | }, |
| 361 | }, |
Yoshie Muranaka | 92a0a4a | 2020-07-15 10:30:31 -0700 | [diff] [blame] | 362 | }; |
| 363 | </script> |
| 364 | |
| 365 | <style lang="scss" scoped> |
| 366 | .update-code { |
| 367 | border-left: none; |
| 368 | @include media-breakpoint-up(xl) { |
| 369 | border-left: 1px solid gray('300'); |
| 370 | } |
| 371 | } |
Yoshie Muranaka | 98bb24e | 2020-10-06 10:00:19 -0700 | [diff] [blame] | 372 | .card-footer { |
Dixsie Wolmers | 30f11f8 | 2020-11-10 16:07:56 -0600 | [diff] [blame] | 373 | height: 40px; |
Yoshie Muranaka | 98bb24e | 2020-10-06 10:00:19 -0700 | [diff] [blame] | 374 | } |
| 375 | .card-body { |
| 376 | padding: 0.75rem 1.25rem; |
| 377 | } |
Yoshie Muranaka | 92a0a4a | 2020-07-15 10:30:31 -0700 | [diff] [blame] | 378 | </style> |