bfg-common 1.5.262 → 1.5.264

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 (140) hide show
  1. package/CODE_STYLE.md +109 -109
  2. package/assets/localization/local_be.json +27 -2
  3. package/assets/localization/local_en.json +27 -2
  4. package/assets/localization/local_hy.json +27 -2
  5. package/assets/localization/local_kk.json +27 -2
  6. package/assets/localization/local_ru.json +27 -2
  7. package/assets/localization/local_zh.json +27 -2
  8. package/assets/scss/common/theme.scss +24 -0
  9. package/components/atoms/TheIcon3.vue +50 -50
  10. package/components/atoms/perPage/PerPage.vue +58 -58
  11. package/components/atoms/stack/StackBlock.vue +185 -185
  12. package/components/atoms/table/dataGrid/DataGrid.vue +1717 -1717
  13. package/components/atoms/table/dataGrid/lib/config/settingsTable.ts +94 -94
  14. package/components/atoms/table/dataGrid/lib/utils/export.ts +16 -16
  15. package/components/atoms/table/info/lib/models/interfaces.ts +10 -10
  16. package/components/atoms/tabs/VerticalTabs.vue +105 -105
  17. package/components/common/backup/storage/actions/add/Add.vue +250 -250
  18. package/components/common/backup/storage/actions/add/Old.vue +116 -116
  19. package/components/common/backup/storage/actions/add/lib/config/steps.ts +168 -168
  20. package/components/common/backup/storage/actions/add/steps/hostAccessibility/HostAccessibility.vue +52 -52
  21. package/components/common/backup/storage/actions/add/steps/name/New.vue +102 -102
  22. package/components/common/backup/storage/actions/add/steps/nameAndConfigure/NameAndConfigure.vue +42 -42
  23. package/components/common/backup/storage/actions/add/steps/readyComplete/ReadyComplete.vue +45 -45
  24. package/components/common/backup/storage/actions/add/steps/readyComplete/ReadyCompleteNew.vue +160 -160
  25. package/components/common/backup/storage/actions/add/steps/readyComplete/lib/config/propertiesDetails.ts +243 -243
  26. package/components/common/backup/storage/actions/delete/Delete.vue +65 -65
  27. package/components/common/browse/blocks/contents/filesNew/Skeleton.vue +18 -18
  28. package/components/common/context/lib/models/interfaces.ts +31 -31
  29. package/components/common/diagramMain/DiagramMain.vue +897 -897
  30. package/components/common/diagramMain/Header.vue +214 -214
  31. package/components/common/diagramMain/modals/viewSettings/viewSettings/ViewSettingsOld.vue +1 -1
  32. package/components/common/layout/theHeader/helpMenu/About.vue +82 -82
  33. package/components/common/layout/theHeader/userMenu/modals/preferences/view/ViewOld.vue +112 -112
  34. package/components/common/monitor/overview/OverviewOld.vue +139 -139
  35. package/components/common/pages/home/headline/Headline.vue +45 -45
  36. package/components/common/pages/home/headline/HeadlineOld.vue +42 -42
  37. package/components/common/pages/home/lib/models/interfaces.ts +48 -48
  38. package/components/common/pages/home/widgets/Widgets.vue +49 -49
  39. package/components/common/pages/home/widgets/WidgetsNew.vue +86 -86
  40. package/components/common/pages/home/widgets/WidgetsOld.vue +34 -34
  41. package/components/common/pages/home/widgets/hosts/Hosts.vue +27 -27
  42. package/components/common/pages/home/widgets/hosts/lib/config/items.ts +23 -23
  43. package/components/common/pages/home/widgets/vms/Vms.vue +26 -26
  44. package/components/common/pages/home/widgets/vms/VmsOld.vue +35 -35
  45. package/components/common/pages/home/widgets/vms/lib/config/items.ts +19 -19
  46. package/components/common/pages/licensing/listView/ListView.vue +2 -2
  47. package/components/common/pages/packages/Packages.vue +208 -208
  48. package/components/common/pages/shortcuts/block/BlockOld.vue +68 -68
  49. package/components/common/readyToComplete/ReadyToComplete.vue +17 -17
  50. package/components/common/recursionTree/RecursionTree.vue +223 -223
  51. package/components/common/resource/simple/Simple.vue +2 -2
  52. package/components/common/select/button/ButtonDropdown.vue +108 -108
  53. package/components/common/spiceConsole/Drawer.vue +377 -377
  54. package/components/common/spiceConsole/lib/models/interfaces.ts +5 -5
  55. package/components/common/vm/actions/add/Add.vue +823 -823
  56. package/components/common/vm/actions/add/Old.vue +382 -382
  57. package/components/common/vm/actions/add/folderTreeView/FolderTreeView.vue +72 -72
  58. package/components/common/vm/actions/add/folderTreeView/New.vue +40 -40
  59. package/components/common/vm/actions/add/folderTreeView/Old.vue +50 -50
  60. package/components/common/vm/actions/clone/lib/config/steps.ts +291 -291
  61. package/components/common/vm/actions/clone/toTemplate/lib/config/steps.ts +116 -116
  62. package/components/common/vm/actions/common/customizeHardware/virtualHardware/VirtualHardwareOld.vue +321 -321
  63. package/components/common/vm/actions/common/customizeHardware/virtualHardware/browseView/BrowseView.vue +227 -227
  64. package/components/common/vm/actions/common/customizeHardware/virtualHardware/bus/Bus.vue +100 -100
  65. package/components/common/vm/actions/common/customizeHardware/virtualHardware/cdDvdDrive/CdDvdDrive.vue +232 -232
  66. package/components/common/vm/actions/common/customizeHardware/virtualHardware/cdDvdDrive/CdDvdDriveOld.vue +168 -168
  67. package/components/common/vm/actions/common/customizeHardware/virtualHardware/cdDvdDrive/media/Media.vue +25 -25
  68. package/components/common/vm/actions/common/customizeHardware/virtualHardware/cdDvdDrive/media/MediaNew.vue +78 -78
  69. package/components/common/vm/actions/common/customizeHardware/virtualHardware/cdDvdDrive/media/MediaOld.vue +50 -50
  70. package/components/common/vm/actions/common/customizeHardware/virtualHardware/cpu/shares/Shares.vue +140 -140
  71. package/components/common/vm/actions/common/customizeHardware/virtualHardware/cpu/shares/lib/config/options.ts +28 -28
  72. package/components/common/vm/actions/common/customizeHardware/virtualHardware/cpu/tooltip/TooltipNew.vue +154 -154
  73. package/components/common/vm/actions/common/customizeHardware/virtualHardware/limit/Limit.vue +220 -220
  74. package/components/common/vm/actions/common/customizeHardware/virtualHardware/memory/Memory.vue +307 -307
  75. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newHardDisk/NewHardDisk.vue +385 -385
  76. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newHardDisk/location/Location.vue +154 -154
  77. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newHardDisk/location/LocationNew.vue +75 -75
  78. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newHardDisk/location/LocationOld.vue +85 -85
  79. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newNetwork/NewNetwork.vue +288 -288
  80. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newNetwork/location/new/table/lib/config/config.ts +94 -94
  81. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newNetwork/macAddress/MacAddress.vue +119 -119
  82. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newPciDevice/NewPciDevice.vue +205 -205
  83. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newPciDevice/directPathIo/DirectPathIoNew.vue +66 -66
  84. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newPciDevice/directPathIo/DirectPathIoOld.vue +62 -62
  85. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newPciDevice/dynamicDirectPathIo/DynamicDirectPathIo.vue +31 -31
  86. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newPciDevice/dynamicDirectPathIo/DynamicDirectPathIoOld.vue +76 -76
  87. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newPciDevice/note/Note.vue +15 -15
  88. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newPciDevice/note/NoteNew.vue +42 -42
  89. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newPciDevice/note/NoteOld.vue +30 -30
  90. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newPciDevice/nvidiaGrid/NvidiaGridOld.vue +84 -84
  91. package/components/common/vm/actions/common/customizeHardware/virtualHardware/other/Other.vue +16 -16
  92. package/components/common/vm/actions/common/customizeHardware/virtualHardware/other/inputDevices/InputDevicesNew.vue +40 -40
  93. package/components/common/vm/actions/common/customizeHardware/virtualHardware/videoCard/VideoCard.vue +154 -147
  94. package/components/common/vm/actions/common/customizeHardware/virtualHardware/videoCard/VideoCardNew.vue +2 -1
  95. package/components/common/vm/actions/common/customizeHardware/virtualHardware/videoCard/VideoCardOld.vue +2 -1
  96. package/components/common/vm/actions/common/customizeHardware/virtualHardware/videoCard/numberDisplays/NumberDisplays.vue +53 -53
  97. package/components/common/vm/actions/common/customizeHardware/vmoptions/Vmoptions.vue +145 -145
  98. package/components/common/vm/actions/common/customizeHardware/vmoptions/bootOptions/delay/Delay.vue +32 -32
  99. package/components/common/vm/actions/common/customizeHardware/vmoptions/bootOptions/firmware/Firmware.vue +60 -60
  100. package/components/common/vm/actions/common/customizeHardware/vmoptions/bootOptions/order/Order.vue +174 -174
  101. package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/copyPaste/CopyPasteNew.vue +31 -31
  102. package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/fileTransfer/FileTransferNew.vue +31 -31
  103. package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/keymap/Keymap.vue +32 -32
  104. package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/password/Password.vue +103 -103
  105. package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/password/PasswordNew.vue +128 -128
  106. package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/usbRedirection/UsbRedirection.vue +28 -28
  107. package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/usbRedirection/UsbRedirectionNew.vue +39 -39
  108. package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/usbRedirection/UsbRedirectionOld.vue +44 -44
  109. package/components/common/vm/actions/common/lib/utils/capabilities.ts +52 -52
  110. package/components/common/vm/actions/common/select/compatibility/Old.vue +107 -107
  111. package/components/common/vm/actions/common/select/computeResource/treeView/New.vue +44 -44
  112. package/components/common/vm/actions/common/select/computeResource/treeView/TreeView.vue +118 -118
  113. package/components/common/vm/actions/common/select/createType/CreateType.vue +38 -38
  114. package/components/common/vm/actions/common/select/createType/lib/models/interfaces.ts +5 -5
  115. package/components/common/vm/actions/common/select/name/Name.vue +174 -174
  116. package/components/common/vm/actions/common/select/os/Old.vue +152 -152
  117. package/components/common/vm/actions/common/select/os/Os.vue +139 -139
  118. package/components/common/vm/actions/common/select/storage/new/lib/models/interfaces.ts +5 -5
  119. package/components/common/vm/actions/common/select/storage/new/lib/utils/utils.ts +21 -21
  120. package/components/common/vm/actions/editSettings/new/Skeleton.vue +88 -88
  121. package/components/common/vmt/actions/add/Add.vue +641 -641
  122. package/components/common/vmt/actions/add/lib/config/steps.ts +107 -107
  123. package/components/common/vmt/actions/add/lib/models/interfaces.ts +23 -23
  124. package/components/common/wizards/vm/migrate/lib/config/constructDataReady.ts +220 -220
  125. package/components/common/wizards/vm/migrate/lib/config/steps.ts +157 -157
  126. package/components/common/wizards/vm/migrate/lib/validations.ts +68 -68
  127. package/components/common/wizards/vm/migrate/select/computeResource/tableView/TableView.vue +135 -135
  128. package/components/common/wizards/vm/migrate/select/network/Network.vue +103 -103
  129. package/components/common/wizards/vm/migrate/select/network/table/network/lib/config/advancedTable.ts +91 -91
  130. package/composables/productNameLocal.ts +30 -30
  131. package/composables/useAppVersion.ts +21 -21
  132. package/package.json +2 -2
  133. package/plugins/date.ts +233 -233
  134. package/plugins/panelStates.ts +70 -70
  135. package/plugins/text.ts +59 -59
  136. package/public/spice-console/lib/images/bitmap.js +203 -203
  137. package/public/spice-console/network/spicechannel.js +387 -387
  138. package/store/main/mutations.ts +7 -7
  139. package/store/main/state.ts +7 -7
  140. package/store/tasks/mappers/recentTasks.ts +64 -64
@@ -1,250 +1,250 @@
1
- <template>
2
- <common-backup-storage-actions-add-new
3
- v-if="isNewView"
4
- v-model="form"
5
- :project="props.project"
6
- :wizard="wizard"
7
- :selected-scheme="selectedScheme"
8
- :alert-messages="alertMessages"
9
- :title="title"
10
- :hosts="props.hosts"
11
- :datastore="props.datastore"
12
- :is-datastore-loading="props.isDatastoreLoading"
13
- :get-datastore-table-func="props.getDatastoreTableFunc"
14
- @change-steps="onChangeSteps"
15
- @change-storage="onChangeStorage"
16
- @submit="onCreate"
17
- @hide="onHideModal"
18
- />
19
- <common-backup-storage-actions-add-old
20
- v-else
21
- v-model="form"
22
- :project="props.project"
23
- :wizard="wizard"
24
- :selected-scheme="selectedScheme"
25
- :alert-messages="alertMessages"
26
- :title="title"
27
- :hosts="props.hosts"
28
- :datastore="props.datastore"
29
- :is-datastore-loading="props.isDatastoreLoading"
30
- :get-datastore-table-func="props.getDatastoreTableFunc"
31
- @change-steps="onChangeSteps"
32
- @change-storage="onChangeStorage"
33
- @submit="onCreate"
34
- @hide="onHideModal"
35
- />
36
- </template>
37
-
38
- <script setup lang="ts">
39
- import type { UI_T_Project } from '~/lib/models/types'
40
- import type { UI_I_CreateDatastoreForm } from '~/components/common/backup/storage/actions/add/lib/models/interfaces'
41
- import type { UI_I_DatastoreTableItem } from '~/lib/models/store/storage/interfaces'
42
- import type { UI_I_TablePayload } from '~/lib/models/table/interfaces'
43
- import type { UI_I_Localization } from '~/lib/models/interfaces'
44
- import type {
45
- UI_I_ValidationReturn,
46
- UI_I_WizardStep,
47
- } from '~/components/atoms/wizard/lib/models/interfaces'
48
- import type { UI_T_DatastoreTypeCode } from '~/components/common/backup/storage/actions/add/lib/models/types'
49
- // TODO use from uikit
50
- import Wizard from "~/components/atoms/wizard/lib/utils/utils";
51
- import {
52
- stepsFunc,
53
- stepsSchemeInitial,
54
- } from '~/components/common/backup/storage/actions/add/lib/config/steps'
55
- import { datastoreDefaultFormFunc } from '~/components/common/backup/storage/actions/add/lib/config/createDatastore'
56
- import {
57
- dynamicSteps,
58
- getStepScheme,
59
- } from '~/components/common/backup/storage/actions/add/lib/config/steps'
60
- import * as validation from '~/components/common/backup/storage/actions/add/lib/validations'
61
-
62
- const props = withDefaults(
63
- defineProps<{
64
- project: UI_T_Project
65
- datastore: UI_I_DatastoreTableItem[]
66
- isDatastoreLoading: boolean
67
- getDatastoreTableFunc: (payload: UI_I_TablePayload) => Promise<void>
68
- hosts?: any[]
69
- }>(),
70
- { hosts: [] }
71
- )
72
- const emits = defineEmits<{
73
- (event: 'create', value: UI_I_CreateDatastoreForm): void
74
- (event: 'hide'): void
75
- }>()
76
-
77
- const { $store }: any = useNuxtApp()
78
- const isNewView = computed<boolean>(() => $store.getters['main/getIsNewView'])
79
-
80
- const localization = computed<UI_I_Localization>(() => useLocal())
81
-
82
- const title = ref(localization.value.common.newBackupStorage)
83
-
84
- const wizard: Wizard = new Wizard(
85
- stepsFunc(localization.value),
86
- stepsSchemeInitial
87
- )
88
-
89
- const selectedScheme = computed<number[]>(() => wizard.selectedScheme.value)
90
- const alertMessages = computed<string[][]>(() => wizard.alertMessages.value)
91
-
92
- const form = ref<UI_I_CreateDatastoreForm>(
93
- useDeepCopy(datastoreDefaultFormFunc())
94
- )
95
-
96
- const validationFunc = async (
97
- value: UI_I_WizardStep[],
98
- currentStep: UI_I_WizardStep,
99
- nextStep: UI_I_WizardStep
100
- ): Promise<UI_I_ValidationReturn> => {
101
- let stepHasError = false
102
-
103
- if (
104
- wizard.isValidateForStep(dynamicSteps.name, currentStep.id, nextStep.id)
105
- ) {
106
- const nameValidation = await validation.checkDatastoreNameAsync(
107
- localization.value,
108
- value,
109
- form.value,
110
- dynamicSteps.name,
111
- 'name',
112
- wizard,
113
- props.project
114
- )
115
-
116
- value = nameValidation.newValue
117
-
118
- stepHasError = nameValidation.stepHasError
119
- }
120
-
121
- if (
122
- wizard.isValidateForStep(
123
- dynamicSteps.nameAndConfigure,
124
- currentStep.id,
125
- nextStep.id
126
- )
127
- ) {
128
- const nameValidation = await validation.checkDatastoreNameAsync(
129
- localization.value,
130
- value,
131
- form.value,
132
- dynamicSteps.nameAndConfigure,
133
- 'name',
134
- wizard,
135
- props.project
136
- )
137
- value = nameValidation.newValue
138
-
139
- const folderValidation = validation.checkFolderSync(
140
- localization.value,
141
- form.value.folder,
142
- wizard,
143
- value
144
- )
145
- value = folderValidation.newValue
146
-
147
- const serverValidation = validation.checkServerSync(
148
- localization.value,
149
- form.value.server,
150
- wizard,
151
- value
152
- )
153
- value = serverValidation.newValue
154
-
155
- const usernameValidation = validation.checkUsernameSync(
156
- localization.value,
157
- form.value.user,
158
- wizard,
159
- value
160
- )
161
- value = usernameValidation.newValue
162
-
163
- const passwordValidation = validation.checkPasswordSync(
164
- localization.value,
165
- form.value.password,
166
- wizard,
167
- value
168
- )
169
- value = passwordValidation.newValue
170
-
171
- stepHasError =
172
- nameValidation.stepHasError ||
173
- folderValidation.stepHasError ||
174
- serverValidation.stepHasError ||
175
- usernameValidation.stepHasError ||
176
- passwordValidation.stepHasError
177
- }
178
-
179
- if (
180
- wizard.isValidateForStep(
181
- dynamicSteps.hostAccessibility,
182
- currentStep.id,
183
- nextStep.id
184
- )
185
- ) {
186
- const hostsValidation = await validation.checkHostsAccessibilitySync(
187
- localization.value,
188
- form.value.hosts,
189
- wizard,
190
- value
191
- )
192
-
193
- value = hostsValidation.newValue
194
-
195
- stepHasError = hostsValidation.stepHasError
196
- }
197
-
198
- if (
199
- wizard.isValidateForStep(dynamicSteps.storage, currentStep.id, nextStep.id)
200
- ) {
201
- const storageValidation = await validation.checkStorageSync(
202
- localization.value,
203
- form.value.storm_id,
204
- wizard,
205
- value
206
- )
207
-
208
- value = storageValidation.newValue
209
-
210
- stepHasError = storageValidation.stepHasError
211
- }
212
-
213
- return {
214
- newValue: value,
215
- stepHasError,
216
- }
217
- }
218
-
219
- const onChangeSteps = async (value: UI_I_WizardStep[]): Promise<void> =>
220
- wizard.changeSteps(value, validationFunc)
221
-
222
- // Choosing Scheme
223
- watch(
224
- () => form.value.type_code,
225
- (newValue: UI_T_DatastoreTypeCode) => {
226
- const step = getStepScheme(props.project, newValue)
227
- if (step !== undefined) {
228
- wizard.changeScheme(step)
229
- }
230
- },
231
- { immediate: true }
232
- )
233
-
234
- const onChangeStorage = (storage: UI_I_DatastoreTableItem | null): void => {
235
- if (!storage) return
236
-
237
- form.value.storm_id = storage.id
238
- }
239
-
240
- const onCreate = async (
241
- ): Promise<void> => {
242
- emits('create', form.value)
243
- }
244
-
245
- const onHideModal = (): void => {
246
- emits('hide')
247
- }
248
- </script>
249
-
250
- <style scoped lang="scss"></style>
1
+ <template>
2
+ <common-backup-storage-actions-add-new
3
+ v-if="isNewView"
4
+ v-model="form"
5
+ :project="props.project"
6
+ :wizard="wizard"
7
+ :selected-scheme="selectedScheme"
8
+ :alert-messages="alertMessages"
9
+ :title="title"
10
+ :hosts="props.hosts"
11
+ :datastore="props.datastore"
12
+ :is-datastore-loading="props.isDatastoreLoading"
13
+ :get-datastore-table-func="props.getDatastoreTableFunc"
14
+ @change-steps="onChangeSteps"
15
+ @change-storage="onChangeStorage"
16
+ @submit="onCreate"
17
+ @hide="onHideModal"
18
+ />
19
+ <common-backup-storage-actions-add-old
20
+ v-else
21
+ v-model="form"
22
+ :project="props.project"
23
+ :wizard="wizard"
24
+ :selected-scheme="selectedScheme"
25
+ :alert-messages="alertMessages"
26
+ :title="title"
27
+ :hosts="props.hosts"
28
+ :datastore="props.datastore"
29
+ :is-datastore-loading="props.isDatastoreLoading"
30
+ :get-datastore-table-func="props.getDatastoreTableFunc"
31
+ @change-steps="onChangeSteps"
32
+ @change-storage="onChangeStorage"
33
+ @submit="onCreate"
34
+ @hide="onHideModal"
35
+ />
36
+ </template>
37
+
38
+ <script setup lang="ts">
39
+ import type { UI_T_Project } from '~/lib/models/types'
40
+ import type { UI_I_CreateDatastoreForm } from '~/components/common/backup/storage/actions/add/lib/models/interfaces'
41
+ import type { UI_I_DatastoreTableItem } from '~/lib/models/store/storage/interfaces'
42
+ import type { UI_I_TablePayload } from '~/lib/models/table/interfaces'
43
+ import type { UI_I_Localization } from '~/lib/models/interfaces'
44
+ import type {
45
+ UI_I_ValidationReturn,
46
+ UI_I_WizardStep,
47
+ } from '~/components/atoms/wizard/lib/models/interfaces'
48
+ import type { UI_T_DatastoreTypeCode } from '~/components/common/backup/storage/actions/add/lib/models/types'
49
+ // TODO use from uikit
50
+ import Wizard from "~/components/atoms/wizard/lib/utils/utils";
51
+ import {
52
+ stepsFunc,
53
+ stepsSchemeInitial,
54
+ } from '~/components/common/backup/storage/actions/add/lib/config/steps'
55
+ import { datastoreDefaultFormFunc } from '~/components/common/backup/storage/actions/add/lib/config/createDatastore'
56
+ import {
57
+ dynamicSteps,
58
+ getStepScheme,
59
+ } from '~/components/common/backup/storage/actions/add/lib/config/steps'
60
+ import * as validation from '~/components/common/backup/storage/actions/add/lib/validations'
61
+
62
+ const props = withDefaults(
63
+ defineProps<{
64
+ project: UI_T_Project
65
+ datastore: UI_I_DatastoreTableItem[]
66
+ isDatastoreLoading: boolean
67
+ getDatastoreTableFunc: (payload: UI_I_TablePayload) => Promise<void>
68
+ hosts?: any[]
69
+ }>(),
70
+ { hosts: [] }
71
+ )
72
+ const emits = defineEmits<{
73
+ (event: 'create', value: UI_I_CreateDatastoreForm): void
74
+ (event: 'hide'): void
75
+ }>()
76
+
77
+ const { $store }: any = useNuxtApp()
78
+ const isNewView = computed<boolean>(() => $store.getters['main/getIsNewView'])
79
+
80
+ const localization = computed<UI_I_Localization>(() => useLocal())
81
+
82
+ const title = ref(localization.value.common.newBackupStorage)
83
+
84
+ const wizard: Wizard = new Wizard(
85
+ stepsFunc(localization.value),
86
+ stepsSchemeInitial
87
+ )
88
+
89
+ const selectedScheme = computed<number[]>(() => wizard.selectedScheme.value)
90
+ const alertMessages = computed<string[][]>(() => wizard.alertMessages.value)
91
+
92
+ const form = ref<UI_I_CreateDatastoreForm>(
93
+ useDeepCopy(datastoreDefaultFormFunc())
94
+ )
95
+
96
+ const validationFunc = async (
97
+ value: UI_I_WizardStep[],
98
+ currentStep: UI_I_WizardStep,
99
+ nextStep: UI_I_WizardStep
100
+ ): Promise<UI_I_ValidationReturn> => {
101
+ let stepHasError = false
102
+
103
+ if (
104
+ wizard.isValidateForStep(dynamicSteps.name, currentStep.id, nextStep.id)
105
+ ) {
106
+ const nameValidation = await validation.checkDatastoreNameAsync(
107
+ localization.value,
108
+ value,
109
+ form.value,
110
+ dynamicSteps.name,
111
+ 'name',
112
+ wizard,
113
+ props.project
114
+ )
115
+
116
+ value = nameValidation.newValue
117
+
118
+ stepHasError = nameValidation.stepHasError
119
+ }
120
+
121
+ if (
122
+ wizard.isValidateForStep(
123
+ dynamicSteps.nameAndConfigure,
124
+ currentStep.id,
125
+ nextStep.id
126
+ )
127
+ ) {
128
+ const nameValidation = await validation.checkDatastoreNameAsync(
129
+ localization.value,
130
+ value,
131
+ form.value,
132
+ dynamicSteps.nameAndConfigure,
133
+ 'name',
134
+ wizard,
135
+ props.project
136
+ )
137
+ value = nameValidation.newValue
138
+
139
+ const folderValidation = validation.checkFolderSync(
140
+ localization.value,
141
+ form.value.folder,
142
+ wizard,
143
+ value
144
+ )
145
+ value = folderValidation.newValue
146
+
147
+ const serverValidation = validation.checkServerSync(
148
+ localization.value,
149
+ form.value.server,
150
+ wizard,
151
+ value
152
+ )
153
+ value = serverValidation.newValue
154
+
155
+ const usernameValidation = validation.checkUsernameSync(
156
+ localization.value,
157
+ form.value.user,
158
+ wizard,
159
+ value
160
+ )
161
+ value = usernameValidation.newValue
162
+
163
+ const passwordValidation = validation.checkPasswordSync(
164
+ localization.value,
165
+ form.value.password,
166
+ wizard,
167
+ value
168
+ )
169
+ value = passwordValidation.newValue
170
+
171
+ stepHasError =
172
+ nameValidation.stepHasError ||
173
+ folderValidation.stepHasError ||
174
+ serverValidation.stepHasError ||
175
+ usernameValidation.stepHasError ||
176
+ passwordValidation.stepHasError
177
+ }
178
+
179
+ if (
180
+ wizard.isValidateForStep(
181
+ dynamicSteps.hostAccessibility,
182
+ currentStep.id,
183
+ nextStep.id
184
+ )
185
+ ) {
186
+ const hostsValidation = await validation.checkHostsAccessibilitySync(
187
+ localization.value,
188
+ form.value.hosts,
189
+ wizard,
190
+ value
191
+ )
192
+
193
+ value = hostsValidation.newValue
194
+
195
+ stepHasError = hostsValidation.stepHasError
196
+ }
197
+
198
+ if (
199
+ wizard.isValidateForStep(dynamicSteps.storage, currentStep.id, nextStep.id)
200
+ ) {
201
+ const storageValidation = await validation.checkStorageSync(
202
+ localization.value,
203
+ form.value.storm_id,
204
+ wizard,
205
+ value
206
+ )
207
+
208
+ value = storageValidation.newValue
209
+
210
+ stepHasError = storageValidation.stepHasError
211
+ }
212
+
213
+ return {
214
+ newValue: value,
215
+ stepHasError,
216
+ }
217
+ }
218
+
219
+ const onChangeSteps = async (value: UI_I_WizardStep[]): Promise<void> =>
220
+ wizard.changeSteps(value, validationFunc)
221
+
222
+ // Choosing Scheme
223
+ watch(
224
+ () => form.value.type_code,
225
+ (newValue: UI_T_DatastoreTypeCode) => {
226
+ const step = getStepScheme(props.project, newValue)
227
+ if (step !== undefined) {
228
+ wizard.changeScheme(step)
229
+ }
230
+ },
231
+ { immediate: true }
232
+ )
233
+
234
+ const onChangeStorage = (storage: UI_I_DatastoreTableItem | null): void => {
235
+ if (!storage) return
236
+
237
+ form.value.storm_id = storage.id
238
+ }
239
+
240
+ const onCreate = async (
241
+ ): Promise<void> => {
242
+ emits('create', form.value)
243
+ }
244
+
245
+ const onHideModal = (): void => {
246
+ emits('hide')
247
+ }
248
+ </script>
249
+
250
+ <style scoped lang="scss"></style>