bfg-common 1.5.790 → 1.5.791
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/components/common/configure/advancedSystemSettings/tableView/old/Old.vue +9 -3
- package/components/common/configure/advancedSystemSettings/tableView/old/field/Field.vue +30 -26
- package/components/common/configure/advancedSystemSettings/tableView/old/lib/config/table.ts +8 -10
- package/components/common/configure/advancedSystemSettings/tableView/old/lib/models/interfaces.ts +10 -0
- package/components/common/pages/backups/modals/restore/Restore.vue +30 -1
- package/components/common/pages/backups/modals/restore/validation/validation.ts +4 -4
- package/package.json +1 -1
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
>
|
|
15
15
|
<template #value="{ item }">
|
|
16
16
|
<common-configure-advanced-system-settings-table-view-old-field
|
|
17
|
-
:
|
|
17
|
+
:data="item.data"
|
|
18
18
|
@change="onChangeSetting($event, item.data.key)"
|
|
19
19
|
@error-message="onUpdateInvalidFields($event, item.data.key)"
|
|
20
20
|
/>
|
|
@@ -38,6 +38,7 @@ import type {
|
|
|
38
38
|
UI_I_Pagination,
|
|
39
39
|
} from '~/lib/models/table/interfaces'
|
|
40
40
|
import type { UI_I_AdvancedSystemSetting } from '~/store/inventory/modules/configure/advancedSystemSettings/lib/models/interfaces'
|
|
41
|
+
import type { UI_I_AdvancedSystemSettingsEditData } from '~/components/common/configure/advancedSystemSettings/tableView/old/lib/models/interfaces'
|
|
41
42
|
import * as table from '~/components/common/configure/advancedSystemSettings/tableView/old/lib/config/table'
|
|
42
43
|
|
|
43
44
|
const settings = defineModel<API_UI_I_DataTable<UI_I_AdvancedSystemSetting[]>>(
|
|
@@ -57,7 +58,10 @@ const props = defineProps<{
|
|
|
57
58
|
|
|
58
59
|
const localization = computed<UI_I_Localization>(() => useLocal())
|
|
59
60
|
|
|
60
|
-
const onChangeSetting = (
|
|
61
|
+
const onChangeSetting = (
|
|
62
|
+
value: UI_I_AdvancedSystemSettingsEditData['value'],
|
|
63
|
+
key: string
|
|
64
|
+
): void => {
|
|
61
65
|
settings.value.items = settings.value.items.map((item) => {
|
|
62
66
|
if (item.key === key) {
|
|
63
67
|
item.value = value
|
|
@@ -70,7 +74,9 @@ const invalidFieldsLocal = ref<UI_I_ArbitraryObject<string>>({})
|
|
|
70
74
|
const onUpdateInvalidFields = (value: string, key: string): void => {
|
|
71
75
|
invalidFieldsLocal.value[key] = value
|
|
72
76
|
if (invalidFields.value)
|
|
73
|
-
invalidFields.value = Object.values(invalidFieldsLocal.value).filter(
|
|
77
|
+
invalidFields.value = Object.values(invalidFieldsLocal.value).filter(
|
|
78
|
+
(error) => error
|
|
79
|
+
)
|
|
74
80
|
}
|
|
75
81
|
|
|
76
82
|
const paginationLocal = ref<UI_I_Pagination>({
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<atoms-tooltip-error :has-error="invalid">
|
|
3
3
|
<template #elem>
|
|
4
|
-
<div v-if="props.
|
|
4
|
+
<div v-if="props.data.type === 'number'">
|
|
5
5
|
<input
|
|
6
6
|
v-model="valueLocal"
|
|
7
7
|
type="number"
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
@input="onChangeSetting($event)"
|
|
10
10
|
/>
|
|
11
11
|
</div>
|
|
12
|
-
<div v-if="props.
|
|
12
|
+
<div v-if="props.data.type === 'string'">
|
|
13
13
|
<input
|
|
14
14
|
v-model="valueLocal"
|
|
15
15
|
type="text"
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
@input="onChangeSetting($event)"
|
|
18
18
|
/>
|
|
19
19
|
</div>
|
|
20
|
-
<div v-if="props.
|
|
20
|
+
<div v-if="props.data.type === 'boolean'" class="select">
|
|
21
21
|
<select
|
|
22
22
|
v-model="valueLocal"
|
|
23
23
|
@change="onChangeSetting($event)"
|
|
@@ -27,21 +27,21 @@
|
|
|
27
27
|
<option value="true">true</option>
|
|
28
28
|
</select>
|
|
29
29
|
</div>
|
|
30
|
-
<div v-if="props.
|
|
31
|
-
<select
|
|
32
|
-
v-model="valueLocal"
|
|
33
|
-
@change="onChangeSetting($event)"
|
|
34
|
-
:class="{ 'has-error': invalid }"
|
|
35
|
-
|
|
36
|
-
<option
|
|
37
|
-
v-for="item2 in props.
|
|
38
|
-
:key="item2.key"
|
|
39
|
-
:value="item2.key"
|
|
40
|
-
|
|
41
|
-
{{ item2.value }}
|
|
42
|
-
</option
|
|
43
|
-
</select
|
|
44
|
-
</div
|
|
30
|
+
<!-- <div v-if="props.data.type === 'select'" class="select">-->
|
|
31
|
+
<!-- <select-->
|
|
32
|
+
<!-- v-model="valueLocal"-->
|
|
33
|
+
<!-- @change="onChangeSetting($event)"-->
|
|
34
|
+
<!-- :class="{ 'has-error': invalid }"-->
|
|
35
|
+
<!-- >-->
|
|
36
|
+
<!-- <option-->
|
|
37
|
+
<!-- v-for="item2 in props.data.options"-->
|
|
38
|
+
<!-- :key="item2.key"-->
|
|
39
|
+
<!-- :value="item2.key"-->
|
|
40
|
+
<!-- >-->
|
|
41
|
+
<!-- {{ item2.value }}-->
|
|
42
|
+
<!-- </option>-->
|
|
43
|
+
<!-- </select>-->
|
|
44
|
+
<!-- </div>-->
|
|
45
45
|
</template>
|
|
46
46
|
<template #content>
|
|
47
47
|
{{ errorMessage }}
|
|
@@ -50,31 +50,35 @@
|
|
|
50
50
|
</template>
|
|
51
51
|
|
|
52
52
|
<script setup lang="ts">
|
|
53
|
+
import type {
|
|
54
|
+
UI_I_AdvancedSystemSettingsEditData
|
|
55
|
+
} from "~/components/common/configure/advancedSystemSettings/tableView/old/lib/models/interfaces";
|
|
53
56
|
import { E_Format } from '~/components/common/configure/advancedSystemSettings/tableView/old/field/lib/models/enums'
|
|
54
57
|
import { allRegExp } from '~/lib/config/regExp'
|
|
55
58
|
|
|
56
59
|
const props = defineProps<{
|
|
57
|
-
|
|
60
|
+
data: UI_I_AdvancedSystemSettingsEditData
|
|
58
61
|
}>()
|
|
59
62
|
const emits = defineEmits<{
|
|
60
|
-
(event: 'change', value:
|
|
63
|
+
(event: 'change', value: UI_I_AdvancedSystemSettingsEditData['value']): void
|
|
61
64
|
(event: 'error-message', value: string): void
|
|
62
65
|
}>()
|
|
63
66
|
|
|
64
|
-
const valueLocal = ref<
|
|
67
|
+
const valueLocal = ref<UI_I_AdvancedSystemSettingsEditData['value']>(props.data.value)
|
|
65
68
|
|
|
66
69
|
const invalid = ref<boolean>(false)
|
|
67
70
|
const errorMessage = ref<string>('')
|
|
68
71
|
|
|
69
|
-
const onChangeSetting = (event:
|
|
72
|
+
const onChangeSetting = (event: Event): void => {
|
|
70
73
|
invalid.value = false
|
|
71
74
|
errorMessage.value = ''
|
|
72
75
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
if (props.
|
|
76
|
+
const target = event.target as HTMLInputElement
|
|
77
|
+
let value: UI_I_AdvancedSystemSettingsEditData['value'] = target.value
|
|
78
|
+
if (props.data.type === 'boolean') value = !!value
|
|
79
|
+
if (props.data.type === 'number') value = +value
|
|
76
80
|
|
|
77
|
-
const { validation } = props.
|
|
81
|
+
const { validation } = props.data
|
|
78
82
|
if (Object.hasOwn(validation, 'equal')) {
|
|
79
83
|
invalid.value = !validation.equal.includes(value)
|
|
80
84
|
errorMessage.value = invalid.value
|
package/components/common/configure/advancedSystemSettings/tableView/old/lib/config/table.ts
CHANGED
|
@@ -87,17 +87,15 @@ export const bodyItems = (
|
|
|
87
87
|
type: item.type,
|
|
88
88
|
value: item.value,
|
|
89
89
|
validation: item.validation,
|
|
90
|
-
options: item.options,
|
|
91
|
-
invalid: false,
|
|
92
|
-
errorMessage: '',
|
|
90
|
+
// options: item.options,
|
|
93
91
|
}
|
|
94
92
|
|
|
95
|
-
let valueText = item[tableItemKeys[1]]
|
|
96
|
-
if (item.type === 'select') {
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
}
|
|
93
|
+
// let valueText = item[tableItemKeys[1]]
|
|
94
|
+
// if (item.type === 'select') {
|
|
95
|
+
// valueText =
|
|
96
|
+
// item.options.find((option) => option.key === valueText)?.value ||
|
|
97
|
+
// valueText
|
|
98
|
+
// }
|
|
101
99
|
const cols = [
|
|
102
100
|
{
|
|
103
101
|
key: 'col0',
|
|
@@ -109,7 +107,7 @@ export const bodyItems = (
|
|
|
109
107
|
},
|
|
110
108
|
{
|
|
111
109
|
key: isEdit ? 'value' : 'col1',
|
|
112
|
-
text:
|
|
110
|
+
text: item[tableItemKeys[1]],
|
|
113
111
|
id: key,
|
|
114
112
|
testId: `advanced-system-settings-table-item-${key}${
|
|
115
113
|
isEdit ? '-edit' : ''
|
package/components/common/configure/advancedSystemSettings/tableView/old/lib/models/interfaces.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
UI_I_AdvancedSystemSetting
|
|
3
|
+
} from "~/store/inventory/modules/configure/advancedSystemSettings/lib/models/interfaces";
|
|
4
|
+
|
|
5
|
+
export interface UI_I_AdvancedSystemSettingsEditData {
|
|
6
|
+
key: UI_I_AdvancedSystemSetting['key'];
|
|
7
|
+
type: UI_I_AdvancedSystemSetting['type'];
|
|
8
|
+
value: UI_I_AdvancedSystemSetting['value'];
|
|
9
|
+
validation: UI_I_AdvancedSystemSetting['validation'];
|
|
10
|
+
}
|
|
@@ -90,7 +90,35 @@ watch(
|
|
|
90
90
|
)
|
|
91
91
|
const selectedScheme = computed<number[]>(() => wizard.selectedScheme.value)
|
|
92
92
|
const onChangeSteps = async (value: UI_I_WizardStep[]): Promise<void> => {
|
|
93
|
-
wizard.changeSteps(value, validationFunc)
|
|
93
|
+
wizard.changeSteps(value, validationFunc, finalValidationFunc)
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
const finalValidationFunc = async (
|
|
97
|
+
value: UI_I_WizardStep[]
|
|
98
|
+
): Promise<UI_I_ValidationReturn> => {
|
|
99
|
+
let stepHasError = false
|
|
100
|
+
|
|
101
|
+
if (model.value.restore_code === 3) {
|
|
102
|
+
// Все это сделано для генерации имени вм, если она не заведена
|
|
103
|
+
const data = await $store.dispatch('backup/A_CHECK_VALIDATION', {
|
|
104
|
+
pvm: model.value.pvm,
|
|
105
|
+
start: true
|
|
106
|
+
})
|
|
107
|
+
|
|
108
|
+
model.value.pvm.name = data.vm_desc.name
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
// if (!data) {
|
|
112
|
+
// stepHasError = wizard.setValidation(dynamicSteps.selectStorage, 'storage', {
|
|
113
|
+
// fieldMessage: localization.value.common.selectStorage,
|
|
114
|
+
// alertMessage: localization.value.common.selectValidDestinationStorage,
|
|
115
|
+
// })
|
|
116
|
+
// }
|
|
117
|
+
|
|
118
|
+
return {
|
|
119
|
+
stepHasError,
|
|
120
|
+
newValue: value,
|
|
121
|
+
}
|
|
94
122
|
}
|
|
95
123
|
|
|
96
124
|
const storageSubmit = ref<null | Function>(null)
|
|
@@ -235,6 +263,7 @@ const getPvm = async (): Promise<void> => {
|
|
|
235
263
|
})
|
|
236
264
|
|
|
237
265
|
model.value.pvm = useDeepCopy($store.getters['backup/getPvm'])
|
|
266
|
+
model.value.pvm.network_devices = model.value.pvm.network_devices || [] // Обрабатываем если null, так не нужно в многих местах делать проверки
|
|
238
267
|
|
|
239
268
|
loadingCount.value--
|
|
240
269
|
}
|
|
@@ -20,10 +20,10 @@ export const checkNameValidation = async (
|
|
|
20
20
|
let stepErrorMessage = ''
|
|
21
21
|
|
|
22
22
|
if (!name) {
|
|
23
|
-
stepHasError = wizard.setValidation(dynamicSteps.selectName, 'name', {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
})
|
|
23
|
+
// stepHasError = wizard.setValidation(dynamicSteps.selectName, 'name', {
|
|
24
|
+
// fieldMessage: localization.common.fieldRequired,
|
|
25
|
+
// alertMessage: localization.common.emptyNameValidationDescription,
|
|
26
|
+
// })
|
|
27
27
|
return { stepHasError, newValue: value }
|
|
28
28
|
}
|
|
29
29
|
|