bfg-common 1.4.706 → 1.4.708
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/assets/localization/local_be.json +1 -0
- package/assets/localization/local_en.json +1 -0
- package/assets/localization/local_hy.json +1 -0
- package/assets/localization/local_kk.json +1 -0
- package/assets/localization/local_ru.json +1 -0
- package/assets/localization/local_zh.json +1 -0
- package/components/atoms/autocomplete/Autocomplete.vue +1 -0
- package/components/atoms/table/dataGrid/DataGridPage.vue +2 -1
- package/components/common/context/recursion/RecursionNew.vue +210 -199
- package/components/common/pages/{Tasks.vue → tasks/Tasks.vue} +35 -60
- package/components/common/pages/tasks/table/Table.vue +258 -0
- package/components/common/pages/tasks/table/errorInfo/ErrorInfo.vue +90 -0
- package/components/common/pages/tasks/table/expandDetails/ExpandDetails.vue +168 -0
- package/components/common/pages/tasks/table/lib/config/config.ts +268 -0
- package/components/common/pages/tasks/table/lib/models/enums.ts +13 -0
- package/lib/models/store/tasks/interfaces.ts +9 -5
- package/lib/models/table/interfaces.ts +18 -0
- package/lib/models/types.ts +10 -0
- package/package.json +1 -1
- package/store/tasks/mappers/tasks.ts +2 -0
|
@@ -0,0 +1,268 @@
|
|
|
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_TaskItem } from '~/lib/models/store/tasks/interfaces'
|
|
9
|
+
import { UI_E_RecentTaskStatus } from '~/lib/models/store/tasks/enums'
|
|
10
|
+
import {
|
|
11
|
+
UI_E_RTaskChipColor,
|
|
12
|
+
UI_E_RTaskStatusIcon,
|
|
13
|
+
} from '~/components/common/pages/tasks/table/lib/models/enums'
|
|
14
|
+
import type { UI_T_Project } from '~/lib/models/types'
|
|
15
|
+
import type { UI_T_ProcuratorTypeNodes } from '~/lib/models/types'
|
|
16
|
+
import * as taskConfig from '~/components/templates/tasks/lib/config/taskConfig' // url из ( sphere, procurator )
|
|
17
|
+
|
|
18
|
+
export const getHeaderDataFunc = (
|
|
19
|
+
localization: UI_I_Localization
|
|
20
|
+
): UI_I_DataTableHeader[] => [
|
|
21
|
+
{
|
|
22
|
+
col: 'col0',
|
|
23
|
+
colName: 'task_name',
|
|
24
|
+
text: localization.tasks.taskName,
|
|
25
|
+
isSortable: true,
|
|
26
|
+
sort: 'asc',
|
|
27
|
+
sortColumn: true,
|
|
28
|
+
width: '180px',
|
|
29
|
+
show: true,
|
|
30
|
+
filter: true,
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
col: 'col1',
|
|
34
|
+
colName: 'target',
|
|
35
|
+
text: localization.common.target,
|
|
36
|
+
isSortable: true,
|
|
37
|
+
sort: 'asc',
|
|
38
|
+
width: '180px',
|
|
39
|
+
show: true,
|
|
40
|
+
filter: true,
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
col: 'col2',
|
|
44
|
+
colName: 'status',
|
|
45
|
+
text: localization.common.status,
|
|
46
|
+
isSortable: true,
|
|
47
|
+
sort: 'asc',
|
|
48
|
+
width: '180px',
|
|
49
|
+
show: true,
|
|
50
|
+
filter: true,
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
col: 'col3',
|
|
54
|
+
colName: 'details',
|
|
55
|
+
text: localization.common.details,
|
|
56
|
+
isSortable: true,
|
|
57
|
+
sort: 'asc',
|
|
58
|
+
width: '180px',
|
|
59
|
+
show: true,
|
|
60
|
+
filter: true,
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
col: 'col4',
|
|
64
|
+
colName: 'initiator',
|
|
65
|
+
text: localization.common.initiator,
|
|
66
|
+
isSortable: true,
|
|
67
|
+
sort: 'asc',
|
|
68
|
+
width: '180px',
|
|
69
|
+
show: true,
|
|
70
|
+
filter: true,
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
col: 'col5',
|
|
74
|
+
colName: 'queued_for',
|
|
75
|
+
text: localization.common.queuedFor,
|
|
76
|
+
isSortable: true,
|
|
77
|
+
sort: 'asc',
|
|
78
|
+
width: '180px',
|
|
79
|
+
show: true,
|
|
80
|
+
filter: true,
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
col: 'col6',
|
|
84
|
+
colName: 'start_time',
|
|
85
|
+
text: localization.common.startTime,
|
|
86
|
+
isSortable: true,
|
|
87
|
+
sort: 'asc',
|
|
88
|
+
width: '180px',
|
|
89
|
+
show: true,
|
|
90
|
+
filter: true,
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
col: 'col7',
|
|
94
|
+
colName: 'completion_time',
|
|
95
|
+
text: localization.common.completionTime,
|
|
96
|
+
isSortable: true,
|
|
97
|
+
sort: 'asc',
|
|
98
|
+
width: '180px',
|
|
99
|
+
show: true,
|
|
100
|
+
filter: true,
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
col: 'col8',
|
|
104
|
+
colName: 'execution_time',
|
|
105
|
+
text: localization.common.executionTime,
|
|
106
|
+
isSortable: true,
|
|
107
|
+
sort: 'asc',
|
|
108
|
+
width: '180px',
|
|
109
|
+
show: true,
|
|
110
|
+
filter: true,
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
col: 'col9',
|
|
114
|
+
colName: 'server',
|
|
115
|
+
text: localization.common.server,
|
|
116
|
+
isSortable: true,
|
|
117
|
+
sort: 'asc',
|
|
118
|
+
width: '180px',
|
|
119
|
+
show: true,
|
|
120
|
+
filter: true,
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
col: 'col10',
|
|
124
|
+
colName: 'zone',
|
|
125
|
+
text: localization.common.zone,
|
|
126
|
+
isSortable: true,
|
|
127
|
+
sort: 'asc',
|
|
128
|
+
width: '180px',
|
|
129
|
+
show: true,
|
|
130
|
+
filter: true,
|
|
131
|
+
},
|
|
132
|
+
]
|
|
133
|
+
|
|
134
|
+
export const getTargetActionsFunc = (
|
|
135
|
+
localization: UI_I_Localization,
|
|
136
|
+
project: UI_T_Project
|
|
137
|
+
): UI_I_Dropdown[] => {
|
|
138
|
+
const actions: UI_I_Dropdown[] = [
|
|
139
|
+
{
|
|
140
|
+
value: 'view-target',
|
|
141
|
+
text: localization.common.viewTarget,
|
|
142
|
+
iconName: 'hide',
|
|
143
|
+
selected: false,
|
|
144
|
+
},
|
|
145
|
+
]
|
|
146
|
+
|
|
147
|
+
if (project === 'sphere') {
|
|
148
|
+
actions.push({
|
|
149
|
+
value: 'view-zone',
|
|
150
|
+
text: localization.common.viewZone,
|
|
151
|
+
iconName: 'hide',
|
|
152
|
+
selected: false,
|
|
153
|
+
})
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
return actions
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
export const options: UI_I_DataTableOptions = {
|
|
160
|
+
perPageOptions: [
|
|
161
|
+
{ text: '10', value: 10 },
|
|
162
|
+
{ text: '50', value: 50 },
|
|
163
|
+
{ text: '100', value: 100, default: true },
|
|
164
|
+
],
|
|
165
|
+
isSelectable: true,
|
|
166
|
+
isFocusable: false,
|
|
167
|
+
showPagination: true,
|
|
168
|
+
showPaginationOnTop: true,
|
|
169
|
+
showPageInfo: true,
|
|
170
|
+
isSortable: true,
|
|
171
|
+
server: true,
|
|
172
|
+
isResizable: true,
|
|
173
|
+
showSearch: false,
|
|
174
|
+
showSelectedRows: true,
|
|
175
|
+
showColumnManager: true,
|
|
176
|
+
withActions: true,
|
|
177
|
+
inBlock: true,
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
export const getBodyDataFunc = (
|
|
181
|
+
bodyData: UI_I_TaskItem<UI_T_ProcuratorTypeNodes>[],
|
|
182
|
+
localization: UI_I_Localization
|
|
183
|
+
): UI_I_DataTableBody[] => {
|
|
184
|
+
const { $formattedDatetime } = useNuxtApp() as any
|
|
185
|
+
|
|
186
|
+
return bodyData.map((task, index: number) => {
|
|
187
|
+
const iconClassName = taskConfig.iconFunc(task.targetType)
|
|
188
|
+
const id = taskConfig.idFunc(task)
|
|
189
|
+
const nav = taskConfig.navFunc(task.targetType)
|
|
190
|
+
const type = taskConfig.typeFunc(task.targetType)
|
|
191
|
+
|
|
192
|
+
const targetData = {
|
|
193
|
+
id,
|
|
194
|
+
nav,
|
|
195
|
+
type,
|
|
196
|
+
icon: iconClassName,
|
|
197
|
+
isLink: !!iconClassName,
|
|
198
|
+
testId: `${task.targetType}-item`,
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
const statusData = {
|
|
202
|
+
icon: UI_E_RTaskStatusIcon[task.status],
|
|
203
|
+
chipColor: UI_E_RTaskChipColor[task.status],
|
|
204
|
+
error: task.error,
|
|
205
|
+
testId: `${task.taskName}-progress`,
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
const zoneNodeParams = taskConfig.zoneNodeFunc(task, nav)
|
|
209
|
+
const zoneData = {
|
|
210
|
+
...zoneNodeParams,
|
|
211
|
+
nav,
|
|
212
|
+
icon: 'vsphere-icon-vcenter',
|
|
213
|
+
type: 'zone',
|
|
214
|
+
testId: `${task.targetType}-zone`,
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
const formattedStartTime =
|
|
218
|
+
task.startTime === '--'
|
|
219
|
+
? '--'
|
|
220
|
+
: $formattedDatetime(+task.startTime * 1000, '', true)
|
|
221
|
+
|
|
222
|
+
const formattedCompletionTime =
|
|
223
|
+
task.completion === '--'
|
|
224
|
+
? '--'
|
|
225
|
+
: $formattedDatetime(+task.completion * 1000, '', true)
|
|
226
|
+
|
|
227
|
+
return {
|
|
228
|
+
row: index,
|
|
229
|
+
collapse: true,
|
|
230
|
+
isHiddenCollapse: false,
|
|
231
|
+
collapseToggle: false,
|
|
232
|
+
data: [
|
|
233
|
+
{ col: 'col0', text: task.taskName },
|
|
234
|
+
{
|
|
235
|
+
key: 'icon',
|
|
236
|
+
col: 'col1',
|
|
237
|
+
text: task.target,
|
|
238
|
+
data: targetData,
|
|
239
|
+
},
|
|
240
|
+
{
|
|
241
|
+
key: 'status',
|
|
242
|
+
col: 'col2',
|
|
243
|
+
text: localization.common[UI_E_RecentTaskStatus[task.status]],
|
|
244
|
+
data: statusData,
|
|
245
|
+
},
|
|
246
|
+
{ col: 'col3', text: task.details || '--' },
|
|
247
|
+
{ col: 'col4', text: task.initiator },
|
|
248
|
+
{ col: 'col5', text: `${task.queuedFor} ms` },
|
|
249
|
+
{ col: 'col6', text: formattedStartTime },
|
|
250
|
+
{ col: 'col7', text: formattedCompletionTime },
|
|
251
|
+
{ col: 'col8', text: `${task.execution} ms` },
|
|
252
|
+
{ col: 'col9', text: task.server },
|
|
253
|
+
{
|
|
254
|
+
key: 'icon',
|
|
255
|
+
col: 'col10',
|
|
256
|
+
text: task.zone,
|
|
257
|
+
data: zoneData,
|
|
258
|
+
},
|
|
259
|
+
{
|
|
260
|
+
key: 'default-actions',
|
|
261
|
+
col: 'default-actions',
|
|
262
|
+
text: '',
|
|
263
|
+
data: { id: index, target: targetData },
|
|
264
|
+
},
|
|
265
|
+
],
|
|
266
|
+
}
|
|
267
|
+
})
|
|
268
|
+
}
|
|
@@ -14,10 +14,12 @@ export interface UI_I_RTaskQuery {
|
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
export interface API_UI_I_RTaskExtra {
|
|
17
|
-
created_objects:
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
created_objects:
|
|
18
|
+
| {
|
|
19
|
+
created_id: string
|
|
20
|
+
created_name: string
|
|
21
|
+
}[]
|
|
22
|
+
| {}
|
|
21
23
|
}
|
|
22
24
|
export interface API_UI_I_RTaskGroupExtra {
|
|
23
25
|
task_group_extra: {
|
|
@@ -97,7 +99,7 @@ export interface API_UI_I_TaskItem<T, E = any> {
|
|
|
97
99
|
args?: string // base64
|
|
98
100
|
}
|
|
99
101
|
|
|
100
|
-
export interface UI_I_TaskItem<T> {
|
|
102
|
+
export interface UI_I_TaskItem<T, E = any> {
|
|
101
103
|
relatedEvents: any
|
|
102
104
|
completion: number | string
|
|
103
105
|
queuedFor: number
|
|
@@ -115,6 +117,8 @@ export interface UI_I_TaskItem<T> {
|
|
|
115
117
|
taskName: string
|
|
116
118
|
id: string
|
|
117
119
|
zone: string
|
|
120
|
+
extra: E
|
|
121
|
+
args: string // base64
|
|
118
122
|
}
|
|
119
123
|
|
|
120
124
|
export interface API_UI_I_Task<T>
|
|
@@ -1,4 +1,22 @@
|
|
|
1
1
|
import type { UI_T_Schema } from '~/lib/models/table/types'
|
|
2
|
+
import type { UI_T_NavNodes, UI_T_Project } from '~/lib/models/types'
|
|
3
|
+
import type {
|
|
4
|
+
UI_T_ProcuratorTypeNodes,
|
|
5
|
+
UI_T_SphereTypeNodes,
|
|
6
|
+
} from '~/lib/models/types'
|
|
7
|
+
|
|
8
|
+
export interface UI_I_TableTarget<T extends UI_T_Project> {
|
|
9
|
+
id: string
|
|
10
|
+
nav: UI_T_NavNodes
|
|
11
|
+
type: T extends 'sphere'
|
|
12
|
+
? UI_T_SphereTypeNodes
|
|
13
|
+
: T extends 'procurator'
|
|
14
|
+
? UI_T_ProcuratorTypeNodes
|
|
15
|
+
: never
|
|
16
|
+
icon: string
|
|
17
|
+
isLink: boolean
|
|
18
|
+
testId: string
|
|
19
|
+
}
|
|
2
20
|
|
|
3
21
|
export interface API_UI_I_DataTable<T> {
|
|
4
22
|
total_items: number
|
package/lib/models/types.ts
CHANGED
|
@@ -43,3 +43,13 @@ export type UI_T_LanguageKey =
|
|
|
43
43
|
| 'inventory'
|
|
44
44
|
| 'inventoryMonitor'
|
|
45
45
|
| 'inventoryTabs'
|
|
46
|
+
|
|
47
|
+
export type UI_T_ProcuratorTypeNodes =
|
|
48
|
+
| 'host'
|
|
49
|
+
| 'vm'
|
|
50
|
+
| 'datastore'
|
|
51
|
+
| 'network'
|
|
52
|
+
| 'folder'
|
|
53
|
+
| 'file'
|
|
54
|
+
|
|
55
|
+
export type UI_T_SphereTypeNodes = UI_T_ProcuratorTypeNodes // TODO добавить осталиные типи те что исползуется в сфере
|
package/package.json
CHANGED
|
@@ -17,6 +17,8 @@ export const tasksConstructor = (
|
|
|
17
17
|
return {
|
|
18
18
|
// relatedEvents: task?.RelatedEvents || '',
|
|
19
19
|
relatedEvents: '',
|
|
20
|
+
args: task?.args || '',
|
|
21
|
+
extra: task?.extra || '',
|
|
20
22
|
completion: task.completion || '--',
|
|
21
23
|
queuedFor: task.start_time - task.creation_time,
|
|
22
24
|
execution: Math.abs(task.start_time - task.completion),
|