17affc529SSandeepa Singh<template>
27affc529SSandeepa Singh  <b-container fluid="xl">
37affc529SSandeepa Singh    <page-title />
47affc529SSandeepa Singh
505388966SSukanya Pandey    <!-- Service indicators -->
605388966SSukanya Pandey    <service-indicator />
705388966SSukanya Pandey
87affc529SSandeepa Singh    <!-- Quicklinks section -->
97affc529SSandeepa Singh    <page-section :section-title="$t('pageInventory.quicklinkTitle')">
107affc529SSandeepa Singh      <b-row class="w-75">
117affc529SSandeepa Singh        <b-col v-for="column in quicklinkColumns" :key="column.id" xl="4">
127affc529SSandeepa Singh          <div v-for="item in column" :key="item.id">
137affc529SSandeepa Singh            <b-link
147affc529SSandeepa Singh              :href="item.href"
157affc529SSandeepa Singh              :data-ref="item.dataRef"
167affc529SSandeepa Singh              @click.prevent="scrollToOffset"
177affc529SSandeepa Singh            >
187affc529SSandeepa Singh              <jump-link /> {{ item.linkText }}
197affc529SSandeepa Singh            </b-link>
207affc529SSandeepa Singh          </div>
217affc529SSandeepa Singh        </b-col>
227affc529SSandeepa Singh      </b-row>
237affc529SSandeepa Singh    </page-section>
247affc529SSandeepa Singh
257affc529SSandeepa Singh    <!-- System table -->
267affc529SSandeepa Singh    <table-system ref="system" />
277affc529SSandeepa Singh
287affc529SSandeepa Singh    <!-- BMC manager table -->
297affc529SSandeepa Singh    <table-bmc-manager ref="bmc" />
307affc529SSandeepa Singh
317affc529SSandeepa Singh    <!-- Chassis table -->
327affc529SSandeepa Singh    <table-chassis ref="chassis" />
337affc529SSandeepa Singh
347affc529SSandeepa Singh    <!-- DIMM slot table -->
357affc529SSandeepa Singh    <table-dimm-slot ref="dimms" />
367affc529SSandeepa Singh
377affc529SSandeepa Singh    <!-- Fans table -->
387affc529SSandeepa Singh    <table-fans ref="fans" />
397affc529SSandeepa Singh
407affc529SSandeepa Singh    <!-- Power supplies table -->
417affc529SSandeepa Singh    <table-power-supplies ref="powerSupply" />
427affc529SSandeepa Singh
437affc529SSandeepa Singh    <!-- Processors table -->
447affc529SSandeepa Singh    <table-processors ref="processors" />
45a02c6f94SSneha Patel
46a02c6f94SSneha Patel    <!-- Assembly table -->
47a02c6f94SSneha Patel    <table-assembly ref="assembly" />
487affc529SSandeepa Singh  </b-container>
497affc529SSandeepa Singh</template>
507affc529SSandeepa Singh
517affc529SSandeepa Singh<script>
527affc529SSandeepa Singhimport PageTitle from '@/components/Global/PageTitle';
5305388966SSukanya Pandeyimport ServiceIndicator from './InventoryServiceIndicator';
547affc529SSandeepa Singhimport TableSystem from './InventoryTableSystem';
557affc529SSandeepa Singhimport TablePowerSupplies from './InventoryTablePowerSupplies';
567affc529SSandeepa Singhimport TableDimmSlot from './InventoryTableDimmSlot';
577affc529SSandeepa Singhimport TableFans from './InventoryTableFans';
587affc529SSandeepa Singhimport TableBmcManager from './InventoryTableBmcManager';
597affc529SSandeepa Singhimport TableChassis from './InventoryTableChassis';
607affc529SSandeepa Singhimport TableProcessors from './InventoryTableProcessors';
61a02c6f94SSneha Patelimport TableAssembly from './InventoryTableAssembly';
627affc529SSandeepa Singhimport LoadingBarMixin from '@/components/Mixins/LoadingBarMixin';
637affc529SSandeepa Singhimport PageSection from '@/components/Global/PageSection';
647affc529SSandeepa Singhimport JumpLink16 from '@carbon/icons-vue/es/jump-link/16';
657affc529SSandeepa Singhimport JumpLinkMixin from '@/components/Mixins/JumpLinkMixin';
667affc529SSandeepa Singhimport { chunk } from 'lodash';
677affc529SSandeepa Singh
687affc529SSandeepa Singhexport default {
697affc529SSandeepa Singh  components: {
707affc529SSandeepa Singh    PageTitle,
7105388966SSukanya Pandey    ServiceIndicator,
727affc529SSandeepa Singh    TableDimmSlot,
737affc529SSandeepa Singh    TablePowerSupplies,
747affc529SSandeepa Singh    TableSystem,
757affc529SSandeepa Singh    TableFans,
767affc529SSandeepa Singh    TableBmcManager,
777affc529SSandeepa Singh    TableChassis,
787affc529SSandeepa Singh    TableProcessors,
79a02c6f94SSneha Patel    TableAssembly,
807affc529SSandeepa Singh    PageSection,
817affc529SSandeepa Singh    JumpLink: JumpLink16,
827affc529SSandeepa Singh  },
837affc529SSandeepa Singh  mixins: [LoadingBarMixin, JumpLinkMixin],
847affc529SSandeepa Singh  beforeRouteLeave(to, from, next) {
857affc529SSandeepa Singh    // Hide loader if user navigates away from page
867affc529SSandeepa Singh    // before requests complete
877affc529SSandeepa Singh    this.hideLoader();
887affc529SSandeepa Singh    next();
897affc529SSandeepa Singh  },
907affc529SSandeepa Singh  data() {
917affc529SSandeepa Singh    return {
927affc529SSandeepa Singh      links: [
937affc529SSandeepa Singh        {
947affc529SSandeepa Singh          id: 'system',
957affc529SSandeepa Singh          dataRef: 'system',
967affc529SSandeepa Singh          href: '#system',
977affc529SSandeepa Singh          linkText: this.$t('pageInventory.system'),
987affc529SSandeepa Singh        },
997affc529SSandeepa Singh        {
1007affc529SSandeepa Singh          id: 'bmc',
1017affc529SSandeepa Singh          dataRef: 'bmc',
1027affc529SSandeepa Singh          href: '#bmc',
1037affc529SSandeepa Singh          linkText: this.$t('pageInventory.bmcManager'),
1047affc529SSandeepa Singh        },
1057affc529SSandeepa Singh        {
1067affc529SSandeepa Singh          id: 'chassis',
1077affc529SSandeepa Singh          dataRef: 'chassis',
1087affc529SSandeepa Singh          href: '#chassis',
1097affc529SSandeepa Singh          linkText: this.$t('pageInventory.chassis'),
1107affc529SSandeepa Singh        },
1117affc529SSandeepa Singh        {
1127affc529SSandeepa Singh          id: 'dimms',
1137affc529SSandeepa Singh          dataRef: 'dimms',
1147affc529SSandeepa Singh          href: '#dimms',
1157affc529SSandeepa Singh          linkText: this.$t('pageInventory.dimmSlot'),
1167affc529SSandeepa Singh        },
1177affc529SSandeepa Singh        {
1187affc529SSandeepa Singh          id: 'fans',
1197affc529SSandeepa Singh          dataRef: 'fans',
1207affc529SSandeepa Singh          href: '#fans',
1217affc529SSandeepa Singh          linkText: this.$t('pageInventory.fans'),
1227affc529SSandeepa Singh        },
1237affc529SSandeepa Singh        {
1247affc529SSandeepa Singh          id: 'powerSupply',
1257affc529SSandeepa Singh          dataRef: 'powerSupply',
1267affc529SSandeepa Singh          href: '#powerSupply',
1277affc529SSandeepa Singh          linkText: this.$t('pageInventory.powerSupplies'),
1287affc529SSandeepa Singh        },
1297affc529SSandeepa Singh        {
1307affc529SSandeepa Singh          id: 'processors',
1317affc529SSandeepa Singh          dataRef: 'processors',
1327affc529SSandeepa Singh          href: '#processors',
1337affc529SSandeepa Singh          linkText: this.$t('pageInventory.processors'),
1347affc529SSandeepa Singh        },
1357affc529SSandeepa Singh        {
136a02c6f94SSneha Patel          id: 'assembly',
137a02c6f94SSneha Patel          dataRef: 'assembly',
138a02c6f94SSneha Patel          href: '#assembly',
139a02c6f94SSneha Patel          linkText: this.$t('pageInventory.assemblies'),
140a02c6f94SSneha Patel        },
1417affc529SSandeepa Singh      ],
1427affc529SSandeepa Singh    };
1437affc529SSandeepa Singh  },
1447affc529SSandeepa Singh  computed: {
1457affc529SSandeepa Singh    quicklinkColumns() {
1467affc529SSandeepa Singh      // Chunk links array to 3 array's to display 3 items per column
1477affc529SSandeepa Singh      return chunk(this.links, 3);
1487affc529SSandeepa Singh    },
1497affc529SSandeepa Singh  },
1507affc529SSandeepa Singh  created() {
1517affc529SSandeepa Singh    this.startLoader();
1527affc529SSandeepa Singh    const bmcManagerTablePromise = new Promise((resolve) => {
1537affc529SSandeepa Singh      this.$root.$on('hardware-status-bmc-manager-complete', () => resolve());
1547affc529SSandeepa Singh    });
1557affc529SSandeepa Singh    const chassisTablePromise = new Promise((resolve) => {
1567affc529SSandeepa Singh      this.$root.$on('hardware-status-chassis-complete', () => resolve());
1577affc529SSandeepa Singh    });
1587affc529SSandeepa Singh    const dimmSlotTablePromise = new Promise((resolve) => {
1597affc529SSandeepa Singh      this.$root.$on('hardware-status-dimm-slot-complete', () => resolve());
1607affc529SSandeepa Singh    });
1617affc529SSandeepa Singh    const fansTablePromise = new Promise((resolve) => {
1627affc529SSandeepa Singh      this.$root.$on('hardware-status-fans-complete', () => resolve());
1637affc529SSandeepa Singh    });
1647affc529SSandeepa Singh    const powerSuppliesTablePromise = new Promise((resolve) => {
1657affc529SSandeepa Singh      this.$root.$on('hardware-status-power-supplies-complete', () =>
166*8132399cSEd Tanous        resolve(),
1677affc529SSandeepa Singh      );
1687affc529SSandeepa Singh    });
1697affc529SSandeepa Singh    const processorsTablePromise = new Promise((resolve) => {
1707affc529SSandeepa Singh      this.$root.$on('hardware-status-processors-complete', () => resolve());
1717affc529SSandeepa Singh    });
17205388966SSukanya Pandey    const serviceIndicatorPromise = new Promise((resolve) => {
17305388966SSukanya Pandey      this.$root.$on('hardware-status-service-complete', () => resolve());
17405388966SSukanya Pandey    });
17505388966SSukanya Pandey    const systemTablePromise = new Promise((resolve) => {
17605388966SSukanya Pandey      this.$root.$on('hardware-status-system-complete', () => resolve());
17705388966SSukanya Pandey    });
178a02c6f94SSneha Patel    const assemblyTablePromise = new Promise((resolve) => {
179a02c6f94SSneha Patel      this.$root.$on('hardware-status-assembly-complete', () => resolve());
180a02c6f94SSneha Patel    });
1817affc529SSandeepa Singh    // Combine all child component Promises to indicate
1827affc529SSandeepa Singh    // when page data load complete
1837affc529SSandeepa Singh    Promise.all([
1847affc529SSandeepa Singh      bmcManagerTablePromise,
1857affc529SSandeepa Singh      chassisTablePromise,
1867affc529SSandeepa Singh      dimmSlotTablePromise,
1877affc529SSandeepa Singh      fansTablePromise,
1887affc529SSandeepa Singh      powerSuppliesTablePromise,
1897affc529SSandeepa Singh      processorsTablePromise,
19005388966SSukanya Pandey      serviceIndicatorPromise,
19105388966SSukanya Pandey      systemTablePromise,
192a02c6f94SSneha Patel      assemblyTablePromise,
1937affc529SSandeepa Singh    ]).finally(() => this.endLoader());
1947affc529SSandeepa Singh  },
1957affc529SSandeepa Singh};
1967affc529SSandeepa Singh</script>
197