bfg-common 1.2.113 → 1.2.114

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 (53) hide show
  1. package/assets/localization/local_be.json +3 -1
  2. package/assets/localization/local_en.json +3 -1
  3. package/assets/localization/local_hy.json +3 -1
  4. package/assets/localization/local_kk.json +3 -1
  5. package/assets/localization/local_ru.json +3 -1
  6. package/assets/localization/local_zh.json +3 -1
  7. package/components/atoms/switch/Switch.vue +107 -107
  8. package/components/common/BadBrowser.vue +114 -114
  9. package/components/common/adapterManager/AddAdapterWarningModal.vue +82 -82
  10. package/components/common/adapterManager/NoActiveAdaptersModal.vue +62 -62
  11. package/components/common/adapterManager/NoConnectedActiveAdaptersModal.vue +62 -62
  12. package/components/common/browse/blocks/Title.vue +66 -66
  13. package/components/common/diagramMain/modals/editSettings/tabs/port/IpvFourSettings.vue +339 -339
  14. package/components/common/diagramMain/modals/editSettings/tabs/port/PortProperties.vue +202 -202
  15. package/components/common/diagramMain/modals/remove/RemoveModal.vue +226 -226
  16. package/components/common/feedback/Feedback.vue +261 -261
  17. package/components/common/feedback/VisitPortal.vue +53 -53
  18. package/components/common/help/navbar/left/utils/constructAccordion.ts +27 -27
  19. package/components/common/recursionTree/RecursionTree.vue +201 -201
  20. package/components/common/vm/actions/clone/Clone.vue +545 -545
  21. package/components/common/vm/actions/clone/select/options/Options.vue +65 -65
  22. package/components/common/vm/actions/clone/utils.ts +43 -43
  23. package/components/common/vm/actions/common/customizeHardware/virtualHardware/cpu/CoresPerSocket.vue +109 -109
  24. package/components/common/vm/actions/common/customizeHardware/virtualHardware/cpu/Cpu.vue +383 -383
  25. package/components/common/vm/actions/common/customizeHardware/virtualHardware/limit/Limit.vue +234 -234
  26. package/components/common/vm/actions/common/customizeHardware/virtualHardware/limit/config/options.ts +28 -28
  27. package/components/common/vm/actions/common/customizeHardware/virtualHardware/memory/Memory.vue +316 -316
  28. package/components/common/vm/actions/common/customizeHardware/virtualHardware/memory/config/memoryOptions.ts +35 -35
  29. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newHardDisk/NewHardDisk.vue +447 -447
  30. package/components/common/vm/actions/common/customizeHardware/virtualHardware/reservation/Reservation.vue +235 -235
  31. package/components/common/vm/actions/common/customizeHardware/virtualHardware/videoCard/VideoCard.vue +177 -177
  32. package/components/common/vm/actions/common/customizeHardware/vmoptions/bootOptions/order/Order.vue +197 -197
  33. package/components/common/vm/actions/common/customizeHardware/vmoptions/generalOptions/GeneralOptions.vue +181 -181
  34. package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/CopyPaste.vue +51 -51
  35. package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/RemoteConsoleOptions.vue +253 -253
  36. package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/keymap/Keymap.vue +55 -55
  37. package/components/common/vm/actions/common/select/storage/Storage.vue +194 -194
  38. package/components/common/vm/actions/common/select/storage/config/config.ts +154 -154
  39. package/components/common/wizards/datastore/add/nfs/kerberosAuthentication/KerberosAuthentication.vue +54 -54
  40. package/components/common/wizards/vm/common/Tooltip.vue +13 -5
  41. package/components/common/wizards/vm/migrate/contentHeading/ContentHeading.vue +82 -7
  42. package/components/common/wizards/vm/migrate/contentHeading/models/interfaces.ts +7 -0
  43. package/composables/useLocal.ts +38 -38
  44. package/minify.js +146 -146
  45. package/models/store/interfaces.ts +37 -37
  46. package/models/store/storage/interfaces.ts +32 -32
  47. package/models/store/types.ts +32 -32
  48. package/modules/fixContentBuild/utils/methods.ts +114 -114
  49. package/package.json +1 -1
  50. package/public/spice-console/application/codec.js +257 -257
  51. package/public/spice-console/lib/rasterEngine.js +907 -907
  52. package/public/spice-console/network/spicechannel.js +369 -369
  53. package/utils/contentBuild.ts +34 -34
@@ -1,261 +1,261 @@
1
- <template>
2
- <div v-if="props.show" id="feedbackId" class="modal">
3
- <div
4
- id="feedback-modal-dialog-Id"
5
- :class="['modal-dialog', { imageDrawn: isFeedbackImageDrawn }]"
6
- :style="{
7
- width: computeWidth,
8
- height: computeHeight,
9
- }"
10
- >
11
- <div class="modal-content">
12
- <div class="modal-header">
13
- <div class="flex-align-center">
14
- <h3 class="modal-title">
15
- {{ props.title }}
16
- </h3>
17
- </div>
18
- <button
19
- v-if="!props.isHideCloseIcon"
20
- id="feedback-modal-close-icon"
21
- class="close"
22
- @click="hide"
23
- >
24
- <atoms-the-icon class="close-icon" name="close" />
25
- </button>
26
- </div>
27
-
28
- <common-feedback-buttons v-model:select="type" :items="tabsItems" />
29
- <div class="modal-body">
30
- <common-feedback-message
31
- v-show="type !== 2"
32
- v-model:description="description"
33
- v-model:email="email"
34
- :type="type"
35
- @screen-shot="onScreenShot"
36
- />
37
- <common-feedback-visit-portal v-show="type === 2" />
38
- </div>
39
- <div
40
- :class="{
41
- 'modal-footer': type !== 2,
42
- 'modal-no-footer': type === 2,
43
- }"
44
- >
45
- <button
46
- id="feedback-modal-cancel-button"
47
- class="btn btn-outline"
48
- @click="hide"
49
- >
50
- {{ localization.cancel }}
51
- </button>
52
- <button
53
- class="btn btn-outline"
54
- :class="props.loading && 'modal-dialog__loader'"
55
- :disabled="!description"
56
- @click="submit"
57
- >
58
- <atoms-loader-pre-loader
59
- v-if="props.loading"
60
- id="loader"
61
- class="absolute-center button__loading"
62
- :show="props.loading"
63
- />
64
- <span v-else>
65
- {{ localization.send }}
66
- </span>
67
- </button>
68
- </div>
69
- </div>
70
- </div>
71
- <div class="modal-backdrop" />
72
- </div>
73
- </template>
74
-
75
- <script setup lang="ts">
76
- import { UI_I_Localization } from '~/models/interfaces'
77
- import {
78
- UI_I_FeedbackButtonsItem,
79
- UI_I_FeedbackForm,
80
- UI_I_MessageImg,
81
- } from '~/components/common/feedback/models/interfaces'
82
- import { UI_T_FeedbackType } from '~/components/common/feedback/models/types'
83
- import { feedbackTabs } from '~/components/common/feedback/config/feedbackTabs'
84
-
85
- const props = defineProps<{
86
- show: boolean
87
- title: string
88
- width?: string
89
- height?: string
90
- submitText?: string
91
- loading?: boolean
92
- isHideCloseIcon?: boolean
93
- }>()
94
- const emits = defineEmits<{
95
- (event: 'submit', value: UI_I_FeedbackForm): void
96
- (event: 'hide'): void
97
- }>()
98
-
99
- const localization = computed<UI_I_Localization>(() => useLocal())
100
-
101
- const tabsItems = computed<UI_I_FeedbackButtonsItem[]>(() =>
102
- feedbackTabs(localization.value)
103
- )
104
- const reset = (): void => {
105
- email.value = ''
106
- description.value = ''
107
- type.value = undefined
108
- }
109
- const hide = (): void => {
110
- emits('hide')
111
-
112
- reset()
113
- }
114
-
115
- const submit = (): void => {
116
- if (type.value !== 0 && type.value !== 1) return
117
-
118
- const canvasData = (document.getElementById('feedbackImg') as HTMLCanvasElement).toDataURL()
119
- const canvasBlankData = (document.getElementById('feedbackImgBlank') as HTMLCanvasElement).toDataURL()
120
-
121
- const image = canvasData.match(/base64,(.+)/)?.[1] || ''
122
- emits('submit', {
123
- image: canvasData === canvasBlankData ? '' : image,
124
- type: type.value,
125
- description: description.value,
126
- email: email.value,
127
- })
128
-
129
- reset()
130
- }
131
- const computeWidth = computed<string | undefined>(() =>
132
- isFeedbackImageDrawn.value && type.value !== 2
133
- ? feedbackImageDrawnWidth.value
134
- : props.width
135
- )
136
- const computeHeight = computed<string>(() =>
137
- !isFeedbackImageDrawn.value && type.value !== 2
138
- ? ''
139
- : type.value !== 2
140
- ? '100%'
141
- : '420px'
142
- )
143
- const isFeedbackImageDrawn = ref<boolean>(false)
144
- const feedbackImageDrawnWidth = ref<string>('')
145
- const type = ref<UI_T_FeedbackType>(undefined)
146
- const description = ref<string>('')
147
- const email = ref<string>('')
148
-
149
- const onScreenShot = (value: UI_I_MessageImg): void => {
150
- isFeedbackImageDrawn.value = value.hasTakeScreenshot
151
- feedbackImageDrawnWidth.value = value.width
152
- }
153
- </script>
154
-
155
- <style scoped lang="scss">
156
- .modal {
157
- position: fixed;
158
- top: 0;
159
- bottom: 0;
160
- right: 0;
161
- left: 0;
162
- z-index: 1050;
163
- display: flex;
164
- flex-direction: column;
165
- justify-content: center;
166
- align-items: center;
167
- padding: 48px;
168
- overflow-y: auto;
169
- overflow-x: auto;
170
-
171
- .modal-dialog {
172
- .modal-content {
173
- position: relative;
174
- display: flex;
175
- flex-direction: column;
176
- background-color: var(--modal-bg-color);
177
- box-shadow: 0 5px 15px rgb(0 0 0 / 50%);
178
- border: 1px solid rgba(0, 0, 0, 0.2);
179
- border-radius: 3px;
180
- background-clip: padding-box;
181
- padding: 24px;
182
- height: 100%;
183
- -webkit-animation-name: animateTop;
184
- -webkit-animation-duration: 0.4s;
185
- animation-name: animateTop;
186
- animation-duration: 0.4s;
187
- overflow-x: auto;
188
-
189
- .modal-header {
190
- display: flex;
191
- justify-content: space-between;
192
- align-items: flex-start;
193
-
194
- .modal-title {
195
- color: var(--main-color-mode);
196
- }
197
-
198
- .close-icon {
199
- fill: var(--close-icon);
200
- width: 24px;
201
- height: 24px;
202
- }
203
- }
204
- .modal-info {
205
- display: flex;
206
- flex-direction: row;
207
- align-items: center;
208
- margin-bottom: 20px;
209
-
210
- :deep(.icon-info-standart) {
211
- width: 20px !important;
212
- min-width: 20px !important;
213
- height: 20px;
214
- min-height: 20px;
215
- }
216
- .info-icon {
217
- height: 24px;
218
- }
219
- .info-text {
220
- margin-left: 5px;
221
- }
222
- }
223
- .modal-footer {
224
- align-items: flex-end;
225
- margin-top: auto;
226
- .btn:last-child {
227
- margin-left: 5px;
228
- }
229
- }
230
- .modal-no-footer {
231
- opacity: 0;
232
- width: 200px;
233
- height: 60px;
234
- }
235
- }
236
- &__loader {
237
- position: relative;
238
- pointer-events: none;
239
- }
240
- }
241
-
242
- .modal-backdrop {
243
- opacity: 1;
244
- background-color: rgba(0, 0, 0, 0.6);
245
- }
246
- .button {
247
- &__loading {
248
- display: flex;
249
- :deep(.spinner) {
250
- width: 25px;
251
- height: 25px;
252
- min-width: 25px;
253
- min-height: 25px;
254
- }
255
- }
256
- }
257
- }
258
- .imageDrawn {
259
- width: auto;
260
- }
261
- </style>
1
+ <template>
2
+ <div v-if="props.show" id="feedbackId" class="modal">
3
+ <div
4
+ id="feedback-modal-dialog-Id"
5
+ :class="['modal-dialog', { imageDrawn: isFeedbackImageDrawn }]"
6
+ :style="{
7
+ width: computeWidth,
8
+ height: computeHeight,
9
+ }"
10
+ >
11
+ <div class="modal-content">
12
+ <div class="modal-header">
13
+ <div class="flex-align-center">
14
+ <h3 class="modal-title">
15
+ {{ props.title }}
16
+ </h3>
17
+ </div>
18
+ <button
19
+ v-if="!props.isHideCloseIcon"
20
+ id="feedback-modal-close-icon"
21
+ class="close"
22
+ @click="hide"
23
+ >
24
+ <atoms-the-icon class="close-icon" name="close" />
25
+ </button>
26
+ </div>
27
+
28
+ <common-feedback-buttons v-model:select="type" :items="tabsItems" />
29
+ <div class="modal-body">
30
+ <common-feedback-message
31
+ v-show="type !== 2"
32
+ v-model:description="description"
33
+ v-model:email="email"
34
+ :type="type"
35
+ @screen-shot="onScreenShot"
36
+ />
37
+ <common-feedback-visit-portal v-show="type === 2" />
38
+ </div>
39
+ <div
40
+ :class="{
41
+ 'modal-footer': type !== 2,
42
+ 'modal-no-footer': type === 2,
43
+ }"
44
+ >
45
+ <button
46
+ id="feedback-modal-cancel-button"
47
+ class="btn btn-outline"
48
+ @click="hide"
49
+ >
50
+ {{ localization.cancel }}
51
+ </button>
52
+ <button
53
+ class="btn btn-outline"
54
+ :class="props.loading && 'modal-dialog__loader'"
55
+ :disabled="!description"
56
+ @click="submit"
57
+ >
58
+ <atoms-loader-pre-loader
59
+ v-if="props.loading"
60
+ id="loader"
61
+ class="absolute-center button__loading"
62
+ :show="props.loading"
63
+ />
64
+ <span v-else>
65
+ {{ localization.send }}
66
+ </span>
67
+ </button>
68
+ </div>
69
+ </div>
70
+ </div>
71
+ <div class="modal-backdrop" />
72
+ </div>
73
+ </template>
74
+
75
+ <script setup lang="ts">
76
+ import { UI_I_Localization } from '~/models/interfaces'
77
+ import {
78
+ UI_I_FeedbackButtonsItem,
79
+ UI_I_FeedbackForm,
80
+ UI_I_MessageImg,
81
+ } from '~/components/common/feedback/models/interfaces'
82
+ import { UI_T_FeedbackType } from '~/components/common/feedback/models/types'
83
+ import { feedbackTabs } from '~/components/common/feedback/config/feedbackTabs'
84
+
85
+ const props = defineProps<{
86
+ show: boolean
87
+ title: string
88
+ width?: string
89
+ height?: string
90
+ submitText?: string
91
+ loading?: boolean
92
+ isHideCloseIcon?: boolean
93
+ }>()
94
+ const emits = defineEmits<{
95
+ (event: 'submit', value: UI_I_FeedbackForm): void
96
+ (event: 'hide'): void
97
+ }>()
98
+
99
+ const localization = computed<UI_I_Localization>(() => useLocal())
100
+
101
+ const tabsItems = computed<UI_I_FeedbackButtonsItem[]>(() =>
102
+ feedbackTabs(localization.value)
103
+ )
104
+ const reset = (): void => {
105
+ email.value = ''
106
+ description.value = ''
107
+ type.value = undefined
108
+ }
109
+ const hide = (): void => {
110
+ emits('hide')
111
+
112
+ reset()
113
+ }
114
+
115
+ const submit = (): void => {
116
+ if (type.value !== 0 && type.value !== 1) return
117
+
118
+ const canvasData = (document.getElementById('feedbackImg') as HTMLCanvasElement).toDataURL()
119
+ const canvasBlankData = (document.getElementById('feedbackImgBlank') as HTMLCanvasElement).toDataURL()
120
+
121
+ const image = canvasData.match(/base64,(.+)/)?.[1] || ''
122
+ emits('submit', {
123
+ image: canvasData === canvasBlankData ? '' : image,
124
+ type: type.value,
125
+ description: description.value,
126
+ email: email.value,
127
+ })
128
+
129
+ reset()
130
+ }
131
+ const computeWidth = computed<string | undefined>(() =>
132
+ isFeedbackImageDrawn.value && type.value !== 2
133
+ ? feedbackImageDrawnWidth.value
134
+ : props.width
135
+ )
136
+ const computeHeight = computed<string>(() =>
137
+ !isFeedbackImageDrawn.value && type.value !== 2
138
+ ? ''
139
+ : type.value !== 2
140
+ ? '100%'
141
+ : '420px'
142
+ )
143
+ const isFeedbackImageDrawn = ref<boolean>(false)
144
+ const feedbackImageDrawnWidth = ref<string>('')
145
+ const type = ref<UI_T_FeedbackType>(undefined)
146
+ const description = ref<string>('')
147
+ const email = ref<string>('')
148
+
149
+ const onScreenShot = (value: UI_I_MessageImg): void => {
150
+ isFeedbackImageDrawn.value = value.hasTakeScreenshot
151
+ feedbackImageDrawnWidth.value = value.width
152
+ }
153
+ </script>
154
+
155
+ <style scoped lang="scss">
156
+ .modal {
157
+ position: fixed;
158
+ top: 0;
159
+ bottom: 0;
160
+ right: 0;
161
+ left: 0;
162
+ z-index: 1050;
163
+ display: flex;
164
+ flex-direction: column;
165
+ justify-content: center;
166
+ align-items: center;
167
+ padding: 48px;
168
+ overflow-y: auto;
169
+ overflow-x: auto;
170
+
171
+ .modal-dialog {
172
+ .modal-content {
173
+ position: relative;
174
+ display: flex;
175
+ flex-direction: column;
176
+ background-color: var(--modal-bg-color);
177
+ box-shadow: 0 5px 15px rgb(0 0 0 / 50%);
178
+ border: 1px solid rgba(0, 0, 0, 0.2);
179
+ border-radius: 3px;
180
+ background-clip: padding-box;
181
+ padding: 24px;
182
+ height: 100%;
183
+ -webkit-animation-name: animateTop;
184
+ -webkit-animation-duration: 0.4s;
185
+ animation-name: animateTop;
186
+ animation-duration: 0.4s;
187
+ overflow-x: auto;
188
+
189
+ .modal-header {
190
+ display: flex;
191
+ justify-content: space-between;
192
+ align-items: flex-start;
193
+
194
+ .modal-title {
195
+ color: var(--main-color-mode);
196
+ }
197
+
198
+ .close-icon {
199
+ fill: var(--close-icon);
200
+ width: 24px;
201
+ height: 24px;
202
+ }
203
+ }
204
+ .modal-info {
205
+ display: flex;
206
+ flex-direction: row;
207
+ align-items: center;
208
+ margin-bottom: 20px;
209
+
210
+ :deep(.icon-info-standart) {
211
+ width: 20px !important;
212
+ min-width: 20px !important;
213
+ height: 20px;
214
+ min-height: 20px;
215
+ }
216
+ .info-icon {
217
+ height: 24px;
218
+ }
219
+ .info-text {
220
+ margin-left: 5px;
221
+ }
222
+ }
223
+ .modal-footer {
224
+ align-items: flex-end;
225
+ margin-top: auto;
226
+ .btn:last-child {
227
+ margin-left: 5px;
228
+ }
229
+ }
230
+ .modal-no-footer {
231
+ opacity: 0;
232
+ width: 200px;
233
+ height: 60px;
234
+ }
235
+ }
236
+ &__loader {
237
+ position: relative;
238
+ pointer-events: none;
239
+ }
240
+ }
241
+
242
+ .modal-backdrop {
243
+ opacity: 1;
244
+ background-color: rgba(0, 0, 0, 0.6);
245
+ }
246
+ .button {
247
+ &__loading {
248
+ display: flex;
249
+ :deep(.spinner) {
250
+ width: 25px;
251
+ height: 25px;
252
+ min-width: 25px;
253
+ min-height: 25px;
254
+ }
255
+ }
256
+ }
257
+ }
258
+ .imageDrawn {
259
+ width: auto;
260
+ }
261
+ </style>
@@ -1,53 +1,53 @@
1
- <template>
2
- <div>
3
- <div class="modal-body">
4
- <div>
5
- {{ localization.useOurExternalIdeasPortal }}
6
- </div>
7
- <a id="portal-link" href="https://customer.aobfg.ru/" target="_blank">
8
- <button id="visit-ideas-portal-button" class="btn btn-outline wrap">
9
- <span class="text"> {{ localization.visitIdeasPortal }} </span>
10
- <atoms-the-icon2 class="btn-icon" name="pop-out" />
11
- </button>
12
- </a>
13
- </div>
14
- </div>
15
- </template>
16
-
17
- <script setup lang="ts">
18
- import { UI_I_Localization } from '~/models/interfaces'
19
- const localization = computed<UI_I_Localization>(() => useLocal())
20
- </script>
21
-
22
- <style scoped lang="scss">
23
- .modal-body {
24
- padding: 0;
25
- a {
26
- text-decoration: none;
27
-
28
- .btn.btn-outline.wrap {
29
- display: flex;
30
- flex-direction: row;
31
- align-items: center;
32
-
33
- .text {
34
- color: var(--icon-fill-hover-color);
35
- }
36
- & .btn-icon {
37
- width: 16px;
38
- height: 16px;
39
- margin-left: 5px;
40
- fill: var(--icon-fill-hover-color);
41
- }
42
- }
43
- }
44
- }
45
- </style>
46
- <style>
47
- :root {
48
- --icon-fill-hover-color: rgb(0, 121, 184);
49
- }
50
- :root.dark-theme {
51
- --icon-fill-hover-color: rgb(73, 175, 217);
52
- }
53
- </style>
1
+ <template>
2
+ <div>
3
+ <div class="modal-body">
4
+ <div>
5
+ {{ localization.useOurExternalIdeasPortal }}
6
+ </div>
7
+ <a id="portal-link" href="https://customer.aobfg.ru/" target="_blank">
8
+ <button id="visit-ideas-portal-button" class="btn btn-outline wrap">
9
+ <span class="text"> {{ localization.visitIdeasPortal }} </span>
10
+ <atoms-the-icon2 class="btn-icon" name="pop-out" />
11
+ </button>
12
+ </a>
13
+ </div>
14
+ </div>
15
+ </template>
16
+
17
+ <script setup lang="ts">
18
+ import { UI_I_Localization } from '~/models/interfaces'
19
+ const localization = computed<UI_I_Localization>(() => useLocal())
20
+ </script>
21
+
22
+ <style scoped lang="scss">
23
+ .modal-body {
24
+ padding: 0;
25
+ a {
26
+ text-decoration: none;
27
+
28
+ .btn.btn-outline.wrap {
29
+ display: flex;
30
+ flex-direction: row;
31
+ align-items: center;
32
+
33
+ .text {
34
+ color: var(--icon-fill-hover-color);
35
+ }
36
+ & .btn-icon {
37
+ width: 16px;
38
+ height: 16px;
39
+ margin-left: 5px;
40
+ fill: var(--icon-fill-hover-color);
41
+ }
42
+ }
43
+ }
44
+ }
45
+ </style>
46
+ <style>
47
+ :root {
48
+ --icon-fill-hover-color: rgb(0, 121, 184);
49
+ }
50
+ :root.dark-theme {
51
+ --icon-fill-hover-color: rgb(73, 175, 217);
52
+ }
53
+ </style>
@@ -1,27 +1,27 @@
1
- import type { UI_I_ContentNavigation } from '~/components/common/help/navbar/left/models/interfaces'
2
- import type { UI_I_AccordionRecursion } from '~/components/common/accordion/models/interfaces'
3
-
4
- export const constructItems = (
5
- items?: UI_I_ContentNavigation[],
6
- parent?: UI_I_ContentNavigation
7
- ): UI_I_AccordionRecursion[] => {
8
- if (!items) return []
9
-
10
- return items
11
- .filter((item) => {
12
- return (
13
- !parent || (item.title !== parent.title && item._path !== parent._path)
14
- )
15
- })
16
- .map((item: UI_I_ContentNavigation): UI_I_AccordionRecursion => {
17
- const children = constructItems(item.children, item)
18
- return {
19
- children,
20
- id: item._path,
21
- path: item._path,
22
- name: item.title,
23
- hasChild: !!children.length,
24
- isOpen: !parent,
25
- }
26
- })
27
- }
1
+ import type { UI_I_ContentNavigation } from '~/components/common/help/navbar/left/models/interfaces'
2
+ import type { UI_I_AccordionRecursion } from '~/components/common/accordion/models/interfaces'
3
+
4
+ export const constructItems = (
5
+ items?: UI_I_ContentNavigation[],
6
+ parent?: UI_I_ContentNavigation
7
+ ): UI_I_AccordionRecursion[] => {
8
+ if (!items) return []
9
+
10
+ return items
11
+ .filter((item) => {
12
+ return (
13
+ !parent || (item.title !== parent.title && item._path !== parent._path)
14
+ )
15
+ })
16
+ .map((item: UI_I_ContentNavigation): UI_I_AccordionRecursion => {
17
+ const children = constructItems(item.children, item)
18
+ return {
19
+ children,
20
+ id: item._path,
21
+ path: item._path,
22
+ name: item.title,
23
+ hasChild: !!children.length,
24
+ isOpen: !parent,
25
+ }
26
+ })
27
+ }