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" |
SurenNeware | 978807d | 2020-09-03 18:35:21 +0530 | [diff] [blame] | 109 | :disabled="isPageDisabled" |
Yoshie Muranaka | 92a0a4a | 2020-07-15 10:30:31 -0700 | [diff] [blame] | 110 | :state="getValidationState($v.file)" |
SurenNeware | 978807d | 2020-09-03 18:35:21 +0530 | [diff] [blame] | 111 | aria-describedby="image-file-help-block" |
| 112 | @input="onFileUpload($event)" |
| 113 | > |
| 114 | <template #invalid> |
| 115 | <b-form-invalid-feedback role="alert"> |
| 116 | <template> |
| 117 | {{ $t('global.form.required') }} |
| 118 | </template> |
| 119 | </b-form-invalid-feedback> |
| 120 | </template> |
| 121 | </form-file> |
Yoshie Muranaka | 92a0a4a | 2020-07-15 10:30:31 -0700 | [diff] [blame] | 122 | </b-form-group> |
| 123 | </template> |
| 124 | |
| 125 | <!-- TFTP Server Upload --> |
| 126 | <template v-else> |
| 127 | <b-form-group |
SurenNeware | 64c20a5 | 2020-10-07 20:30:34 +0530 | [diff] [blame] | 128 | :label="$t('pageFirmware.form.tftpServerAddress')" |
Yoshie Muranaka | 92a0a4a | 2020-07-15 10:30:31 -0700 | [diff] [blame] | 129 | label-for="tftp-ip" |
| 130 | > |
SurenNeware | 64c20a5 | 2020-10-07 20:30:34 +0530 | [diff] [blame] | 131 | <b-form-text id="server-address-help-block"> |
| 132 | {{ $t('pageFirmware.form.tftpServerAddressHelper') }} |
| 133 | </b-form-text> |
Yoshie Muranaka | 92a0a4a | 2020-07-15 10:30:31 -0700 | [diff] [blame] | 134 | <b-form-input |
| 135 | id="tftp-id" |
| 136 | v-model="tftpIpAddress" |
| 137 | type="text" |
Yoshie Muranaka | 92a0a4a | 2020-07-15 10:30:31 -0700 | [diff] [blame] | 138 | :state="getValidationState($v.tftpIpAddress)" |
| 139 | :disabled="isPageDisabled" |
SurenNeware | 64c20a5 | 2020-10-07 20:30:34 +0530 | [diff] [blame] | 140 | aria-describedby="server-address-help-block" |
Yoshie Muranaka | 92a0a4a | 2020-07-15 10:30:31 -0700 | [diff] [blame] | 141 | @input="$v.tftpIpAddress.$touch()" |
| 142 | /> |
| 143 | <b-form-invalid-feedback role="alert"> |
| 144 | {{ $t('global.form.fieldRequired') }} |
| 145 | </b-form-invalid-feedback> |
| 146 | </b-form-group> |
| 147 | <b-form-group |
| 148 | :label="$t('pageFirmware.form.imageFileName')" |
| 149 | label-for="tftp-file-name" |
| 150 | > |
| 151 | <b-form-input |
| 152 | id="tftp-file-name" |
| 153 | v-model="tftpFileName" |
| 154 | type="text" |
| 155 | :state="getValidationState($v.tftpFileName)" |
Yoshie Muranaka | 92a0a4a | 2020-07-15 10:30:31 -0700 | [diff] [blame] | 156 | @input="$v.tftpFileName.$touch()" |
| 157 | /> |
| 158 | <b-form-invalid-feedback role="alert"> |
| 159 | {{ $t('global.form.fieldRequired') }} |
| 160 | </b-form-invalid-feedback> |
| 161 | </b-form-group> |
| 162 | </template> |
| 163 | |
| 164 | <!-- Info alert --> |
| 165 | <alert variant="info" class="mt-4 mb-5"> |
| 166 | <p class="font-weight-bold mb-1"> |
| 167 | {{ $t('pageFirmware.alert.updateProcess') }} |
| 168 | </p> |
| 169 | <p>{{ $t('pageFirmware.alert.updateProcessInfo') }}</p> |
| 170 | </alert> |
Derick Montague | ad48a0c | 2020-10-30 08:48:09 -0500 | [diff] [blame] | 171 | |
| 172 | <b-btn type="submit" variant="primary"> |
| 173 | {{ $t('pageFirmware.form.uploadAndRebootBmcOrHost') }} |
| 174 | </b-btn> |
Yoshie Muranaka | 92a0a4a | 2020-07-15 10:30:31 -0700 | [diff] [blame] | 175 | </b-form> |
| 176 | </page-section> |
| 177 | </b-col> |
| 178 | </b-row> |
| 179 | |
| 180 | <!-- Modals --> |
| 181 | <modal-upload @ok="uploadFirmware" /> |
Yoshie Muranaka | 98bb24e | 2020-10-06 10:00:19 -0700 | [diff] [blame] | 182 | <modal-reboot-backup-bmc |
| 183 | :current="bmcFirmwareCurrentVersion || '--'" |
| 184 | :backup="bmcFirmwareBackupVersion || '--'" |
| 185 | @ok="switchBmcFirmware" |
Yoshie Muranaka | 92a0a4a | 2020-07-15 10:30:31 -0700 | [diff] [blame] | 186 | /> |
| 187 | </b-container> |
| 188 | </template> |
| 189 | |
| 190 | <script> |
| 191 | import { requiredIf } from 'vuelidate/lib/validators'; |
| 192 | import { mapGetters } from 'vuex'; |
Yoshie Muranaka | 98bb24e | 2020-10-06 10:00:19 -0700 | [diff] [blame] | 193 | import IconSwitch from '@carbon/icons-vue/es/arrows--horizontal/20'; |
Yoshie Muranaka | 92a0a4a | 2020-07-15 10:30:31 -0700 | [diff] [blame] | 194 | |
| 195 | import PageSection from '@/components/Global/PageSection'; |
| 196 | import PageTitle from '@/components/Global/PageTitle'; |
| 197 | import Alert from '@/components/Global/Alert'; |
| 198 | import ModalUpload from './FirmwareModalUpload'; |
Yoshie Muranaka | 98bb24e | 2020-10-06 10:00:19 -0700 | [diff] [blame] | 199 | import ModalRebootBackupBmc from './FirmwareModalRebootBackupBmc'; |
SurenNeware | 978807d | 2020-09-03 18:35:21 +0530 | [diff] [blame] | 200 | import FormFile from '@/components/Global/FormFile'; |
Yoshie Muranaka | 92a0a4a | 2020-07-15 10:30:31 -0700 | [diff] [blame] | 201 | |
| 202 | import VuelidateMixin from '@/components/Mixins/VuelidateMixin.js'; |
SurenNeware | ba91c49 | 2020-10-27 14:18:54 +0530 | [diff] [blame] | 203 | import LoadingBarMixin, { loading } from '@/components/Mixins/LoadingBarMixin'; |
Yoshie Muranaka | 92a0a4a | 2020-07-15 10:30:31 -0700 | [diff] [blame] | 204 | import BVToastMixin from '@/components/Mixins/BVToastMixin'; |
| 205 | |
| 206 | export default { |
| 207 | name: 'Firmware', |
| 208 | components: { |
| 209 | Alert, |
Yoshie Muranaka | 98bb24e | 2020-10-06 10:00:19 -0700 | [diff] [blame] | 210 | IconSwitch, |
| 211 | ModalRebootBackupBmc, |
Yoshie Muranaka | 92a0a4a | 2020-07-15 10:30:31 -0700 | [diff] [blame] | 212 | ModalUpload, |
| 213 | PageSection, |
Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 214 | PageTitle, |
SurenNeware | 978807d | 2020-09-03 18:35:21 +0530 | [diff] [blame] | 215 | FormFile, |
Yoshie Muranaka | 92a0a4a | 2020-07-15 10:30:31 -0700 | [diff] [blame] | 216 | }, |
| 217 | mixins: [BVToastMixin, LoadingBarMixin, VuelidateMixin], |
Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 218 | beforeRouteLeave(to, from, next) { |
| 219 | this.hideLoader(); |
| 220 | this.clearRebootTimeout(); |
| 221 | next(); |
| 222 | }, |
Yoshie Muranaka | 92a0a4a | 2020-07-15 10:30:31 -0700 | [diff] [blame] | 223 | data() { |
| 224 | return { |
| 225 | isWorkstationSelected: true, |
| 226 | file: null, |
| 227 | tftpIpAddress: null, |
| 228 | tftpFileName: null, |
Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 229 | timeoutId: null, |
SurenNeware | 978807d | 2020-09-03 18:35:21 +0530 | [diff] [blame] | 230 | isPageDisabled: null, |
SurenNeware | ba91c49 | 2020-10-27 14:18:54 +0530 | [diff] [blame] | 231 | loading: loading, |
Yoshie Muranaka | 92a0a4a | 2020-07-15 10:30:31 -0700 | [diff] [blame] | 232 | }; |
| 233 | }, |
| 234 | computed: { |
Yoshie Muranaka | 92a0a4a | 2020-07-15 10:30:31 -0700 | [diff] [blame] | 235 | ...mapGetters('firmware', [ |
Yoshie Muranaka | 98bb24e | 2020-10-06 10:00:19 -0700 | [diff] [blame] | 236 | 'bmcFirmwareCurrentVersion', |
| 237 | 'bmcFirmwareCurrentState', |
| 238 | 'bmcFirmwareBackupVersion', |
| 239 | 'bmcFirmwareBackupState', |
| 240 | 'hostFirmwareCurrentVersion', |
| 241 | 'hostFirmwareCurrentState', |
| 242 | 'hostFirmwareBackupVersion', |
Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 243 | 'hostFirmwareBackupState', |
| 244 | ]), |
Yoshie Muranaka | 92a0a4a | 2020-07-15 10:30:31 -0700 | [diff] [blame] | 245 | }, |
| 246 | watch: { |
Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 247 | isWorkstationSelected: function () { |
Yoshie Muranaka | 92a0a4a | 2020-07-15 10:30:31 -0700 | [diff] [blame] | 248 | this.$v.$reset(); |
| 249 | this.file = null; |
| 250 | this.tftpIpAddress = null; |
| 251 | this.tftpFileName = null; |
Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 252 | }, |
Yoshie Muranaka | 92a0a4a | 2020-07-15 10:30:31 -0700 | [diff] [blame] | 253 | }, |
| 254 | created() { |
| 255 | this.startLoader(); |
| 256 | this.$store.dispatch('firmware/getUpdateServiceApplyTime'); |
Yoshie Muranaka | 98bb24e | 2020-10-06 10:00:19 -0700 | [diff] [blame] | 257 | this.$store |
| 258 | .dispatch('firmware/getFirmwareInformation') |
| 259 | .finally(() => this.endLoader()); |
Yoshie Muranaka | 92a0a4a | 2020-07-15 10:30:31 -0700 | [diff] [blame] | 260 | }, |
Yoshie Muranaka | 92a0a4a | 2020-07-15 10:30:31 -0700 | [diff] [blame] | 261 | validations() { |
| 262 | return { |
| 263 | file: { |
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 | tftpIpAddress: { |
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 | }), |
Yoshie Muranaka | 92a0a4a | 2020-07-15 10:30:31 -0700 | [diff] [blame] | 272 | }, |
| 273 | tftpFileName: { |
Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 274 | required: requiredIf(function () { |
Yoshie Muranaka | 92a0a4a | 2020-07-15 10:30:31 -0700 | [diff] [blame] | 275 | return !this.isWorkstationSelected; |
Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 276 | }), |
| 277 | }, |
Yoshie Muranaka | 92a0a4a | 2020-07-15 10:30:31 -0700 | [diff] [blame] | 278 | }; |
| 279 | }, |
| 280 | methods: { |
SurenNeware | 978807d | 2020-09-03 18:35:21 +0530 | [diff] [blame] | 281 | onFileUpload(file) { |
| 282 | this.file = file; |
| 283 | this.$v.file.$touch(); |
| 284 | }, |
Yoshie Muranaka | 92a0a4a | 2020-07-15 10:30:31 -0700 | [diff] [blame] | 285 | uploadFirmware() { |
| 286 | const startTime = this.$options.filters.formatTime(new Date()); |
| 287 | this.setRebootTimeout(360000); //6 minute timeout |
| 288 | this.infoToast( |
| 289 | this.$t('pageFirmware.toast.infoUploadStartTimeMessage', { startTime }), |
| 290 | this.$t('pageFirmware.toast.infoUploadStartTimeTitle') |
| 291 | ); |
| 292 | if (this.isWorkstationSelected) { |
| 293 | this.dispatchWorkstationUpload(); |
| 294 | } else { |
| 295 | this.dispatchTftpUpload(); |
| 296 | } |
| 297 | }, |
| 298 | dispatchWorkstationUpload() { |
| 299 | this.$store |
| 300 | .dispatch('firmware/uploadFirmware', this.file) |
Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 301 | .then((success) => |
Yoshie Muranaka | 92a0a4a | 2020-07-15 10:30:31 -0700 | [diff] [blame] | 302 | this.infoToast( |
| 303 | success, |
| 304 | this.$t('pageFirmware.toast.successUploadTitle') |
| 305 | ) |
| 306 | ) |
| 307 | .catch(({ message }) => { |
| 308 | this.errorToast(message); |
| 309 | this.clearRebootTimeout(); |
| 310 | }); |
| 311 | }, |
| 312 | dispatchTftpUpload() { |
| 313 | const data = { |
| 314 | address: this.tftpIpAddress, |
Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 315 | filename: this.tftpFileName, |
Yoshie Muranaka | 92a0a4a | 2020-07-15 10:30:31 -0700 | [diff] [blame] | 316 | }; |
| 317 | this.$store |
| 318 | .dispatch('firmware/uploadFirmwareTFTP', data) |
Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 319 | .then((success) => |
Yoshie Muranaka | 92a0a4a | 2020-07-15 10:30:31 -0700 | [diff] [blame] | 320 | this.infoToast( |
| 321 | success, |
| 322 | this.$t('pageFirmware.toast.successUploadTitle') |
| 323 | ) |
| 324 | ) |
| 325 | .catch(({ message }) => { |
| 326 | this.errorToast(message); |
| 327 | this.clearRebootTimeout(); |
| 328 | }); |
| 329 | }, |
Yoshie Muranaka | 98bb24e | 2020-10-06 10:00:19 -0700 | [diff] [blame] | 330 | switchBmcFirmware() { |
Yoshie Muranaka | 92a0a4a | 2020-07-15 10:30:31 -0700 | [diff] [blame] | 331 | this.setRebootTimeout(); |
| 332 | this.$store |
Yoshie Muranaka | 98bb24e | 2020-10-06 10:00:19 -0700 | [diff] [blame] | 333 | .dispatch('firmware/switchBmcFirmware') |
Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 334 | .then((success) => |
Yoshie Muranaka | 92a0a4a | 2020-07-15 10:30:31 -0700 | [diff] [blame] | 335 | this.infoToast(success, this.$t('global.status.success')) |
| 336 | ) |
| 337 | .catch(({ message }) => { |
| 338 | this.errorToast(message); |
| 339 | this.clearRebootTimeout(); |
| 340 | }); |
| 341 | }, |
| 342 | setRebootTimeout(timeoutMs = 60000) { |
| 343 | // Set a timeout to disable page interactions while |
| 344 | // an upload or BMC reboot is in progress |
| 345 | this.startLoader(); |
| 346 | this.timeoutId = setTimeout(() => { |
| 347 | this.endLoader(); |
| 348 | this.infoToast( |
| 349 | this.$t('pageFirmware.toast.infoRefreshApplicationMessage'), |
| 350 | this.$t('pageFirmware.toast.infoRefreshApplicationTitle') |
| 351 | ); |
| 352 | }, timeoutMs); |
| 353 | }, |
| 354 | clearRebootTimeout() { |
| 355 | if (this.timeoutId) { |
| 356 | clearTimeout(this.timeoutId); |
| 357 | this.endLoader(); |
| 358 | } |
| 359 | }, |
| 360 | onSubmitUpload() { |
| 361 | this.$v.$touch(); |
| 362 | if (this.$v.$invalid) return; |
| 363 | this.$bvModal.show('modal-upload'); |
Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 364 | }, |
| 365 | }, |
Yoshie Muranaka | 92a0a4a | 2020-07-15 10:30:31 -0700 | [diff] [blame] | 366 | }; |
| 367 | </script> |
| 368 | |
| 369 | <style lang="scss" scoped> |
| 370 | .update-code { |
| 371 | border-left: none; |
| 372 | @include media-breakpoint-up(xl) { |
| 373 | border-left: 1px solid gray('300'); |
| 374 | } |
| 375 | } |
Yoshie Muranaka | 98bb24e | 2020-10-06 10:00:19 -0700 | [diff] [blame] | 376 | .card-footer { |
Dixsie Wolmers | 30f11f8 | 2020-11-10 16:07:56 -0600 | [diff] [blame] | 377 | height: 40px; |
Yoshie Muranaka | 98bb24e | 2020-10-06 10:00:19 -0700 | [diff] [blame] | 378 | } |
| 379 | .card-body { |
| 380 | padding: 0.75rem 1.25rem; |
| 381 | } |
Yoshie Muranaka | 92a0a4a | 2020-07-15 10:30:31 -0700 | [diff] [blame] | 382 | </style> |