bfg-common 1.5.633 → 1.5.635
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/scss/components/auth.scss +1 -0
- package/components/common/monitor/overview/filters/Filters.vue +169 -169
- package/components/common/pages/home/widgets/warnings/table/lib/models/enums.ts +1 -0
- package/components/common/split/horizontal/{HorizontalNew.vue → New.vue} +1 -0
- package/components/common/split/horizontal/{HorizontalOld.vue → Old.vue} +1 -0
- package/components/common/split/vertical/{VerticalNew.vue → New.vue} +1 -0
- package/components/common/split/vertical/{VerticalOld.vue → Old.vue} +1 -0
- package/components/common/vm/actions/register/New.vue +17 -1
- package/components/common/vm/actions/register/Register.vue +313 -313
- package/components/common/vm/actions/register/lib/config/steps.ts +94 -86
- package/lib/models/store/tasks/interfaces.ts +1 -0
- package/package.json +2 -2
- package/store/tasks/mappers/recentTasks.ts +8 -3
|
@@ -1,169 +1,169 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<common-monitor-overview-filters-new
|
|
3
|
-
v-if="isNewView"
|
|
4
|
-
v-model:selected-period="selectedPeriod"
|
|
5
|
-
v-model:selected-view="selectedView"
|
|
6
|
-
:disabled-period-options="disabledPeriodOptions"
|
|
7
|
-
:period-options="periodOptions"
|
|
8
|
-
:is-show-custom-interval-button="isShowCustomIntervalButton"
|
|
9
|
-
:chart-title-date="chartTitleDate"
|
|
10
|
-
:view-options="viewOptions"
|
|
11
|
-
:valid-date-end="props.validDateEnd"
|
|
12
|
-
:is-show-interval-modal="isShowIntervalModal"
|
|
13
|
-
:selected-periods="props.selectedPeriods"
|
|
14
|
-
:current-lang="props.currentLang"
|
|
15
|
-
:selected-node-name="props.selectedNodeName"
|
|
16
|
-
@submit-interval-modal="onSubmitIntervalModal"
|
|
17
|
-
@show-interval-modal="onShowIntervalModal"
|
|
18
|
-
@hide-interval-modal="onHideIntervalModal"
|
|
19
|
-
/>
|
|
20
|
-
<common-monitor-overview-filters-old
|
|
21
|
-
v-else
|
|
22
|
-
v-model:selected-period="selectedPeriod"
|
|
23
|
-
v-model:selected-view="selectedView"
|
|
24
|
-
:disabled-period-options="disabledPeriodOptions"
|
|
25
|
-
:period-options="periodOptions"
|
|
26
|
-
:is-show-custom-interval-button="isShowCustomIntervalButton"
|
|
27
|
-
:chart-title-date="chartTitleDate"
|
|
28
|
-
:view-options="viewOptions"
|
|
29
|
-
:valid-date-end="props.validDateEnd"
|
|
30
|
-
:is-show-interval-modal="isShowIntervalModal"
|
|
31
|
-
:selected-periods="props.selectedPeriods"
|
|
32
|
-
:current-lang="props.currentLang"
|
|
33
|
-
:selected-node-name="props.selectedNodeName"
|
|
34
|
-
@submit-interval-modal="onSubmitIntervalModal"
|
|
35
|
-
@show-interval-modal="onShowIntervalModal"
|
|
36
|
-
@hide-interval-modal="onHideIntervalModal"
|
|
37
|
-
/>
|
|
38
|
-
</template>
|
|
39
|
-
|
|
40
|
-
<script setup lang="ts">
|
|
41
|
-
import type { UI_T_Project } from '~/lib/models/types'
|
|
42
|
-
import type { UI_I_Localization } from '~/lib/models/interfaces'
|
|
43
|
-
import type { UI_I_OptionItem } from '~/components/atoms/lib/models/interfaces'
|
|
44
|
-
import type { UI_I_MonitorGraphPayload } from '~/components/common/monitor/lib/models/interfaces'
|
|
45
|
-
import type { UI_T_OverviewViewType } from '~/components/common/monitor/overview/filters/lib/models/types'
|
|
46
|
-
import {
|
|
47
|
-
periodFunc,
|
|
48
|
-
viewFunc,
|
|
49
|
-
} from '~/components/common/monitor/overview/filters/lib/config/filterOptions'
|
|
50
|
-
import { getValidDateByOptionFunc } from '~/components/common/monitor/lib/config/getValidDateByOption'
|
|
51
|
-
|
|
52
|
-
const { $formattedDatetime, $store }: any = useNuxtApp()
|
|
53
|
-
const isNewView = computed<boolean>(() => $store.getters['main/getIsNewView'])
|
|
54
|
-
|
|
55
|
-
const props = withDefaults(
|
|
56
|
-
defineProps<{
|
|
57
|
-
startDate: number
|
|
58
|
-
endDate: number
|
|
59
|
-
chartType: 'spline' | 'pie'
|
|
60
|
-
view: UI_T_OverviewViewType
|
|
61
|
-
selectedPeriods: number[]
|
|
62
|
-
currentLang: string
|
|
63
|
-
validDateEnd: number
|
|
64
|
-
selectedNodeName: string
|
|
65
|
-
timeFormat?: string
|
|
66
|
-
project?: UI_T_Project
|
|
67
|
-
}>(),
|
|
68
|
-
{
|
|
69
|
-
timeFormat: '',
|
|
70
|
-
project: undefined,
|
|
71
|
-
}
|
|
72
|
-
)
|
|
73
|
-
|
|
74
|
-
const emits = defineEmits<{
|
|
75
|
-
(event: 'update-filters', value: UI_I_MonitorGraphPayload): void
|
|
76
|
-
(event: 'update-custom-date', value: number[]): void
|
|
77
|
-
}>()
|
|
78
|
-
|
|
79
|
-
const localization = computed<UI_I_Localization>(() => useLocal())
|
|
80
|
-
|
|
81
|
-
const selectedPeriod = ref<string>('')
|
|
82
|
-
const periodOptions = computed<UI_I_OptionItem[]>(() =>
|
|
83
|
-
periodFunc(localization.value)
|
|
84
|
-
)
|
|
85
|
-
watch(
|
|
86
|
-
() => periodOptions.value,
|
|
87
|
-
(newValue: UI_I_OptionItem[]) => {
|
|
88
|
-
if (newValue) selectedPeriod.value = newValue[0].value
|
|
89
|
-
},
|
|
90
|
-
{ immediate: true }
|
|
91
|
-
)
|
|
92
|
-
|
|
93
|
-
const isShowCustomIntervalButton = computed<boolean>(
|
|
94
|
-
() => selectedPeriod.value === 'custom_interval'
|
|
95
|
-
)
|
|
96
|
-
|
|
97
|
-
const isShowIntervalModal = ref<boolean>(false)
|
|
98
|
-
const onShowIntervalModal = (): void => {
|
|
99
|
-
isShowIntervalModal.value = true
|
|
100
|
-
}
|
|
101
|
-
const onHideIntervalModal = (): void => {
|
|
102
|
-
isShowIntervalModal.value = false
|
|
103
|
-
}
|
|
104
|
-
const onSubmitIntervalModal = (customDates: number[]): void => {
|
|
105
|
-
customDatesData.value = customDates
|
|
106
|
-
sendUpdatedFilters()
|
|
107
|
-
onHideIntervalModal()
|
|
108
|
-
emits('update-custom-date', customDates)
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
const chartTitleDate = computed<string>(() => {
|
|
112
|
-
const startValue = props.startDate
|
|
113
|
-
const endValue = props.endDate
|
|
114
|
-
if (!startValue && !endValue) return ''
|
|
115
|
-
|
|
116
|
-
const start = $formattedDatetime(startValue, {
|
|
117
|
-
hasSeconds: true,
|
|
118
|
-
timeFormat: props.timeFormat,
|
|
119
|
-
})
|
|
120
|
-
|
|
121
|
-
const end = $formattedDatetime(endValue, {
|
|
122
|
-
hasSeconds: true,
|
|
123
|
-
timeFormat: props.timeFormat,
|
|
124
|
-
})
|
|
125
|
-
|
|
126
|
-
return `${start} - ${end}`
|
|
127
|
-
})
|
|
128
|
-
|
|
129
|
-
// const disabledPeriodOptions = computed<boolean>(
|
|
130
|
-
// () => props.chartType === 'pie' || !chartTitleDate.value
|
|
131
|
-
// )
|
|
132
|
-
|
|
133
|
-
const disabledPeriodOptions = computed<boolean>(() => props.chartType === 'pie')
|
|
134
|
-
|
|
135
|
-
const selectedView = ref<string>('')
|
|
136
|
-
const viewOptions = computed<UI_I_OptionItem[]>(() =>
|
|
137
|
-
viewFunc(localization.value, props.view, props.project)
|
|
138
|
-
)
|
|
139
|
-
watch(
|
|
140
|
-
() => viewOptions.value,
|
|
141
|
-
(newValue: UI_I_OptionItem[]) => {
|
|
142
|
-
if (newValue) selectedView.value = newValue[0].value
|
|
143
|
-
},
|
|
144
|
-
{ immediate: true }
|
|
145
|
-
)
|
|
146
|
-
|
|
147
|
-
const customDatesData = ref<number[]>([])
|
|
148
|
-
const sendUpdatedFilters = (): void => {
|
|
149
|
-
const currentPeriod =
|
|
150
|
-
selectedPeriod.value === 'custom_interval'
|
|
151
|
-
? customDatesData.value
|
|
152
|
-
: getValidDateByOptionFunc(selectedPeriod.value)
|
|
153
|
-
const filters: UI_I_MonitorGraphPayload = {
|
|
154
|
-
period: currentPeriod,
|
|
155
|
-
view: selectedView.value,
|
|
156
|
-
periodName: selectedPeriod.value,
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
emits('update-filters', filters)
|
|
160
|
-
}
|
|
161
|
-
watch(
|
|
162
|
-
() => [selectedPeriod.value, selectedView.value],
|
|
163
|
-
() => {
|
|
164
|
-
sendUpdatedFilters()
|
|
165
|
-
}
|
|
166
|
-
)
|
|
167
|
-
</script>
|
|
168
|
-
|
|
169
|
-
<style scoped lang="scss"></style>
|
|
1
|
+
<template>
|
|
2
|
+
<common-monitor-overview-filters-new
|
|
3
|
+
v-if="isNewView"
|
|
4
|
+
v-model:selected-period="selectedPeriod"
|
|
5
|
+
v-model:selected-view="selectedView"
|
|
6
|
+
:disabled-period-options="disabledPeriodOptions"
|
|
7
|
+
:period-options="periodOptions"
|
|
8
|
+
:is-show-custom-interval-button="isShowCustomIntervalButton"
|
|
9
|
+
:chart-title-date="chartTitleDate"
|
|
10
|
+
:view-options="viewOptions"
|
|
11
|
+
:valid-date-end="props.validDateEnd"
|
|
12
|
+
:is-show-interval-modal="isShowIntervalModal"
|
|
13
|
+
:selected-periods="props.selectedPeriods"
|
|
14
|
+
:current-lang="props.currentLang"
|
|
15
|
+
:selected-node-name="props.selectedNodeName"
|
|
16
|
+
@submit-interval-modal="onSubmitIntervalModal"
|
|
17
|
+
@show-interval-modal="onShowIntervalModal"
|
|
18
|
+
@hide-interval-modal="onHideIntervalModal"
|
|
19
|
+
/>
|
|
20
|
+
<common-monitor-overview-filters-old
|
|
21
|
+
v-else
|
|
22
|
+
v-model:selected-period="selectedPeriod"
|
|
23
|
+
v-model:selected-view="selectedView"
|
|
24
|
+
:disabled-period-options="disabledPeriodOptions"
|
|
25
|
+
:period-options="periodOptions"
|
|
26
|
+
:is-show-custom-interval-button="isShowCustomIntervalButton"
|
|
27
|
+
:chart-title-date="chartTitleDate"
|
|
28
|
+
:view-options="viewOptions"
|
|
29
|
+
:valid-date-end="props.validDateEnd"
|
|
30
|
+
:is-show-interval-modal="isShowIntervalModal"
|
|
31
|
+
:selected-periods="props.selectedPeriods"
|
|
32
|
+
:current-lang="props.currentLang"
|
|
33
|
+
:selected-node-name="props.selectedNodeName"
|
|
34
|
+
@submit-interval-modal="onSubmitIntervalModal"
|
|
35
|
+
@show-interval-modal="onShowIntervalModal"
|
|
36
|
+
@hide-interval-modal="onHideIntervalModal"
|
|
37
|
+
/>
|
|
38
|
+
</template>
|
|
39
|
+
|
|
40
|
+
<script setup lang="ts">
|
|
41
|
+
import type { UI_T_Project } from '~/lib/models/types'
|
|
42
|
+
import type { UI_I_Localization } from '~/lib/models/interfaces'
|
|
43
|
+
import type { UI_I_OptionItem } from '~/components/atoms/lib/models/interfaces'
|
|
44
|
+
import type { UI_I_MonitorGraphPayload } from '~/components/common/monitor/lib/models/interfaces'
|
|
45
|
+
import type { UI_T_OverviewViewType } from '~/components/common/monitor/overview/filters/lib/models/types'
|
|
46
|
+
import {
|
|
47
|
+
periodFunc,
|
|
48
|
+
viewFunc,
|
|
49
|
+
} from '~/components/common/monitor/overview/filters/lib/config/filterOptions'
|
|
50
|
+
import { getValidDateByOptionFunc } from '~/components/common/monitor/lib/config/getValidDateByOption'
|
|
51
|
+
|
|
52
|
+
const { $formattedDatetime, $store }: any = useNuxtApp()
|
|
53
|
+
const isNewView = computed<boolean>(() => $store.getters['main/getIsNewView'])
|
|
54
|
+
|
|
55
|
+
const props = withDefaults(
|
|
56
|
+
defineProps<{
|
|
57
|
+
startDate: number
|
|
58
|
+
endDate: number
|
|
59
|
+
chartType: 'spline' | 'pie'
|
|
60
|
+
view: UI_T_OverviewViewType
|
|
61
|
+
selectedPeriods: number[]
|
|
62
|
+
currentLang: string
|
|
63
|
+
validDateEnd: number
|
|
64
|
+
selectedNodeName: string
|
|
65
|
+
timeFormat?: string
|
|
66
|
+
project?: UI_T_Project
|
|
67
|
+
}>(),
|
|
68
|
+
{
|
|
69
|
+
timeFormat: '',
|
|
70
|
+
project: undefined,
|
|
71
|
+
}
|
|
72
|
+
)
|
|
73
|
+
|
|
74
|
+
const emits = defineEmits<{
|
|
75
|
+
(event: 'update-filters', value: UI_I_MonitorGraphPayload): void
|
|
76
|
+
(event: 'update-custom-date', value: number[]): void
|
|
77
|
+
}>()
|
|
78
|
+
|
|
79
|
+
const localization = computed<UI_I_Localization>(() => useLocal())
|
|
80
|
+
|
|
81
|
+
const selectedPeriod = ref<string>('')
|
|
82
|
+
const periodOptions = computed<UI_I_OptionItem[]>(() =>
|
|
83
|
+
periodFunc(localization.value)
|
|
84
|
+
)
|
|
85
|
+
watch(
|
|
86
|
+
() => periodOptions.value,
|
|
87
|
+
(newValue: UI_I_OptionItem[]) => {
|
|
88
|
+
if (newValue) selectedPeriod.value = newValue[0].value
|
|
89
|
+
},
|
|
90
|
+
{ immediate: true }
|
|
91
|
+
)
|
|
92
|
+
|
|
93
|
+
const isShowCustomIntervalButton = computed<boolean>(
|
|
94
|
+
() => selectedPeriod.value === 'custom_interval'
|
|
95
|
+
)
|
|
96
|
+
|
|
97
|
+
const isShowIntervalModal = ref<boolean>(false)
|
|
98
|
+
const onShowIntervalModal = (): void => {
|
|
99
|
+
isShowIntervalModal.value = true
|
|
100
|
+
}
|
|
101
|
+
const onHideIntervalModal = (): void => {
|
|
102
|
+
isShowIntervalModal.value = false
|
|
103
|
+
}
|
|
104
|
+
const onSubmitIntervalModal = (customDates: number[]): void => {
|
|
105
|
+
customDatesData.value = customDates
|
|
106
|
+
sendUpdatedFilters()
|
|
107
|
+
onHideIntervalModal()
|
|
108
|
+
emits('update-custom-date', customDates)
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
const chartTitleDate = computed<string>(() => {
|
|
112
|
+
const startValue = props.startDate
|
|
113
|
+
const endValue = props.endDate
|
|
114
|
+
if (!startValue && !endValue) return ''
|
|
115
|
+
|
|
116
|
+
const start = $formattedDatetime(startValue, {
|
|
117
|
+
hasSeconds: true,
|
|
118
|
+
timeFormat: props.timeFormat,
|
|
119
|
+
})
|
|
120
|
+
|
|
121
|
+
const end = $formattedDatetime(endValue, {
|
|
122
|
+
hasSeconds: true,
|
|
123
|
+
timeFormat: props.timeFormat,
|
|
124
|
+
})
|
|
125
|
+
|
|
126
|
+
return `${start} - ${end}`
|
|
127
|
+
})
|
|
128
|
+
|
|
129
|
+
// const disabledPeriodOptions = computed<boolean>(
|
|
130
|
+
// () => props.chartType === 'pie' || !chartTitleDate.value
|
|
131
|
+
// )
|
|
132
|
+
|
|
133
|
+
const disabledPeriodOptions = computed<boolean>(() => props.chartType === 'pie')
|
|
134
|
+
|
|
135
|
+
const selectedView = ref<string>('')
|
|
136
|
+
const viewOptions = computed<UI_I_OptionItem[]>(() =>
|
|
137
|
+
viewFunc(localization.value, props.view, props.project)
|
|
138
|
+
)
|
|
139
|
+
watch(
|
|
140
|
+
() => viewOptions.value,
|
|
141
|
+
(newValue: UI_I_OptionItem[]) => {
|
|
142
|
+
if (newValue) selectedView.value = newValue[0].value
|
|
143
|
+
},
|
|
144
|
+
{ immediate: true }
|
|
145
|
+
)
|
|
146
|
+
|
|
147
|
+
const customDatesData = ref<number[]>([])
|
|
148
|
+
const sendUpdatedFilters = (): void => {
|
|
149
|
+
const currentPeriod =
|
|
150
|
+
selectedPeriod.value === 'custom_interval'
|
|
151
|
+
? customDatesData.value
|
|
152
|
+
: getValidDateByOptionFunc(selectedPeriod.value)
|
|
153
|
+
const filters: UI_I_MonitorGraphPayload = {
|
|
154
|
+
period: currentPeriod,
|
|
155
|
+
view: selectedView.value,
|
|
156
|
+
periodName: selectedPeriod.value,
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
emits('update-filters', filters)
|
|
160
|
+
}
|
|
161
|
+
watch(
|
|
162
|
+
() => [selectedPeriod.value, selectedView.value],
|
|
163
|
+
() => {
|
|
164
|
+
sendUpdatedFilters()
|
|
165
|
+
}
|
|
166
|
+
)
|
|
167
|
+
</script>
|
|
168
|
+
|
|
169
|
+
<style scoped lang="scss"></style>
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
:is-loading="props.wizard.wizardLoader.status"
|
|
6
6
|
:title="localization.common.registerVm"
|
|
7
7
|
:texts="texts"
|
|
8
|
+
:has-changes="hasChanges"
|
|
8
9
|
test-id="register-wizard"
|
|
9
10
|
show
|
|
10
11
|
@change-steps="emits('change-steps', $event)"
|
|
@@ -74,7 +75,7 @@
|
|
|
74
75
|
test-id="computed-resource-alert"
|
|
75
76
|
type="error"
|
|
76
77
|
size="md"
|
|
77
|
-
class="subtitle-block__alert"
|
|
78
|
+
class="subtitle-block__alert mb-4"
|
|
78
79
|
/>
|
|
79
80
|
<ui-wizard-subtitle
|
|
80
81
|
:sub-title="
|
|
@@ -131,6 +132,7 @@ import type {
|
|
|
131
132
|
UI_I_WizardTexts,
|
|
132
133
|
} from '~/node_modules/bfg-uikit/components/ui/wizard/lib/models/interfaces'
|
|
133
134
|
import Wizard from '~/node_modules/bfg-uikit/components/ui/wizard/lib/utils/utils'
|
|
135
|
+
import { compare } from '~/node_modules/bfg-uikit/lib/utils/compare'
|
|
134
136
|
import type { UI_I_Localization } from '~/lib/models/interfaces'
|
|
135
137
|
import type { UI_T_Project } from '~/lib/models/types'
|
|
136
138
|
import type { UI_I_TableInfoItem } from '~/components/atoms/table/info/lib/models/interfaces'
|
|
@@ -208,8 +210,19 @@ const currentSubtitleSelectNameBlock = ref<string>(
|
|
|
208
210
|
? localization.value.vmWizard.specifyUniqueNameAndTargetLocationForVm
|
|
209
211
|
: localization.value.common.specifyUniqueNameForVm
|
|
210
212
|
)
|
|
213
|
+
|
|
214
|
+
const initialCompare = compare(vmForm)
|
|
215
|
+
const hasChanges = computed<boolean>(() => initialCompare.getDiff(vmForm.value))
|
|
211
216
|
</script>
|
|
212
217
|
|
|
218
|
+
<style>
|
|
219
|
+
:root {
|
|
220
|
+
--select-name-border-color: #e9ebed;
|
|
221
|
+
}
|
|
222
|
+
:root.dark-theme {
|
|
223
|
+
--select-name-border-color: #e9ebed1f;
|
|
224
|
+
}
|
|
225
|
+
</style>
|
|
213
226
|
<style scoped lang="scss">
|
|
214
227
|
.subtitle-block {
|
|
215
228
|
display: flex;
|
|
@@ -217,6 +230,9 @@ const currentSubtitleSelectNameBlock = ref<string>(
|
|
|
217
230
|
border-bottom: 1px solid var(--wizard-line);
|
|
218
231
|
padding-bottom: 12px;
|
|
219
232
|
}
|
|
233
|
+
:deep(.select-name .tree-view-wrap) {
|
|
234
|
+
border-color: var(--select-name-border-color);
|
|
235
|
+
}
|
|
220
236
|
.compute-resource-container {
|
|
221
237
|
padding-bottom: 40px;
|
|
222
238
|
|
|
@@ -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[]>(() => {
|
|
308
|
-
// для сферы
|
|
309
|
-
return props.computeResourceTree || []
|
|
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, props.project),
|
|
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[]>(() => {
|
|
308
|
+
// для сферы
|
|
309
|
+
return props.computeResourceTree || []
|
|
310
|
+
})
|
|
311
|
+
</script>
|
|
312
|
+
|
|
313
|
+
<style scoped lang="scss"></style>
|
|
@@ -1,86 +1,94 @@
|
|
|
1
|
-
import type { UI_I_WizardStep } from '~/node_modules/bfg-uikit/components/ui/wizard/lib/models/interfaces'
|
|
2
|
-
import { UI_E_WIZARD_STATUS } from '~/node_modules/bfg-uikit/components/ui/wizard/lib/models/enums'
|
|
3
|
-
import type { UI_I_Localization } from '~/lib/models/interfaces'
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
1
|
+
import type { UI_I_WizardStep } from '~/node_modules/bfg-uikit/components/ui/wizard/lib/models/interfaces'
|
|
2
|
+
import { UI_E_WIZARD_STATUS } from '~/node_modules/bfg-uikit/components/ui/wizard/lib/models/enums'
|
|
3
|
+
import type { UI_I_Localization } from '~/lib/models/interfaces'
|
|
4
|
+
import type { UI_T_Project } from '~/lib/models/types'
|
|
5
|
+
|
|
6
|
+
export const dynamicSteps = {
|
|
7
|
+
selectName: 0,
|
|
8
|
+
selectNameFolder: 1,
|
|
9
|
+
selectComputeResource: 2,
|
|
10
|
+
readyComplete: 3,
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export const stepsFunc = (
|
|
14
|
+
localization: UI_I_Localization,
|
|
15
|
+
project: UI_T_Project
|
|
16
|
+
): UI_I_WizardStep[] => {
|
|
17
|
+
return [
|
|
18
|
+
// Procurator
|
|
19
|
+
{
|
|
20
|
+
id: dynamicSteps.selectName,
|
|
21
|
+
stepName: '',
|
|
22
|
+
title: localization.common.selectName,
|
|
23
|
+
subTitle: localization.common.specifyUniqueName,
|
|
24
|
+
status:
|
|
25
|
+
project === 'procurator'
|
|
26
|
+
? UI_E_WIZARD_STATUS.SELECTED
|
|
27
|
+
: UI_E_WIZARD_STATUS.INACTIVE,
|
|
28
|
+
isValid: true,
|
|
29
|
+
testId: 'vm-select-name',
|
|
30
|
+
fields: {
|
|
31
|
+
name: {
|
|
32
|
+
field: '',
|
|
33
|
+
alert: '',
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
// Sphere
|
|
38
|
+
{
|
|
39
|
+
id: dynamicSteps.selectNameFolder,
|
|
40
|
+
stepName: '',
|
|
41
|
+
title: localization.vmWizard.selectNameFolder,
|
|
42
|
+
subTitle: localization.common.specifyUniqueNameTargetLocation,
|
|
43
|
+
status:
|
|
44
|
+
project === 'procurator'
|
|
45
|
+
? UI_E_WIZARD_STATUS.INACTIVE
|
|
46
|
+
: UI_E_WIZARD_STATUS.SELECTED,
|
|
47
|
+
isValid: true,
|
|
48
|
+
testId: 'vm-select-name-folder',
|
|
49
|
+
fields: {
|
|
50
|
+
name: {
|
|
51
|
+
field: '',
|
|
52
|
+
alert: '',
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
// Sphere
|
|
57
|
+
{
|
|
58
|
+
id: dynamicSteps.selectComputeResource,
|
|
59
|
+
stepName: '',
|
|
60
|
+
title: localization.vmWizard.selectComputeResource,
|
|
61
|
+
subTitle: localization.common.selectDestinationComputeResourceOperation,
|
|
62
|
+
status: UI_E_WIZARD_STATUS.INACTIVE,
|
|
63
|
+
isValid: true,
|
|
64
|
+
testId: 'vm-select-compute-resource',
|
|
65
|
+
fields: {
|
|
66
|
+
computeResource: {
|
|
67
|
+
field: '',
|
|
68
|
+
alert: '',
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
id: dynamicSteps.readyComplete,
|
|
74
|
+
stepName: '',
|
|
75
|
+
title: localization.vmWizard.readyComplete,
|
|
76
|
+
subTitle: localization.vmWizard.lastCreateSubtitle,
|
|
77
|
+
status: UI_E_WIZARD_STATUS.INACTIVE,
|
|
78
|
+
isValid: true,
|
|
79
|
+
testId: 'vm-ready-complete',
|
|
80
|
+
fields: {},
|
|
81
|
+
},
|
|
82
|
+
]
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export const stepsSchemeInitial = [
|
|
86
|
+
// 0 Procurator
|
|
87
|
+
[dynamicSteps.selectName, dynamicSteps.readyComplete],
|
|
88
|
+
// 1 Sphere
|
|
89
|
+
[
|
|
90
|
+
dynamicSteps.selectNameFolder,
|
|
91
|
+
dynamicSteps.selectComputeResource,
|
|
92
|
+
dynamicSteps.readyComplete,
|
|
93
|
+
],
|
|
94
|
+
]
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bfg-common",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "1.5.
|
|
4
|
+
"version": "1.5.635",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "nuxt build",
|
|
7
7
|
"dev": "nuxt dev --port=3002",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"@vueuse/core": "10.1.2",
|
|
19
19
|
"@vueuse/nuxt": "10.1.2",
|
|
20
20
|
"bfg-nuxt-3-graph": "1.0.27",
|
|
21
|
-
"bfg-uikit": "1.0.
|
|
21
|
+
"bfg-uikit": "1.0.533",
|
|
22
22
|
"eslint-config-prettier": "^8.5.0",
|
|
23
23
|
"eslint-plugin-myrules": "file:./eslint",
|
|
24
24
|
"nuxt": "3.11.2",
|
|
@@ -45,8 +45,8 @@ export const recentTasks = (
|
|
|
45
45
|
execution = '--'
|
|
46
46
|
queuedFor = 0
|
|
47
47
|
startTime = Date.now() / 1000 + ''
|
|
48
|
-
// Обрабатываем данные когда задачка в работе
|
|
49
|
-
} else if (task.status === 1) {
|
|
48
|
+
// Обрабатываем данные когда задачка в работе или когда в статусе retry
|
|
49
|
+
} else if (task.status === 1 || task.status === 5) {
|
|
50
50
|
completion = '--'
|
|
51
51
|
execution = '--'
|
|
52
52
|
}
|
|
@@ -86,6 +86,9 @@ export const recentTasks = (
|
|
|
86
86
|
break
|
|
87
87
|
}
|
|
88
88
|
|
|
89
|
+
const targetName = task.extra.target_name || '--'
|
|
90
|
+
const targetType = task.extra.target_type || task.target_type
|
|
91
|
+
|
|
89
92
|
return {
|
|
90
93
|
args,
|
|
91
94
|
completion,
|
|
@@ -103,7 +106,9 @@ export const recentTasks = (
|
|
|
103
106
|
status: task.status,
|
|
104
107
|
statusDetails: operations,
|
|
105
108
|
target: task.target,
|
|
106
|
-
|
|
109
|
+
targetName,
|
|
110
|
+
targetType,
|
|
111
|
+
// targetType: task.target_type,
|
|
107
112
|
taskName: task.task_name,
|
|
108
113
|
id: task.id,
|
|
109
114
|
zone: task.zone,
|