@xen-orchestra/web-core 0.54.0 → 0.56.0

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 (107) hide show
  1. package/lib/components/button-group/VtsButtonGroup.vue +11 -1
  2. package/lib/components/card-object-title/VtsCardObjectTitle.vue +36 -0
  3. package/lib/components/code-snippet/VtsCodeSnippet.vue +11 -5
  4. package/lib/components/drawer/VtsDrawer.vue +89 -0
  5. package/lib/components/drawer/VtsDrawerButton.vue +22 -0
  6. package/lib/components/drawer/VtsDrawerCancelButton.vue +33 -0
  7. package/lib/components/drawer/VtsDrawerConfirmButton.vue +32 -0
  8. package/lib/components/drawer/VtsDrawerList.vue +34 -0
  9. package/lib/components/icon/VtsIcon.vue +3 -1
  10. package/lib/components/layout/VtsContentSidePanel.vue +41 -0
  11. package/lib/components/layout/VtsLayoutSidebar.vue +5 -2
  12. package/lib/components/menu/VtsActionsMenu.vue +37 -3
  13. package/lib/components/modal/VtsModalButton.vue +0 -1
  14. package/lib/components/operation-card/VtsOperationCard.vue +2 -1
  15. package/lib/components/panel/VtsPanel.vue +80 -0
  16. package/lib/components/panel/VtsSidePanel.vue +140 -0
  17. package/lib/components/query-builder/VtsQueryBuilderModal.vue +0 -1
  18. package/lib/components/select/VtsSelect.vue +1 -0
  19. package/lib/components/state-hero/VtsStateHero.vue +26 -24
  20. package/lib/components/table/VtsTable.vue +2 -1
  21. package/lib/components/table/cells/VtsActionCell.vue +7 -0
  22. package/lib/components/table/cells/VtsHeaderCell.vue +1 -17
  23. package/lib/components/table/cells/VtsLinkCell.vue +3 -1
  24. package/lib/components/table/cells/VtsTagCell.vue +4 -2
  25. package/lib/components/tree/VtsTreeItem.vue +9 -3
  26. package/lib/components/tree/VtsTreeList.vue +6 -3
  27. package/lib/components/tree/VtsTreeLoadingItem.vue +3 -3
  28. package/lib/components/ui/drawer/UiDrawer.vue +123 -0
  29. package/lib/components/ui/head-bar/UiHeadBar.vue +1 -1
  30. package/lib/components/ui/input/UiInput.vue +3 -1
  31. package/lib/components/ui/link/UiLink.vue +3 -1
  32. package/lib/components/ui/modal/UiModal.vue +10 -18
  33. package/lib/components/ui/panel/UiPanel.vue +7 -24
  34. package/lib/components/ui/tree-item-label/UiTreeItemLabel.vue +1 -1
  35. package/lib/composables/default-tab.composable.ts +4 -0
  36. package/lib/composables/table-state.composable.ts +1 -1
  37. package/lib/icons/action-icons.ts +20 -2
  38. package/lib/icons/custom-icons.ts +16 -0
  39. package/lib/icons/object-icons.ts +33 -18
  40. package/lib/locales/cs.json +110 -11
  41. package/lib/locales/da.json +1 -3
  42. package/lib/locales/de.json +1 -12
  43. package/lib/locales/en.json +76 -12
  44. package/lib/locales/es.json +15 -6
  45. package/lib/locales/fa.json +0 -1
  46. package/lib/locales/fr.json +76 -12
  47. package/lib/locales/it.json +0 -1
  48. package/lib/locales/ko.json +0 -2
  49. package/lib/locales/nb-NO.json +18 -20
  50. package/lib/locales/nl.json +0 -11
  51. package/lib/locales/pt-BR.json +0 -4
  52. package/lib/locales/pt.json +0 -4
  53. package/lib/locales/ru.json +0 -1
  54. package/lib/locales/sk.json +110 -11
  55. package/lib/locales/sv.json +2 -13
  56. package/lib/locales/uk.json +0 -1
  57. package/lib/locales/zh-Hans.json +79 -16
  58. package/lib/packages/drawer/DrawerProvider.vue +17 -0
  59. package/lib/packages/drawer/README.md +189 -0
  60. package/lib/packages/drawer/create-drawer-opener.ts +119 -0
  61. package/lib/packages/drawer/drawer.store.ts +22 -0
  62. package/lib/packages/drawer/types.ts +93 -0
  63. package/lib/packages/drawer/use-drawer.ts +53 -0
  64. package/lib/packages/modal/create-modal-opener.ts +12 -10
  65. package/lib/packages/remote-resource/define-remote-resource.ts +64 -29
  66. package/lib/packages/tree/types.ts +6 -0
  67. package/lib/packages/tree/use-tree.ts +38 -37
  68. package/lib/stores/panel.store.ts +56 -5
  69. package/lib/tables/column-definitions/action-column.ts +22 -10
  70. package/lib/tables/column-definitions/address-column.ts +1 -1
  71. package/lib/tables/column-definitions/button-column.ts +1 -1
  72. package/lib/tables/column-definitions/button-icon-column.ts +1 -1
  73. package/lib/tables/column-definitions/collapsed-list-column.ts +1 -1
  74. package/lib/tables/column-definitions/date-column.ts +1 -1
  75. package/lib/tables/column-definitions/double-link-column.ts +1 -1
  76. package/lib/tables/column-definitions/info-column.ts +1 -1
  77. package/lib/tables/column-definitions/input-column.ts +1 -5
  78. package/lib/tables/column-definitions/link-column.ts +1 -1
  79. package/lib/tables/column-definitions/link-or-text-column.ts +1 -1
  80. package/lib/tables/column-definitions/literal-column.ts +1 -1
  81. package/lib/tables/column-definitions/number-column.ts +1 -1
  82. package/lib/tables/column-definitions/percent-column.ts +1 -1
  83. package/lib/tables/column-definitions/progress-bar-column.ts +1 -1
  84. package/lib/tables/column-definitions/select-column.ts +1 -1
  85. package/lib/tables/column-definitions/status-column.ts +2 -2
  86. package/lib/tables/column-definitions/tag-column.ts +3 -2
  87. package/lib/tables/column-definitions/text-column.ts +1 -1
  88. package/lib/tables/column-definitions/truncated-text-column.ts +1 -1
  89. package/lib/tables/column-sets/backup-job-schedule-columns.ts +2 -2
  90. package/lib/tables/column-sets/backup-log-columns.ts +1 -1
  91. package/lib/tables/column-sets/new-vm-network-columns.ts +0 -2
  92. package/lib/tables/column-sets/new-vm-sr-columns.ts +0 -1
  93. package/lib/tables/column-sets/server-columns.ts +1 -1
  94. package/lib/tables/column-sets/snapshot-columns.ts +1 -1
  95. package/lib/tables/column-sets/sr-columns.ts +2 -2
  96. package/lib/tables/column-sets/traffic-rules-columns.ts +5 -7
  97. package/lib/tables/column-sets/vif-network-columns.ts +24 -0
  98. package/lib/tables/column-sets/vm-columns.ts +2 -3
  99. package/lib/tables/helpers/render-head-cell.ts +2 -4
  100. package/lib/tables/types.ts +0 -2
  101. package/lib/types/connection.ts +14 -0
  102. package/lib/types/state-hero.type.ts +19 -0
  103. package/lib/types/storage-repository.type.ts +14 -0
  104. package/lib/types/vue-virtual-scroller.d.ts +8 -2
  105. package/lib/utils/injection-keys.util.ts +1 -1
  106. package/lib/utils/sr.utils.ts +34 -0
  107. package/package.json +4 -4
@@ -4,18 +4,30 @@ import { defineColumn } from '@core/packages/table/define-column'
4
4
  import type { ButtonIconConfig } from '@core/tables/column-definitions/button-icon-column.ts'
5
5
  import { renderHeadCell } from '@core/tables/helpers/render-head-cell'
6
6
  import type { HeaderConfig } from '@core/tables/types.ts'
7
- import { h, toValue } from 'vue'
7
+ import { type Component, h, toValue } from 'vue'
8
8
 
9
9
  export type { ActionItem }
10
10
 
11
11
  export const useActionColumn = defineColumn((config: HeaderConfig & Partial<ButtonIconConfig>) => ({
12
- renderHead: () => renderHeadCell(config.headerIcon, config.headerLabel),
13
- renderBody: (params: { onClick: () => void; actions?: ActionItem[] }) =>
14
- h(VtsActionCell, {
15
- buttonIcon: toValue(config.buttonIcon ?? 'fa:eye'),
16
- buttonAccent: toValue(config.buttonAccent),
17
- buttonSize: toValue(config.buttonSize),
18
- actions: params.actions,
19
- onClick: params.onClick,
20
- }),
12
+ renderHead: () => renderHeadCell(config.headerLabel),
13
+ renderBody: (params: {
14
+ onClick: () => void
15
+ actions?: ActionItem[]
16
+ component?: Component
17
+ props?: Record<string, unknown>
18
+ }) => {
19
+ const { component, props } = params
20
+
21
+ return h(
22
+ VtsActionCell,
23
+ {
24
+ buttonIcon: toValue(config.buttonIcon ?? 'fa:eye'),
25
+ buttonAccent: toValue(config.buttonAccent),
26
+ buttonSize: toValue(config.buttonSize),
27
+ actions: params.actions,
28
+ onClick: params.onClick,
29
+ },
30
+ component ? () => h(component, props) : undefined
31
+ )
32
+ },
21
33
  }))
@@ -1,4 +1,4 @@
1
1
  import { useCollapsedListColumn } from '@core/tables/column-definitions/collapsed-list-column.ts'
2
2
  import type { HeaderConfig } from '@core/tables/types.ts'
3
3
 
4
- export const useAddressColumn = (config?: HeaderConfig) => useCollapsedListColumn({ headerIcon: 'fa:at', ...config })
4
+ export const useAddressColumn = (config?: HeaderConfig) => useCollapsedListColumn(config)
@@ -17,7 +17,7 @@ type ButtonConfig = {
17
17
  }
18
18
 
19
19
  export const useButtonColumn = defineColumn((config?: HeaderConfig & ButtonConfig) => ({
20
- renderHead: () => renderHeadCell(config?.headerIcon, config?.headerLabel),
20
+ renderHead: () => renderHeadCell(config?.headerLabel),
21
21
  renderBody: (label: string, onClick: () => void, props?: Partial<ButtonProps>) =>
22
22
  renderBodyCell(() =>
23
23
  h(
@@ -16,7 +16,7 @@ export type ButtonIconConfig = {
16
16
  }
17
17
 
18
18
  export const useButtonIconColumn = defineColumn((config: HeaderConfig & ButtonIconConfig) => ({
19
- renderHead: () => renderHeadCell(config.headerIcon, config.headerLabel),
19
+ renderHead: () => renderHeadCell(config.headerLabel),
20
20
  renderBody: (onClick: () => void) =>
21
21
  h(UiTableCell, { align: 'center', style: 'width: 6rem' }, () =>
22
22
  h(UiButtonIcon, {
@@ -7,6 +7,6 @@ import { toArray } from '@core/utils/to-array.utils.ts'
7
7
  import { h } from 'vue'
8
8
 
9
9
  export const useCollapsedListColumn = defineColumn((config?: HeaderConfig) => ({
10
- renderHead: () => renderHeadCell(config?.headerIcon ?? 'fa:square-caret-down', config?.headerLabel),
10
+ renderHead: () => renderHeadCell(config?.headerLabel),
11
11
  renderBody: (items: MaybeArray<string>) => h(VtsCollapsedListCell, { items: toArray(items) }),
12
12
  }))
@@ -13,7 +13,7 @@ export const useDateColumn = defineColumn((config?: HeaderConfig & DateConfig) =
13
13
  const { d } = useI18n()
14
14
 
15
15
  return {
16
- renderHead: () => renderHeadCell(config?.headerIcon ?? 'fa:calendar', config?.headerLabel),
16
+ renderHead: () => renderHeadCell(config?.headerLabel),
17
17
  renderBody: (date?: DateLike, options?: { relative?: boolean }) => {
18
18
  return renderBodyCell(() => {
19
19
  if (date === undefined) {
@@ -5,7 +5,7 @@ import type { HeaderConfig } from '@core/tables/types.ts'
5
5
  import { h } from 'vue'
6
6
 
7
7
  export const useDoubleLinkColumn = defineColumn((config?: HeaderConfig) => ({
8
- renderHead: () => renderHeadCell(config?.headerIcon ?? 'fa:a', config?.headerLabel),
8
+ renderHead: () => renderHeadCell(config?.headerLabel),
9
9
  renderBody: (link: { label: string } & VtsDoubleLinkCellProps) => {
10
10
  const { label, ...doubleLinkCellProps } = link
11
11
 
@@ -7,6 +7,6 @@ import type { HeaderConfig } from '@core/tables/types.ts'
7
7
  import { h } from 'vue'
8
8
 
9
9
  export const useInfoColumn = defineColumn((config?: HeaderConfig) => ({
10
- renderHead: () => renderHeadCell(config?.headerIcon ?? 'fa:square-caret-down', config?.headerLabel),
10
+ renderHead: () => renderHeadCell(config?.headerLabel),
11
11
  renderBody: (label: string, accent: InfoAccent) => renderBodyCell(() => h(UiInfo, { accent }, () => label)),
12
12
  }))
@@ -11,11 +11,7 @@ type InputConfig = {
11
11
  }
12
12
 
13
13
  export const useInputColumn = defineColumn((config?: HeaderConfig & InputConfig) => ({
14
- renderHead: () =>
15
- renderHeadCell(
16
- config?.headerIcon ?? (config?.type === 'number' ? 'fa:hashtag' : 'fa:align-left'),
17
- config?.headerLabel
18
- ),
14
+ renderHead: () => renderHeadCell(config?.headerLabel),
19
15
  renderBody: (model: Ref<string | number | undefined>, inputProps?: { disabled?: boolean }) =>
20
16
  renderBodyCell(() =>
21
17
  h(UiInput, {
@@ -5,7 +5,7 @@ import type { HeaderConfig } from '@core/tables/types.ts'
5
5
  import { h } from 'vue'
6
6
 
7
7
  export const useLinkColumn = defineColumn((config?: HeaderConfig) => ({
8
- renderHead: () => renderHeadCell(config?.headerIcon ?? 'fa:a', config?.headerLabel),
8
+ renderHead: () => renderHeadCell(config?.headerLabel),
9
9
  renderBody: (link: { label: string } & VtsLinkCellProps) => {
10
10
  const { label, ...linkCellProps } = link
11
11
 
@@ -6,7 +6,7 @@ import type { HeaderConfig } from '@core/tables/types.ts'
6
6
  import { h } from 'vue'
7
7
 
8
8
  export const useLinkOrTextColumn = defineColumn((config?: HeaderConfig) => ({
9
- renderHead: () => renderHeadCell(config?.headerIcon, config?.headerLabel),
9
+ renderHead: () => renderHeadCell(config?.headerLabel),
10
10
  renderBody: (link: { label: string; suffix?: string } & VtsLinkCellProps) => {
11
11
  const { label, suffix, ...linkCellProps } = link
12
12
 
@@ -4,6 +4,6 @@ import { renderHeadCell } from '@core/tables/helpers/render-head-cell'
4
4
  import type { HeaderConfig } from '@core/tables/types.ts'
5
5
 
6
6
  export const useLiteralColumn = defineColumn((config?: HeaderConfig) => ({
7
- renderHead: () => renderHeadCell(config?.headerIcon ?? 'fa:square-caret-down', config?.headerLabel),
7
+ renderHead: () => renderHeadCell(config?.headerLabel),
8
8
  renderBody: (value: any) => renderBodyCell(() => value),
9
9
  }))
@@ -5,6 +5,6 @@ import type { HeaderConfig } from '@core/tables/types.ts'
5
5
  import { h } from 'vue'
6
6
 
7
7
  export const useNumberColumn = defineColumn((headerConfig?: HeaderConfig) => ({
8
- renderHead: () => renderHeadCell(headerConfig?.headerIcon ?? 'fa:hashtag', headerConfig?.headerLabel),
8
+ renderHead: () => renderHeadCell(headerConfig?.headerLabel),
9
9
  renderBody: (number?: number | string, unit?: string) => h(VtsNumberCell, { unit }, () => number),
10
10
  }))
@@ -9,7 +9,7 @@ export const usePercentColumn = defineColumn((headerConfig?: HeaderConfig) => {
9
9
  const { n } = useI18n()
10
10
 
11
11
  return {
12
- renderHead: () => renderHeadCell(headerConfig?.headerIcon ?? 'fa:hashtag', headerConfig?.headerLabel),
12
+ renderHead: () => renderHeadCell(headerConfig?.headerLabel),
13
13
  renderBody: (number: number) => h(VtsNumberCell, () => n(number, 'percent')),
14
14
  }
15
15
  })
@@ -5,6 +5,6 @@ import type { HeaderConfig } from '@core/tables/types.ts'
5
5
  import { h } from 'vue'
6
6
 
7
7
  export const useProgressBarColumn = defineColumn((config?: HeaderConfig) => ({
8
- renderHead: () => renderHeadCell(config?.headerIcon ?? 'fa:hashtag', config?.headerLabel),
8
+ renderHead: () => renderHeadCell(config?.headerLabel),
9
9
  renderBody: (current: number, total: number) => h(VtsProgressBarCell, { current, total }),
10
10
  }))
@@ -7,6 +7,6 @@ import type { HeaderConfig } from '@core/tables/types.ts'
7
7
  import { h } from 'vue'
8
8
 
9
9
  export const useSelectColumn = defineColumn((config?: HeaderConfig) => ({
10
- renderHead: () => renderHeadCell(config?.headerIcon, config?.headerLabel),
10
+ renderHead: () => renderHeadCell(config?.headerLabel),
11
11
  renderBody: (id: FormSelectId) => renderBodyCell(() => h(VtsSelect, { accent: 'brand', id })),
12
12
  }))
@@ -7,10 +7,10 @@ import { useI18n } from 'vue-i18n'
7
7
 
8
8
  export const useStatusColumn = defineColumn((config?: HeaderConfig & Omit<StatusCellProps, 'status'>) => {
9
9
  const { t } = useI18n()
10
- const { headerIcon, headerLabel, ...statusCellProps } = config ?? {}
10
+ const { headerLabel, ...statusCellProps } = config ?? {}
11
11
 
12
12
  return {
13
- renderHead: () => renderHeadCell(headerIcon ?? 'fa:square-caret-down', headerLabel ?? t('status')),
13
+ renderHead: () => renderHeadCell(headerLabel ?? t('status')),
14
14
  renderBody: (status: StatusCellProps['status']) => h(VtsStatusCell, { status, ...statusCellProps }),
15
15
  }
16
16
  })
@@ -1,4 +1,5 @@
1
1
  import VtsTagCell from '@core/components/table/cells/VtsTagCell.vue'
2
+ import type { TagAccent } from '@core/components/ui/tag/UiTag.vue'
2
3
  import { defineColumn } from '@core/packages/table/define-column'
3
4
  import { renderHeadCell } from '@core/tables/helpers/render-head-cell'
4
5
  import type { HeaderConfig } from '@core/tables/types.ts'
@@ -6,6 +7,6 @@ import type { MaybeArray } from '@core/types/utility.type'
6
7
  import { h } from 'vue'
7
8
 
8
9
  export const useTagColumn = defineColumn((config?: HeaderConfig) => ({
9
- renderHead: () => renderHeadCell(config?.headerIcon ?? 'fa:square-caret-down', config?.headerLabel),
10
- renderBody: (tag: MaybeArray<string>) => h(VtsTagCell, { tag }),
10
+ renderHead: () => renderHeadCell(config?.headerLabel),
11
+ renderBody: (tag: MaybeArray<string>, accent: TagAccent = 'info') => h(VtsTagCell, { tag, accent }),
11
12
  }))
@@ -6,6 +6,6 @@ import type { HeaderConfig } from '@core/tables/types.ts'
6
6
  import { h } from 'vue'
7
7
 
8
8
  export const useTextColumn = defineColumn((config?: HeaderConfig) => ({
9
- renderHead: () => renderHeadCell(config?.headerIcon ?? 'fa:align-left', config?.headerLabel),
9
+ renderHead: () => renderHeadCell(config?.headerLabel),
10
10
  renderBody: (content: string, props?: TextCellProps) => h(VtsTextCell, props, () => content),
11
11
  }))
@@ -5,6 +5,6 @@ import type { HeaderConfig } from '@core/tables/types.ts'
5
5
  import { h } from 'vue'
6
6
 
7
7
  export const useTruncatedTextColumn = defineColumn((config?: HeaderConfig & { limit?: number }) => ({
8
- renderHead: () => renderHeadCell(config?.headerIcon ?? 'fa:align-left', config?.headerLabel),
8
+ renderHead: () => renderHeadCell(config?.headerLabel),
9
9
  renderBody: (content: string) => h(VtsTruncatedTextCell, { content, limit: config?.limit }),
10
10
  }))
@@ -9,9 +9,9 @@ export const useBackupJobScheduleColumns = defineColumns(() => {
9
9
 
10
10
  return {
11
11
  schedule: useLinkColumn({ headerLabel: () => t('schedule') }),
12
- id: useTextColumn({ headerLabel: () => t('id'), headerIcon: 'fa:hashtag' }),
12
+ id: useTextColumn({ headerLabel: () => t('id') }),
13
13
  status: useStatusColumn(),
14
- cronPattern: useTextColumn({ headerLabel: () => t('cron-pattern'), headerIcon: 'fa:clock' }),
14
+ cronPattern: useTextColumn({ headerLabel: () => t('cron-pattern') }),
15
15
  lastThreeRuns: useStatusColumn({
16
16
  headerLabel: () => t('last-n-runs', { n: 3 }),
17
17
  iconOnly: true,
@@ -11,7 +11,7 @@ export const useBackupLogsColumns = defineColumns(() => {
11
11
  return {
12
12
  startDate: useDateColumn({ headerLabel: () => t('start-date'), dateStyle: 'short', timeStyle: 'medium' }),
13
13
  endDate: useDateColumn({ headerLabel: () => t('end-date'), dateStyle: 'short', timeStyle: 'medium' }),
14
- duration: useNumberColumn({ headerIcon: 'fa:time', headerLabel: () => t('duration') }),
14
+ duration: useNumberColumn({ headerLabel: () => t('duration') }),
15
15
  status: useStatusColumn(),
16
16
  transferSize: useNumberColumn({ headerLabel: () => t('transfer-size') }),
17
17
  selectItem: useSelectItemColumn(),
@@ -10,12 +10,10 @@ export const useNewVmNetworkColumns = defineColumns(() => {
10
10
  return {
11
11
  interface: useSelectColumn({
12
12
  headerLabel: () => t('interfaces'),
13
- headerIcon: 'object:network',
14
13
  }),
15
14
 
16
15
  mac: useInputColumn({
17
16
  headerLabel: () => t('mac-addresses'),
18
- headerIcon: 'fa:at',
19
17
  placeholder: () => t('auto-generated'),
20
18
  }),
21
19
 
@@ -10,7 +10,6 @@ export const useNewVmSrColumns = defineColumns(() => {
10
10
  return {
11
11
  sr: useSelectColumn({
12
12
  headerLabel: () => t('storage-repositories'),
13
- headerIcon: 'object:sr',
14
13
  }),
15
14
 
16
15
  diskName: useInputColumn({
@@ -12,7 +12,7 @@ export const useServerColumns = defineColumns(() => {
12
12
  pool: useLinkColumn({ headerLabel: () => t('pool') }),
13
13
  hostIp: useAddressColumn({ headerLabel: () => t('ip-address') }),
14
14
  status: useStatusColumn({ headerLabel: () => t('status') }),
15
- primaryHost: useLinkColumn({ headerLabel: () => t('master'), headerIcon: 'object:host' }),
15
+ primaryHost: useLinkColumn({ headerLabel: () => t('master') }),
16
16
  selectItem: useSelectItemColumn(),
17
17
  }
18
18
  })
@@ -13,7 +13,7 @@ export const useSnapshotColumns = defineColumns(() => {
13
13
  name: useLinkColumn({ headerLabel: () => t('name') }),
14
14
  description: useTruncatedTextColumn({ headerLabel: () => t('description') }),
15
15
  creationDate: useDateColumn({ headerLabel: () => t('creation-date'), dateStyle: 'short', timeStyle: 'medium' }),
16
- trigger: useLinkOrTextColumn({ headerLabel: () => t('trigger'), headerIcon: 'fa:square-caret-down' }),
16
+ trigger: useLinkOrTextColumn({ headerLabel: () => t('trigger') }),
17
17
  actions: useActionColumn({}),
18
18
  }
19
19
  })
@@ -1,8 +1,8 @@
1
1
  import { defineColumns } from '@core/packages/table/define-columns.ts'
2
+ import { useActionColumn } from '@core/tables/column-definitions/action-column'
2
3
  import { useLinkColumn } from '@core/tables/column-definitions/link-column'
3
4
  import { useLiteralColumn } from '@core/tables/column-definitions/literal-column.ts'
4
5
  import { useProgressBarColumn } from '@core/tables/column-definitions/progress-bar-column.ts'
5
- import { useSelectItemColumn } from '@core/tables/column-definitions/select-item-column'
6
6
  import { useTruncatedTextColumn } from '@core/tables/column-definitions/truncated-text-column'
7
7
  import { useI18n } from 'vue-i18n'
8
8
 
@@ -15,6 +15,6 @@ export const useSrColumns = defineColumns(() => {
15
15
  storageFormat: useLiteralColumn({ headerLabel: () => t('storage-format') }),
16
16
  accessMode: useLiteralColumn({ headerLabel: () => t('access-mode') }),
17
17
  usedSpace: useProgressBarColumn({ headerLabel: () => t('used-space') }),
18
- selectItem: useSelectItemColumn(),
18
+ actions: useActionColumn({}),
19
19
  }
20
20
  })
@@ -1,7 +1,7 @@
1
1
  import { defineColumns } from '@core/packages/table/define-columns.ts'
2
+ import { useActionColumn } from '@core/tables/column-definitions/action-column.ts'
2
3
  import { useDoubleLinkColumn } from '@core/tables/column-definitions/double-link-column.ts'
3
4
  import { useNumberColumn } from '@core/tables/column-definitions/number-column.ts'
4
- import { useSelectItemColumn } from '@core/tables/column-definitions/select-item-column.ts'
5
5
  import { useTagColumn } from '@core/tables/column-definitions/tag-column.ts'
6
6
  import { useTextColumn } from '@core/tables/column-definitions/text-column.ts'
7
7
  import { useTruncatedTextColumn } from '@core/tables/column-definitions/truncated-text-column.ts'
@@ -11,19 +11,17 @@ export const useTrafficRulesColumns = defineColumns(() => {
11
11
  const { t } = useI18n()
12
12
 
13
13
  return {
14
- order: useNumberColumn({ headerIcon: 'fa:hashtag' }),
14
+ order: useNumberColumn(),
15
15
  policy: useTagColumn({ headerLabel: () => t('policy') }),
16
16
  protocol: useTextColumn({
17
17
  headerLabel: () => t('protocol:port'),
18
- headerIcon: 'fa:square-caret-down',
19
18
  }),
20
- directionA: useTextColumn({ headerLabel: () => t('direction'), headerIcon: 'fa:square-caret-down' }),
21
- target: useTruncatedTextColumn({ headerLabel: () => t('target'), headerIcon: 'fa:at' }),
19
+ directionA: useTextColumn({ headerLabel: () => t('direction') }),
20
+ target: useTruncatedTextColumn({ headerLabel: () => t('target') }),
22
21
  directionB: useTextColumn({
23
22
  headerLabel: () => t('direction'),
24
- headerIcon: 'fa:square-caret-down',
25
23
  }),
26
24
  object: useDoubleLinkColumn({ headerLabel: () => t('object') }),
27
- selectItem: useSelectItemColumn(),
25
+ actions: useActionColumn({}),
28
26
  }
29
27
  })
@@ -0,0 +1,24 @@
1
+ import { defineColumns } from '@core/packages/table/define-columns.ts'
2
+ import { useActionColumn } from '@core/tables/column-definitions/action-column.ts'
3
+ import { useAddressColumn } from '@core/tables/column-definitions/address-column.ts'
4
+ import { useLinkColumn } from '@core/tables/column-definitions/link-column'
5
+ import { useNumberColumn } from '@core/tables/column-definitions/number-column.ts'
6
+ import { useStatusColumn } from '@core/tables/column-definitions/status-column.ts'
7
+ import { useTextColumn } from '@core/tables/column-definitions/text-column.ts'
8
+ import { useI18n } from 'vue-i18n'
9
+
10
+ export const useVifNetworkColumns = defineColumns(() => {
11
+ const { t } = useI18n()
12
+
13
+ return {
14
+ vif: useLinkColumn({ headerLabel: () => t('vif') }),
15
+ network: useLinkColumn({ headerLabel: () => t('network') }),
16
+ device: useTextColumn({ headerLabel: () => t('device') }),
17
+ status: useStatusColumn({ headerLabel: () => t('status') }),
18
+ ipsAddresses: useAddressColumn({ headerLabel: () => t('ip-addresses') }),
19
+ macAddresses: useAddressColumn({ headerLabel: () => t('mac-addresses') }),
20
+ mtu: useNumberColumn({ headerLabel: () => t('mtu') }),
21
+ lockingMode: useTextColumn({ headerLabel: () => t('locking-mode') }),
22
+ actions: useActionColumn({}),
23
+ }
24
+ })
@@ -1,14 +1,13 @@
1
1
  import { defineColumns } from '@core/packages/table/define-columns.ts'
2
+ import { useActionColumn } from '@core/tables/column-definitions/action-column.ts'
2
3
  import { useAddressColumn } from '@core/tables/column-definitions/address-column.ts'
3
4
  import { useLinkColumn } from '@core/tables/column-definitions/link-column'
4
5
  import { useNumberColumn } from '@core/tables/column-definitions/number-column.ts'
5
- import { useSelectItemColumn } from '@core/tables/column-definitions/select-item-column'
6
6
  import { useTagColumn } from '@core/tables/column-definitions/tag-column.ts'
7
7
  import { useI18n } from 'vue-i18n'
8
8
 
9
9
  export const useVmColumns = defineColumns(() => {
10
10
  const { t } = useI18n()
11
-
12
11
  return {
13
12
  vm: useLinkColumn({ headerLabel: () => t('vm') }),
14
13
  ipAddresses: useAddressColumn({ headerLabel: () => t('ip-addresses') }),
@@ -16,6 +15,6 @@ export const useVmColumns = defineColumns(() => {
16
15
  ram: useNumberColumn({ headerLabel: () => t('ram') }),
17
16
  diskSpace: useNumberColumn({ headerLabel: () => t('disk-space') }),
18
17
  tags: useTagColumn({ headerLabel: () => t('tags') }),
19
- selectItem: useSelectItemColumn(),
18
+ actions: useActionColumn({}),
20
19
  }
21
20
  })
@@ -1,6 +1,4 @@
1
1
  import VtsHeaderCell from '@core/components/table/cells/VtsHeaderCell.vue'
2
- import type { IconName } from '@core/icons/index.ts'
3
- import { h, toValue, type MaybeRefOrGetter } from 'vue'
2
+ import { h, type MaybeRefOrGetter, toValue } from 'vue'
4
3
 
5
- export const renderHeadCell = (icon?: MaybeRefOrGetter<IconName>, label?: MaybeRefOrGetter<string | undefined>) =>
6
- h(VtsHeaderCell, { icon: toValue(icon) }, () => toValue(label))
4
+ export const renderHeadCell = (label?: MaybeRefOrGetter<string | undefined>) => h(VtsHeaderCell, () => toValue(label))
@@ -1,7 +1,5 @@
1
- import type { IconName } from '@core/icons/index.ts'
2
1
  import type { MaybeRefOrGetter } from 'vue'
3
2
 
4
3
  export type HeaderConfig = {
5
4
  headerLabel?: MaybeRefOrGetter<string | undefined>
6
- headerIcon?: MaybeRefOrGetter<IconName>
7
5
  }
@@ -0,0 +1,14 @@
1
+ export const CONNECTION_ACTION = {
2
+ CONNECT: 'connect',
3
+ DISCONNECT: 'disconnect',
4
+ } as const
5
+
6
+ export type ConnectionAction = (typeof CONNECTION_ACTION)[keyof typeof CONNECTION_ACTION]
7
+
8
+ export const CONNECTION_STATUS = {
9
+ CONNECTED: 'connected',
10
+ PARTIALLY_CONNECTED: 'partially-connected',
11
+ DISCONNECTED: 'disconnected',
12
+ PHYSICALLY_DISCONNECTED: 'physically-disconnected',
13
+ DISCONNECTED_FROM_PHYSICAL_DEVICE: 'disconnected-from-physical-device',
14
+ } as const
@@ -0,0 +1,19 @@
1
+ export const STATE_HERO_TYPES = [
2
+ 'busy',
3
+ 'no-result',
4
+ 'under-construction',
5
+ 'no-data',
6
+ 'no-selection',
7
+ 'error',
8
+ 'not-found',
9
+ 'offline',
10
+ 'all-good',
11
+ 'all-done',
12
+ 'creating',
13
+ ] as const
14
+
15
+ export type StateHeroType = (typeof STATE_HERO_TYPES)[number]
16
+
17
+ export type StateHeroFormat = 'page' | 'card' | 'panel' | 'table'
18
+
19
+ export type StateHeroSize = 'extra-small' | 'small' | 'medium' | 'large'
@@ -0,0 +1,14 @@
1
+ export const SR_SCOPE_TYPE = {
2
+ POOL: 'pool',
3
+ HOST: 'host',
4
+ } as const
5
+
6
+ export type SrScope = { type: typeof SR_SCOPE_TYPE.POOL } | { type: typeof SR_SCOPE_TYPE.HOST; hostId: string }
7
+
8
+ export const SR_ACCESS_MODE = {
9
+ LOCAL: 'local',
10
+ SHARED: 'shared',
11
+ MIXED: 'mixed',
12
+ } as const
13
+
14
+ export type SrAccessMode = (typeof SR_ACCESS_MODE)[keyof typeof SR_ACCESS_MODE]
@@ -48,10 +48,16 @@ declare module 'vue-virtual-scroller' {
48
48
  after(): unknown
49
49
  }
50
50
 
51
+ interface ScrollToOptions {
52
+ smooth?: boolean
53
+ align?: 'start' | 'center' | 'end' | 'nearest'
54
+ offset?: number
55
+ }
56
+
51
57
  export interface RecycleScrollerInstance {
52
58
  getScroll(): { start: number; end: number }
53
- scrollToItem(index: number): void
54
- scrollToPosition(position: number): void
59
+ scrollToItem(index: number, options?: ScrollToOptions): void
60
+ scrollToPosition(position: number, options?: ScrollToOptions): void
55
61
  }
56
62
 
57
63
  export const RecycleScroller: <T>(
@@ -11,7 +11,7 @@ export const IK_TREE_ITEM_TOGGLE = Symbol('IK_TREE_ITEM_TOGGLE') as InjectionKey
11
11
 
12
12
  export const IK_TREE_ITEM_EXPANDED = Symbol('IK_TREE_ITEM_EXPANDED') as InjectionKey<Ref<boolean>>
13
13
 
14
- export const IK_TREE_LIST_DEPTH = Symbol('IK_TREE_LIST_DEPTH') as InjectionKey<number>
14
+ export const IK_TREE_LIST_DEPTH = Symbol('IK_TREE_LIST_DEPTH') as InjectionKey<Ref<number>>
15
15
 
16
16
  export const IK_MENU_HORIZONTAL = Symbol('IK_MENU_HORIZONTAL') as InjectionKey<ComputedRef<boolean>>
17
17
 
@@ -0,0 +1,34 @@
1
+ import { SR_ACCESS_MODE, SR_SCOPE_TYPE, type SrAccessMode, type SrScope } from '@core/types/storage-repository.type.ts'
2
+
3
+ export function getSrAccessMode(srs: { shared: boolean }[]): SrAccessMode {
4
+ const hasShared = srs.some(sr => sr.shared)
5
+ const hasLocal = srs.some(sr => !sr.shared)
6
+
7
+ if (hasShared && hasLocal) {
8
+ return SR_ACCESS_MODE.MIXED
9
+ }
10
+
11
+ if (hasShared) {
12
+ return SR_ACCESS_MODE.SHARED
13
+ }
14
+
15
+ return SR_ACCESS_MODE.LOCAL
16
+ }
17
+
18
+ export type SrModalInfoVariant = 'host' | 'pool-local' | 'pool-mixed' | 'pool-shared'
19
+
20
+ export function getSrModalInfoVariant(scope: SrScope, accessMode: SrAccessMode): SrModalInfoVariant {
21
+ if (scope.type === SR_SCOPE_TYPE.HOST) {
22
+ return 'host'
23
+ }
24
+
25
+ if (accessMode === SR_ACCESS_MODE.LOCAL) {
26
+ return 'pool-local'
27
+ }
28
+
29
+ if (accessMode === SR_ACCESS_MODE.MIXED) {
30
+ return 'pool-mixed'
31
+ }
32
+
33
+ return 'pool-shared'
34
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@xen-orchestra/web-core",
3
3
  "type": "module",
4
- "version": "0.54.0",
4
+ "version": "0.56.0",
5
5
  "private": false,
6
6
  "exports": {
7
7
  "./*": {
@@ -17,8 +17,8 @@
17
17
  "@fortawesome/free-solid-svg-icons": "^6.7.2",
18
18
  "@fortawesome/vue-fontawesome": "^3.0.8",
19
19
  "@novnc/novnc": "~1.5.0",
20
- "@regle/core": "^1.20.2",
21
- "@regle/rules": "^1.20.2",
20
+ "@regle/core": "^1.26.0",
21
+ "@regle/rules": "^1.26.0",
22
22
  "@regle/schemas": "^1.20.2",
23
23
  "@types/d3-time-format": "^4.0.3",
24
24
  "@vueuse/core": "^14.0.0",
@@ -50,7 +50,7 @@
50
50
  "pinia": "^3.0.1",
51
51
  "vue": "~3.5.13",
52
52
  "vue-i18n": "^11.1.2",
53
- "vue-router": "^5.0.0"
53
+ "vue-router": "5.0.6"
54
54
  },
55
55
  "homepage": "https://github.com/vatesfr/xen-orchestra/tree/master/@xen-orchestra/web-core",
56
56
  "bugs": "https://github.com/vatesfr/xen-orchestra/issues",