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
|
<template>
<page-section :section-title="$t('pageTransfer.snmp.snmpTitle')">
<b-row>
<b-col>
<div class="text-right">
<b-button
variant="primary"
:disabled="isNotAdmin"
@click="initSnmpModal()"
>
<icon-add />
{{ $t('global.action.add') }}
</b-button>
</div>
<b-table
responsive="md"
hover
:fields="snmpTableFields"
:items="form.snmpTableItems"
:empty-text="$t('global.table.emptyMessage')"
show-empty
>
<template #cell(actions)="{ item, index }">
<table-row-action
v-for="(action, actionIndex) in item.actions"
:key="actionIndex"
:value="action.value"
:title="action.title"
:enabled="action.enabled"
@click-table-action="onSnmpTableAction(action, $event, index)"
>
<template #icon>
<icon-edit v-if="action.value === 'edit'" />
<icon-trashcan v-if="action.value === 'delete'" />
</template>
</table-row-action>
</template>
</b-table>
</b-col>
</b-row>
</page-section>
</template>
<script>
import PageSection from '@/components/_sila/Global/PageSection';
import BVToastMixin from '@/components/_sila/Mixins/BVToastMixin';
import IconAdd from '@carbon/icons-vue/es/add--alt/20';
import IconEdit from '@carbon/icons-vue/es/edit/20';
import IconTrashcan from '@carbon/icons-vue/es/trash-can/20';
import TableRowAction from '@/components/_sila/Global/TableRowAction';
export default {
name: 'Snmp',
components: {
IconAdd,
IconEdit,
IconTrashcan,
PageSection,
TableRowAction,
},
mixins: [BVToastMixin],
data() {
return {
form: {
snmpTableItems: [],
},
actions: [
{
value: 'edit',
title: this.$t('global.action.edit'),
},
{
value: 'delete',
title: this.$t('global.action.delete'),
},
],
snmpTableFields: [
{
key: 'host',
label: this.$t('pageTransfer.snmp.host'),
},
{
key: 'port',
label: this.$t('pageTransfer.snmp.port'),
},
{ key: 'actions', label: '', tdClass: 'text-right' },
],
};
},
computed: {
isNotAdmin() {
return (
this.$store.getters['authentication/role'] === 'ReadOnly' ||
this.$store.getters['authentication/role'] === 'Operator'
);
},
},
created() {
this.getSnmpItems();
},
methods: {
getSnmpItems() {},
initSnmpModal() {},
onSnmpTableAction() {},
},
};
</script>
|