1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
|
<template>
<b-container fluid="xl">
<page-title />
<page-section :section-title="$t('pagePci.title')">
<b-table
responsive="md"
show-empty
hover
:items="items"
:fields="fields"
:empty-text="$t('global.table.emptyMessage')"
:busy="isBusy"
>
<template #cell(expandRow)="row">
<b-button
v-if="items[row.index].DeviceType !== 'SingleFunction'"
variant="link"
:title="expandRowLabel"
class="btn-icon-only"
@click="toggleRowDetails(row)"
>
<icon-chevron />
<span class="sr-only">{{ expandRowLabel }}</span>
</b-button>
</template>
<template #cell(health)>
<status-icon :status="statusIcon('OK')" />
{{ $t('pagePci.table.health_d') }}
</template>
<template #row-details="data">
<b-container fluid>
<b-row v-for="item in data.item.Functions" :key="item.deviceId">
<b-col xs="6">
<dl>
<dt>{{ $t('pagePci.table.name') }}:</dt>
<dd>{{ dataFormatter(item.DeviceName) }}</dd>
</dl>
</b-col>
<b-col xs="6">
<dl>
<dt>{{ $t('pagePci.table.type') }}:</dt>
<dd>{{ dataFormatter(item.deviceClass) }}</dd>
</dl>
</b-col>
</b-row>
</b-container>
</template>
</b-table>
</page-section>
</b-container>
</template>
<script>
import PageTitle from '@/components/_sila/Global/PageTitle';
import PageSection from '@/components/_sila/Global/PageSection';
import IconChevron from '@carbon/icons-vue/es/chevron--down/20';
import StatusIcon from '@/components/_sila/Global/StatusIcon';
import DataFormatterMixin from '@/components/_sila/Mixins/DataFormatterMixin';
import LoadingBarMixin from '@/components/_sila/Mixins/LoadingBarMixin';
import TableRowExpandMixin, {
expandRowLabel,
} from '@/components/_ibs/Mixins/TableRowExpandMixin';
export default {
components: { PageTitle, PageSection, StatusIcon, IconChevron },
mixins: [DataFormatterMixin, LoadingBarMixin, TableRowExpandMixin],
data() {
return {
isBusy: true,
fields: [
{
key: 'expandRow',
label: '',
tdClass: 'table-row-expand',
sortable: false,
},
{
key: 'DeviceName',
label: this.$t('pagePci.table.name'),
formatter: this.dataFormatter,
},
{
key: 'health',
label: this.$t('pagePci.table.health'),
formatter: this.dataFormatter,
tdClass: 'text-nowrap',
},
{
key: 'deviceClass',
label: this.$t('pagePci.table.type'),
formatter: this.dataFormatter,
},
{
key: 'manufacturer',
label: this.$t('pagePci.table.manufacturer'),
formatter: this.dataFormatter,
},
],
expandRowLabel: expandRowLabel,
};
},
computed: {
items() {
return this.$store.getters['pci/pciDevices'];
},
},
created() {
this.startLoader();
return this.$store
.dispatch('pci/getDevices')
.then(() => {
return this.$store.dispatch('pci/getDevicesMembers');
})
.then(() => {
this.$store.dispatch('pci/getFunctionDevices');
})
.finally(() => {
this.endLoader();
this.isBusy = false;
});
},
};
</script>
|