bfg-common 1.5.449 → 1.5.451

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.
@@ -2134,6 +2134,7 @@
2134
2134
  "loginZabbixAccount": "Увайдзіце на Сервер Zabbix",
2135
2135
  "newView": "Новы выгляд",
2136
2136
  "viewDesc": "Выберыце прагляд, які будзе выкарыстоўвацца кліентам {trademark}",
2137
+ "emptyNameValidationDescription": "Імя не павінна быць пустым",
2137
2138
  "kindValidationDescription": "Няправільны тып запісу",
2138
2139
  "alert": "Трывога",
2139
2140
  "noTargetToScanIsSelected": "Мэта для сканавання не абраная.",
@@ -2137,6 +2137,7 @@
2137
2137
  "loginZabbixAccount": "Login to Zabbix Server",
2138
2138
  "newView": "New view",
2139
2139
  "viewDesc": "Select view to be used by {trademark} Client",
2140
+ "emptyNameValidationDescription": "Name should not be empty",
2140
2141
  "kindValidationDescription": "Invalid record kind",
2141
2142
  "alert": "Alert",
2142
2143
  "noTargetToScanIsSelected": "No target to scan is selected.",
@@ -2137,6 +2137,7 @@
2137
2137
  "loginZabbixAccount": "Մուտք գործեք Zabbix Սերվեր",
2138
2138
  "newView": "Նոր տեսարան",
2139
2139
  "viewDesc": "Ընտրեք տեսքը, որը կօգտագործվի {trademark} Client-ի կողմից",
2140
+ "emptyNameValidationDescription": "Անունը դատարկ չպետք է լինի",
2140
2141
  "kindValidationDescription": "Գրառման անվավեր տեսակ",
2141
2142
  "alert": "Անհանգստություն",
2142
2143
  "noTargetToScanIsSelected": "Սկանավորման թիրախը ընտրված չէ:",
@@ -2136,6 +2136,7 @@
2136
2136
  "loginZabbixAccount": "Zabbix Серверіне кіріңіз",
2137
2137
  "newView": "Жаңа көрініс",
2138
2138
  "viewDesc": "{trademark} Client пайдаланатын көріністі таңдаңыз",
2139
+ "emptyNameValidationDescription": "Аты бос болмауы керек",
2139
2140
  "kindValidationDescription": "Жарамсыз жазба түрі",
2140
2141
  "alert": "Ескерту",
2141
2142
  "noTargetToScanIsSelected": "Сканерлеуге арналған мақсат таңдалмаған.",
@@ -2136,6 +2136,7 @@
2136
2136
  "loginZabbixAccount": "Вход на Сервер Zabbix",
2137
2137
  "newView": "Новый вид",
2138
2138
  "viewDesc": "Выберите представление, которое будет использоваться клиентом {trademark}.",
2139
+ "emptyNameValidationDescription": "Имя не должно быть пустым",
2139
2140
  "kindValidationDescription": "Неверный тип записи",
2140
2141
  "alert": "Тревога",
2141
2142
  "noTargetToScanIsSelected": "Цель для сканирования не выбрана.",
@@ -2135,6 +2135,7 @@
2135
2135
  "loginZabbixAccount": "登录Zabbix服务器",
2136
2136
  "newView": "新观点",
2137
2137
  "viewDesc": "选择 {trademark} 客户端要使用的视图",
2138
+ "emptyNameValidationDescription": "名称不能为空",
2138
2139
  "kindValidationDescription": "记录类型无效",
2139
2140
  "alert": "警报",
2140
2141
  "noTargetToScanIsSelected": "未选择要扫描的目标。",
@@ -2076,6 +2076,7 @@
2076
2076
  "loginZabbixAccount": "تسجيل الدخول إلى خادم Zabbix",
2077
2077
  "newView": "عرض جديد",
2078
2078
  "viewDesc": "حدد العرض الذي سيستخدمه عميل {trademark}",
2079
+ "emptyNameValidationDescription": "الاسم لا يجب أن يكون فارغًا",
2079
2080
  "kindValidationDescription": "نوع السجل غير صالح",
2080
2081
  "alert": "تنبيه",
2081
2082
  "noTargetToScanIsSelected": "لم يتم تحديد أي هدف للفحص.",
@@ -32,6 +32,10 @@ html:not(.is-new-view) {
32
32
  }
33
33
  }
34
34
 
35
+ body {
36
+ overflow: hidden;
37
+ }
38
+
35
39
  * button:focus {
36
40
  outline: none;
37
41
  }
@@ -73,6 +73,12 @@ const checkNameIsValid = async (name: string): Promise<boolean> => {
73
73
  cb: (error): void => {
74
74
  const status = error?.statusCode || 200
75
75
  switch (status) {
76
+ case 400: // Empty name
77
+ showValidationErrors([
78
+ localization.value.common.emptyNameValidationDescription,
79
+ ])
80
+ resolve(false)
81
+ break
76
82
  case 405: // Invalid kind
77
83
  showValidationErrors([
78
84
  localization.value.common.kindValidationDescription,
@@ -74,6 +74,12 @@ const checkNameIsValid = async (name: string): Promise<boolean> => {
74
74
  cb: (error): void => {
75
75
  const status = error?.statusCode || 200
76
76
  switch (status) {
77
+ case 400: // Empty name
78
+ showValidationErrors([
79
+ localization.value.common.emptyNameValidationDescription,
80
+ ])
81
+ resolve(false)
82
+ break
77
83
  case 405: // Invalid kind
78
84
  showValidationErrors([
79
85
  localization.value.common.kindValidationDescription,
@@ -1,182 +1,190 @@
1
- <template>
2
- <common-vm-actions-common-select-name-new
3
- v-if="isNewView"
4
- v-model:vm-name="vmName"
5
- v-model:is-show-help="isShowHelp"
6
- :project="props.project"
7
- :errors="errors"
8
- :data-center="props.dataCenter"
9
- @remove-validation-errors="onRemoveValidationErrors"
10
- @select-node="onSelectNode"
11
- />
12
- <common-vm-actions-common-select-name-old
13
- v-else
14
- v-model:vm-name="vmName"
15
- v-model:is-show-help="isShowHelp"
16
- :project="props.project"
17
- :errors="errors"
18
- :data-center="props.dataCenter"
19
- @remove-validation-errors="onRemoveValidationErrors"
20
- @select-node="onSelectNode"
21
- />
22
- </template>
23
-
24
- <script setup lang="ts">
25
- // import { API_UI_I_Error } from '~/lib/models/store/interfaces'
26
- import type { UI_I_Localization } from '~/lib/models/interfaces'
27
- import type { UI_T_Project } from '~/lib/models/types'
28
- import type { UI_I_TreeNode } from '~/components/common/recursionTree/lib/models/interfaces'
29
-
30
- const props = withDefaults(
31
- defineProps<{
32
- nameFormSubmit: null | Function
33
- show: boolean
34
- project: UI_T_Project
35
- dataCenter?: UI_I_TreeNode // для сферы
36
- existName?: string
37
- }>(),
38
- {
39
- dataCenter: undefined,
40
- existName: undefined,
41
- }
42
- )
43
- const emits = defineEmits<{
44
- (event: 'submit', value: [string, UI_I_TreeNode | null]): void
45
- (event: 'loading', value: boolean): void
46
- (
47
- event: 'check-name',
48
- value: [[string, UI_I_TreeNode | null], (error: any) => void]
49
- ): void
50
- (event: 'has-errors', value: boolean): void
51
- }>()
52
-
53
- const { $store }: any = useNuxtApp()
54
- const isNewView = computed<boolean>(() => $store.getters['main/getIsNewView'])
55
-
56
- const localization = computed<UI_I_Localization>(() => useLocal())
57
-
58
- // TODO 100
59
- const vmName = ref<string>(props.existName || '')
60
-
61
- const selectedNode = ref<UI_I_TreeNode | null>(null)
62
- const onSelectNode = (node: UI_I_TreeNode): void => {
63
- selectedNode.value = node
64
- }
65
-
66
- watch(
67
- () => props.nameFormSubmit,
68
- (newValue) => {
69
- newValue && submit(newValue)
70
- }
71
- )
72
-
73
- const isParentDatacenter = (node: UI_I_TreeNode | null): boolean => {
74
- if (!node) return false
75
-
76
- if (node.parent?.type === 'datacenter') return true
77
- if (node.parent?.type === 'folder') return isParentDatacenter(node.parent)
78
- return false
79
- }
80
- const submit = async (cb: Function): Promise<void> => {
81
- const name = vmName.value
82
-
83
- if (name !== '') {
84
- const isNameValid = await checkNameIsValid(name)
85
- if (!isNameValid) {
86
- cb(false)
87
- return
88
- }
89
- }
90
-
91
- if (props.project === 'sphere') {
92
- // const isDatacenterFolder = isParentDatacenter(selectedNode.value)
93
-
94
- if (
95
- // selectedNode.value?.type !== 'datacenter' &&
96
- // selectedNode.value?.type === 'folder' &&
97
- // !isDatacenterFolder
98
- // TODO рефакторинг, здесь сейчас проверяем является ли выбранный элемент датацентром или папкой(вм)
99
- ![3, 7].includes(selectedNode.value?.kind)
100
- ) {
101
- showValidationErrors([
102
- localization.value.common.enterValidLocationVirtualMachine,
103
- ])
104
- cb(false)
105
- return
106
- }
107
- }
108
-
109
- onRemoveValidationErrors()
110
- emits('submit', [name, selectedNode.value])
111
- cb(true)
112
- }
113
- const checkNameIsValid = async (name: string): Promise<boolean> => {
114
- emits('loading', true)
115
-
116
- return new Promise((resolve) => {
117
- emits('check-name', [
118
- [name, selectedNode.value],
119
- (error) => {
120
- emits('loading', false)
121
-
122
- const status = error?.statusCode || 200
123
- switch (status) {
124
- case 405: // Invalid kind
125
- showValidationErrors([
126
- localization.value.common.kindValidationDescription,
127
- ])
128
- resolve(false)
129
- break
130
- case 406: // Invalid name
131
- showValidationErrors([
132
- localization.value.common.vmNameValidationDescription,
133
- ])
134
- resolve(false)
135
- break
136
- case 409: // Name exist
137
- showValidationErrors([
138
- localization.value.common.vmNameExistInSelectedLocation,
139
- ])
140
- resolve(false)
141
- break
142
- }
143
-
144
- resolve(true)
145
- },
146
- ])
147
- })
148
- }
149
-
150
- const errors = ref<string[]>([])
151
- const showValidationErrors = (data: string[]): void => {
152
- errors.value = data
153
- }
154
- const onRemoveValidationErrors = (): void => {
155
- errors.value = []
156
- }
157
- watch(
158
- errors,
159
- (newValue) => {
160
- emits('has-errors', !newValue.length)
161
- },
162
- { immediate: true, deep: true }
163
- )
164
-
165
- watch(
166
- () => props.show,
167
- (newValue) => {
168
- if (!newValue) return
169
-
170
- const input = document.getElementById('virtual-machine-name')
171
- if (!input) return
172
-
173
- setTimeout(() => {
174
- input.focus()
175
- }, 0)
176
- }
177
- )
178
-
179
- const isShowHelp = ref<boolean>(false)
180
- </script>
181
-
182
- <style scoped lang="scss"></style>
1
+ <template>
2
+ <common-vm-actions-common-select-name-new
3
+ v-if="isNewView"
4
+ v-model:vm-name="vmName"
5
+ v-model:is-show-help="isShowHelp"
6
+ :project="props.project"
7
+ :errors="errors"
8
+ :data-center="props.dataCenter"
9
+ @remove-validation-errors="onRemoveValidationErrors"
10
+ @select-node="onSelectNode"
11
+ />
12
+ <common-vm-actions-common-select-name-old
13
+ v-else
14
+ v-model:vm-name="vmName"
15
+ v-model:is-show-help="isShowHelp"
16
+ :project="props.project"
17
+ :errors="errors"
18
+ :data-center="props.dataCenter"
19
+ @remove-validation-errors="onRemoveValidationErrors"
20
+ @select-node="onSelectNode"
21
+ />
22
+ </template>
23
+
24
+ <script setup lang="ts">
25
+ // import { API_UI_I_Error } from '~/lib/models/store/interfaces'
26
+ import type { UI_I_Localization } from '~/lib/models/interfaces'
27
+ import type { UI_T_Project } from '~/lib/models/types'
28
+ import type { UI_I_TreeNode } from '~/components/common/recursionTree/lib/models/interfaces'
29
+
30
+ const props = withDefaults(
31
+ defineProps<{
32
+ nameFormSubmit: null | Function
33
+ show: boolean
34
+ project: UI_T_Project
35
+ validateEmptyName?: boolean
36
+ dataCenter?: UI_I_TreeNode // для сферы
37
+ existName?: string
38
+ }>(),
39
+ {
40
+ validateEmptyName: false,
41
+ dataCenter: undefined,
42
+ existName: undefined,
43
+ }
44
+ )
45
+ const emits = defineEmits<{
46
+ (event: 'submit', value: [string, UI_I_TreeNode | null]): void
47
+ (event: 'loading', value: boolean): void
48
+ (
49
+ event: 'check-name',
50
+ value: [[string, UI_I_TreeNode | null], (error: any) => void]
51
+ ): void
52
+ (event: 'has-errors', value: boolean): void
53
+ }>()
54
+
55
+ const { $store }: any = useNuxtApp()
56
+ const isNewView = computed<boolean>(() => $store.getters['main/getIsNewView'])
57
+
58
+ const localization = computed<UI_I_Localization>(() => useLocal())
59
+
60
+ // TODO 100
61
+ const vmName = ref<string>(props.existName || '')
62
+
63
+ const selectedNode = ref<UI_I_TreeNode | null>(null)
64
+ const onSelectNode = (node: UI_I_TreeNode): void => {
65
+ selectedNode.value = node
66
+ }
67
+
68
+ watch(
69
+ () => props.nameFormSubmit,
70
+ (newValue) => {
71
+ newValue && submit(newValue)
72
+ }
73
+ )
74
+
75
+ const isParentDatacenter = (node: UI_I_TreeNode | null): boolean => {
76
+ if (!node) return false
77
+
78
+ if (node.parent?.type === 'datacenter') return true
79
+ if (node.parent?.type === 'folder') return isParentDatacenter(node.parent)
80
+ return false
81
+ }
82
+ const submit = async (cb: Function): Promise<void> => {
83
+ const name = vmName.value
84
+
85
+ if (name !== '' || props.validateEmptyName) {
86
+ const isNameValid = await checkNameIsValid(name)
87
+ if (!isNameValid) {
88
+ cb(false)
89
+ return
90
+ }
91
+ }
92
+
93
+ if (props.project === 'sphere') {
94
+ // const isDatacenterFolder = isParentDatacenter(selectedNode.value)
95
+
96
+ if (
97
+ // selectedNode.value?.type !== 'datacenter' &&
98
+ // selectedNode.value?.type === 'folder' &&
99
+ // !isDatacenterFolder
100
+ // TODO рефакторинг, здесь сейчас проверяем является ли выбранный элемент датацентром или папкой(вм)
101
+ ![3, 7].includes(selectedNode.value?.kind)
102
+ ) {
103
+ showValidationErrors([
104
+ localization.value.common.enterValidLocationVirtualMachine,
105
+ ])
106
+ cb(false)
107
+ return
108
+ }
109
+ }
110
+
111
+ onRemoveValidationErrors()
112
+ emits('submit', [name, selectedNode.value])
113
+ cb(true)
114
+ }
115
+ const checkNameIsValid = async (name: string): Promise<boolean> => {
116
+ emits('loading', true)
117
+
118
+ return new Promise((resolve) => {
119
+ emits('check-name', [
120
+ [name, selectedNode.value],
121
+ (error) => {
122
+ emits('loading', false)
123
+
124
+ const status = error?.statusCode || 200
125
+ switch (status) {
126
+ case 400: // Empty name
127
+ showValidationErrors([
128
+ localization.value.common.emptyNameValidationDescription,
129
+ ])
130
+ resolve(false)
131
+ break
132
+ case 405: // Invalid kind
133
+ showValidationErrors([
134
+ localization.value.common.kindValidationDescription,
135
+ ])
136
+ resolve(false)
137
+ break
138
+ case 406: // Invalid name
139
+ showValidationErrors([
140
+ localization.value.common.vmNameValidationDescription,
141
+ ])
142
+ resolve(false)
143
+ break
144
+ case 409: // Name exist
145
+ showValidationErrors([
146
+ localization.value.common.vmNameExistInSelectedLocation,
147
+ ])
148
+ resolve(false)
149
+ break
150
+ }
151
+
152
+ resolve(true)
153
+ },
154
+ ])
155
+ })
156
+ }
157
+
158
+ const errors = ref<string[]>([])
159
+ const showValidationErrors = (data: string[]): void => {
160
+ errors.value = data
161
+ }
162
+ const onRemoveValidationErrors = (): void => {
163
+ errors.value = []
164
+ }
165
+ watch(
166
+ errors,
167
+ (newValue) => {
168
+ emits('has-errors', !newValue.length)
169
+ },
170
+ { immediate: true, deep: true }
171
+ )
172
+
173
+ watch(
174
+ () => props.show,
175
+ (newValue) => {
176
+ if (!newValue) return
177
+
178
+ const input = document.getElementById('virtual-machine-name')
179
+ if (!input) return
180
+
181
+ setTimeout(() => {
182
+ input.focus()
183
+ }, 0)
184
+ }
185
+ )
186
+
187
+ const isShowHelp = ref<boolean>(false)
188
+ </script>
189
+
190
+ <style scoped lang="scss"></style>
@@ -28,6 +28,7 @@
28
28
  :show="selectedStep.id === props.dynamicSteps.selectName"
29
29
  :name-form-submit="props.nameFormSubmit"
30
30
  :project="props.project"
31
+ validate-empty-name
31
32
  @submit="emits('change-name', ...$event)"
32
33
  @check-name="emits('check-name', $event)"
33
34
  />
@@ -12,12 +12,12 @@ export const vmMigrateSelectPriorityTypesFunc = (
12
12
  disabled: vmState !== 2,
13
13
  description: localization.migrateVm.liveMigrationDesc,
14
14
  },
15
- {
16
- label: localization.migrateVm.ramSuspendMigration,
17
- value: 'ram-suspend',
18
- disabled: vmState !== 2,
19
- description: localization.migrateVm.ramSuspendMigrationDesc,
20
- },
15
+ // {
16
+ // label: localization.migrateVm.ramSuspendMigration,
17
+ // value: 'ram-suspend',
18
+ // disabled: vmState !== 2,
19
+ // description: localization.migrateVm.ramSuspendMigrationDesc,
20
+ // },
21
21
  {
22
22
  label: localization.migrateVm.offlineMigration,
23
23
  value: 'offline',
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bfg-common",
3
3
  "private": false,
4
- "version": "1.5.449",
4
+ "version": "1.5.451",
5
5
  "scripts": {
6
6
  "build": "nuxt build",
7
7
  "dev": "nuxt dev --port=3002",