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