1<template> 2 <page-section :section-title="$t('pageInventory.system')"> 3 <b-table 4 responsive="md" 5 hover 6 show-empty 7 thead-class="table-light" 8 :items="systems" 9 :fields="fields" 10 :empty-text="$t('global.table.emptyMessage')" 11 :busy="isBusy" 12 > 13 <!-- Expand chevron icon --> 14 <template #cell(expandRow)="row"> 15 <b-button 16 variant="link" 17 data-test-id="hardwareStatus-button-expandSystem" 18 :title="expandRowLabel" 19 class="btn-icon-only" 20 :class="{ collapsed: !row.detailsShowing }" 21 @click="toggleRowDetails(row)" 22 > 23 <icon-chevron /> 24 <span class="visually-hidden">{{ expandRowLabel }}</span> 25 </b-button> 26 </template> 27 28 <!-- Health --> 29 <template #cell(health)="{ value }"> 30 <status-icon :status="statusIcon(value)" /> 31 {{ value }} 32 </template> 33 34 <template #cell(locationIndicatorActive)="{ item }"> 35 <b-form-checkbox 36 id="identifyLedSwitchSystem" 37 v-model="item.locationIndicatorActive" 38 data-test-id="inventorySystem-toggle-identifyLed" 39 switch 40 @change="toggleIdentifyLedSwitch" 41 > 42 <span v-if="item.locationIndicatorActive"> 43 {{ $t('global.status.on') }} 44 </span> 45 <span v-else>{{ $t('global.status.off') }}</span> 46 </b-form-checkbox> 47 </template> 48 49 <template #row-details="{ item }"> 50 <b-container fluid> 51 <b-row> 52 <b-col class="mt-2" sm="6"> 53 <dl> 54 <!-- Serial number --> 55 <dt>{{ $t('pageInventory.table.serialNumber') }}:</dt> 56 <dd>{{ dataFormatter(item.serialNumber) }}</dd> 57 <!-- Model --> 58 <dt>{{ $t('pageInventory.table.model') }}:</dt> 59 <dd>{{ dataFormatter(item.model) }}</dd> 60 <!-- Asset tag --> 61 <dt>{{ $t('pageInventory.table.assetTag') }}:</dt> 62 <dd class="mb-2"> 63 {{ dataFormatter(item.assetTag) }} 64 </dd> 65 </dl> 66 </b-col> 67 <b-col class="mt-2" sm="6"> 68 <dl> 69 <!-- Status state --> 70 <dt>{{ $t('pageInventory.table.statusState') }}:</dt> 71 <dd>{{ dataFormatter(item.statusState) }}</dd> 72 <!-- Power state --> 73 <dt>{{ $t('pageInventory.table.power') }}:</dt> 74 <dd>{{ dataFormatter(item.powerState) }}</dd> 75 <!-- Health rollup --> 76 <dt>{{ $t('pageInventory.table.healthRollup') }}:</dt> 77 <dd>{{ dataFormatter(item.healthRollup) }}</dd> 78 </dl> 79 </b-col> 80 </b-row> 81 <div class="section-divider mb-3 mt-3"></div> 82 <b-row> 83 <b-col class="mt-1" sm="6"> 84 <dl> 85 <!-- Manufacturer --> 86 <dt>{{ $t('pageInventory.table.manufacturer') }}:</dt> 87 <dd>{{ dataFormatter(item.manufacturer) }}</dd> 88 <!-- Description --> 89 <dt>{{ $t('pageInventory.table.description') }}:</dt> 90 <dd>{{ dataFormatter(item.description) }}</dd> 91 <!-- Sub Model --> 92 <dt>{{ $t('pageInventory.table.subModel') }}:</dt> 93 <dd> 94 {{ dataFormatter(item.subModel) }} 95 </dd> 96 <!-- System Type --> 97 <dt>{{ $t('pageInventory.table.systemType') }}:</dt> 98 <dd> 99 {{ dataFormatter(item.systemType) }} 100 </dd> 101 </dl> 102 </b-col> 103 <b-col sm="6"> 104 <!-- Memory Summary --> 105 <p class="mt-1 mb-2 h6 float-none m-0"> 106 {{ $t('pageInventory.table.memorySummary') }} 107 </p> 108 <dl class="ms-4"> 109 <!-- Total system memory --> 110 <dt>{{ $t('pageInventory.table.totalSystemMemoryGiB') }}:</dt> 111 <dd> 112 {{ dataFormatter(item.totalSystemMemoryGiB) }} 113 {{ $t('unit.GiB') }} 114 </dd> 115 </dl> 116 <!-- Processor Summary --> 117 <p class="mt-1 mb-2 h6 float-none m-0"> 118 {{ $t('pageInventory.table.processorSummary') }} 119 </p> 120 <dl class="ms-4"> 121 <!-- Count --> 122 <dt>{{ $t('pageInventory.table.count') }}:</dt> 123 <dd> 124 {{ dataFormatter(item.processorSummaryCount) }} 125 </dd> 126 <!-- Core Count --> 127 <dt>{{ $t('pageInventory.table.coreCount') }}:</dt> 128 <dd> 129 {{ dataFormatter(item.processorSummaryCoreCount) }} 130 </dd> 131 </dl> 132 <!-- Serial console --> 133 <p class="mt-1 mb-2 h6 float-none m-0"> 134 {{ $t('pageInventory.table.serialConsole') }} 135 </p> 136 <dl class="ms-4"> 137 <dt>{{ $t('pageInventory.table.maxConcurrentSessions') }}:</dt> 138 <dd> 139 {{ dataFormatter(item.serialConsoleMaxSessions) }} 140 </dd> 141 <dt>{{ $t('pageInventory.table.serviceEnabled') }}:</dt> 142 <dd> 143 {{ dataFormatter(item.serialConsoleEnabled) }} 144 </dd> 145 </dl> 146 </b-col> 147 </b-row> 148 </b-container> 149 </template> 150 </b-table> 151 </page-section> 152</template> 153 154<script> 155import BVToastMixin from '@/components/Mixins/BVToastMixin'; 156import PageSection from '@/components/Global/PageSection'; 157import IconChevron from '@carbon/icons-vue/es/chevron--down/20'; 158 159import StatusIcon from '@/components/Global/StatusIcon'; 160 161import TableRowExpandMixin, { 162 expandRowLabel, 163} from '@/components/Mixins/TableRowExpandMixin'; 164import DataFormatterMixin from '@/components/Mixins/DataFormatterMixin'; 165import { useI18n } from 'vue-i18n'; 166import i18n from '@/i18n'; 167 168export default { 169 components: { IconChevron, PageSection, StatusIcon }, 170 mixins: [BVToastMixin, TableRowExpandMixin, DataFormatterMixin], 171 data() { 172 return { 173 $t: useI18n().t, 174 isBusy: true, 175 fields: [ 176 { 177 key: 'expandRow', 178 label: '', 179 tdClass: 'table-row-expand', 180 }, 181 { 182 key: 'id', 183 label: i18n.global.t('pageInventory.table.id'), 184 formatter: this.dataFormatter, 185 }, 186 { 187 key: 'hardwareType', 188 label: i18n.global.t('pageInventory.table.hardwareType'), 189 formatter: this.dataFormatter, 190 tdClass: 'text-nowrap', 191 }, 192 { 193 key: 'health', 194 label: i18n.global.t('pageInventory.table.health'), 195 formatter: this.dataFormatter, 196 tdClass: 'text-nowrap', 197 }, 198 { 199 key: 'locationNumber', 200 label: i18n.global.t('pageInventory.table.locationNumber'), 201 formatter: this.dataFormatter, 202 }, 203 { 204 key: 'locationIndicatorActive', 205 label: i18n.global.t('pageInventory.table.identifyLed'), 206 formatter: this.dataFormatter, 207 }, 208 ], 209 expandRowLabel: expandRowLabel, 210 }; 211 }, 212 computed: { 213 systems() { 214 return this.$store.getters['system/systems']; 215 }, 216 }, 217 created() { 218 this.$store.dispatch('system/getSystem').finally(() => { 219 // Emit initial data fetch complete to parent component 220 require('@/eventBus').default.$emit('hardware-status-system-complete'); 221 this.isBusy = false; 222 }); 223 }, 224 methods: { 225 toggleIdentifyLedSwitch(state) { 226 this.$store 227 .dispatch('system/changeIdentifyLedState', state) 228 .then((message) => this.successToast(message)) 229 .catch(({ message }) => this.errorToast(message)); 230 }, 231 }, 232}; 233</script> 234