bfg-common 1.6.104 → 1.6.105

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,451 +1,466 @@
1
- <template>
2
- <div class="vmkernel-adapters-table">
3
- <ui-data-table
4
- :data="data"
5
- :options="options"
6
- :total-items="props.networkData.total_items"
7
- :total-pages="props.networkData.total_pages"
8
- :texts="texts"
9
- :skeleton="skeletonDataLocal"
10
- :actions="actions"
11
- :loading="props.isLoading"
12
- test-id="vmkernel-adapters-table"
13
- class="vmkernel-adapters-table"
14
- server-off
15
- @select-row="onSelectRow"
16
- @action="onSelectAction"
17
- >
18
- <template #insteadOfTitleActions>
19
- <div class="title-actions">
20
- <ui-button
21
- test-id="refresh-vmkernel-adapters-btn"
22
- class="refresh-btn"
23
- size="md"
24
- variant="outline"
25
- @click="emits('global-refresh')"
26
- >
27
- <template #icon> <ui-icon name="reset" width="24" /> </template>
28
- {{ localization.common.refresh }}
29
- </ui-button>
30
- <ui-button
31
- v-permission="
32
- 'Networks.CreateSysx Networks.CreatePortGroup Networks.UpdateSwitch Networks.CreateSwitch'
33
- "
34
- test-id="add-vmkernel-adapters-btn"
35
- class="add-btn"
36
- size="md"
37
- @click="emits('show-add-networking-modal')"
38
- >
39
- <template #icon> <ui-icon name="plus" width="24" /> </template>
40
- {{ localization.common.addNetworkingWithDots }}
41
- </ui-button>
42
- </div>
43
- </template>
44
-
45
- <template #icon="{ item }">
46
- <div class="cell">
47
- <div
48
- :class="[
49
- 'cell-icon',
50
- {
51
- 'cell-icon-device': item.col === 'col0',
52
- },
53
- ]"
54
- >
55
- <ui-icon
56
- v-if="item.col === 'col0'"
57
- :name="item.data.icon"
58
- width="18"
59
- height="18"
60
- />
61
- <div v-else :class="item.data.icon"></div>
62
- </div>
63
- <span class="cell-text">
64
- {{ item.text }}
65
- </span>
66
- </div>
67
- </template>
68
-
69
- <template #default-actions="{ item }">
70
- <span
71
- :id="`vmkernel-adapters-item-${item.data.id}-action`"
72
- v-permission="'Networks.UpdateSysx Networks.RemoveSysx'"
73
- :class="[
74
- 'action-button',
75
- {
76
- 'action-button-active': selectedActionId === item.data.id,
77
- },
78
- ]"
79
- @click.stop="onToggleActions(item.data.id)"
80
- >
81
- <ui-icon name="vertical-dotes" width="20" height="20" />
82
- </span>
83
- <Teleport to="body">
84
- <ui-dropdown
85
- v-permission="'Networks.UpdateSysx Networks.RemoveSysx'"
86
- :test-id="`data-table-vmkernel-adapters-dropdown-${item.data.id}`"
87
- :show="selectedActionId === item.data.id"
88
- :items="actionItems"
89
- :elem-id="`vmkernel-adapters-item-${item.data.id}-action`"
90
- width="max-content"
91
- @select="(action) => onSelectAction(action, true)"
92
- @hide="selectedActionId = -1"
93
- />
94
- </Teleport>
95
- </template>
96
-
97
- <template #skeleton-header>
98
- <div class="skeleton-header">
99
- <div class="left-skeleton">
100
- <ui-skeleton-item width="80" height="20" />
101
- </div>
102
- <div class="right-skeleton">
103
- <ui-skeleton-item width="112" height="36" border-radius="8" />
104
- <ui-skeleton-item width="160" height="36" border-radius="8" />
105
- </div>
106
- </div>
107
- </template>
108
- </ui-data-table>
109
- </div>
110
-
111
- <common-diagram-main-modals-remove-modal
112
- v-if="isShowPortRemoveModal"
113
- :id="vmKernelToAction?.sysx?.id || ''"
114
- :title="localization.common.removeVMkernelAdapter"
115
- :show="isShowPortRemoveModal"
116
- :is-show-loader="props.isRemoveModalLoading"
117
- modal-name="port-remove-modal"
118
- view-name="port-remove"
119
- :switch-name="vmKernelToAction.switchName"
120
- type="port"
121
- @remove="onRemove"
122
- @hide="onHideRemoveModal"
123
- />
124
- <common-diagram-main-modals-edit-settings-modal
125
- v-if="isShowPortEditSettingsModal"
126
- :show="isShowPortEditSettingsModal"
127
- :title="portEditInitialData.portName || ''"
128
- :initial-data="portEditInitialData"
129
- :items="portEditSettingsTabs"
130
- :is-dark-mode="props.isDarkMode"
131
- :is-edit-modal-loading="props.isEditModalLoading"
132
- view-name="port-edit"
133
- width="872px"
134
- height="558px"
135
- @send-edit-data="onSendEditData"
136
- @change-edit-fields-data="onChangeEditFieldsData"
137
- @hide="onHidePortEditSettingsModal"
138
- />
139
- </template>
140
-
141
- <script setup lang="ts">
142
- import type { UI_I_ButtonsGroup } from '~/node_modules/bfg-uikit/components/ui/button/group/lib/models/interfaces'
143
- import type { UI_I_Dropdown } from '~/node_modules/bfg-uikit/components/ui/dropdown/models/interfaces'
144
- import type {
145
- UI_I_DataTableBody,
146
- UI_I_DataTableHeader,
147
- UI_I_TableTexts,
148
- UI_I_DataTableSkeleton,
149
- UI_I_DataTable,
150
- } from '~/node_modules/bfg-uikit/components/ui/dataTable/models/interfaces'
151
- import type { UI_I_Localization } from '~/lib/models/interfaces'
152
- import type {
153
- UI_I_Network,
154
- UI_I_ModalsInitialData,
155
- UI_I_EditFieldsData,
156
- UI_I_ModalTab,
157
- } from '~/components/common/diagramMain/lib/models/interfaces'
158
- import type { I_VmKernelAdapter } from '~/components/common/configure/vmkernelAdapters/tableView/lib/models/interfaces'
159
- import { constructNetworkTableFunc } from '~/components/common/configure/vmkernelAdapters/tableView/mappers/mappers'
160
- import {
161
- portEditSettingsTabsFunc,
162
- portEditInitialDataFunc,
163
- } from '~/components/common/configure/vmkernelAdapters/tableView/lib/config/settings'
164
- import {
165
- getBodyDataFunc,
166
- getHeaderDataFunc,
167
- options,
168
- skeletonData,
169
- getActions,
170
- getHeaderActions,
171
- } from '~/components/common/configure/vmkernelAdapters/tableView/lib/config/vmKernelAdaptersTableConfigNew'
172
-
173
- const props = defineProps<{
174
- isLoading: boolean
175
- networkData: UI_I_Network[]
176
- isDarkMode: boolean
177
- isRemoveModalLoading: boolean
178
- isEditModalLoading: boolean
179
- }>()
180
-
181
- const emits = defineEmits<{
182
- (event: 'remove', id: string, type: string, hideModal: () => void): void
183
- (
184
- event: 'send-edit-data',
185
- type: string,
186
- data: UI_I_EditFieldsData,
187
- hideModal: () => void,
188
- name?: string
189
- ): void
190
- (event: 'global-refresh'): void
191
- (event: 'show-add-networking-modal'): void
192
- }>()
193
-
194
- const localization = computed<UI_I_Localization>(() => useLocal())
195
-
196
- const selectedRow = defineModel<number>()
197
-
198
- const onSelectRow = (value: UI_I_DataTableBody[]): void => {
199
- if (typeof value[0].row !== 'number') return
200
- selectedRow.value = value[0].row
201
- }
202
-
203
- const texts = computed<UI_I_TableTexts>(() => ({
204
- searchHere: localization.value.common.searchHere,
205
- rowsPerPage: localization.value.common.rowsPerPage,
206
- of: localization.value.common.of,
207
- selected: localization.value.common.selected,
208
- columns: localization.value.common.columns,
209
- previous: localization.value.common.previous,
210
- next: localization.value.common.next,
211
- noItemsFound: localization.value.common.noItemsFound,
212
- exportAll: localization.value.common.exportAll,
213
- exportSelected: localization.value.common.exportSelected,
214
- all: localization.value.common.all,
215
- filter: localization.value.common.filter,
216
- }))
217
-
218
- const skeletonDataLocal = ref<UI_I_DataTableSkeleton>(skeletonData)
219
-
220
- const data = computed<UI_I_DataTable>(() => ({
221
- id: 'vmkernel-adapters-table',
222
- selectedRows: [],
223
- isAllSelected: false,
224
- header: headItems.value,
225
- body: bodyItems.value,
226
- }))
227
-
228
- const headItems = computed<UI_I_DataTableHeader[]>(() =>
229
- getHeaderDataFunc(localization.value)
230
- )
231
- const bodyItems = ref<UI_I_DataTableBody[]>([])
232
-
233
- const networkTableData = computed<I_VmKernelAdapter[]>(() => {
234
- return constructNetworkTableFunc(props.networkData, localization.value)
235
- })
236
-
237
- const selectedSysx = ref<string>('')
238
-
239
- watch(
240
- networkTableData,
241
- (newValue: I_VmKernelAdapter[]) => {
242
- if (!newValue?.length) {
243
- selectedSysx.value = ''
244
- selectedRow.value = undefined
245
- bodyItems.value = []
246
- } else {
247
- if (
248
- !newValue?.find?.(
249
- (network: I_VmKernelAdapter) => network.device === selectedSysx.value
250
- )
251
- ) {
252
- selectedSysx.value = ''
253
- selectedRow.value = undefined
254
- }
255
- bodyItems.value = getBodyDataFunc(
256
- newValue,
257
- selectedRow.value,
258
- localization.value
259
- )
260
- }
261
- },
262
- { deep: true, immediate: true }
263
- )
264
-
265
- const hasSelectedAdapter = computed<boolean>(
266
- () => typeof selectedRow.value === 'number'
267
- )
268
-
269
- const actions = computed<UI_I_ButtonsGroup[]>(() =>
270
- getHeaderActions(localization.value, hasSelectedAdapter.value)
271
- )
272
-
273
- const selectedActionId = ref<number>(-1)
274
-
275
- const onToggleActions = (id: number): void => {
276
- if (selectedActionId.value === id) {
277
- selectedActionId.value = ''
278
- return
279
- }
280
- selectedActionId.value = id
281
- }
282
-
283
- const onSelectAction = (action: string, isDropdownAction?: boolean): void => {
284
- selectedSysx.value = isDropdownAction
285
- ? selectedActionId.value
286
- : data.value.body?.find?.((row) => row.row === selectedRow.value)?.data?.[0]
287
- .data?.id
288
-
289
- action === 'edit' ? onShowPortEditSettingsModal() : onShowRemoveModal()
290
- }
291
-
292
- const actionItems = computed<UI_I_Dropdown[]>(() =>
293
- getActions(localization.value, 'data-table-vmkernel-adapters-action-item')
294
- )
295
-
296
- const portEditInitialData = ref<UI_I_ModalsInitialData>({})
297
-
298
- const vmKernelToAction = computed<UI_I_Network | undefined>(() =>
299
- props.networkData.find(
300
- (network: UI_I_Network) => network.sysx?.id === selectedSysx.value
301
- )
302
- )
303
-
304
- const onRemove = (id: string, type: string): void => {
305
- emits('remove', id, type, onHideRemoveModal)
306
- }
307
-
308
- const isShowPortRemoveModal = ref<boolean>(false)
309
-
310
- const onShowRemoveModal = (): void => {
311
- isShowPortRemoveModal.value = true
312
- }
313
- const onHideRemoveModal = (): void => {
314
- isShowPortRemoveModal.value = false
315
- }
316
-
317
- const isShowPortEditSettingsModal = ref<boolean>(false)
318
-
319
- const onShowPortEditSettingsModal = (): void => {
320
- if (vmKernelToAction.value) {
321
- portEditInitialData.value = portEditInitialDataFunc(vmKernelToAction.value)
322
- isShowPortEditSettingsModal.value = true
323
- }
324
- }
325
- const onHidePortEditSettingsModal = (): void => {
326
- isShowPortEditSettingsModal.value = false
327
- }
328
-
329
- const editFieldsData = ref<UI_I_EditFieldsData>({})
330
-
331
- const onSendEditData = (
332
- type: string,
333
- hideModal: () => void,
334
- name?: string
335
- ): void => {
336
- emits('send-edit-data', type, editFieldsData.value, hideModal, name)
337
- }
338
-
339
- const onChangeEditFieldsData = (
340
- newEditFieldsData: UI_I_EditFieldsData
341
- ): void => {
342
- editFieldsData.value = newEditFieldsData
343
- }
344
-
345
- const portEditSettingsTabs = computed<UI_I_ModalTab[]>(() =>
346
- portEditSettingsTabsFunc(localization.value)
347
- )
348
- </script>
349
-
350
- <style scoped lang="scss">
351
- .vmkernel-adapters-table {
352
- height: calc(100% - 52px);
353
- }
354
-
355
- :deep(.table-container) {
356
- height: 100%;
357
- grid-template-rows: min-content auto min-content;
358
-
359
- .title-container {
360
- margin-right: 16px;
361
- }
362
-
363
- &.full-width-search {
364
- grid-template-rows: min-content min-content auto min-content;
365
- }
366
- }
367
-
368
- .actions {
369
- justify-content: flex-end;
370
- padding-right: 4px;
371
-
372
- .action-icon {
373
- height: 20px;
374
- width: 20px;
375
- color: var(--actions-icon-color);
376
-
377
- &:hover {
378
- color: var(--actions-icon-icative-color);
379
- }
380
- }
381
- }
382
-
383
- .title-actions {
384
- display: flex;
385
- column-gap: 16px;
386
-
387
- :deep(.ui-btn) {
388
- white-space: nowrap;
389
- }
390
- }
391
-
392
- :deep(.ui-button-group) {
393
- padding-left: 0;
394
- }
395
-
396
- :deep(.table-fixed-height) {
397
- all: unset;
398
- .table-fixed-full-height {
399
- all: unset;
400
- }
401
- }
402
-
403
- :deep(.data-table-skeleton) {
404
- height: 100%;
405
- grid-template-rows: min-content auto min-content;
406
- &.full-width-search {
407
- grid-template-rows: min-content min-content auto min-content;
408
- }
409
-
410
- .body.with-actions {
411
- height: calc(100% - 92px);
412
- }
413
- }
414
-
415
- .skeleton-header {
416
- display: flex;
417
- justify-content: space-between;
418
- align-items: center;
419
-
420
- .right-skeleton {
421
- display: flex;
422
- column-gap: 16px;
423
- }
424
- }
425
-
426
- .cell {
427
- display: flex;
428
- column-gap: 4px;
429
-
430
- &-icon {
431
- height: 18px;
432
-
433
- &.cell-icon-device {
434
- color: var(--checkbox-stroke-checked);
435
- }
436
- }
437
- &-text {
438
- line-height: 18px;
439
- }
440
- }
441
-
442
- :deep(.status-container) {
443
- span:not(.icon-container) {
444
- white-space: nowrap;
445
- }
446
- }
447
-
448
- :deep(.ui-button-group-dots-icon) {
449
- padding-left: 0;
450
- }
451
- </style>
1
+ <template>
2
+ <div class="vmkernel-adapters-table">
3
+ <ui-data-table
4
+ :data="data"
5
+ :options="options"
6
+ :total-items="props.networkData.total_items"
7
+ :total-pages="props.networkData.total_pages"
8
+ :texts="texts"
9
+ :skeleton="skeletonDataLocal"
10
+ :actions="actions"
11
+ :loading="props.isLoading"
12
+ test-id="vmkernel-adapters-table"
13
+ class="vmkernel-adapters-table"
14
+ server-off
15
+ @select-row="onSelectRow"
16
+ @action="onSelectAction"
17
+ >
18
+ <template #insteadOfTitleActions>
19
+ <div class="title-actions">
20
+ <ui-button
21
+ test-id="refresh-vmkernel-adapters-btn"
22
+ class="refresh-btn"
23
+ size="md"
24
+ variant="outline"
25
+ @click="emits('global-refresh')"
26
+ >
27
+ <template #icon> <ui-icon name="reset" width="24" /> </template>
28
+ {{ localization.common.refresh }}
29
+ </ui-button>
30
+ <ui-button
31
+ v-permission="
32
+ 'Networks.CreateSysx Networks.CreatePortGroup Networks.UpdateSwitch Networks.CreateSwitch'
33
+ "
34
+ test-id="add-vmkernel-adapters-btn"
35
+ class="add-btn"
36
+ size="md"
37
+ @click="emits('show-add-networking-modal')"
38
+ >
39
+ <template #icon> <ui-icon name="plus" width="24" /> </template>
40
+ {{ localization.common.addNetworkingWithDots }}
41
+ </ui-button>
42
+ </div>
43
+ </template>
44
+
45
+ <template #icon="{ item }">
46
+ <div class="cell">
47
+ <div
48
+ :class="[
49
+ 'cell-icon',
50
+ {
51
+ 'cell-icon-device': item.col === 'col0',
52
+ },
53
+ ]"
54
+ >
55
+ <ui-icon
56
+ v-if="item.col === 'col0'"
57
+ :name="item.data.icon"
58
+ width="18"
59
+ height="18"
60
+ />
61
+ <div v-else :class="item.data.icon"></div>
62
+ </div>
63
+ <span class="cell-text">
64
+ {{ item.text }}
65
+ </span>
66
+ </div>
67
+ </template>
68
+
69
+ <template #default-actions="{ item }">
70
+ <span
71
+ :id="`vmkernel-adapters-item-${item.data.id}-action`"
72
+ v-permission="'Networks.UpdateSysx Networks.RemoveSysx'"
73
+ :class="[
74
+ 'action-button',
75
+ {
76
+ 'action-button-active': selectedActionId === item.data.id,
77
+ },
78
+ ]"
79
+ @click.stop="onToggleActions(item.data.id)"
80
+ >
81
+ <ui-icon name="vertical-dotes" width="20" height="20" />
82
+ </span>
83
+ <Teleport to="body">
84
+ <ui-dropdown
85
+ v-permission="'Networks.UpdateSysx Networks.RemoveSysx'"
86
+ :test-id="`data-table-vmkernel-adapters-dropdown-${item.data.id}`"
87
+ :show="selectedActionId === item.data.id"
88
+ :items="actionItems"
89
+ :elem-id="`vmkernel-adapters-item-${item.data.id}-action`"
90
+ width="max-content"
91
+ @select="(action) => onSelectAction(action, true)"
92
+ @hide="selectedActionId = -1"
93
+ />
94
+ </Teleport>
95
+ </template>
96
+
97
+ <template #skeleton-header>
98
+ <div class="skeleton-header">
99
+ <div class="left-skeleton">
100
+ <ui-skeleton-item width="80" height="20" />
101
+ </div>
102
+ <div class="right-skeleton">
103
+ <ui-skeleton-item width="112" height="36" border-radius="8" />
104
+ <ui-skeleton-item width="160" height="36" border-radius="8" />
105
+ </div>
106
+ </div>
107
+ </template>
108
+ </ui-data-table>
109
+ </div>
110
+
111
+ <common-diagram-main-modals-remove-modal
112
+ v-if="isShowPortRemoveModal"
113
+ :id="vmKernelToAction?.sysx?.id || ''"
114
+ :title="localization.common.removeVMkernelAdapter"
115
+ :show="isShowPortRemoveModal"
116
+ :is-show-loader="props.isRemoveModalLoading"
117
+ modal-name="port-remove-modal"
118
+ view-name="port-remove"
119
+ :switch-name="vmKernelToAction.switchName"
120
+ type="port"
121
+ @remove="onRemove"
122
+ @hide="onHideRemoveModal"
123
+ />
124
+ <common-diagram-main-modals-edit-settings-modal
125
+ v-if="isShowPortEditSettingsModal"
126
+ :show="isShowPortEditSettingsModal"
127
+ :title="portEditInitialData.portName || ''"
128
+ :initial-data="portEditInitialData"
129
+ :items="portEditSettingsTabs"
130
+ :is-dark-mode="props.isDarkMode"
131
+ :is-edit-modal-loading="props.isEditModalLoading"
132
+ view-name="port-edit"
133
+ width="872px"
134
+ height="558px"
135
+ @send-edit-data="onSendEditData"
136
+ @change-edit-fields-data="onChangeEditFieldsData"
137
+ @hide="onHidePortEditSettingsModal"
138
+ />
139
+ </template>
140
+
141
+ <script setup lang="ts">
142
+ import type { UI_I_ButtonsGroup } from '~/node_modules/bfg-uikit/components/ui/button/group/lib/models/interfaces'
143
+ import type { UI_I_Dropdown } from '~/node_modules/bfg-uikit/components/ui/dropdown/models/interfaces'
144
+ import type {
145
+ UI_I_DataTableBody,
146
+ UI_I_DataTableHeader,
147
+ UI_I_TableTexts,
148
+ UI_I_DataTableSkeleton,
149
+ UI_I_DataTable,
150
+ } from '~/node_modules/bfg-uikit/components/ui/dataTable/models/interfaces'
151
+ import type { UI_I_Localization } from '~/lib/models/interfaces'
152
+ import type {
153
+ UI_I_Network,
154
+ UI_I_ModalsInitialData,
155
+ UI_I_EditFieldsData,
156
+ UI_I_ModalTab,
157
+ } from '~/components/common/diagramMain/lib/models/interfaces'
158
+ import type { I_VmKernelAdapter } from '~/components/common/configure/vmkernelAdapters/tableView/lib/models/interfaces'
159
+ import { constructNetworkTableFunc } from '~/components/common/configure/vmkernelAdapters/tableView/mappers/mappers'
160
+ import {
161
+ portEditSettingsTabsFunc,
162
+ portEditInitialDataFunc,
163
+ } from '~/components/common/configure/vmkernelAdapters/tableView/lib/config/settings'
164
+ import {
165
+ getBodyDataFunc,
166
+ getHeaderDataFunc,
167
+ options,
168
+ skeletonData,
169
+ getActions,
170
+ getHeaderActions,
171
+ } from '~/components/common/configure/vmkernelAdapters/tableView/lib/config/vmKernelAdaptersTableConfigNew'
172
+
173
+ const props = defineProps<{
174
+ isLoading: boolean
175
+ networkData: UI_I_Network[]
176
+ isDarkMode: boolean
177
+ isRemoveModalLoading: boolean
178
+ isEditModalLoading: boolean
179
+ }>()
180
+
181
+ const emits = defineEmits<{
182
+ (event: 'remove', id: string, type: string, hideModal: () => void): void
183
+ (
184
+ event: 'send-edit-data',
185
+ type: string,
186
+ data: UI_I_EditFieldsData,
187
+ hideModal: () => void,
188
+ name?: string
189
+ ): void
190
+ (event: 'global-refresh'): void
191
+ (event: 'show-add-networking-modal'): void
192
+ }>()
193
+
194
+ const localization = computed<UI_I_Localization>(() => useLocal())
195
+
196
+ const selectedRow = defineModel<number>()
197
+
198
+ const onSelectRow = (value: UI_I_DataTableBody[]): void => {
199
+ if (typeof value[0].row !== 'number') return
200
+ selectedRow.value = value[0].row
201
+ }
202
+
203
+ const texts = computed<UI_I_TableTexts>(() => ({
204
+ searchHere: localization.value.common.searchHere,
205
+ rowsPerPage: localization.value.common.rowsPerPage,
206
+ of: localization.value.common.of,
207
+ selected: localization.value.common.selected,
208
+ columns: localization.value.common.columns,
209
+ previous: localization.value.common.previous,
210
+ next: localization.value.common.next,
211
+ noItemsFound: localization.value.common.noItemsFound,
212
+ exportAll: localization.value.common.exportAll,
213
+ exportSelected: localization.value.common.exportSelected,
214
+ all: localization.value.common.all,
215
+ filter: localization.value.common.filter,
216
+ }))
217
+
218
+ const skeletonDataLocal = ref<UI_I_DataTableSkeleton>(skeletonData)
219
+
220
+ const data = computed<UI_I_DataTable>(() => ({
221
+ id: 'vmkernel-adapters-table',
222
+ selectedRows: [],
223
+ isAllSelected: false,
224
+ header: headItems.value,
225
+ body: bodyItems.value,
226
+ }))
227
+
228
+ const headItems = computed<UI_I_DataTableHeader[]>(() =>
229
+ getHeaderDataFunc(localization.value)
230
+ )
231
+ const bodyItems = ref<UI_I_DataTableBody[]>([])
232
+
233
+ const networkTableData = computed<I_VmKernelAdapter[]>(() => {
234
+ return constructNetworkTableFunc(props.networkData, localization.value)
235
+ })
236
+
237
+ const selectedSysx = ref<string>('')
238
+
239
+ watch(
240
+ networkTableData,
241
+ (newValue: I_VmKernelAdapter[]) => {
242
+ if (!newValue?.length) {
243
+ selectedSysx.value = ''
244
+ selectedRow.value = undefined
245
+ bodyItems.value = []
246
+ } else {
247
+ if (
248
+ !newValue?.find?.(
249
+ (network: I_VmKernelAdapter) => network.device === selectedSysx.value
250
+ )
251
+ ) {
252
+ selectedSysx.value = ''
253
+ selectedRow.value = undefined
254
+ }
255
+ bodyItems.value = getBodyDataFunc(
256
+ newValue,
257
+ selectedRow.value,
258
+ localization.value
259
+ )
260
+ }
261
+ },
262
+ { deep: true, immediate: true }
263
+ )
264
+
265
+ const hasSelectedAdapter = computed<boolean>(
266
+ () => typeof selectedRow.value === 'number'
267
+ )
268
+
269
+ const actions = computed<UI_I_ButtonsGroup[]>(() =>
270
+ getHeaderActions(localization.value, hasSelectedAdapter.value)
271
+ )
272
+
273
+ const selectedActionId = ref<number>(-1)
274
+
275
+ const onToggleActions = (id: number): void => {
276
+ if (selectedActionId.value === id) {
277
+ selectedActionId.value = ''
278
+ return
279
+ }
280
+ selectedActionId.value = id
281
+ }
282
+
283
+ const onSelectAction = (action: string, isDropdownAction?: boolean): void => {
284
+ selectedSysx.value = isDropdownAction
285
+ ? selectedActionId.value
286
+ : data.value.body?.find?.((row) => row.row === selectedRow.value)?.data?.[0]
287
+ .data?.id
288
+
289
+ action === 'edit' ? onShowPortEditSettingsModal() : onShowRemoveModal()
290
+ }
291
+
292
+ const actionItems = computed<UI_I_Dropdown[]>(() =>
293
+ getActions(localization.value, 'data-table-vmkernel-adapters-action-item')
294
+ )
295
+
296
+ const portEditInitialData = ref<UI_I_ModalsInitialData>({})
297
+
298
+ const vmKernelToAction = computed<UI_I_Network | undefined>(() =>
299
+ props.networkData.find(
300
+ (network: UI_I_Network) => network.sysx?.id === selectedSysx.value
301
+ )
302
+ )
303
+
304
+ const onRemove = (id: string, type: string): void => {
305
+ emits('remove', id, type, onHideRemoveModal)
306
+ }
307
+
308
+ const isShowPortRemoveModal = ref<boolean>(false)
309
+
310
+ const onShowRemoveModal = (): void => {
311
+ isShowPortRemoveModal.value = true
312
+ }
313
+ const onHideRemoveModal = (): void => {
314
+ isShowPortRemoveModal.value = false
315
+ }
316
+
317
+ const isShowPortEditSettingsModal = ref<boolean>(false)
318
+
319
+ const onShowPortEditSettingsModal = (): void => {
320
+ if (vmKernelToAction.value) {
321
+ portEditInitialData.value = portEditInitialDataFunc(vmKernelToAction.value)
322
+ isShowPortEditSettingsModal.value = true
323
+ }
324
+ }
325
+ const onHidePortEditSettingsModal = (): void => {
326
+ isShowPortEditSettingsModal.value = false
327
+ }
328
+
329
+ const editFieldsData = ref<UI_I_EditFieldsData>({})
330
+
331
+ const onSendEditData = (
332
+ type: string,
333
+ hideModal: () => void,
334
+ name?: string
335
+ ): void => {
336
+ emits('send-edit-data', type, editFieldsData.value, hideModal, name)
337
+ }
338
+
339
+ const onChangeEditFieldsData = (
340
+ newEditFieldsData: UI_I_EditFieldsData
341
+ ): void => {
342
+ editFieldsData.value = newEditFieldsData
343
+ }
344
+
345
+ const portEditSettingsTabs = computed<UI_I_ModalTab[]>(() =>
346
+ portEditSettingsTabsFunc(localization.value)
347
+ )
348
+ </script>
349
+
350
+ <style scoped lang="scss">
351
+ .vmkernel-adapters-table {
352
+ height: calc(100% - 52px);
353
+ }
354
+
355
+ :deep(.table-container) {
356
+ height: 100%;
357
+ grid-template-rows: min-content auto min-content;
358
+
359
+ .title-container {
360
+ margin-right: 16px;
361
+ }
362
+
363
+ &.full-width-search {
364
+ grid-template-rows: min-content min-content auto min-content;
365
+ }
366
+ }
367
+
368
+ .actions {
369
+ justify-content: flex-end;
370
+ padding-right: 4px;
371
+
372
+ .action-icon {
373
+ height: 20px;
374
+ width: 20px;
375
+ color: var(--actions-icon-color);
376
+
377
+ &:hover {
378
+ color: var(--actions-icon-icative-color);
379
+ }
380
+ }
381
+ }
382
+
383
+ .title-actions {
384
+ display: flex;
385
+ column-gap: 16px;
386
+
387
+ :deep(.ui-btn) {
388
+ white-space: nowrap;
389
+ }
390
+ }
391
+
392
+ :deep(.ui-button-group) {
393
+ padding-left: 0;
394
+ }
395
+
396
+ :deep(.table-fixed-height) {
397
+ all: unset;
398
+ .table-fixed-full-height {
399
+ all: unset;
400
+ }
401
+ }
402
+
403
+ :deep(.data-table-skeleton) {
404
+ height: 100%;
405
+ grid-template-rows: min-content auto min-content;
406
+ &.full-width-search {
407
+ grid-template-rows: min-content min-content auto min-content;
408
+ }
409
+
410
+ .body.with-actions {
411
+ height: calc(100% - 92px);
412
+ }
413
+ }
414
+
415
+ .skeleton-header {
416
+ display: flex;
417
+ justify-content: space-between;
418
+ align-items: center;
419
+
420
+ .right-skeleton {
421
+ display: flex;
422
+ column-gap: 16px;
423
+ }
424
+ }
425
+
426
+ .cell {
427
+ display: flex;
428
+ column-gap: 4px;
429
+
430
+ &-icon {
431
+ height: 18px;
432
+
433
+ &.cell-icon-device {
434
+ color: var(--checkbox-stroke-checked);
435
+ }
436
+ }
437
+ &-text {
438
+ line-height: 18px;
439
+ }
440
+ }
441
+
442
+ :deep(.status-container) {
443
+ span:not(.icon-container) {
444
+ white-space: nowrap;
445
+ }
446
+ }
447
+
448
+ :deep(.ui-button-group-dots-icon) {
449
+ padding-left: 0;
450
+ }
451
+
452
+ .action-button {
453
+ width: 20px;
454
+ height: 20px;
455
+ color: var(--close-icon);
456
+ cursor: pointer;
457
+
458
+ &:hover {
459
+ color: var(--btn-table-manager-color-hover);
460
+ }
461
+
462
+ &.action-button-active {
463
+ color: var(--btn-primary-fill-bg-color);
464
+ }
465
+ }
466
+ </style>
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bfg-common",
3
3
  "private": false,
4
- "version": "1.6.104",
4
+ "version": "1.6.105",
5
5
  "scripts": {
6
6
  "build": "nuxt build",
7
7
  "dev": "nuxt dev --port=3002",