blob: f2cdb3edb5c2608d6ecf2c978e8c1d3bd566fdca [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">
Yoshie Muranaka56ee7692020-05-28 13:28:29 -0700104 <dl>
Sukanya Pandeyeb4cef32021-04-09 15:40:27 +0530105 <!-- Memory Summary -->
106 <dt class="mt-1 mb-2 font-weight-bold float-none">
Sandeepa Singh7affc522021-07-06 16:29:10 +0530107 {{ $t('pageInventory.table.memorySummary') }}
Yoshie Muranaka56ee7692020-05-28 13:28:29 -0700108 </dt>
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>
118
119 <!-- Processor Summary -->
120 <dt class="mt-1 mb-2 font-weight-bold float-none">
Sandeepa Singh7affc522021-07-06 16:29:10 +0530121 {{ $t('pageInventory.table.processorSummary') }}
Sukanya Pandeyeb4cef32021-04-09 15:40:27 +0530122 </dt>
123 <!-- Status state -->
Sandeepa Singh7affc522021-07-06 16:29:10 +0530124 <dt>{{ $t('pageInventory.table.statusState') }}:</dt>
Sukanya Pandeyeb4cef32021-04-09 15:40:27 +0530125 <dd>{{ tableFormatter(item.processorSummaryState) }}</dd>
126 <!-- Health -->
Sandeepa Singh7affc522021-07-06 16:29:10 +0530127 <dt>{{ $t('pageInventory.table.health') }}:</dt>
Sukanya Pandeyeb4cef32021-04-09 15:40:27 +0530128 <dd>{{ tableFormatter(item.processorSummaryHealth) }}</dd>
129 <!-- Health Rollup -->
Sandeepa Singh7affc522021-07-06 16:29:10 +0530130 <dt>{{ $t('pageInventory.table.healthRollup') }}:</dt>
Sukanya Pandeyeb4cef32021-04-09 15:40:27 +0530131 <dd>{{ tableFormatter(item.processorSummaryHealthRoll) }}</dd>
132 <!-- Count -->
Sandeepa Singh7affc522021-07-06 16:29:10 +0530133 <dt>{{ $t('pageInventory.table.count') }}:</dt>
Sukanya Pandeyeb4cef32021-04-09 15:40:27 +0530134 <dd>{{ tableFormatter(item.processorSummaryCount) }}</dd>
Yoshie Muranaka56ee7692020-05-28 13:28:29 -0700135 </dl>
136 </b-col>
137 </b-row>
138 </b-container>
139 </template>
140 </b-table>
141 </page-section>
142</template>
143
144<script>
Sukanya Pandeyeb4cef32021-04-09 15:40:27 +0530145import BVToastMixin from '@/components/Mixins/BVToastMixin';
Yoshie Muranaka56ee7692020-05-28 13:28:29 -0700146import PageSection from '@/components/Global/PageSection';
147import IconChevron from '@carbon/icons-vue/es/chevron--down/20';
148
149import StatusIcon from '@/components/Global/StatusIcon';
Dixsie Wolmersb53e0862020-09-08 14:13:38 -0500150
SurenNewareba91c492020-10-27 14:18:54 +0530151import TableRowExpandMixin, {
152 expandRowLabel,
153} from '@/components/Mixins/TableRowExpandMixin';
Yoshie Muranaka386df452020-06-18 12:45:13 -0700154import TableDataFormatterMixin from '@/components/Mixins/TableDataFormatterMixin';
Yoshie Muranaka56ee7692020-05-28 13:28:29 -0700155
156export default {
157 components: { IconChevron, PageSection, StatusIcon },
Sukanya Pandeyeb4cef32021-04-09 15:40:27 +0530158 mixins: [BVToastMixin, TableRowExpandMixin, TableDataFormatterMixin],
Yoshie Muranaka56ee7692020-05-28 13:28:29 -0700159 data() {
160 return {
161 fields: [
162 {
163 key: 'expandRow',
164 label: '',
Derick Montague602e98a2020-10-21 16:20:00 -0500165 tdClass: 'table-row-expand',
Yoshie Muranaka56ee7692020-05-28 13:28:29 -0700166 },
167 {
168 key: 'id',
Sandeepa Singh7affc522021-07-06 16:29:10 +0530169 label: this.$t('pageInventory.table.id'),
Derick Montague602e98a2020-10-21 16:20:00 -0500170 formatter: this.tableFormatter,
Yoshie Muranaka56ee7692020-05-28 13:28:29 -0700171 },
172 {
Sukanya Pandeyeb4cef32021-04-09 15:40:27 +0530173 key: 'hardwareType',
Sandeepa Singh7affc522021-07-06 16:29:10 +0530174 label: this.$t('pageInventory.table.hardwareType'),
Sukanya Pandeyeb4cef32021-04-09 15:40:27 +0530175 formatter: this.tableFormatter,
176 tdClass: 'text-nowrap',
177 },
178 {
Yoshie Muranaka56ee7692020-05-28 13:28:29 -0700179 key: 'health',
Sandeepa Singh7affc522021-07-06 16:29:10 +0530180 label: this.$t('pageInventory.table.health'),
Dixsie Wolmersa04d46f2020-10-22 06:34:56 -0500181 formatter: this.tableFormatter,
Derick Montague602e98a2020-10-21 16:20:00 -0500182 tdClass: 'text-nowrap',
Yoshie Muranaka56ee7692020-05-28 13:28:29 -0700183 },
184 {
Sukanya Pandeyeb4cef32021-04-09 15:40:27 +0530185 key: 'locationNumber',
Sandeepa Singh7affc522021-07-06 16:29:10 +0530186 label: this.$t('pageInventory.table.locationNumber'),
Derick Montague602e98a2020-10-21 16:20:00 -0500187 formatter: this.tableFormatter,
Yoshie Muranaka56ee7692020-05-28 13:28:29 -0700188 },
189 {
Sukanya Pandeyeb4cef32021-04-09 15:40:27 +0530190 key: 'locationIndicatorActive',
Sandeepa Singh7affc522021-07-06 16:29:10 +0530191 label: this.$t('pageInventory.table.identifyLed'),
Derick Montague602e98a2020-10-21 16:20:00 -0500192 formatter: this.tableFormatter,
193 },
194 ],
SurenNewareba91c492020-10-27 14:18:54 +0530195 expandRowLabel: expandRowLabel,
Yoshie Muranaka56ee7692020-05-28 13:28:29 -0700196 };
197 },
198 computed: {
199 systems() {
200 return this.$store.getters['system/systems'];
Derick Montague602e98a2020-10-21 16:20:00 -0500201 },
Yoshie Muranaka56ee7692020-05-28 13:28:29 -0700202 },
203 created() {
204 this.$store.dispatch('system/getSystem').finally(() => {
Gunnar Millsdefc9e22020-07-07 20:29:03 -0500205 // Emit initial data fetch complete to parent component
Sukanya Pandeyedb8a772020-10-29 11:33:42 +0530206 this.$root.$emit('hardware-status-system-complete');
Yoshie Muranaka56ee7692020-05-28 13:28:29 -0700207 });
Derick Montague602e98a2020-10-21 16:20:00 -0500208 },
Sukanya Pandeyeb4cef32021-04-09 15:40:27 +0530209 methods: {
210 toggleIdentifyLedSwitch(state) {
211 this.$store
212 .dispatch('system/changeIdentifyLedState', state)
213 .catch(({ message }) => this.errorToast(message));
214 },
215 },
Yoshie Muranaka56ee7692020-05-28 13:28:29 -0700216};
217</script>