bfg-common 1.6.0 → 1.6.2

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.
@@ -3491,7 +3491,8 @@
3491
3491
  "snapshotHasNoDescriptionYet": "Гэты здымак яшчэ не мае апісання.",
3492
3492
  "takeSnapshot": "Зрабіце здымак",
3493
3493
  "newSnapshot": "Новы здымак",
3494
- "editSnapshot": "Рэдагаваць здымак"
3494
+ "editSnapshot": "Рэдагаваць здымак",
3495
+ "revertLatestSnapshot": "Вярнуцца да апошняга здымка"
3495
3496
  },
3496
3497
  "importVms": {
3497
3498
  "selectSourceTooltipDesc": "Правы карыстальніка esxi павінны адпавядаць ролях Administrator, крэдыт прымаюцца ад esxi і vSphere",
@@ -3495,7 +3495,8 @@
3495
3495
  "snapshotHasNoDescriptionYet": "This snapshot has no description yet.",
3496
3496
  "takeSnapshot": "Take Snapshot",
3497
3497
  "newSnapshot": "New Snapshot",
3498
- "editSnapshot": "Edit snapshot"
3498
+ "editSnapshot": "Edit snapshot",
3499
+ "revertLatestSnapshot": "Revert to Latest Snapshot"
3499
3500
  },
3500
3501
  "importVms": {
3501
3502
  "selectSourceTooltipDesc": "No Trusted infrastructure Administrator, credits are accepted from esxi and vSphere",
@@ -3495,7 +3495,8 @@
3495
3495
  "snapshotHasNoDescriptionYet": "Այս պահպանումը դեռևս չունի նկարագրություն։",
3496
3496
  "takeSnapshot": "Ակնթարթ նկար",
3497
3497
  "newSnapshot": "Նոր սքրինշոթ",
3498
- "editSnapshot": "Խմբագրել սքրինշոթը"
3498
+ "editSnapshot": "Խմբագրել սքրինշոթը",
3499
+ "revertLatestSnapshot": "Վերադառնալ վերջին նկարին"
3499
3500
  },
3500
3501
  "importVms": {
3501
3502
  "selectSourceTooltipDesc": "Esxi օգտագործողի իրավունքները պետք է համապատասխանեն Administrator-ի դերերին, կրեդիտներն ընդունվում են esxi-ից և vSphere-ից",
@@ -3494,7 +3494,8 @@
3494
3494
  "snapshotHasNoDescriptionYet": "Бұл суретке әлі сипаттама қосылмаған.",
3495
3495
  "takeSnapshot": "сурет",
3496
3496
  "newSnapshot": "Жаңа снимок",
3497
- "editSnapshot": "Снимокты өңдеу"
3497
+ "editSnapshot": "Снимокты өңдеу",
3498
+ "revertLatestSnapshot": "Варнузза және түтіннің тұманы"
3498
3499
  },
3499
3500
  "importVms": {
3500
3501
  "selectSourceTooltipDesc": "Esxi пайдаланушы құқықтары әкімші рөлдеріне сәйкес келуі керек, несиелер esxi және vSphere - ден алынады",
@@ -3494,7 +3494,8 @@
3494
3494
  "snapshotHasNoDescriptionYet": "У этого снимка пока нет описания.",
3495
3495
  "takeSnapshot": "Сделать снимок",
3496
3496
  "newSnapshot": "Новый снимок",
3497
- "editSnapshot": "Редактировать снимок"
3497
+ "editSnapshot": "Редактировать снимок",
3498
+ "revertLatestSnapshot": "Вернуться к последнему снимку"
3498
3499
  },
3499
3500
  "importVms": {
3500
3501
  "selectSourceTooltipDesc": "Права пользователя vmware дожны соответствовать ролям Administrator, креды принимаются от esxi и vSphere",
@@ -3492,7 +3492,8 @@
3492
3492
  "snapshotHasNoDescriptionYet": "此快照尚无描述。",
3493
3493
  "takeSnapshot": "快照",
3494
3494
  "newSnapshot": "新快照",
3495
- "editSnapshot": "编辑快照"
3495
+ "editSnapshot": "编辑快照",
3496
+ "revertLatestSnapshot": "回到上一张照片"
3496
3497
  },
3497
3498
  "importVms": {
3498
3499
  "selectSourceTooltipDesc": "Esxi用户权限必须对应于管理员角色. esxi和vSphere接受积分",
@@ -8,6 +8,7 @@
8
8
  ]"
9
9
  >
10
10
  <div
11
+ v-if="!props.isNewVmFromTemplate"
11
12
  :class="[
12
13
  'checkbox-container',
13
14
  { checked: isCustomizeOs },
@@ -59,35 +60,24 @@
59
60
  </p>
60
61
  </div>
61
62
  <div
62
- :class="[
63
- 'checkbox-container',
64
- { checked: isPowerOn },
65
- { disabled: props.isNewVmFromTemplate },
66
- ]"
63
+ :class="['checkbox-container', { checked: isPowerOn }]"
67
64
  @click.stop.prevent="onTogglePowerOn"
68
65
  >
69
- <!-- :disabled="props.isNewVmFromTemplate"-->
70
66
  <ui-checkbox
71
67
  v-model="isPowerOn"
72
68
  :label-text="localization.vmWizard.autoPowerOn"
73
- :title="localization.vmWizard.autoPowerOn"
74
- :disabled="props.isNewVmFromTemplate"
75
69
  test-id="power-on"
76
70
  size="md"
77
71
  />
78
- <!-- { disabled: props.isNewVmFromTemplate },-->
79
- <p
80
- :class="[
81
- 'checkbox-block-description mt-2 ml-7',
82
- { disabled: props.isNewVmFromTemplate },
83
- ]"
84
- >
72
+ <p class="checkbox-block-description mt-2 ml-7">
85
73
  {{ localization.vmWizard.powerVMAfterCreation }}
86
74
  </p>
87
75
  </div>
88
- <div v-if="props.isNewVmFromTemplate" class="checkbox-container">
76
+ <div
77
+ v-if="props.isNewVmFromTemplate && props.project === 'sphere'"
78
+ class="checkbox-container"
79
+ >
89
80
  <ui-input
90
- v-if="props.project === 'sphere'"
91
81
  v-model="maxParallel"
92
82
  :placeholder="localization.vmWizard.maxParallel"
93
83
  test-id="max-parallel"
@@ -180,7 +170,7 @@ const onToggleCustomizeHardware = (): void => {
180
170
  }
181
171
 
182
172
  const onTogglePowerOn = (): void => {
183
- if (props.isNewVmFromTemplate) return
173
+ // if (props.isNewVmFromTemplate) return
184
174
 
185
175
  isPowerOn.value = !isPowerOn.value
186
176
  if (isPowerOn.value) {
@@ -223,7 +213,8 @@ watch(
223
213
 
224
214
  <style scoped lang="scss">
225
215
  .select-options {
226
- grid-template-columns: 1fr 1fr;
216
+ //grid-template-columns: 1fr 1fr;
217
+ grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
227
218
  grid-template-rows: max-content;
228
219
  overflow-y: auto;
229
220
  padding-bottom: 16px;
@@ -2,7 +2,7 @@
2
2
  <div class="device-table-container">
3
3
  <ui-data-table
4
4
  :data="data"
5
- :options="options"
5
+ :options="tableConfig.options"
6
6
  :loading="props.isLoading"
7
7
  :total-pages="props.totalPages"
8
8
  :total-items="props.totalItems"
@@ -79,13 +79,10 @@ import type {
79
79
  UI_I_TableTexts,
80
80
  } from '~/node_modules/bfg-uikit/components/ui/dataTable/models/interfaces'
81
81
  import type { UI_I_DataTableSkeleton } from '~/node_modules/bfg-uikit/components/ui/dataTable/models/interfaces'
82
- import type { UI_T_SelectComputeResourceTabType } from '~/components/common/wizards/vm/migrate/select/storage/lib/models/types'
82
+ import type { UI_T_SelectComputeResourceTabType } from '~/components/common/wizards/vm/migrate/steps/selectStorage/lib/models/types'
83
83
  import type { UI_T_ComputeResourceTableItem } from '~/components/common/wizards/vm/migrate/steps/computeResource/lib/models/types'
84
- import {
85
- options,
86
- getHeaderDataFunc,
87
- getBodyDataFunc,
88
- } from '~/components/common/wizards/vm/migrate/steps/computeResource/tableView/new/lib/config/hostTable'
84
+ import * as hostTable from '~/components/common/wizards/vm/migrate/steps/computeResource/tableView/new/lib/config/hostTable'
85
+ import * as clusterTable from '~/components/common/wizards/vm/migrate/steps/computeResource/tableView/new/lib/config/clusterTable'
89
86
 
90
87
  const selectedDataLocal = defineModel<number | null>({ required: true })
91
88
  const props = defineProps<{
@@ -120,15 +117,33 @@ const tableSkeleton = ref<UI_I_DataTableSkeleton>({
120
117
  withoutPagination: true,
121
118
  })
122
119
 
120
+ const tableTitleMap = {
121
+ host: localization.value.common.hosts,
122
+ cluster: localization.value.common.clusters,
123
+ } as const
124
+ const tableConfigMap = {
125
+ host: hostTable,
126
+ cluster: clusterTable,
127
+ } as const
128
+
129
+ const tableConfig = computed(
130
+ () => tableConfigMap[props.type as keyof typeof tableConfigMap]
131
+ )
132
+
123
133
  const data = computed<UI_I_DataTable>(() => ({
124
- id: 'compute-resource-host-table',
125
- title: `${localization.value.common.hosts} (${props.totalItems})`,
134
+ id: `compute-resource-${props.type}-table`,
135
+ title: tableDataTitle.value,
126
136
  header: deviceHeadItems.value,
127
137
  body: deviceBodyItems.value,
128
138
  }))
129
-
139
+ const tableDataTitle = computed<string>(
140
+ () =>
141
+ `${tableTitleMap[props.type as keyof typeof tableConfigMap]} (${
142
+ props.totalItems
143
+ })`
144
+ )
130
145
  const deviceHeadItems = computed<UI_I_DataTableHeader[]>(() =>
131
- getHeaderDataFunc(localization.value)
146
+ tableConfig.value.getHeaderDataFunc(localization.value)
132
147
  )
133
148
 
134
149
  const deviceBodyItems = ref<UI_I_DataTableBody[]>([])
@@ -140,13 +155,16 @@ watch(
140
155
  return
141
156
  }
142
157
 
143
- deviceBodyItems.value = getBodyDataFunc(newValue, localization.value)
158
+ deviceBodyItems.value = tableConfig.value.getBodyDataFunc(
159
+ newValue,
160
+ localization.value
161
+ )
144
162
  },
145
163
  { deep: true, immediate: true }
146
164
  )
147
165
 
148
166
  const onSelectRow = (value: UI_I_DataTableBody[]): void => {
149
- selectedDataLocal.value = value?.[0].row
167
+ selectedDataLocal.value = value?.[0].row as number
150
168
  }
151
169
  </script>
152
170
 
@@ -0,0 +1,340 @@
1
+ import type {
2
+ UI_I_DataTableBody,
3
+ UI_I_DataTableOptions,
4
+ UI_I_DataTableHeader,
5
+ } from '~/node_modules/bfg-uikit/components/ui/dataTable/models/interfaces'
6
+ import type { UI_I_Localization } from '~/lib/models/interfaces'
7
+ import type { UI_I_ClusterTableItem } from '~/components/common/wizards/vm/migrate/steps/computeResource/tableView/lib/models/interfaces'
8
+ // import {
9
+ // UI_E_DeviceStatus,
10
+ // UI_E_DeviceStatusChipColor,
11
+ // UI_E_DeviceStatusIcon,
12
+ // } from '~/components/common/wizards/vm/migrate/steps/computeResource/tableView/new/lib/models/enums'
13
+
14
+ // // Маппинг для статусов
15
+ // const STATUS_MAPPING = {
16
+ // [UI_E_DeviceStatus.Unknown]: {
17
+ // icon: UI_E_DeviceStatusIcon.HelpIcon,
18
+ // chipColor: UI_E_DeviceStatusChipColor.Primary,
19
+ // },
20
+ // [UI_E_DeviceStatus.Supported]: {
21
+ // icon: UI_E_DeviceStatusIcon.StatusCheck,
22
+ // chipColor: UI_E_DeviceStatusChipColor.Green,
23
+ // },
24
+ // [UI_E_DeviceStatus.NotSupported]: {
25
+ // icon: UI_E_DeviceStatusIcon.Close,
26
+ // chipColor: UI_E_DeviceStatusChipColor.Red,
27
+ // },
28
+ // }
29
+
30
+ export const getHeaderDataFunc = (
31
+ localization: UI_I_Localization
32
+ ): UI_I_DataTableHeader[] => [
33
+ {
34
+ col: 'col0',
35
+ colName: 'name',
36
+ text: localization.common.name,
37
+ isSortable: true,
38
+ sort: 'asc',
39
+ width: '180px',
40
+ show: true,
41
+ filter: false,
42
+ },
43
+ {
44
+ col: 'col1',
45
+ colName: 'available_cpu',
46
+ text: localization.common.availableCpu,
47
+ isSortable: true,
48
+ sort: 'asc',
49
+ width: '96px',
50
+ show: true,
51
+ filter: false,
52
+ },
53
+ {
54
+ col: 'col2',
55
+ colName: 'available_memory',
56
+ text: localization.common.availableMemory,
57
+ isSortable: true,
58
+ sort: 'asc',
59
+ width: '96px',
60
+ show: true,
61
+ filter: false,
62
+ },
63
+ {
64
+ col: 'col3',
65
+ colName: 'available_storage',
66
+ text: localization.common.availableStorage,
67
+ isSortable: true,
68
+ sort: 'asc',
69
+ width: '96px',
70
+ show: true,
71
+ filter: false,
72
+ },
73
+ {
74
+ col: 'col4',
75
+ colName: 'drs',
76
+ text: localization.common.vSphere_DRS,
77
+ isSortable: true,
78
+ sort: 'asc',
79
+ width: '96px',
80
+ show: true,
81
+ filter: false,
82
+ },
83
+ {
84
+ col: 'col5',
85
+ colName: 'ha',
86
+ text: localization.common.vSphere_HA,
87
+ isSortable: true,
88
+ sort: 'asc',
89
+ width: '96px',
90
+ show: true,
91
+ filter: false,
92
+ },
93
+ {
94
+ col: 'col6',
95
+ colName: 'total_cpu',
96
+ text: localization.common.totalCpu,
97
+ isSortable: true,
98
+ sort: 'asc',
99
+ width: '96px',
100
+ show: true,
101
+ filter: false,
102
+ },
103
+ {
104
+ col: 'col7',
105
+ colName: 'total_memory',
106
+ text: localization.common.totalMemory,
107
+ isSortable: true,
108
+ sort: 'asc',
109
+ width: '96px',
110
+ show: true,
111
+ filter: false,
112
+ },
113
+ {
114
+ col: 'col8',
115
+ colName: 'total_storage',
116
+ text: localization.common.totalStorage,
117
+ isSortable: true,
118
+ sort: 'asc',
119
+ width: '96px',
120
+ show: true,
121
+ filter: false,
122
+ },
123
+ {
124
+ col: 'col9',
125
+ colName: 'vms',
126
+ text: localization.common.vms,
127
+ isSortable: true,
128
+ sort: 'asc',
129
+ width: '96px',
130
+ show: true,
131
+ filter: false,
132
+ },
133
+ {
134
+ col: 'col10',
135
+ colName: 'hosts',
136
+ text: localization.common.hosts,
137
+ isSortable: true,
138
+ sort: 'asc',
139
+ width: '96px',
140
+ show: true,
141
+ filter: false,
142
+ },
143
+ {
144
+ col: 'col11',
145
+ colName: 'cpus',
146
+ text: localization.common.cpus,
147
+ isSortable: true,
148
+ sort: 'asc',
149
+ width: '96px',
150
+ show: true,
151
+ filter: false,
152
+ },
153
+ {
154
+ col: 'col12',
155
+ colName: 'datastores',
156
+ text: localization.common.datastores,
157
+ isSortable: true,
158
+ sort: 'asc',
159
+ width: '96px',
160
+ show: true,
161
+ filter: false,
162
+ },
163
+ {
164
+ col: 'col13',
165
+ colName: 'vsan',
166
+ text: localization.common.vSAN,
167
+ isSortable: true,
168
+ sort: 'asc',
169
+ width: '96px',
170
+ show: true,
171
+ filter: false,
172
+ },
173
+ {
174
+ col: 'col14',
175
+ colName: 'vc',
176
+ text: localization.common.vc,
177
+ isSortable: true,
178
+ sort: 'asc',
179
+ width: '96px',
180
+ show: true,
181
+ filter: false,
182
+ },
183
+ {
184
+ col: 'col15',
185
+ colName: 'evc_cpu_mode',
186
+ text: localization.common.evcCpuMode,
187
+ isSortable: true,
188
+ sort: 'asc',
189
+ width: '96px',
190
+ show: true,
191
+ filter: false,
192
+ },
193
+ {
194
+ col: 'col16',
195
+ colName: 'evc_graphics_mode',
196
+ text: localization.common.evcGraphicsMode,
197
+ isSortable: true,
198
+ sort: 'asc',
199
+ width: '96px',
200
+ show: true,
201
+ filter: false,
202
+ },
203
+ ]
204
+ export const options: UI_I_DataTableOptions = {
205
+ perPageOptions: [{ text: '10', value: 100, default: true }],
206
+ isSelectable: true,
207
+ selectType: 'radio',
208
+ showPagination: false,
209
+ showPageInfo: false,
210
+ isSortable: true,
211
+ server: true,
212
+ isResizable: true,
213
+ showSelectedRows: false,
214
+ showColumnManager: true,
215
+ inModal: true,
216
+ inBlock: false,
217
+ // isFocusable: false,
218
+ // showPaginationOnTop: false,
219
+ // showSearch: false,
220
+ // withActions: false,
221
+ // showExport: false,
222
+ // withCollapse: false,
223
+ }
224
+
225
+ export const getBodyDataFunc = (
226
+ bodyData: UI_I_ClusterTableItem[],
227
+ _localization: UI_I_Localization
228
+ ): UI_I_DataTableBody[] => {
229
+ const { $binary }: any = useNuxtApp()
230
+
231
+ return bodyData.map((cluster, index: number) => {
232
+ // const statusKey = host.state
233
+ // ? UI_E_DeviceStatus.Unknown
234
+ // : UI_E_DeviceStatus.Supported
235
+ // const statusData = {
236
+ // ...STATUS_MAPPING[statusKey],
237
+ // testId: `${host.name}-${index}-status`,
238
+ // }
239
+
240
+ return {
241
+ row: index,
242
+ collapse: false,
243
+ isHiddenCollapse: false,
244
+ collapseToggle: false,
245
+
246
+ data: [
247
+ {
248
+ key: 'icon',
249
+ col: 'col0',
250
+ text: cluster.name,
251
+ data: {
252
+ iconClassName: 'vsphere-icon-cluster',
253
+ },
254
+ testId: `migrate-cluster-table-item-${index}`,
255
+ },
256
+
257
+ {
258
+ col: 'col1',
259
+ text: $binary.roundHz(cluster.available_cpu),
260
+ testId: `migrate-cluster-table-item-${index}`,
261
+ },
262
+ {
263
+ col: 'col2',
264
+ text: $binary.round(cluster.available_memory),
265
+ testId: `migrate-cluster-table-item-${index}`,
266
+ },
267
+ {
268
+ col: 'col3',
269
+ text: $binary.round(cluster.available_storage),
270
+ testId: `migrate-cluster-table-item-${index}`,
271
+ },
272
+ {
273
+ col: 'col4',
274
+ text: cluster.drs,
275
+ testId: `migrate-cluster-table-item-${index}`,
276
+ },
277
+ {
278
+ col: 'col5',
279
+ text: cluster.ha,
280
+ testId: `migrate-cluster-table-item-${index}`,
281
+ },
282
+ {
283
+ col: 'col6',
284
+ text: $binary.roundHz(cluster.total_cpu),
285
+ testId: `migrate-cluster-table-item-${index}`,
286
+ },
287
+ {
288
+ col: 'col7',
289
+ text: $binary.round(cluster.total_memory),
290
+ testId: `migrate-cluster-table-item-${index}`,
291
+ },
292
+ {
293
+ col: 'col8',
294
+ text: $binary.round(cluster.total_storage),
295
+ testId: `migrate-cluster-table-item-${index}`,
296
+ },
297
+ {
298
+ col: 'col9',
299
+ text: cluster.vms,
300
+ testId: `migrate-cluster-table-item-${index}`,
301
+ },
302
+ {
303
+ col: 'col10',
304
+ text: cluster.hosts,
305
+ testId: `migrate-cluster-table-item-${index}`,
306
+ },
307
+ {
308
+ col: 'col11',
309
+ text: cluster.cpus,
310
+ testId: `migrate-cluster-table-item-${index}`,
311
+ },
312
+ {
313
+ col: 'col12',
314
+ text: cluster.datastores,
315
+ testId: `migrate-cluster-table-item-${index}`,
316
+ },
317
+ {
318
+ col: 'col13',
319
+ text: cluster.vsan,
320
+ testId: `migrate-cluster-table-item-${index}`,
321
+ },
322
+ {
323
+ col: 'col14',
324
+ text: cluster.vc,
325
+ testId: `migrate-cluster-table-item-${index}`,
326
+ },
327
+ {
328
+ col: 'col15',
329
+ text: cluster.evc_cpu_mode,
330
+ testId: `migrate-cluster-table-item-${index}`,
331
+ },
332
+ {
333
+ col: 'col16',
334
+ text: cluster.evc_graphics_mode,
335
+ testId: `migrate-cluster-table-item-${index}`,
336
+ },
337
+ ],
338
+ }
339
+ })
340
+ }
@@ -222,7 +222,9 @@ export const getBodyDataFunc = (
222
222
  key: 'icon',
223
223
  col: 'col0',
224
224
  text: host.name,
225
- data: `vsphere-icon-${hostIconByState[host.state]}`,
225
+ data: {
226
+ iconClassName: `vsphere-icon-${hostIconByState[host.state]}`,
227
+ },
226
228
  testId: `migrate-host-table-item-${index}`,
227
229
  },
228
230
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bfg-common",
3
3
  "private": false,
4
- "version": "1.6.0",
4
+ "version": "1.6.2",
5
5
  "scripts": {
6
6
  "build": "nuxt build",
7
7
  "dev": "nuxt dev --port=3002",