17affc529SSandeepa Singh<template> 27affc529SSandeepa Singh <page-section :section-title="$t('pageInventory.chassis')"> 37affc529SSandeepa Singh <b-table 47affc529SSandeepa Singh responsive="md" 57affc529SSandeepa Singh hover 67affc529SSandeepa Singh :items="chassis" 77affc529SSandeepa Singh :fields="fields" 87affc529SSandeepa Singh show-empty 97affc529SSandeepa Singh :empty-text="$t('global.table.emptyMessage')" 1041057853SKenneth Fullbright :busy="isBusy" 117affc529SSandeepa Singh > 127affc529SSandeepa Singh <!-- Expand chevron icon --> 137affc529SSandeepa Singh <template #cell(expandRow)="row"> 147affc529SSandeepa Singh <b-button 157affc529SSandeepa Singh variant="link" 167affc529SSandeepa Singh data-test-id="hardwareStatus-button-expandChassis" 177affc529SSandeepa Singh :title="expandRowLabel" 187affc529SSandeepa Singh class="btn-icon-only" 197affc529SSandeepa Singh @click="toggleRowDetails(row)" 207affc529SSandeepa Singh > 217affc529SSandeepa Singh <icon-chevron /> 227affc529SSandeepa Singh <span class="sr-only">{{ expandRowLabel }}</span> 237affc529SSandeepa Singh </b-button> 247affc529SSandeepa Singh </template> 257affc529SSandeepa Singh 267affc529SSandeepa Singh <!-- Health --> 277affc529SSandeepa Singh <template #cell(health)="{ value }"> 287affc529SSandeepa Singh <status-icon :status="statusIcon(value)" /> 297affc529SSandeepa Singh {{ value }} 307affc529SSandeepa Singh </template> 317affc529SSandeepa Singh <!-- Toggle identify LED --> 327affc529SSandeepa Singh <template #cell(identifyLed)="row"> 337affc529SSandeepa Singh <b-form-checkbox 347affc529SSandeepa Singh v-if="hasIdentifyLed(row.item.identifyLed)" 357affc529SSandeepa Singh v-model="row.item.identifyLed" 367affc529SSandeepa Singh name="switch" 377affc529SSandeepa Singh switch 387affc529SSandeepa Singh @change="toggleIdentifyLedValue(row.item)" 397affc529SSandeepa Singh > 407affc529SSandeepa Singh <span v-if="row.item.identifyLed"> 417affc529SSandeepa Singh {{ $t('global.status.on') }} 427affc529SSandeepa Singh </span> 437affc529SSandeepa Singh <span v-else> {{ $t('global.status.off') }} </span> 447affc529SSandeepa Singh </b-form-checkbox> 457affc529SSandeepa Singh <div v-else>--</div> 467affc529SSandeepa Singh </template> 477affc529SSandeepa Singh <template #row-details="{ item }"> 487affc529SSandeepa Singh <b-container fluid> 497affc529SSandeepa Singh <b-row> 507affc529SSandeepa Singh <b-col class="mt-2" sm="6" xl="6"> 517affc529SSandeepa Singh <dl> 527affc529SSandeepa Singh <!-- Name --> 537affc529SSandeepa Singh <dt>{{ $t('pageInventory.table.name') }}:</dt> 549726f9a7SDixsie Wolmers <dd>{{ dataFormatter(item.name) }}</dd> 557affc529SSandeepa Singh <!-- Part number --> 567affc529SSandeepa Singh <dt>{{ $t('pageInventory.table.partNumber') }}:</dt> 579726f9a7SDixsie Wolmers <dd>{{ dataFormatter(item.partNumber) }}</dd> 587affc529SSandeepa Singh <!-- Serial Number --> 597affc529SSandeepa Singh <dt>{{ $t('pageInventory.table.serialNumber') }}:</dt> 609726f9a7SDixsie Wolmers <dd>{{ dataFormatter(item.serialNumber) }}</dd> 617affc529SSandeepa Singh <!-- Model --> 627affc529SSandeepa Singh <dt>{{ $t('pageInventory.table.model') }}:</dt> 637affc529SSandeepa Singh <dd class="mb-2"> 649726f9a7SDixsie Wolmers {{ dataFormatter(item.model) }} 657affc529SSandeepa Singh </dd> 667affc529SSandeepa Singh <!-- Asset tag --> 677affc529SSandeepa Singh <dt>{{ $t('pageInventory.table.assetTag') }}:</dt> 687affc529SSandeepa Singh <dd class="mb-2"> 699726f9a7SDixsie Wolmers {{ dataFormatter(item.assetTag) }} 707affc529SSandeepa Singh </dd> 717affc529SSandeepa Singh </dl> 727affc529SSandeepa Singh </b-col> 737affc529SSandeepa Singh <b-col class="mt-2" sm="6" xl="6"> 747affc529SSandeepa Singh <dl> 757affc529SSandeepa Singh <!-- Status state --> 767affc529SSandeepa Singh <dt>{{ $t('pageInventory.table.statusState') }}:</dt> 779726f9a7SDixsie Wolmers <dd>{{ dataFormatter(item.statusState) }}</dd> 787affc529SSandeepa Singh <!-- Power state --> 797affc529SSandeepa Singh <dt>{{ $t('pageInventory.table.power') }}:</dt> 809726f9a7SDixsie Wolmers <dd>{{ dataFormatter(item.power) }}</dd> 817affc529SSandeepa Singh <!-- Health rollup --> 827affc529SSandeepa Singh <dt>{{ $t('pageInventory.table.healthRollup') }}:</dt> 839726f9a7SDixsie Wolmers <dd>{{ dataFormatter(item.healthRollup) }}</dd> 847affc529SSandeepa Singh </dl> 857affc529SSandeepa Singh </b-col> 867affc529SSandeepa Singh </b-row> 877affc529SSandeepa Singh <div class="section-divider mb-3 mt-3"></div> 887affc529SSandeepa Singh <b-row> 897affc529SSandeepa Singh <b-col class="mt-2" sm="6" xl="6"> 907affc529SSandeepa Singh <dl> 917affc529SSandeepa Singh <!-- Manufacturer --> 927affc529SSandeepa Singh <dt>{{ $t('pageInventory.table.manufacturer') }}:</dt> 939726f9a7SDixsie Wolmers <dd>{{ dataFormatter(item.manufacturer) }}</dd> 947affc529SSandeepa Singh <!-- Chassis Type --> 957affc529SSandeepa Singh <dt>{{ $t('pageInventory.table.chassisType') }}:</dt> 969726f9a7SDixsie Wolmers <dd>{{ dataFormatter(item.chassisType) }}</dd> 977affc529SSandeepa Singh </dl> 987affc529SSandeepa Singh </b-col> 997affc529SSandeepa Singh <b-col class="mt-2" sm="6" xl="6"> 1007affc529SSandeepa Singh <dl> 1017affc529SSandeepa Singh <!-- Min power --> 1027affc529SSandeepa Singh <dt>{{ $t('pageInventory.table.minPowerWatts') }}:</dt> 103d0b078f6SGlukhov Mikhail <dd> 104d0b078f6SGlukhov Mikhail {{ dataFormatter(item.minPowerWatts) }} 105d0b078f6SGlukhov Mikhail {{ $t('unit.W') }} 106d0b078f6SGlukhov Mikhail </dd> 1077affc529SSandeepa Singh <!-- Max power --> 1087affc529SSandeepa Singh <dt>{{ $t('pageInventory.table.maxPowerWatts') }}:</dt> 109d0b078f6SGlukhov Mikhail <dd> 110d0b078f6SGlukhov Mikhail {{ dataFormatter(item.maxPowerWatts) }} 111d0b078f6SGlukhov Mikhail {{ $t('unit.W') }} 112d0b078f6SGlukhov Mikhail </dd> 1137affc529SSandeepa Singh </dl> 1147affc529SSandeepa Singh </b-col> 1157affc529SSandeepa Singh </b-row> 1167affc529SSandeepa Singh </b-container> 1177affc529SSandeepa Singh </template> 1187affc529SSandeepa Singh </b-table> 1197affc529SSandeepa Singh </page-section> 1207affc529SSandeepa Singh</template> 1217affc529SSandeepa Singh 1227affc529SSandeepa Singh<script> 1237affc529SSandeepa Singhimport PageSection from '@/components/Global/PageSection'; 1247affc529SSandeepa Singhimport IconChevron from '@carbon/icons-vue/es/chevron--down/20'; 1257affc529SSandeepa Singhimport BVToastMixin from '@/components/Mixins/BVToastMixin'; 1267affc529SSandeepa Singhimport StatusIcon from '@/components/Global/StatusIcon'; 1277affc529SSandeepa Singh 1287affc529SSandeepa Singhimport TableRowExpandMixin, { 1297affc529SSandeepa Singh expandRowLabel, 1307affc529SSandeepa Singh} from '@/components/Mixins/TableRowExpandMixin'; 1319726f9a7SDixsie Wolmersimport DataFormatterMixin from '@/components/Mixins/DataFormatterMixin'; 132*de23ea23SSurya Vimport { useI18n } from 'vue-i18n'; 133*de23ea23SSurya Vimport i18n from '@/i18n'; 1347affc529SSandeepa Singh 1357affc529SSandeepa Singhexport default { 1367affc529SSandeepa Singh components: { IconChevron, PageSection, StatusIcon }, 1379726f9a7SDixsie Wolmers mixins: [BVToastMixin, TableRowExpandMixin, DataFormatterMixin], 1387affc529SSandeepa Singh data() { 1397affc529SSandeepa Singh return { 140*de23ea23SSurya V $t: useI18n().t, 14141057853SKenneth Fullbright isBusy: true, 1427affc529SSandeepa Singh fields: [ 1437affc529SSandeepa Singh { 1447affc529SSandeepa Singh key: 'expandRow', 1457affc529SSandeepa Singh label: '', 1467affc529SSandeepa Singh tdClass: 'table-row-expand', 1477affc529SSandeepa Singh }, 1487affc529SSandeepa Singh { 1497affc529SSandeepa Singh key: 'id', 150*de23ea23SSurya V label: i18n.global.t('pageInventory.table.id'), 1519726f9a7SDixsie Wolmers formatter: this.dataFormatter, 1527affc529SSandeepa Singh }, 1537affc529SSandeepa Singh { 1547affc529SSandeepa Singh key: 'health', 155*de23ea23SSurya V label: i18n.global.t('pageInventory.table.health'), 1569726f9a7SDixsie Wolmers formatter: this.dataFormatter, 1577affc529SSandeepa Singh tdClass: 'text-nowrap', 1587affc529SSandeepa Singh }, 1597affc529SSandeepa Singh { 1607affc529SSandeepa Singh key: 'locationNumber', 161*de23ea23SSurya V label: i18n.global.t('pageInventory.table.locationNumber'), 1629726f9a7SDixsie Wolmers formatter: this.dataFormatter, 1637affc529SSandeepa Singh }, 1647affc529SSandeepa Singh { 1657affc529SSandeepa Singh key: 'identifyLed', 166*de23ea23SSurya V label: i18n.global.t('pageInventory.table.identifyLed'), 1679726f9a7SDixsie Wolmers formatter: this.dataFormatter, 1687affc529SSandeepa Singh }, 1697affc529SSandeepa Singh ], 1707affc529SSandeepa Singh expandRowLabel: expandRowLabel, 1717affc529SSandeepa Singh }; 1727affc529SSandeepa Singh }, 1737affc529SSandeepa Singh computed: { 1747affc529SSandeepa Singh chassis() { 1757affc529SSandeepa Singh return this.$store.getters['chassis/chassis']; 1767affc529SSandeepa Singh }, 1777affc529SSandeepa Singh }, 1787affc529SSandeepa Singh created() { 1797affc529SSandeepa Singh this.$store.dispatch('chassis/getChassisInfo').finally(() => { 1807affc529SSandeepa Singh // Emit initial data fetch complete to parent component 1817affc529SSandeepa Singh this.$root.$emit('hardware-status-chassis-complete'); 18241057853SKenneth Fullbright this.isBusy = false; 1837affc529SSandeepa Singh }); 1847affc529SSandeepa Singh }, 1857affc529SSandeepa Singh methods: { 1867affc529SSandeepa Singh toggleIdentifyLedValue(row) { 1877affc529SSandeepa Singh this.$store 1887affc529SSandeepa Singh .dispatch('chassis/updateIdentifyLedValue', { 1897affc529SSandeepa Singh uri: row.uri, 1907affc529SSandeepa Singh identifyLed: row.identifyLed, 1917affc529SSandeepa Singh }) 192f11a1901SNikhil Ashoka .then((message) => this.successToast(message)) 1937affc529SSandeepa Singh .catch(({ message }) => this.errorToast(message)); 1947affc529SSandeepa Singh }, 1957affc529SSandeepa Singh // TO DO: Remove this method when the LocationIndicatorActive is added from backend. 1967affc529SSandeepa Singh hasIdentifyLed(identifyLed) { 1977affc529SSandeepa Singh return typeof identifyLed === 'boolean'; 1987affc529SSandeepa Singh }, 1997affc529SSandeepa Singh }, 2007affc529SSandeepa Singh}; 2017affc529SSandeepa Singh</script> 202