@xen-orchestra/web-core 0.54.0 → 0.55.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 (74) hide show
  1. package/lib/components/button-group/VtsButtonGroup.vue +11 -1
  2. package/lib/components/drawer/VtsDrawer.vue +85 -0
  3. package/lib/components/drawer/VtsDrawerButton.vue +21 -0
  4. package/lib/components/drawer/VtsDrawerCancelButton.vue +33 -0
  5. package/lib/components/drawer/VtsDrawerConfirmButton.vue +30 -0
  6. package/lib/components/drawer/VtsDrawerList.vue +34 -0
  7. package/lib/components/layout/VtsLayoutSidebar.vue +5 -2
  8. package/lib/components/modal/VtsModalButton.vue +0 -1
  9. package/lib/components/query-builder/VtsQueryBuilderModal.vue +0 -1
  10. package/lib/components/state-hero/VtsStateHero.vue +17 -7
  11. package/lib/components/table/cells/VtsHeaderCell.vue +1 -17
  12. package/lib/components/table/cells/VtsTagCell.vue +4 -2
  13. package/lib/components/ui/drawer/UiDrawer.vue +123 -0
  14. package/lib/components/ui/modal/UiModal.vue +10 -18
  15. package/lib/composables/default-tab.composable.ts +4 -0
  16. package/lib/icons/action-icons.ts +6 -2
  17. package/lib/icons/custom-icons.ts +16 -0
  18. package/lib/icons/object-icons.ts +33 -18
  19. package/lib/locales/cs.json +56 -12
  20. package/lib/locales/da.json +1 -3
  21. package/lib/locales/de.json +0 -12
  22. package/lib/locales/en.json +54 -10
  23. package/lib/locales/es.json +6 -7
  24. package/lib/locales/fr.json +54 -10
  25. package/lib/locales/ko.json +0 -4
  26. package/lib/locales/nb-NO.json +18 -20
  27. package/lib/locales/nl.json +0 -12
  28. package/lib/locales/pt-BR.json +0 -3
  29. package/lib/locales/pt.json +0 -3
  30. package/lib/locales/sk.json +56 -12
  31. package/lib/locales/sv.json +1 -13
  32. package/lib/locales/zh-Hans.json +0 -12
  33. package/lib/packages/drawer/DrawerProvider.vue +17 -0
  34. package/lib/packages/drawer/README.md +189 -0
  35. package/lib/packages/drawer/create-drawer-opener.ts +119 -0
  36. package/lib/packages/drawer/drawer.store.ts +22 -0
  37. package/lib/packages/drawer/types.ts +93 -0
  38. package/lib/packages/drawer/use-drawer.ts +53 -0
  39. package/lib/packages/modal/create-modal-opener.ts +12 -10
  40. package/lib/tables/column-definitions/action-column.ts +1 -1
  41. package/lib/tables/column-definitions/address-column.ts +1 -1
  42. package/lib/tables/column-definitions/button-column.ts +1 -1
  43. package/lib/tables/column-definitions/button-icon-column.ts +1 -1
  44. package/lib/tables/column-definitions/collapsed-list-column.ts +1 -1
  45. package/lib/tables/column-definitions/date-column.ts +1 -1
  46. package/lib/tables/column-definitions/double-link-column.ts +1 -1
  47. package/lib/tables/column-definitions/info-column.ts +1 -1
  48. package/lib/tables/column-definitions/input-column.ts +1 -5
  49. package/lib/tables/column-definitions/link-column.ts +1 -1
  50. package/lib/tables/column-definitions/link-or-text-column.ts +1 -1
  51. package/lib/tables/column-definitions/literal-column.ts +1 -1
  52. package/lib/tables/column-definitions/number-column.ts +1 -1
  53. package/lib/tables/column-definitions/percent-column.ts +1 -1
  54. package/lib/tables/column-definitions/progress-bar-column.ts +1 -1
  55. package/lib/tables/column-definitions/select-column.ts +1 -1
  56. package/lib/tables/column-definitions/status-column.ts +2 -2
  57. package/lib/tables/column-definitions/tag-column.ts +3 -2
  58. package/lib/tables/column-definitions/text-column.ts +1 -1
  59. package/lib/tables/column-definitions/truncated-text-column.ts +1 -1
  60. package/lib/tables/column-sets/backup-job-schedule-columns.ts +2 -2
  61. package/lib/tables/column-sets/backup-log-columns.ts +1 -1
  62. package/lib/tables/column-sets/new-vm-network-columns.ts +0 -2
  63. package/lib/tables/column-sets/new-vm-sr-columns.ts +0 -1
  64. package/lib/tables/column-sets/server-columns.ts +1 -1
  65. package/lib/tables/column-sets/snapshot-columns.ts +1 -1
  66. package/lib/tables/column-sets/sr-columns.ts +2 -2
  67. package/lib/tables/column-sets/traffic-rules-columns.ts +5 -7
  68. package/lib/tables/column-sets/vif-network-columns.ts +24 -0
  69. package/lib/tables/helpers/render-head-cell.ts +2 -4
  70. package/lib/tables/types.ts +0 -2
  71. package/lib/types/connection.ts +14 -0
  72. package/lib/types/storage-repository.type.ts +14 -0
  73. package/lib/utils/sr.utils.ts +34 -0
  74. package/package.json +4 -4
@@ -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,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,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]
@@ -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.55.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",