bfg-common 1.2.163 → 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.
@@ -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 = {
@@ -27,7 +27,6 @@
27
27
  :items="selectStorageTabs"
28
28
  size="small"
29
29
  class="compute-resource__tabs"
30
- @change="getTableData"
31
30
  />
32
31
 
33
32
  <common-wizards-vm-migrate-select-compute-resource-table-view
@@ -37,7 +36,6 @@
37
36
  :total-items="props.computeResourceData?.total_items || 0"
38
37
  :total-pages="props.computeResourceData?.total_pages || 1"
39
38
  :type="activeTab"
40
- :loading="loading"
41
39
  />
42
40
  </template>
43
41
 
@@ -50,7 +48,7 @@
50
48
  </template>
51
49
 
52
50
  <script lang="ts" setup>
53
- import type { UI_I_Localization, UI_I_Pagination } from '~/models/interfaces'
51
+ import type { UI_I_Localization } from '~/models/interfaces'
54
52
  import type { UI_I_CollapseNavItem } from '~/components/atoms/collapse/models/interfaces'
55
53
  import type { UI_I_TreeNode } from '~/components/common/recursionTree/models/interfaces'
56
54
  import type { UI_I_TablePayload } from '~/models/store/interfaces'
@@ -174,25 +172,6 @@ const onHideErrorMessageAlert = (): void => {
174
172
  errorMessages.value = []
175
173
  }
176
174
 
177
- const loading = ref<boolean>(false)
178
- const sort = ref<string | null>(null)
179
- const pagination = ref<UI_I_Pagination>({
180
- page: 1,
181
- pageSize: 100,
182
- })
183
- const getTableData = (): void => {
184
- loading.value = true
185
-
186
- const payload = {
187
- pagination: pagination.value,
188
- sortBy: sort.value,
189
- type: 'hosts',
190
- }
191
-
192
- props.getComputeResourceData(payload).then(() => {
193
- loading.value = false
194
- })
195
- }
196
175
  const checkValidityBlock = (): boolean => {
197
176
  const hasSelectedData = Object.values(computeResourceDataLocal.value).some(
198
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,17 +77,25 @@ const table: any = {
72
77
  'v-apps': vAppsTable,
73
78
  }
74
79
 
75
- const getData = async (): Promise<void> => {
80
+ const getData = async (
81
+ type: UI_T_SelectComputeResourceTabType
82
+ ): Promise<void> => {
76
83
  const payload: UI_I_TablePayload = {
77
84
  pagination: pagination.value,
78
85
  sortBy: null,
79
- type: 'datastore',
80
86
  schema: 'full',
87
+ type,
81
88
  }
82
89
 
83
90
  props.getComputeResourceData(payload).then(() => {})
84
91
  }
85
- getData()
92
+ watch(
93
+ () => props.type,
94
+ (newValue: UI_T_SelectComputeResourceTabType) => {
95
+ getData(newValue)
96
+ },
97
+ { deep: true, immediate: true }
98
+ )
86
99
 
87
100
  const headItems = computed<UI_I_HeadItem[]>(() =>
88
101
  table[props.type].headItems(localization.value)
@@ -98,11 +111,6 @@ const bodyItems = computed<UI_I_BodyItem[][]>(() => {
98
111
  return table[props.type].bodyItems(props.dataTable, localization.value)
99
112
  })
100
113
 
101
- const pagination = ref<UI_I_Pagination>({
102
- page: 1,
103
- pageSize: 100,
104
- })
105
-
106
114
  const selectedRow = computed<number>({
107
115
  get() {
108
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.163",
4
+ "version": "1.2.164",
5
5
  "scripts": {
6
6
  "build": "nuxt build",
7
7
  "dev": "nuxt dev --port=3002",