bfg-common 1.4.569 → 1.4.570

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.
Files changed (137) hide show
  1. package/assets/img/icons/icons-sprite-dark-1.svg +407 -407
  2. package/assets/img/icons/icons-sprite-dark-2.svg +343 -343
  3. package/assets/img/icons/icons-sprite-dark-3.svg +227 -227
  4. package/assets/img/icons/icons-sprite-dark-4.svg +255 -255
  5. package/assets/img/icons/icons-sprite-dark-5.svg +488 -488
  6. package/assets/img/icons/icons-sprite-dark-6.svg +94 -94
  7. package/assets/img/icons/icons-sprite-light-1.svg +407 -407
  8. package/assets/img/icons/icons-sprite-light-2.svg +343 -343
  9. package/assets/img/icons/icons-sprite-light-3.svg +227 -227
  10. package/assets/img/icons/icons-sprite-light-4.svg +255 -255
  11. package/assets/img/icons/icons-sprite-light-5.svg +488 -488
  12. package/assets/img/icons/icons-sprite-light-6.svg +94 -94
  13. package/components/atoms/TheIcon3.vue +50 -50
  14. package/components/atoms/modal/bySteps/BySteps.vue +253 -253
  15. package/components/atoms/stack/StackBlock.vue +185 -185
  16. package/components/atoms/table/dataGrid/DataGrid.vue +1633 -1633
  17. package/components/atoms/table/dataGrid/DataGridColumnSwitch.vue +222 -222
  18. package/components/common/browse/BrowseNew.vue +237 -237
  19. package/components/common/browse/BrowseOld.vue +217 -217
  20. package/components/common/browse/blocks/contents/Files.vue +35 -35
  21. package/components/common/browse/blocks/contents/FilesOld.vue +70 -70
  22. package/components/common/browse/blocks/contents/filesNew/FilesNew.vue +92 -92
  23. package/components/common/browse/blocks/contents/filesNew/Skeleton.vue +18 -18
  24. package/components/common/browse/blocks/lib/models/types.ts +1 -1
  25. package/components/common/browse/lib/models/interfaces.ts +5 -5
  26. package/components/common/context/lib/models/interfaces.ts +30 -30
  27. package/components/common/context/recursion/Recursion.vue +86 -86
  28. package/components/common/context/recursion/RecursionNew.vue +199 -199
  29. package/components/common/context/recursion/RecursionOld.vue +213 -213
  30. package/components/common/diagramMain/Header.vue +211 -211
  31. package/components/common/diagramMain/adapter/AdapterItems.vue +61 -61
  32. package/components/common/diagramMain/lib/config/initial.ts +50 -50
  33. package/components/common/diagramMain/lib/models/enums.ts +44 -44
  34. package/components/common/diagramMain/lib/models/types.ts +21 -21
  35. package/components/common/diagramMain/lib/utils/utils.ts +331 -331
  36. package/components/common/diagramMain/modals/ManagePhysicalAdaptersModal.vue +330 -330
  37. package/components/common/diagramMain/modals/editSettings/ConfirmTeamingSettingsModal.vue +40 -40
  38. package/components/common/diagramMain/modals/editSettings/EditSettings.vue +497 -497
  39. package/components/common/diagramMain/modals/editSettings/EditSettingsModal.vue +812 -812
  40. package/components/common/diagramMain/modals/editSettings/tabs/NetworkProperties.vue +214 -214
  41. package/components/common/diagramMain/modals/editSettings/tabs/Security.vue +189 -189
  42. package/components/common/diagramMain/modals/editSettings/tabs/SwitchProperties.vue +163 -163
  43. package/components/common/diagramMain/modals/editSettings/tabs/TeamingFailover.vue +175 -175
  44. package/components/common/diagramMain/modals/editSettings/tabs/TrafficShaping.vue +398 -398
  45. package/components/common/diagramMain/modals/editSettings/tabs/port/IpvFourSettings.vue +346 -346
  46. package/components/common/diagramMain/modals/editSettings/tabs/port/PortProperties.vue +205 -205
  47. package/components/common/diagramMain/modals/lib/config/diagramConfig.ts +23 -23
  48. package/components/common/diagramMain/modals/lib/config/initial.ts +180 -180
  49. package/components/common/diagramMain/modals/lib/config/vmKernelAdapter.ts +90 -90
  50. package/components/common/diagramMain/modals/lib/mappers/mappers.ts +87 -87
  51. package/components/common/diagramMain/modals/lib/utils/index.ts +24 -24
  52. package/components/common/diagramMain/modals/migrateVmkernelAdapter/MigrateVmkernelAdapter.vue +537 -537
  53. package/components/common/diagramMain/modals/migrateVmkernelAdapter/lib/config/steps.ts +114 -114
  54. package/components/common/diagramMain/modals/migrateVmkernelAdapter/steps/ConnectionSettings.vue +169 -169
  55. package/components/common/diagramMain/modals/migrateVmkernelAdapter/steps/SelectVmkernelAdapter.vue +159 -159
  56. package/components/common/diagramMain/modals/migrateVmkernelAdapter/validations/common.ts +14 -14
  57. package/components/common/diagramMain/modals/migrateVmkernelAdapter/validations/connectionSettings.ts +137 -137
  58. package/components/common/diagramMain/modals/migrateVmkernelAdapter/validations/selectVmkernelAdapter.ts +52 -52
  59. package/components/common/diagramMain/modals/migrateVmkernelAdapter/validations/validations.ts +19 -19
  60. package/components/common/diagramMain/port/Ports.vue +47 -47
  61. package/components/common/layout/theHeader/helpMenu/About.vue +85 -85
  62. package/components/common/layout/theHeader/helpMenu/aboutNew/AboutNew.vue +103 -103
  63. package/components/common/mainNavigationPanel/MainNavigationPanel.vue +152 -152
  64. package/components/common/portlets/customAttributes/Portlet.vue +655 -655
  65. package/components/common/portlets/tag/Portlet.vue +422 -422
  66. package/components/common/portlets/tag/TagAddNew.vue +624 -624
  67. package/components/common/spiceConsole/Drawer.vue +370 -370
  68. package/components/common/spiceConsole/lib/models/interfaces.ts +5 -5
  69. package/components/common/vm/actions/add/Add.vue +617 -617
  70. package/components/common/vm/actions/clone/lib/config/steps.ts +129 -129
  71. package/components/common/vm/actions/common/customizeHardware/CustomizeHardware.vue +267 -267
  72. package/components/common/vm/actions/common/customizeHardware/CustomizeHardwareNew.vue +264 -264
  73. package/components/common/vm/actions/common/customizeHardware/virtualHardware/browseView/BrowseView.vue +219 -219
  74. package/components/common/vm/actions/common/customizeHardware/virtualHardware/bus/BusNew.vue +118 -118
  75. package/components/common/vm/actions/common/customizeHardware/virtualHardware/cdDvdDrive/CdDvdDriveNew.vue +161 -161
  76. package/components/common/vm/actions/common/customizeHardware/virtualHardware/cdDvdDrive/CdDvdDriveOld.vue +165 -165
  77. package/components/common/vm/actions/common/customizeHardware/virtualHardware/cdDvdDrive/media/Media.vue +25 -25
  78. package/components/common/vm/actions/common/customizeHardware/virtualHardware/cdDvdDrive/media/MediaNew.vue +55 -55
  79. package/components/common/vm/actions/common/customizeHardware/virtualHardware/lib/config/dropdownItems.ts +147 -147
  80. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newHardDisk/mode/ModeOld.vue +55 -55
  81. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newHardDisk/sharing/SharingNew.vue +44 -44
  82. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newNetwork/NewNetworkNew.vue +124 -124
  83. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newNetwork/location/LocationOld.vue +134 -134
  84. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newNetwork/location/new/New.vue +63 -63
  85. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newNetwork/location/new/table/Table.vue +74 -74
  86. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newNetwork/location/new/table/lib/config/config.ts +95 -95
  87. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newNetwork/macAddress/MacAddress.vue +119 -119
  88. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newNetwork/macAddress/MacAddressNew.vue +69 -69
  89. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newNetwork/macAddress/MacAddressOld.vue +83 -83
  90. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newPciDevice/NewPciDeviceNew.vue +85 -85
  91. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newPciDevice/NewPciDeviceOld.vue +91 -91
  92. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newPciDevice/directPathIo/DirectPathIoNew.vue +35 -35
  93. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newPciDevice/dynamicDirectPathIo/DynamicDirectPathIoNew.vue +48 -48
  94. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newPciDevice/note/Note.vue +15 -15
  95. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newPciDevice/note/NoteNew.vue +42 -42
  96. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newPciDevice/note/NoteOld.vue +30 -30
  97. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newPciDevice/nvidiaGrid/NvidiaGridNew.vue +30 -30
  98. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newPciDevice/typeSelection/TypeSelectionNew.vue +46 -46
  99. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newUsbController/NewUsbControllerNew.vue +56 -56
  100. package/components/common/vm/actions/common/customizeHardware/virtualHardware/other/Other.vue +16 -16
  101. package/components/common/vm/actions/common/customizeHardware/virtualHardware/other/OtherNew.vue +27 -27
  102. package/components/common/vm/actions/common/customizeHardware/virtualHardware/videoCard/totalVideoMemory/TotalVideoMemoryNew.vue +54 -54
  103. package/components/common/vm/actions/common/customizeHardware/vmoptions/Vmoptions.vue +145 -145
  104. package/components/common/vm/actions/common/customizeHardware/vmoptions/VmoptionsNew.vue +102 -102
  105. package/components/common/vm/actions/common/customizeHardware/vmoptions/bootOptions/BootOptionsNew.vue +75 -75
  106. package/components/common/vm/actions/common/customizeHardware/vmoptions/bootOptions/delay/Delay.vue +26 -26
  107. package/components/common/vm/actions/common/customizeHardware/vmoptions/bootOptions/firmware/Firmware.vue +57 -57
  108. package/components/common/vm/actions/common/customizeHardware/vmoptions/bootOptions/firmware/FirmwareNew.vue +42 -42
  109. package/components/common/vm/actions/common/customizeHardware/vmoptions/bootOptions/menu/MenuNew.vue +25 -25
  110. package/components/common/vm/actions/common/customizeHardware/vmoptions/bootOptions/order/Order.vue +171 -171
  111. package/components/common/vm/actions/common/customizeHardware/vmoptions/bootOptions/order/OrderNew.vue +50 -50
  112. package/components/common/vm/actions/common/customizeHardware/vmoptions/generalOptions/GeneralOptionsNew.vue +141 -141
  113. package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/New.vue +140 -140
  114. package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/copyPaste/CopyPasteNew.vue +30 -30
  115. package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/fileTransfer/FileTransferNew.vue +30 -30
  116. package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/folderSharing/FolderSharingNew.vue +30 -30
  117. package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/keymap/Keymap.vue +32 -32
  118. package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/keymap/KeymapNew.vue +39 -39
  119. package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/password/PasswordNew.vue +100 -100
  120. package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/usbRedirection/UsbRedirectionNew.vue +38 -38
  121. package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/usbRedirection/UsbRedirectionOld.vue +44 -44
  122. package/components/common/vm/actions/common/select/storage/Storage.vue +130 -130
  123. package/components/common/vm/actions/common/select/storage/StorageOld.vue +129 -129
  124. package/components/common/vm/actions/common/select/storage/new/New.vue +159 -159
  125. package/components/common/vm/actions/editSettings/EditSettings.vue +214 -214
  126. package/components/common/vm/actions/editSettings/EditSettingsOld.vue +182 -182
  127. package/components/common/vm/actions/editSettings/new/New.vue +176 -176
  128. package/components/common/vm/actions/editSettings/new/Skeleton.vue +88 -87
  129. package/components/common/wizards/network/add/lib/config/steps.ts +464 -464
  130. package/composables/productNameLocal.ts +30 -30
  131. package/package.json +1 -1
  132. package/plugins/date.ts +233 -233
  133. package/plugins/recursion.ts +311 -311
  134. package/public/spice-console/lib/images/bitmap.js +203 -203
  135. package/public/spice-console/network/spicechannel.js +383 -383
  136. package/store/main/mutations.ts +7 -7
  137. package/store/main/state.ts +7 -7
@@ -1,655 +1,655 @@
1
- <template>
2
- <div>
3
- <ui-portlet
4
- class="attributes"
5
- test-id="attributes-portlet"
6
- :title="portletTitle"
7
- :dragged="props.dragged"
8
- :dragged-any="props.draggedAny"
9
- :is-open="props.isOpen"
10
- :portlet-id="props.portletId"
11
- @toggle="onTogglePortlet"
12
- >
13
- <template #portletBody>
14
- <ui-data-table
15
- test-id="attributes-portlet-table"
16
- :data="data"
17
- :options="attributeTableHeaderOptions"
18
- server-off
19
- :default-layout="false"
20
- size="sm"
21
- >
22
- <template #notFound>
23
- <div
24
- v-if="!allRowsCount"
25
- class="add-new-attribute-button-container"
26
- >
27
- <ui-button
28
- test-id="add-new-attribute-button"
29
- variant="text"
30
- is-without-height
31
- is-without-sizes
32
- :disabled="hasEditRow"
33
- @click="onAddNew"
34
- >
35
- {{ localization.zabbix.addNew }}...
36
- </ui-button>
37
- </div>
38
- </template>
39
- <!-- :loading="loading"-->
40
- <template #icon="{ item }">
41
- <div v-if="item.data.type === 'options'" class="actions-container">
42
- <span
43
- :id="`actions-attributes-${item.data.row}`"
44
- :class="[
45
- 'icon-container',
46
- {
47
- selected: isShow[`action-attributes-${item.data.row}`],
48
- },
49
- ]"
50
- @click="onShowActions(item.data.row)"
51
- >
52
- <ui-icon :name="item.data.icon" width="16" height="16" />
53
- </span>
54
- <ui-popup-window
55
- v-model="isShow[`action-attributes-${item.data.row}`]"
56
- :elem-id="`actions-attributes-${item.data.row}`"
57
- width="fit-content"
58
- >
59
- <div class="actions-dropdown-container">
60
- <div
61
- :class="['action', { disabled: hasEditRow }]"
62
- data-id="edit-attribute-action"
63
- @click="onEditAttribute(item.data.row)"
64
- >
65
- <!-- @click="onShowDetails(item.data.row)"-->
66
- <ui-icon name="edit" width="16" height="16" />
67
- <span>{{ localization.common.edit }}</span>
68
- </div>
69
- <div
70
- class="action-remove"
71
- data-id="delete-attribute-action"
72
- @click="onShowRemoveDialog(item.data.row)"
73
- >
74
- <ui-icon name="delete" width="16" height="16" />
75
- <span>{{ localization.common.delete }}</span>
76
- </div>
77
- </div>
78
- </ui-popup-window>
79
- </div>
80
- <template v-if="item.data.type === 'attribute'">
81
- <input
82
- v-model="editData.attribute"
83
- data-id="attribute-name-input"
84
- :class="[
85
- 'table-input',
86
- {
87
- 'table-input-error':
88
- validationData.attribute && isShowValidation,
89
- },
90
- ]"
91
- :placeholder="localization.common[item.data.type]"
92
- type="text"
93
- @click.prevent.stop
94
- />
95
- </template>
96
-
97
- <template v-else-if="item.data.type === 'value'">
98
- <input
99
- v-model="editData.value"
100
- :class="[
101
- 'table-input',
102
- {
103
- 'table-input-error':
104
- validationData.value && isShowValidation,
105
- },
106
- ]"
107
- :placeholder="localization.common[item.data.type]"
108
- type="text"
109
- data-id="attribute-value-input"
110
- @click.prevent.stop
111
- />
112
- </template>
113
- <template v-else-if="item.data.type === 'type'">
114
- <div class="category-select">
115
- <ui-select
116
- v-model="editData.type"
117
- :items="selectItems"
118
- :placeholder="localization.common.chooseCategory"
119
- width="165px"
120
- select-width="100%"
121
- :show-text="true"
122
- :error="validationData.type && isShowValidation"
123
- :disabled="isEditRow"
124
- size="sm"
125
- test-id="attribute-type-select"
126
- />
127
- </div>
128
- </template>
129
- <template v-else-if="item.data.type === 'actions'">
130
- <div class="edit-actions-container">
131
- <span
132
- class="hide-row"
133
- data-id="hide-create-attribute-row"
134
- @click.prevent.stop="onHideEditRow"
135
- >
136
- <ui-icon name="close" width="16" height="16" />
137
- </span>
138
- <span
139
- class="create-row"
140
- data-id="create-attribute-accept"
141
- @click.prevent.stop="onAddAttribute"
142
- >
143
- <ui-icon name="status-check" width="16" height="16" />
144
- </span>
145
- </div>
146
- </template>
147
- </template>
148
- </ui-data-table>
149
- </template>
150
- <template #portletFooter>
151
- <div class="footer">
152
- <ui-button
153
- test-id="add-new-attribute-button"
154
- variant="text"
155
- is-without-height
156
- is-without-sizes
157
- :disabled="hasEditRow"
158
- @click="onAddNew"
159
- >
160
- {{ localization.zabbix.addNew }}...
161
- </ui-button>
162
- </div>
163
- </template>
164
- </ui-portlet>
165
-
166
- <ui-popup
167
- v-if="isShowRemoveDialog"
168
- test-id="remove-attribute-dialog"
169
- icon-name="info-status"
170
- :texts="removeAttributeDialogTexts"
171
- :message="removeAttributeMessage"
172
- :title="localization.zabbix.deleteConfirmation"
173
- @hide="onHideRemoveDialog"
174
- @submit="onRemoveAttribute"
175
- />
176
- </div>
177
- </template>
178
-
179
- <script setup lang="ts">
180
- import type {
181
- UI_I_DataTable,
182
- UI_I_DataTableHeader,
183
- UI_I_DataTableBody,
184
- } from '~/node_modules/bfg-uikit/components/ui/dataTable/models/interfaces'
185
- import type { UI_I_Dropdown } from '~/node_modules/bfg-uikit/components/ui/dropdown/models/interfaces'
186
- import type { UI_I_ModalTexts } from '~/node_modules/bfg-uikit/components/ui/modal/models/interfaces'
187
- import type {
188
- UI_I_Localization,
189
- UI_I_ArbitraryObject,
190
- } from '~/lib/models/interfaces'
191
- import type { UI_I_NewAttributeData } from '~/components/common/portlets/customAttributes/lib/models/interfaces'
192
- import {
193
- attributeTableHeaderOptions,
194
- attributeTableHeaderDataFunc,
195
- createRow,
196
- makeNewAttributeCreateActionRowFunc,
197
- availableTypesFunc,
198
- } from '~/components/common/portlets/customAttributes/lib/config/config'
199
-
200
- const props = defineProps<{
201
- portletId: string
202
- dragged?: boolean
203
- isOpen?: boolean
204
- draggedAny?: boolean
205
- selectedItemName: string
206
- type: UI_I_Dropdown
207
- bodyItems: UI_I_DataTableBody[]
208
- }>()
209
-
210
- const localization = computed<UI_I_Localization>(() => useLocal())
211
-
212
- const portletTitle = computed<string>(() => {
213
- const count = allRowsCount.value
214
- ? ` (${isEditRow.value ? allRowsCount.value + 1 : allRowsCount.value})`
215
- : ''
216
-
217
- return localization.value.common.customAttributes + count
218
- })
219
-
220
- const isShow = ref<UI_I_ArbitraryObject<boolean>>({})
221
-
222
- const onShowActions = (id: number): void => {
223
- isShow.value[`action-attributes-${id}`] =
224
- !isShow.value[`action-attributes-${id}`]
225
- }
226
-
227
- const attributesHeadItems = computed<UI_I_DataTableHeader[]>(() =>
228
- attributeTableHeaderDataFunc(localization.value)
229
- )
230
-
231
- const attributesBodyItems = ref<UI_I_DataTableBody[]>([])
232
-
233
- const allRowsCount = computed<number>(
234
- () =>
235
- attributesBodyItems.value.filter(
236
- (row: UI_I_DataTableBody) => !row.actionRow
237
- ).length
238
- )
239
-
240
- const hasEditRow = computed<boolean>(
241
- () => !!attributesBodyItems.value.find((row) => row.actionRow)
242
- )
243
-
244
- const selectedType = computed<UI_I_Dropdown>(() => ({
245
- text: props.type.text,
246
- value: props.type.value,
247
- selected: true,
248
- }))
249
-
250
- const editData = ref<UI_I_NewAttributeData>({
251
- attribute: '',
252
- value: '',
253
- type: selectedType.value.text,
254
- })
255
-
256
- const resetFields = (): void => {
257
- editData.value = {
258
- attribute: '',
259
- value: '',
260
- type: selectedType.value.text,
261
- }
262
- }
263
-
264
- const isShowValidation = ref<boolean>(false)
265
- const validationData = computed<{
266
- attribute: boolean
267
- value: boolean
268
- type: boolean
269
- }>(() => ({
270
- attribute: !editData.value.attribute.trim(),
271
- value: !editData.value.value.trim(),
272
- type: !editData.value.type.trim(),
273
- }))
274
-
275
- watch(
276
- validationData,
277
- (newValue: { attribute: boolean; value: boolean; type: boolean }) => {
278
- !newValue.attribute &&
279
- !newValue.value &&
280
- !newValue.type &&
281
- (isShowValidation.value = false)
282
- },
283
- { deep: true }
284
- )
285
-
286
- const onAddAttribute = (): void => {
287
- if (
288
- validationData.value.attribute ||
289
- validationData.value.value ||
290
- validationData.value.type
291
- ) {
292
- isShowValidation.value = true
293
- return
294
- }
295
-
296
- if (isEditRow.value && editRowData.value) {
297
- const editedRowData = createRow(editRowData.value.row, editData.value)
298
-
299
- attributesBodyItems.value = attributesBodyItems.value.map((row) =>
300
- row.row === editRowData.value?.row ? editedRowData : row
301
- )
302
-
303
- emits('edit-attribute', editedRowData)
304
- isShow.value[`action-attributes-${editRowData.value?.row}`] = false
305
- editRowData.value = undefined
306
- isEditRow.value = false
307
- } else {
308
- const withoutEditRowData = attributesBodyItems.value.filter(
309
- (row) => !row.actionRow
310
- )
311
-
312
- const rowsIds = withoutEditRowData.map((row) => row.row).sort()
313
- let lastId = rowsIds[rowsIds.length - 1]
314
- lastId = lastId === undefined ? -1 : lastId
315
-
316
- const addedRowData = createRow(lastId + 1, editData.value)
317
-
318
- attributesBodyItems.value.push(addedRowData)
319
- emits('add-attribute', addedRowData)
320
- attributesBodyItems.value = attributesBodyItems.value.filter(
321
- (row) => !row.actionRow
322
- )
323
- }
324
-
325
- resetFields()
326
- }
327
-
328
- const onHideEditRow = (): void => {
329
- if (isEditRow.value && editRowData.value) {
330
- attributesBodyItems.value = attributesBodyItems.value.map((row) =>
331
- row.row === editRowData.value?.row ? editRowData.value : row
332
- )
333
- isShow.value[`action-attributes-${editRowData.value?.row}`] = false
334
- editRowData.value = undefined
335
- isEditRow.value = false
336
- } else {
337
- attributesBodyItems.value = attributesBodyItems.value.filter(
338
- (row) => !row.actionRow
339
- )
340
- }
341
- resetFields()
342
- }
343
-
344
- watch(
345
- () => props.bodyItems,
346
- (newValue: UI_I_DataTableBody[]) => {
347
- attributesBodyItems.value = newValue
348
- },
349
- { deep: true, immediate: true }
350
- )
351
-
352
- const data = computed<UI_I_DataTable>(() => ({
353
- id: '0',
354
- selectedRows: [],
355
- isAllSelected: false,
356
- title: '',
357
- subTitle: '',
358
- header: attributesHeadItems.value,
359
- body: attributesBodyItems.value,
360
- }))
361
-
362
- const selectItems = ref<UI_I_Dropdown[]>(
363
- useDeepCopy(availableTypesFunc(selectedType.value))
364
- )
365
-
366
- const onAddNew = (): void => {
367
- const rowsIds = attributesBodyItems.value.map((row) => row.row).sort()
368
- let lastId = rowsIds[rowsIds.length - 1]
369
- lastId = lastId === undefined ? -1 : lastId
370
-
371
- attributesBodyItems.value.push(
372
- makeNewAttributeCreateActionRowFunc(lastId + 1)
373
- )
374
- }
375
-
376
- const removeAttributeDialogTexts = computed<UI_I_ModalTexts>(() => ({
377
- button1: localization.value.common.cancel,
378
- button2: localization.value.common.delete,
379
- }))
380
-
381
- const isShowRemoveDialog = ref<boolean>(false)
382
-
383
- const onHideRemoveDialog = (): void => {
384
- isShowRemoveDialog.value = false
385
- }
386
-
387
- const attributeIdForRemove = ref<number>(0)
388
- const attributeNameForRemove = computed<string>(
389
- () =>
390
- (attributesBodyItems.value.find(
391
- (row: UI_I_DataTableBody) => row.row === attributeIdForRemove.value
392
- )?.data[0]?.text || '') as string
393
- )
394
- const removeAttributeMessage = computed<string>(() =>
395
- localization.value.common.removeAttributeDialog
396
- .replace?.('{attributeName}', attributeNameForRemove.value)
397
- .replace('{selectedItemName}', props.selectedItemName)
398
- )
399
- const onShowRemoveDialog = (id: number): void => {
400
- attributeIdForRemove.value = id
401
- isShowRemoveDialog.value = true
402
- }
403
- const onRemoveAttribute = (): void => {
404
- onHideRemoveDialog()
405
-
406
- const removeItem = attributesBodyItems.value.find(
407
- (row) => row.row === attributeIdForRemove.value
408
- )
409
- if (!removeItem) return
410
-
411
- emits('remove-attribute', removeItem)
412
- attributesBodyItems.value = attributesBodyItems.value.filter(
413
- (row) => row.row !== attributeIdForRemove.value
414
- )
415
- }
416
-
417
- const isEditRow = ref<boolean>(false)
418
- const editRowData = ref<UI_I_DataTableBody | undefined>(undefined)
419
- const onEditAttribute = (id: number): void => {
420
- editRowData.value = useDeepCopy(
421
- attributesBodyItems.value.find((row) => row.row === id)
422
- )
423
-
424
- if (!editRowData.value) return
425
- isEditRow.value = true
426
-
427
- editData.value = {
428
- attribute: editRowData.value.data[0].text,
429
- value: editRowData.value.data[1].text,
430
- type: editRowData.value.data[2].text,
431
- }
432
-
433
- attributesBodyItems.value = attributesBodyItems.value.map((row) =>
434
- row.row === id ? makeNewAttributeCreateActionRowFunc(id) : row
435
- )
436
- }
437
-
438
- const emits = defineEmits<{
439
- (event: 'toggle-portlet', id: string): void
440
- (event: 'remove-attribute', value: UI_I_DataTableBody): void
441
- (event: 'add-attribute', value: UI_I_DataTableBody): void
442
- (event: 'edit-attribute', value: UI_I_DataTableBody): void
443
- }>()
444
-
445
- const onTogglePortlet = (id: string): void => {
446
- emits('toggle-portlet', id)
447
- }
448
- </script>
449
-
450
- <style>
451
- :root {
452
- --separator-color: #e9ebed;
453
- --input-border: #d3d6da;
454
- --input-color: #4d5d69;
455
- --input-caret-color: #000000;
456
- --input-bg: #ffffff;
457
- --hide-row-icon: #4d5d69;
458
- --hide-row-icon-hover: #213444;
459
- --create-row-icon: #008fd6;
460
- --create-row-icon-hover: #0081c1;
461
- }
462
- :root.dark-theme {
463
- --separator-color: #e9ebed1f;
464
- --input-border: #e9ebed3d;
465
- --input-color: #d3d6da;
466
- --input-caret-color: #ffffff;
467
- --input-bg: transparent;
468
- --hide-row-icon: #e9eaec;
469
- --hide-row-icon-hover: #ffffff;
470
- --create-row-icon: #2ba2de;
471
- --create-row-icon-hover: #008fd6;
472
- }
473
- </style>
474
-
475
- <style scoped lang="scss">
476
- .icon-container {
477
- width: 16px;
478
- height: 16px;
479
- display: block;
480
- cursor: pointer;
481
- color: var(--table-actions-icon);
482
-
483
- &:hover,
484
- &.selected {
485
- color: var(--table-actions-icon-hover);
486
- }
487
- }
488
-
489
- .action-remove {
490
- display: flex;
491
- align-items: center;
492
- column-gap: 8px;
493
-
494
- height: 32px;
495
- border-radius: 4px;
496
- padding: 8px;
497
- color: var(--table-actions-remove);
498
- cursor: pointer;
499
-
500
- font-size: 13px;
501
- font-weight: 500;
502
- line-height: 15.73px;
503
-
504
- &:hover {
505
- background: var(--table-actions-bg-hover);
506
- }
507
- }
508
-
509
- .action {
510
- display: flex;
511
- align-items: center;
512
- column-gap: 8px;
513
-
514
- height: 32px;
515
- border-radius: 4px;
516
- padding: 8px;
517
- color: var(--table-actions-view);
518
- margin-bottom: 8px;
519
- cursor: pointer;
520
-
521
- font-size: 13px;
522
- font-weight: 500;
523
- line-height: 15.73px;
524
-
525
- &.disabled {
526
- user-select: none;
527
- pointer-events: none;
528
- opacity: 0.3;
529
- cursor: not-allowed;
530
- }
531
-
532
- &:hover {
533
- background: var(--table-actions-bg-hover);
534
- }
535
- }
536
-
537
- .footer {
538
- padding: 0 16px 8px;
539
-
540
- :deep(button.ui-btn) {
541
- line-height: 16px;
542
- margin-bottom: 11px;
543
- margin-left: 6px;
544
- width: fit-content;
545
- }
546
- }
547
-
548
- .table-input {
549
- height: 28px;
550
- background-color: var(--input-bg);
551
- border: 1px solid var(--input-border);
552
- font-size: 12px;
553
- font-weight: 500;
554
- line-height: 14.52px;
555
- border-radius: 6px;
556
- width: 100%;
557
- padding: 6px 8px;
558
- caret-color: var(--input-caret-color);
559
- color: var(--input-color);
560
-
561
- &::placeholder {
562
- color: #9da6ad;
563
- }
564
-
565
- &:focus,
566
- &:focus-visible {
567
- border: 1px solid #008fd6;
568
- outline: none;
569
- }
570
-
571
- &.table-input-error {
572
- border-color: #ea3223;
573
- }
574
- }
575
-
576
- .category-select {
577
- width: 100%;
578
-
579
- :deep(.ui-select-toggle-button) {
580
- height: 28px;
581
- background-color: var(--input-bg);
582
-
583
- &:disabled {
584
- background: var(--select-bg-disabled);
585
- color: var(--select-color-disabled);
586
- cursor: default;
587
-
588
- .ui-arrow-icon {
589
- color: var(--select-color-disabled);
590
- }
591
-
592
- :deep(.content-icon) {
593
- opacity: 40%;
594
- }
595
- }
596
- }
597
-
598
- :deep(.ui-placeholder) {
599
- font-size: 12px;
600
- }
601
-
602
- :deep(.ui-dropdown) {
603
- max-height: 250px;
604
- overflow-y: auto;
605
-
606
- .ui-dropdown-menu-item {
607
- height: 28px;
608
- margin-bottom: 4px;
609
- .ui-item-text {
610
- font-size: 12px;
611
- }
612
- }
613
- }
614
- }
615
-
616
- .hide-row {
617
- cursor: pointer;
618
- line-height: 16px;
619
- color: var(--hide-row-icon);
620
-
621
- &:hover {
622
- color: var(--hide-row-icon-hover);
623
- }
624
- }
625
-
626
- .create-row {
627
- cursor: pointer;
628
- line-height: 16px;
629
- color: var(--create-row-icon);
630
-
631
- &:hover {
632
- color: var(--create-row-icon-hover);
633
- }
634
- }
635
-
636
- .add-new-attribute-button-container {
637
- margin-top: 12px;
638
- }
639
-
640
- .actions-container {
641
- display: flex;
642
- justify-content: flex-end;
643
- width: 100%;
644
- }
645
-
646
- .actions-dropdown-container {
647
- padding: 8px;
648
- }
649
-
650
- .edit-actions-container {
651
- display: flex;
652
- align-items: center;
653
- column-gap: 12px;
654
- }
655
- </style>
1
+ <template>
2
+ <div>
3
+ <ui-portlet
4
+ class="attributes"
5
+ test-id="attributes-portlet"
6
+ :title="portletTitle"
7
+ :dragged="props.dragged"
8
+ :dragged-any="props.draggedAny"
9
+ :is-open="props.isOpen"
10
+ :portlet-id="props.portletId"
11
+ @toggle="onTogglePortlet"
12
+ >
13
+ <template #portletBody>
14
+ <ui-data-table
15
+ test-id="attributes-portlet-table"
16
+ :data="data"
17
+ :options="attributeTableHeaderOptions"
18
+ server-off
19
+ :default-layout="false"
20
+ size="sm"
21
+ >
22
+ <template #notFound>
23
+ <div
24
+ v-if="!allRowsCount"
25
+ class="add-new-attribute-button-container"
26
+ >
27
+ <ui-button
28
+ test-id="add-new-attribute-button"
29
+ variant="text"
30
+ is-without-height
31
+ is-without-sizes
32
+ :disabled="hasEditRow"
33
+ @click="onAddNew"
34
+ >
35
+ {{ localization.zabbix.addNew }}...
36
+ </ui-button>
37
+ </div>
38
+ </template>
39
+ <!-- :loading="loading"-->
40
+ <template #icon="{ item }">
41
+ <div v-if="item.data.type === 'options'" class="actions-container">
42
+ <span
43
+ :id="`actions-attributes-${item.data.row}`"
44
+ :class="[
45
+ 'icon-container',
46
+ {
47
+ selected: isShow[`action-attributes-${item.data.row}`],
48
+ },
49
+ ]"
50
+ @click="onShowActions(item.data.row)"
51
+ >
52
+ <ui-icon :name="item.data.icon" width="16" height="16" />
53
+ </span>
54
+ <ui-popup-window
55
+ v-model="isShow[`action-attributes-${item.data.row}`]"
56
+ :elem-id="`actions-attributes-${item.data.row}`"
57
+ width="fit-content"
58
+ >
59
+ <div class="actions-dropdown-container">
60
+ <div
61
+ :class="['action', { disabled: hasEditRow }]"
62
+ data-id="edit-attribute-action"
63
+ @click="onEditAttribute(item.data.row)"
64
+ >
65
+ <!-- @click="onShowDetails(item.data.row)"-->
66
+ <ui-icon name="edit" width="16" height="16" />
67
+ <span>{{ localization.common.edit }}</span>
68
+ </div>
69
+ <div
70
+ class="action-remove"
71
+ data-id="delete-attribute-action"
72
+ @click="onShowRemoveDialog(item.data.row)"
73
+ >
74
+ <ui-icon name="delete" width="16" height="16" />
75
+ <span>{{ localization.common.delete }}</span>
76
+ </div>
77
+ </div>
78
+ </ui-popup-window>
79
+ </div>
80
+ <template v-if="item.data.type === 'attribute'">
81
+ <input
82
+ v-model="editData.attribute"
83
+ data-id="attribute-name-input"
84
+ :class="[
85
+ 'table-input',
86
+ {
87
+ 'table-input-error':
88
+ validationData.attribute && isShowValidation,
89
+ },
90
+ ]"
91
+ :placeholder="localization.common[item.data.type]"
92
+ type="text"
93
+ @click.prevent.stop
94
+ />
95
+ </template>
96
+
97
+ <template v-else-if="item.data.type === 'value'">
98
+ <input
99
+ v-model="editData.value"
100
+ :class="[
101
+ 'table-input',
102
+ {
103
+ 'table-input-error':
104
+ validationData.value && isShowValidation,
105
+ },
106
+ ]"
107
+ :placeholder="localization.common[item.data.type]"
108
+ type="text"
109
+ data-id="attribute-value-input"
110
+ @click.prevent.stop
111
+ />
112
+ </template>
113
+ <template v-else-if="item.data.type === 'type'">
114
+ <div class="category-select">
115
+ <ui-select
116
+ v-model="editData.type"
117
+ :items="selectItems"
118
+ :placeholder="localization.common.chooseCategory"
119
+ width="165px"
120
+ select-width="100%"
121
+ :show-text="true"
122
+ :error="validationData.type && isShowValidation"
123
+ :disabled="isEditRow"
124
+ size="sm"
125
+ test-id="attribute-type-select"
126
+ />
127
+ </div>
128
+ </template>
129
+ <template v-else-if="item.data.type === 'actions'">
130
+ <div class="edit-actions-container">
131
+ <span
132
+ class="hide-row"
133
+ data-id="hide-create-attribute-row"
134
+ @click.prevent.stop="onHideEditRow"
135
+ >
136
+ <ui-icon name="close" width="16" height="16" />
137
+ </span>
138
+ <span
139
+ class="create-row"
140
+ data-id="create-attribute-accept"
141
+ @click.prevent.stop="onAddAttribute"
142
+ >
143
+ <ui-icon name="status-check" width="16" height="16" />
144
+ </span>
145
+ </div>
146
+ </template>
147
+ </template>
148
+ </ui-data-table>
149
+ </template>
150
+ <template #portletFooter>
151
+ <div class="footer">
152
+ <ui-button
153
+ test-id="add-new-attribute-button"
154
+ variant="text"
155
+ is-without-height
156
+ is-without-sizes
157
+ :disabled="hasEditRow"
158
+ @click="onAddNew"
159
+ >
160
+ {{ localization.zabbix.addNew }}...
161
+ </ui-button>
162
+ </div>
163
+ </template>
164
+ </ui-portlet>
165
+
166
+ <ui-popup
167
+ v-if="isShowRemoveDialog"
168
+ test-id="remove-attribute-dialog"
169
+ icon-name="info-status"
170
+ :texts="removeAttributeDialogTexts"
171
+ :message="removeAttributeMessage"
172
+ :title="localization.zabbix.deleteConfirmation"
173
+ @hide="onHideRemoveDialog"
174
+ @submit="onRemoveAttribute"
175
+ />
176
+ </div>
177
+ </template>
178
+
179
+ <script setup lang="ts">
180
+ import type {
181
+ UI_I_DataTable,
182
+ UI_I_DataTableHeader,
183
+ UI_I_DataTableBody,
184
+ } from '~/node_modules/bfg-uikit/components/ui/dataTable/models/interfaces'
185
+ import type { UI_I_Dropdown } from '~/node_modules/bfg-uikit/components/ui/dropdown/models/interfaces'
186
+ import type { UI_I_ModalTexts } from '~/node_modules/bfg-uikit/components/ui/modal/models/interfaces'
187
+ import type {
188
+ UI_I_Localization,
189
+ UI_I_ArbitraryObject,
190
+ } from '~/lib/models/interfaces'
191
+ import type { UI_I_NewAttributeData } from '~/components/common/portlets/customAttributes/lib/models/interfaces'
192
+ import {
193
+ attributeTableHeaderOptions,
194
+ attributeTableHeaderDataFunc,
195
+ createRow,
196
+ makeNewAttributeCreateActionRowFunc,
197
+ availableTypesFunc,
198
+ } from '~/components/common/portlets/customAttributes/lib/config/config'
199
+
200
+ const props = defineProps<{
201
+ portletId: string
202
+ dragged?: boolean
203
+ isOpen?: boolean
204
+ draggedAny?: boolean
205
+ selectedItemName: string
206
+ type: UI_I_Dropdown
207
+ bodyItems: UI_I_DataTableBody[]
208
+ }>()
209
+
210
+ const localization = computed<UI_I_Localization>(() => useLocal())
211
+
212
+ const portletTitle = computed<string>(() => {
213
+ const count = allRowsCount.value
214
+ ? ` (${isEditRow.value ? allRowsCount.value + 1 : allRowsCount.value})`
215
+ : ''
216
+
217
+ return localization.value.common.customAttributes + count
218
+ })
219
+
220
+ const isShow = ref<UI_I_ArbitraryObject<boolean>>({})
221
+
222
+ const onShowActions = (id: number): void => {
223
+ isShow.value[`action-attributes-${id}`] =
224
+ !isShow.value[`action-attributes-${id}`]
225
+ }
226
+
227
+ const attributesHeadItems = computed<UI_I_DataTableHeader[]>(() =>
228
+ attributeTableHeaderDataFunc(localization.value)
229
+ )
230
+
231
+ const attributesBodyItems = ref<UI_I_DataTableBody[]>([])
232
+
233
+ const allRowsCount = computed<number>(
234
+ () =>
235
+ attributesBodyItems.value.filter(
236
+ (row: UI_I_DataTableBody) => !row.actionRow
237
+ ).length
238
+ )
239
+
240
+ const hasEditRow = computed<boolean>(
241
+ () => !!attributesBodyItems.value.find((row) => row.actionRow)
242
+ )
243
+
244
+ const selectedType = computed<UI_I_Dropdown>(() => ({
245
+ text: props.type.text,
246
+ value: props.type.value,
247
+ selected: true,
248
+ }))
249
+
250
+ const editData = ref<UI_I_NewAttributeData>({
251
+ attribute: '',
252
+ value: '',
253
+ type: selectedType.value.text,
254
+ })
255
+
256
+ const resetFields = (): void => {
257
+ editData.value = {
258
+ attribute: '',
259
+ value: '',
260
+ type: selectedType.value.text,
261
+ }
262
+ }
263
+
264
+ const isShowValidation = ref<boolean>(false)
265
+ const validationData = computed<{
266
+ attribute: boolean
267
+ value: boolean
268
+ type: boolean
269
+ }>(() => ({
270
+ attribute: !editData.value.attribute.trim(),
271
+ value: !editData.value.value.trim(),
272
+ type: !editData.value.type.trim(),
273
+ }))
274
+
275
+ watch(
276
+ validationData,
277
+ (newValue: { attribute: boolean; value: boolean; type: boolean }) => {
278
+ !newValue.attribute &&
279
+ !newValue.value &&
280
+ !newValue.type &&
281
+ (isShowValidation.value = false)
282
+ },
283
+ { deep: true }
284
+ )
285
+
286
+ const onAddAttribute = (): void => {
287
+ if (
288
+ validationData.value.attribute ||
289
+ validationData.value.value ||
290
+ validationData.value.type
291
+ ) {
292
+ isShowValidation.value = true
293
+ return
294
+ }
295
+
296
+ if (isEditRow.value && editRowData.value) {
297
+ const editedRowData = createRow(editRowData.value.row, editData.value)
298
+
299
+ attributesBodyItems.value = attributesBodyItems.value.map((row) =>
300
+ row.row === editRowData.value?.row ? editedRowData : row
301
+ )
302
+
303
+ emits('edit-attribute', editedRowData)
304
+ isShow.value[`action-attributes-${editRowData.value?.row}`] = false
305
+ editRowData.value = undefined
306
+ isEditRow.value = false
307
+ } else {
308
+ const withoutEditRowData = attributesBodyItems.value.filter(
309
+ (row) => !row.actionRow
310
+ )
311
+
312
+ const rowsIds = withoutEditRowData.map((row) => row.row).sort()
313
+ let lastId = rowsIds[rowsIds.length - 1]
314
+ lastId = lastId === undefined ? -1 : lastId
315
+
316
+ const addedRowData = createRow(lastId + 1, editData.value)
317
+
318
+ attributesBodyItems.value.push(addedRowData)
319
+ emits('add-attribute', addedRowData)
320
+ attributesBodyItems.value = attributesBodyItems.value.filter(
321
+ (row) => !row.actionRow
322
+ )
323
+ }
324
+
325
+ resetFields()
326
+ }
327
+
328
+ const onHideEditRow = (): void => {
329
+ if (isEditRow.value && editRowData.value) {
330
+ attributesBodyItems.value = attributesBodyItems.value.map((row) =>
331
+ row.row === editRowData.value?.row ? editRowData.value : row
332
+ )
333
+ isShow.value[`action-attributes-${editRowData.value?.row}`] = false
334
+ editRowData.value = undefined
335
+ isEditRow.value = false
336
+ } else {
337
+ attributesBodyItems.value = attributesBodyItems.value.filter(
338
+ (row) => !row.actionRow
339
+ )
340
+ }
341
+ resetFields()
342
+ }
343
+
344
+ watch(
345
+ () => props.bodyItems,
346
+ (newValue: UI_I_DataTableBody[]) => {
347
+ attributesBodyItems.value = newValue
348
+ },
349
+ { deep: true, immediate: true }
350
+ )
351
+
352
+ const data = computed<UI_I_DataTable>(() => ({
353
+ id: '0',
354
+ selectedRows: [],
355
+ isAllSelected: false,
356
+ title: '',
357
+ subTitle: '',
358
+ header: attributesHeadItems.value,
359
+ body: attributesBodyItems.value,
360
+ }))
361
+
362
+ const selectItems = ref<UI_I_Dropdown[]>(
363
+ useDeepCopy(availableTypesFunc(selectedType.value))
364
+ )
365
+
366
+ const onAddNew = (): void => {
367
+ const rowsIds = attributesBodyItems.value.map((row) => row.row).sort()
368
+ let lastId = rowsIds[rowsIds.length - 1]
369
+ lastId = lastId === undefined ? -1 : lastId
370
+
371
+ attributesBodyItems.value.push(
372
+ makeNewAttributeCreateActionRowFunc(lastId + 1)
373
+ )
374
+ }
375
+
376
+ const removeAttributeDialogTexts = computed<UI_I_ModalTexts>(() => ({
377
+ button1: localization.value.common.cancel,
378
+ button2: localization.value.common.delete,
379
+ }))
380
+
381
+ const isShowRemoveDialog = ref<boolean>(false)
382
+
383
+ const onHideRemoveDialog = (): void => {
384
+ isShowRemoveDialog.value = false
385
+ }
386
+
387
+ const attributeIdForRemove = ref<number>(0)
388
+ const attributeNameForRemove = computed<string>(
389
+ () =>
390
+ (attributesBodyItems.value.find(
391
+ (row: UI_I_DataTableBody) => row.row === attributeIdForRemove.value
392
+ )?.data[0]?.text || '') as string
393
+ )
394
+ const removeAttributeMessage = computed<string>(() =>
395
+ localization.value.common.removeAttributeDialog
396
+ .replace?.('{attributeName}', attributeNameForRemove.value)
397
+ .replace('{selectedItemName}', props.selectedItemName)
398
+ )
399
+ const onShowRemoveDialog = (id: number): void => {
400
+ attributeIdForRemove.value = id
401
+ isShowRemoveDialog.value = true
402
+ }
403
+ const onRemoveAttribute = (): void => {
404
+ onHideRemoveDialog()
405
+
406
+ const removeItem = attributesBodyItems.value.find(
407
+ (row) => row.row === attributeIdForRemove.value
408
+ )
409
+ if (!removeItem) return
410
+
411
+ emits('remove-attribute', removeItem)
412
+ attributesBodyItems.value = attributesBodyItems.value.filter(
413
+ (row) => row.row !== attributeIdForRemove.value
414
+ )
415
+ }
416
+
417
+ const isEditRow = ref<boolean>(false)
418
+ const editRowData = ref<UI_I_DataTableBody | undefined>(undefined)
419
+ const onEditAttribute = (id: number): void => {
420
+ editRowData.value = useDeepCopy(
421
+ attributesBodyItems.value.find((row) => row.row === id)
422
+ )
423
+
424
+ if (!editRowData.value) return
425
+ isEditRow.value = true
426
+
427
+ editData.value = {
428
+ attribute: editRowData.value.data[0].text,
429
+ value: editRowData.value.data[1].text,
430
+ type: editRowData.value.data[2].text,
431
+ }
432
+
433
+ attributesBodyItems.value = attributesBodyItems.value.map((row) =>
434
+ row.row === id ? makeNewAttributeCreateActionRowFunc(id) : row
435
+ )
436
+ }
437
+
438
+ const emits = defineEmits<{
439
+ (event: 'toggle-portlet', id: string): void
440
+ (event: 'remove-attribute', value: UI_I_DataTableBody): void
441
+ (event: 'add-attribute', value: UI_I_DataTableBody): void
442
+ (event: 'edit-attribute', value: UI_I_DataTableBody): void
443
+ }>()
444
+
445
+ const onTogglePortlet = (id: string): void => {
446
+ emits('toggle-portlet', id)
447
+ }
448
+ </script>
449
+
450
+ <style>
451
+ :root {
452
+ --separator-color: #e9ebed;
453
+ --input-border: #d3d6da;
454
+ --input-color: #4d5d69;
455
+ --input-caret-color: #000000;
456
+ --input-bg: #ffffff;
457
+ --hide-row-icon: #4d5d69;
458
+ --hide-row-icon-hover: #213444;
459
+ --create-row-icon: #008fd6;
460
+ --create-row-icon-hover: #0081c1;
461
+ }
462
+ :root.dark-theme {
463
+ --separator-color: #e9ebed1f;
464
+ --input-border: #e9ebed3d;
465
+ --input-color: #d3d6da;
466
+ --input-caret-color: #ffffff;
467
+ --input-bg: transparent;
468
+ --hide-row-icon: #e9eaec;
469
+ --hide-row-icon-hover: #ffffff;
470
+ --create-row-icon: #2ba2de;
471
+ --create-row-icon-hover: #008fd6;
472
+ }
473
+ </style>
474
+
475
+ <style scoped lang="scss">
476
+ .icon-container {
477
+ width: 16px;
478
+ height: 16px;
479
+ display: block;
480
+ cursor: pointer;
481
+ color: var(--table-actions-icon);
482
+
483
+ &:hover,
484
+ &.selected {
485
+ color: var(--table-actions-icon-hover);
486
+ }
487
+ }
488
+
489
+ .action-remove {
490
+ display: flex;
491
+ align-items: center;
492
+ column-gap: 8px;
493
+
494
+ height: 32px;
495
+ border-radius: 4px;
496
+ padding: 8px;
497
+ color: var(--table-actions-remove);
498
+ cursor: pointer;
499
+
500
+ font-size: 13px;
501
+ font-weight: 500;
502
+ line-height: 15.73px;
503
+
504
+ &:hover {
505
+ background: var(--table-actions-bg-hover);
506
+ }
507
+ }
508
+
509
+ .action {
510
+ display: flex;
511
+ align-items: center;
512
+ column-gap: 8px;
513
+
514
+ height: 32px;
515
+ border-radius: 4px;
516
+ padding: 8px;
517
+ color: var(--table-actions-view);
518
+ margin-bottom: 8px;
519
+ cursor: pointer;
520
+
521
+ font-size: 13px;
522
+ font-weight: 500;
523
+ line-height: 15.73px;
524
+
525
+ &.disabled {
526
+ user-select: none;
527
+ pointer-events: none;
528
+ opacity: 0.3;
529
+ cursor: not-allowed;
530
+ }
531
+
532
+ &:hover {
533
+ background: var(--table-actions-bg-hover);
534
+ }
535
+ }
536
+
537
+ .footer {
538
+ padding: 0 16px 8px;
539
+
540
+ :deep(button.ui-btn) {
541
+ line-height: 16px;
542
+ margin-bottom: 11px;
543
+ margin-left: 6px;
544
+ width: fit-content;
545
+ }
546
+ }
547
+
548
+ .table-input {
549
+ height: 28px;
550
+ background-color: var(--input-bg);
551
+ border: 1px solid var(--input-border);
552
+ font-size: 12px;
553
+ font-weight: 500;
554
+ line-height: 14.52px;
555
+ border-radius: 6px;
556
+ width: 100%;
557
+ padding: 6px 8px;
558
+ caret-color: var(--input-caret-color);
559
+ color: var(--input-color);
560
+
561
+ &::placeholder {
562
+ color: #9da6ad;
563
+ }
564
+
565
+ &:focus,
566
+ &:focus-visible {
567
+ border: 1px solid #008fd6;
568
+ outline: none;
569
+ }
570
+
571
+ &.table-input-error {
572
+ border-color: #ea3223;
573
+ }
574
+ }
575
+
576
+ .category-select {
577
+ width: 100%;
578
+
579
+ :deep(.ui-select-toggle-button) {
580
+ height: 28px;
581
+ background-color: var(--input-bg);
582
+
583
+ &:disabled {
584
+ background: var(--select-bg-disabled);
585
+ color: var(--select-color-disabled);
586
+ cursor: default;
587
+
588
+ .ui-arrow-icon {
589
+ color: var(--select-color-disabled);
590
+ }
591
+
592
+ :deep(.content-icon) {
593
+ opacity: 40%;
594
+ }
595
+ }
596
+ }
597
+
598
+ :deep(.ui-placeholder) {
599
+ font-size: 12px;
600
+ }
601
+
602
+ :deep(.ui-dropdown) {
603
+ max-height: 250px;
604
+ overflow-y: auto;
605
+
606
+ .ui-dropdown-menu-item {
607
+ height: 28px;
608
+ margin-bottom: 4px;
609
+ .ui-item-text {
610
+ font-size: 12px;
611
+ }
612
+ }
613
+ }
614
+ }
615
+
616
+ .hide-row {
617
+ cursor: pointer;
618
+ line-height: 16px;
619
+ color: var(--hide-row-icon);
620
+
621
+ &:hover {
622
+ color: var(--hide-row-icon-hover);
623
+ }
624
+ }
625
+
626
+ .create-row {
627
+ cursor: pointer;
628
+ line-height: 16px;
629
+ color: var(--create-row-icon);
630
+
631
+ &:hover {
632
+ color: var(--create-row-icon-hover);
633
+ }
634
+ }
635
+
636
+ .add-new-attribute-button-container {
637
+ margin-top: 12px;
638
+ }
639
+
640
+ .actions-container {
641
+ display: flex;
642
+ justify-content: flex-end;
643
+ width: 100%;
644
+ }
645
+
646
+ .actions-dropdown-container {
647
+ padding: 8px;
648
+ }
649
+
650
+ .edit-actions-container {
651
+ display: flex;
652
+ align-items: center;
653
+ column-gap: 12px;
654
+ }
655
+ </style>