bfg-common 1.5.597 → 1.5.598
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.
- package/assets/localization/local_be.json +1 -1
- package/assets/localization/local_en.json +1 -1
- package/assets/localization/local_hy.json +1 -1
- package/assets/localization/local_kk.json +1 -1
- package/assets/localization/local_ru.json +1 -1
- package/assets/localization/local_zh.json +1 -1
- package/components/common/browse/Browse.vue +12 -28
- package/components/common/vm/actions/register/Register.vue +313 -313
- package/package.json +1 -1
- /package/components/common/browse/{BrowseNew.vue → New.vue} +0 -0
- /package/components/common/browse/{BrowseOld.vue → Old.vue} +0 -0
|
@@ -2507,7 +2507,7 @@
|
|
|
2507
2507
|
"vmtRemoveConfirmationFromInventoryDesc": "Вы ўпэўнены, што хочаце выдаліць шаблон “{0}” з інвентара?",
|
|
2508
2508
|
"toConfirmTypeFieldBelow": "Каб пацвердзіць, увядзіце «{0}» у поле ніжэй.",
|
|
2509
2509
|
"vmRemoveConfirmationFromDiskDesc": "Вы ўпэўнены, што хочаце выдаліць віртуальную машыну «{0}» і яе звязаныя дыскі? Калі іншыя віртуальныя машыны выкарыстоўваюць агульныя дыскі, гэтыя дыскі не будуць выдалены, і ВМ захаваюць да іх доступ.",
|
|
2510
|
-
"vmtRemoveConfirmationFromDiskDesc": "Вы
|
|
2510
|
+
"vmtRemoveConfirmationFromDiskDesc": "Вы ўпэўненыя, што хочаце выдаліць шаблон “{0}”? Гэтая аперацыя назаўсёды выдаляе ўсе файлы, звязаныя з выбраным шаблонам."
|
|
2511
2511
|
},
|
|
2512
2512
|
"auth": {
|
|
2513
2513
|
"welcomeTo": "Сардэчна запрашаем у",
|
|
@@ -2511,7 +2511,7 @@
|
|
|
2511
2511
|
"vmtRemoveConfirmationFromInventoryDesc": "Are you sure you want to remove the template “{0}” from inventory?",
|
|
2512
2512
|
"toConfirmTypeFieldBelow": "To confirm, type “{0}” in the field below.",
|
|
2513
2513
|
"vmRemoveConfirmationFromDiskDesc": "Are you sure you want to delete the virtual machine “{0}” and its associated disks? If other virtual machines are sharing their disks, the shared disks will not be deleted, and the VMs will continue to have access to them.",
|
|
2514
|
-
"vmtRemoveConfirmationFromDiskDesc": "Are you sure you want to delete the template “{0}
|
|
2514
|
+
"vmtRemoveConfirmationFromDiskDesc": "Are you sure you want to delete the template “{0}”? This operation permanently deletes all the files associated with the selected template."
|
|
2515
2515
|
},
|
|
2516
2516
|
"auth": {
|
|
2517
2517
|
"welcomeTo": "Welcome to",
|
|
@@ -2511,7 +2511,7 @@
|
|
|
2511
2511
|
"vmtRemoveConfirmationFromInventoryDesc": "Իսկապե՞ս ուզում եք հեռացնել «{0}» ձևանմուշը գույքագրումից:",
|
|
2512
2512
|
"toConfirmTypeFieldBelow": "Հաստատելու համար մուտքագրեք «{0}» ստորև bulunan դաշտում։",
|
|
2513
2513
|
"vmRemoveConfirmationFromDiskDesc": "Վստահ եք, որ ցանկանում եք ջնջել «{0}» վիրտուալ մեքենան և դրա հետ կապված սկավառակները՞։ Եթե այլ վիրտուալ մեքենաներ կիսում են իրենց սկավառակները, այդ ընդհանուր սկավառակները չեն ջնջվի, և ՎՄ-ները կշարունակեն մուտք ունենալ դրանց։",
|
|
2514
|
-
"vmtRemoveConfirmationFromDiskDesc": "
|
|
2514
|
+
"vmtRemoveConfirmationFromDiskDesc": "Վստա՞հ եք, որ ուզում եք ջնջել “{0}” ձևանմուշը: Այս գործողությունը ընդմիշտ ջնջում է ընտրված ձևանմուշին կապված բոլոր ֆայլերը:"
|
|
2515
2515
|
},
|
|
2516
2516
|
"auth": {
|
|
2517
2517
|
"welcomeTo": "Բարի գալուստ",
|
|
@@ -2510,7 +2510,7 @@
|
|
|
2510
2510
|
"vmtRemoveConfirmationFromInventoryDesc": "«{0}» шаблонын түгендеуден жойғыңыз келе ме?",
|
|
2511
2511
|
"toConfirmTypeFieldBelow": "Растау үшін төмендегі өріске «{0}» теріңіз.",
|
|
2512
2512
|
"vmRemoveConfirmationFromDiskDesc": "«{0}» виртуалды машинасын және оған байланысты дисктерді жойғыңыз келетініне сенімдісіз бе? Егер басқа виртуалды машиналар сол дисктерді ортақ пайдаланса, ортақ дисктер жойылмайды және ВМ-дар оларға қол жеткізуді жалғастырады.",
|
|
2513
|
-
"vmtRemoveConfirmationFromDiskDesc": "
|
|
2513
|
+
"vmtRemoveConfirmationFromDiskDesc": "“{0}” үлгісін шынымен жойғыңыз келе ме? Бұл әрекет таңдалған үлгімен байланысты барлық файлдарды біржола жояды."
|
|
2514
2514
|
},
|
|
2515
2515
|
"auth": {
|
|
2516
2516
|
"welcomeTo": "Қош келдіңіз",
|
|
@@ -2510,7 +2510,7 @@
|
|
|
2510
2510
|
"vmtRemoveConfirmationFromInventoryDesc": "Вы уверены, что хотите удалить шаблон «{0}» из инвентаря?",
|
|
2511
2511
|
"toConfirmTypeFieldBelow": "Для подтверждения введите “{0}” в поле ниже.",
|
|
2512
2512
|
"vmRemoveConfirmationFromDiskDesc": "Вы уверены, что хотите удалить виртуальную машину “{0}” и все связанные с ней диски? Если другие виртуальные машины используют общие диски, эти диски не будут удалены, и виртуальные машины продолжат иметь к ним доступ.",
|
|
2513
|
-
"vmtRemoveConfirmationFromDiskDesc": "Вы уверены, что хотите удалить шаблон
|
|
2513
|
+
"vmtRemoveConfirmationFromDiskDesc": "Вы уверены, что хотите удалить шаблон “{0}”? Эта операция безвозвратно удалит все файлы, связанные с выбранным шаблоном."
|
|
2514
2514
|
},
|
|
2515
2515
|
"auth": {
|
|
2516
2516
|
"welcomeTo": "Добро пожаловать в",
|
|
@@ -2508,7 +2508,7 @@
|
|
|
2508
2508
|
"vmtRemoveConfirmationFromInventoryDesc": "您确定要从库存中删除模板“{0}”吗?",
|
|
2509
2509
|
"toConfirmTypeFieldBelow": "若要确认,请在下方输入“{0}”。",
|
|
2510
2510
|
"vmRemoveConfirmationFromDiskDesc": "您确定要删除虚拟机“{0}”及其关联的磁盘吗?如果其他虚拟机共享这些磁盘,共享磁盘将不会被删除,这些虚拟机仍可访问它们。",
|
|
2511
|
-
"vmtRemoveConfirmationFromDiskDesc": "您确定要删除模板“{0}
|
|
2511
|
+
"vmtRemoveConfirmationFromDiskDesc": "您确定要删除模板“{0}”吗?此操作将永久删除与所选模板关联的所有文件。"
|
|
2512
2512
|
},
|
|
2513
2513
|
"auth": {
|
|
2514
2514
|
"welcomeTo": "欢迎来到",
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
3
|
-
|
|
2
|
+
<component
|
|
3
|
+
:is="currentComponent"
|
|
4
4
|
v-model:selected-file-type="selectedFileTypeLocal"
|
|
5
5
|
:show="props.show"
|
|
6
6
|
:selected-file="props.selectedFile"
|
|
7
7
|
:blocks-width="blocksWidth"
|
|
8
8
|
:first-block-sorting="firstBlockSorting"
|
|
9
9
|
:second-block-sorting="secondBlockSorting"
|
|
10
|
-
:nodes-local-with-loading="nodesLocalWithLoading"
|
|
11
10
|
:files-local="filesLocal"
|
|
12
11
|
:selected-file-type-local="selectedFileTypeLocal"
|
|
13
12
|
:test-id="props.testId"
|
|
@@ -15,31 +14,8 @@
|
|
|
15
14
|
:info="props.info"
|
|
16
15
|
:browse-loading="props.browseLoading"
|
|
17
16
|
:modal-title="modalTitleLocal"
|
|
18
|
-
|
|
19
|
-
@sort-first="onSortFirstBlock"
|
|
20
|
-
@sort-second="onSortSecondBlock"
|
|
21
|
-
@toggle-node="onShowNodes"
|
|
22
|
-
@select-node="onSelectNode"
|
|
23
|
-
@select-file="onSelectFile"
|
|
24
|
-
@submit="emits('submit')"
|
|
25
|
-
@hide="emits('hide')"
|
|
26
|
-
/>
|
|
27
|
-
<common-browse-old
|
|
28
|
-
v-else
|
|
29
|
-
v-model:selected-file-type="selectedFileTypeLocal"
|
|
30
|
-
:show="props.show"
|
|
31
|
-
:selected-file="props.selectedFile"
|
|
32
|
-
:blocks-width="blocksWidth"
|
|
33
|
-
:first-block-sorting="firstBlockSorting"
|
|
34
|
-
:second-block-sorting="secondBlockSorting"
|
|
17
|
+
:nodes-local-with-loading="nodesLocalWithLoading"
|
|
35
18
|
:nodes-local="nodesLocal"
|
|
36
|
-
:files-local="filesLocal"
|
|
37
|
-
:selected-file-type-local="selectedFileTypeLocal"
|
|
38
|
-
:test-id="props.testId"
|
|
39
|
-
:file-types="props.fileTypes"
|
|
40
|
-
:info="props.info"
|
|
41
|
-
:browse-loading="props.browseLoading"
|
|
42
|
-
:modal-title="modalTitleLocal"
|
|
43
19
|
@change-widths="onChangeWidths"
|
|
44
20
|
@sort-first="onSortFirstBlock"
|
|
45
21
|
@sort-second="onSortSecondBlock"
|
|
@@ -98,10 +74,18 @@ const { $recursion, $store }: any = useNuxtApp()
|
|
|
98
74
|
|
|
99
75
|
const localization = computed<UI_I_Localization>(() => useLocal())
|
|
100
76
|
|
|
101
|
-
const modalTitleLocal = computed<string>(
|
|
77
|
+
const modalTitleLocal = computed<string>(
|
|
78
|
+
() => props.modalTitle || localization.value.common.selectFile
|
|
79
|
+
)
|
|
102
80
|
|
|
103
81
|
const isNewView = computed<boolean>(() => $store.getters['main/getIsNewView'])
|
|
104
82
|
|
|
83
|
+
const currentComponent = computed(() =>
|
|
84
|
+
isNewView.value
|
|
85
|
+
? defineAsyncComponent(() => import('./New.vue'))
|
|
86
|
+
: defineAsyncComponent(() => import('./Old.vue'))
|
|
87
|
+
)
|
|
88
|
+
|
|
105
89
|
const nodesLocal = computed<any[]>(() => {
|
|
106
90
|
if (!firstBlockSorting.value[0]) return props.nodes
|
|
107
91
|
|
|
@@ -1,313 +1,313 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<component
|
|
3
|
-
:is="currentComponent"
|
|
4
|
-
v-model="vmForm"
|
|
5
|
-
v-model:location="location"
|
|
6
|
-
:project="props.project"
|
|
7
|
-
:ready-complete-table-info="props.readyCompleteTableInfo"
|
|
8
|
-
:name-request-url="props.nameRequestUrl"
|
|
9
|
-
:wizard="wizard"
|
|
10
|
-
:selected-scheme="selectedScheme"
|
|
11
|
-
:dynamic-steps="dynamicSteps"
|
|
12
|
-
:name-form-submit="nameFormSubmit"
|
|
13
|
-
:name-test-ids="nameTestIds"
|
|
14
|
-
:allowed-location-kinds="allowedLocationKinds"
|
|
15
|
-
:location-description="locationDescription"
|
|
16
|
-
:is-sphere="isSphere"
|
|
17
|
-
:compute-resource-tree-local="computeResourceTreeLocal"
|
|
18
|
-
:compatibility-text="compatibilityText"
|
|
19
|
-
:is-loading-compute-tree="isLoadingComputeTree"
|
|
20
|
-
:compute-resource-alert="computeResourceAlert"
|
|
21
|
-
:location-nodes="props.locationNodes"
|
|
22
|
-
@finish="emits('finish')"
|
|
23
|
-
@hide="emits('hide')"
|
|
24
|
-
@change-steps="onChangeSteps"
|
|
25
|
-
@change-name="onChangeName(...$event)"
|
|
26
|
-
/>
|
|
27
|
-
</template>
|
|
28
|
-
|
|
29
|
-
<script setup lang="ts">
|
|
30
|
-
import type { UI_I_WizardStep } from '~/node_modules/bfg-uikit/components/ui/wizard/lib/models/interfaces'
|
|
31
|
-
import type { UI_I_ValidationReturn } from '~/node_modules/bfg-uikit/components/ui/wizard/lib/models/interfaces'
|
|
32
|
-
import Wizard from '~/node_modules/bfg-uikit/components/ui/wizard/lib/utils/utils'
|
|
33
|
-
import type { UI_I_Localization } from '~/lib/models/interfaces'
|
|
34
|
-
import type { UI_T_Project } from '~/lib/models/types'
|
|
35
|
-
import type { UI_I_TableInfoItem } from '~/components/atoms/table/info/lib/models/interfaces'
|
|
36
|
-
import type { UI_I_TreeNode } from '~/components/common/recursionTree/lib/models/interfaces'
|
|
37
|
-
import type { UI_I_NameTestIds } from '~/components/common/wizards/common/steps/name/lib/models/interfaces'
|
|
38
|
-
import type { UI_T_CompatibilityStatus } from '~/components/common/wizards/common/compatibility/lib/models/types'
|
|
39
|
-
import {
|
|
40
|
-
dynamicSteps,
|
|
41
|
-
stepsFunc,
|
|
42
|
-
stepsSchemeInitial,
|
|
43
|
-
} from '~/components/common/vm/actions/register/lib/config/steps'
|
|
44
|
-
import { allowedLocationKinds } from '~/components/common/vm/actions/register/lib/config'
|
|
45
|
-
|
|
46
|
-
const vmForm = defineModel<any>({ required: true })
|
|
47
|
-
|
|
48
|
-
const props = withDefaults(
|
|
49
|
-
defineProps<{
|
|
50
|
-
project: UI_T_Project
|
|
51
|
-
readyCompleteTableInfo: UI_I_TableInfoItem[]
|
|
52
|
-
nameRequestUrl: string
|
|
53
|
-
isLoadingComputeTree?: boolean // для сферы
|
|
54
|
-
computeResourceAlert?: string[] // для сферы
|
|
55
|
-
dataCenter?: UI_I_TreeNode | null // для сферы
|
|
56
|
-
computeResourceTree?: UI_I_TreeNode[] // для сферы
|
|
57
|
-
locationNodes?: UI_I_TreeNode[] // для сферы
|
|
58
|
-
}>(),
|
|
59
|
-
{
|
|
60
|
-
isLoadingComputeTree: false,
|
|
61
|
-
computeResourceAlert: () => [],
|
|
62
|
-
dataCenter: null,
|
|
63
|
-
computeResourceTree: undefined,
|
|
64
|
-
locationNodes: () => [],
|
|
65
|
-
}
|
|
66
|
-
)
|
|
67
|
-
|
|
68
|
-
const emits = defineEmits<{
|
|
69
|
-
(event: 'finish'): void
|
|
70
|
-
(event: 'hide'): void
|
|
71
|
-
(event: 'select-compute-resource-tree', value: UI_I_TreeNode): void // для сферы
|
|
72
|
-
(
|
|
73
|
-
event: 'get-compute-resource-tree',
|
|
74
|
-
value: { id: string | number; cb: () => void }
|
|
75
|
-
): void // для сферы
|
|
76
|
-
}>()
|
|
77
|
-
|
|
78
|
-
const { $store, $recursion }: any = useNuxtApp()
|
|
79
|
-
|
|
80
|
-
const isNewView = computed<boolean>(() => $store.getters['main/getIsNewView'])
|
|
81
|
-
|
|
82
|
-
const currentComponent = computed(() =>
|
|
83
|
-
isNewView.value
|
|
84
|
-
? defineAsyncComponent(() => import('./New.vue'))
|
|
85
|
-
: defineAsyncComponent(() => import('./Old.vue'))
|
|
86
|
-
)
|
|
87
|
-
|
|
88
|
-
const localization = computed<UI_I_Localization>(() => useLocal())
|
|
89
|
-
const isSphere = computed<boolean>(() => props.project === 'sphere')
|
|
90
|
-
|
|
91
|
-
const location = ref<UI_I_TreeNode | null>(props.dataCenter) // для сферы
|
|
92
|
-
|
|
93
|
-
const wizard: Wizard = new Wizard(
|
|
94
|
-
stepsFunc(localization.value),
|
|
95
|
-
stepsSchemeInitial
|
|
96
|
-
)
|
|
97
|
-
if (isSphere.value) {
|
|
98
|
-
wizard.changeScheme(1)
|
|
99
|
-
wizard.selectStepHard(1)
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
const locationDescription = computed<string>(
|
|
103
|
-
() => localization.value.common.selectLocationVirtualMachine
|
|
104
|
-
)
|
|
105
|
-
|
|
106
|
-
const nameTestIds: UI_I_NameTestIds = {
|
|
107
|
-
name: 'virtual-machine-name',
|
|
108
|
-
helpIcon: 'show-vm-name-help-icon',
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
const selectedScheme = computed<number[]>(() => wizard.selectedScheme.value)
|
|
112
|
-
const onChangeSteps = async (value: UI_I_WizardStep[]): Promise<void> => {
|
|
113
|
-
wizard.changeSteps(value, validationFunc)
|
|
114
|
-
}
|
|
115
|
-
const validationFunc = async (
|
|
116
|
-
value: UI_I_WizardStep[],
|
|
117
|
-
currentStep: UI_I_WizardStep,
|
|
118
|
-
nextStep: UI_I_WizardStep
|
|
119
|
-
): Promise<UI_I_ValidationReturn> => {
|
|
120
|
-
let stepHasError = false
|
|
121
|
-
let stepShouldStop = {
|
|
122
|
-
ifOnCurrentStep: false,
|
|
123
|
-
ifFromAnyStep: false,
|
|
124
|
-
stoppageStepId: -1,
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
wizard.setLoader(true)
|
|
128
|
-
if (
|
|
129
|
-
wizard.isValidateForStep(
|
|
130
|
-
isSphere.value ? dynamicSteps.selectNameFolder : dynamicSteps.selectName,
|
|
131
|
-
currentStep.id,
|
|
132
|
-
nextStep.id
|
|
133
|
-
)
|
|
134
|
-
) {
|
|
135
|
-
const nameValidation = await onCheckName(value)
|
|
136
|
-
|
|
137
|
-
value = nameValidation.newValue
|
|
138
|
-
stepHasError = stepHasError || nameValidation.stepHasError
|
|
139
|
-
} else if (
|
|
140
|
-
isSphere.value &&
|
|
141
|
-
wizard.isValidateForStep(
|
|
142
|
-
dynamicSteps.selectComputeResource,
|
|
143
|
-
currentStep.id,
|
|
144
|
-
nextStep.id
|
|
145
|
-
)
|
|
146
|
-
) {
|
|
147
|
-
const computeResourceValidation = await checkComputeResource(value)
|
|
148
|
-
|
|
149
|
-
value = computeResourceValidation.newValue
|
|
150
|
-
stepHasError = stepHasError || computeResourceValidation.stepHasError
|
|
151
|
-
}
|
|
152
|
-
wizard.setLoader(false)
|
|
153
|
-
|
|
154
|
-
return {
|
|
155
|
-
newValue: value,
|
|
156
|
-
stepHasError,
|
|
157
|
-
stepShouldStop,
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
const nameFormSubmit = ref<null | Function>(null)
|
|
162
|
-
const onCheckName = async (
|
|
163
|
-
value: UI_I_WizardStep[]
|
|
164
|
-
): Promise<UI_I_ValidationReturn> => {
|
|
165
|
-
let stepHasError = false
|
|
166
|
-
|
|
167
|
-
return new Promise((resolve) => {
|
|
168
|
-
const step = isSphere.value
|
|
169
|
-
? dynamicSteps.selectNameFolder
|
|
170
|
-
: dynamicSteps.selectName
|
|
171
|
-
nameFormSubmit.value = (isValid: boolean) => {
|
|
172
|
-
if (!isValid) {
|
|
173
|
-
stepHasError = wizard.setValidation(step, 'name', {
|
|
174
|
-
fieldMessage: 'aaa',
|
|
175
|
-
alertMessage: 'aaa',
|
|
176
|
-
})
|
|
177
|
-
} else if (wizard.hasMessage(step, 'name')) {
|
|
178
|
-
value = wizard.removeValidation(step, 'name', value)
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
resolve({
|
|
182
|
-
stepHasError,
|
|
183
|
-
newValue: value,
|
|
184
|
-
})
|
|
185
|
-
nameFormSubmit.value = null
|
|
186
|
-
}
|
|
187
|
-
})
|
|
188
|
-
}
|
|
189
|
-
const compatibilityText = computed<[UI_T_CompatibilityStatus, string]>(() => {
|
|
190
|
-
const { computeResource } = vmForm.value
|
|
191
|
-
|
|
192
|
-
if (!computeResource)
|
|
193
|
-
return [
|
|
194
|
-
'none',
|
|
195
|
-
localization.value.vmWizard.noDestinationComputeResourceSelected,
|
|
196
|
-
]
|
|
197
|
-
|
|
198
|
-
let res: [UI_T_CompatibilityStatus, string] = [
|
|
199
|
-
'success',
|
|
200
|
-
localization.value.common.compatibilityChecksSucceeded,
|
|
201
|
-
]
|
|
202
|
-
|
|
203
|
-
if (!['cluster', 'host', 'resource_pool'].includes(computeResource?.type)) {
|
|
204
|
-
res = [
|
|
205
|
-
'error',
|
|
206
|
-
localization.value.common.selectValidClusterOrHostDestination,
|
|
207
|
-
]
|
|
208
|
-
}
|
|
209
|
-
if (computeResource?.type === 'cluster') {
|
|
210
|
-
const hasHost = !!computeResource.nodes.length
|
|
211
|
-
if (!hasHost) {
|
|
212
|
-
res = ['error', localization.value.common.clusterNotContainAnyHosts]
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
if (computeResource?.type === 'host') {
|
|
217
|
-
if (computeResource.state === 'Error') {
|
|
218
|
-
// TODO check Maintenance Mode
|
|
219
|
-
res = [
|
|
220
|
-
'error',
|
|
221
|
-
localization.value.common.selectedHostDisconnectedMaintenanceMode,
|
|
222
|
-
]
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
return res
|
|
227
|
-
})
|
|
228
|
-
const computeResourceAlert = ref<string[]>([])
|
|
229
|
-
const checkComputeResource = (
|
|
230
|
-
value: UI_I_WizardStep[]
|
|
231
|
-
): UI_I_ValidationReturn => {
|
|
232
|
-
let stepHasError = false
|
|
233
|
-
|
|
234
|
-
const { computeResource } = vmForm.value
|
|
235
|
-
|
|
236
|
-
if (
|
|
237
|
-
!computeResource ||
|
|
238
|
-
// compatibilityText.value[0] !== 1 ||
|
|
239
|
-
computeResource.type === 'datacenter' ||
|
|
240
|
-
computeResource.type === 'folder' ||
|
|
241
|
-
(computeResource.type === 'cluster' && !computeResource.nodes.length)
|
|
242
|
-
) {
|
|
243
|
-
computeResourceAlert.value = [
|
|
244
|
-
localization.value.common.specifyValidClusterOrHostDestination,
|
|
245
|
-
]
|
|
246
|
-
stepHasError = wizard.setValidation(
|
|
247
|
-
dynamicSteps.selectComputeResource,
|
|
248
|
-
'computeResource',
|
|
249
|
-
{
|
|
250
|
-
fieldMessage: 'aaa',
|
|
251
|
-
alertMessage: 'aaa',
|
|
252
|
-
}
|
|
253
|
-
)
|
|
254
|
-
} else {
|
|
255
|
-
computeResourceAlert.value = []
|
|
256
|
-
if (
|
|
257
|
-
wizard.hasMessage(dynamicSteps.selectComputeResource, 'computeResource')
|
|
258
|
-
) {
|
|
259
|
-
value = wizard.removeValidation(
|
|
260
|
-
dynamicSteps.selectComputeResource,
|
|
261
|
-
'computeResource',
|
|
262
|
-
value
|
|
263
|
-
)
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
return {
|
|
268
|
-
stepHasError,
|
|
269
|
-
newValue: value,
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
const isLoadingComputeTree = ref<boolean>(false)
|
|
274
|
-
const onChangeName = (name: string, node: UI_I_TreeNode | null): void => {
|
|
275
|
-
vmForm.value.name = name
|
|
276
|
-
if (isSphere.value) {
|
|
277
|
-
vmForm.value.locationPath = node.id
|
|
278
|
-
vmForm.value.dataCenter = $recursion.findParentByValue(
|
|
279
|
-
node,
|
|
280
|
-
'datacenter',
|
|
281
|
-
'type',
|
|
282
|
-
'parent'
|
|
283
|
-
)
|
|
284
|
-
isLoadingComputeTree.value = true
|
|
285
|
-
emits('get-compute-resource-tree', {
|
|
286
|
-
id: node.id,
|
|
287
|
-
cb: () => {
|
|
288
|
-
isLoadingComputeTree.value = false
|
|
289
|
-
},
|
|
290
|
-
})
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
watch(
|
|
295
|
-
() => vmForm.value.computeResource,
|
|
296
|
-
(newValue, oldValue) => {
|
|
297
|
-
if (newValue && newValue.id !== oldValue?.id) {
|
|
298
|
-
onSelectComputeResourceTree(newValue)
|
|
299
|
-
}
|
|
300
|
-
},
|
|
301
|
-
{ deep: true }
|
|
302
|
-
)
|
|
303
|
-
const onSelectComputeResourceTree = (node: UI_I_TreeNode): void => {
|
|
304
|
-
emits('select-compute-resource-tree', node)
|
|
305
|
-
}
|
|
306
|
-
|
|
307
|
-
const computeResourceTreeLocal = computed<UI_I_TreeNode | null>(() => {
|
|
308
|
-
// для сферы
|
|
309
|
-
return props.computeResourceTree?.[0] || null
|
|
310
|
-
})
|
|
311
|
-
</script>
|
|
312
|
-
|
|
313
|
-
<style scoped lang="scss"></style>
|
|
1
|
+
<template>
|
|
2
|
+
<component
|
|
3
|
+
:is="currentComponent"
|
|
4
|
+
v-model="vmForm"
|
|
5
|
+
v-model:location="location"
|
|
6
|
+
:project="props.project"
|
|
7
|
+
:ready-complete-table-info="props.readyCompleteTableInfo"
|
|
8
|
+
:name-request-url="props.nameRequestUrl"
|
|
9
|
+
:wizard="wizard"
|
|
10
|
+
:selected-scheme="selectedScheme"
|
|
11
|
+
:dynamic-steps="dynamicSteps"
|
|
12
|
+
:name-form-submit="nameFormSubmit"
|
|
13
|
+
:name-test-ids="nameTestIds"
|
|
14
|
+
:allowed-location-kinds="allowedLocationKinds"
|
|
15
|
+
:location-description="locationDescription"
|
|
16
|
+
:is-sphere="isSphere"
|
|
17
|
+
:compute-resource-tree-local="computeResourceTreeLocal"
|
|
18
|
+
:compatibility-text="compatibilityText"
|
|
19
|
+
:is-loading-compute-tree="isLoadingComputeTree"
|
|
20
|
+
:compute-resource-alert="computeResourceAlert"
|
|
21
|
+
:location-nodes="props.locationNodes"
|
|
22
|
+
@finish="emits('finish')"
|
|
23
|
+
@hide="emits('hide')"
|
|
24
|
+
@change-steps="onChangeSteps"
|
|
25
|
+
@change-name="onChangeName(...$event)"
|
|
26
|
+
/>
|
|
27
|
+
</template>
|
|
28
|
+
|
|
29
|
+
<script setup lang="ts">
|
|
30
|
+
import type { UI_I_WizardStep } from '~/node_modules/bfg-uikit/components/ui/wizard/lib/models/interfaces'
|
|
31
|
+
import type { UI_I_ValidationReturn } from '~/node_modules/bfg-uikit/components/ui/wizard/lib/models/interfaces'
|
|
32
|
+
import Wizard from '~/node_modules/bfg-uikit/components/ui/wizard/lib/utils/utils'
|
|
33
|
+
import type { UI_I_Localization } from '~/lib/models/interfaces'
|
|
34
|
+
import type { UI_T_Project } from '~/lib/models/types'
|
|
35
|
+
import type { UI_I_TableInfoItem } from '~/components/atoms/table/info/lib/models/interfaces'
|
|
36
|
+
import type { UI_I_TreeNode } from '~/components/common/recursionTree/lib/models/interfaces'
|
|
37
|
+
import type { UI_I_NameTestIds } from '~/components/common/wizards/common/steps/name/lib/models/interfaces'
|
|
38
|
+
import type { UI_T_CompatibilityStatus } from '~/components/common/wizards/common/compatibility/lib/models/types'
|
|
39
|
+
import {
|
|
40
|
+
dynamicSteps,
|
|
41
|
+
stepsFunc,
|
|
42
|
+
stepsSchemeInitial,
|
|
43
|
+
} from '~/components/common/vm/actions/register/lib/config/steps'
|
|
44
|
+
import { allowedLocationKinds } from '~/components/common/vm/actions/register/lib/config'
|
|
45
|
+
|
|
46
|
+
const vmForm = defineModel<any>({ required: true })
|
|
47
|
+
|
|
48
|
+
const props = withDefaults(
|
|
49
|
+
defineProps<{
|
|
50
|
+
project: UI_T_Project
|
|
51
|
+
readyCompleteTableInfo: UI_I_TableInfoItem[]
|
|
52
|
+
nameRequestUrl: string
|
|
53
|
+
isLoadingComputeTree?: boolean // для сферы
|
|
54
|
+
computeResourceAlert?: string[] // для сферы
|
|
55
|
+
dataCenter?: UI_I_TreeNode | null // для сферы
|
|
56
|
+
computeResourceTree?: UI_I_TreeNode[] // для сферы
|
|
57
|
+
locationNodes?: UI_I_TreeNode[] // для сферы
|
|
58
|
+
}>(),
|
|
59
|
+
{
|
|
60
|
+
isLoadingComputeTree: false,
|
|
61
|
+
computeResourceAlert: () => [],
|
|
62
|
+
dataCenter: null,
|
|
63
|
+
computeResourceTree: undefined,
|
|
64
|
+
locationNodes: () => [],
|
|
65
|
+
}
|
|
66
|
+
)
|
|
67
|
+
|
|
68
|
+
const emits = defineEmits<{
|
|
69
|
+
(event: 'finish'): void
|
|
70
|
+
(event: 'hide'): void
|
|
71
|
+
(event: 'select-compute-resource-tree', value: UI_I_TreeNode): void // для сферы
|
|
72
|
+
(
|
|
73
|
+
event: 'get-compute-resource-tree',
|
|
74
|
+
value: { id: string | number; cb: () => void }
|
|
75
|
+
): void // для сферы
|
|
76
|
+
}>()
|
|
77
|
+
|
|
78
|
+
const { $store, $recursion }: any = useNuxtApp()
|
|
79
|
+
|
|
80
|
+
const isNewView = computed<boolean>(() => $store.getters['main/getIsNewView'])
|
|
81
|
+
|
|
82
|
+
const currentComponent = computed(() =>
|
|
83
|
+
isNewView.value
|
|
84
|
+
? defineAsyncComponent(() => import('./New.vue'))
|
|
85
|
+
: defineAsyncComponent(() => import('./Old.vue'))
|
|
86
|
+
)
|
|
87
|
+
|
|
88
|
+
const localization = computed<UI_I_Localization>(() => useLocal())
|
|
89
|
+
const isSphere = computed<boolean>(() => props.project === 'sphere')
|
|
90
|
+
|
|
91
|
+
const location = ref<UI_I_TreeNode | null>(props.dataCenter) // для сферы
|
|
92
|
+
|
|
93
|
+
const wizard: Wizard = new Wizard(
|
|
94
|
+
stepsFunc(localization.value),
|
|
95
|
+
stepsSchemeInitial
|
|
96
|
+
)
|
|
97
|
+
if (isSphere.value) {
|
|
98
|
+
wizard.changeScheme(1)
|
|
99
|
+
wizard.selectStepHard(1)
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
const locationDescription = computed<string>(
|
|
103
|
+
() => localization.value.common.selectLocationVirtualMachine
|
|
104
|
+
)
|
|
105
|
+
|
|
106
|
+
const nameTestIds: UI_I_NameTestIds = {
|
|
107
|
+
name: 'virtual-machine-name',
|
|
108
|
+
helpIcon: 'show-vm-name-help-icon',
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
const selectedScheme = computed<number[]>(() => wizard.selectedScheme.value)
|
|
112
|
+
const onChangeSteps = async (value: UI_I_WizardStep[]): Promise<void> => {
|
|
113
|
+
wizard.changeSteps(value, validationFunc)
|
|
114
|
+
}
|
|
115
|
+
const validationFunc = async (
|
|
116
|
+
value: UI_I_WizardStep[],
|
|
117
|
+
currentStep: UI_I_WizardStep,
|
|
118
|
+
nextStep: UI_I_WizardStep
|
|
119
|
+
): Promise<UI_I_ValidationReturn> => {
|
|
120
|
+
let stepHasError = false
|
|
121
|
+
let stepShouldStop = {
|
|
122
|
+
ifOnCurrentStep: false,
|
|
123
|
+
ifFromAnyStep: false,
|
|
124
|
+
stoppageStepId: -1,
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
wizard.setLoader(true)
|
|
128
|
+
if (
|
|
129
|
+
wizard.isValidateForStep(
|
|
130
|
+
isSphere.value ? dynamicSteps.selectNameFolder : dynamicSteps.selectName,
|
|
131
|
+
currentStep.id,
|
|
132
|
+
nextStep.id
|
|
133
|
+
)
|
|
134
|
+
) {
|
|
135
|
+
const nameValidation = await onCheckName(value)
|
|
136
|
+
|
|
137
|
+
value = nameValidation.newValue
|
|
138
|
+
stepHasError = stepHasError || nameValidation.stepHasError
|
|
139
|
+
} else if (
|
|
140
|
+
isSphere.value &&
|
|
141
|
+
wizard.isValidateForStep(
|
|
142
|
+
dynamicSteps.selectComputeResource,
|
|
143
|
+
currentStep.id,
|
|
144
|
+
nextStep.id
|
|
145
|
+
)
|
|
146
|
+
) {
|
|
147
|
+
const computeResourceValidation = await checkComputeResource(value)
|
|
148
|
+
|
|
149
|
+
value = computeResourceValidation.newValue
|
|
150
|
+
stepHasError = stepHasError || computeResourceValidation.stepHasError
|
|
151
|
+
}
|
|
152
|
+
wizard.setLoader(false)
|
|
153
|
+
|
|
154
|
+
return {
|
|
155
|
+
newValue: value,
|
|
156
|
+
stepHasError,
|
|
157
|
+
stepShouldStop,
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
const nameFormSubmit = ref<null | Function>(null)
|
|
162
|
+
const onCheckName = async (
|
|
163
|
+
value: UI_I_WizardStep[]
|
|
164
|
+
): Promise<UI_I_ValidationReturn> => {
|
|
165
|
+
let stepHasError = false
|
|
166
|
+
|
|
167
|
+
return new Promise((resolve) => {
|
|
168
|
+
const step = isSphere.value
|
|
169
|
+
? dynamicSteps.selectNameFolder
|
|
170
|
+
: dynamicSteps.selectName
|
|
171
|
+
nameFormSubmit.value = (isValid: boolean) => {
|
|
172
|
+
if (!isValid) {
|
|
173
|
+
stepHasError = wizard.setValidation(step, 'name', {
|
|
174
|
+
fieldMessage: 'aaa',
|
|
175
|
+
alertMessage: 'aaa',
|
|
176
|
+
})
|
|
177
|
+
} else if (wizard.hasMessage(step, 'name')) {
|
|
178
|
+
value = wizard.removeValidation(step, 'name', value)
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
resolve({
|
|
182
|
+
stepHasError,
|
|
183
|
+
newValue: value,
|
|
184
|
+
})
|
|
185
|
+
nameFormSubmit.value = null
|
|
186
|
+
}
|
|
187
|
+
})
|
|
188
|
+
}
|
|
189
|
+
const compatibilityText = computed<[UI_T_CompatibilityStatus, string]>(() => {
|
|
190
|
+
const { computeResource } = vmForm.value
|
|
191
|
+
|
|
192
|
+
if (!computeResource)
|
|
193
|
+
return [
|
|
194
|
+
'none',
|
|
195
|
+
localization.value.vmWizard.noDestinationComputeResourceSelected,
|
|
196
|
+
]
|
|
197
|
+
|
|
198
|
+
let res: [UI_T_CompatibilityStatus, string] = [
|
|
199
|
+
'success',
|
|
200
|
+
localization.value.common.compatibilityChecksSucceeded,
|
|
201
|
+
]
|
|
202
|
+
|
|
203
|
+
if (!['cluster', 'host', 'resource_pool'].includes(computeResource?.type)) {
|
|
204
|
+
res = [
|
|
205
|
+
'error',
|
|
206
|
+
localization.value.common.selectValidClusterOrHostDestination,
|
|
207
|
+
]
|
|
208
|
+
}
|
|
209
|
+
if (computeResource?.type === 'cluster') {
|
|
210
|
+
const hasHost = !!computeResource.nodes.length
|
|
211
|
+
if (!hasHost) {
|
|
212
|
+
res = ['error', localization.value.common.clusterNotContainAnyHosts]
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
if (computeResource?.type === 'host') {
|
|
217
|
+
if (computeResource.state === 'Error') {
|
|
218
|
+
// TODO check Maintenance Mode
|
|
219
|
+
res = [
|
|
220
|
+
'error',
|
|
221
|
+
localization.value.common.selectedHostDisconnectedMaintenanceMode,
|
|
222
|
+
]
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
return res
|
|
227
|
+
})
|
|
228
|
+
const computeResourceAlert = ref<string[]>([])
|
|
229
|
+
const checkComputeResource = (
|
|
230
|
+
value: UI_I_WizardStep[]
|
|
231
|
+
): UI_I_ValidationReturn => {
|
|
232
|
+
let stepHasError = false
|
|
233
|
+
|
|
234
|
+
const { computeResource } = vmForm.value
|
|
235
|
+
|
|
236
|
+
if (
|
|
237
|
+
!computeResource ||
|
|
238
|
+
// compatibilityText.value[0] !== 1 ||
|
|
239
|
+
computeResource.type === 'datacenter' ||
|
|
240
|
+
computeResource.type === 'folder' ||
|
|
241
|
+
(computeResource.type === 'cluster' && !computeResource.nodes.length)
|
|
242
|
+
) {
|
|
243
|
+
computeResourceAlert.value = [
|
|
244
|
+
localization.value.common.specifyValidClusterOrHostDestination,
|
|
245
|
+
]
|
|
246
|
+
stepHasError = wizard.setValidation(
|
|
247
|
+
dynamicSteps.selectComputeResource,
|
|
248
|
+
'computeResource',
|
|
249
|
+
{
|
|
250
|
+
fieldMessage: 'aaa',
|
|
251
|
+
alertMessage: 'aaa',
|
|
252
|
+
}
|
|
253
|
+
)
|
|
254
|
+
} else {
|
|
255
|
+
computeResourceAlert.value = []
|
|
256
|
+
if (
|
|
257
|
+
wizard.hasMessage(dynamicSteps.selectComputeResource, 'computeResource')
|
|
258
|
+
) {
|
|
259
|
+
value = wizard.removeValidation(
|
|
260
|
+
dynamicSteps.selectComputeResource,
|
|
261
|
+
'computeResource',
|
|
262
|
+
value
|
|
263
|
+
)
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
return {
|
|
268
|
+
stepHasError,
|
|
269
|
+
newValue: value,
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
const isLoadingComputeTree = ref<boolean>(false)
|
|
274
|
+
const onChangeName = (name: string, node: UI_I_TreeNode | null): void => {
|
|
275
|
+
vmForm.value.name = name
|
|
276
|
+
if (isSphere.value) {
|
|
277
|
+
vmForm.value.locationPath = node.id
|
|
278
|
+
vmForm.value.dataCenter = $recursion.findParentByValue(
|
|
279
|
+
node,
|
|
280
|
+
'datacenter',
|
|
281
|
+
'type',
|
|
282
|
+
'parent'
|
|
283
|
+
)
|
|
284
|
+
isLoadingComputeTree.value = true
|
|
285
|
+
emits('get-compute-resource-tree', {
|
|
286
|
+
id: node.id,
|
|
287
|
+
cb: () => {
|
|
288
|
+
isLoadingComputeTree.value = false
|
|
289
|
+
},
|
|
290
|
+
})
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
watch(
|
|
295
|
+
() => vmForm.value.computeResource,
|
|
296
|
+
(newValue, oldValue) => {
|
|
297
|
+
if (newValue && newValue.id !== oldValue?.id) {
|
|
298
|
+
onSelectComputeResourceTree(newValue)
|
|
299
|
+
}
|
|
300
|
+
},
|
|
301
|
+
{ deep: true }
|
|
302
|
+
)
|
|
303
|
+
const onSelectComputeResourceTree = (node: UI_I_TreeNode): void => {
|
|
304
|
+
emits('select-compute-resource-tree', node)
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
const computeResourceTreeLocal = computed<UI_I_TreeNode | null>(() => {
|
|
308
|
+
// для сферы
|
|
309
|
+
return props.computeResourceTree?.[0] || null
|
|
310
|
+
})
|
|
311
|
+
</script>
|
|
312
|
+
|
|
313
|
+
<style scoped lang="scss"></style>
|
package/package.json
CHANGED
|
File without changes
|
|
File without changes
|