xref: /openbmc/webui-vue/src/views/HardwareStatus/Inventory/Inventory.vue (revision de23ea23d88451a2fa2774ec72053772603c23ae)
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';
67*de23ea23SSurya Vimport { useI18n } from 'vue-i18n';
68*de23ea23SSurya Vimport i18n from '@/i18n';
697affc529SSandeepa Singh
707affc529SSandeepa Singhexport default {
717affc529SSandeepa Singh  components: {
727affc529SSandeepa Singh    PageTitle,
7305388966SSukanya Pandey    ServiceIndicator,
747affc529SSandeepa Singh    TableDimmSlot,
757affc529SSandeepa Singh    TablePowerSupplies,
767affc529SSandeepa Singh    TableSystem,
777affc529SSandeepa Singh    TableFans,
787affc529SSandeepa Singh    TableBmcManager,
797affc529SSandeepa Singh    TableChassis,
807affc529SSandeepa Singh    TableProcessors,
81a02c6f94SSneha Patel    TableAssembly,
827affc529SSandeepa Singh    PageSection,
837affc529SSandeepa Singh    JumpLink: JumpLink16,
847affc529SSandeepa Singh  },
857affc529SSandeepa Singh  mixins: [LoadingBarMixin, JumpLinkMixin],
867affc529SSandeepa Singh  beforeRouteLeave(to, from, next) {
877affc529SSandeepa Singh    // Hide loader if user navigates away from page
887affc529SSandeepa Singh    // before requests complete
897affc529SSandeepa Singh    this.hideLoader();
907affc529SSandeepa Singh    next();
917affc529SSandeepa Singh  },
927affc529SSandeepa Singh  data() {
937affc529SSandeepa Singh    return {
94*de23ea23SSurya V      $t: useI18n().t,
957affc529SSandeepa Singh      links: [
967affc529SSandeepa Singh        {
977affc529SSandeepa Singh          id: 'system',
987affc529SSandeepa Singh          dataRef: 'system',
997affc529SSandeepa Singh          href: '#system',
100*de23ea23SSurya V          linkText: i18n.global.t('pageInventory.system'),
1017affc529SSandeepa Singh        },
1027affc529SSandeepa Singh        {
1037affc529SSandeepa Singh          id: 'bmc',
1047affc529SSandeepa Singh          dataRef: 'bmc',
1057affc529SSandeepa Singh          href: '#bmc',
106*de23ea23SSurya V          linkText: i18n.global.t('pageInventory.bmcManager'),
1077affc529SSandeepa Singh        },
1087affc529SSandeepa Singh        {
1097affc529SSandeepa Singh          id: 'chassis',
1107affc529SSandeepa Singh          dataRef: 'chassis',
1117affc529SSandeepa Singh          href: '#chassis',
112*de23ea23SSurya V          linkText: i18n.global.t('pageInventory.chassis'),
1137affc529SSandeepa Singh        },
1147affc529SSandeepa Singh        {
1157affc529SSandeepa Singh          id: 'dimms',
1167affc529SSandeepa Singh          dataRef: 'dimms',
1177affc529SSandeepa Singh          href: '#dimms',
118*de23ea23SSurya V          linkText: i18n.global.t('pageInventory.dimmSlot'),
1197affc529SSandeepa Singh        },
1207affc529SSandeepa Singh        {
1217affc529SSandeepa Singh          id: 'fans',
1227affc529SSandeepa Singh          dataRef: 'fans',
1237affc529SSandeepa Singh          href: '#fans',
124*de23ea23SSurya V          linkText: i18n.global.t('pageInventory.fans'),
1257affc529SSandeepa Singh        },
1267affc529SSandeepa Singh        {
1277affc529SSandeepa Singh          id: 'powerSupply',
1287affc529SSandeepa Singh          dataRef: 'powerSupply',
1297affc529SSandeepa Singh          href: '#powerSupply',
130*de23ea23SSurya V          linkText: i18n.global.t('pageInventory.powerSupplies'),
1317affc529SSandeepa Singh        },
1327affc529SSandeepa Singh        {
1337affc529SSandeepa Singh          id: 'processors',
1347affc529SSandeepa Singh          dataRef: 'processors',
1357affc529SSandeepa Singh          href: '#processors',
136*de23ea23SSurya V          linkText: i18n.global.t('pageInventory.processors'),
1377affc529SSandeepa Singh        },
1387affc529SSandeepa Singh        {
139a02c6f94SSneha Patel          id: 'assembly',
140a02c6f94SSneha Patel          dataRef: 'assembly',
141a02c6f94SSneha Patel          href: '#assembly',
142*de23ea23SSurya V          linkText: i18n.global.t('pageInventory.assemblies'),
143a02c6f94SSneha Patel        },
1447affc529SSandeepa Singh      ],
1457affc529SSandeepa Singh    };
1467affc529SSandeepa Singh  },
1477affc529SSandeepa Singh  computed: {
1487affc529SSandeepa Singh    quicklinkColumns() {
1497affc529SSandeepa Singh      // Chunk links array to 3 array's to display 3 items per column
1507affc529SSandeepa Singh      return chunk(this.links, 3);
1517affc529SSandeepa Singh    },
1527affc529SSandeepa Singh  },
1537affc529SSandeepa Singh  created() {
1547affc529SSandeepa Singh    this.startLoader();
1557affc529SSandeepa Singh    const bmcManagerTablePromise = new Promise((resolve) => {
1567affc529SSandeepa Singh      this.$root.$on('hardware-status-bmc-manager-complete', () => resolve());
1577affc529SSandeepa Singh    });
1587affc529SSandeepa Singh    const chassisTablePromise = new Promise((resolve) => {
1597affc529SSandeepa Singh      this.$root.$on('hardware-status-chassis-complete', () => resolve());
1607affc529SSandeepa Singh    });
1617affc529SSandeepa Singh    const dimmSlotTablePromise = new Promise((resolve) => {
1627affc529SSandeepa Singh      this.$root.$on('hardware-status-dimm-slot-complete', () => resolve());
1637affc529SSandeepa Singh    });
1647affc529SSandeepa Singh    const fansTablePromise = new Promise((resolve) => {
1657affc529SSandeepa Singh      this.$root.$on('hardware-status-fans-complete', () => resolve());
1667affc529SSandeepa Singh    });
1677affc529SSandeepa Singh    const powerSuppliesTablePromise = new Promise((resolve) => {
1687affc529SSandeepa Singh      this.$root.$on('hardware-status-power-supplies-complete', () =>
1698132399cSEd Tanous        resolve(),
1707affc529SSandeepa Singh      );
1717affc529SSandeepa Singh    });
1727affc529SSandeepa Singh    const processorsTablePromise = new Promise((resolve) => {
1737affc529SSandeepa Singh      this.$root.$on('hardware-status-processors-complete', () => resolve());
1747affc529SSandeepa Singh    });
17505388966SSukanya Pandey    const serviceIndicatorPromise = new Promise((resolve) => {
17605388966SSukanya Pandey      this.$root.$on('hardware-status-service-complete', () => resolve());
17705388966SSukanya Pandey    });
17805388966SSukanya Pandey    const systemTablePromise = new Promise((resolve) => {
17905388966SSukanya Pandey      this.$root.$on('hardware-status-system-complete', () => resolve());
18005388966SSukanya Pandey    });
181a02c6f94SSneha Patel    const assemblyTablePromise = new Promise((resolve) => {
182a02c6f94SSneha Patel      this.$root.$on('hardware-status-assembly-complete', () => resolve());
183a02c6f94SSneha Patel    });
1847affc529SSandeepa Singh    // Combine all child component Promises to indicate
1857affc529SSandeepa Singh    // when page data load complete
1867affc529SSandeepa Singh    Promise.all([
1877affc529SSandeepa Singh      bmcManagerTablePromise,
1887affc529SSandeepa Singh      chassisTablePromise,
1897affc529SSandeepa Singh      dimmSlotTablePromise,
1907affc529SSandeepa Singh      fansTablePromise,
1917affc529SSandeepa Singh      powerSuppliesTablePromise,
1927affc529SSandeepa Singh      processorsTablePromise,
19305388966SSukanya Pandey      serviceIndicatorPromise,
19405388966SSukanya Pandey      systemTablePromise,
195a02c6f94SSneha Patel      assemblyTablePromise,
1967affc529SSandeepa Singh    ]).finally(() => this.endLoader());
1977affc529SSandeepa Singh  },
1987affc529SSandeepa Singh};
1997affc529SSandeepa Singh</script>
200