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