bfg-common 1.5.85 → 1.5.87

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,27 +1,48 @@
1
1
  <template>
2
2
  <div class="host-accessibility">
3
- {{ props }}
4
- {{ modelHosts }}
3
+ <ui-tabs
4
+ v-model="activeTabModel"
5
+ test-id="accessibility"
6
+ :tabs="tabsLocal"
7
+ type="outline"
8
+ class="host-accessibility__tab"
9
+ >
10
+ </ui-tabs>
11
+
12
+ <common-wizards-datastore-add-steps-host-accessibility-table
13
+ v-model="formHostsLocal"
14
+ :data="props.hosts"
15
+ :table-type="activeTabModel"
16
+ />
5
17
  </div>
6
18
  </template>
7
19
 
8
20
  <script lang="ts" setup>
9
21
  import type { UI_I_CollapseNavItem } from '~/components/atoms/collapse/lib/models/interfaces'
10
- import type { UI_I_Localization } from '~/lib/models/interfaces'
11
- import type { T_HostsAccessibilityTab } from '~/components/common/wizards/datastore/add/nfs/accessibility/lib/models/types'
12
- import type { UI_I_CreateDatastoreHosts } from '~/components/common/wizards/datastore/add/nfs/accessibility/tablesView/lib/models/interfaces'
13
- import { hostAccessibilityTabsFunc } from '~/components/common/wizards/datastore/add/nfs/accessibility/lib/config/tabsPannel'
22
+ import type { UI_I_CompatibleHosts } from '~/components/common/wizards/datastore/add/steps/hostAccessibility/table/lib/models/interfaces'
23
+ import type { UI_T_HostsAccessibilityTab } from '~/components/common/wizards/datastore/add/steps/hostAccessibility/lib/models/types'
14
24
 
25
+ const formHostsLocal = defineModel<string[]>({ required: true })
26
+ const activeTabModel = defineModel<UI_T_HostsAccessibilityTab>('activeTab', {
27
+ required: true,
28
+ })
15
29
  const props = defineProps<{
16
- alertMessages: string[]
17
- hosts?: UI_I_CreateDatastoreHosts
30
+ hosts?: UI_I_CompatibleHosts
31
+ tabOptions: UI_I_CollapseNavItem[]
18
32
  }>()
19
- const modelHosts = defineModel<string[]>()
20
- // const emits = defineEmits<{
21
- // (event: 'hide-alert', value: number): void
22
- // }>()
23
33
 
24
- // const localization = computed<UI_I_Localization>(() => useLocal())
34
+ const tabsLocal = computed<UI_I_CollapseNavItem[]>(() =>
35
+ props.tabOptions.map((tab: UI_I_CollapseNavItem) => ({
36
+ ...tab,
37
+ name: tab.text,
38
+ }))
39
+ )
25
40
  </script>
26
41
 
27
- <style lang="scss" scoped></style>
42
+ <style lang="scss" scoped>
43
+ .host-accessibility {
44
+ &__tab {
45
+ padding: 16px 0;
46
+ }
47
+ }
48
+ </style>
@@ -26,7 +26,6 @@
26
26
 
27
27
  <script lang="ts" setup>
28
28
  import type { UI_I_CollapseNavItem } from '~/components/atoms/collapse/lib/models/interfaces'
29
- import type { UI_I_Localization } from '~/lib/models/interfaces'
30
29
  import type { UI_I_CompatibleHosts } from '~/components/common/wizards/datastore/add/steps/hostAccessibility/table/lib/models/interfaces'
31
30
  import type { UI_T_HostsAccessibilityTab } from '~/components/common/wizards/datastore/add/steps/hostAccessibility/lib/models/types'
32
31
  import { dynamicSteps } from '~/components/common/wizards/datastore/add/lib/config/steps'
@@ -44,8 +43,6 @@ const emits = defineEmits<{
44
43
  (event: 'hide-alert', value: number): void
45
44
  }>()
46
45
 
47
- const localization = computed<UI_I_Localization>(() => useLocal())
48
-
49
46
  const onHideAlert = (): void =>
50
47
  emits('hide-alert', dynamicSteps.hostAccessibility)
51
48
  </script>
@@ -1,16 +1,29 @@
1
1
  <template>
2
- <ui-data-table
3
- test-id="add-host-license-table"
4
- :data="data"
5
- :options="options"
6
- :loading="props.loading"
7
- :total-pages="props.totalPages"
8
- :total-items="props.totalItems"
9
- :texts="texts"
10
- class="license-table"
11
- @select-row="onSelectRow"
12
- >
13
- </ui-data-table>
2
+ <div class="host-accessibility-table">
3
+ <h2>
4
+ {{ tableHeadline }}
5
+ </h2>
6
+
7
+ <ui-data-table
8
+ test-id="accessibility-table"
9
+ :data="data"
10
+ :options="options"
11
+ :loading="props.loading"
12
+ :total-pages="props.totalPages"
13
+ :total-items="props.totalItems"
14
+ :texts="texts"
15
+ class="accessibility-host-table"
16
+ size="sm"
17
+ @select-row="onSelectRow"
18
+ >
19
+ <template #icon="{ item }">
20
+ <span :class="['icon', item.data.iconClassName]" />
21
+ <span class="text-ellipsis">
22
+ {{ item.text }}
23
+ </span>
24
+ </template>
25
+ </ui-data-table>
26
+ </div>
14
27
  </template>
15
28
 
16
29
  <script lang="ts" setup>
@@ -26,10 +39,11 @@ import {
26
39
  getHeaderDataFunc,
27
40
  getBodyDataFunc,
28
41
  } from '~/components/common/wizards/datastore/add/steps/hostAccessibility/table/new/lib/config/compatibleTable'
42
+ import { UI_I_CompatibleHostsTableItem } from '~/components/common/wizards/datastore/add/steps/hostAccessibility/table/lib/models/interfaces'
29
43
 
30
- const selectedLicenseIdLocal = defineModel<number>({ required: true })
44
+ const selectedHostsIdLocal = defineModel<string[]>({ required: true })
31
45
  const props = defineProps<{
32
- tableData: any[]
46
+ tableData: UI_I_CompatibleHostsTableItem[]
33
47
  totalItems: number
34
48
  totalPages: number
35
49
  loading: boolean
@@ -53,32 +67,51 @@ const texts = computed<UI_I_TableTexts>(() => ({
53
67
  }))
54
68
 
55
69
  const data = computed<UI_I_DataTable>(() => ({
56
- id: 'license-table',
57
- header: taskHeadItems.value,
58
- body: taskBodyItems.value,
70
+ id: 'accessibility-host-table',
71
+ header: hostHeadItems.value,
72
+ body: hostBodyItems.value,
59
73
  }))
60
74
 
61
- const taskHeadItems = computed<UI_I_DataTableHeader[]>(() =>
75
+ const hostHeadItems = computed<UI_I_DataTableHeader[]>(() =>
62
76
  getHeaderDataFunc(localization.value)
63
77
  )
64
78
 
65
- const taskBodyItems = ref<UI_I_DataTableBody[]>([])
79
+ const hostBodyItems = ref<UI_I_DataTableBody[]>([])
66
80
  watch(
67
81
  () => props.tableData,
68
- (newValue) => {
82
+ (newValue: UI_I_CompatibleHostsTableItem[]) => {
69
83
  if (!newValue?.length) {
70
- taskBodyItems.value = []
84
+ hostBodyItems.value = []
71
85
  return
72
86
  }
73
87
 
74
- taskBodyItems.value = getBodyDataFunc(newValue)
88
+ hostBodyItems.value = getBodyDataFunc(newValue)
75
89
  },
76
90
  { deep: true, immediate: true }
77
91
  )
78
92
 
93
+ const tableHeadline = computed<string>(() => {
94
+ const { selected } = localization.value.common
95
+ return ` ${props.totalItems} ${selected}`
96
+ })
97
+
79
98
  const onSelectRow = (value: UI_I_DataTableBody[]): void => {
80
- selectedLicenseIdLocal.value = value?.[0].row
99
+ // TODO поправить сейчас работает неправильно < selectedHostsIdLocal >
100
+ selectedHostsIdLocal.value = value?.[0].row
81
101
  }
82
102
  </script>
83
103
 
84
- <style lang="scss" scoped></style>
104
+ <style lang="scss" scoped>
105
+ .host-accessibility-table {
106
+ h2 {
107
+ font-family: Inter, serif;
108
+ color: var(--title-form-first-color);
109
+ font-weight: 400;
110
+ font-size: 12px;
111
+ line-height: 100%;
112
+ margin-bottom: 12px;
113
+ }
114
+ .icon {
115
+ }
116
+ }
117
+ </style>
@@ -4,57 +4,32 @@ import type {
4
4
  UI_I_DataTableHeader,
5
5
  } from '~/node_modules/bfg-uikit/components/ui/dataTable/models/interfaces'
6
6
  import type { UI_I_Localization } from '~/lib/models/interfaces'
7
+ import type { UI_I_CompatibleHostsTableItem } from '~/components/common/wizards/datastore/add/steps/hostAccessibility/table/lib/models/interfaces'
8
+ import {
9
+ hostIconByState,
10
+ clusterIconByState,
11
+ } from '~/components/common/lib/config/states'
7
12
 
8
13
  export const getHeaderDataFunc = (
9
14
  localization: UI_I_Localization
10
15
  ): UI_I_DataTableHeader[] => [
11
16
  {
12
17
  col: 'col0',
13
- colName: 'license',
14
- text: localization.license.license,
18
+ colName: 'host',
19
+ text: localization.common.host,
15
20
  isSortable: true,
16
21
  sort: 'asc',
17
- width: '120px',
22
+ width: '250px',
18
23
  show: true,
19
24
  filter: false,
20
25
  },
21
26
  {
22
27
  col: 'col1',
23
- colName: 'license_key',
24
- text: localization.license.licenseKey,
28
+ colName: 'cluster',
29
+ text: localization.common.cluster,
25
30
  isSortable: true,
26
31
  sort: 'asc',
27
- width: '120px',
28
- show: true,
29
- filter: false,
30
- },
31
- {
32
- col: 'col2',
33
- colName: 'product',
34
- text: localization.common.product,
35
- isSortable: true,
36
- sort: 'asc',
37
- width: '96px',
38
- show: true,
39
- filter: false,
40
- },
41
- {
42
- col: 'col3',
43
- colName: 'usage',
44
- text: localization.common.usage,
45
- isSortable: true,
46
- sort: 'asc',
47
- width: '96px',
48
- show: true,
49
- filter: false,
50
- },
51
- {
52
- col: 'col4',
53
- colName: 'capacity',
54
- text: localization.common.capacity,
55
- isSortable: true,
56
- sort: 'asc',
57
- width: '96px',
32
+ width: '250px',
58
33
  show: true,
59
34
  filter: false,
60
35
  },
@@ -73,30 +48,38 @@ export const options: UI_I_DataTableOptions = {
73
48
  showSelectedRows: false,
74
49
  showColumnManager: false,
75
50
  withActions: false,
76
- selectType: 'radio',
51
+ selectType: 'checkbox',
77
52
  inBlock: true,
78
53
  showExport: false,
79
54
  withCollapse: false,
80
55
  }
81
56
 
82
57
  export const getBodyDataFunc = (
83
- bodyData: any[]
58
+ bodyData: UI_I_CompatibleHostsTableItem[]
84
59
  ): UI_I_DataTableBody[] => {
85
- return bodyData.map((license, _index: number) => {
60
+ return bodyData.map((host, _index: number) => {
86
61
  return {
87
- row: Number(license.id),
62
+ row: Number(host.id),
88
63
  collapse: false,
89
64
  isHiddenCollapse: false,
90
65
  collapseToggle: false,
91
66
  data: [
92
- { col: 'col0', text: license.licence },
93
67
  {
68
+ key: 'icon',
69
+ col: 'col0',
70
+ text: host.host,
71
+ data: {
72
+ iconClassName: `vsphere-icon-${hostIconByState[host.state]}`,
73
+ },
74
+ },
75
+ {
76
+ key: 'icon',
94
77
  col: 'col1',
95
- text: license.licence_key,
78
+ text: host.cluster || '--',
79
+ data: {
80
+ iconClassName: `vsphere-icon-${clusterIconByState[1]}`,
81
+ },
96
82
  },
97
- { col: 'col2', text: license.product },
98
- { col: 'col3', text: license.usage },
99
- { col: 'col4', text: license.capacity || '--' },
100
83
  ],
101
84
  }
102
85
  })
@@ -3,8 +3,8 @@ import type {
3
3
  UI_I_BodyItem,
4
4
  } from '~/components/atoms/table/dataGrid/lib/models/interfaces'
5
5
  import type { UI_I_Localization } from '~/lib/models/interfaces'
6
- import { constructHeadItem } from '~/components/atoms/table/dataGrid/lib/utils/constructDataTable'
7
- import type { I_CompatibleHostsTable } from '~/components/common/wizards/datastore/add/nfs/accessibility/lib/models/interfaces'
6
+ import * as defaultSettings from '~/components/atoms/table/dataGrid/lib/config/settingsTable'
7
+ import type { UI_I_CompatibleHostsTableItem } from '~/components/common/wizards/datastore/add/steps/hostAccessibility/table/lib/models/interfaces'
8
8
  import { compatibleHostsTableKeys } from '~/components/common/wizards/datastore/add/steps/hostAccessibility/table/old/lib/config/tableKeys'
9
9
  import {
10
10
  hostIconByState,
@@ -19,22 +19,18 @@ const getItems = (
19
19
  [localization.common.cluster, true, '300px', compatibleHostsTableKeys[1]],
20
20
  ]
21
21
  }
22
-
23
22
  export const headItems = (localization: UI_I_Localization): UI_I_HeadItem[] => {
24
- const result: UI_I_HeadItem[] = []
25
- getItems(localization).forEach((item) => {
26
- result.push(constructHeadItem('icon', item[0], item[3], false, item[2]))
23
+ return defaultSettings.defaultHeadItems(getItems(localization), {
24
+ icon: [0, 1],
27
25
  })
28
- return result
29
26
  }
30
27
 
31
28
  export const bodyItems = (
32
- data: I_CompatibleHostsTable[]
29
+ data: UI_I_CompatibleHostsTableItem[]
33
30
  ): UI_I_BodyItem[][] => {
34
31
  const bodyItems: UI_I_BodyItem[][] = []
35
- data.forEach((item: I_CompatibleHostsTable, key) => {
32
+ data.forEach((item: UI_I_CompatibleHostsTableItem, key) => {
36
33
  const hostData = {
37
- // @ts-ignore
38
34
  iconClassName: `vsphere-icon-${hostIconByState[item.state]}`,
39
35
  }
40
36
  const clusterData = {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bfg-common",
3
3
  "private": false,
4
- "version": "1.5.85",
4
+ "version": "1.5.87",
5
5
  "scripts": {
6
6
  "build": "nuxt build",
7
7
  "dev": "nuxt dev --port=3002",