blob: 6e2ebdae3f3a4c27cdd0d941e4264bc567936698 [file] [log] [blame]
SurenNewaredc3fa2e2020-08-04 20:45:25 +05301<template>
2 <page-section :section-title="$t('pageHardwareStatus.processors')">
3 <!-- Search -->
SurenNeware787635a2020-11-24 22:42:42 +05304 <b-row class="align-items-end">
SurenNewaredc3fa2e2020-08-04 20:45:25 +05305 <b-col sm="6" md="5" xl="4">
Dixsie Wolmers9b22b492020-09-07 21:26:06 -05006 <search
Sukanya Pandeyedb8a772020-10-29 11:33:42 +05307 @change-search="onChangeSearchInput"
8 @clear-search="onClearSearchInput"
Dixsie Wolmers9b22b492020-09-07 21:26:06 -05009 />
SurenNewaredc3fa2e2020-08-04 20:45:25 +053010 </b-col>
Sukanya Pandey99010962020-07-27 21:44:47 +053011 <b-col sm="6" md="3" xl="2">
12 <table-cell-count
13 :filtered-items-count="filteredRows"
14 :total-number-of-cells="processors.length"
15 ></table-cell-count>
16 </b-col>
SurenNewaredc3fa2e2020-08-04 20:45:25 +053017 </b-row>
18 <b-table
19 sort-icon-left
20 no-sort-reset
Sukanya Pandeyfde429e2020-09-14 20:48:39 +053021 hover
SurenNewaredc3fa2e2020-08-04 20:45:25 +053022 responsive="md"
SurenNeware10fe2762020-08-19 12:01:32 +053023 show-empty
SurenNewaredc3fa2e2020-08-04 20:45:25 +053024 :items="processors"
25 :fields="fields"
26 :sort-desc="true"
27 :filter="searchFilter"
SurenNeware10fe2762020-08-19 12:01:32 +053028 :empty-text="$t('global.table.emptyMessage')"
SurenNeware156a0e62020-08-28 19:20:03 +053029 :empty-filtered-text="$t('global.table.emptySearchMessage')"
Sukanya Pandey99010962020-07-27 21:44:47 +053030 @filtered="onFiltered"
SurenNewaredc3fa2e2020-08-04 20:45:25 +053031 >
32 <!-- Expand button -->
Derick Montague602e98a2020-10-21 16:20:00 -050033 <template #cell(expandRow)="row">
SurenNewaredc3fa2e2020-08-04 20:45:25 +053034 <b-button
35 variant="link"
36 data-test-id="hardwareStatus-button-expandProcessors"
Dixsie Wolmersb53e0862020-09-08 14:13:38 -050037 :aria-label="expandRowLabel"
Dixsie Wolmers30f11f82020-11-10 16:07:56 -060038 :title="expandRowLabel"
39 class="btn-icon-only"
Dixsie Wolmersb53e0862020-09-08 14:13:38 -050040 @click="toggleRowDetails(row)"
SurenNewaredc3fa2e2020-08-04 20:45:25 +053041 >
Dixsie Wolmers30f11f82020-11-10 16:07:56 -060042 <icon-chevron />
SurenNewaredc3fa2e2020-08-04 20:45:25 +053043 </b-button>
44 </template>
45 <!-- Health -->
Derick Montague602e98a2020-10-21 16:20:00 -050046 <template #cell(health)="{ value }">
SurenNewaredc3fa2e2020-08-04 20:45:25 +053047 <status-icon :status="statusIcon(value)" />
48 {{ value }}
49 </template>
Derick Montague602e98a2020-10-21 16:20:00 -050050 <template #row-details="{ item }">
SurenNewaredc3fa2e2020-08-04 20:45:25 +053051 <b-container fluid>
52 <b-row>
53 <b-col sm="6" xl="4">
54 <dl>
55 <!-- Name -->
56 <dt>{{ $t('pageHardwareStatus.table.name') }}:</dt>
57 <dd>{{ tableFormatter(item.name) }}</dd>
58 <br />
59 <!-- Model -->
60 <dt>{{ $t('pageHardwareStatus.table.model') }}:</dt>
61 <dd>{{ tableFormatter(item.model) }}</dd>
62 <br />
63 <!-- Instruction set -->
64 <dt>{{ $t('pageHardwareStatus.table.instructionSet') }}:</dt>
65 <dd>{{ tableFormatter(item.instructionSet) }}</dd>
66 <br />
67 <!-- Manufacturer -->
68 <dt>{{ $t('pageHardwareStatus.table.manufacturer') }}:</dt>
69 <dd>{{ tableFormatter(item.manufacturer) }}</dd>
70 </dl>
71 </b-col>
72 <b-col sm="6" xl="4">
73 <dl>
74 <!-- Architecture -->
75 <dt>
76 {{ $t('pageHardwareStatus.table.processorArchitecture') }}:
77 </dt>
78 <dd>{{ tableFormatter(item.processorArchitecture) }}</dd>
79 <br />
80 <!-- Type -->
81 <dt>{{ $t('pageHardwareStatus.table.processorType') }}:</dt>
82 <dd>{{ tableFormatter(item.processorType) }}</dd>
83 <br />
84 <!-- Total cores -->
85 <dt>{{ $t('pageHardwareStatus.table.totalCores') }}:</dt>
86 <dd>{{ tableFormatter(item.totalCores) }}</dd>
87 <br />
88 <!-- Status state -->
89 <dt>{{ $t('pageHardwareStatus.table.statusState') }}:</dt>
90 <dd>{{ tableFormatter(item.statusState) }}</dd>
91 </dl>
92 </b-col>
93 </b-row>
94 </b-container>
95 </template>
96 </b-table>
97 </page-section>
98</template>
99
100<script>
101import PageSection from '@/components/Global/PageSection';
102import IconChevron from '@carbon/icons-vue/es/chevron--down/20';
103import StatusIcon from '@/components/Global/StatusIcon';
Sukanya Pandey99010962020-07-27 21:44:47 +0530104import TableCellCount from '@/components/Global/TableCellCount';
SurenNewaredc3fa2e2020-08-04 20:45:25 +0530105
106import TableSortMixin from '@/components/Mixins/TableSortMixin';
107import TableDataFormatterMixin from '@/components/Mixins/TableDataFormatterMixin';
108import Search from '@/components/Global/Search';
SurenNewareba91c492020-10-27 14:18:54 +0530109import SearchFilterMixin, {
110 searchFilter,
111} from '@/components/Mixins/SearchFilterMixin';
112import TableRowExpandMixin, {
113 expandRowLabel,
114} from '@/components/Mixins/TableRowExpandMixin';
SurenNewaredc3fa2e2020-08-04 20:45:25 +0530115
116export default {
Dixsie Wolmersb53e0862020-09-08 14:13:38 -0500117 components: { IconChevron, PageSection, StatusIcon, Search, TableCellCount },
118 mixins: [
119 TableRowExpandMixin,
120 TableDataFormatterMixin,
121 TableSortMixin,
Derick Montague602e98a2020-10-21 16:20:00 -0500122 SearchFilterMixin,
Dixsie Wolmersb53e0862020-09-08 14:13:38 -0500123 ],
SurenNewaredc3fa2e2020-08-04 20:45:25 +0530124 data() {
125 return {
126 fields: [
127 {
128 key: 'expandRow',
129 label: '',
130 tdClass: 'table-row-expand',
Derick Montague602e98a2020-10-21 16:20:00 -0500131 sortable: false,
SurenNewaredc3fa2e2020-08-04 20:45:25 +0530132 },
133 {
134 key: 'id',
135 label: this.$t('pageHardwareStatus.table.id'),
136 formatter: this.tableFormatter,
Derick Montague602e98a2020-10-21 16:20:00 -0500137 sortable: true,
SurenNewaredc3fa2e2020-08-04 20:45:25 +0530138 },
139 {
140 key: 'health',
141 label: this.$t('pageHardwareStatus.table.health'),
142 formatter: this.tableFormatter,
Dixsie Wolmersa04d46f2020-10-22 06:34:56 -0500143 sortable: true,
Derick Montague602e98a2020-10-21 16:20:00 -0500144 tdClass: 'text-nowrap',
SurenNewaredc3fa2e2020-08-04 20:45:25 +0530145 },
146 {
147 key: 'partNumber',
148 label: this.$t('pageHardwareStatus.table.partNumber'),
149 formatter: this.tableFormatter,
Derick Montague602e98a2020-10-21 16:20:00 -0500150 sortable: true,
SurenNewaredc3fa2e2020-08-04 20:45:25 +0530151 },
152 {
153 key: 'serialNumber',
154 label: this.$t('pageHardwareStatus.table.serialNumber'),
155 formatter: this.tableFormatter,
Derick Montague602e98a2020-10-21 16:20:00 -0500156 sortable: true,
157 },
SurenNewaredc3fa2e2020-08-04 20:45:25 +0530158 ],
SurenNewareba91c492020-10-27 14:18:54 +0530159 searchFilter: searchFilter,
Derick Montague602e98a2020-10-21 16:20:00 -0500160 searchTotalFilteredRows: 0,
SurenNewareba91c492020-10-27 14:18:54 +0530161 expandRowLabel: expandRowLabel,
SurenNewaredc3fa2e2020-08-04 20:45:25 +0530162 };
163 },
164 computed: {
Sukanya Pandey99010962020-07-27 21:44:47 +0530165 filteredRows() {
166 return this.searchFilter
167 ? this.searchTotalFilteredRows
168 : this.processors.length;
169 },
SurenNewaredc3fa2e2020-08-04 20:45:25 +0530170 processors() {
171 return this.$store.getters['processors/processors'];
Derick Montague602e98a2020-10-21 16:20:00 -0500172 },
SurenNewaredc3fa2e2020-08-04 20:45:25 +0530173 },
174 created() {
175 this.$store.dispatch('processors/getProcessorsInfo').finally(() => {
176 // Emit initial data fetch complete to parent component
Sukanya Pandeyedb8a772020-10-29 11:33:42 +0530177 this.$root.$emit('hardware-status-processors-complete');
SurenNewaredc3fa2e2020-08-04 20:45:25 +0530178 });
179 },
180 methods: {
Sukanya Pandey99010962020-07-27 21:44:47 +0530181 onFiltered(filteredItems) {
182 this.searchTotalFilteredRows = filteredItems.length;
Derick Montague602e98a2020-10-21 16:20:00 -0500183 },
184 },
SurenNewaredc3fa2e2020-08-04 20:45:25 +0530185};
186</script>