blob: 2e601bd43a2ac7afc1d62507898c662ed8f685d7 [file] [log] [blame]
Yoshie Muranaka0b980db2020-10-06 09:24:14 -07001<template>
2 <b-container fluid="xl">
Yoshie Muranaka6f712842021-02-04 11:23:03 -08003 <page-title />
Yoshie Muranaka7bc85e42021-02-11 09:59:13 -08004 <alerts-server-power
5 v-if="isServerPowerOffRequired"
6 :is-host-off="isHostOff"
7 />
8
9 <!-- Firmware cards -->
Yoshie Muranaka6f712842021-02-04 11:23:03 -080010 <b-row>
11 <b-col xl="10">
Yoshie Muranaka7bc85e42021-02-11 09:59:13 -080012 <!-- BMC Firmware -->
13 <bmc-cards :is-page-disabled="isPageDisabled" />
Yoshie Muranaka6f712842021-02-04 11:23:03 -080014
Yoshie Muranaka7bc85e42021-02-11 09:59:13 -080015 <!-- Host Firmware -->
16 <host-cards v-if="!isSingleFileUploadEnabled" />
Yoshie Muranaka0b980db2020-10-06 09:24:14 -070017 </b-col>
18 </b-row>
19
Yoshie Muranaka7bc85e42021-02-11 09:59:13 -080020 <!-- Update firmware-->
21 <page-section
22 :section-title="
23 $t('pageFirmware.singleFileUpload.sectionTitleUpdateFirmware')
24 "
25 >
26 <b-row>
27 <b-col sm="8" md="6" xl="4">
28 <!-- Update form -->
29 <form-update
30 :is-host-off="isHostOff"
31 :is-page-disabled="isPageDisabled"
32 />
33 </b-col>
34 </b-row>
35 </page-section>
Yoshie Muranaka0b980db2020-10-06 09:24:14 -070036 </b-container>
37</template>
38
39<script>
Yoshie Muranaka7bc85e42021-02-11 09:59:13 -080040import AlertsServerPower from './FirmwareAlertServerPower';
41import BmcCards from './FirmwareCardsBmc';
42import FormUpdate from './FirmwareFormUpdate';
43import HostCards from './FirmwareCardsHost';
Yoshie Muranaka0b980db2020-10-06 09:24:14 -070044import PageSection from '@/components/Global/PageSection';
45import PageTitle from '@/components/Global/PageTitle';
Yoshie Muranaka0b980db2020-10-06 09:24:14 -070046
Yoshie Muranakad73f4962020-12-09 08:52:23 -080047import LoadingBarMixin, { loading } from '@/components/Mixins/LoadingBarMixin';
Yoshie Muranaka0b980db2020-10-06 09:24:14 -070048
49export default {
50 name: 'FirmwareSingleImage',
51 components: {
Yoshie Muranaka7bc85e42021-02-11 09:59:13 -080052 AlertsServerPower,
53 BmcCards,
54 FormUpdate,
55 HostCards,
Yoshie Muranaka0b980db2020-10-06 09:24:14 -070056 PageSection,
Derick Montague602e98a2020-10-21 16:20:00 -050057 PageTitle,
Yoshie Muranaka0b980db2020-10-06 09:24:14 -070058 },
Yoshie Muranaka7bc85e42021-02-11 09:59:13 -080059 mixins: [LoadingBarMixin],
Derick Montagueefbd4012020-11-03 14:10:45 -060060 beforeRouteLeave(to, from, next) {
61 this.hideLoader();
Derick Montagueefbd4012020-11-03 14:10:45 -060062 next();
63 },
Yoshie Muranaka0b980db2020-10-06 09:24:14 -070064 data() {
65 return {
Yoshie Muranakad73f4962020-12-09 08:52:23 -080066 loading,
Yoshie Muranakafc387aa2021-02-11 08:27:36 -080067 isServerPowerOffRequired:
68 process.env.VUE_APP_SERVER_OFF_REQUIRED === 'true',
Yoshie Muranaka0b980db2020-10-06 09:24:14 -070069 };
70 },
71 computed: {
72 hostStatus() {
73 return this.$store.getters['global/hostStatus'];
74 },
75 isHostOff() {
76 return this.hostStatus === 'off' ? true : false;
77 },
Yoshie Muranaka7bc85e42021-02-11 09:59:13 -080078 isSingleFileUploadEnabled() {
79 return this.$store.getters[
80 'firmwareSingleImage/isSingleFileUploadEnabled'
81 ];
Yoshie Muranaka0b980db2020-10-06 09:24:14 -070082 },
Yoshie Muranaka0b980db2020-10-06 09:24:14 -070083 isPageDisabled() {
Yoshie Muranakafc387aa2021-02-11 08:27:36 -080084 if (this.isServerPowerOffRequired) {
85 return !this.isHostOff || this.loading || this.isOperationInProgress;
86 }
87 return this.loading || this.isOperationInProgress;
Derick Montague602e98a2020-10-21 16:20:00 -050088 },
Yoshie Muranaka0b980db2020-10-06 09:24:14 -070089 },
90 created() {
91 this.startLoader();
Yoshie Muranaka7bc85e42021-02-11 09:59:13 -080092 this.$store
93 .dispatch('firmwareSingleImage/getFirmwareInformation')
94 .finally(() => this.endLoader());
Derick Montague602e98a2020-10-21 16:20:00 -050095 },
Yoshie Muranaka0b980db2020-10-06 09:24:14 -070096};
97</script>