bfg-common 1.2.162 → 1.2.164

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.
@@ -35,7 +35,9 @@
35
35
  <common-wizards-vm-migrate-select-compute-resource
36
36
  v-show="currentBlockId === 'select-compute-resource'"
37
37
  :submit="selectComputeResourceSubmit"
38
+ :get-compute-resource-data="props.getComputeResourceData"
38
39
  :migrate-type="vmMigrateType"
40
+ :compute-resource-data="props.computeResourceTableData"
39
41
  :compute-resource-tree="props.computeResourceTree"
40
42
  @next-step="onSelectComputeResourceAndNext"
41
43
  />
@@ -90,8 +92,10 @@ const props = defineProps<{
90
92
  vmSettings: UI_I_VmSettings | null
91
93
  vmName: string
92
94
  getDatastoreTableFunc: (payload: UI_I_TablePayload) => Promise<void>
95
+ getComputeResourceData: (payload: UI_I_TablePayload) => Promise<void>
93
96
  datastore: UI_I_DatastoreTableItem[]
94
97
  configurePerDisks: UI_I_StorageConfigurePerDiskItem[]
98
+ computeResourceTableData?: any
95
99
  computeResourceTree?: UI_I_TreeNode
96
100
  readyCompleteTableInfo?: any // пока так потом если будет нужен изменит или удалить
97
101
  finishFunc: any
@@ -1,5 +1,4 @@
1
1
  import type { UI_I_Localization } from '~/models/interfaces'
2
- import type { UI_I_TableInfoItem } from '~/components/atoms/table/info/models/interfaces'
3
2
  import type { UI_T_VmMigrateType } from '~/components/common/wizards/vm/migrate/models/types'
4
3
  import { UI_E_VmMigrationType } from '~/components/common/wizards/vm/migrate/models/enums'
5
4
  import {
@@ -80,7 +79,7 @@ export const constructDataReadyViewFunc = (
80
79
  type: UI_T_VmMigrateType,
81
80
  name: string,
82
81
  data: UI_I_CollectedDataFormLocal
83
- ): UI_I_TableInfoItem[] => {
82
+ ): UI_I_MigrateReadyBlockData[] => {
84
83
  const localization: UI_I_Localization = useLocal()
85
84
 
86
85
  // const details = {
@@ -36,7 +36,6 @@
36
36
  :total-items="props.computeResourceData?.total_items || 0"
37
37
  :total-pages="props.computeResourceData?.total_pages || 1"
38
38
  :type="activeTab"
39
- :loading="loading"
40
39
  />
41
40
  </template>
42
41
 
@@ -49,7 +48,7 @@
49
48
  </template>
50
49
 
51
50
  <script lang="ts" setup>
52
- import type { UI_I_Localization, UI_I_Pagination } from '~/models/interfaces'
51
+ import type { UI_I_Localization } from '~/models/interfaces'
53
52
  import type { UI_I_CollapseNavItem } from '~/components/atoms/collapse/models/interfaces'
54
53
  import type { UI_I_TreeNode } from '~/components/common/recursionTree/models/interfaces'
55
54
  import type { UI_I_TablePayload } from '~/models/store/interfaces'
@@ -173,27 +172,6 @@ const onHideErrorMessageAlert = (): void => {
173
172
  errorMessages.value = []
174
173
  }
175
174
 
176
- const selectedData = ref([])
177
-
178
- const loading = ref<boolean>(false)
179
- const sort = ref<string | null>(null)
180
- const pagination = ref<UI_I_Pagination>({
181
- page: 1,
182
- pageSize: 100,
183
- })
184
- const getTableData = (): void => {
185
- loading.value = true
186
-
187
- const payload = {
188
- pagination: pagination.value,
189
- sortBy: sort.value,
190
- type: 'hosts',
191
- }
192
-
193
- props.getComputeResourceData(payload).then(() => {
194
- loading.value = false
195
- })
196
- }
197
175
  const checkValidityBlock = (): boolean => {
198
176
  const hasSelectedData = Object.values(computeResourceDataLocal.value).some(
199
177
  (value) => value !== null
@@ -9,7 +9,7 @@
9
9
  :body-items="bodyItems"
10
10
  :total-items="props.totalItems"
11
11
  :total-pages="props.totalPages"
12
- :loading="props.loading"
12
+ :loading="loading"
13
13
  class="data-table"
14
14
  server-off
15
15
  hide-page-size
@@ -57,7 +57,6 @@ const props = defineProps<{
57
57
  totalItems: number
58
58
  totalPages: number
59
59
  type: UI_T_SelectComputeResourceTabType
60
- loading: boolean
61
60
  }>()
62
61
  const emits = defineEmits<{
63
62
  (event: 'update:selected-data', value: number): void
@@ -65,6 +64,12 @@ const emits = defineEmits<{
65
64
 
66
65
  const localization = computed<UI_I_Localization>(() => useLocal())
67
66
 
67
+ const loading = ref<boolean>(false)
68
+ const pagination = ref<UI_I_Pagination>({
69
+ page: 1,
70
+ pageSize: 100,
71
+ })
72
+
68
73
  const table: any = {
69
74
  host: hostTable,
70
75
  cluster: clusterTable,
@@ -72,6 +77,26 @@ const table: any = {
72
77
  'v-apps': vAppsTable,
73
78
  }
74
79
 
80
+ const getData = async (
81
+ type: UI_T_SelectComputeResourceTabType
82
+ ): Promise<void> => {
83
+ const payload: UI_I_TablePayload = {
84
+ pagination: pagination.value,
85
+ sortBy: null,
86
+ schema: 'full',
87
+ type,
88
+ }
89
+
90
+ props.getComputeResourceData(payload).then(() => {})
91
+ }
92
+ watch(
93
+ () => props.type,
94
+ (newValue: UI_T_SelectComputeResourceTabType) => {
95
+ getData(newValue)
96
+ },
97
+ { deep: true, immediate: true }
98
+ )
99
+
75
100
  const headItems = computed<UI_I_HeadItem[]>(() =>
76
101
  table[props.type].headItems(localization.value)
77
102
  )
@@ -86,11 +111,6 @@ const bodyItems = computed<UI_I_BodyItem[][]>(() => {
86
111
  return table[props.type].bodyItems(props.dataTable, localization.value)
87
112
  })
88
113
 
89
- const pagination = ref<UI_I_Pagination>({
90
- page: 1,
91
- pageSize: 100,
92
- })
93
-
94
114
  const selectedRow = computed<number>({
95
115
  get() {
96
116
  return props.selectedData
@@ -1,5 +1,13 @@
1
1
  <template>
2
2
  <div class="select-storage">
3
+ <atoms-alert
4
+ v-if="errorMessages.length"
5
+ test-id="select-storage-alert"
6
+ status="alert-danger"
7
+ :items="errorMessages"
8
+ @remove="onHideErrorMessageAlert"
9
+ />
10
+
3
11
  <common-wizards-vm-migrate-select-storage-selected-per-disk
4
12
  v-if="isShowSelectedPerDisks"
5
13
  v-model="isShowSelectedPerDisks"
@@ -20,12 +28,12 @@
20
28
 
21
29
  <common-wizards-vm-migrate-select-storage-configure-batch
22
30
  v-show="activeTab === 'batch-configure'"
23
- v-model:vm-disk-format="dataLocal.vmDiskFormat"
31
+ v-model:vm-disk-format="selectStorageDataLocal.vmDiskFormat"
24
32
  :get-datastore-table-func="props.getDatastoreTableFunc"
25
33
  :datastore="props.datastore"
26
34
  :connected-storage-id="connectedStorageId"
27
35
  :is-hide-select-disk-format="isHideSelectDiskFormat"
28
- @update-selected-datastore="dataLocal.storage = $event"
36
+ @update-selected-datastore="selectStorageDataLocal.storage = $event"
29
37
  >
30
38
  <template v-if="isShowSelectedPerDisks" #buttonConfirm>
31
39
  <button class="btn btn-sm btn-primary" @click="onApplyChanges">
@@ -44,7 +52,7 @@
44
52
  />
45
53
 
46
54
  <common-wizards-vm-common-validation-compatibility
47
- :loading="!dataLocal.storage"
55
+ :loading="!selectStorageDataLocal.storage"
48
56
  :status="'Success'"
49
57
  text="compatibilityChecksSucceeded"
50
58
  />
@@ -82,7 +90,11 @@ const selectStorageTabs = computed<UI_I_CollapseNavItem[]>(() =>
82
90
  vmMigrateSelectStorageTabsFunc(localization.value)
83
91
  )
84
92
 
85
- // const selectedStorage = ref<UI_I_DatastoreTableItem | null>(null)
93
+ const errorMessages = ref<string[]>([])
94
+ const selectStorageDataLocal = ref<UI_I_SelectStorageDataLocal>({
95
+ vmDiskFormat: 0,
96
+ storage: null,
97
+ })
86
98
  const isShowSelectedPerDisks = ref<boolean>(false)
87
99
 
88
100
  const selectedPerDiskKeys = ref<number[]>([])
@@ -106,7 +118,7 @@ const onChangePerDiskStorage = (
106
118
  event: UI_I_StorageConfigurePerDiskItem[]
107
119
  ): void => {
108
120
  connectedStorageIdLocal.value = event[0].extra.datastore_id
109
- dataLocal.value.vmDiskFormat = event[0].disk_format
121
+ selectStorageDataLocal.value.vmDiskFormat = event[0].disk_format
110
122
 
111
123
  selectedPerDisks.value = event
112
124
  }
@@ -122,7 +134,7 @@ const onApplyChanges = (): void => {
122
134
  )!
123
135
 
124
136
  if (selectedDisk) {
125
- const { storage, vmDiskFormat } = dataLocal.value
137
+ const { storage, vmDiskFormat } = selectStorageDataLocal.value
126
138
 
127
139
  // ;({ name: disk.storage, id: disk.extra.datastore_id } = storage)
128
140
  disk.storage = storage.name
@@ -144,23 +156,21 @@ const isHideSelectDiskFormat = computed<boolean>(() => {
144
156
  selectedPerDisks.value[0].file === 'Configuration file'
145
157
  )
146
158
  })
147
-
148
- const dataLocal = ref<UI_I_SelectStorageDataLocal>({
149
- vmDiskFormat: 0,
150
- storage: null,
151
- })
159
+ const onHideErrorMessageAlert = (): void => {
160
+ errorMessages.value = []
161
+ }
152
162
 
153
163
  const checkValidityBlock = (): boolean => {
154
- if (!dataLocal.value.storage) {
155
- // const errorText = localization.value.nameCannotBeBlank
156
- //
157
- // showValidationErrors(errorText)
164
+ if (!selectStorageDataLocal.value.storage) {
165
+ const errorText = localization.value.selectValidDestinationStorage
166
+
167
+ errorMessages.value = [errorText]
158
168
  return false
159
169
  }
160
- const isActivePerDiskTab = activeTab.value === 'configure-disk'
161
170
 
171
+ const isActivePerDiskTab = activeTab.value === 'configure-disk'
162
172
  emits('next-step', {
163
- ...dataLocal.value,
173
+ ...selectStorageDataLocal.value,
164
174
  tab: activeTab.value,
165
175
  // ...(isActivePerDiskTab && { configureDisks: props.configurePerDisks }),
166
176
  configureDisks: isActivePerDiskTab
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bfg-common",
3
3
  "private": false,
4
- "version": "1.2.162",
4
+ "version": "1.2.164",
5
5
  "scripts": {
6
6
  "build": "nuxt build",
7
7
  "dev": "nuxt dev --port=3002",