blob: 54129d1fcf15100fec2c52120d895286aac1106a [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
33 id="identifyLedSwitch"
34 v-model="item.locationIndicatorActive"
35 data-test-id="hardwareStatus-toggle-identifyLed"
36 switch
37 @change="toggleIdentifyLedSwitch"
38 >
39 </b-form-checkbox>
40 </template>
41
Derick Montague602e98a2020-10-21 16:20:00 -050042 <template #row-details="{ item }">
Yoshie Muranaka56ee7692020-05-28 13:28:29 -070043 <b-container fluid>
44 <b-row>
Sukanya Pandeyeb4cef32021-04-09 15:40:27 +053045 <b-col class="mt-2" sm="6">
Yoshie Muranaka56ee7692020-05-28 13:28:29 -070046 <dl>
Sukanya Pandeyeb4cef32021-04-09 15:40:27 +053047 <!-- Serial number -->
Sandeepa Singh7affc522021-07-06 16:29:10 +053048 <dt>{{ $t('pageInventory.table.serialNumber') }}:</dt>
Sukanya Pandeyeb4cef32021-04-09 15:40:27 +053049 <dd>{{ tableFormatter(item.serialNumber) }}</dd>
50 <!-- Model -->
Sandeepa Singh7affc522021-07-06 16:29:10 +053051 <dt>{{ $t('pageInventory.table.model') }}:</dt>
Sukanya Pandeyeb4cef32021-04-09 15:40:27 +053052 <dd>{{ tableFormatter(item.model) }}</dd>
Yoshie Muranaka56ee7692020-05-28 13:28:29 -070053 <!-- Asset tag -->
Sandeepa Singh7affc522021-07-06 16:29:10 +053054 <dt>{{ $t('pageInventory.table.assetTag') }}:</dt>
Sukanya Pandeyeb4cef32021-04-09 15:40:27 +053055 <dd class="mb-2">
56 {{ tableFormatter(item.assetTag) }}
57 </dd>
58 </dl>
59 </b-col>
60 <b-col class="mt-2" sm="6">
61 <dl>
62 <!-- Status state -->
Sandeepa Singh7affc522021-07-06 16:29:10 +053063 <dt>{{ $t('pageInventory.table.statusState') }}:</dt>
Sukanya Pandeyeb4cef32021-04-09 15:40:27 +053064 <dd>{{ tableFormatter(item.statusState) }}</dd>
65 <!-- Power state -->
Sandeepa Singh7affc522021-07-06 16:29:10 +053066 <dt>{{ $t('pageInventory.table.power') }}:</dt>
Sukanya Pandeyeb4cef32021-04-09 15:40:27 +053067 <dd>{{ tableFormatter(item.powerState) }}</dd>
68 <!-- Health rollup -->
Sandeepa Singh7affc522021-07-06 16:29:10 +053069 <dt>{{ $t('pageInventory.table.healthRollup') }}:</dt>
Sukanya Pandeyeb4cef32021-04-09 15:40:27 +053070 <dd>{{ tableFormatter(item.healthRollup) }}</dd>
71 </dl>
72 </b-col>
73 </b-row>
74 <div class="section-divider mb-3 mt-3"></div>
75 <b-row>
76 <b-col class="mt-1" sm="6">
77 <dl>
78 <!-- Manufacturer -->
Sandeepa Singh7affc522021-07-06 16:29:10 +053079 <dt>{{ $t('pageInventory.table.manufacturer') }}:</dt>
Yoshie Muranaka56ee7692020-05-28 13:28:29 -070080 <dd>{{ tableFormatter(item.assetTag) }}</dd>
Yoshie Muranaka56ee7692020-05-28 13:28:29 -070081 <!-- Description -->
Sandeepa Singh7affc522021-07-06 16:29:10 +053082 <dt>{{ $t('pageInventory.table.description') }}:</dt>
Yoshie Muranaka56ee7692020-05-28 13:28:29 -070083 <dd>{{ tableFormatter(item.description) }}</dd>
Sukanya Pandeyeb4cef32021-04-09 15:40:27 +053084 <!-- Sub Model -->
Sandeepa Singh7affc522021-07-06 16:29:10 +053085 <dt>{{ $t('pageInventory.table.subModel') }}:</dt>
Sukanya Pandeyeb4cef32021-04-09 15:40:27 +053086 <dd>
87 {{ tableFormatter(item.subModel) }}
SurenNewarebbf896c2021-01-27 21:50:22 +053088 </dd>
Sukanya Pandeyeb4cef32021-04-09 15:40:27 +053089 <!-- System Type -->
Sandeepa Singh7affc522021-07-06 16:29:10 +053090 <dt>{{ $t('pageInventory.table.systemType') }}:</dt>
Sukanya Pandeyeb4cef32021-04-09 15:40:27 +053091 <dd>
92 {{ tableFormatter(item.systemType) }}
SurenNewarebbf896c2021-01-27 21:50:22 +053093 </dd>
Yoshie Muranaka56ee7692020-05-28 13:28:29 -070094 </dl>
95 </b-col>
Sukanya Pandeyeb4cef32021-04-09 15:40:27 +053096 <b-col sm="6">
Yoshie Muranaka56ee7692020-05-28 13:28:29 -070097 <dl>
Sukanya Pandeyeb4cef32021-04-09 15:40:27 +053098 <!-- Memory Summary -->
99 <dt class="mt-1 mb-2 font-weight-bold float-none">
Sandeepa Singh7affc522021-07-06 16:29:10 +0530100 {{ $t('pageInventory.table.memorySummary') }}
Yoshie Muranaka56ee7692020-05-28 13:28:29 -0700101 </dt>
Yoshie Muranaka56ee7692020-05-28 13:28:29 -0700102 <!-- Status state -->
Sandeepa Singh7affc522021-07-06 16:29:10 +0530103 <dt>{{ $t('pageInventory.table.statusState') }}:</dt>
Sukanya Pandeyeb4cef32021-04-09 15:40:27 +0530104 <dd>{{ tableFormatter(item.memorySummaryState) }}</dd>
105 <!-- Health -->
Sandeepa Singh7affc522021-07-06 16:29:10 +0530106 <dt>{{ $t('pageInventory.table.health') }}:</dt>
Sukanya Pandeyeb4cef32021-04-09 15:40:27 +0530107 <dd>{{ tableFormatter(item.memorySummaryHealth) }}</dd>
108 <!-- Health Roll -->
Sandeepa Singh7affc522021-07-06 16:29:10 +0530109 <dt>{{ $t('pageInventory.table.healthRollup') }}:</dt>
Sukanya Pandeyeb4cef32021-04-09 15:40:27 +0530110 <dd>{{ tableFormatter(item.memorySummaryHealthRoll) }}</dd>
111
112 <!-- Processor Summary -->
113 <dt class="mt-1 mb-2 font-weight-bold float-none">
Sandeepa Singh7affc522021-07-06 16:29:10 +0530114 {{ $t('pageInventory.table.processorSummary') }}
Sukanya Pandeyeb4cef32021-04-09 15:40:27 +0530115 </dt>
116 <!-- Status state -->
Sandeepa Singh7affc522021-07-06 16:29:10 +0530117 <dt>{{ $t('pageInventory.table.statusState') }}:</dt>
Sukanya Pandeyeb4cef32021-04-09 15:40:27 +0530118 <dd>{{ tableFormatter(item.processorSummaryState) }}</dd>
119 <!-- Health -->
Sandeepa Singh7affc522021-07-06 16:29:10 +0530120 <dt>{{ $t('pageInventory.table.health') }}:</dt>
Sukanya Pandeyeb4cef32021-04-09 15:40:27 +0530121 <dd>{{ tableFormatter(item.processorSummaryHealth) }}</dd>
122 <!-- Health Rollup -->
Sandeepa Singh7affc522021-07-06 16:29:10 +0530123 <dt>{{ $t('pageInventory.table.healthRollup') }}:</dt>
Sukanya Pandeyeb4cef32021-04-09 15:40:27 +0530124 <dd>{{ tableFormatter(item.processorSummaryHealthRoll) }}</dd>
125 <!-- Count -->
Sandeepa Singh7affc522021-07-06 16:29:10 +0530126 <dt>{{ $t('pageInventory.table.count') }}:</dt>
Sukanya Pandeyeb4cef32021-04-09 15:40:27 +0530127 <dd>{{ tableFormatter(item.processorSummaryCount) }}</dd>
Yoshie Muranaka56ee7692020-05-28 13:28:29 -0700128 </dl>
129 </b-col>
130 </b-row>
131 </b-container>
132 </template>
133 </b-table>
134 </page-section>
135</template>
136
137<script>
Sukanya Pandeyeb4cef32021-04-09 15:40:27 +0530138import BVToastMixin from '@/components/Mixins/BVToastMixin';
Yoshie Muranaka56ee7692020-05-28 13:28:29 -0700139import PageSection from '@/components/Global/PageSection';
140import IconChevron from '@carbon/icons-vue/es/chevron--down/20';
141
142import StatusIcon from '@/components/Global/StatusIcon';
Dixsie Wolmersb53e0862020-09-08 14:13:38 -0500143
SurenNewareba91c492020-10-27 14:18:54 +0530144import TableRowExpandMixin, {
145 expandRowLabel,
146} from '@/components/Mixins/TableRowExpandMixin';
Yoshie Muranaka386df452020-06-18 12:45:13 -0700147import TableDataFormatterMixin from '@/components/Mixins/TableDataFormatterMixin';
Yoshie Muranaka56ee7692020-05-28 13:28:29 -0700148
149export default {
150 components: { IconChevron, PageSection, StatusIcon },
Sukanya Pandeyeb4cef32021-04-09 15:40:27 +0530151 mixins: [BVToastMixin, TableRowExpandMixin, TableDataFormatterMixin],
Yoshie Muranaka56ee7692020-05-28 13:28:29 -0700152 data() {
153 return {
154 fields: [
155 {
156 key: 'expandRow',
157 label: '',
Derick Montague602e98a2020-10-21 16:20:00 -0500158 tdClass: 'table-row-expand',
Yoshie Muranaka56ee7692020-05-28 13:28:29 -0700159 },
160 {
161 key: 'id',
Sandeepa Singh7affc522021-07-06 16:29:10 +0530162 label: this.$t('pageInventory.table.id'),
Derick Montague602e98a2020-10-21 16:20:00 -0500163 formatter: this.tableFormatter,
Yoshie Muranaka56ee7692020-05-28 13:28:29 -0700164 },
165 {
Sukanya Pandeyeb4cef32021-04-09 15:40:27 +0530166 key: 'hardwareType',
Sandeepa Singh7affc522021-07-06 16:29:10 +0530167 label: this.$t('pageInventory.table.hardwareType'),
Sukanya Pandeyeb4cef32021-04-09 15:40:27 +0530168 formatter: this.tableFormatter,
169 tdClass: 'text-nowrap',
170 },
171 {
Yoshie Muranaka56ee7692020-05-28 13:28:29 -0700172 key: 'health',
Sandeepa Singh7affc522021-07-06 16:29:10 +0530173 label: this.$t('pageInventory.table.health'),
Dixsie Wolmersa04d46f2020-10-22 06:34:56 -0500174 formatter: this.tableFormatter,
Derick Montague602e98a2020-10-21 16:20:00 -0500175 tdClass: 'text-nowrap',
Yoshie Muranaka56ee7692020-05-28 13:28:29 -0700176 },
177 {
Sukanya Pandeyeb4cef32021-04-09 15:40:27 +0530178 key: 'locationNumber',
Sandeepa Singh7affc522021-07-06 16:29:10 +0530179 label: this.$t('pageInventory.table.locationNumber'),
Derick Montague602e98a2020-10-21 16:20:00 -0500180 formatter: this.tableFormatter,
Yoshie Muranaka56ee7692020-05-28 13:28:29 -0700181 },
182 {
Sukanya Pandeyeb4cef32021-04-09 15:40:27 +0530183 key: 'locationIndicatorActive',
Sandeepa Singh7affc522021-07-06 16:29:10 +0530184 label: this.$t('pageInventory.table.identifyLed'),
Derick Montague602e98a2020-10-21 16:20:00 -0500185 formatter: this.tableFormatter,
186 },
187 ],
SurenNewareba91c492020-10-27 14:18:54 +0530188 expandRowLabel: expandRowLabel,
Yoshie Muranaka56ee7692020-05-28 13:28:29 -0700189 };
190 },
191 computed: {
192 systems() {
193 return this.$store.getters['system/systems'];
Derick Montague602e98a2020-10-21 16:20:00 -0500194 },
Yoshie Muranaka56ee7692020-05-28 13:28:29 -0700195 },
196 created() {
197 this.$store.dispatch('system/getSystem').finally(() => {
Gunnar Millsdefc9e22020-07-07 20:29:03 -0500198 // Emit initial data fetch complete to parent component
Sukanya Pandeyedb8a772020-10-29 11:33:42 +0530199 this.$root.$emit('hardware-status-system-complete');
Yoshie Muranaka56ee7692020-05-28 13:28:29 -0700200 });
Derick Montague602e98a2020-10-21 16:20:00 -0500201 },
Sukanya Pandeyeb4cef32021-04-09 15:40:27 +0530202 methods: {
203 toggleIdentifyLedSwitch(state) {
204 this.$store
205 .dispatch('system/changeIdentifyLedState', state)
206 .catch(({ message }) => this.errorToast(message));
207 },
208 },
Yoshie Muranaka56ee7692020-05-28 13:28:29 -0700209};
210</script>