blob: 96736736a7402a9ba8f1e809e339d2c120add582 [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">
120 <dl>
121 <!-- Firmware Version -->
122 <dt>{{ $t('pageHardwareStatus.table.firmwareVersion') }}:</dt>
123 <dd>{{ item.firmwareVersion }}</dd>
Yoshie Muranaka54c6bfc2020-06-12 08:29:42 -0700124 <!-- Graphical console -->
Sandeepa Singh78b6b532021-04-09 18:08:22 +0530125 <dt class="mt-1 mb-2 float-none">
Yoshie Muranaka54c6bfc2020-06-12 08:29:42 -0700126 {{ $t('pageHardwareStatus.table.graphicalConsole') }}
127 </dt>
128 <dt>
129 {{ $t('pageHardwareStatus.table.connectTypesSupported') }}:
130 </dt>
131 <dd>
132 {{ tableFormatterArray(item.graphicalConsoleConnectTypes) }}
133 </dd>
Yoshie Muranaka54c6bfc2020-06-12 08:29:42 -0700134 <dt>
135 {{ $t('pageHardwareStatus.table.maxConcurrentSessions') }}:
136 </dt>
Sandeepa Singh78b6b532021-04-09 18:08:22 +0530137 <dd>
138 {{ tableFormatter(item.graphicalConsoleMaxSessions) }}
139 </dd>
Yoshie Muranaka54c6bfc2020-06-12 08:29:42 -0700140 <dt>{{ $t('pageHardwareStatus.table.serviceEnabled') }}:</dt>
Sandeepa Singh78b6b532021-04-09 18:08:22 +0530141 <dd>
142 {{ tableFormatter(item.graphicalConsoleEnabled) }}
143 </dd>
Yoshie Muranaka54c6bfc2020-06-12 08:29:42 -0700144 <!-- Serial console -->
Sandeepa Singh78b6b532021-04-09 18:08:22 +0530145 <dt class="mt-1 mb-2 float-none">
Yoshie Muranaka54c6bfc2020-06-12 08:29:42 -0700146 {{ $t('pageHardwareStatus.table.serialConsole') }}
147 </dt>
148 <dt>
149 {{ $t('pageHardwareStatus.table.connectTypesSupported') }}:
150 </dt>
151 <dd>
152 {{ tableFormatterArray(item.serialConsoleConnectTypes) }}
153 </dd>
Yoshie Muranaka54c6bfc2020-06-12 08:29:42 -0700154 <dt>
155 {{ $t('pageHardwareStatus.table.maxConcurrentSessions') }}:
156 </dt>
157 <dd>{{ tableFormatter(item.serialConsoleMaxSessions) }}</dd>
Yoshie Muranaka54c6bfc2020-06-12 08:29:42 -0700158 <dt>{{ $t('pageHardwareStatus.table.serviceEnabled') }}:</dt>
159 <dd>{{ tableFormatter(item.serialConsoleEnabled) }}</dd>
160 </dl>
161 </b-col>
162 </b-row>
163 </b-container>
164 </template>
165 </b-table>
166 </page-section>
167</template>
168
169<script>
170import PageSection from '@/components/Global/PageSection';
171import IconChevron from '@carbon/icons-vue/es/chevron--down/20';
Yoshie Muranaka54c6bfc2020-06-12 08:29:42 -0700172import StatusIcon from '@/components/Global/StatusIcon';
Sandeepa Singh78b6b532021-04-09 18:08:22 +0530173import BVToastMixin from '@/components/Mixins/BVToastMixin';
SurenNewareba91c492020-10-27 14:18:54 +0530174import TableRowExpandMixin, {
175 expandRowLabel,
176} from '@/components/Mixins/TableRowExpandMixin';
Yoshie Muranaka386df452020-06-18 12:45:13 -0700177import TableDataFormatterMixin from '@/components/Mixins/TableDataFormatterMixin';
Yoshie Muranaka54c6bfc2020-06-12 08:29:42 -0700178
179export default {
180 components: { IconChevron, PageSection, StatusIcon },
Sandeepa Singh78b6b532021-04-09 18:08:22 +0530181 mixins: [BVToastMixin, TableRowExpandMixin, TableDataFormatterMixin],
Yoshie Muranaka54c6bfc2020-06-12 08:29:42 -0700182 data() {
183 return {
184 fields: [
185 {
186 key: 'expandRow',
187 label: '',
Derick Montague602e98a2020-10-21 16:20:00 -0500188 tdClass: 'table-row-expand',
Yoshie Muranaka54c6bfc2020-06-12 08:29:42 -0700189 },
190 {
191 key: 'id',
192 label: this.$t('pageHardwareStatus.table.id'),
Derick Montague602e98a2020-10-21 16:20:00 -0500193 formatter: this.tableFormatter,
Yoshie Muranaka54c6bfc2020-06-12 08:29:42 -0700194 },
195 {
196 key: 'health',
197 label: this.$t('pageHardwareStatus.table.health'),
Dixsie Wolmersa04d46f2020-10-22 06:34:56 -0500198 formatter: this.tableFormatter,
Yoshie Muranaka54c6bfc2020-06-12 08:29:42 -0700199 },
200 {
Sandeepa Singh78b6b532021-04-09 18:08:22 +0530201 key: 'locationNumber',
202 label: this.$t('pageHardwareStatus.table.locationNumber'),
Derick Montague602e98a2020-10-21 16:20:00 -0500203 formatter: this.tableFormatter,
Yoshie Muranaka54c6bfc2020-06-12 08:29:42 -0700204 },
205 {
Sandeepa Singh78b6b532021-04-09 18:08:22 +0530206 key: 'identifyLed',
207 label: this.$t('pageHardwareStatus.table.identifyLed'),
Derick Montague602e98a2020-10-21 16:20:00 -0500208 formatter: this.tableFormatter,
209 },
210 ],
SurenNewareba91c492020-10-27 14:18:54 +0530211 expandRowLabel: expandRowLabel,
Yoshie Muranaka54c6bfc2020-06-12 08:29:42 -0700212 };
213 },
214 computed: {
215 bmc() {
216 return this.$store.getters['bmc/bmc'];
217 },
218 items() {
219 if (this.bmc) {
220 return [this.bmc];
221 } else {
222 return [];
223 }
Derick Montague602e98a2020-10-21 16:20:00 -0500224 },
Yoshie Muranaka54c6bfc2020-06-12 08:29:42 -0700225 },
226 created() {
227 this.$store.dispatch('bmc/getBmcInfo').finally(() => {
Gunnar Millsdefc9e22020-07-07 20:29:03 -0500228 // Emit initial data fetch complete to parent component
Sukanya Pandeyedb8a772020-10-29 11:33:42 +0530229 this.$root.$emit('hardware-status-bmc-manager-complete');
Yoshie Muranaka54c6bfc2020-06-12 08:29:42 -0700230 });
Derick Montague602e98a2020-10-21 16:20:00 -0500231 },
Sandeepa Singh78b6b532021-04-09 18:08:22 +0530232 methods: {
233 toggleIdentifyLedValue(row) {
234 this.$store
235 .dispatch('bmc/updateIdentifyLedValue', {
236 uri: row.uri,
237 identifyLed: row.identifyLed,
238 })
239 .catch(({ message }) => this.errorToast(message));
240 },
241 // TO DO: remove hasIdentifyLed method once the following story is merged:
242 // https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/43179
243 hasIdentifyLed(identifyLed) {
244 return typeof identifyLed === 'boolean';
245 },
246 },
Yoshie Muranaka54c6bfc2020-06-12 08:29:42 -0700247};
248</script>