bfg-common 1.4.355 → 1.4.356

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 (33) hide show
  1. package/assets/localization/local_be.json +2823 -2796
  2. package/assets/localization/local_en.json +2827 -2800
  3. package/assets/localization/local_hy.json +28 -1
  4. package/assets/localization/local_kk.json +28 -1
  5. package/assets/localization/local_ru.json +28 -1
  6. package/assets/localization/local_zh.json +28 -1
  7. package/components/common/layout/theHeader/feedback/Feedback.vue +12 -7
  8. package/components/common/layout/theHeader/feedback/lib/config/sendFeedback.ts +9 -0
  9. package/components/common/layout/theHeader/feedback/new/New.vue +131 -0
  10. package/components/common/layout/theHeader/feedback/new/additionalDetails/AdditionalDetails.vue +14 -0
  11. package/components/common/layout/theHeader/feedback/new/description/Description.vue +58 -0
  12. package/components/common/layout/theHeader/feedback/new/email/Email.vue +43 -0
  13. package/components/common/layout/theHeader/feedback/new/subtitle/Subtitle.vue +83 -0
  14. package/components/common/layout/theHeader/feedback/new/tabs/Tabs.vue +79 -0
  15. package/components/common/layout/theHeader/feedback/new/tabs/lib/config/tabs.ts +25 -0
  16. package/components/common/layout/theHeader/feedback/new/tabs/lib/models/interfaces.ts +17 -0
  17. package/components/common/layout/theHeader/feedback/new/tabs/lib/models/types.ts +1 -0
  18. package/components/common/layout/theHeader/helpMenu/About.vue +45 -72
  19. package/components/common/layout/theHeader/helpMenu/HelpMenu.vue +1 -1
  20. package/components/common/layout/theHeader/helpMenu/aboutNew/AboutNew.vue +92 -0
  21. package/components/common/layout/theHeader/helpMenu/aboutOld/AboutOld.vue +95 -0
  22. package/components/common/monitor/advanced/tools/chartOptionsModal/counters/table/lib/config/utils.ts +136 -64
  23. package/components/common/portlets/tag/CreateCategory.vue +276 -276
  24. package/components/common/portlets/tag/TagAddNew.vue +578 -578
  25. package/components/common/portlets/tag/TagsNew.vue +450 -450
  26. package/components/common/portlets/tag/lib/config/config.ts +199 -199
  27. package/components/common/portlets/tag/lib/models/interfaces.ts +27 -27
  28. package/components/common/portlets/tag/lib/models/types.ts +15 -15
  29. package/components/common/spiceConsole/Drawer.vue +28 -0
  30. package/lib/models/interfaces.ts +1 -0
  31. package/package.json +1 -1
  32. package/store/tasks/mappers/recentTasks.ts +8 -1
  33. package/components/common/layout/theHeader/feedback/FeedbackNew.vue +0 -63
@@ -1,578 +1,578 @@
1
- <template>
2
- <div class="add-tag-modal-container">
3
- <ui-modal
4
- v-if="props.isShowModal"
5
- :title="localization.common.assignTag"
6
- :subtitle="props.selectedItemName"
7
- :texts="assignTagTexts"
8
- test-id="modal-assign-tag"
9
- width="720px"
10
- :is-disabled-accept="!selectedRowsCount"
11
- @hide="emits('cancel')"
12
- @submit="onAssign"
13
- >
14
- <template #header></template>
15
- <template #content>
16
- <div style="padding: 8px 32px 0">
17
- <div v-if="isShowRequiredFieldsError" style="margin: 8px 0">
18
- <ui-alert
19
- :messages="[localization.common.pleaseFillAllRequiredFields]"
20
- test-id="required-alert"
21
- simple-error
22
- />
23
- </div>
24
- <div class="modal-top">
25
- <span class="selected-text">
26
- {{ selectedRowsCount }} {{ texts.selected }}
27
- </span>
28
- </div>
29
- <ui-data-table
30
- test-id="assign-tags-data-table"
31
- :data="assignDataLocal"
32
- :options="options"
33
- server-off
34
- :default-layout="false"
35
- size="sm"
36
- @select-row="onGetSelected"
37
- >
38
- <template #notFound>
39
- <div v-if="!allRowsCount" style="margin-top: 12px">
40
- <ui-button
41
- variant="text"
42
- test-id="create-new-tag"
43
- is-without-height
44
- is-without-sizes
45
- :disabled="hasEditRow"
46
- @click="onAddNewRow"
47
- >
48
- {{ localization.zabbix.addNew }}...
49
- </ui-button>
50
- </div>
51
- </template>
52
- <template #icon="{ item }">
53
- <template v-if="item.data.type === 'tagName'">
54
- <input
55
- v-model="editData.tagName"
56
- data-id="new-tag-name"
57
- :class="[
58
- 'table-input',
59
- {
60
- 'table-input-error':
61
- validationData.tagName && isShowValidation,
62
- },
63
- ]"
64
- :placeholder="localization.common[item.data.type]"
65
- type="text"
66
- @click.prevent.stop
67
- />
68
- </template>
69
-
70
- <template v-else-if="item.data.type === 'category'">
71
- <div class="category-select">
72
- <ui-select
73
- v-model="editData.category"
74
- :items="selectItems"
75
- :error="validationData.category && isShowValidation"
76
- :placeholder="localization.common.chooseCategory"
77
- width="165px"
78
- select-width="100%"
79
- :show-text="true"
80
- size="sm"
81
- test-id="new-tag-category"
82
- >
83
- <template #heading>
84
- <div class="add-category-button">
85
- <ui-button
86
- variant="text"
87
- is-without-height
88
- is-without-sizes
89
- test-id="create-new-tag-category"
90
- @click="onShowCreateCategoryModal"
91
- >
92
- <div
93
- style="
94
- display: flex;
95
- align-items: center;
96
- height: 28px;
97
- "
98
- >
99
- <ui-icon name="plus" width="16" height="16" />
100
- <span>{{ localization.common.createNew }}</span>
101
- </div>
102
- </ui-button>
103
- </div>
104
- <div class="separator-container"></div>
105
- </template>
106
- </ui-select>
107
- </div>
108
- </template>
109
- <template v-else-if="item.data.type === 'description'">
110
- <input
111
- v-model="editData.description"
112
- class="table-input"
113
- :placeholder="localization.common[item.data.type]"
114
- type="text"
115
- data-id="new-tag-description"
116
- @click.prevent.stop
117
- />
118
- </template>
119
- <template v-else-if="item.data.type === 'actions'">
120
- <div
121
- style="display: flex; align-items: center; column-gap: 12px"
122
- >
123
- <span
124
- style="cursor: pointer; line-height: 16px"
125
- data-id="hide-create-new-tag-row"
126
- @click.prevent.stop="onHideEditRow"
127
- >
128
- <ui-icon
129
- name="close"
130
- width="16"
131
- height="16"
132
- color="#4D5D69"
133
- />
134
- </span>
135
- <span
136
- style="cursor: pointer; line-height: 16px"
137
- data-id="create-new-tag-accept"
138
- @click.prevent.stop="onAddTag"
139
- >
140
- <ui-icon
141
- name="status-check"
142
- width="16"
143
- height="16"
144
- color="#008FD6"
145
- />
146
- </span>
147
- </div>
148
- </template>
149
- </template>
150
- </ui-data-table>
151
-
152
- <div v-if="allRowsCount" class="modal-bottom">
153
- <span class="add-new-button">
154
- <ui-button
155
- variant="text"
156
- is-without-height
157
- is-without-sizes
158
- :disabled="hasEditRow"
159
- test-id="create-new-tag"
160
- @click="onAddNewRow"
161
- >
162
- {{ localization.zabbix.addNew }}...
163
- </ui-button>
164
- </span>
165
- <span class="selected-text">
166
- {{ allRowsCount }} {{ texts.tags }}
167
- </span>
168
- </div>
169
- </div>
170
- </template>
171
- <template #footerLeftContent>
172
- <div class="tags-link">
173
- <ui-button
174
- variant="text"
175
- is-without-height
176
- is-without-sizes
177
- test-id="show-tags-custom-attributes"
178
- @click="onShowDetails"
179
- >
180
- <div class="tags-link-container">
181
- <span class="tags-link-icon">
182
- <ui-icon
183
- name="icon-tags-custom-attributes"
184
- width="20"
185
- height="20"
186
- />
187
- </span>
188
- <span class="tags-link-text">
189
- {{ localization.mainNavigation.tagsCustomAttributes }}
190
- </span>
191
- </div>
192
- </ui-button>
193
- </div>
194
- </template>
195
- </ui-modal>
196
- <common-portlets-tag-create-category
197
- :is-show-modal="isShowCreateCategoryModal"
198
- @cancel="onHideCreateCategoryModal"
199
- @create="onCreateCategory"
200
- />
201
- </div>
202
- </template>
203
-
204
- <script setup lang="ts">
205
- import type {
206
- UI_I_Localization,
207
- UI_I_ArbitraryObject,
208
- } from '~/lib/models/interfaces'
209
- import type {
210
- UI_I_DataTable,
211
- UI_I_DataTableOptions,
212
- UI_I_DataTableBody,
213
- } from '~/node_modules/bfg-uikit/components/ui/dataTable/models/interfaces'
214
- import type { UI_I_ModalTexts } from '~/node_modules/bfg-uikit/components/ui/modal/models/interfaces'
215
- import type { UI_I_Dropdown } from '~/node_modules/bfg-uikit/components/ui/dropdown/models/interfaces'
216
- import type {
217
- I_NewTagData,
218
- I_CreateCategoryData,
219
- } from '~/components/common/portlets/tag/lib/models/interfaces'
220
- import {
221
- tagTableHeaderOptions,
222
- makeNewTagCreateActionRowFunc,
223
- temporaryCategories,
224
- } from '~/components/common/portlets/tag/lib/config/config'
225
-
226
- const props = defineProps<{
227
- isShowModal: boolean
228
- assignData: UI_I_DataTable
229
- selectedItemName: string
230
- }>()
231
-
232
- const onShowDetails = (_id: number): void => {
233
- navigateTo('/tags-attributes/tags')
234
- }
235
-
236
- const options: UI_I_DataTableOptions = tagTableHeaderOptions
237
-
238
- const assignTagTexts = computed<UI_I_ModalTexts>(() => ({
239
- button1: localization.value.common.cancel,
240
- button2: localization.value.common.assign,
241
- }))
242
-
243
- const texts = computed<UI_I_ArbitraryObject<string>>(() => ({
244
- selected: localization.value.common.selected.toLowerCase(),
245
- tags: localization.value.common.tags.toLowerCase(),
246
- }))
247
-
248
- const selectItems = ref<UI_I_Dropdown[]>(useDeepCopy(temporaryCategories))
249
-
250
- const assignDataLocal = ref<UI_I_DataTable>(useDeepCopy(props.assignData))
251
-
252
- watch(
253
- () => props.assignData,
254
- (newValue: UI_I_DataTable) => {
255
- const newDataBody = newValue.body.map((row) => ({
256
- ...row,
257
- isSelected: assignDataLocal.value.body.find((r) => r.row === row.row)
258
- ?.isSelected,
259
- }))
260
-
261
- assignDataLocal.value = { ...newValue, body: newDataBody }
262
- },
263
- { deep: true }
264
- )
265
-
266
- const selectedRowsCount = computed<number>(
267
- () =>
268
- assignDataLocal.value.body.filter(
269
- (row: UI_I_DataTableBody) => row.isSelected
270
- ).length
271
- )
272
-
273
- const allRowsCount = computed<number>(
274
- () =>
275
- assignDataLocal.value.body.filter(
276
- (row: UI_I_DataTableBody) => !row.actionRow
277
- ).length
278
- )
279
-
280
- const onAddNewRow = (): void => {
281
- const rowsIds = assignDataLocal.value.body.map((row) => row.row).sort()
282
- let lastId = rowsIds[rowsIds.length - 1]
283
- lastId = lastId === undefined ? -1 : lastId
284
-
285
- assignDataLocal.value.body.push(makeNewTagCreateActionRowFunc(lastId + 1))
286
- }
287
-
288
- const editData = ref<I_NewTagData>({
289
- tagName: '',
290
- category: '',
291
- description: '',
292
- })
293
-
294
- const isShowValidation = ref<boolean>(false)
295
- const validationData = computed<{
296
- tagName: boolean
297
- category: boolean
298
- }>(() => ({
299
- tagName: !editData.value.tagName.trim(),
300
- category: !editData.value.category.trim(),
301
- }))
302
-
303
- const isShowRequiredFieldsError = computed<boolean>(
304
- () =>
305
- (validationData.value.tagName || validationData.value.category) &&
306
- isShowValidation.value
307
- )
308
-
309
- watch(
310
- validationData,
311
- (newValue: { tagName: boolean; category: boolean }) => {
312
- !newValue.tagName && !newValue.category && (isShowValidation.value = false)
313
- },
314
- { deep: true }
315
- )
316
-
317
- const resetFields = (): void => {
318
- editData.value = {
319
- tagName: '',
320
- category: '',
321
- description: '',
322
- }
323
- }
324
-
325
- const onAddTag = (): void => {
326
- if (validationData.value.tagName || validationData.value.category) {
327
- isShowValidation.value = true
328
- return
329
- }
330
-
331
- const withoutEditRowData = assignDataLocal.value.body.filter(
332
- (row) => !row.actionRow
333
- )
334
-
335
- const rowsIds = withoutEditRowData.map((row) => row.row).sort()
336
- let lastId = rowsIds[rowsIds.length - 1]
337
- lastId = lastId === undefined ? -1 : lastId
338
-
339
- emits('add-new-tag', {
340
- row: lastId + 1,
341
- isSelected: false,
342
- data: [
343
- { col: 0, text: editData.value.tagName },
344
- { col: 1, text: editData.value.category },
345
- { col: 2, text: editData.value.description },
346
- { col: 3, text: '' },
347
- ],
348
- })
349
-
350
- resetFields()
351
- }
352
-
353
- const onHideEditRow = (): void => {
354
- assignDataLocal.value.body = assignDataLocal.value.body.filter(
355
- (row) => !row.actionRow
356
- )
357
- resetFields()
358
- }
359
-
360
- const hasEditRow = computed<boolean>(
361
- () => !!assignDataLocal.value.body.find((row) => row.actionRow)
362
- )
363
-
364
- const onAssign = (): void => {
365
- emits(
366
- 'assign',
367
- assignDataLocal.value.body.filter((row) => row.isSelected)
368
- )
369
- }
370
-
371
- const onGetSelected = (selectedRows: UI_I_DataTableBody[]): void => {
372
- const selectedRowsId = selectedRows.map(
373
- (selectedRow: UI_I_DataTableBody) => selectedRow.row
374
- )
375
- assignDataLocal.value.body = assignDataLocal.value.body.map((row) =>
376
- selectedRowsId.includes(row.row)
377
- ? { ...row, isSelected: true }
378
- : { ...row, isSelected: false }
379
- )
380
- }
381
-
382
- const emits = defineEmits([
383
- 'add',
384
- 'cancel',
385
- 'assign',
386
- 'save',
387
- 'hide',
388
- 'add-new-tag',
389
- 'create-category',
390
- ])
391
- const localization = computed<UI_I_Localization>(() => useLocal())
392
-
393
- const isShowCreateCategoryModal = ref<boolean>(false)
394
- const onShowCreateCategoryModal = (): void => {
395
- isShowCreateCategoryModal.value = true
396
- }
397
- const onHideCreateCategoryModal = (): void => {
398
- isShowCreateCategoryModal.value = false
399
- }
400
-
401
- const onCreateCategory = (data: I_CreateCategoryData): void => {
402
- selectItems.value.push({
403
- text: data.categoryName,
404
- value: data.categoryName.replaceAll(' ', ''),
405
- selected: false,
406
- })
407
- emits('create-category', data)
408
- onHideCreateCategoryModal()
409
- }
410
- </script>
411
-
412
- <style>
413
- :root {
414
- --separator-color: #e9ebed;
415
- --input-border: #d3d6da;
416
- --input-color: #4d5d69;
417
- --input-caret-color: #000000;
418
- --input-bg: #ffffff;
419
- }
420
- :root.dark-theme {
421
- --separator-color: #e9ebed1f;
422
- --input-border: #e9ebed3d;
423
- --input-color: #d3d6da;
424
- --input-caret-color: #ffffff;
425
- --input-bg: transparent;
426
- }
427
- </style>
428
-
429
- <style scoped lang="scss">
430
- .add-new-button {
431
- :deep(button.ui-btn) {
432
- line-height: 16px;
433
- margin: 16px 0;
434
- width: fit-content;
435
- }
436
- }
437
-
438
- .add-tag-modal-container {
439
- :deep(.modal-footer) {
440
- padding: 0 !important;
441
- }
442
- }
443
-
444
- .selected-text {
445
- font-size: 12px;
446
- font-weight: 400;
447
- line-height: 14.52px;
448
- color: #9da6ad;
449
- }
450
- .modal-top {
451
- display: flex;
452
- justify-content: space-between;
453
- align-items: center;
454
- margin-bottom: 12px;
455
-
456
- //&-manager-button {
457
- // display: flex;
458
- // align-items: center;
459
- // column-gap: 0.5px;
460
- // height: 28px;
461
- // border: 1px solid #e9ebed;
462
- // background-color: #ffffff;
463
- // color: #4d5d69;
464
- // font-size: 12px;
465
- // font-weight: 500;
466
- // line-height: 14.52px;
467
- // padding: 6px 8px;
468
- // border-radius: 6px;
469
- // cursor: pointer;
470
- //
471
- // &:hover {
472
- // background: #e9ebed66;
473
- // }
474
- //}
475
- }
476
-
477
- .modal-bottom {
478
- display: flex;
479
- justify-content: space-between;
480
- align-items: center;
481
-
482
- .selected-text {
483
- align-self: flex-start;
484
- padding-top: 8px;
485
- }
486
- }
487
-
488
- .tags-link {
489
- &-text {
490
- font-size: 14px;
491
- font-weight: 500;
492
- line-height: 16.94px;
493
- }
494
- &-icon {
495
- width: 20px;
496
- height: 20px;
497
- }
498
-
499
- &-container {
500
- display: flex;
501
- align-items: center;
502
- column-gap: 8px;
503
- }
504
- }
505
-
506
- .table-input {
507
- height: 28px;
508
- background-color: var(--input-bg);
509
- border: 1px solid var(--input-border);
510
- font-size: 12px;
511
- font-weight: 500;
512
- line-height: 14.52px;
513
- border-radius: 6px;
514
- width: 100%;
515
- padding: 6px 8px;
516
- caret-color: var(--input-caret-color);
517
- color: var(--input-color);
518
-
519
- &::placeholder {
520
- color: #9da6ad;
521
- }
522
-
523
- &:focus,
524
- &:focus-visible {
525
- border: 1px solid #008fd6;
526
- outline: none;
527
- }
528
-
529
- &.table-input-error {
530
- border-color: #ea3223;
531
- }
532
- }
533
-
534
- .category-select {
535
- width: 100%;
536
-
537
- :deep(.ui-select-toggle-button) {
538
- height: 28px;
539
- background-color: var(--input-bg);
540
- }
541
-
542
- :deep(.ui-placeholder) {
543
- font-size: 12px;
544
- }
545
-
546
- :deep(.ui-dropdown) {
547
- max-height: 250px;
548
- overflow-y: auto;
549
-
550
- .ui-dropdown-menu-item {
551
- height: 28px;
552
- margin-bottom: 4px;
553
- .ui-item-text {
554
- font-size: 12px;
555
- }
556
- }
557
- }
558
- }
559
-
560
- .add-category-button {
561
- :deep(.ui-btn) {
562
- height: 28px;
563
- margin-top: 4px;
564
- font-size: 12px;
565
- justify-content: flex-start;
566
- padding-left: 12px;
567
-
568
- span {
569
- font-size: 12px;
570
- }
571
- }
572
- }
573
- .separator-container {
574
- margin: 4px 12px 0;
575
- border-bottom: 1px solid var(--separator-color);
576
- height: 0;
577
- }
578
- </style>
1
+ <template>
2
+ <div class="add-tag-modal-container">
3
+ <ui-modal
4
+ v-if="props.isShowModal"
5
+ :title="localization.common.assignTag"
6
+ :subtitle="props.selectedItemName"
7
+ :texts="assignTagTexts"
8
+ test-id="modal-assign-tag"
9
+ width="720px"
10
+ :is-disabled-accept="!selectedRowsCount"
11
+ @hide="emits('cancel')"
12
+ @submit="onAssign"
13
+ >
14
+ <template #header></template>
15
+ <template #content>
16
+ <div style="padding: 8px 32px 0">
17
+ <div v-if="isShowRequiredFieldsError" style="margin: 8px 0">
18
+ <ui-alert
19
+ :messages="[localization.common.pleaseFillAllRequiredFields]"
20
+ test-id="required-alert"
21
+ simple-error
22
+ />
23
+ </div>
24
+ <div class="modal-top">
25
+ <span class="selected-text">
26
+ {{ selectedRowsCount }} {{ texts.selected }}
27
+ </span>
28
+ </div>
29
+ <ui-data-table
30
+ test-id="assign-tags-data-table"
31
+ :data="assignDataLocal"
32
+ :options="options"
33
+ server-off
34
+ :default-layout="false"
35
+ size="sm"
36
+ @select-row="onGetSelected"
37
+ >
38
+ <template #notFound>
39
+ <div v-if="!allRowsCount" style="margin-top: 12px">
40
+ <ui-button
41
+ variant="text"
42
+ test-id="create-new-tag"
43
+ is-without-height
44
+ is-without-sizes
45
+ :disabled="hasEditRow"
46
+ @click="onAddNewRow"
47
+ >
48
+ {{ localization.zabbix.addNew }}...
49
+ </ui-button>
50
+ </div>
51
+ </template>
52
+ <template #icon="{ item }">
53
+ <template v-if="item.data.type === 'tagName'">
54
+ <input
55
+ v-model="editData.tagName"
56
+ data-id="new-tag-name"
57
+ :class="[
58
+ 'table-input',
59
+ {
60
+ 'table-input-error':
61
+ validationData.tagName && isShowValidation,
62
+ },
63
+ ]"
64
+ :placeholder="localization.common[item.data.type]"
65
+ type="text"
66
+ @click.prevent.stop
67
+ />
68
+ </template>
69
+
70
+ <template v-else-if="item.data.type === 'category'">
71
+ <div class="category-select">
72
+ <ui-select
73
+ v-model="editData.category"
74
+ :items="selectItems"
75
+ :error="validationData.category && isShowValidation"
76
+ :placeholder="localization.common.chooseCategory"
77
+ width="165px"
78
+ select-width="100%"
79
+ :show-text="true"
80
+ size="sm"
81
+ test-id="new-tag-category"
82
+ >
83
+ <template #heading>
84
+ <div class="add-category-button">
85
+ <ui-button
86
+ variant="text"
87
+ is-without-height
88
+ is-without-sizes
89
+ test-id="create-new-tag-category"
90
+ @click="onShowCreateCategoryModal"
91
+ >
92
+ <div
93
+ style="
94
+ display: flex;
95
+ align-items: center;
96
+ height: 28px;
97
+ "
98
+ >
99
+ <ui-icon name="plus" width="16" height="16" />
100
+ <span>{{ localization.common.createNew }}</span>
101
+ </div>
102
+ </ui-button>
103
+ </div>
104
+ <div class="separator-container"></div>
105
+ </template>
106
+ </ui-select>
107
+ </div>
108
+ </template>
109
+ <template v-else-if="item.data.type === 'description'">
110
+ <input
111
+ v-model="editData.description"
112
+ class="table-input"
113
+ :placeholder="localization.common[item.data.type]"
114
+ type="text"
115
+ data-id="new-tag-description"
116
+ @click.prevent.stop
117
+ />
118
+ </template>
119
+ <template v-else-if="item.data.type === 'actions'">
120
+ <div
121
+ style="display: flex; align-items: center; column-gap: 12px"
122
+ >
123
+ <span
124
+ style="cursor: pointer; line-height: 16px"
125
+ data-id="hide-create-new-tag-row"
126
+ @click.prevent.stop="onHideEditRow"
127
+ >
128
+ <ui-icon
129
+ name="close"
130
+ width="16"
131
+ height="16"
132
+ color="#4D5D69"
133
+ />
134
+ </span>
135
+ <span
136
+ style="cursor: pointer; line-height: 16px"
137
+ data-id="create-new-tag-accept"
138
+ @click.prevent.stop="onAddTag"
139
+ >
140
+ <ui-icon
141
+ name="status-check"
142
+ width="16"
143
+ height="16"
144
+ color="#008FD6"
145
+ />
146
+ </span>
147
+ </div>
148
+ </template>
149
+ </template>
150
+ </ui-data-table>
151
+
152
+ <div v-if="allRowsCount" class="modal-bottom">
153
+ <span class="add-new-button">
154
+ <ui-button
155
+ variant="text"
156
+ is-without-height
157
+ is-without-sizes
158
+ :disabled="hasEditRow"
159
+ test-id="create-new-tag"
160
+ @click="onAddNewRow"
161
+ >
162
+ {{ localization.zabbix.addNew }}...
163
+ </ui-button>
164
+ </span>
165
+ <span class="selected-text">
166
+ {{ allRowsCount }} {{ texts.tags }}
167
+ </span>
168
+ </div>
169
+ </div>
170
+ </template>
171
+ <template #footerLeftContent>
172
+ <div class="tags-link">
173
+ <ui-button
174
+ variant="text"
175
+ is-without-height
176
+ is-without-sizes
177
+ test-id="show-tags-custom-attributes"
178
+ @click="onShowDetails"
179
+ >
180
+ <div class="tags-link-container">
181
+ <span class="tags-link-icon">
182
+ <ui-icon
183
+ name="icon-tags-custom-attributes"
184
+ width="20"
185
+ height="20"
186
+ />
187
+ </span>
188
+ <span class="tags-link-text">
189
+ {{ localization.mainNavigation.tagsCustomAttributes }}
190
+ </span>
191
+ </div>
192
+ </ui-button>
193
+ </div>
194
+ </template>
195
+ </ui-modal>
196
+ <common-portlets-tag-create-category
197
+ :is-show-modal="isShowCreateCategoryModal"
198
+ @cancel="onHideCreateCategoryModal"
199
+ @create="onCreateCategory"
200
+ />
201
+ </div>
202
+ </template>
203
+
204
+ <script setup lang="ts">
205
+ import type {
206
+ UI_I_Localization,
207
+ UI_I_ArbitraryObject,
208
+ } from '~/lib/models/interfaces'
209
+ import type {
210
+ UI_I_DataTable,
211
+ UI_I_DataTableOptions,
212
+ UI_I_DataTableBody,
213
+ } from '~/node_modules/bfg-uikit/components/ui/dataTable/models/interfaces'
214
+ import type { UI_I_ModalTexts } from '~/node_modules/bfg-uikit/components/ui/modal/models/interfaces'
215
+ import type { UI_I_Dropdown } from '~/node_modules/bfg-uikit/components/ui/dropdown/models/interfaces'
216
+ import type {
217
+ I_NewTagData,
218
+ I_CreateCategoryData,
219
+ } from '~/components/common/portlets/tag/lib/models/interfaces'
220
+ import {
221
+ tagTableHeaderOptions,
222
+ makeNewTagCreateActionRowFunc,
223
+ temporaryCategories,
224
+ } from '~/components/common/portlets/tag/lib/config/config'
225
+
226
+ const props = defineProps<{
227
+ isShowModal: boolean
228
+ assignData: UI_I_DataTable
229
+ selectedItemName: string
230
+ }>()
231
+
232
+ const onShowDetails = (_id: number): void => {
233
+ navigateTo('/tags-attributes/tags')
234
+ }
235
+
236
+ const options: UI_I_DataTableOptions = tagTableHeaderOptions
237
+
238
+ const assignTagTexts = computed<UI_I_ModalTexts>(() => ({
239
+ button1: localization.value.common.cancel,
240
+ button2: localization.value.common.assign,
241
+ }))
242
+
243
+ const texts = computed<UI_I_ArbitraryObject<string>>(() => ({
244
+ selected: localization.value.common.selected.toLowerCase(),
245
+ tags: localization.value.common.tags.toLowerCase(),
246
+ }))
247
+
248
+ const selectItems = ref<UI_I_Dropdown[]>(useDeepCopy(temporaryCategories))
249
+
250
+ const assignDataLocal = ref<UI_I_DataTable>(useDeepCopy(props.assignData))
251
+
252
+ watch(
253
+ () => props.assignData,
254
+ (newValue: UI_I_DataTable) => {
255
+ const newDataBody = newValue.body.map((row) => ({
256
+ ...row,
257
+ isSelected: assignDataLocal.value.body.find((r) => r.row === row.row)
258
+ ?.isSelected,
259
+ }))
260
+
261
+ assignDataLocal.value = { ...newValue, body: newDataBody }
262
+ },
263
+ { deep: true }
264
+ )
265
+
266
+ const selectedRowsCount = computed<number>(
267
+ () =>
268
+ assignDataLocal.value.body.filter(
269
+ (row: UI_I_DataTableBody) => row.isSelected
270
+ ).length
271
+ )
272
+
273
+ const allRowsCount = computed<number>(
274
+ () =>
275
+ assignDataLocal.value.body.filter(
276
+ (row: UI_I_DataTableBody) => !row.actionRow
277
+ ).length
278
+ )
279
+
280
+ const onAddNewRow = (): void => {
281
+ const rowsIds = assignDataLocal.value.body.map((row) => row.row).sort()
282
+ let lastId = rowsIds[rowsIds.length - 1]
283
+ lastId = lastId === undefined ? -1 : lastId
284
+
285
+ assignDataLocal.value.body.push(makeNewTagCreateActionRowFunc(lastId + 1))
286
+ }
287
+
288
+ const editData = ref<I_NewTagData>({
289
+ tagName: '',
290
+ category: '',
291
+ description: '',
292
+ })
293
+
294
+ const isShowValidation = ref<boolean>(false)
295
+ const validationData = computed<{
296
+ tagName: boolean
297
+ category: boolean
298
+ }>(() => ({
299
+ tagName: !editData.value.tagName.trim(),
300
+ category: !editData.value.category.trim(),
301
+ }))
302
+
303
+ const isShowRequiredFieldsError = computed<boolean>(
304
+ () =>
305
+ (validationData.value.tagName || validationData.value.category) &&
306
+ isShowValidation.value
307
+ )
308
+
309
+ watch(
310
+ validationData,
311
+ (newValue: { tagName: boolean; category: boolean }) => {
312
+ !newValue.tagName && !newValue.category && (isShowValidation.value = false)
313
+ },
314
+ { deep: true }
315
+ )
316
+
317
+ const resetFields = (): void => {
318
+ editData.value = {
319
+ tagName: '',
320
+ category: '',
321
+ description: '',
322
+ }
323
+ }
324
+
325
+ const onAddTag = (): void => {
326
+ if (validationData.value.tagName || validationData.value.category) {
327
+ isShowValidation.value = true
328
+ return
329
+ }
330
+
331
+ const withoutEditRowData = assignDataLocal.value.body.filter(
332
+ (row) => !row.actionRow
333
+ )
334
+
335
+ const rowsIds = withoutEditRowData.map((row) => row.row).sort()
336
+ let lastId = rowsIds[rowsIds.length - 1]
337
+ lastId = lastId === undefined ? -1 : lastId
338
+
339
+ emits('add-new-tag', {
340
+ row: lastId + 1,
341
+ isSelected: false,
342
+ data: [
343
+ { col: 0, text: editData.value.tagName },
344
+ { col: 1, text: editData.value.category },
345
+ { col: 2, text: editData.value.description },
346
+ { col: 3, text: '' },
347
+ ],
348
+ })
349
+
350
+ resetFields()
351
+ }
352
+
353
+ const onHideEditRow = (): void => {
354
+ assignDataLocal.value.body = assignDataLocal.value.body.filter(
355
+ (row) => !row.actionRow
356
+ )
357
+ resetFields()
358
+ }
359
+
360
+ const hasEditRow = computed<boolean>(
361
+ () => !!assignDataLocal.value.body.find((row) => row.actionRow)
362
+ )
363
+
364
+ const onAssign = (): void => {
365
+ emits(
366
+ 'assign',
367
+ assignDataLocal.value.body.filter((row) => row.isSelected)
368
+ )
369
+ }
370
+
371
+ const onGetSelected = (selectedRows: UI_I_DataTableBody[]): void => {
372
+ const selectedRowsId = selectedRows.map(
373
+ (selectedRow: UI_I_DataTableBody) => selectedRow.row
374
+ )
375
+ assignDataLocal.value.body = assignDataLocal.value.body.map((row) =>
376
+ selectedRowsId.includes(row.row)
377
+ ? { ...row, isSelected: true }
378
+ : { ...row, isSelected: false }
379
+ )
380
+ }
381
+
382
+ const emits = defineEmits([
383
+ 'add',
384
+ 'cancel',
385
+ 'assign',
386
+ 'save',
387
+ 'hide',
388
+ 'add-new-tag',
389
+ 'create-category',
390
+ ])
391
+ const localization = computed<UI_I_Localization>(() => useLocal())
392
+
393
+ const isShowCreateCategoryModal = ref<boolean>(false)
394
+ const onShowCreateCategoryModal = (): void => {
395
+ isShowCreateCategoryModal.value = true
396
+ }
397
+ const onHideCreateCategoryModal = (): void => {
398
+ isShowCreateCategoryModal.value = false
399
+ }
400
+
401
+ const onCreateCategory = (data: I_CreateCategoryData): void => {
402
+ selectItems.value.push({
403
+ text: data.categoryName,
404
+ value: data.categoryName.replaceAll(' ', ''),
405
+ selected: false,
406
+ })
407
+ emits('create-category', data)
408
+ onHideCreateCategoryModal()
409
+ }
410
+ </script>
411
+
412
+ <style>
413
+ :root {
414
+ --separator-color: #e9ebed;
415
+ --input-border: #d3d6da;
416
+ --input-color: #4d5d69;
417
+ --input-caret-color: #000000;
418
+ --input-bg: #ffffff;
419
+ }
420
+ :root.dark-theme {
421
+ --separator-color: #e9ebed1f;
422
+ --input-border: #e9ebed3d;
423
+ --input-color: #d3d6da;
424
+ --input-caret-color: #ffffff;
425
+ --input-bg: transparent;
426
+ }
427
+ </style>
428
+
429
+ <style scoped lang="scss">
430
+ .add-new-button {
431
+ :deep(button.ui-btn) {
432
+ line-height: 16px;
433
+ margin: 16px 0;
434
+ width: fit-content;
435
+ }
436
+ }
437
+
438
+ .add-tag-modal-container {
439
+ :deep(.modal-footer) {
440
+ padding: 0 !important;
441
+ }
442
+ }
443
+
444
+ .selected-text {
445
+ font-size: 12px;
446
+ font-weight: 400;
447
+ line-height: 14.52px;
448
+ color: #9da6ad;
449
+ }
450
+ .modal-top {
451
+ display: flex;
452
+ justify-content: space-between;
453
+ align-items: center;
454
+ margin-bottom: 12px;
455
+
456
+ //&-manager-button {
457
+ // display: flex;
458
+ // align-items: center;
459
+ // column-gap: 0.5px;
460
+ // height: 28px;
461
+ // border: 1px solid #e9ebed;
462
+ // background-color: #ffffff;
463
+ // color: #4d5d69;
464
+ // font-size: 12px;
465
+ // font-weight: 500;
466
+ // line-height: 14.52px;
467
+ // padding: 6px 8px;
468
+ // border-radius: 6px;
469
+ // cursor: pointer;
470
+ //
471
+ // &:hover {
472
+ // background: #e9ebed66;
473
+ // }
474
+ //}
475
+ }
476
+
477
+ .modal-bottom {
478
+ display: flex;
479
+ justify-content: space-between;
480
+ align-items: center;
481
+
482
+ .selected-text {
483
+ align-self: flex-start;
484
+ padding-top: 8px;
485
+ }
486
+ }
487
+
488
+ .tags-link {
489
+ &-text {
490
+ font-size: 14px;
491
+ font-weight: 500;
492
+ line-height: 16.94px;
493
+ }
494
+ &-icon {
495
+ width: 20px;
496
+ height: 20px;
497
+ }
498
+
499
+ &-container {
500
+ display: flex;
501
+ align-items: center;
502
+ column-gap: 8px;
503
+ }
504
+ }
505
+
506
+ .table-input {
507
+ height: 28px;
508
+ background-color: var(--input-bg);
509
+ border: 1px solid var(--input-border);
510
+ font-size: 12px;
511
+ font-weight: 500;
512
+ line-height: 14.52px;
513
+ border-radius: 6px;
514
+ width: 100%;
515
+ padding: 6px 8px;
516
+ caret-color: var(--input-caret-color);
517
+ color: var(--input-color);
518
+
519
+ &::placeholder {
520
+ color: #9da6ad;
521
+ }
522
+
523
+ &:focus,
524
+ &:focus-visible {
525
+ border: 1px solid #008fd6;
526
+ outline: none;
527
+ }
528
+
529
+ &.table-input-error {
530
+ border-color: #ea3223;
531
+ }
532
+ }
533
+
534
+ .category-select {
535
+ width: 100%;
536
+
537
+ :deep(.ui-select-toggle-button) {
538
+ height: 28px;
539
+ background-color: var(--input-bg);
540
+ }
541
+
542
+ :deep(.ui-placeholder) {
543
+ font-size: 12px;
544
+ }
545
+
546
+ :deep(.ui-dropdown) {
547
+ max-height: 250px;
548
+ overflow-y: auto;
549
+
550
+ .ui-dropdown-menu-item {
551
+ height: 28px;
552
+ margin-bottom: 4px;
553
+ .ui-item-text {
554
+ font-size: 12px;
555
+ }
556
+ }
557
+ }
558
+ }
559
+
560
+ .add-category-button {
561
+ :deep(.ui-btn) {
562
+ height: 28px;
563
+ margin-top: 4px;
564
+ font-size: 12px;
565
+ justify-content: flex-start;
566
+ padding-left: 12px;
567
+
568
+ span {
569
+ font-size: 12px;
570
+ }
571
+ }
572
+ }
573
+ .separator-container {
574
+ margin: 4px 12px 0;
575
+ border-bottom: 1px solid var(--separator-color);
576
+ height: 0;
577
+ }
578
+ </style>