bfg-common 1.5.64 → 1.5.66

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.
Files changed (44) hide show
  1. package/assets/localization/local_be.json +11 -2
  2. package/assets/localization/local_en.json +11 -2
  3. package/assets/localization/local_hy.json +11 -2
  4. package/assets/localization/local_kk.json +11 -2
  5. package/assets/localization/local_ru.json +11 -2
  6. package/assets/localization/local_zh.json +11 -2
  7. package/components/common/accordion/Recursion.vue +6 -6
  8. package/components/common/monitor/advanced/tools/chartOptionsModal/actions/lib/utils/optionsActions.ts +5 -1
  9. package/components/common/monitor/advanced/tools/lib/config/advancedToolbar.ts +21 -5
  10. package/components/common/vm/actions/add/Add.vue +205 -194
  11. package/components/common/vm/actions/add/New.vue +485 -0
  12. package/components/common/vm/actions/add/Old.vue +371 -0
  13. package/components/common/vm/actions/add/{FolderTreeView.vue → folderTreeView/FolderTreeView.vue} +16 -27
  14. package/components/common/vm/actions/add/folderTreeView/New.vue +40 -0
  15. package/components/common/vm/actions/add/folderTreeView/Old.vue +50 -0
  16. package/components/common/vm/actions/add/lib/config/steps.ts +19 -3
  17. package/components/common/vm/actions/clone/toTemplate/ToTemplate.vue +29 -37
  18. package/components/common/vm/actions/common/customizeHardware/virtualHardware/cpu/shares/Shares.vue +5 -5
  19. package/components/common/vm/actions/common/customizeHardware/virtualHardware/cpu/shares/lib/config/options.ts +3 -3
  20. package/components/common/vm/actions/common/select/compatibility/Compatibility.vue +21 -83
  21. package/components/common/vm/actions/common/select/compatibility/New.vue +165 -0
  22. package/components/common/vm/actions/common/select/compatibility/Old.vue +107 -0
  23. package/components/common/vm/actions/common/select/computeResource/ComputeResource.vue +45 -75
  24. package/components/common/vm/actions/common/select/computeResource/New.vue +141 -0
  25. package/components/common/vm/actions/common/select/computeResource/Old.vue +99 -0
  26. package/components/common/vm/actions/common/select/computeResource/treeView/New.vue +44 -0
  27. package/components/common/vm/actions/common/select/computeResource/treeView/Old.vue +48 -0
  28. package/components/common/vm/actions/common/select/computeResource/{TreeView.vue → treeView/TreeView.vue} +28 -34
  29. package/components/common/vm/actions/common/select/createType/CreateType.vue +15 -51
  30. package/components/common/vm/actions/common/select/createType/New.vue +84 -0
  31. package/components/common/vm/actions/common/select/createType/Old.vue +70 -0
  32. package/components/common/vm/actions/common/select/createType/lib/config/items.ts +24 -4
  33. package/components/common/vm/actions/common/select/createType/lib/models/interfaces.ts +5 -0
  34. package/components/common/vm/actions/common/select/name/Name.vue +24 -93
  35. package/components/common/vm/actions/common/select/name/New.vue +246 -0
  36. package/components/common/vm/actions/common/select/name/Old.vue +119 -0
  37. package/components/common/vm/actions/common/select/storage/new/New.vue +116 -86
  38. package/components/common/vm/actions/common/select/storage/new/lib/config/table.ts +156 -3
  39. package/components/common/vm/actions/common/select/storage/new/lib/models/interfaces.ts +6 -0
  40. package/components/common/vm/actions/common/select/storage/new/lib/utils/utils.ts +21 -0
  41. package/components/common/vm/actions/common/select/template/Template.vue +2 -3
  42. package/components/common/vm/actions/common/select/template/TemplateTreeView.vue +1 -1
  43. package/package.json +1 -1
  44. /package/components/common/vm/actions/common/select/storage/{StorageOld.vue → Old.vue} +0 -0
@@ -0,0 +1,119 @@
1
+ <template>
2
+ <div class="select-name">
3
+ <atoms-alert
4
+ v-show="props.errors.length"
5
+ status="alert-danger"
6
+ :items="props.errors"
7
+ test-id="name-alert"
8
+ @remove="emits('remove-validation-errors')"
9
+ />
10
+
11
+ <form id="virtual-machine-form" @submit.prevent>
12
+ <label for="virtual-machine-name"
13
+ >{{ localization.common.virtualMachineName }}:</label
14
+ >
15
+ <input
16
+ id="virtual-machine-name"
17
+ v-model.trim="vmName"
18
+ data-id="virtual-machine-name-input"
19
+ type="text"
20
+ maxlength="54"
21
+ />
22
+ <div id="vm-name-help-icon" class="content-signpost relative">
23
+ <atoms-the-icon
24
+ data-id="show-vm-name-help-icon"
25
+ class="icon-show-help"
26
+ fill="#0072a3"
27
+ width="24px"
28
+ height="24px"
29
+ name="info-circle"
30
+ @click="isShowHelp = !isShowHelp"
31
+ />
32
+ <atoms-tooltip-signpost
33
+ v-if="isShowHelp"
34
+ test-id="help-signpost"
35
+ elem-id="vm-name-help-icon"
36
+ @hide="isShowHelp = false"
37
+ >
38
+ <p>
39
+ {{ localization.common.vmNameValidationDescription }}
40
+ </p>
41
+ </atoms-tooltip-signpost>
42
+ </div>
43
+ </form>
44
+
45
+ <template v-if="props.project === 'sphere'">
46
+ <p class="new-vm-name-and-folder-instructions mt-1">
47
+ {{ localization.common.selectLocationVirtualMachine }}
48
+ </p>
49
+ <div class="tree-view-wrap">
50
+ <common-vm-actions-add-folder-tree-view
51
+ :data-center="props.dataCenter"
52
+ @select-node="emits('select-node', $event)"
53
+ />
54
+ </div>
55
+ </template>
56
+ </div>
57
+ </template>
58
+
59
+ <script setup lang="ts">
60
+ // import { API_UI_I_Error } from '~/lib/models/store/interfaces'
61
+ import type { UI_I_Localization } from '~/lib/models/interfaces'
62
+ import type { UI_T_Project } from '~/lib/models/types'
63
+ import type { UI_I_TreeNode } from '~/components/common/recursionTree/lib/models/interfaces'
64
+
65
+ const vmName = defineModel<string>('vmName', { required: true })
66
+ const isShowHelp = defineModel<boolean>('isShowHelp', { required: true })
67
+
68
+ const props = defineProps<{
69
+ project: UI_T_Project
70
+ errors: string[]
71
+ dataCenter?: UI_I_TreeNode // для сферы
72
+ }>()
73
+ const emits = defineEmits<{
74
+ (event: 'remove-validation-errors'): void
75
+ (event: 'select-node', value: UI_I_TreeNode): void
76
+ }>()
77
+
78
+ const localization = computed<UI_I_Localization>(() => useLocal())
79
+ </script>
80
+
81
+ <style scoped lang="scss">
82
+ .select-name {
83
+ form {
84
+ display: flex;
85
+ align-items: center;
86
+ padding-top: 20px;
87
+
88
+ label {
89
+ width: 216px;
90
+ }
91
+ input {
92
+ width: 345px;
93
+ }
94
+ }
95
+
96
+ .tree-view-wrap {
97
+ position: relative;
98
+ border: 1px solid #000;
99
+ padding: 5px;
100
+ max-height: 300px;
101
+ min-height: 200px;
102
+ overflow: auto;
103
+ margin-bottom: 10px;
104
+ }
105
+ }
106
+ .content-signpost {
107
+ .icon-show-help {
108
+ cursor: pointer;
109
+ }
110
+
111
+ .help-title {
112
+ font-size: 22px;
113
+ margin-bottom: 24px;
114
+ }
115
+ .signpost {
116
+ max-width: 360px;
117
+ }
118
+ }
119
+ </style>
@@ -1,12 +1,16 @@
1
1
  <template>
2
2
  <div class="select-storage">
3
- <ui-alert
4
- v-show="props.errors.length"
5
- status="alert-danger"
6
- test-id="storage-alert"
7
- :items="props.errors"
8
- @remove="emits('remove-error')"
9
- />
3
+ <Teleport to="#storage-alert-wrapper">
4
+ <ui-alert
5
+ v-show="props.errors.length"
6
+ status="alert-danger"
7
+ :messages="props.errors"
8
+ test-id="storage-alert"
9
+ :items="props.errors"
10
+ @remove="emits('remove-error')"
11
+ />
12
+ </Teleport>
13
+
10
14
  <div class="table-wrap">
11
15
  <ui-data-table
12
16
  test-id="select-storage-data-table"
@@ -15,8 +19,21 @@
15
19
  :loading="loading"
16
20
  server-off
17
21
  :default-layout="false"
22
+ size="sm"
18
23
  @select-row="onSelectRow"
19
- />
24
+ >
25
+ <template #insteadOfTitleActions
26
+ ><h3 class="storage-count">
27
+ {{ storageCount }}
28
+ </h3></template
29
+ >
30
+ <template #state="{ item }">
31
+ <ui-chip :color="item.data.color" rounded>
32
+ <ui-icon :name="item.data.iconClassName" width="14" height="14" />
33
+ {{ item.data.text }}
34
+ </ui-chip>
35
+ </template>
36
+ </ui-data-table>
20
37
  </div>
21
38
 
22
39
  <div v-if="!props.hideCompatibility" class="compatibility-wrap">
@@ -24,13 +41,21 @@
24
41
  {{ localization.inventorySummary.compatibility }}
25
42
  </p>
26
43
  <div class="compatibility-message flex-align-center">
27
- <template v-if="props.selectedStorage">
28
- <div class="icon-status-ok" />
29
- <span>{{ localization.common.compatibilityChecksSucceeded }}</span>
44
+ <ui-skeleton-item v-if="loading" width="160px" height="16px" />
45
+ <template v-else>
46
+ <template v-if="props.selectedStorage">
47
+ <ui-icon name="success-fill" width="16" height="16" />
48
+ <span class="compatibility-message-description">{{
49
+ localization.common.compatibilityChecksSucceeded
50
+ }}</span>
51
+ </template>
52
+ <template v-else>
53
+ <!-- <ui-icon name="error" width="16" height="16" />-->
54
+ <span class="compatibility-message-description">{{
55
+ localization.vmWizard.noStorageSelected
56
+ }}</span>
57
+ </template>
30
58
  </template>
31
- <div v-else>
32
- <br />
33
- </div>
34
59
  </div>
35
60
  </div>
36
61
  </div>
@@ -41,8 +66,8 @@ import type { UI_I_DataTable } from 'bfg-uikit/components/ui/dataTable/models/in
41
66
  import type { UI_I_TablePayload } from '~/lib/models/table/interfaces'
42
67
  import type { UI_I_DatastoreTableItem } from '~/lib/models/store/storage/interfaces'
43
68
  import type { UI_I_Localization } from '~/lib/models/interfaces'
44
- import { datastoreLocalizationByState } from '~/components/common/lib/config/states'
45
69
  import {
70
+ tableBodyFunc,
46
71
  tableDataFunc,
47
72
  tableOptions,
48
73
  } from '~/components/common/vm/actions/common/select/storage/new/lib/config/table'
@@ -63,8 +88,13 @@ const emits = defineEmits<{
63
88
 
64
89
  const localization = computed<UI_I_Localization>(() => useLocal())
65
90
 
91
+ const storageCount = computed<string>(() =>
92
+ localization.value.vmWizard.storageCount.replace(
93
+ '{0}',
94
+ data.value.body.length.toString()
95
+ )
96
+ )
66
97
  const loading = ref<boolean>(true)
67
-
68
98
  const data = ref<UI_I_DataTable>(tableDataFunc(localization.value))
69
99
 
70
100
  watch(
@@ -72,75 +102,12 @@ watch(
72
102
  (newValue: UI_I_DatastoreTableItem[]) => {
73
103
  if (!newValue.length || data.value.body.length) return
74
104
 
75
- const { $binary } = useNuxtApp()
76
-
77
- newValue.forEach((item, key) => {
78
- const state =
79
- localization.value.inventorySummary[
80
- datastoreLocalizationByState[item.state]
81
- ]
82
- data.value.body.push({
83
- row: key,
84
- collapse: false,
85
- isHiddenCollapse: false,
86
- collapseToggle: false,
87
- isSelected: key === selectedRow.value,
88
- data: [
89
- {
90
- key: item.id,
91
- col: 0,
92
- text: item.name,
93
- },
94
- {
95
- col: 1,
96
- text: state,
97
- },
98
- { col: 2, text: $binary.round(item.capacity.capacity_mb) },
99
- {
100
- col: 3,
101
- text: $binary.round(item.capacity.provisioned_mb.toString()),
102
- },
103
- {
104
- col: 4,
105
- text: $binary.round(item.capacity.free_mb.toString()),
106
- },
107
- {
108
- col: 5,
109
- text: $binary.round(item.capacity.used_mb.toString()),
110
- },
111
- {
112
- col: 6,
113
- text: item.type_text,
114
- },
115
- {
116
- col: 7,
117
- text: item.thin_provisioning
118
- ? localization.value.common.yes
119
- : localization.value.common.no,
120
- },
121
- {
122
- col: 8,
123
- text: item.access_mode,
124
- },
125
- {
126
- col: 9,
127
- text: item.hardware_acceleration,
128
- },
129
- {
130
- col: 10,
131
- text: item.drive_type,
132
- },
133
- {
134
- col: 11,
135
- text: item.device,
136
- },
137
- {
138
- col: 12,
139
- text: item.storage_io_control,
140
- },
141
- ],
142
- })
143
- })
105
+ data.value.body = tableBodyFunc(
106
+ newValue,
107
+ localization.value,
108
+ selectedRow.value
109
+ )
110
+
144
111
  loading.value = false
145
112
  },
146
113
  { immediate: true, deep: true }
@@ -156,4 +123,67 @@ const onSelectRow = (selectedData: UI_I_DataTable): void => {
156
123
  }
157
124
  </script>
158
125
 
159
- <style scoped lang="scss"></style>
126
+ <style>
127
+ :root {
128
+ --select-storage-border-color: #e9ebed;
129
+ --select-storage-bg-color: #ffffff;
130
+ --select-storage-title-color: #4d5d69;
131
+ --select-storage-compatibility-description-color: #4d5d69;
132
+ }
133
+ :root.dark-theme {
134
+ --select-storage-border-color: #e9ebed1f;
135
+ --select-storage-bg-color: var(--wizard-right-bg);
136
+ --select-storage-title-color: #e9eaec;
137
+ --select-storage-compatibility-description-color: #9da6ad;
138
+ }
139
+ </style>
140
+ <style scoped lang="scss">
141
+ .select-storage {
142
+ padding-top: 16px;
143
+
144
+ .storage-count {
145
+ font-size: 16px;
146
+ font-weight: 500;
147
+ color: var(--select-storage-title-color);
148
+ }
149
+
150
+ :deep(.bottom-grid-content) {
151
+ border: 1px solid var(--select-storage-border-color);
152
+ border-radius: 8px;
153
+ padding: 12px;
154
+ background-color: var(--select-storage-bg-color);
155
+ }
156
+ :deep(.select-row-item) {
157
+ background-color: var(--select-storage-bg-color);
158
+ }
159
+ :deep(.table-title-actions-container) {
160
+ justify-content: flex-start;
161
+ }
162
+ :deep(.table-container .table-title) {
163
+ margin-bottom: 12px;
164
+ }
165
+
166
+ .compatibility-wrap {
167
+ margin-top: 24px;
168
+
169
+ .compatibility {
170
+ font-size: 16px;
171
+ font-weight: 500;
172
+ color: var(--select-storage-title-color);
173
+ margin-bottom: 16px;
174
+ }
175
+ .compatibility-message {
176
+ border-radius: 8px;
177
+ border: 1px solid var(--select-storage-border-color);
178
+ padding: 12px;
179
+ background-color: var(--select-storage-bg-color);
180
+ gap: 12px;
181
+
182
+ .compatibility-message-description {
183
+ font-size: 13px;
184
+ color: var(--select-storage-compatibility-description-color);
185
+ }
186
+ }
187
+ }
188
+ }
189
+ </style>
@@ -1,6 +1,13 @@
1
- import type { UI_I_DataTable } from '~/node_modules/bfg-uikit/components/ui/dataTable/models/interfaces'
2
- import type { UI_I_DataTableOptions } from '~/node_modules/bfg-uikit/components/ui/dataTable/models/interfaces'
1
+ import type {
2
+ UI_I_DataTable,
3
+ UI_I_DataTableOptions,
4
+ UI_I_DataTableBody,
5
+ } from '~/node_modules/bfg-uikit/components/ui/dataTable/models/interfaces'
3
6
  import type { UI_I_Localization } from '~/lib/models/interfaces'
7
+ import type { UI_I_DatastoreTableItem } from '~/lib/models/store/storage/interfaces'
8
+ import type { UI_I_StatusData } from '~/components/common/vm/actions/common/select/storage/new/lib/models/interfaces'
9
+ import { datastoreLocalizationByState } from '~/components/common/lib/config/states'
10
+ import { getStatus } from '~/components/common/vm/actions/common/select/storage/new/lib/utils/utils'
4
11
 
5
12
  export const tableDataFunc = (
6
13
  localization: UI_I_Localization
@@ -161,10 +168,156 @@ export const tableDataFunc = (
161
168
  body: [],
162
169
  })
163
170
 
171
+ export const tableBodyFunc = (
172
+ data: UI_I_DatastoreTableItem[],
173
+ localization: UI_I_Localization,
174
+ selectedRow: any
175
+ ): any => {
176
+ const result: UI_I_DataTableBody[] = []
177
+ const { $binary } = useNuxtApp()
178
+
179
+ data.forEach((item, key) => {
180
+ const stateData = {
181
+ iconClassName: '',
182
+ color: '',
183
+ isState: true,
184
+ text: localization.inventorySummary[
185
+ datastoreLocalizationByState[item.state]
186
+ ],
187
+ }
188
+
189
+ let thinProvisioningData: UI_I_StatusData | {} = {}
190
+ let hardwareAccelerationData: UI_I_StatusData | {} = {}
191
+ let storage_io_control: UI_I_StatusData | {} = {}
192
+ switch (item.state) {
193
+ case 0:
194
+ stateData.iconClassName = 'icon-help'
195
+ stateData.color = 'primary'
196
+ break
197
+ case 1:
198
+ stateData.iconClassName = 'status-check'
199
+ stateData.color = 'green'
200
+ break
201
+ case 2:
202
+ stateData.iconClassName = 'warning-outline'
203
+ stateData.color = 'yellow'
204
+ break
205
+ case 3:
206
+ stateData.iconClassName = 'error-outline'
207
+ stateData.color = 'red'
208
+ break
209
+ case 4:
210
+ stateData.iconClassName = 'maintenance'
211
+ stateData.color = 'yellow'
212
+ break
213
+ case 5:
214
+ stateData.iconClassName = 'close'
215
+ stateData.color = 'red'
216
+ break
217
+ case 6:
218
+ stateData.iconClassName = 'close'
219
+ stateData.color = 'red'
220
+ break
221
+ default:
222
+ stateData.iconClassName = ''
223
+ stateData.color = 'default'
224
+ }
225
+
226
+ hardwareAccelerationData =
227
+ item.hardware_acceleration === 'Unknown'
228
+ ? {
229
+ iconClassName: 'icon-help',
230
+ color: 'primary',
231
+ isState: true,
232
+ text: localization.common.unknown,
233
+ }
234
+ : {
235
+ iconClassName: 'status-check',
236
+ color: 'green',
237
+ isState: true,
238
+ text: localization.common.supported,
239
+ }
240
+
241
+ thinProvisioningData = getStatus(item.thin_provisioning)
242
+ storage_io_control = getStatus(item.storage_io_control)
243
+
244
+ result.push({
245
+ row: key,
246
+ collapse: false,
247
+ isHiddenCollapse: false,
248
+ collapseToggle: false,
249
+ isSelected: key === selectedRow,
250
+ data: [
251
+ {
252
+ key: item.id,
253
+ col: 0,
254
+ text: item.name,
255
+ },
256
+ {
257
+ key: 'state',
258
+ col: 1,
259
+ text: stateData.text,
260
+ data: stateData
261
+ },
262
+ { col: 2, text: $binary.round(item.capacity.capacity_mb) },
263
+ {
264
+ col: 3,
265
+ text: $binary.round(item.capacity.provisioned_mb.toString()),
266
+ },
267
+ {
268
+ col: 4,
269
+ text: $binary.round(item.capacity.free_mb.toString()),
270
+ },
271
+ {
272
+ col: 5,
273
+ text: $binary.round(item.capacity.used_mb.toString()),
274
+ },
275
+ {
276
+ col: 6,
277
+ text: item.type_text,
278
+ },
279
+ {
280
+ key: 'state',
281
+ col: 7,
282
+ text: item.thin_provisioning
283
+ ? localization.common.yes
284
+ : localization.common.no,
285
+ data: thinProvisioningData
286
+ },
287
+ {
288
+ col: 8,
289
+ text: item.access_mode,
290
+ },
291
+ {
292
+ key: 'state',
293
+ col: 9,
294
+ text: item.hardware_acceleration,
295
+ data: hardwareAccelerationData
296
+ },
297
+ {
298
+ col: 10,
299
+ text: item.drive_type,
300
+ },
301
+ {
302
+ col: 11,
303
+ text: item.device,
304
+ },
305
+ {
306
+ key: 'state',
307
+ col: 12,
308
+ text: item.storage_io_control,
309
+ data: storage_io_control
310
+ },
311
+ ],
312
+ })
313
+ })
314
+ return result
315
+ }
316
+
164
317
  export const tableOptions: UI_I_DataTableOptions = {
165
318
  isSelectable: true,
166
319
  selectType: 'radio',
167
- showPagination: true,
320
+ showPagination: false,
168
321
  showPageInfo: false,
169
322
  isSortable: true,
170
323
  server: false,
@@ -0,0 +1,6 @@
1
+ export interface UI_I_StatusData {
2
+ iconClassName: string
3
+ color: string
4
+ isState: boolean
5
+ text: string
6
+ }
@@ -0,0 +1,21 @@
1
+ import type { UI_I_StatusData } from '~/components/common/vm/actions/common/select/storage/new/lib/models/interfaces'
2
+
3
+ export const getStatus = (
4
+ status: boolean,
5
+ text1?: string,
6
+ text2?: string
7
+ ): UI_I_StatusData => {
8
+ return status
9
+ ? {
10
+ iconClassName: 'status-check',
11
+ color: 'green',
12
+ isState: true,
13
+ text: text1 || 'True',
14
+ }
15
+ : {
16
+ iconClassName: 'close',
17
+ color: 'red',
18
+ isState: true,
19
+ text: text2 || 'False',
20
+ }
21
+ }
@@ -26,7 +26,7 @@ const props = defineProps<{
26
26
  templatesTree: UI_I_TreeNode[]
27
27
  }>()
28
28
  const emits = defineEmits<{
29
- (event: 'submit', value: UI_I_TreeNode | null): void
29
+ (event: 'submit', value: UI_I_TreeNode): void
30
30
  }>()
31
31
 
32
32
  const localization = computed<UI_I_Localization>(() => useLocal())
@@ -44,8 +44,7 @@ watch(
44
44
  )
45
45
 
46
46
  const submit = async (cb: Function): Promise<void> => {
47
- if (!selectedNode.value || selectedNode.value.type !== 'vm') {
48
- // TODO change vm to vmTemplate
47
+ if (!selectedNode.value || selectedNode.value.type !== 'vmt') {
49
48
  errors.value = [localization.value.vmWizard.selectValidTemplate]
50
49
  cb(false)
51
50
  return
@@ -34,7 +34,7 @@ watch(
34
34
  (newValue) => {
35
35
  nodes.value = useDeepCopy(newValue)
36
36
  },
37
- { deep: true, once: true }
37
+ { deep: true }
38
38
  )
39
39
 
40
40
  const loading = ref<boolean>(false)
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bfg-common",
3
3
  "private": false,
4
- "version": "1.5.64",
4
+ "version": "1.5.66",
5
5
  "scripts": {
6
6
  "build": "nuxt build",
7
7
  "dev": "nuxt dev --port=3002",