blob: d8b46b255eeb2ed9d9be264c987ad717f656f0ff [file] [log] [blame]
Yoshie Muranaka56ee7692020-05-28 13:28:29 -07001<template>
2 <b-container fluid="xl">
3 <page-title />
4
Dixsie Wolmersdc6b3cd2021-05-20 19:01:42 -05005 <!-- Quicklinks section -->
Sandeepa Singh7affc522021-07-06 16:29:10 +05306 <page-section :section-title="$t('pageInventory.quicklinkTitle')">
Dixsie Wolmersdc6b3cd2021-05-20 19:01:42 -05007 <b-row class="w-75">
8 <b-col v-for="column in quicklinkColumns" :key="column.id" xl="4">
9 <div v-for="item in column" :key="item.id">
10 <b-link
11 :href="item.href"
12 :data-ref="item.dataRef"
13 @click.prevent="scrollToOffset"
14 >
15 <jump-link /> {{ item.linkText }}
16 </b-link>
17 </div>
18 </b-col>
19 </b-row>
20 </page-section>
21
Yoshie Muranaka56ee7692020-05-28 13:28:29 -070022 <!-- System table -->
Dixsie Wolmersdc6b3cd2021-05-20 19:01:42 -050023 <table-system ref="system" />
Yoshie Muranaka5918b482020-06-08 08:18:23 -070024
Yoshie Muranaka54c6bfc2020-06-12 08:29:42 -070025 <!-- BMC manager table -->
Dixsie Wolmersdc6b3cd2021-05-20 19:01:42 -050026 <table-bmc-manager ref="bmc" />
Yoshie Muranaka54c6bfc2020-06-12 08:29:42 -070027
Yoshie Muranaka09e8b5d2020-06-08 07:36:59 -070028 <!-- Chassis table -->
Dixsie Wolmersdc6b3cd2021-05-20 19:01:42 -050029 <table-chassis ref="chassis" />
Yoshie Muranaka09e8b5d2020-06-08 07:36:59 -070030
Yoshie Muranakae24b17d2020-06-08 11:03:11 -070031 <!-- DIMM slot table -->
Dixsie Wolmersdc6b3cd2021-05-20 19:01:42 -050032 <table-dimm-slot ref="dimms" />
Yoshie Muranakae24b17d2020-06-08 11:03:11 -070033
Yoshie Muranakab89a53c2020-06-15 13:25:46 -070034 <!-- Fans table -->
Dixsie Wolmersdc6b3cd2021-05-20 19:01:42 -050035 <table-fans ref="fans" />
Yoshie Muranakab89a53c2020-06-15 13:25:46 -070036
Yoshie Muranaka5918b482020-06-08 08:18:23 -070037 <!-- Power supplies table -->
Dixsie Wolmersdc6b3cd2021-05-20 19:01:42 -050038 <table-power-supplies ref="powerSupply" />
SurenNewaredc3fa2e2020-08-04 20:45:25 +053039
40 <!-- Processors table -->
Dixsie Wolmersdc6b3cd2021-05-20 19:01:42 -050041 <table-processors ref="processors" />
Yoshie Muranaka56ee7692020-05-28 13:28:29 -070042 </b-container>
43</template>
44
45<script>
46import PageTitle from '@/components/Global/PageTitle';
Sandeepa Singh7affc522021-07-06 16:29:10 +053047import TableSystem from './InventoryTableSystem';
48import TablePowerSupplies from './InventoryTablePowerSupplies';
49import TableDimmSlot from './InventoryTableDimmSlot';
50import TableFans from './InventoryTableFans';
51import TableBmcManager from './InventoryTableBmcManager';
52import TableChassis from './InventoryTableChassis';
53import TableProcessors from './InventoryTableProcessors';
Yoshie Muranaka56ee7692020-05-28 13:28:29 -070054import LoadingBarMixin from '@/components/Mixins/LoadingBarMixin';
Dixsie Wolmersdc6b3cd2021-05-20 19:01:42 -050055import PageSection from '@/components/Global/PageSection';
56import JumpLink16 from '@carbon/icons-vue/es/jump-link/16';
57
58import JumpLinkMixin from '@/components/Mixins/JumpLinkMixin';
59
60import { chunk } from 'lodash';
Yoshie Muranaka56ee7692020-05-28 13:28:29 -070061
62export default {
Yoshie Muranakab89a53c2020-06-15 13:25:46 -070063 components: {
64 PageTitle,
65 TableDimmSlot,
66 TablePowerSupplies,
67 TableSystem,
Yoshie Muranaka09e8b5d2020-06-08 07:36:59 -070068 TableFans,
Yoshie Muranaka54c6bfc2020-06-12 08:29:42 -070069 TableBmcManager,
SurenNewaredc3fa2e2020-08-04 20:45:25 +053070 TableChassis,
Derick Montague602e98a2020-10-21 16:20:00 -050071 TableProcessors,
Dixsie Wolmersdc6b3cd2021-05-20 19:01:42 -050072 PageSection,
73 JumpLink: JumpLink16,
Yoshie Muranakab89a53c2020-06-15 13:25:46 -070074 },
Dixsie Wolmersdc6b3cd2021-05-20 19:01:42 -050075 mixins: [LoadingBarMixin, JumpLinkMixin],
Derick Montague602e98a2020-10-21 16:20:00 -050076 beforeRouteLeave(to, from, next) {
77 // Hide loader if user navigates away from page
78 // before requests complete
79 this.hideLoader();
80 next();
81 },
Dixsie Wolmersdc6b3cd2021-05-20 19:01:42 -050082 data() {
83 return {
84 links: [
85 {
Dixsie Wolmers0a7a4992021-06-25 08:18:23 -050086 id: 'system',
87 dataRef: 'system',
88 href: '#system',
Sandeepa Singh7affc522021-07-06 16:29:10 +053089 linkText: this.$t('pageInventory.system'),
Dixsie Wolmers0a7a4992021-06-25 08:18:23 -050090 },
91 {
Dixsie Wolmersdc6b3cd2021-05-20 19:01:42 -050092 id: 'bmc',
93 dataRef: 'bmc',
94 href: '#bmc',
Sandeepa Singh7affc522021-07-06 16:29:10 +053095 linkText: this.$t('pageInventory.bmcManager'),
Dixsie Wolmersdc6b3cd2021-05-20 19:01:42 -050096 },
97 {
98 id: 'chassis',
99 dataRef: 'chassis',
100 href: '#chassis',
Sandeepa Singh7affc522021-07-06 16:29:10 +0530101 linkText: this.$t('pageInventory.chassis'),
Dixsie Wolmersdc6b3cd2021-05-20 19:01:42 -0500102 },
103 {
104 id: 'dimms',
105 dataRef: 'dimms',
106 href: '#dimms',
Sandeepa Singh7affc522021-07-06 16:29:10 +0530107 linkText: this.$t('pageInventory.dimmSlot'),
Dixsie Wolmersdc6b3cd2021-05-20 19:01:42 -0500108 },
109 {
110 id: 'fans',
111 dataRef: 'fans',
112 href: '#fans',
Sandeepa Singh7affc522021-07-06 16:29:10 +0530113 linkText: this.$t('pageInventory.fans'),
Dixsie Wolmersdc6b3cd2021-05-20 19:01:42 -0500114 },
115 {
116 id: 'powerSupply',
117 dataRef: 'powerSupply',
118 href: '#powerSupply',
Sandeepa Singh7affc522021-07-06 16:29:10 +0530119 linkText: this.$t('pageInventory.powerSupplies'),
Dixsie Wolmersdc6b3cd2021-05-20 19:01:42 -0500120 },
121 {
122 id: 'processors',
123 dataRef: 'processors',
124 href: '#processors',
Sandeepa Singh7affc522021-07-06 16:29:10 +0530125 linkText: this.$t('pageInventory.processors'),
126 },
127 {
128 id: 'system',
129 dataRef: 'system',
130 href: '#system',
131 linkText: this.$t('pageInventory.system'),
Dixsie Wolmersdc6b3cd2021-05-20 19:01:42 -0500132 },
Dixsie Wolmersdc6b3cd2021-05-20 19:01:42 -0500133 ],
134 };
135 },
136 computed: {
137 quicklinkColumns() {
138 // Chunk links array to 3 array's to display 3 items per column
139 return chunk(this.links, 3);
140 },
141 },
Yoshie Muranaka56ee7692020-05-28 13:28:29 -0700142 created() {
143 this.startLoader();
Derick Montague602e98a2020-10-21 16:20:00 -0500144 const systemTablePromise = new Promise((resolve) => {
Sukanya Pandeyedb8a772020-10-29 11:33:42 +0530145 this.$root.$on('hardware-status-system-complete', () => resolve());
Yoshie Muranaka56ee7692020-05-28 13:28:29 -0700146 });
Derick Montague602e98a2020-10-21 16:20:00 -0500147 const bmcManagerTablePromise = new Promise((resolve) => {
Sukanya Pandeyedb8a772020-10-29 11:33:42 +0530148 this.$root.$on('hardware-status-bmc-manager-complete', () => resolve());
Yoshie Muranaka54c6bfc2020-06-12 08:29:42 -0700149 });
Derick Montague602e98a2020-10-21 16:20:00 -0500150 const chassisTablePromise = new Promise((resolve) => {
Sukanya Pandeyedb8a772020-10-29 11:33:42 +0530151 this.$root.$on('hardware-status-chassis-complete', () => resolve());
Yoshie Muranaka09e8b5d2020-06-08 07:36:59 -0700152 });
Derick Montague602e98a2020-10-21 16:20:00 -0500153 const dimmSlotTablePromise = new Promise((resolve) => {
Sukanya Pandeyedb8a772020-10-29 11:33:42 +0530154 this.$root.$on('hardware-status-dimm-slot-complete', () => resolve());
Yoshie Muranakae24b17d2020-06-08 11:03:11 -0700155 });
Derick Montague602e98a2020-10-21 16:20:00 -0500156 const fansTablePromise = new Promise((resolve) => {
Sukanya Pandeyedb8a772020-10-29 11:33:42 +0530157 this.$root.$on('hardware-status-fans-complete', () => resolve());
Yoshie Muranakab89a53c2020-06-15 13:25:46 -0700158 });
Derick Montague602e98a2020-10-21 16:20:00 -0500159 const powerSuppliesTablePromise = new Promise((resolve) => {
Sukanya Pandeyedb8a772020-10-29 11:33:42 +0530160 this.$root.$on('hardware-status-power-supplies-complete', () =>
Yoshie Muranaka5918b482020-06-08 08:18:23 -0700161 resolve()
162 );
163 });
Derick Montague602e98a2020-10-21 16:20:00 -0500164 const processorsTablePromise = new Promise((resolve) => {
Sukanya Pandeyedb8a772020-10-29 11:33:42 +0530165 this.$root.$on('hardware-status-processors-complete', () => resolve());
SurenNewaredc3fa2e2020-08-04 20:45:25 +0530166 });
Yoshie Muranaka56ee7692020-05-28 13:28:29 -0700167 // Combine all child component Promises to indicate
168 // when page data load complete
Yoshie Muranakae24b17d2020-06-08 11:03:11 -0700169 Promise.all([
170 systemTablePromise,
Yoshie Muranaka54c6bfc2020-06-12 08:29:42 -0700171 bmcManagerTablePromise,
Yoshie Muranaka09e8b5d2020-06-08 07:36:59 -0700172 chassisTablePromise,
Yoshie Muranakae24b17d2020-06-08 11:03:11 -0700173 dimmSlotTablePromise,
Yoshie Muranakab89a53c2020-06-15 13:25:46 -0700174 fansTablePromise,
SurenNewaredc3fa2e2020-08-04 20:45:25 +0530175 powerSuppliesTablePromise,
Derick Montague602e98a2020-10-21 16:20:00 -0500176 processorsTablePromise,
Yoshie Muranakae24b17d2020-06-08 11:03:11 -0700177 ]).finally(() => this.endLoader());
Yoshie Muranaka56ee7692020-05-28 13:28:29 -0700178 },
Yoshie Muranaka56ee7692020-05-28 13:28:29 -0700179};
180</script>