blob: 20d63d79758ec50c141aa20f745c47f9acf78ad3 [file] [log] [blame]
Yoshie Muranaka56ee7692020-05-28 13:28:29 -07001<template>
Sandeepa Singh7affc522021-07-06 16:29:10 +05302 <page-section :section-title="$t('pageInventory.system')">
SurenNeware307382e2020-07-27 20:45:14 +05303 <b-table
4 responsive="md"
Sukanya Pandeyfde429e2020-09-14 20:48:39 +05305 hover
SurenNeware307382e2020-07-27 20:45:14 +05306 show-empty
7 :items="systems"
8 :fields="fields"
9 :empty-text="$t('global.table.emptyMessage')"
10 >
Yoshie Muranaka56ee7692020-05-28 13:28:29 -070011 <!-- Expand chevron icon -->
Derick Montague602e98a2020-10-21 16:20:00 -050012 <template #cell(expandRow)="row">
Dixsie Wolmers83133762020-07-15 08:45:19 -050013 <b-button
14 variant="link"
15 data-test-id="hardwareStatus-button-expandSystem"
Dixsie Wolmers30f11f82020-11-10 16:07:56 -060016 :title="expandRowLabel"
17 class="btn-icon-only"
Dixsie Wolmersb53e0862020-09-08 14:13:38 -050018 @click="toggleRowDetails(row)"
Dixsie Wolmers83133762020-07-15 08:45:19 -050019 >
Dixsie Wolmers30f11f82020-11-10 16:07:56 -060020 <icon-chevron />
SurenNeware6e2cb972020-12-24 20:58:16 +053021 <span class="sr-only">{{ expandRowLabel }}</span>
Yoshie Muranaka56ee7692020-05-28 13:28:29 -070022 </b-button>
23 </template>
24
25 <!-- Health -->
Derick Montague602e98a2020-10-21 16:20:00 -050026 <template #cell(health)="{ value }">
Yoshie Muranaka56ee7692020-05-28 13:28:29 -070027 <status-icon :status="statusIcon(value)" />
28 {{ value }}
29 </template>
30
Sukanya Pandeyeb4cef32021-04-09 15:40:27 +053031 <template #cell(locationIndicatorActive)="{ item }">
32 <b-form-checkbox
Sukanya Pandey05388962021-06-10 15:35:21 +053033 id="identifyLedSwitchSystem"
Sukanya Pandeyeb4cef32021-04-09 15:40:27 +053034 v-model="item.locationIndicatorActive"
Sukanya Pandey05388962021-06-10 15:35:21 +053035 data-test-id="inventorySystem-toggle-identifyLed"
Sukanya Pandeyeb4cef32021-04-09 15:40:27 +053036 switch
37 @change="toggleIdentifyLedSwitch"
38 >
Sukanya Pandey05388962021-06-10 15:35:21 +053039 <span v-if="item.locationIndicatorActive">
40 {{ $t('global.status.on') }}
41 </span>
42 <span v-else>{{ $t('global.status.off') }}</span>
Sukanya Pandeyeb4cef32021-04-09 15:40:27 +053043 </b-form-checkbox>
44 </template>
45
Derick Montague602e98a2020-10-21 16:20:00 -050046 <template #row-details="{ item }">
Yoshie Muranaka56ee7692020-05-28 13:28:29 -070047 <b-container fluid>
48 <b-row>
Sukanya Pandeyeb4cef32021-04-09 15:40:27 +053049 <b-col class="mt-2" sm="6">
Yoshie Muranaka56ee7692020-05-28 13:28:29 -070050 <dl>
Sukanya Pandeyeb4cef32021-04-09 15:40:27 +053051 <!-- Serial number -->
Sandeepa Singh7affc522021-07-06 16:29:10 +053052 <dt>{{ $t('pageInventory.table.serialNumber') }}:</dt>
Dixsie Wolmers9726f9a2021-09-07 15:33:16 -050053 <dd>{{ dataFormatter(item.serialNumber) }}</dd>
Sukanya Pandeyeb4cef32021-04-09 15:40:27 +053054 <!-- Model -->
Sandeepa Singh7affc522021-07-06 16:29:10 +053055 <dt>{{ $t('pageInventory.table.model') }}:</dt>
Dixsie Wolmers9726f9a2021-09-07 15:33:16 -050056 <dd>{{ dataFormatter(item.model) }}</dd>
Yoshie Muranaka56ee7692020-05-28 13:28:29 -070057 <!-- Asset tag -->
Sandeepa Singh7affc522021-07-06 16:29:10 +053058 <dt>{{ $t('pageInventory.table.assetTag') }}:</dt>
Sukanya Pandeyeb4cef32021-04-09 15:40:27 +053059 <dd class="mb-2">
Dixsie Wolmers9726f9a2021-09-07 15:33:16 -050060 {{ dataFormatter(item.assetTag) }}
Sukanya Pandeyeb4cef32021-04-09 15:40:27 +053061 </dd>
62 </dl>
63 </b-col>
64 <b-col class="mt-2" sm="6">
65 <dl>
66 <!-- Status state -->
Sandeepa Singh7affc522021-07-06 16:29:10 +053067 <dt>{{ $t('pageInventory.table.statusState') }}:</dt>
Dixsie Wolmers9726f9a2021-09-07 15:33:16 -050068 <dd>{{ dataFormatter(item.statusState) }}</dd>
Sukanya Pandeyeb4cef32021-04-09 15:40:27 +053069 <!-- Power state -->
Sandeepa Singh7affc522021-07-06 16:29:10 +053070 <dt>{{ $t('pageInventory.table.power') }}:</dt>
Dixsie Wolmers9726f9a2021-09-07 15:33:16 -050071 <dd>{{ dataFormatter(item.powerState) }}</dd>
Sukanya Pandeyeb4cef32021-04-09 15:40:27 +053072 <!-- Health rollup -->
Sandeepa Singh7affc522021-07-06 16:29:10 +053073 <dt>{{ $t('pageInventory.table.healthRollup') }}:</dt>
Dixsie Wolmers9726f9a2021-09-07 15:33:16 -050074 <dd>{{ dataFormatter(item.healthRollup) }}</dd>
Sukanya Pandeyeb4cef32021-04-09 15:40:27 +053075 </dl>
76 </b-col>
77 </b-row>
78 <div class="section-divider mb-3 mt-3"></div>
79 <b-row>
80 <b-col class="mt-1" sm="6">
81 <dl>
82 <!-- Manufacturer -->
Sandeepa Singh7affc522021-07-06 16:29:10 +053083 <dt>{{ $t('pageInventory.table.manufacturer') }}:</dt>
Thang Q. Nguyenc6899362021-10-20 02:08:49 +000084 <dd>{{ dataFormatter(item.manufacturer) }}</dd>
Yoshie Muranaka56ee7692020-05-28 13:28:29 -070085 <!-- Description -->
Sandeepa Singh7affc522021-07-06 16:29:10 +053086 <dt>{{ $t('pageInventory.table.description') }}:</dt>
Dixsie Wolmers9726f9a2021-09-07 15:33:16 -050087 <dd>{{ dataFormatter(item.description) }}</dd>
Sukanya Pandeyeb4cef32021-04-09 15:40:27 +053088 <!-- Sub Model -->
Sandeepa Singh7affc522021-07-06 16:29:10 +053089 <dt>{{ $t('pageInventory.table.subModel') }}:</dt>
Sukanya Pandeyeb4cef32021-04-09 15:40:27 +053090 <dd>
Dixsie Wolmers9726f9a2021-09-07 15:33:16 -050091 {{ dataFormatter(item.subModel) }}
SurenNewarebbf896c2021-01-27 21:50:22 +053092 </dd>
Sukanya Pandeyeb4cef32021-04-09 15:40:27 +053093 <!-- System Type -->
Sandeepa Singh7affc522021-07-06 16:29:10 +053094 <dt>{{ $t('pageInventory.table.systemType') }}:</dt>
Sukanya Pandeyeb4cef32021-04-09 15:40:27 +053095 <dd>
Dixsie Wolmers9726f9a2021-09-07 15:33:16 -050096 {{ dataFormatter(item.systemType) }}
SurenNewarebbf896c2021-01-27 21:50:22 +053097 </dd>
Yoshie Muranaka56ee7692020-05-28 13:28:29 -070098 </dl>
99 </b-col>
Sukanya Pandeyeb4cef32021-04-09 15:40:27 +0530100 <b-col sm="6">
Sandeepa Singh1908ac92021-08-31 16:38:17 +0530101 <!-- Memory Summary -->
102 <p class="mt-1 mb-2 h6 float-none m-0">
103 {{ $t('pageInventory.table.memorySummary') }}
104 </p>
105 <dl class="ml-4">
Yoshie Muranaka56ee7692020-05-28 13:28:29 -0700106 <!-- Status state -->
Sandeepa Singh7affc522021-07-06 16:29:10 +0530107 <dt>{{ $t('pageInventory.table.statusState') }}:</dt>
Dixsie Wolmers9726f9a2021-09-07 15:33:16 -0500108 <dd>{{ dataFormatter(item.memorySummaryState) }}</dd>
Sukanya Pandeyeb4cef32021-04-09 15:40:27 +0530109 <!-- Health -->
Sandeepa Singh7affc522021-07-06 16:29:10 +0530110 <dt>{{ $t('pageInventory.table.health') }}:</dt>
Dixsie Wolmers9726f9a2021-09-07 15:33:16 -0500111 <dd>{{ dataFormatter(item.memorySummaryHealth) }}</dd>
Sukanya Pandeyeb4cef32021-04-09 15:40:27 +0530112 <!-- Health Roll -->
Sandeepa Singh7affc522021-07-06 16:29:10 +0530113 <dt>{{ $t('pageInventory.table.healthRollup') }}:</dt>
Dixsie Wolmers9726f9a2021-09-07 15:33:16 -0500114 <dd>{{ dataFormatter(item.memorySummaryHealthRoll) }}</dd>
Sandeepa Singh1908ac92021-08-31 16:38:17 +0530115 </dl>
116 <!-- Processor Summary -->
117 <p class="mt-1 mb-2 h6 float-none m-0">
118 {{ $t('pageInventory.table.processorSummary') }}
119 </p>
120 <dl class="ml-4">
Sukanya Pandeyeb4cef32021-04-09 15:40:27 +0530121 <!-- Status state -->
Sandeepa Singh7affc522021-07-06 16:29:10 +0530122 <dt>{{ $t('pageInventory.table.statusState') }}:</dt>
Dixsie Wolmers9726f9a2021-09-07 15:33:16 -0500123 <dd>{{ dataFormatter(item.processorSummaryState) }}</dd>
Sukanya Pandeyeb4cef32021-04-09 15:40:27 +0530124 <!-- Health -->
Sandeepa Singh7affc522021-07-06 16:29:10 +0530125 <dt>{{ $t('pageInventory.table.health') }}:</dt>
Dixsie Wolmers9726f9a2021-09-07 15:33:16 -0500126 <dd>{{ dataFormatter(item.processorSummaryHealth) }}</dd>
Sukanya Pandeyeb4cef32021-04-09 15:40:27 +0530127 <!-- Health Rollup -->
Sandeepa Singh7affc522021-07-06 16:29:10 +0530128 <dt>{{ $t('pageInventory.table.healthRollup') }}:</dt>
Dixsie Wolmers9726f9a2021-09-07 15:33:16 -0500129 <dd>{{ dataFormatter(item.processorSummaryHealthRoll) }}</dd>
Sukanya Pandeyeb4cef32021-04-09 15:40:27 +0530130 <!-- Count -->
Sandeepa Singh7affc522021-07-06 16:29:10 +0530131 <dt>{{ $t('pageInventory.table.count') }}:</dt>
Dixsie Wolmers9726f9a2021-09-07 15:33:16 -0500132 <dd>{{ dataFormatter(item.processorSummaryCount) }}</dd>
Yoshie Muranaka56ee7692020-05-28 13:28:29 -0700133 </dl>
134 </b-col>
135 </b-row>
136 </b-container>
137 </template>
138 </b-table>
139 </page-section>
140</template>
141
142<script>
Sukanya Pandeyeb4cef32021-04-09 15:40:27 +0530143import BVToastMixin from '@/components/Mixins/BVToastMixin';
Yoshie Muranaka56ee7692020-05-28 13:28:29 -0700144import PageSection from '@/components/Global/PageSection';
145import IconChevron from '@carbon/icons-vue/es/chevron--down/20';
146
147import StatusIcon from '@/components/Global/StatusIcon';
Dixsie Wolmersb53e0862020-09-08 14:13:38 -0500148
SurenNewareba91c492020-10-27 14:18:54 +0530149import TableRowExpandMixin, {
150 expandRowLabel,
151} from '@/components/Mixins/TableRowExpandMixin';
Dixsie Wolmers9726f9a2021-09-07 15:33:16 -0500152import DataFormatterMixin from '@/components/Mixins/DataFormatterMixin';
Yoshie Muranaka56ee7692020-05-28 13:28:29 -0700153
154export default {
155 components: { IconChevron, PageSection, StatusIcon },
Dixsie Wolmers9726f9a2021-09-07 15:33:16 -0500156 mixins: [BVToastMixin, TableRowExpandMixin, DataFormatterMixin],
Yoshie Muranaka56ee7692020-05-28 13:28:29 -0700157 data() {
158 return {
159 fields: [
160 {
161 key: 'expandRow',
162 label: '',
Derick Montague602e98a2020-10-21 16:20:00 -0500163 tdClass: 'table-row-expand',
Yoshie Muranaka56ee7692020-05-28 13:28:29 -0700164 },
165 {
166 key: 'id',
Sandeepa Singh7affc522021-07-06 16:29:10 +0530167 label: this.$t('pageInventory.table.id'),
Dixsie Wolmers9726f9a2021-09-07 15:33:16 -0500168 formatter: this.dataFormatter,
Yoshie Muranaka56ee7692020-05-28 13:28:29 -0700169 },
170 {
Sukanya Pandeyeb4cef32021-04-09 15:40:27 +0530171 key: 'hardwareType',
Sandeepa Singh7affc522021-07-06 16:29:10 +0530172 label: this.$t('pageInventory.table.hardwareType'),
Dixsie Wolmers9726f9a2021-09-07 15:33:16 -0500173 formatter: this.dataFormatter,
Sukanya Pandeyeb4cef32021-04-09 15:40:27 +0530174 tdClass: 'text-nowrap',
175 },
176 {
Yoshie Muranaka56ee7692020-05-28 13:28:29 -0700177 key: 'health',
Sandeepa Singh7affc522021-07-06 16:29:10 +0530178 label: this.$t('pageInventory.table.health'),
Dixsie Wolmers9726f9a2021-09-07 15:33:16 -0500179 formatter: this.dataFormatter,
Derick Montague602e98a2020-10-21 16:20:00 -0500180 tdClass: 'text-nowrap',
Yoshie Muranaka56ee7692020-05-28 13:28:29 -0700181 },
182 {
Sukanya Pandeyeb4cef32021-04-09 15:40:27 +0530183 key: 'locationNumber',
Sandeepa Singh7affc522021-07-06 16:29:10 +0530184 label: this.$t('pageInventory.table.locationNumber'),
Dixsie Wolmers9726f9a2021-09-07 15:33:16 -0500185 formatter: this.dataFormatter,
Yoshie Muranaka56ee7692020-05-28 13:28:29 -0700186 },
187 {
Sukanya Pandeyeb4cef32021-04-09 15:40:27 +0530188 key: 'locationIndicatorActive',
Sandeepa Singh7affc522021-07-06 16:29:10 +0530189 label: this.$t('pageInventory.table.identifyLed'),
Dixsie Wolmers9726f9a2021-09-07 15:33:16 -0500190 formatter: this.dataFormatter,
Derick Montague602e98a2020-10-21 16:20:00 -0500191 },
192 ],
SurenNewareba91c492020-10-27 14:18:54 +0530193 expandRowLabel: expandRowLabel,
Yoshie Muranaka56ee7692020-05-28 13:28:29 -0700194 };
195 },
196 computed: {
197 systems() {
198 return this.$store.getters['system/systems'];
Derick Montague602e98a2020-10-21 16:20:00 -0500199 },
Yoshie Muranaka56ee7692020-05-28 13:28:29 -0700200 },
201 created() {
202 this.$store.dispatch('system/getSystem').finally(() => {
Gunnar Millsdefc9e22020-07-07 20:29:03 -0500203 // Emit initial data fetch complete to parent component
Sukanya Pandeyedb8a772020-10-29 11:33:42 +0530204 this.$root.$emit('hardware-status-system-complete');
Yoshie Muranaka56ee7692020-05-28 13:28:29 -0700205 });
Derick Montague602e98a2020-10-21 16:20:00 -0500206 },
Sukanya Pandeyeb4cef32021-04-09 15:40:27 +0530207 methods: {
208 toggleIdentifyLedSwitch(state) {
209 this.$store
210 .dispatch('system/changeIdentifyLedState', state)
211 .catch(({ message }) => this.errorToast(message));
212 },
213 },
Yoshie Muranaka56ee7692020-05-28 13:28:29 -0700214};
215</script>