1<template> 2 <page-section :section-title="$t('pageInventory.system')"> 3 <b-table 4 responsive="md" 5 hover 6 show-empty 7 :items="systems" 8 :fields="fields" 9 :empty-text="$t('global.table.emptyMessage')" 10 > 11 <!-- Expand chevron icon --> 12 <template #cell(expandRow)="row"> 13 <b-button 14 variant="link" 15 data-test-id="hardwareStatus-button-expandSystem" 16 :title="expandRowLabel" 17 class="btn-icon-only" 18 @click="toggleRowDetails(row)" 19 > 20 <icon-chevron /> 21 <span class="sr-only">{{ expandRowLabel }}</span> 22 </b-button> 23 </template> 24 25 <!-- Health --> 26 <template #cell(health)="{ value }"> 27 <status-icon :status="statusIcon(value)" /> 28 {{ value }} 29 </template> 30 31 <template #cell(locationIndicatorActive)="{ item }"> 32 <b-form-checkbox 33 id="identifyLedSwitchSystem" 34 v-model="item.locationIndicatorActive" 35 data-test-id="inventorySystem-toggle-identifyLed" 36 switch 37 @change="toggleIdentifyLedSwitch" 38 > 39 <span class="sr-only"> 40 {{ $t('pageInventory.table.identifyLed') }} 41 </span> 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>{{ tableFormatter(item.serialNumber) }}</dd> 57 <!-- Model --> 58 <dt>{{ $t('pageInventory.table.model') }}:</dt> 59 <dd>{{ tableFormatter(item.model) }}</dd> 60 <!-- Asset tag --> 61 <dt>{{ $t('pageInventory.table.assetTag') }}:</dt> 62 <dd class="mb-2"> 63 {{ tableFormatter(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>{{ tableFormatter(item.statusState) }}</dd> 72 <!-- Power state --> 73 <dt>{{ $t('pageInventory.table.power') }}:</dt> 74 <dd>{{ tableFormatter(item.powerState) }}</dd> 75 <!-- Health rollup --> 76 <dt>{{ $t('pageInventory.table.healthRollup') }}:</dt> 77 <dd>{{ tableFormatter(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>{{ tableFormatter(item.assetTag) }}</dd> 88 <!-- Description --> 89 <dt>{{ $t('pageInventory.table.description') }}:</dt> 90 <dd>{{ tableFormatter(item.description) }}</dd> 91 <!-- Sub Model --> 92 <dt>{{ $t('pageInventory.table.subModel') }}:</dt> 93 <dd> 94 {{ tableFormatter(item.subModel) }} 95 </dd> 96 <!-- System Type --> 97 <dt>{{ $t('pageInventory.table.systemType') }}:</dt> 98 <dd> 99 {{ tableFormatter(item.systemType) }} 100 </dd> 101 </dl> 102 </b-col> 103 <b-col sm="6"> 104 <dl> 105 <!-- Memory Summary --> 106 <dt class="mt-1 mb-2 font-weight-bold float-none"> 107 {{ $t('pageInventory.table.memorySummary') }} 108 </dt> 109 <!-- Status state --> 110 <dt>{{ $t('pageInventory.table.statusState') }}:</dt> 111 <dd>{{ tableFormatter(item.memorySummaryState) }}</dd> 112 <!-- Health --> 113 <dt>{{ $t('pageInventory.table.health') }}:</dt> 114 <dd>{{ tableFormatter(item.memorySummaryHealth) }}</dd> 115 <!-- Health Roll --> 116 <dt>{{ $t('pageInventory.table.healthRollup') }}:</dt> 117 <dd>{{ tableFormatter(item.memorySummaryHealthRoll) }}</dd> 118 119 <!-- Processor Summary --> 120 <dt class="mt-1 mb-2 font-weight-bold float-none"> 121 {{ $t('pageInventory.table.processorSummary') }} 122 </dt> 123 <!-- Status state --> 124 <dt>{{ $t('pageInventory.table.statusState') }}:</dt> 125 <dd>{{ tableFormatter(item.processorSummaryState) }}</dd> 126 <!-- Health --> 127 <dt>{{ $t('pageInventory.table.health') }}:</dt> 128 <dd>{{ tableFormatter(item.processorSummaryHealth) }}</dd> 129 <!-- Health Rollup --> 130 <dt>{{ $t('pageInventory.table.healthRollup') }}:</dt> 131 <dd>{{ tableFormatter(item.processorSummaryHealthRoll) }}</dd> 132 <!-- Count --> 133 <dt>{{ $t('pageInventory.table.count') }}:</dt> 134 <dd>{{ tableFormatter(item.processorSummaryCount) }}</dd> 135 </dl> 136 </b-col> 137 </b-row> 138 </b-container> 139 </template> 140 </b-table> 141 </page-section> 142</template> 143 144<script> 145import BVToastMixin from '@/components/Mixins/BVToastMixin'; 146import PageSection from '@/components/Global/PageSection'; 147import IconChevron from '@carbon/icons-vue/es/chevron--down/20'; 148 149import StatusIcon from '@/components/Global/StatusIcon'; 150 151import TableRowExpandMixin, { 152 expandRowLabel, 153} from '@/components/Mixins/TableRowExpandMixin'; 154import TableDataFormatterMixin from '@/components/Mixins/TableDataFormatterMixin'; 155 156export default { 157 components: { IconChevron, PageSection, StatusIcon }, 158 mixins: [BVToastMixin, TableRowExpandMixin, TableDataFormatterMixin], 159 data() { 160 return { 161 fields: [ 162 { 163 key: 'expandRow', 164 label: '', 165 tdClass: 'table-row-expand', 166 }, 167 { 168 key: 'id', 169 label: this.$t('pageInventory.table.id'), 170 formatter: this.tableFormatter, 171 }, 172 { 173 key: 'hardwareType', 174 label: this.$t('pageInventory.table.hardwareType'), 175 formatter: this.tableFormatter, 176 tdClass: 'text-nowrap', 177 }, 178 { 179 key: 'health', 180 label: this.$t('pageInventory.table.health'), 181 formatter: this.tableFormatter, 182 tdClass: 'text-nowrap', 183 }, 184 { 185 key: 'locationNumber', 186 label: this.$t('pageInventory.table.locationNumber'), 187 formatter: this.tableFormatter, 188 }, 189 { 190 key: 'locationIndicatorActive', 191 label: this.$t('pageInventory.table.identifyLed'), 192 formatter: this.tableFormatter, 193 }, 194 ], 195 expandRowLabel: expandRowLabel, 196 }; 197 }, 198 computed: { 199 systems() { 200 return this.$store.getters['system/systems']; 201 }, 202 }, 203 created() { 204 this.$store.dispatch('system/getSystem').finally(() => { 205 // Emit initial data fetch complete to parent component 206 this.$root.$emit('hardware-status-system-complete'); 207 }); 208 }, 209 methods: { 210 toggleIdentifyLedSwitch(state) { 211 this.$store 212 .dispatch('system/changeIdentifyLedState', state) 213 .catch(({ message }) => this.errorToast(message)); 214 }, 215 }, 216}; 217</script> 218