bfg-common 1.5.388 → 1.5.390

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.
@@ -1,337 +1,337 @@
1
- import type {
2
- UI_I_DataTable,
3
- UI_I_DataTableOptions,
4
- UI_I_DataTableBody,
5
- } from '~/node_modules/bfg-uikit/components/ui/dataTable/models/interfaces'
6
- import type { UI_I_Localization } from '~/lib/models/interfaces'
7
- import type { UI_I_DatastoreTableItem } from '~/lib/models/store/storage/interfaces'
8
- import type { UI_I_StatusData } from '~/components/common/vm/actions/common/select/storage/new/lib/models/interfaces'
9
- import { datastoreLocalizationByState } from '~/components/common/lib/config/states'
10
- import { getStatus } from '~/components/common/vm/actions/common/select/storage/new/lib/utils/utils'
11
-
12
- export const tableDataFunc = (
13
- localization: UI_I_Localization
14
- ): UI_I_DataTable => ({
15
- id: 'select-storage',
16
- header: [
17
- {
18
- col: 0,
19
- colName: localization.common.name,
20
- text: localization.common.name,
21
- isSortable: true,
22
- sort: 'asc',
23
- sortColumn: true,
24
- width: '150px',
25
- show: true,
26
- filter: true,
27
- },
28
- {
29
- col: 1,
30
- colName: localization.inventorySummary.state,
31
- text: localization.inventorySummary.state,
32
- isSortable: false,
33
- sort: 'asc',
34
- sortColumn: true,
35
- width: '150px',
36
- show: true,
37
- filter: true,
38
- },
39
- {
40
- col: 2,
41
- colName: localization.common.capacity,
42
- text: localization.common.capacity,
43
- isSortable: false,
44
- sort: 'asc',
45
- sortColumn: true,
46
- width: '150px',
47
- show: true,
48
- filter: true,
49
- },
50
- {
51
- col: 3,
52
- colName: localization.common.provisioned,
53
- text: localization.common.provisioned,
54
- isSortable: false,
55
- sort: 'asc',
56
- sortColumn: true,
57
- width: '150px',
58
- show: true,
59
- filter: true,
60
- },
61
- {
62
- col: 4,
63
- colName: localization.common.free,
64
- text: localization.common.free,
65
- isSortable: false,
66
- sort: 'asc',
67
- sortColumn: true,
68
- width: '150px',
69
- show: true,
70
- filter: true,
71
- },
72
- {
73
- col: 5,
74
- colName: localization.common.used,
75
- text: localization.common.used,
76
- isSortable: false,
77
- sort: 'asc',
78
- sortColumn: true,
79
- width: '150px',
80
- show: true,
81
- filter: true,
82
- },
83
- {
84
- col: 6,
85
- colName: localization.common.type,
86
- text: localization.common.type,
87
- isSortable: false,
88
- sort: 'asc',
89
- sortColumn: true,
90
- width: '120px',
91
- show: true,
92
- filter: true,
93
- },
94
- {
95
- col: 7,
96
- colName: localization.common.thinProvisioning,
97
- text: localization.common.thinProvisioning,
98
- isSortable: false,
99
- sort: 'asc',
100
- sortColumn: true,
101
- width: '160px',
102
- show: true,
103
- filter: true,
104
- },
105
- {
106
- col: 8,
107
- colName: localization.common.access,
108
- text: localization.common.access,
109
- isSortable: false,
110
- sort: 'asc',
111
- sortColumn: true,
112
- width: '120px',
113
- show: true,
114
- filter: true,
115
- },
116
- {
117
- col: 9,
118
- colName: localization.common.hardwareAcceleration,
119
- text: localization.common.hardwareAcceleration,
120
- isSortable: false,
121
- sort: 'asc',
122
- sortColumn: true,
123
- width: '210px',
124
- show: true,
125
- filter: true,
126
- },
127
- {
128
- col: 10,
129
- colName: localization.common.driverType,
130
- text: localization.common.driverType,
131
- isSortable: false,
132
- sort: 'asc',
133
- sortColumn: true,
134
- width: '150px',
135
- show: true,
136
- filter: true,
137
- },
138
- {
139
- col: 11,
140
- colName: localization.common.device,
141
- text: localization.common.device,
142
- isSortable: false,
143
- sort: 'asc',
144
- sortColumn: true,
145
- width: '150px',
146
- show: true,
147
- filter: true,
148
- },
149
- {
150
- col: 12,
151
- colName: localization.common.storageIoControl,
152
- text: localization.common.storageIoControl,
153
- isSortable: false,
154
- sort: 'asc',
155
- sortColumn: true,
156
- width: '210px',
157
- show: true,
158
- filter: true,
159
- },
160
- // {
161
- // col: 13,
162
- // colName: 'default-actions',
163
- // text: '',
164
- // show: true,
165
- // },
166
- ],
167
-
168
- body: [],
169
- })
170
-
171
- export const tableBodyFunc = (
172
- data: UI_I_DatastoreTableItem[],
173
- localization: UI_I_Localization,
174
- selectedRow: any
175
- ): any => {
176
- const result: UI_I_DataTableBody[] = []
177
- const { $binary } = useNuxtApp()
178
-
179
- data.forEach((item, key) => {
180
- const stateData = {
181
- iconClassName: '',
182
- color: '',
183
- isState: true,
184
- text: localization.inventorySummary[
185
- datastoreLocalizationByState[item.state]
186
- ],
187
- }
188
-
189
- let thinProvisioningData: UI_I_StatusData | {} = {}
190
- let hardwareAccelerationData: UI_I_StatusData | {} = {}
191
- let storage_io_control: UI_I_StatusData | {} = {}
192
- switch (item.state) {
193
- case 0:
194
- stateData.iconClassName = 'icon-help'
195
- stateData.color = 'primary'
196
- break
197
- case 1:
198
- stateData.iconClassName = 'status-check'
199
- stateData.color = 'green'
200
- break
201
- case 2:
202
- stateData.iconClassName = 'warning-outline'
203
- stateData.color = 'yellow'
204
- break
205
- case 3:
206
- stateData.iconClassName = 'error-outline'
207
- stateData.color = 'red'
208
- break
209
- case 4:
210
- stateData.iconClassName = 'maintenance'
211
- stateData.color = 'yellow'
212
- break
213
- case 5:
214
- stateData.iconClassName = 'close'
215
- stateData.color = 'red'
216
- break
217
- case 6:
218
- stateData.iconClassName = 'close'
219
- stateData.color = 'red'
220
- break
221
- default:
222
- stateData.iconClassName = ''
223
- stateData.color = 'default'
224
- }
225
-
226
- hardwareAccelerationData =
227
- item.hardware_acceleration === 'Unknown'
228
- ? {
229
- iconClassName: 'icon-help',
230
- color: 'primary',
231
- isState: true,
232
- text: localization.common.unknown,
233
- }
234
- : {
235
- iconClassName: 'status-check',
236
- color: 'green',
237
- isState: true,
238
- text: localization.common.supported,
239
- }
240
-
241
- thinProvisioningData = getStatus(
242
- item.thin_provisioning,
243
- localization.common.yes,
244
- localization.common.no
245
- )
246
- storage_io_control = getStatus(
247
- item.storage_io_control,
248
- localization.common.yes,
249
- localization.common.no
250
- )
251
-
252
- result.push({
253
- row: key,
254
- collapse: false,
255
- isHiddenCollapse: false,
256
- collapseToggle: false,
257
- isSelected: key === selectedRow,
258
- data: [
259
- {
260
- key: 'name',
261
- col: 0,
262
- text: item.name,
263
- data: { id: item.id },
264
- },
265
- {
266
- key: 'state',
267
- col: 1,
268
- text: stateData.text,
269
- data: stateData,
270
- },
271
- { col: 2, text: $binary.round(item.capacity.capacity_mb) },
272
- {
273
- col: 3,
274
- text: $binary.round(item.capacity.provisioned_mb.toString()),
275
- },
276
- {
277
- col: 4,
278
- text: $binary.round(item.capacity.free_mb.toString()),
279
- },
280
- {
281
- col: 5,
282
- text: $binary.round(item.capacity.used_mb.toString()),
283
- },
284
- {
285
- col: 6,
286
- text: item.type_text,
287
- },
288
- {
289
- key: 'state',
290
- col: 7,
291
- text: item.thin_provisioning
292
- ? localization.common.yes
293
- : localization.common.no,
294
- data: thinProvisioningData,
295
- },
296
- {
297
- col: 8,
298
- text: item.access_mode,
299
- },
300
- {
301
- key: 'state',
302
- col: 9,
303
- text: item.hardware_acceleration,
304
- data: hardwareAccelerationData,
305
- },
306
- {
307
- col: 10,
308
- text: item.drive_type,
309
- },
310
- {
311
- col: 11,
312
- text: item.device,
313
- },
314
- {
315
- key: 'state',
316
- col: 12,
317
- text: item.storage_io_control,
318
- data: storage_io_control,
319
- },
320
- ],
321
- })
322
- })
323
- return result
324
- }
325
-
326
- export const tableOptions: UI_I_DataTableOptions = {
327
- isSelectable: true,
328
- selectType: 'radio',
329
- showPagination: false,
330
- showPageInfo: false,
331
- isSortable: true,
332
- server: false,
333
- isResizable: true,
334
- showColumnManager: true,
335
- inBlock: false,
336
- inModal: true,
337
- }
1
+ import type {
2
+ UI_I_DataTable,
3
+ UI_I_DataTableOptions,
4
+ UI_I_DataTableBody,
5
+ } from '~/node_modules/bfg-uikit/components/ui/dataTable/models/interfaces'
6
+ import type { UI_I_Localization } from '~/lib/models/interfaces'
7
+ import type { UI_I_DatastoreTableItem } from '~/lib/models/store/storage/interfaces'
8
+ import type { UI_I_StatusData } from '~/components/common/vm/actions/common/select/storage/new/lib/models/interfaces'
9
+ import { datastoreLocalizationByState } from '~/components/common/lib/config/states'
10
+ import { getStatus } from '~/components/common/vm/actions/common/select/storage/new/lib/utils/utils'
11
+
12
+ export const tableDataFunc = (
13
+ localization: UI_I_Localization
14
+ ): UI_I_DataTable => ({
15
+ id: 'select-storage',
16
+ header: [
17
+ {
18
+ col: 0,
19
+ colName: localization.common.name,
20
+ text: localization.common.name,
21
+ isSortable: true,
22
+ sort: 'asc',
23
+ sortColumn: true,
24
+ width: '150px',
25
+ show: true,
26
+ filter: true,
27
+ },
28
+ {
29
+ col: 1,
30
+ colName: localization.inventorySummary.state,
31
+ text: localization.inventorySummary.state,
32
+ isSortable: false,
33
+ sort: 'asc',
34
+ sortColumn: true,
35
+ width: '150px',
36
+ show: true,
37
+ filter: true,
38
+ },
39
+ {
40
+ col: 2,
41
+ colName: localization.common.capacity,
42
+ text: localization.common.capacity,
43
+ isSortable: false,
44
+ sort: 'asc',
45
+ sortColumn: true,
46
+ width: '150px',
47
+ show: true,
48
+ filter: true,
49
+ },
50
+ {
51
+ col: 3,
52
+ colName: localization.common.provisioned,
53
+ text: localization.common.provisioned,
54
+ isSortable: false,
55
+ sort: 'asc',
56
+ sortColumn: true,
57
+ width: '150px',
58
+ show: true,
59
+ filter: true,
60
+ },
61
+ {
62
+ col: 4,
63
+ colName: localization.common.free,
64
+ text: localization.common.free,
65
+ isSortable: false,
66
+ sort: 'asc',
67
+ sortColumn: true,
68
+ width: '150px',
69
+ show: true,
70
+ filter: true,
71
+ },
72
+ {
73
+ col: 5,
74
+ colName: localization.common.used,
75
+ text: localization.common.used,
76
+ isSortable: false,
77
+ sort: 'asc',
78
+ sortColumn: true,
79
+ width: '150px',
80
+ show: true,
81
+ filter: true,
82
+ },
83
+ {
84
+ col: 6,
85
+ colName: localization.common.type,
86
+ text: localization.common.type,
87
+ isSortable: false,
88
+ sort: 'asc',
89
+ sortColumn: true,
90
+ width: '120px',
91
+ show: true,
92
+ filter: true,
93
+ },
94
+ {
95
+ col: 7,
96
+ colName: localization.common.thinProvisioning,
97
+ text: localization.common.thinProvisioning,
98
+ isSortable: false,
99
+ sort: 'asc',
100
+ sortColumn: true,
101
+ width: '160px',
102
+ show: true,
103
+ filter: true,
104
+ },
105
+ {
106
+ col: 8,
107
+ colName: localization.common.access,
108
+ text: localization.common.access,
109
+ isSortable: false,
110
+ sort: 'asc',
111
+ sortColumn: true,
112
+ width: '120px',
113
+ show: true,
114
+ filter: true,
115
+ },
116
+ {
117
+ col: 9,
118
+ colName: localization.common.hardwareAcceleration,
119
+ text: localization.common.hardwareAcceleration,
120
+ isSortable: false,
121
+ sort: 'asc',
122
+ sortColumn: true,
123
+ width: '210px',
124
+ show: true,
125
+ filter: true,
126
+ },
127
+ {
128
+ col: 10,
129
+ colName: localization.common.driverType,
130
+ text: localization.common.driverType,
131
+ isSortable: false,
132
+ sort: 'asc',
133
+ sortColumn: true,
134
+ width: '150px',
135
+ show: true,
136
+ filter: true,
137
+ },
138
+ {
139
+ col: 11,
140
+ colName: localization.common.device,
141
+ text: localization.common.device,
142
+ isSortable: false,
143
+ sort: 'asc',
144
+ sortColumn: true,
145
+ width: '150px',
146
+ show: true,
147
+ filter: true,
148
+ },
149
+ {
150
+ col: 12,
151
+ colName: localization.common.storageIoControl,
152
+ text: localization.common.storageIoControl,
153
+ isSortable: false,
154
+ sort: 'asc',
155
+ sortColumn: true,
156
+ width: '210px',
157
+ show: true,
158
+ filter: true,
159
+ },
160
+ // {
161
+ // col: 13,
162
+ // colName: 'default-actions',
163
+ // text: '',
164
+ // show: true,
165
+ // },
166
+ ],
167
+
168
+ body: [],
169
+ })
170
+
171
+ export const tableBodyFunc = (
172
+ data: UI_I_DatastoreTableItem[],
173
+ localization: UI_I_Localization,
174
+ selectedRow: any
175
+ ): any => {
176
+ const result: UI_I_DataTableBody[] = []
177
+ const { $binary } = useNuxtApp()
178
+
179
+ data.forEach((item, key) => {
180
+ const stateData = {
181
+ iconClassName: '',
182
+ color: '',
183
+ isState: true,
184
+ text: localization.inventorySummary[
185
+ datastoreLocalizationByState[item.state]
186
+ ],
187
+ }
188
+
189
+ let thinProvisioningData: UI_I_StatusData | {} = {}
190
+ let hardwareAccelerationData: UI_I_StatusData | {} = {}
191
+ let storage_io_control: UI_I_StatusData | {} = {}
192
+ switch (item.state) {
193
+ case 0:
194
+ stateData.iconClassName = 'icon-help'
195
+ stateData.color = 'primary'
196
+ break
197
+ case 1:
198
+ stateData.iconClassName = 'status-check'
199
+ stateData.color = 'green'
200
+ break
201
+ case 2:
202
+ stateData.iconClassName = 'warning-outline'
203
+ stateData.color = 'yellow'
204
+ break
205
+ case 3:
206
+ stateData.iconClassName = 'error-outline'
207
+ stateData.color = 'red'
208
+ break
209
+ case 4:
210
+ stateData.iconClassName = 'maintenance'
211
+ stateData.color = 'yellow'
212
+ break
213
+ case 5:
214
+ stateData.iconClassName = 'close'
215
+ stateData.color = 'red'
216
+ break
217
+ case 6:
218
+ stateData.iconClassName = 'close'
219
+ stateData.color = 'red'
220
+ break
221
+ default:
222
+ stateData.iconClassName = ''
223
+ stateData.color = 'default'
224
+ }
225
+
226
+ hardwareAccelerationData =
227
+ item.hardware_acceleration === 'Unknown'
228
+ ? {
229
+ iconClassName: 'icon-help',
230
+ color: 'primary',
231
+ isState: true,
232
+ text: localization.common.unknown,
233
+ }
234
+ : {
235
+ iconClassName: 'status-check',
236
+ color: 'green',
237
+ isState: true,
238
+ text: localization.common.supported,
239
+ }
240
+
241
+ thinProvisioningData = getStatus(
242
+ item.thin_provisioning,
243
+ localization.common.yes,
244
+ localization.common.no
245
+ )
246
+ storage_io_control = getStatus(
247
+ item.storage_io_control,
248
+ localization.common.yes,
249
+ localization.common.no
250
+ )
251
+
252
+ result.push({
253
+ row: key,
254
+ collapse: false,
255
+ isHiddenCollapse: false,
256
+ collapseToggle: false,
257
+ isSelected: key === selectedRow,
258
+ data: [
259
+ {
260
+ key: 'name',
261
+ col: 0,
262
+ text: item.name,
263
+ data: { id: item.id },
264
+ },
265
+ {
266
+ key: 'state',
267
+ col: 1,
268
+ text: stateData.text,
269
+ data: stateData,
270
+ },
271
+ { col: 2, text: $binary.round(item.capacity.capacity_mb) },
272
+ {
273
+ col: 3,
274
+ text: $binary.round(item.capacity.provisioned_mb.toString()),
275
+ },
276
+ {
277
+ col: 4,
278
+ text: $binary.round(item.capacity.free_mb.toString()),
279
+ },
280
+ {
281
+ col: 5,
282
+ text: $binary.round(item.capacity.used_mb.toString()),
283
+ },
284
+ {
285
+ col: 6,
286
+ text: item.type_text,
287
+ },
288
+ {
289
+ key: 'state',
290
+ col: 7,
291
+ text: item.thin_provisioning
292
+ ? localization.common.yes
293
+ : localization.common.no,
294
+ data: thinProvisioningData,
295
+ },
296
+ {
297
+ col: 8,
298
+ text: item.access_mode,
299
+ },
300
+ {
301
+ key: 'state',
302
+ col: 9,
303
+ text: item.hardware_acceleration,
304
+ data: hardwareAccelerationData,
305
+ },
306
+ {
307
+ col: 10,
308
+ text: item.drive_type,
309
+ },
310
+ {
311
+ col: 11,
312
+ text: item.device,
313
+ },
314
+ {
315
+ key: 'state',
316
+ col: 12,
317
+ text: item.storage_io_control,
318
+ data: storage_io_control,
319
+ },
320
+ ],
321
+ })
322
+ })
323
+ return result
324
+ }
325
+
326
+ export const tableOptions: UI_I_DataTableOptions = {
327
+ isSelectable: true,
328
+ selectType: 'radio',
329
+ showPagination: false,
330
+ showPageInfo: false,
331
+ isSortable: true,
332
+ server: false,
333
+ isResizable: true,
334
+ showColumnManager: true,
335
+ inBlock: false,
336
+ inModal: true,
337
+ }