blob: 07157448558c846013f393a8528b09409a918c7a [file] [log] [blame]
Yoshie Muranaka54c6bfc2020-06-12 08:29:42 -07001<template>
2 <page-section :section-title="$t('pageHardwareStatus.bmcManager')">
SurenNeware307382e2020-07-27 20:45:14 +05303 <b-table
4 responsive="md"
Sukanya Pandeyfde429e2020-09-14 20:48:39 +05305 hover
SurenNeware307382e2020-07-27 20:45:14 +05306 :items="items"
7 :fields="fields"
8 show-empty
9 :empty-text="$t('global.table.emptyMessage')"
10 >
Yoshie Muranaka54c6bfc2020-06-12 08:29:42 -070011 <!-- Expand chevron icon -->
Derick Montague602e98a2020-10-21 16:20:00 -050012 <template #cell(expandRow)="row">
Dixsie Wolmers83133762020-07-15 08:45:19 -050013 <b-button
14 variant="link"
15 data-test-id="hardwareStatus-button-expandBmc"
Dixsie Wolmers30f11f82020-11-10 16:07:56 -060016 :title="expandRowLabel"
17 class="btn-icon-only"
Dixsie Wolmersb53e0862020-09-08 14:13:38 -050018 @click="toggleRowDetails(row)"
Dixsie Wolmers83133762020-07-15 08:45:19 -050019 >
Dixsie Wolmers30f11f82020-11-10 16:07:56 -060020 <icon-chevron />
SurenNeware6e2cb972020-12-24 20:58:16 +053021 <span class="sr-only">{{ expandRowLabel }}</span>
Yoshie Muranaka54c6bfc2020-06-12 08:29:42 -070022 </b-button>
23 </template>
24
25 <!-- Health -->
Derick Montague602e98a2020-10-21 16:20:00 -050026 <template #cell(health)="{ value }">
Yoshie Muranaka54c6bfc2020-06-12 08:29:42 -070027 <status-icon :status="statusIcon(value)" />
28 {{ value }}
29 </template>
30
Sandeepa Singh78b6b532021-04-09 18:08:22 +053031 <!-- Toggle identify LED -->
32 <template #cell(identifyLed)="row">
33 <b-form-checkbox
34 v-if="hasIdentifyLed(row.item.identifyLed)"
35 v-model="row.item.identifyLed"
36 name="switch"
37 switch
38 @change="toggleIdentifyLedValue(row.item)"
39 >
40 <span v-if="row.item.identifyLed">
41 {{ $t('global.status.on') }}
42 </span>
43 <span v-else> {{ $t('global.status.off') }} </span>
44 </b-form-checkbox>
45 <div v-else>--</div>
46 </template>
47
Derick Montague602e98a2020-10-21 16:20:00 -050048 <template #row-details="{ item }">
Yoshie Muranaka54c6bfc2020-06-12 08:29:42 -070049 <b-container fluid>
50 <b-row>
Sandeepa Singh78b6b532021-04-09 18:08:22 +053051 <b-col class="mt-2" sm="6" xl="6">
Yoshie Muranaka54c6bfc2020-06-12 08:29:42 -070052 <dl>
Sandeepa Singh78b6b532021-04-09 18:08:22 +053053 <!-- Name -->
54 <dt>{{ $t('pageHardwareStatus.table.name') }}:</dt>
55 <dd>{{ tableFormatter(item.name) }}</dd>
56 <!-- Part number -->
57 <dt>{{ $t('pageHardwareStatus.table.partNumber') }}:</dt>
58 <dd>{{ tableFormatter(item.partNumber) }}</dd>
59 <!-- Serial number -->
60 <dt>{{ $t('pageHardwareStatus.table.serialNumber') }}:</dt>
61 <dd>{{ tableFormatter(item.serialNumber) }}</dd>
62 <!-- Spare part number -->
63 <dt>{{ $t('pageHardwareStatus.table.sparePartNumber') }}:</dt>
64 <dd>{{ tableFormatter(item.sparePartNumber) }}</dd>
Yoshie Muranaka54c6bfc2020-06-12 08:29:42 -070065 <!-- Model -->
66 <dt>{{ $t('pageHardwareStatus.table.model') }}:</dt>
67 <dd>{{ tableFormatter(item.model) }}</dd>
Sandeepa Singh78b6b532021-04-09 18:08:22 +053068 <!-- UUID -->
69 <dt>{{ $t('pageHardwareStatus.table.uuid') }}:</dt>
70 <dd>{{ tableFormatter(item.uuid) }}</dd>
71 <!-- Service entry point UUID -->
Yoshie Muranaka54c6bfc2020-06-12 08:29:42 -070072 <dt>
Sandeepa Singh78b6b532021-04-09 18:08:22 +053073 {{ $t('pageHardwareStatus.table.serviceEntryPointUuid') }}:
Yoshie Muranaka54c6bfc2020-06-12 08:29:42 -070074 </dt>
Sandeepa Singh78b6b532021-04-09 18:08:22 +053075 <dd>{{ tableFormatter(item.serviceEntryPointUuid) }}</dd>
76 </dl>
77 </b-col>
78 <b-col class="mt-2" sm="6" xl="6">
79 <dl>
Yoshie Muranaka54c6bfc2020-06-12 08:29:42 -070080 <!-- Status state -->
81 <dt>{{ $t('pageHardwareStatus.table.statusState') }}:</dt>
82 <dd>{{ tableFormatter(item.statusState) }}</dd>
Sandeepa Singh78b6b532021-04-09 18:08:22 +053083 <!-- Power state -->
84 <dt>{{ $t('pageHardwareStatus.table.power') }}:</dt>
85 <dd>{{ tableFormatter(item.powerState) }}</dd>
86 <!-- Health rollup -->
87 <dt>{{ $t('pageHardwareStatus.table.healthRollup') }}:</dt>
88 <dd>{{ tableFormatter(item.healthRollup) }}</dd>
89 <!-- BMC date and time -->
90 <dt>{{ $t('pageHardwareStatus.table.bmcDateTime') }}:</dt>
91 <dd>
92 {{ item.dateTime | formatDate }}
93 {{ item.dateTime | formatTime }}
94 </dd>
95 <!-- Reset date and time -->
96 <dt>{{ $t('pageHardwareStatus.table.lastResetTime') }}:</dt>
97 <dd>
98 {{ item.lastResetTime | formatDate }}
99 {{ item.lastResetTime | formatTime }}
100 </dd>
101 </dl>
102 </b-col>
103 </b-row>
104 <div class="section-divider mb-3 mt-3"></div>
105 <b-row>
106 <b-col class="mt-2" sm="6" xl="6">
107 <dl>
108 <!-- Manufacturer -->
109 <dt>{{ $t('pageHardwareStatus.table.manufacturer') }}:</dt>
110 <dd>{{ tableFormatter(item.manufacturer) }}</dd>
111 <!-- Description -->
112 <dt>{{ $t('pageHardwareStatus.table.description') }}:</dt>
113 <dd>{{ tableFormatter(item.description) }}</dd>
114 <!-- Manager type -->
115 <dt>{{ $t('pageHardwareStatus.table.managerType') }}:</dt>
116 <dd>{{ tableFormatter(item.managerType) }}</dd>
117 </dl>
118 </b-col>
119 <b-col class="mt-2" sm="6" xl="6">
Sandeepa Singh4c039192021-07-02 21:36:45 +0530120 <!-- Firmware Version -->
Sandeepa Singh78b6b532021-04-09 18:08:22 +0530121 <dl>
Sandeepa Singh78b6b532021-04-09 18:08:22 +0530122 <dt>{{ $t('pageHardwareStatus.table.firmwareVersion') }}:</dt>
123 <dd>{{ item.firmwareVersion }}</dd>
Sandeepa Singh4c039192021-07-02 21:36:45 +0530124 </dl>
125 <!-- Graphical console -->
126 <p class="mt-1 mb-2 h6 float-none m-0">
127 {{ $t('pageHardwareStatus.table.graphicalConsole') }}
128 </p>
129 <dl class="ml-4">
Yoshie Muranaka54c6bfc2020-06-12 08:29:42 -0700130 <dt>
131 {{ $t('pageHardwareStatus.table.connectTypesSupported') }}:
132 </dt>
133 <dd>
134 {{ tableFormatterArray(item.graphicalConsoleConnectTypes) }}
135 </dd>
Yoshie Muranaka54c6bfc2020-06-12 08:29:42 -0700136 <dt>
137 {{ $t('pageHardwareStatus.table.maxConcurrentSessions') }}:
138 </dt>
Sandeepa Singh78b6b532021-04-09 18:08:22 +0530139 <dd>
140 {{ tableFormatter(item.graphicalConsoleMaxSessions) }}
141 </dd>
Yoshie Muranaka54c6bfc2020-06-12 08:29:42 -0700142 <dt>{{ $t('pageHardwareStatus.table.serviceEnabled') }}:</dt>
Sandeepa Singh78b6b532021-04-09 18:08:22 +0530143 <dd>
144 {{ tableFormatter(item.graphicalConsoleEnabled) }}
145 </dd>
Sandeepa Singh4c039192021-07-02 21:36:45 +0530146 </dl>
147 <!-- Serial console -->
148 <p class="mt-1 mb-2 h6 float-none m-0">
149 {{ $t('pageHardwareStatus.table.serialConsole') }}
150 </p>
151 <dl class="ml-4">
Yoshie Muranaka54c6bfc2020-06-12 08:29:42 -0700152 <dt>
153 {{ $t('pageHardwareStatus.table.connectTypesSupported') }}:
154 </dt>
155 <dd>
156 {{ tableFormatterArray(item.serialConsoleConnectTypes) }}
157 </dd>
Yoshie Muranaka54c6bfc2020-06-12 08:29:42 -0700158 <dt>
159 {{ $t('pageHardwareStatus.table.maxConcurrentSessions') }}:
160 </dt>
161 <dd>{{ tableFormatter(item.serialConsoleMaxSessions) }}</dd>
Yoshie Muranaka54c6bfc2020-06-12 08:29:42 -0700162 <dt>{{ $t('pageHardwareStatus.table.serviceEnabled') }}:</dt>
163 <dd>{{ tableFormatter(item.serialConsoleEnabled) }}</dd>
164 </dl>
165 </b-col>
166 </b-row>
167 </b-container>
168 </template>
169 </b-table>
170 </page-section>
171</template>
172
173<script>
174import PageSection from '@/components/Global/PageSection';
175import IconChevron from '@carbon/icons-vue/es/chevron--down/20';
Yoshie Muranaka54c6bfc2020-06-12 08:29:42 -0700176import StatusIcon from '@/components/Global/StatusIcon';
Sandeepa Singh78b6b532021-04-09 18:08:22 +0530177import BVToastMixin from '@/components/Mixins/BVToastMixin';
SurenNewareba91c492020-10-27 14:18:54 +0530178import TableRowExpandMixin, {
179 expandRowLabel,
180} from '@/components/Mixins/TableRowExpandMixin';
Yoshie Muranaka386df452020-06-18 12:45:13 -0700181import TableDataFormatterMixin from '@/components/Mixins/TableDataFormatterMixin';
Yoshie Muranaka54c6bfc2020-06-12 08:29:42 -0700182
183export default {
184 components: { IconChevron, PageSection, StatusIcon },
Sandeepa Singh78b6b532021-04-09 18:08:22 +0530185 mixins: [BVToastMixin, TableRowExpandMixin, TableDataFormatterMixin],
Yoshie Muranaka54c6bfc2020-06-12 08:29:42 -0700186 data() {
187 return {
188 fields: [
189 {
190 key: 'expandRow',
191 label: '',
Derick Montague602e98a2020-10-21 16:20:00 -0500192 tdClass: 'table-row-expand',
Yoshie Muranaka54c6bfc2020-06-12 08:29:42 -0700193 },
194 {
195 key: 'id',
196 label: this.$t('pageHardwareStatus.table.id'),
Derick Montague602e98a2020-10-21 16:20:00 -0500197 formatter: this.tableFormatter,
Yoshie Muranaka54c6bfc2020-06-12 08:29:42 -0700198 },
199 {
200 key: 'health',
201 label: this.$t('pageHardwareStatus.table.health'),
Dixsie Wolmersa04d46f2020-10-22 06:34:56 -0500202 formatter: this.tableFormatter,
Yoshie Muranaka54c6bfc2020-06-12 08:29:42 -0700203 },
204 {
Sandeepa Singh78b6b532021-04-09 18:08:22 +0530205 key: 'locationNumber',
206 label: this.$t('pageHardwareStatus.table.locationNumber'),
Derick Montague602e98a2020-10-21 16:20:00 -0500207 formatter: this.tableFormatter,
Yoshie Muranaka54c6bfc2020-06-12 08:29:42 -0700208 },
209 {
Sandeepa Singh78b6b532021-04-09 18:08:22 +0530210 key: 'identifyLed',
211 label: this.$t('pageHardwareStatus.table.identifyLed'),
Derick Montague602e98a2020-10-21 16:20:00 -0500212 formatter: this.tableFormatter,
213 },
214 ],
SurenNewareba91c492020-10-27 14:18:54 +0530215 expandRowLabel: expandRowLabel,
Yoshie Muranaka54c6bfc2020-06-12 08:29:42 -0700216 };
217 },
218 computed: {
219 bmc() {
220 return this.$store.getters['bmc/bmc'];
221 },
222 items() {
223 if (this.bmc) {
224 return [this.bmc];
225 } else {
226 return [];
227 }
Derick Montague602e98a2020-10-21 16:20:00 -0500228 },
Yoshie Muranaka54c6bfc2020-06-12 08:29:42 -0700229 },
230 created() {
231 this.$store.dispatch('bmc/getBmcInfo').finally(() => {
Gunnar Millsdefc9e22020-07-07 20:29:03 -0500232 // Emit initial data fetch complete to parent component
Sukanya Pandeyedb8a772020-10-29 11:33:42 +0530233 this.$root.$emit('hardware-status-bmc-manager-complete');
Yoshie Muranaka54c6bfc2020-06-12 08:29:42 -0700234 });
Derick Montague602e98a2020-10-21 16:20:00 -0500235 },
Sandeepa Singh78b6b532021-04-09 18:08:22 +0530236 methods: {
237 toggleIdentifyLedValue(row) {
238 this.$store
239 .dispatch('bmc/updateIdentifyLedValue', {
240 uri: row.uri,
241 identifyLed: row.identifyLed,
242 })
243 .catch(({ message }) => this.errorToast(message));
244 },
245 // TO DO: remove hasIdentifyLed method once the following story is merged:
246 // https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/43179
247 hasIdentifyLed(identifyLed) {
248 return typeof identifyLed === 'boolean';
249 },
250 },
Yoshie Muranaka54c6bfc2020-06-12 08:29:42 -0700251};
252</script>