blob: 28163e8abd8936a2c5aae07781d4fbe0c591c2a5 [file] [log] [blame]
SurenNewaredc3fa2e2020-08-04 20:45:25 +05301<template>
2 <page-section :section-title="$t('pageHardwareStatus.processors')">
3 <!-- Search -->
4 <b-row>
5 <b-col sm="6" md="5" xl="4">
6 <search @changeSearch="onChangeSearchInput" />
7 </b-col>
8 </b-row>
9 <b-table
10 sort-icon-left
11 no-sort-reset
12 responsive="md"
SurenNeware10fe2762020-08-19 12:01:32 +053013 show-empty
SurenNewaredc3fa2e2020-08-04 20:45:25 +053014 :items="processors"
15 :fields="fields"
16 :sort-desc="true"
17 :filter="searchFilter"
SurenNeware10fe2762020-08-19 12:01:32 +053018 :empty-text="$t('global.table.emptyMessage')"
SurenNewaredc3fa2e2020-08-04 20:45:25 +053019 >
20 <!-- Expand button -->
21 <template v-slot:cell(expandRow)="row">
22 <b-button
23 variant="link"
24 data-test-id="hardwareStatus-button-expandProcessors"
25 @click="row.toggleDetails"
26 >
27 <icon-chevron />
28 </b-button>
29 </template>
30 <!-- Health -->
31 <template v-slot:cell(health)="{ value }">
32 <status-icon :status="statusIcon(value)" />
33 {{ value }}
34 </template>
35 <template v-slot:row-details="{ item }">
36 <b-container fluid>
37 <b-row>
38 <b-col sm="6" xl="4">
39 <dl>
40 <!-- Name -->
41 <dt>{{ $t('pageHardwareStatus.table.name') }}:</dt>
42 <dd>{{ tableFormatter(item.name) }}</dd>
43 <br />
44 <!-- Model -->
45 <dt>{{ $t('pageHardwareStatus.table.model') }}:</dt>
46 <dd>{{ tableFormatter(item.model) }}</dd>
47 <br />
48 <!-- Instruction set -->
49 <dt>{{ $t('pageHardwareStatus.table.instructionSet') }}:</dt>
50 <dd>{{ tableFormatter(item.instructionSet) }}</dd>
51 <br />
52 <!-- Manufacturer -->
53 <dt>{{ $t('pageHardwareStatus.table.manufacturer') }}:</dt>
54 <dd>{{ tableFormatter(item.manufacturer) }}</dd>
55 </dl>
56 </b-col>
57 <b-col sm="6" xl="4">
58 <dl>
59 <!-- Architecture -->
60 <dt>
61 {{ $t('pageHardwareStatus.table.processorArchitecture') }}:
62 </dt>
63 <dd>{{ tableFormatter(item.processorArchitecture) }}</dd>
64 <br />
65 <!-- Type -->
66 <dt>{{ $t('pageHardwareStatus.table.processorType') }}:</dt>
67 <dd>{{ tableFormatter(item.processorType) }}</dd>
68 <br />
69 <!-- Total cores -->
70 <dt>{{ $t('pageHardwareStatus.table.totalCores') }}:</dt>
71 <dd>{{ tableFormatter(item.totalCores) }}</dd>
72 <br />
73 <!-- Status state -->
74 <dt>{{ $t('pageHardwareStatus.table.statusState') }}:</dt>
75 <dd>{{ tableFormatter(item.statusState) }}</dd>
76 </dl>
77 </b-col>
78 </b-row>
79 </b-container>
80 </template>
81 </b-table>
82 </page-section>
83</template>
84
85<script>
86import PageSection from '@/components/Global/PageSection';
87import IconChevron from '@carbon/icons-vue/es/chevron--down/20';
88import StatusIcon from '@/components/Global/StatusIcon';
89
90import TableSortMixin from '@/components/Mixins/TableSortMixin';
91import TableDataFormatterMixin from '@/components/Mixins/TableDataFormatterMixin';
92import Search from '@/components/Global/Search';
93
94export default {
95 components: { PageSection, IconChevron, StatusIcon, Search },
96 mixins: [TableDataFormatterMixin, TableSortMixin],
97 data() {
98 return {
99 fields: [
100 {
101 key: 'expandRow',
102 label: '',
103 tdClass: 'table-row-expand',
104 sortable: false
105 },
106 {
107 key: 'id',
108 label: this.$t('pageHardwareStatus.table.id'),
109 formatter: this.tableFormatter,
110 sortable: true
111 },
112 {
113 key: 'health',
114 label: this.$t('pageHardwareStatus.table.health'),
115 formatter: this.tableFormatter,
116 sortable: true
117 },
118 {
119 key: 'partNumber',
120 label: this.$t('pageHardwareStatus.table.partNumber'),
121 formatter: this.tableFormatter,
122 sortable: true
123 },
124 {
125 key: 'serialNumber',
126 label: this.$t('pageHardwareStatus.table.serialNumber'),
127 formatter: this.tableFormatter,
128 sortable: true
129 }
130 ],
131 searchFilter: null
132 };
133 },
134 computed: {
135 processors() {
136 return this.$store.getters['processors/processors'];
137 }
138 },
139 created() {
140 this.$store.dispatch('processors/getProcessorsInfo').finally(() => {
141 // Emit initial data fetch complete to parent component
142 this.$root.$emit('hardwareStatus::processors::complete');
143 });
144 },
145 methods: {
146 onChangeSearchInput(searchValue) {
147 this.searchFilter = searchValue;
148 }
149 }
150};
151</script>