bfg-common 1.2.134 → 1.2.136

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.
@@ -28,6 +28,10 @@
28
28
  :project="props.project"
29
29
  />
30
30
 
31
+ <common-wizards-vm-migrate-select-target-server
32
+ v-show="currentBlockId === 'select-target-center'"
33
+ />
34
+
31
35
  <common-wizards-vm-migrate-select-compute-resource
32
36
  v-show="currentBlockId === 'select-compute-resource'"
33
37
  />
@@ -69,6 +69,7 @@ export const constructDataReadyViewFunc = <T>(
69
69
 
70
70
  const details = {
71
71
  storage: storageDetailsFunc,
72
+ 'resource-storage': storageDetailsFunc, // временно чтобы не было ошибка при исползоване сфере
72
73
  }
73
74
 
74
75
  const migrationType = localization[UI_E_VmMigrationType[type]]
@@ -0,0 +1,18 @@
1
+ import type { UI_I_Localization } from '~/models/interfaces'
2
+ import type { UI_I_CollapseNavItem } from '~/components/atoms/collapse/models/interfaces'
3
+ export const vmMigrateSelectTargetServerTabsFunc = (
4
+ localization: UI_I_Localization
5
+ ): UI_I_CollapseNavItem[] => {
6
+ return [
7
+ {
8
+ text: localization.savedVCenterServers,
9
+ value: 'saved-servers',
10
+ disabled: false,
11
+ },
12
+ {
13
+ text: localization.newVCenterServer,
14
+ value: 'new-server',
15
+ disabled: false,
16
+ },
17
+ ]
18
+ }
@@ -0,0 +1 @@
1
+ export type T_SelectTargetServerTab = 'new-server' | 'saved-servers'
@@ -0,0 +1,287 @@
1
+ <template>
2
+ <div class="new-server">
3
+ <div>
4
+ <div class="clr-form-control clr-row">
5
+ <label for="" class="clr-control-label clr-col-md-4">
6
+ {{ localization.vCenterServerAddress }}
7
+ </label>
8
+
9
+ <div
10
+ class="clr-control-container"
11
+ :class="nameErrorText && 'clr-error'"
12
+ >
13
+ <div class="flex-align-center">
14
+ <input
15
+ id="configuration-name-input"
16
+ v-model="form.name.value"
17
+ type="text"
18
+ class="clr-input"
19
+ @blur="onBlurInputName"
20
+ @input="onInputName"
21
+ />
22
+ <atoms-the-icon class="error-icon" name="info-circle" />
23
+ </div>
24
+
25
+ <div class="clr-subtext ng-star-inserted">
26
+ {{ nameErrorText }}
27
+ </div>
28
+ </div>
29
+ </div>
30
+
31
+ <div class="clr-form-control clr-row">
32
+ <label class="clr-control-label clr-col-md-4">
33
+ {{ localization.username }}
34
+ </label>
35
+
36
+ <div
37
+ class="clr-control-container"
38
+ :class="folderErrorText && 'clr-error'"
39
+ >
40
+ <div class="flex-align-center">
41
+ <input
42
+ id="configuration-folder-input"
43
+ v-model="form.folder.value"
44
+ type="text"
45
+ class="clr-input"
46
+ @blur="onBlurInputFolder"
47
+ @input="onInputFolder"
48
+ />
49
+ <atoms-the-icon class="error-icon" name="info-circle" />
50
+ </div>
51
+
52
+ <div v-if="folderErrorText" class="clr-subtext">
53
+ {{ folderErrorText }}
54
+ </div>
55
+ <div v-else class="clr-subtext">example@domain.local</div>
56
+ </div>
57
+ </div>
58
+
59
+ <div class="nd-mt-0 clr-form-control clr-row">
60
+ <label class="clr-control-label clr-col-md-4">
61
+ {{ localization.password }}
62
+ </label>
63
+
64
+ <div
65
+ class="clr-control-container"
66
+ :class="serverErrorText && 'clr-error'"
67
+ >
68
+ <div class="flex-align-center input-action-wrapper">
69
+ <input
70
+ id="configuration-folder-input"
71
+ v-model="form.server.value"
72
+ type="text"
73
+ class="clr-input"
74
+ @blur="onBlurInputServer"
75
+ @input="onInputServer"
76
+ />
77
+ <atoms-the-icon class="error-icon" name="info-circle" />
78
+ </div>
79
+ <div v-if="serverErrorText" class="clr-subtext">
80
+ {{ serverErrorText }}
81
+ </div>
82
+ <div v-else class="clr-subtext">Password</div>
83
+ </div>
84
+ </div>
85
+ </div>
86
+
87
+ <div class="clr-form-control clr-row mt-1">
88
+ <label for="" class="clr-control-label clr-col-md-4">
89
+ {{ localization.saveVCenterServerAddress }}
90
+ </label>
91
+
92
+ <input v-model="accessMode" type="checkbox" />
93
+ </div>
94
+
95
+ <button
96
+ class="btn btn-primary btn-sm mt-2 clr-col-md-2"
97
+ :disabled="true"
98
+ @click="onSignIn"
99
+ >
100
+ {{ localization.login }}
101
+ </button>
102
+ </div>
103
+ </template>
104
+
105
+ <script lang="ts" setup>
106
+ import type { UI_I_ValidationTouchResult } from '~/node_modules/bfg-common/models/plugins/validation/interfaces'
107
+ import type { UI_I_Localization } from '~/node_modules/bfg-common/models/interfaces'
108
+ import type { UI_I_FormValidationConfiguration } from '~/node_modules/bfg-common/components/common/wizards/datastore/add/nfs/configuration/serversList/models/interfaces'
109
+ import type { UI_I_ConfigurationSendDataNfs } from '~/node_modules/bfg-common/components/common/wizards/datastore/add/nfs/configuration/models/interfaces'
110
+ import { checkValidityName } from '~/node_modules/bfg-common/components/common/wizards/datastore/add/utils'
111
+ import { defaultFormFunc } from '~/components/common/wizards/vm/migrate/select/targetServer/new/config/defaultForm'
112
+
113
+ const props = defineProps<{
114
+ nfsConfigurationSubmit: number
115
+ }>()
116
+ const localization = computed<UI_I_Localization>(() => useLocal())
117
+ const emits = defineEmits<{
118
+ (event: 'loading', value: boolean): void
119
+ (event: 'next', value: UI_I_ConfigurationSendDataNfs): void
120
+ }>()
121
+ const { $validation } = useNuxtApp()
122
+
123
+ const validation = $validation.call({})
124
+ const defaultForm: UI_I_FormValidationConfiguration = defaultFormFunc(
125
+ localization.value
126
+ )
127
+ const form = ref<UI_I_FormValidationConfiguration>(useDeepCopy(defaultForm))
128
+ const setForm = (): void => {
129
+ form.value = useDeepCopy(defaultForm)
130
+ validation.setForm(form)
131
+ }
132
+ setForm()
133
+
134
+ const validForm = ref<UI_I_ValidationTouchResult | null>(null)
135
+
136
+ /* Validation for Name input */
137
+ const isInitNameValidation = ref<boolean>(false)
138
+ const onBlurInputName = (): void => {
139
+ validForm.value = validation.touch()
140
+ isInitNameValidation.value = true
141
+ }
142
+ const onInputName = (): void => {
143
+ validForm.value = validation.touch()
144
+ }
145
+
146
+ const nameErrorText = computed<string>(() => {
147
+ if (!isInitNameValidation.value) return ''
148
+ return validForm.value?.errors?.name?.[0] || ''
149
+ })
150
+ /* Validation Name input end */
151
+
152
+ /* Validation for Folder input */
153
+ const isInitFolderValidation = ref<boolean>(false)
154
+ const onBlurInputFolder = (): void => {
155
+ validForm.value = validation.touch()
156
+ isInitFolderValidation.value = true
157
+ }
158
+ const onInputFolder = (): void => {
159
+ validForm.value = validation.touch()
160
+ }
161
+
162
+ const folderErrorText = computed<string>(() => {
163
+ if (!isInitFolderValidation.value) return ''
164
+ return validForm.value?.errors?.folder?.[0] || ''
165
+ })
166
+ /* Validation Folder input end */
167
+
168
+ /* Validation for Server input */
169
+ const isInitServerValidation = ref<boolean>(false)
170
+ const onBlurInputServer = (): void => {
171
+ validForm.value = validation.touch()
172
+ isInitServerValidation.value = true
173
+ }
174
+ const onInputServer = (): void => {
175
+ validForm.value = validation.touch()
176
+ isInitServerValidation.value = true
177
+ }
178
+
179
+ const serverErrorText = computed<string>(() => {
180
+ // if (!isInitServerValidation.value || dataServers.value.length) return ''
181
+ if (!isInitServerValidation.value) return ''
182
+ return validForm.value?.errors?.server?.[0] || ''
183
+ })
184
+
185
+ /* Validation Folder Server end */
186
+
187
+ const accessMode = ref<boolean>(false)
188
+
189
+ const onSignIn = (): void => {}
190
+
191
+ const resetValidation = (): void => {
192
+ isInitNameValidation.value =
193
+ isInitFolderValidation.value =
194
+ isInitServerValidation.value =
195
+ false
196
+ validForm.value = null
197
+ errors.value = []
198
+ }
199
+
200
+ watch(
201
+ () => props.nfsConfigurationSubmit,
202
+ () => {
203
+ submit()
204
+ }
205
+ )
206
+ const submit = async (): Promise<void> => {
207
+ const { name, server, folder } = form.value
208
+
209
+ validForm.value = validation.touch()
210
+ isInitNameValidation.value =
211
+ isInitFolderValidation.value =
212
+ isInitServerValidation.value =
213
+ true
214
+
215
+ if (nameErrorText.value || folderErrorText.value || serverErrorText.value) {
216
+ return
217
+ }
218
+
219
+ emits('loading', true)
220
+
221
+ const { valid, msg } = await checkValidityName(name.value)
222
+
223
+ emits('loading', false)
224
+
225
+ if (!valid) {
226
+ showValidationErrors(msg)
227
+ return
228
+ }
229
+
230
+ resetValidation()
231
+
232
+ const configurationData: UI_I_ConfigurationSendDataNfs = {
233
+ name: name.value,
234
+ folder: folder.value,
235
+ server: server.value,
236
+ }
237
+
238
+ emits('next', configurationData)
239
+ }
240
+
241
+ const errors = ref<string[]>([])
242
+
243
+ const showValidationErrors = (errorText: string): void => {
244
+ errors.value = [errorText]
245
+ }
246
+ </script>
247
+
248
+ <style lang="scss" scoped>
249
+ @import 'assets/scss/common/mixins.scss';
250
+ .new-server {
251
+ @include flex($dir: column, $just: space-between);
252
+ height: 100%;
253
+ margin-top: 25px;
254
+
255
+ .clr-form-control {
256
+ margin-top: 0;
257
+ display: flex;
258
+ flex-direction: row;
259
+
260
+ .clr-control-container {
261
+ min-height: 48px;
262
+ &.clr-error {
263
+ .clr-subtext,
264
+ .error-icon {
265
+ display: block;
266
+ }
267
+ }
268
+ .error-icon {
269
+ display: none;
270
+ }
271
+ .error-icon {
272
+ fill: #db2100;
273
+ width: 24px;
274
+ height: 24px;
275
+ }
276
+ }
277
+ }
278
+ }
279
+ .flex-align-center {
280
+ &.input-action-wrapper {
281
+ width: 260px;
282
+ }
283
+ input {
284
+ width: 210px;
285
+ }
286
+ }
287
+ </style>
@@ -0,0 +1,33 @@
1
+ import type { UI_I_Localization } from '~/models/interfaces'
2
+
3
+ export const defaultFormFunc = (localization: UI_I_Localization): any => {
4
+ return {
5
+ name: {
6
+ value: '',
7
+ validations: [
8
+ {
9
+ value: 'required',
10
+ errorText: localization.fieldRequired,
11
+ },
12
+ ],
13
+ },
14
+ folder: {
15
+ value: '',
16
+ validations: [
17
+ {
18
+ value: 'required',
19
+ errorText: localization.fieldRequired,
20
+ },
21
+ ],
22
+ },
23
+ server: {
24
+ value: '',
25
+ validations: [
26
+ {
27
+ value: 'required',
28
+ errorText: localization.fieldRequired,
29
+ },
30
+ ],
31
+ },
32
+ }
33
+ }
@@ -0,0 +1,27 @@
1
+ <template>
2
+ <div class="saved-servers">
3
+ <atoms-alert
4
+ test-id="vm-migrate-saved-servers-alert"
5
+ status="alert-info"
6
+ :items="arrayErrorMessages"
7
+ hide-close-icon
8
+ />
9
+ </div>
10
+ </template>
11
+
12
+ <script lang="ts" setup>
13
+ import type { UI_I_Localization } from '~/models/interfaces'
14
+
15
+ const localization = computed<UI_I_Localization>(() => useLocal())
16
+
17
+ const arrayErrorMessages = ref<string[]>([])
18
+
19
+ const setErrorText = (): void => {
20
+ arrayErrorMessages.value = [
21
+ localization.value.noSavedVCenterServerAddressesFound,
22
+ ]
23
+ }
24
+ setErrorText()
25
+ </script>
26
+
27
+ <style lang="scss" scoped></style>
@@ -0,0 +1,41 @@
1
+ <template>
2
+ <div class="target-server">
3
+ <atoms-tabs
4
+ v-model="activeTab"
5
+ test-id="migrate-select-target-server-tabs"
6
+ :items="selectStorageTabs"
7
+ size="small"
8
+ class="target-server__tabs"
9
+ />
10
+
11
+ <common-wizards-vm-migrate-select-target-server-saved
12
+ v-if="activeTab === 'saved-servers'"
13
+ />
14
+
15
+ <common-wizards-vm-migrate-select-target-server-new
16
+ v-if="activeTab === 'new-server'"
17
+ />
18
+ </div>
19
+ </template>
20
+
21
+ <script lang="ts" setup>
22
+ import type { UI_I_Localization } from '~/models/interfaces'
23
+ import type { UI_I_CollapseNavItem } from '~/components/atoms/collapse/models/interfaces'
24
+ import type { T_SelectTargetServerTab } from '~/components/common/wizards/vm/migrate/select/targetServer/models/types'
25
+ import { vmMigrateSelectTargetServerTabsFunc } from '~/components/common/wizards/vm/migrate/select/targetServer/config/tabsPannel'
26
+
27
+ const localization = computed<UI_I_Localization>(() => useLocal())
28
+
29
+ const activeTab = ref<T_SelectTargetServerTab>('new-server')
30
+ const selectStorageTabs = computed<UI_I_CollapseNavItem[]>(() =>
31
+ vmMigrateSelectTargetServerTabsFunc(localization.value)
32
+ )
33
+ </script>
34
+
35
+ <style lang="scss" scoped>
36
+ .target-server {
37
+ &__tabs {
38
+ width: 100%;
39
+ }
40
+ }
41
+ </style>
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bfg-common",
3
3
  "private": false,
4
- "version": "1.2.134",
4
+ "version": "1.2.136",
5
5
  "scripts": {
6
6
  "build": "nuxt build",
7
7
  "dev": "nuxt dev --port=3002",