1<template> 2 <page-section :section-title="$t('pageInventory.bmcManager')"> 3 <b-table 4 responsive="md" 5 hover 6 :items="items" 7 :fields="fields" 8 show-empty 9 :empty-text="$t('global.table.emptyMessage')" 10 :busy="isBusy" 11 > 12 <!-- Expand chevron icon --> 13 <template #cell(expandRow)="row"> 14 <b-button 15 variant="link" 16 data-test-id="hardwareStatus-button-expandBmc" 17 :title="expandRowLabel" 18 class="btn-icon-only" 19 @click="toggleRowDetails(row)" 20 > 21 <icon-chevron /> 22 <span class="sr-only">{{ expandRowLabel }}</span> 23 </b-button> 24 </template> 25 26 <!-- Health --> 27 <template #cell(health)="{ value }"> 28 <status-icon :status="statusIcon(value)" /> 29 {{ value }} 30 </template> 31 32 <!-- Toggle identify LED --> 33 <template #cell(identifyLed)="row"> 34 <b-form-checkbox 35 v-if="hasIdentifyLed(row.item.identifyLed)" 36 v-model="row.item.identifyLed" 37 name="switch" 38 switch 39 @change="toggleIdentifyLedValue(row.item)" 40 > 41 <span v-if="row.item.identifyLed"> 42 {{ $t('global.status.on') }} 43 </span> 44 <span v-else> {{ $t('global.status.off') }} </span> 45 </b-form-checkbox> 46 <div v-else>--</div> 47 </template> 48 49 <template #row-details="{ item }"> 50 <b-container fluid> 51 <b-row> 52 <b-col class="mt-2" sm="6" xl="6"> 53 <dl> 54 <!-- Name --> 55 <dt>{{ $t('pageInventory.table.name') }}:</dt> 56 <dd>{{ dataFormatter(item.name) }}</dd> 57 <!-- Part number --> 58 <dt>{{ $t('pageInventory.table.partNumber') }}:</dt> 59 <dd>{{ dataFormatter(item.partNumber) }}</dd> 60 <!-- Serial number --> 61 <dt>{{ $t('pageInventory.table.serialNumber') }}:</dt> 62 <dd>{{ dataFormatter(item.serialNumber) }}</dd> 63 <!-- Spare part number --> 64 <dt>{{ $t('pageInventory.table.sparePartNumber') }}:</dt> 65 <dd>{{ dataFormatter(item.sparePartNumber) }}</dd> 66 <!-- Model --> 67 <dt>{{ $t('pageInventory.table.model') }}:</dt> 68 <dd>{{ dataFormatter(item.model) }}</dd> 69 <!-- UUID --> 70 <dt>{{ $t('pageInventory.table.uuid') }}:</dt> 71 <dd>{{ dataFormatter(item.uuid) }}</dd> 72 <!-- Service entry point UUID --> 73 <dt>{{ $t('pageInventory.table.serviceEntryPointUuid') }}:</dt> 74 <dd>{{ dataFormatter(item.serviceEntryPointUuid) }}</dd> 75 </dl> 76 </b-col> 77 <b-col class="mt-2" sm="6" xl="6"> 78 <dl> 79 <!-- Status state --> 80 <dt>{{ $t('pageInventory.table.statusState') }}:</dt> 81 <dd>{{ dataFormatter(item.statusState) }}</dd> 82 <!-- Power state --> 83 <dt>{{ $t('pageInventory.table.power') }}:</dt> 84 <dd>{{ dataFormatter(item.powerState) }}</dd> 85 <!-- Health rollup --> 86 <dt>{{ $t('pageInventory.table.healthRollup') }}:</dt> 87 <dd>{{ dataFormatter(item.healthRollup) }}</dd> 88 <!-- BMC date and time --> 89 <dt>{{ $t('pageInventory.table.bmcDateTime') }}:</dt> 90 <dd> 91 {{ item.dateTime | formatDate }} 92 {{ item.dateTime | formatTime }} 93 </dd> 94 <!-- Reset date and time --> 95 <dt>{{ $t('pageInventory.table.lastResetTime') }}:</dt> 96 <dd> 97 {{ item.lastResetTime | formatDate }} 98 {{ item.lastResetTime | formatTime }} 99 </dd> 100 </dl> 101 </b-col> 102 </b-row> 103 <div class="section-divider mb-3 mt-3"></div> 104 <b-row> 105 <b-col class="mt-2" sm="6" xl="6"> 106 <dl> 107 <!-- Manufacturer --> 108 <dt>{{ $t('pageInventory.table.manufacturer') }}:</dt> 109 <dd>{{ dataFormatter(item.manufacturer) }}</dd> 110 <!-- Description --> 111 <dt>{{ $t('pageInventory.table.description') }}:</dt> 112 <dd>{{ dataFormatter(item.description) }}</dd> 113 <!-- Manager type --> 114 <dt>{{ $t('pageInventory.table.managerType') }}:</dt> 115 <dd>{{ dataFormatter(item.managerType) }}</dd> 116 </dl> 117 </b-col> 118 <b-col class="mt-2" sm="6" xl="6"> 119 <!-- Firmware Version --> 120 <dl> 121 <dt>{{ $t('pageInventory.table.firmwareVersion') }}:</dt> 122 <dd>{{ item.firmwareVersion }}</dd> 123 </dl> 124 <!-- Graphical console --> 125 <p class="mt-1 mb-2 h6 float-none m-0"> 126 {{ $t('pageInventory.table.graphicalConsole') }} 127 </p> 128 <dl class="ml-4"> 129 <dt>{{ $t('pageInventory.table.connectTypesSupported') }}:</dt> 130 <dd> 131 {{ dataFormatterArray(item.graphicalConsoleConnectTypes) }} 132 </dd> 133 <dt>{{ $t('pageInventory.table.maxConcurrentSessions') }}:</dt> 134 <dd> 135 {{ dataFormatter(item.graphicalConsoleMaxSessions) }} 136 </dd> 137 <dt>{{ $t('pageInventory.table.serviceEnabled') }}:</dt> 138 <dd> 139 {{ dataFormatter(item.graphicalConsoleEnabled) }} 140 </dd> 141 </dl> 142 <!-- Serial console --> 143 <p class="mt-1 mb-2 h6 float-none m-0"> 144 {{ $t('pageInventory.table.serialConsole') }} 145 </p> 146 <dl class="ml-4"> 147 <dt>{{ $t('pageInventory.table.connectTypesSupported') }}:</dt> 148 <dd> 149 {{ dataFormatterArray(item.serialConsoleConnectTypes) }} 150 </dd> 151 <dt>{{ $t('pageInventory.table.maxConcurrentSessions') }}:</dt> 152 <dd>{{ dataFormatter(item.serialConsoleMaxSessions) }}</dd> 153 <dt>{{ $t('pageInventory.table.serviceEnabled') }}:</dt> 154 <dd>{{ dataFormatter(item.serialConsoleEnabled) }}</dd> 155 </dl> 156 </b-col> 157 </b-row> 158 </b-container> 159 </template> 160 </b-table> 161 </page-section> 162</template> 163 164<script> 165import PageSection from '@/components/Global/PageSection'; 166import IconChevron from '@carbon/icons-vue/es/chevron--down/20'; 167import StatusIcon from '@/components/Global/StatusIcon'; 168import BVToastMixin from '@/components/Mixins/BVToastMixin'; 169import TableRowExpandMixin, { 170 expandRowLabel, 171} from '@/components/Mixins/TableRowExpandMixin'; 172import DataFormatterMixin from '@/components/Mixins/DataFormatterMixin'; 173 174export default { 175 components: { IconChevron, PageSection, StatusIcon }, 176 mixins: [BVToastMixin, TableRowExpandMixin, DataFormatterMixin], 177 data() { 178 return { 179 isBusy: true, 180 fields: [ 181 { 182 key: 'expandRow', 183 label: '', 184 tdClass: 'table-row-expand', 185 }, 186 { 187 key: 'id', 188 label: this.$t('pageInventory.table.id'), 189 formatter: this.dataFormatter, 190 }, 191 { 192 key: 'health', 193 label: this.$t('pageInventory.table.health'), 194 formatter: this.dataFormatter, 195 }, 196 { 197 key: 'locationNumber', 198 label: this.$t('pageInventory.table.locationNumber'), 199 formatter: this.dataFormatter, 200 }, 201 { 202 key: 'identifyLed', 203 label: this.$t('pageInventory.table.identifyLed'), 204 formatter: this.dataFormatter, 205 }, 206 ], 207 expandRowLabel: expandRowLabel, 208 }; 209 }, 210 computed: { 211 bmc() { 212 return this.$store.getters['bmc/bmc']; 213 }, 214 items() { 215 if (this.bmc) { 216 return [this.bmc]; 217 } else { 218 return []; 219 } 220 }, 221 }, 222 created() { 223 this.$store.dispatch('bmc/getBmcInfo').finally(() => { 224 // Emit initial data fetch complete to parent component 225 this.$root.$emit('hardware-status-bmc-manager-complete'); 226 this.isBusy = false; 227 }); 228 }, 229 methods: { 230 toggleIdentifyLedValue(row) { 231 this.$store 232 .dispatch('bmc/updateIdentifyLedValue', { 233 uri: row.uri, 234 identifyLed: row.identifyLed, 235 }) 236 .then((message) => this.successToast(message)) 237 .catch(({ message }) => this.errorToast(message)); 238 }, 239 // TO DO: remove hasIdentifyLed method once the following story is merged: 240 // https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/43179 241 hasIdentifyLed(identifyLed) { 242 return typeof identifyLed === 'boolean'; 243 }, 244 }, 245}; 246</script> 247