blob: 44a35859b3bd618bafba944e76553b5766579acd [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 class="sr-only">
40 {{ $t('pageInventory.table.identifyLed') }}
41 </span>
42 <span v-if="item.locationIndicatorActive">
43 {{ $t('global.status.on') }}
44 </span>
45 <span v-else>{{ $t('global.status.off') }}</span>
Sukanya Pandeyeb4cef32021-04-09 15:40:27 +053046 </b-form-checkbox>
47 </template>
48
Derick Montague602e98a2020-10-21 16:20:00 -050049 <template #row-details="{ item }">
Yoshie Muranaka56ee7692020-05-28 13:28:29 -070050 <b-container fluid>
51 <b-row>
Sukanya Pandeyeb4cef32021-04-09 15:40:27 +053052 <b-col class="mt-2" sm="6">
Yoshie Muranaka56ee7692020-05-28 13:28:29 -070053 <dl>
Sukanya Pandeyeb4cef32021-04-09 15:40:27 +053054 <!-- Serial number -->
Sandeepa Singh7affc522021-07-06 16:29:10 +053055 <dt>{{ $t('pageInventory.table.serialNumber') }}:</dt>
Sukanya Pandeyeb4cef32021-04-09 15:40:27 +053056 <dd>{{ tableFormatter(item.serialNumber) }}</dd>
57 <!-- Model -->
Sandeepa Singh7affc522021-07-06 16:29:10 +053058 <dt>{{ $t('pageInventory.table.model') }}:</dt>
Sukanya Pandeyeb4cef32021-04-09 15:40:27 +053059 <dd>{{ tableFormatter(item.model) }}</dd>
Yoshie Muranaka56ee7692020-05-28 13:28:29 -070060 <!-- Asset tag -->
Sandeepa Singh7affc522021-07-06 16:29:10 +053061 <dt>{{ $t('pageInventory.table.assetTag') }}:</dt>
Sukanya Pandeyeb4cef32021-04-09 15:40:27 +053062 <dd class="mb-2">
63 {{ tableFormatter(item.assetTag) }}
64 </dd>
65 </dl>
66 </b-col>
67 <b-col class="mt-2" sm="6">
68 <dl>
69 <!-- Status state -->
Sandeepa Singh7affc522021-07-06 16:29:10 +053070 <dt>{{ $t('pageInventory.table.statusState') }}:</dt>
Sukanya Pandeyeb4cef32021-04-09 15:40:27 +053071 <dd>{{ tableFormatter(item.statusState) }}</dd>
72 <!-- Power state -->
Sandeepa Singh7affc522021-07-06 16:29:10 +053073 <dt>{{ $t('pageInventory.table.power') }}:</dt>
Sukanya Pandeyeb4cef32021-04-09 15:40:27 +053074 <dd>{{ tableFormatter(item.powerState) }}</dd>
75 <!-- Health rollup -->
Sandeepa Singh7affc522021-07-06 16:29:10 +053076 <dt>{{ $t('pageInventory.table.healthRollup') }}:</dt>
Sukanya Pandeyeb4cef32021-04-09 15:40:27 +053077 <dd>{{ tableFormatter(item.healthRollup) }}</dd>
78 </dl>
79 </b-col>
80 </b-row>
81 <div class="section-divider mb-3 mt-3"></div>
82 <b-row>
83 <b-col class="mt-1" sm="6">
84 <dl>
85 <!-- Manufacturer -->
Sandeepa Singh7affc522021-07-06 16:29:10 +053086 <dt>{{ $t('pageInventory.table.manufacturer') }}:</dt>
Yoshie Muranaka56ee7692020-05-28 13:28:29 -070087 <dd>{{ tableFormatter(item.assetTag) }}</dd>
Yoshie Muranaka56ee7692020-05-28 13:28:29 -070088 <!-- Description -->
Sandeepa Singh7affc522021-07-06 16:29:10 +053089 <dt>{{ $t('pageInventory.table.description') }}:</dt>
Yoshie Muranaka56ee7692020-05-28 13:28:29 -070090 <dd>{{ tableFormatter(item.description) }}</dd>
Sukanya Pandeyeb4cef32021-04-09 15:40:27 +053091 <!-- Sub Model -->
Sandeepa Singh7affc522021-07-06 16:29:10 +053092 <dt>{{ $t('pageInventory.table.subModel') }}:</dt>
Sukanya Pandeyeb4cef32021-04-09 15:40:27 +053093 <dd>
94 {{ tableFormatter(item.subModel) }}
SurenNewarebbf896c2021-01-27 21:50:22 +053095 </dd>
Sukanya Pandeyeb4cef32021-04-09 15:40:27 +053096 <!-- System Type -->
Sandeepa Singh7affc522021-07-06 16:29:10 +053097 <dt>{{ $t('pageInventory.table.systemType') }}:</dt>
Sukanya Pandeyeb4cef32021-04-09 15:40:27 +053098 <dd>
99 {{ tableFormatter(item.systemType) }}
SurenNewarebbf896c2021-01-27 21:50:22 +0530100 </dd>
Yoshie Muranaka56ee7692020-05-28 13:28:29 -0700101 </dl>
102 </b-col>
Sukanya Pandeyeb4cef32021-04-09 15:40:27 +0530103 <b-col sm="6">
Sandeepa Singh1908ac92021-08-31 16:38:17 +0530104 <!-- Memory Summary -->
105 <p class="mt-1 mb-2 h6 float-none m-0">
106 {{ $t('pageInventory.table.memorySummary') }}
107 </p>
108 <dl class="ml-4">
Yoshie Muranaka56ee7692020-05-28 13:28:29 -0700109 <!-- Status state -->
Sandeepa Singh7affc522021-07-06 16:29:10 +0530110 <dt>{{ $t('pageInventory.table.statusState') }}:</dt>
Sukanya Pandeyeb4cef32021-04-09 15:40:27 +0530111 <dd>{{ tableFormatter(item.memorySummaryState) }}</dd>
112 <!-- Health -->
Sandeepa Singh7affc522021-07-06 16:29:10 +0530113 <dt>{{ $t('pageInventory.table.health') }}:</dt>
Sukanya Pandeyeb4cef32021-04-09 15:40:27 +0530114 <dd>{{ tableFormatter(item.memorySummaryHealth) }}</dd>
115 <!-- Health Roll -->
Sandeepa Singh7affc522021-07-06 16:29:10 +0530116 <dt>{{ $t('pageInventory.table.healthRollup') }}:</dt>
Sukanya Pandeyeb4cef32021-04-09 15:40:27 +0530117 <dd>{{ tableFormatter(item.memorySummaryHealthRoll) }}</dd>
Sandeepa Singh1908ac92021-08-31 16:38:17 +0530118 </dl>
119 <!-- Processor Summary -->
120 <p class="mt-1 mb-2 h6 float-none m-0">
121 {{ $t('pageInventory.table.processorSummary') }}
122 </p>
123 <dl class="ml-4">
Sukanya Pandeyeb4cef32021-04-09 15:40:27 +0530124 <!-- Status state -->
Sandeepa Singh7affc522021-07-06 16:29:10 +0530125 <dt>{{ $t('pageInventory.table.statusState') }}:</dt>
Sukanya Pandeyeb4cef32021-04-09 15:40:27 +0530126 <dd>{{ tableFormatter(item.processorSummaryState) }}</dd>
127 <!-- Health -->
Sandeepa Singh7affc522021-07-06 16:29:10 +0530128 <dt>{{ $t('pageInventory.table.health') }}:</dt>
Sukanya Pandeyeb4cef32021-04-09 15:40:27 +0530129 <dd>{{ tableFormatter(item.processorSummaryHealth) }}</dd>
130 <!-- Health Rollup -->
Sandeepa Singh7affc522021-07-06 16:29:10 +0530131 <dt>{{ $t('pageInventory.table.healthRollup') }}:</dt>
Sukanya Pandeyeb4cef32021-04-09 15:40:27 +0530132 <dd>{{ tableFormatter(item.processorSummaryHealthRoll) }}</dd>
133 <!-- Count -->
Sandeepa Singh7affc522021-07-06 16:29:10 +0530134 <dt>{{ $t('pageInventory.table.count') }}:</dt>
Sukanya Pandeyeb4cef32021-04-09 15:40:27 +0530135 <dd>{{ tableFormatter(item.processorSummaryCount) }}</dd>
Yoshie Muranaka56ee7692020-05-28 13:28:29 -0700136 </dl>
137 </b-col>
138 </b-row>
139 </b-container>
140 </template>
141 </b-table>
142 </page-section>
143</template>
144
145<script>
Sukanya Pandeyeb4cef32021-04-09 15:40:27 +0530146import BVToastMixin from '@/components/Mixins/BVToastMixin';
Yoshie Muranaka56ee7692020-05-28 13:28:29 -0700147import PageSection from '@/components/Global/PageSection';
148import IconChevron from '@carbon/icons-vue/es/chevron--down/20';
149
150import StatusIcon from '@/components/Global/StatusIcon';
Dixsie Wolmersb53e0862020-09-08 14:13:38 -0500151
SurenNewareba91c492020-10-27 14:18:54 +0530152import TableRowExpandMixin, {
153 expandRowLabel,
154} from '@/components/Mixins/TableRowExpandMixin';
Yoshie Muranaka386df452020-06-18 12:45:13 -0700155import TableDataFormatterMixin from '@/components/Mixins/TableDataFormatterMixin';
Yoshie Muranaka56ee7692020-05-28 13:28:29 -0700156
157export default {
158 components: { IconChevron, PageSection, StatusIcon },
Sukanya Pandeyeb4cef32021-04-09 15:40:27 +0530159 mixins: [BVToastMixin, TableRowExpandMixin, TableDataFormatterMixin],
Yoshie Muranaka56ee7692020-05-28 13:28:29 -0700160 data() {
161 return {
162 fields: [
163 {
164 key: 'expandRow',
165 label: '',
Derick Montague602e98a2020-10-21 16:20:00 -0500166 tdClass: 'table-row-expand',
Yoshie Muranaka56ee7692020-05-28 13:28:29 -0700167 },
168 {
169 key: 'id',
Sandeepa Singh7affc522021-07-06 16:29:10 +0530170 label: this.$t('pageInventory.table.id'),
Derick Montague602e98a2020-10-21 16:20:00 -0500171 formatter: this.tableFormatter,
Yoshie Muranaka56ee7692020-05-28 13:28:29 -0700172 },
173 {
Sukanya Pandeyeb4cef32021-04-09 15:40:27 +0530174 key: 'hardwareType',
Sandeepa Singh7affc522021-07-06 16:29:10 +0530175 label: this.$t('pageInventory.table.hardwareType'),
Sukanya Pandeyeb4cef32021-04-09 15:40:27 +0530176 formatter: this.tableFormatter,
177 tdClass: 'text-nowrap',
178 },
179 {
Yoshie Muranaka56ee7692020-05-28 13:28:29 -0700180 key: 'health',
Sandeepa Singh7affc522021-07-06 16:29:10 +0530181 label: this.$t('pageInventory.table.health'),
Dixsie Wolmersa04d46f2020-10-22 06:34:56 -0500182 formatter: this.tableFormatter,
Derick Montague602e98a2020-10-21 16:20:00 -0500183 tdClass: 'text-nowrap',
Yoshie Muranaka56ee7692020-05-28 13:28:29 -0700184 },
185 {
Sukanya Pandeyeb4cef32021-04-09 15:40:27 +0530186 key: 'locationNumber',
Sandeepa Singh7affc522021-07-06 16:29:10 +0530187 label: this.$t('pageInventory.table.locationNumber'),
Derick Montague602e98a2020-10-21 16:20:00 -0500188 formatter: this.tableFormatter,
Yoshie Muranaka56ee7692020-05-28 13:28:29 -0700189 },
190 {
Sukanya Pandeyeb4cef32021-04-09 15:40:27 +0530191 key: 'locationIndicatorActive',
Sandeepa Singh7affc522021-07-06 16:29:10 +0530192 label: this.$t('pageInventory.table.identifyLed'),
Derick Montague602e98a2020-10-21 16:20:00 -0500193 formatter: this.tableFormatter,
194 },
195 ],
SurenNewareba91c492020-10-27 14:18:54 +0530196 expandRowLabel: expandRowLabel,
Yoshie Muranaka56ee7692020-05-28 13:28:29 -0700197 };
198 },
199 computed: {
200 systems() {
201 return this.$store.getters['system/systems'];
Derick Montague602e98a2020-10-21 16:20:00 -0500202 },
Yoshie Muranaka56ee7692020-05-28 13:28:29 -0700203 },
204 created() {
205 this.$store.dispatch('system/getSystem').finally(() => {
Gunnar Millsdefc9e22020-07-07 20:29:03 -0500206 // Emit initial data fetch complete to parent component
Sukanya Pandeyedb8a772020-10-29 11:33:42 +0530207 this.$root.$emit('hardware-status-system-complete');
Yoshie Muranaka56ee7692020-05-28 13:28:29 -0700208 });
Derick Montague602e98a2020-10-21 16:20:00 -0500209 },
Sukanya Pandeyeb4cef32021-04-09 15:40:27 +0530210 methods: {
211 toggleIdentifyLedSwitch(state) {
212 this.$store
213 .dispatch('system/changeIdentifyLedState', state)
214 .catch(({ message }) => this.errorToast(message));
215 },
216 },
Yoshie Muranaka56ee7692020-05-28 13:28:29 -0700217};
218</script>