bfg-common 1.5.676 → 1.5.677
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/common/layout/bottomPanel/BottomPanel.vue +84 -0
- package/components/common/layout/bottomPanel/New.vue +243 -0
- package/components/common/layout/bottomPanel/Old.vue +160 -0
- package/components/common/layout/bottomPanel/alarms/Alarms.vue +76 -0
- package/components/common/layout/bottomPanel/alarms/lib/models/interfaces.ts +23 -0
- package/components/common/layout/bottomPanel/alarms/new/New.vue +212 -0
- package/components/common/layout/bottomPanel/alarms/new/lib/config/config.ts +193 -0
- package/components/common/layout/bottomPanel/alarms/new/lib/models/enums.ts +10 -0
- package/components/common/layout/bottomPanel/alarms/new/lib/models/interfaces.ts +12 -0
- package/components/common/layout/bottomPanel/alarms/old/Old.vue +191 -0
- package/components/common/layout/bottomPanel/alarms/old/lib/config/alarmTables.ts +89 -0
- package/components/common/layout/bottomPanel/alarms/old/lib/config/tableKeys.ts +11 -0
- package/components/common/layout/bottomPanel/alarms/old/lib/models/types.ts +8 -0
- package/components/common/layout/bottomPanel/lib/config/statusFilter.ts +19 -0
- package/components/common/layout/bottomPanel/lib/models/types.ts +1 -0
- package/components/common/layout/bottomPanel/recentTasks/RecentTasks.vue +49 -0
- package/components/common/layout/bottomPanel/recentTasks/lib/models/interfaces.ts +14 -0
- package/components/common/layout/bottomPanel/recentTasks/new/New.vue +428 -0
- package/components/common/layout/bottomPanel/recentTasks/new/lib/config/config.ts +259 -0
- package/components/common/layout/bottomPanel/recentTasks/old/Old.vue +277 -0
- package/components/common/layout/bottomPanel/recentTasks/old/lib/config/recentTaskTable.ts +240 -0
- package/components/common/layout/bottomPanel/recentTasks/old/lib/config/tableKeys.ts +15 -0
- package/components/common/layout/bottomPanel/recentTasks/old/lib/models/types.ts +14 -0
- package/components/common/pages/auth/TheFooter.vue +104 -104
- package/lib/models/enums.ts +65 -1
- package/package.json +1 -1
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<ui-data-table
|
|
3
|
+
:data="data"
|
|
4
|
+
:options="options"
|
|
5
|
+
:loading="props.loading"
|
|
6
|
+
test-id="bottom-alarms-table"
|
|
7
|
+
classes="alarms-table"
|
|
8
|
+
@sort="onSorting"
|
|
9
|
+
>
|
|
10
|
+
<template #icon="{ item }">
|
|
11
|
+
<span class="flex-align-center">
|
|
12
|
+
<span :class="['icon', item.data.icon]" />
|
|
13
|
+
|
|
14
|
+
<span
|
|
15
|
+
:data-id="`rtask-${item.data.testId}`"
|
|
16
|
+
:class="item.data.isLink && 'target-link'"
|
|
17
|
+
@click="onSelectNodeOfTree(item.data)"
|
|
18
|
+
>
|
|
19
|
+
{{ item.text }}
|
|
20
|
+
</span>
|
|
21
|
+
</span>
|
|
22
|
+
</template>
|
|
23
|
+
|
|
24
|
+
<template #status="{ item }">
|
|
25
|
+
<ui-chip :test-id="item.data.testId" :color="item.data.chipColor" rounded>
|
|
26
|
+
<ui-icon
|
|
27
|
+
:name="item.data.icon"
|
|
28
|
+
width="14px"
|
|
29
|
+
height="14px"
|
|
30
|
+
class="chip-icon"
|
|
31
|
+
></ui-icon>
|
|
32
|
+
{{ item.text }}
|
|
33
|
+
</ui-chip>
|
|
34
|
+
</template>
|
|
35
|
+
|
|
36
|
+
<template #default-actions="{ item }">
|
|
37
|
+
<div class="actions">
|
|
38
|
+
<ui-button
|
|
39
|
+
:test-id="`resent-task-item-${item.data.id}-action`"
|
|
40
|
+
variant="text"
|
|
41
|
+
is-without-height
|
|
42
|
+
is-without-sizes
|
|
43
|
+
@click.stop="onShowActions(item.data.id)"
|
|
44
|
+
>
|
|
45
|
+
<ui-icon
|
|
46
|
+
:class="['action-icon', { active: actionsIsShow[item.data.id] }]"
|
|
47
|
+
name="vertical-dotes"
|
|
48
|
+
width="24"
|
|
49
|
+
/>
|
|
50
|
+
</ui-button>
|
|
51
|
+
<ui-dropdown
|
|
52
|
+
:show="actionsIsShow[item.data.id]"
|
|
53
|
+
:test-id="`resent-task-item-action-${item.data.id}`"
|
|
54
|
+
:items="actions"
|
|
55
|
+
:elem-id="`resent-task-item-${item.data.id}-action`"
|
|
56
|
+
width="max-content"
|
|
57
|
+
@select="onSelectAction(item.data.target, $event, item.data.id)"
|
|
58
|
+
@hide="onHideActionsDropdown(item.data.id)"
|
|
59
|
+
@click.stop
|
|
60
|
+
>
|
|
61
|
+
<template #row="{ item: dropMenu }">
|
|
62
|
+
<ui-icon
|
|
63
|
+
v-if="dropMenu.iconName === 'hide'"
|
|
64
|
+
name="password-hide"
|
|
65
|
+
width="16"
|
|
66
|
+
height="16"
|
|
67
|
+
/>
|
|
68
|
+
<span class="action-text">
|
|
69
|
+
{{ dropMenu.text }}
|
|
70
|
+
</span>
|
|
71
|
+
</template>
|
|
72
|
+
</ui-dropdown>
|
|
73
|
+
</div>
|
|
74
|
+
</template>
|
|
75
|
+
</ui-data-table>
|
|
76
|
+
</template>
|
|
77
|
+
|
|
78
|
+
<script setup lang="ts">
|
|
79
|
+
import type { UI_I_Dropdown } from '~/node_modules/bfg-uikit/components/ui/dropdown/models/interfaces'
|
|
80
|
+
import type {
|
|
81
|
+
UI_I_DataTable,
|
|
82
|
+
UI_I_DataTableHeader,
|
|
83
|
+
UI_I_DataTableBody,
|
|
84
|
+
} from '~/node_modules/bfg-uikit/components/ui/dataTable/models/interfaces'
|
|
85
|
+
import type { UI_I_Localization } from '~/lib/models/interfaces'
|
|
86
|
+
import type { UI_I_Pagination } from '~/lib/models/table/interfaces'
|
|
87
|
+
import type { UI_I_DataTargetForTable } from '~/components/common/layout/bottomPanel/recentTasks/lib/models/interfaces'
|
|
88
|
+
import type { UI_I_AlarmItem } from '~/components/common/layout/bottomPanel/alarms/new/lib/models/interfaces'
|
|
89
|
+
import {
|
|
90
|
+
getAlarmRowQuickActionsFunc,
|
|
91
|
+
options,
|
|
92
|
+
getHeaderDataFunc,
|
|
93
|
+
getBodyDataFunc,
|
|
94
|
+
} from '~/components/common/layout/bottomPanel/alarms/new/lib/config/config'
|
|
95
|
+
|
|
96
|
+
const props = defineProps<{
|
|
97
|
+
dataTable: UI_I_AlarmItem[]
|
|
98
|
+
loading: boolean
|
|
99
|
+
pagination: UI_I_Pagination
|
|
100
|
+
}>()
|
|
101
|
+
const emits = defineEmits<{
|
|
102
|
+
(event: 'sort', value: string): void
|
|
103
|
+
}>()
|
|
104
|
+
|
|
105
|
+
const localization = computed<UI_I_Localization>(() => useLocal())
|
|
106
|
+
// const { $store }: any = useNuxtApp()
|
|
107
|
+
|
|
108
|
+
const actionsIsShow = ref<boolean[]>([])
|
|
109
|
+
|
|
110
|
+
const data = computed<UI_I_DataTable>(() => ({
|
|
111
|
+
id: 'bottom-alarms-table',
|
|
112
|
+
header: resentTaskHeadItems.value,
|
|
113
|
+
body: resentTaskBodyItems.value,
|
|
114
|
+
}))
|
|
115
|
+
|
|
116
|
+
const resentTaskHeadItems = computed<UI_I_DataTableHeader[]>(() =>
|
|
117
|
+
getHeaderDataFunc(localization.value)
|
|
118
|
+
)
|
|
119
|
+
|
|
120
|
+
const resentTaskBodyItems = ref<UI_I_DataTableBody[]>([])
|
|
121
|
+
watch(
|
|
122
|
+
() => props.dataTable,
|
|
123
|
+
(newValue) => {
|
|
124
|
+
if (!newValue?.length) return
|
|
125
|
+
|
|
126
|
+
resentTaskBodyItems.value = getBodyDataFunc(newValue)
|
|
127
|
+
},
|
|
128
|
+
{ deep: true, immediate: true }
|
|
129
|
+
)
|
|
130
|
+
const onSorting = (value: string): void => {
|
|
131
|
+
emits('sort', value)
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
const actions = computed<UI_I_Dropdown[]>(() =>
|
|
135
|
+
getAlarmRowQuickActionsFunc(localization.value)
|
|
136
|
+
)
|
|
137
|
+
const onShowActions = (id: number): void => {
|
|
138
|
+
actionsIsShow.value[id] = true
|
|
139
|
+
}
|
|
140
|
+
const onSelectAction = (
|
|
141
|
+
_data: UI_I_DataTargetForTable,
|
|
142
|
+
action: string,
|
|
143
|
+
actionId: number
|
|
144
|
+
): void => {
|
|
145
|
+
switch (action) {
|
|
146
|
+
case 'view-object':
|
|
147
|
+
// onSelectNodeOfTree(data)
|
|
148
|
+
break
|
|
149
|
+
case 'alarm-details':
|
|
150
|
+
break
|
|
151
|
+
case 'event-details':
|
|
152
|
+
break
|
|
153
|
+
}
|
|
154
|
+
onHideActionsDropdown(actionId)
|
|
155
|
+
}
|
|
156
|
+
const onHideActionsDropdown = (id: number): void => {
|
|
157
|
+
actionsIsShow.value[id] = false
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
// const onSelectNodeOfTree = (data: UI_I_DataTargetForTable): void => {
|
|
161
|
+
// const { type, id, nav } = data
|
|
162
|
+
//
|
|
163
|
+
// const node = {
|
|
164
|
+
// id,
|
|
165
|
+
// type,
|
|
166
|
+
// }
|
|
167
|
+
//
|
|
168
|
+
// const path = `/inventory/type=${type};nav=${nav};id=${id}/summary`
|
|
169
|
+
// navigateTo(path)
|
|
170
|
+
//
|
|
171
|
+
// $store.dispatch('inventory/A_SELECT_NODE', { node, type })
|
|
172
|
+
// }
|
|
173
|
+
</script>
|
|
174
|
+
|
|
175
|
+
<style scoped lang="scss">
|
|
176
|
+
.alarms-table {
|
|
177
|
+
height: inherit;
|
|
178
|
+
|
|
179
|
+
.target-link {
|
|
180
|
+
font-family: 'Inter', sans-serif;
|
|
181
|
+
font-size: 13px;
|
|
182
|
+
color: var(--bottom-pannel-rtask-link-text);
|
|
183
|
+
font-weight: 400;
|
|
184
|
+
line-height: 15.73px;
|
|
185
|
+
cursor: pointer;
|
|
186
|
+
&:hover {
|
|
187
|
+
color: var(--bottom-pannel-rtask-link-hover-text);
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
.chip-icon {
|
|
191
|
+
min-width: 14px;
|
|
192
|
+
margin-right: 4px;
|
|
193
|
+
}
|
|
194
|
+
.icon {
|
|
195
|
+
margin-right: 4px;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
.action-icon {
|
|
199
|
+
width: 16px;
|
|
200
|
+
height: 16px;
|
|
201
|
+
fill: var(--summary-dropdown-notification-item-action-color);
|
|
202
|
+
|
|
203
|
+
&.active {
|
|
204
|
+
fill: var(--summary-dropdown-notification-item-hover-action-color);
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
.action-text {
|
|
209
|
+
margin-left: 8px;
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
</style>
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
UI_I_DataTableBody,
|
|
3
|
+
UI_I_DataTableOptions,
|
|
4
|
+
UI_I_DataTableHeader,
|
|
5
|
+
} from '~/node_modules/bfg-uikit/components/ui/dataTable/models/interfaces'
|
|
6
|
+
import type { UI_I_Dropdown } from '~/node_modules/bfg-uikit/components/ui/dropdown/models/interfaces'
|
|
7
|
+
import type { UI_I_Localization } from '~/lib/models/interfaces'
|
|
8
|
+
import type { UI_I_AlarmItem } from '~/components/common/layout/bottomPanel/alarms/new/lib/models/interfaces'
|
|
9
|
+
import {
|
|
10
|
+
UI_E_RTaskChipColor,
|
|
11
|
+
UI_E_RTaskStatusIcon,
|
|
12
|
+
} from '~/components/common/pages/tasks/table/lib/models/enums'
|
|
13
|
+
import { UI_E_TaskTypeToCorrectType } from '~/components/common/layout/bottomPanel/alarms/new/lib/models/enums'
|
|
14
|
+
import { UI_E_NodeIconsByState } from '~/lib/models/enums'
|
|
15
|
+
|
|
16
|
+
export const getHeaderDataFunc = (
|
|
17
|
+
localization: UI_I_Localization
|
|
18
|
+
): UI_I_DataTableHeader[] => [
|
|
19
|
+
{
|
|
20
|
+
col: 0,
|
|
21
|
+
colName: 'object',
|
|
22
|
+
text: localization.common.object,
|
|
23
|
+
isSortable: true,
|
|
24
|
+
sort: 'asc',
|
|
25
|
+
sortColumn: true,
|
|
26
|
+
width: '180px',
|
|
27
|
+
show: true,
|
|
28
|
+
filter: true,
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
col: 1,
|
|
32
|
+
colName: 'status',
|
|
33
|
+
text: localization.common.status,
|
|
34
|
+
isSortable: true,
|
|
35
|
+
sort: 'asc',
|
|
36
|
+
width: '180px',
|
|
37
|
+
show: true,
|
|
38
|
+
filter: true,
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
col: 2,
|
|
42
|
+
colName: 'name',
|
|
43
|
+
text: localization.common.name,
|
|
44
|
+
isSortable: true,
|
|
45
|
+
sort: 'asc',
|
|
46
|
+
width: '180px',
|
|
47
|
+
show: true,
|
|
48
|
+
filter: true,
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
col: 3,
|
|
52
|
+
colName: 'triggered',
|
|
53
|
+
text: localization.layout.triggered,
|
|
54
|
+
isSortable: true,
|
|
55
|
+
sort: 'asc',
|
|
56
|
+
width: '180px',
|
|
57
|
+
show: true,
|
|
58
|
+
filter: true,
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
col: 4,
|
|
62
|
+
colName: 'acknowledged',
|
|
63
|
+
text: localization.layout.acknowledged,
|
|
64
|
+
isSortable: true,
|
|
65
|
+
sort: 'asc',
|
|
66
|
+
width: '180px',
|
|
67
|
+
show: true,
|
|
68
|
+
filter: true,
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
col: 5,
|
|
72
|
+
colName: 'acknowledgedBy',
|
|
73
|
+
text: localization.layout.acknowledgedBy,
|
|
74
|
+
isSortable: true,
|
|
75
|
+
sort: 'asc',
|
|
76
|
+
width: '180px',
|
|
77
|
+
show: true,
|
|
78
|
+
filter: true,
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
col: 6,
|
|
82
|
+
colName: 'triggeringEvent',
|
|
83
|
+
text: localization.layout.triggeringEvent,
|
|
84
|
+
isSortable: true,
|
|
85
|
+
sort: 'asc',
|
|
86
|
+
width: '180px',
|
|
87
|
+
show: true,
|
|
88
|
+
filter: true,
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
col: 7,
|
|
92
|
+
colName: 'default-actions',
|
|
93
|
+
text: '',
|
|
94
|
+
show: true,
|
|
95
|
+
},
|
|
96
|
+
]
|
|
97
|
+
export const getAlarmRowQuickActionsFunc = (
|
|
98
|
+
localization: UI_I_Localization
|
|
99
|
+
): UI_I_Dropdown[] => [
|
|
100
|
+
{
|
|
101
|
+
value: 'view-object',
|
|
102
|
+
text: localization.common.viewObject,
|
|
103
|
+
iconName: 'hide',
|
|
104
|
+
selected: false,
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
value: 'alarm-details',
|
|
108
|
+
text: localization.common.alarmDetails,
|
|
109
|
+
iconName: 'icon-policies-profiles',
|
|
110
|
+
selected: false,
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
value: 'event-details',
|
|
114
|
+
text: localization.common.eventDetails,
|
|
115
|
+
iconName: 'icon-policies-profiles',
|
|
116
|
+
selected: false,
|
|
117
|
+
},
|
|
118
|
+
]
|
|
119
|
+
|
|
120
|
+
export const options: UI_I_DataTableOptions = {
|
|
121
|
+
perPageOptions: [
|
|
122
|
+
{ text: '10', value: 10 },
|
|
123
|
+
{ text: '50', value: 50 },
|
|
124
|
+
{ text: '100', value: 100 },
|
|
125
|
+
],
|
|
126
|
+
isSelectable: false,
|
|
127
|
+
isFocusable: false,
|
|
128
|
+
showPagination: true,
|
|
129
|
+
showPageInfo: true,
|
|
130
|
+
isSortable: true,
|
|
131
|
+
server: false,
|
|
132
|
+
isResizable: true,
|
|
133
|
+
showSearch: false,
|
|
134
|
+
showColumnManager: true,
|
|
135
|
+
withActions: true,
|
|
136
|
+
inBlock: true,
|
|
137
|
+
inBlockOnlyLightMode: true,
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
export const getBodyDataFunc = (
|
|
141
|
+
bodyData: UI_I_AlarmItem[]
|
|
142
|
+
): UI_I_DataTableBody[] => {
|
|
143
|
+
return bodyData.map((alarm: UI_I_AlarmItem, index: number) => {
|
|
144
|
+
const correctType =
|
|
145
|
+
UI_E_TaskTypeToCorrectType[
|
|
146
|
+
alarm?.targetType as keyof typeof UI_E_TaskTypeToCorrectType
|
|
147
|
+
]
|
|
148
|
+
const iconClassName = UI_E_NodeIconsByState[`${correctType}_Normal`]
|
|
149
|
+
|
|
150
|
+
const objectData = {
|
|
151
|
+
id: alarm.id,
|
|
152
|
+
icon: iconClassName,
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
const statusData = {
|
|
156
|
+
icon: UI_E_RTaskStatusIcon[alarm.statusIcon],
|
|
157
|
+
chipColor: UI_E_RTaskChipColor[alarm.status],
|
|
158
|
+
testId: `${alarm.name}-progress`,
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
return {
|
|
162
|
+
row: index,
|
|
163
|
+
collapse: false,
|
|
164
|
+
isHiddenCollapse: false,
|
|
165
|
+
collapseToggle: false,
|
|
166
|
+
data: [
|
|
167
|
+
{
|
|
168
|
+
key: 'icon',
|
|
169
|
+
col: 0,
|
|
170
|
+
text: alarm.object,
|
|
171
|
+
data: objectData,
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
key: 'status',
|
|
175
|
+
col: 1,
|
|
176
|
+
text: alarm.status,
|
|
177
|
+
data: statusData,
|
|
178
|
+
},
|
|
179
|
+
{ key: 'icon', col: 2, text: alarm.name },
|
|
180
|
+
{ col: 3, text: alarm.triggered },
|
|
181
|
+
{ col: 4, text: alarm.acknowledged },
|
|
182
|
+
{ col: 5, text: alarm.acknowledged_by },
|
|
183
|
+
{ key: 'icon', col: 6, text: alarm.triggering_event },
|
|
184
|
+
{
|
|
185
|
+
key: 'default-actions',
|
|
186
|
+
col: 7,
|
|
187
|
+
text: '',
|
|
188
|
+
data: { id: index },
|
|
189
|
+
},
|
|
190
|
+
],
|
|
191
|
+
}
|
|
192
|
+
})
|
|
193
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface UI_API_I_AlarmItem {
|
|
2
|
+
id: number
|
|
3
|
+
object: string
|
|
4
|
+
status: string
|
|
5
|
+
name: string
|
|
6
|
+
triggered: string
|
|
7
|
+
acknowledged: string
|
|
8
|
+
acknowledged_by: string
|
|
9
|
+
triggering_event: string
|
|
10
|
+
statusIcon: string
|
|
11
|
+
}
|
|
12
|
+
export interface UI_I_AlarmItem extends UI_API_I_AlarmItem {}
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="data-table-view">
|
|
3
|
+
<atoms-table-data-grid
|
|
4
|
+
v-model:selected-row="selectedRow"
|
|
5
|
+
v-model:column-keys="columnKeys"
|
|
6
|
+
v-model:page-size="pagination.pageSize"
|
|
7
|
+
v-model:page="pagination.page"
|
|
8
|
+
:head-items="headItems"
|
|
9
|
+
:body-items="bodyItems"
|
|
10
|
+
:total-items="props.totalItems"
|
|
11
|
+
:total-pages="props.totalPages"
|
|
12
|
+
:items-per-page="itemsPerPage"
|
|
13
|
+
:loading="props.loading"
|
|
14
|
+
test-id="bottom-panel-table"
|
|
15
|
+
class="data-table"
|
|
16
|
+
row-attribute-id-name="data-recent-tasks-id"
|
|
17
|
+
hide-pagination
|
|
18
|
+
server-off
|
|
19
|
+
@sorting="onSorting"
|
|
20
|
+
>
|
|
21
|
+
<template #icon="{ item }">
|
|
22
|
+
<div v-if="item.data.isIconSvg" class="data-table-view__col-icon">
|
|
23
|
+
<atoms-the-icon :name="item.data.iconClassName" />
|
|
24
|
+
</div>
|
|
25
|
+
<span v-else :class="['datagrid-cell-icon', item.data.iconClassName]" />
|
|
26
|
+
<a
|
|
27
|
+
v-if="item.data.isLink"
|
|
28
|
+
:id="item.data.id"
|
|
29
|
+
:data-id="`rtask-${item.data.testId}`"
|
|
30
|
+
:title="item.text"
|
|
31
|
+
href="javascript:void(0)"
|
|
32
|
+
class="text-ellipsis"
|
|
33
|
+
@click="onSelectNodeOfTree(item.data)"
|
|
34
|
+
>{{ item.text }}</a
|
|
35
|
+
>
|
|
36
|
+
<span v-else :title="item.text" class="text-ellipsis">
|
|
37
|
+
{{ item.text }}
|
|
38
|
+
</span>
|
|
39
|
+
</template>
|
|
40
|
+
|
|
41
|
+
<template #action>
|
|
42
|
+
<div class="flex-space-between flex-align-center">
|
|
43
|
+
<div class="flex-align-center"></div>
|
|
44
|
+
</div>
|
|
45
|
+
</template>
|
|
46
|
+
</atoms-table-data-grid>
|
|
47
|
+
</div>
|
|
48
|
+
</template>
|
|
49
|
+
|
|
50
|
+
<script lang="ts" setup>
|
|
51
|
+
import type { UI_T_TimeValue } from '~/components/common/layout/theHeader/userMenu/modals/preferences/timeFormat/lib/models/types'
|
|
52
|
+
import type {
|
|
53
|
+
UI_I_ColumnKey,
|
|
54
|
+
UI_I_HeadItem,
|
|
55
|
+
UI_I_BodyItem,
|
|
56
|
+
} from '~/components/atoms/table/dataGrid/lib/models/interfaces'
|
|
57
|
+
import type { UI_I_Localization } from '~/lib/models/interfaces'
|
|
58
|
+
import type { UI_I_Pagination } from '~/lib/models/table/interfaces'
|
|
59
|
+
import type { UI_I_DataTargetForTable } from '~/components/common/layout/bottomPanel/recentTasks/lib/models/interfaces'
|
|
60
|
+
import type { UI_T_SelectedRow } from '~/components/atoms/table/dataGrid/lib/models/types'
|
|
61
|
+
import type { UI_I_RecentTaskItem } from '~/lib/models/store/tasks/interfaces'
|
|
62
|
+
import type { UI_T_LangValue } from '~/lib/models/types'
|
|
63
|
+
import type { UI_T_NodeType } from '~/components/common/pages/home/lib/models/types'
|
|
64
|
+
import { UI_E_TaskTypeToCorrectType } from '~/components/common/layout/bottomPanel/alarms/new/lib/models/enums'
|
|
65
|
+
import { itemsPerPage } from '~/components/atoms/table/dataGrid/lib/config/itemsPerPage'
|
|
66
|
+
import * as alarmTables from '~/components/common/layout/bottomPanel/alarms/old/lib/config/alarmTables'
|
|
67
|
+
|
|
68
|
+
const props = defineProps<{
|
|
69
|
+
dataTable: UI_I_RecentTaskItem<UI_T_NodeType>[]
|
|
70
|
+
totalItems: number
|
|
71
|
+
totalPages: number
|
|
72
|
+
pagination: UI_I_Pagination
|
|
73
|
+
loading: boolean
|
|
74
|
+
}>()
|
|
75
|
+
const emits = defineEmits<{
|
|
76
|
+
(event: 'pagination', value: UI_I_Pagination | null): void
|
|
77
|
+
(event: 'sort', value: string): void
|
|
78
|
+
}>()
|
|
79
|
+
|
|
80
|
+
const { $store }: any = useNuxtApp()
|
|
81
|
+
|
|
82
|
+
const localization = computed<UI_I_Localization>(() => useLocal())
|
|
83
|
+
|
|
84
|
+
const selectedRow = ref<UI_T_SelectedRow>([])
|
|
85
|
+
|
|
86
|
+
const onSorting = (event: [number, boolean]): void => {
|
|
87
|
+
const [column, status] = event
|
|
88
|
+
const direction = status ? 'desc' : 'asc'
|
|
89
|
+
|
|
90
|
+
const sort = `${column}.${direction}`
|
|
91
|
+
|
|
92
|
+
emits('sort', sort)
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
const pagination = ref<UI_I_Pagination | null>(null)
|
|
96
|
+
watch(
|
|
97
|
+
() => props.pagination,
|
|
98
|
+
(newValue) => {
|
|
99
|
+
pagination.value = newValue
|
|
100
|
+
},
|
|
101
|
+
{ immediate: true }
|
|
102
|
+
)
|
|
103
|
+
watch(
|
|
104
|
+
pagination,
|
|
105
|
+
(newValue) => {
|
|
106
|
+
emits('pagination', newValue)
|
|
107
|
+
},
|
|
108
|
+
{ deep: true, immediate: true }
|
|
109
|
+
)
|
|
110
|
+
|
|
111
|
+
const columnKeys = ref<UI_I_ColumnKey[]>(
|
|
112
|
+
alarmTables.columnKeys(localization.value)
|
|
113
|
+
)
|
|
114
|
+
const headItems = computed<UI_I_HeadItem[]>(() =>
|
|
115
|
+
alarmTables.headItems(localization.value)
|
|
116
|
+
)
|
|
117
|
+
const timeFormat = computed<UI_T_TimeValue>(
|
|
118
|
+
() => $store.getters['main/getTimeFormat']
|
|
119
|
+
)
|
|
120
|
+
|
|
121
|
+
const interfaceLang = computed<UI_T_LangValue>(
|
|
122
|
+
() => $store.getters['main/getInterfaceLang']
|
|
123
|
+
)
|
|
124
|
+
|
|
125
|
+
const bodyItems = ref<UI_I_BodyItem[][]>([])
|
|
126
|
+
watch(
|
|
127
|
+
[
|
|
128
|
+
(): UI_I_RecentTaskItem<UI_T_NodeType>[] => props.dataTable,
|
|
129
|
+
timeFormat,
|
|
130
|
+
interfaceLang,
|
|
131
|
+
],
|
|
132
|
+
([newValue1]) => {
|
|
133
|
+
if (!newValue1?.length) {
|
|
134
|
+
bodyItems.value = []
|
|
135
|
+
return
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
bodyItems.value = alarmTables.bodyItems(newValue1)
|
|
139
|
+
},
|
|
140
|
+
{ deep: true, immediate: true }
|
|
141
|
+
)
|
|
142
|
+
|
|
143
|
+
const onSelectNodeOfTree = (item: UI_I_DataTargetForTable): void => {
|
|
144
|
+
const id = item.id
|
|
145
|
+
const type = UI_E_TaskTypeToCorrectType[item.type]
|
|
146
|
+
let nav = item.nav
|
|
147
|
+
switch (type) {
|
|
148
|
+
case 'zone':
|
|
149
|
+
case 'datacenter':
|
|
150
|
+
case 'folder':
|
|
151
|
+
nav = useRoute().params.nav || nav
|
|
152
|
+
break
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
const params = `type=${type};nav=${nav};id=${id}`
|
|
156
|
+
const path = `/inventory/${params}`
|
|
157
|
+
|
|
158
|
+
// Переход в inventory
|
|
159
|
+
navigateTo({
|
|
160
|
+
path,
|
|
161
|
+
})
|
|
162
|
+
}
|
|
163
|
+
</script>
|
|
164
|
+
|
|
165
|
+
<style lang="scss" scoped>
|
|
166
|
+
.data-table-view {
|
|
167
|
+
height: inherit;
|
|
168
|
+
.data-table {
|
|
169
|
+
height: inherit;
|
|
170
|
+
:deep(.datagrid-outer-wrapper) {
|
|
171
|
+
height: inherit;
|
|
172
|
+
|
|
173
|
+
.datagrid-footer__action {
|
|
174
|
+
width: 100%;
|
|
175
|
+
|
|
176
|
+
.select {
|
|
177
|
+
margin-left: 10px;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
&__col-icon {
|
|
183
|
+
min-width: 16px;
|
|
184
|
+
height: 16px;
|
|
185
|
+
margin-right: 2px;
|
|
186
|
+
}
|
|
187
|
+
&__action {
|
|
188
|
+
padding-left: 0.3rem;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
</style>
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import type { UI_I_Localization } from '~/lib/models/interfaces'
|
|
2
|
+
import type {
|
|
3
|
+
UI_I_ColumnKey,
|
|
4
|
+
UI_I_HeadItem,
|
|
5
|
+
UI_I_BodyItem,
|
|
6
|
+
} from '~/components/atoms/table/dataGrid/lib/models/interfaces'
|
|
7
|
+
import type { UI_I_AlarmItem } from '~/components/common/layout/bottomPanel/alarms/new/lib/models/interfaces'
|
|
8
|
+
import {
|
|
9
|
+
constructColumnKey,
|
|
10
|
+
constructHeadItem,
|
|
11
|
+
} from '~/components/atoms/table/dataGrid/lib/utils/constructDataTable'
|
|
12
|
+
import { alarmsTableKeys } from '~/components/common/layout/bottomPanel/alarms/old/lib/config/tableKeys'
|
|
13
|
+
|
|
14
|
+
const getItems = (
|
|
15
|
+
localization: UI_I_Localization
|
|
16
|
+
): [string, boolean, string, string][] => {
|
|
17
|
+
return [
|
|
18
|
+
[localization.common.object, true, '96px', alarmsTableKeys[0]],
|
|
19
|
+
[localization.common.status, true, '180px', alarmsTableKeys[1]],
|
|
20
|
+
[localization.common.name, true, '250px', alarmsTableKeys[2]],
|
|
21
|
+
[localization.layout.triggered, true, '180px', alarmsTableKeys[3]],
|
|
22
|
+
[localization.layout.acknowledged, true, '180px', alarmsTableKeys[4]],
|
|
23
|
+
[localization.layout.acknowledgedBy, true, '180px', alarmsTableKeys[5]],
|
|
24
|
+
[localization.layout.triggeringEvent, true, '180px', alarmsTableKeys[6]],
|
|
25
|
+
]
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export const columnKeys = (
|
|
29
|
+
localization: UI_I_Localization
|
|
30
|
+
): UI_I_ColumnKey[] => {
|
|
31
|
+
const result: UI_I_ColumnKey[] = []
|
|
32
|
+
getItems(localization).forEach((item, i) => {
|
|
33
|
+
const col = i === 0 ? 'icon' : `col${i}`
|
|
34
|
+
result.push(constructColumnKey(col, item[0], item[1]))
|
|
35
|
+
})
|
|
36
|
+
return result
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export const headItems = (localization: UI_I_Localization): UI_I_HeadItem[] => {
|
|
40
|
+
const result: UI_I_HeadItem[] = []
|
|
41
|
+
getItems(localization).forEach((item, i) => {
|
|
42
|
+
const col = i === 0 ? 'icon' : `col${i}`
|
|
43
|
+
result.push(constructHeadItem(col, item[0], item[3], true, item[2]))
|
|
44
|
+
})
|
|
45
|
+
return result
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export const bodyItems = (data: UI_I_AlarmItem[]): UI_I_BodyItem[][] => {
|
|
49
|
+
const bodyItems: UI_I_BodyItem[][] = []
|
|
50
|
+
data.forEach((alarm: UI_I_AlarmItem, key) => {
|
|
51
|
+
const objectData = {
|
|
52
|
+
isLink: true,
|
|
53
|
+
}
|
|
54
|
+
const data = {
|
|
55
|
+
iconClassName: 'vsphere-icon-status-warning',
|
|
56
|
+
}
|
|
57
|
+
const nameData = {
|
|
58
|
+
isLink: true,
|
|
59
|
+
}
|
|
60
|
+
const triggeringData = {
|
|
61
|
+
isLink: true,
|
|
62
|
+
}
|
|
63
|
+
bodyItems.push([
|
|
64
|
+
{
|
|
65
|
+
key: 'icon',
|
|
66
|
+
text: alarm[alarmsTableKeys[0]],
|
|
67
|
+
data: objectData,
|
|
68
|
+
id: key,
|
|
69
|
+
},
|
|
70
|
+
{ key: 'col1', text: alarm[alarmsTableKeys[1]], data, id: key },
|
|
71
|
+
{
|
|
72
|
+
key: 'col2',
|
|
73
|
+
text: alarm[alarmsTableKeys[2]],
|
|
74
|
+
data: nameData,
|
|
75
|
+
id: key,
|
|
76
|
+
},
|
|
77
|
+
{ key: 'col3', text: alarm[alarmsTableKeys[3]], id: key },
|
|
78
|
+
{ key: 'col4', text: alarm[alarmsTableKeys[4]], id: key },
|
|
79
|
+
{ key: 'col5', text: alarm[alarmsTableKeys[5]], id: key },
|
|
80
|
+
{
|
|
81
|
+
key: 'col6',
|
|
82
|
+
text: alarm[alarmsTableKeys[6]],
|
|
83
|
+
data: triggeringData,
|
|
84
|
+
id: key,
|
|
85
|
+
},
|
|
86
|
+
])
|
|
87
|
+
})
|
|
88
|
+
return bodyItems
|
|
89
|
+
}
|