Compare commits

..

86 Commits

Author SHA1 Message Date
Joris-K
d9694f8ed2 chore(lite): add PR number to changelog 2026-11-27 16:12:15 +01:00
Joris-K
f77289dc9e feat(lite): add a VM side panel and row actions to the VMs tables
Also show the VMs bulk actions bar again, on desktop and mobile.

Introduced by #10807 (bar collapsed to 0px) and #9869 (mobile bar in a non-existent UiTitle slot)
2026-11-27 16:11:22 +01:00
Joris-K
fc641161fb feat(lite): share the VM actions menu between the treeview and the VM header 2026-11-27 16:10:51 +01:00
Joris-K
81b640c64e feat(lite): add HostLink and use it for every host link 2026-11-27 16:10:21 +01:00
Sylvère
810e342df2 feat: technical release (#10926)
* feat(xo-collection): 1.0.1

* feat(@vates/nbd-client): 3.7.2

* feat(@vates/types): 3.1.0

* feat(@xen-orchestra/backups): 1.0.1

* feat(@xen-orchestra/web-core): 0.66.1

* feat(@xen-orchestra/proxy): 0.35.1

* feat(@xen-orchestra/vmware-explorer): 1.4.0

* feat(@xen-orchestra/rest-api): 0.43.0

* feat(@xen-orchestra/web): 0.66.1

* feat(xo-server): 5.214.1

* chore(CHANGELOG): update next
2026-11-27 11:10:16 +01:00
Florent BEAUCHAMP
20e90b6d0f fix(xo-web): sanitize-html dependency (#10899)
Since 2.17.6, sanitize-html depends on htmlparser2 ^12, which is
ESM-only. Browserify cannot bundle it and the build fails with:

    'import' and 'export' may appear only with 'sourceType: module'

The dev setup is not affected because yarn.lock resolves 2.17.4, but
xoa-packager installs each package with `npm install` and no lockfile,
so `^2.17.4` resolves to the latest release as soon as xo-web's
node_modules is recreated.

Pin the exact version until xo-web's bundler can handle ESM-only
dependencies.
2026-11-27 10:00:36 +01:00
Joris K
c23587cbdc fix(xo6/site): stop displaying the site pages below the pools loader (#10923) 2026-11-27 09:46:51 +01:00
Mathieu
f67f94a60b feat(vmware-explorer): fall back to RSA key exchange on ESXi 6.5 data port (#10802)
feat(vmware-explorer): fall back to RSA key exchange on ESXi 6.5 data port (#10802)
2026-11-26 17:09:13 +01:00
Joris K
07722cd4f3 feat(web-core): update UiTag to v7 and rename UiTertiaryTag to UiLabelValueTag (#10920) 2026-11-26 15:29:29 +01:00
Marie Garde
b6d1387425 fix(xo6): remove target proxy for backup job mirror create form (#10914)
* fix(xo6): remove target proxy for backup job mirror create form

* fix changelog
2026-11-26 14:01:24 +01:00
Joris K
8f8c8ca405 feat(web-core): add UiRichCheckbox component (#10909) 2026-11-26 12:43:20 +01:00
Joris K
424f970cf9 feat(web-core): add UiRichRadioButton component (#10907)
* feat(web-core): add UiRichRadioButton component

- Rename the image-based `UiRichRadioButton` to `UiImageRadioButton`, as
  the design system renamed "Rich radio button" into "Image radio button"
- Add `UiRichRadioButton` (Rich radio button + Label v1): card radio with
  optional icon, tag, description and info, in brand/warning/danger
  accents
- Add `UiRichRadioButtonGroup` (Rich radio button group v1): label,
  vertical or horizontal layout, info and accent message, exposed as a
  radiogroup
- Update `UiRadioButton` to Radio button v7 (radio drawn with the
  `status:radio-button` icon, `txt` accent colors, white checked dot) and
  grey out its label when disabled (Radio button + Label v4)
- Use the same v7 radio in `UiImageRadioButton` and `UiRichRadioButton`,
  and apply the active border of the image radio button card

* feat(web-core): add UiRichRadioButton component changelog entry
2026-11-26 12:13:57 +01:00
Joris K
dfc298e40b feat(web-core): add UiGroupSubcategory component (#10906)
Design system component (Group subcategory v1) that splits a group of
choices into titled subcategories, with an optional text on the right.
2026-11-26 12:03:57 +01:00
Florent BEAUCHAMP
750c74beb1 chore(types): add types for xoa updates (#10843)
* chore(types): add types for xoa updates
2026-11-25 19:03:40 +01:00
Joris K
050c47079a fix(lite): display the default 4 MiB video RAM of HVM VMs (#10901) 2026-11-25 18:12:59 +01:00
Joris K
dca9d63799 fix(xo6/pif): prevent setting the management PIF on a network whose MTU is not 1500 (#10905) 2026-11-25 18:02:28 +01:00
Joris K
c42b46b833 fix(xo6/vdi): show the used space of the whole snapshot chain (#10902) 2026-11-25 17:58:25 +01:00
Joris K
77c24dacd7 fix(lite): apply each template disk's settings to its own disk (#10898) 2026-11-25 17:42:57 +01:00
Alina D
9bee5dc5b1 fix(lite/vdi): show the used space of the whole snapshot chain (#10116) 2026-11-25 17:39:26 +01:00
MlssFrncJrg
2313809c11 feat(rest-api): expose proxy updater state endpoint (#10773)
* feat(rest-api): expose proxy updater state endpoint
2026-11-25 14:54:08 +01:00
GeraldineFromVates
21d458cdd1 Feat/qa test/readable report mail (#10867)
* feat(qa-test): show status, Paris time and commit in report subject

* feat(qa-test): show test counts in report subject

* feat(qa-test): show test summary at the top of report body

* feat(qa-test): show run duration in report summary
2026-11-25 14:14:18 +01:00
OlivierFL
fa675eead1 chore(web-core): remove unused --color-logo variable (#10895) 2026-11-25 12:07:49 +01:00
OlivierFL
31c3f5bb20 feat(web-core): add data colors for charts (#10894) 2026-11-25 11:59:03 +01:00
OlivierFL
7e850aedaf fix(web-core): mix dark status backgrounds from their item color (#10888)
* fix(web-core): mix dark status backgrounds from their item color

In dark mode, the selected, hover and active backgrounds of success, warning and danger
mixed black with the text color, unlike brand and info which use the item color.
Only danger was affected (its text and item colors differ): its backgrounds were too
light and the tertiary danger button text failed WCAG 1.4.3 on hover (4.38:1).

* docs(changelog): add the PR number of the dark status backgrounds fix

* fix(web-core): mix dark danger backgrounds from the danger background base

The design system mixes the dark danger selected, hover and active backgrounds
from #e73642, like the light ones: #451014 / #5c161a / #741b21. The tertiary
danger button text still passes WCAG 1.4.3 (4.77:1 on hover, 5.12:1 when active).

* fix(web-core): declare the dark danger background base
2026-11-25 11:49:34 +01:00
OlivierFL
069cb2816a fix(web-core): align light danger background tints with the design system (#10891)
* fix(web-core): align light danger background tints with the design system

* docs(changelog): add the PR number of the light danger backgrounds fix
2026-11-25 11:38:08 +01:00
Alex Castillo González
7c63be3aaf fix(xo-collection): emit remove on the previous type when an indexed item changes type (#10884)
Fixes #10717
2026-11-25 11:11:23 +01:00
ayoub-el-kajji-v
9c68705932 fix(backups/merge): adding delay in background merge when ELOCKED (#10866)
* fix(backups/merge): adding delay in background merge when ELOCKED

* add changelog

* changing logs display and unblocking non-locked tasks

* reducing changes to not make code complicated
2026-11-25 10:40:40 +01:00
Mathieu
14ed5fd5b9 fix(nbd-client): report the stderr of a stdio server dying before the handshake (#10842)
* fix(nbd-client): report the stderr of a stdio server dying before the handshake

When vectura exits before the NBD greeting (unreachable host, disk the
host refuses...), the V2V import failed with only:

    stream has ended without data, was looking for 8 bytes

The end of its stdout makes the handshake read fail first, then
`_destroyTransport` marks the exit as expected and the exit handler
reports nothing. When the exit comes first, stderr may not be read yet.

`connect()` now waits for the `close` event of the server, which comes
after its standard streams end, and throws `NBD_SERVER_EXITED` with its
stderr as the message and the handshake error as `cause`. `reconnect()`
goes through `connect()`, so the retries of `readBlock()` get it too.

Introduced by #10381

* fix(nbd-client): attach stderr to the pre-handshake NBD_SERVER_EXITED error

Same shape as the error built by the exit handler.
2026-11-25 10:13:27 +01:00
OlivierFL
f7e476cd81 docs(v2v): document the XO 6 migration wizard (#10833)
* docs(v2v): document the XO 6 migration wizard

* docs(v2v): add the XO 6 prerequisite check screenshot

* docs(v2v): add a screenshot of each XO 6 migration wizard step

* docs(v2v): flag the guide as new and the XO 5 section as legacy
2026-11-25 09:52:27 +01:00
spacotte-vates
2a4491aeda fix(backup-jobs): fix issues on backup job creation from the REST API (#10779)
* fix(rest-api): backup-job schedule settings lost on creation
* fix(backup-jobs): fix mirror and metadata job failing due to targeting backup repo with expression
* feat(backup-jobs): add expression support for vms and pools
* fix(rest-api): add filter support to backup-jobs
2026-11-25 09:44:12 +01:00
Sylvère
e9760747f9 feat: technical release (#10896)
* feat(@xen-orchestra/log): 1.0.0

* feat(@vates/disposable): 0.1.7

* feat(@xen-orchestra/fs): 4.11.0

* feat(vhd-lib): 4.17.1

* feat(@vates/fuse-vhd): 2.1.4

* feat(@vates/iscsi): 0.4.1

* feat(@vates/obfuscate): 0.2.0

* feat(xo-collection): 1.0.0

* feat(xen-api): 6.0.0

* feat(@vates/nbd-client): 3.7.1

* feat(@vates/node-vsphere-soap): 2.2.1

* feat(@vates/syslog): 0.2.0

* feat(@vates/types): 3.0.0

* feat(@xen-orchestra/acl): 1.9.0

* feat(@xen-orchestra/audit-core): 0.4.1

* feat(@xen-orchestra/autopilot-docking): 0.1.0

* feat(@xen-orchestra/backup-archive): 1.2.1

* feat(@xen-orchestra/xapi): 10.0.0

* feat(@xen-orchestra/backups): 1.0.0

* feat(@xen-orchestra/backups-cli): 1.1.19

* feat(@xen-orchestra/cr-seed-cli): 1.0.4

* feat(@xen-orchestra/disk-cli): 2.2.6

* feat(@xen-orchestra/immutable-backups): 3.0.10

* feat(@xen-orchestra/web-core): 0.66.0

* feat(@xen-orchestra/mcp): 1.4.4

* feat(@xen-orchestra/mixins): 0.24.0

* feat(@xen-orchestra/proxy): 0.35.0

* feat(@xen-orchestra/vmware-explorer): 1.3.0

* feat(@xen-orchestra/qa-test): 1.5.0

* feat(@xen-orchestra/rest-api): 0.42.0

* feat(@xen-orchestra/web): 0.66.0

* feat(xapi-explore-sr): 0.4.9

* feat(xo-server): 5.214.0

* feat(xo-server-audit): 0.16.0

* feat(xo-server-auth-ldap): 0.10.13

* feat(xo-server-backup-reports): 1.7.2

* feat(xo-server-ipmi-sensors): 2.1.2

* feat(xo-server-load-balancer): 0.14.1

* feat(xo-server-netbox): 1.14.1

* feat(xo-server-openmetrics): 1.9.4

* feat(xo-server-perf-alert): 1.1.3

* feat(xo-server-sdn-controller): 1.7.0

* feat(xo-server-transport-nagios): 1.0.4

* feat(xo-server-usage-report): 0.11.2

* feat(xo-server-web-hooks): 0.4.1

* feat(xo-web): 5.209.0

* chore(CHANGELOG): update next
2026-11-24 16:47:56 +01:00
Marie Garde
eae4e889b6 fix(xo6): fix mock backup job (#10893) 2026-11-24 15:26:59 +01:00
Marie Garde
fdbfa97002 Xo6/backup job create form (#10758)
* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* form andjob ok

* refacto for pr

* refacto

* fix errorMessage

* split use backup job target

* refacto

* refacto

* add tests utils

* add tests form

* add tests components

* add test composable

* fix build

* fix CI

* rebase ok

* rebase ok

* refacto with backend

* remove lite from changelog

* remove claude

* refacto for merge

* fix post back

* fix build

* fix build
2026-11-24 15:08:27 +01:00
Joris K
57c1865270 feat(xo6/vm): open the VM duplication form in a drawer (#10879) 2026-11-24 14:53:54 +01:00
Marie Garde
a0a11fdd48 feat(xo6): display dynamic selection in backup job side panel (#10757)
* feat(xo6): display dynamic selection in backup job side panel

* fix import and add changelog
2026-11-24 14:50:48 +01:00
Marie Garde
54fb7a33b8 feat(xo6/web-core): add query builder preview and resource query buil… (#10756)
feat(xo6/web-core): add query builder preview and resource query builders
2026-11-24 14:47:26 +01:00
Marie Garde
edbfe8c7e4 feat(xo6): add schedule cron editor components (#10755)
* feat(xo6): add schedule cron editor components

* fix build
2026-11-24 14:45:30 +01:00
Joris K
e97cea2dd6 feat(xo6/traffic-rules): open the traffic rule creation form in a drawer (#10880) 2026-11-24 14:39:40 +01:00
Joris K
467c0130fc feat(xo6/pool): open the pool connection form in a drawer (#10881) 2026-11-24 14:27:58 +01:00
Marie Garde
de62672a07 refactor(xo6): rename backup repository review components (#10754) 2026-11-24 14:22:48 +01:00
noritaka97
4b242221f3 feat(xo6/web-core): show storage in VM dashboard quick info (#10747) 2026-11-24 14:11:32 +01:00
Sylvère
0be66a2698 feat(xo6): replace the Quick Tasks popup with a new My Tasks sidebar (#10805)
* feat(xo6): add MyTasks view

* feat(xo6): new tasks list components + story, fixed UiCircleProgressBar

* grouped task types, added mock tasks for testing

* fix(xo6): align task tree lines with compact treeview, use real tasks in UI

* review fixes

* feat(xo6): expand and seek parent task when selecting subtask

* feat(xo6): add search to tasks sidebar, include subtasks in tasks table search

* feat(xo6): use new UiButtonIcon counter for tasks

* feat(xo6): show unread dot on task items in sidebar

* feat(xo6): removed now unused components and locale keys

* review fixes and tests

* feat(xo6): updated tasks button behaviour, added progress circle

* feat(xo6): my tasks - add mark all as read feature

* fix rebase

* review fixes
2026-11-24 13:52:10 +01:00
OlivierFL
82dabbf0cd test(web): import the VDI drawer select helpers from web-core (#10890)
Introduced by #10878, merged after f608a47d8f
2026-11-24 13:26:45 +01:00
OlivierFL
1fca20d82e test(web): read the host and VIF network selects with the shared helpers (#10889)
Introduced by f608a47d8f, merged after #10865 and #10877
2026-11-24 12:00:29 +01:00
Joris K
04de2031e6 feat(xo6/vdi): open the VDI creation and attach forms in a drawer (#10878) 2026-11-24 11:47:10 +01:00
Olivier Floch
7c6b48d139 test(web): read the backup repository selects with the shared helpers
- Drop the local findShownSelections, which shadowed the web-core one with
  another signature
- Add mountBrGeneralStep and createBrGeneralFormData (src/test), replacing
  the three mounts of BackupRepositoryGeneralStep and the empty form data
  built twice
- Forward attachTo in the XO 6 mountWithSetup, used by mountBrGeneralStep
2026-11-24 11:39:43 +01:00
Olivier Floch
06080bbec6 test(web-core): share the test setup helpers
- Add mountWithSetupResult (web-core, wrapped by XO 6): setup returns
  { result, render }, the mount returns { wrapper, result }; the SR, private
  network, new VM, JSON schema form, menu popup, menu list navigation and
  overlay focus tests no longer capture what their setup builds by hand
- Add mountComposableUnderSetup (web-core, wrapped by XO 6) and
  injectOrThrow: the tests running a composable under the component
  providing what it injects (new VM form, JSON schema form, V2V connection,
  VM migrate selects, tag select keyboard) share them
2026-11-24 11:39:43 +01:00
Olivier Floch
f608a47d8f feat(web-core): update VtsSelect to v7
- Add the success accent to VtsSelect, with the success icon before the
  chevron, also from a success message of its input wrapper
- Show the placeholder of a readonly UiInput without value, so that a
  VtsSelect without selection shows its placeholder; an empty placeholder
  renders nothing
- Share the input wrapper accents in INPUT_WRAPPER_ACCENTS, make required
  optional in useInputWrapperController and style the slotted right icons
  of UiInput
- Move the select test helpers (select.ts) from XO 6 to web-core/test, add
  mountWithSetup (web-core, wrapped by XO 6) replacing the XO 6
  mountWithSelect, renderSelect / mountSelect and isPlaceholderShown;
  migrate every caller and the docs
- Add VtsSelect unit tests
- Update the VtsSelect story and the form-select README to the current API
2026-11-24 11:39:43 +01:00
Joris K
543aebb302 feat(xo6/vif): open the VIF creation form in a drawer (#10877) 2026-11-24 11:23:27 +01:00
Marie Garde
6f9c0f3466 feat(xo6): add connect host to pool (#10865)
* feat(xo6): add connect host to pool

* add tests

* add tests and loader

* fix build

* fix refacto

* add arg file

* remove useless com
2026-11-24 10:51:06 +01:00
Joris K
e4c8fbf211 feat(xo6/network): open the network creation forms in a drawer (#10876) 2026-11-24 09:45:27 +01:00
Joris K
e2c724d5fe fix(web-core): stop the treeview resize handle from covering its scrollbar (#10886) 2026-11-24 09:32:03 +01:00
Joris K
98cd148db7 fix(web-core): make Discard the primary button of the discard changes modal (#10883) 2026-11-23 18:21:51 +01:00
MlssFrncJrg
dbd8a14001 feat(rest-api): expose proxy health endpoint (#10752)
* feat(rest-api): migrate proxy health endpoint

* changelog entry

* handle unreachable proxy errors

* map all unreachable proxy errors to 502 and test health endpoint

* share proxy unreachable mapping and response descriptor

---------

Co-authored-by: Mathieu <mathieu.piton@vates.tech>
2026-11-23 15:52:06 +01:00
Elise-F
d3e8ec3458 feat(xo6/traffic-rules): show private network info in the traffic rue side panel (#10874) 2026-11-23 15:49:13 +01:00
Joris K
7104d235ef fix(web-core): pin the show more/less button to the top right of truncated text cells (#10873) 2026-11-23 15:45:18 +01:00
amouillard-vates
c3a4039aae fix(xo6/web-core): fix VM tags horizontal squeezing (#10871) 2026-11-23 14:24:25 +01:00
Joris K
5175915b1c fix(xo6/web-core): stop syncing the side panel open state between browser tabs (#10869) 2026-11-23 11:03:40 +01:00
MlssFrncJrg
dea99db937 feat(xo-web/licenses): add airgap data pack upload (#10254) 2026-11-23 10:47:55 +01:00
amouillard-vates
75c5696bef feat(xo6): add VM tags edition (#10804) 2026-11-23 10:18:51 +01:00
Sylvère
f376c130ee feat(xo6): add SR create form (#10251) 2026-11-23 10:15:41 +01:00
OlivierFL
3df5ba46d1 feat(web-core): update UiTextarea to v6 (#10862) 2026-11-23 09:50:19 +01:00
Mathieu
6d84ec9b20 feat(xo-server): resume a failed or interrupted rolling pool update (#10860)
* feat(xo-server): resume a failed or interrupted rolling pool update (#10474)
2026-11-23 09:31:04 +01:00
OlivierFL
525b72e00a feat(web-core): update UiInput to v10 (#10861) 2026-11-23 08:58:08 +01:00
Joris K
651f4e8aee fix(xo6/vdi): open the XO 6 storage repository page from the VDI storage link (#10864) 2026-11-20 18:18:05 +01:00
OlivierFL
334002cba5 test(web): run the unit tests about 7 times faster (#10841) 2026-11-20 17:42:19 +01:00
Joris K
6faeae4a2f fix(xo6/new-vm): add a default network interface to templates without one (#10863) 2026-11-20 17:40:44 +01:00
Mathieu
5eab6643a1 fix(xo-server): require admin authentication for updater access (#10857)
The XOA updater WebSocket proxied by xo-server did not check the caller's session. xo-server now requires a valid XO session with admin permission before it proxies an updater WebSocket connection.

    Every path starting with /api/updater or /v5/api/updater is protected, including the generic /v5/api proxy path.
    Missing, invalid and non-admin credentials get a 403. The rejection is logged without the request headers, so the session token never ends up in the logs.
    The upgrade handler moves to createProxyUpgradeHandler (_updaterProxy.mjs) so the wiring is covered by tests.
    The updater localhost target is no longer rewritten to http.listen.hostname: the updater only listens on loopback.
    xo-web only starts the updater client for admin users. On Free XOA, the rejected connection would otherwise put non-admin users in an error state that blocks their access.

This must ship together with the matching xoa-updater change.
Verification

    xo-server build and test suite pass, including the new _updaterProxy tests.
    Tested on a disposable XOA: unauthenticated, invalid-token and non-admin handshakes on every updater path get a 403, the admin update workflow and the local xoa-updater CLI keep working, and a non-admin user on Free XOA keeps access to the UI.

Same change as #10856, which targets release-6.10.
2026-11-20 16:53:20 +01:00
Killian
639fdee531 docs: log in to XOA and proxies with an SSH key, deprecate the XenStore password (#10852)
* docs: log in to XOA and proxies with an SSH key, deprecate the XenStore password

The xoa account can now get an SSH public key through
vm-data/system-account-xoa-ssh-key. Document it as the recommended way, and
mark the XenStore password as deprecated: it will be removed in a future
version.

* docs: fold the deprecated XenStore password method

Requested by julienXOvates: readers should not be led to the deprecated
method. The password command and its warning now sit in a collapsed
details block in the XOA, proxy and troubleshooting pages; the SSH key
method stays the only one shown by default.
2026-11-20 16:47:11 +01:00
Florent BEAUCHAMP
f556f77363 fix(proxy): stop exposing proxy token out of xo (#10810)
* fix(proxy): stop exposing proxy token out of xo, remove copy proxy url feature. 
* mark method and field as deprecated
2026-11-20 16:09:07 +01:00
Thierry Goettelmann
c40f0bac73 feat(web-core/validated-form): add markStepUntouched to multi-step forms (#10855)
When a form changes the values of a step itself, they are handled as
edited by the user and their errors are displayed right away, before the
user does anything on the step.

`markStepUntouched` hides the errors and warnings of a step until the
user edits or validates it again. Its values are not changed.

See XO-3469
2026-11-20 16:08:34 +01:00
Joris K
26767fccfc feat(xo6/vm): update the VM creation form into a 3-step workflow (#10851) 2026-11-20 15:51:44 +01:00
ayoub-el-kajji-v
cb206a4512 feat(rest-api): import VDI from URL (#10751) 2026-11-20 15:24:12 +01:00
Killian
bd91b65cef fix(deps): fix some critical vulnerabilities (#10853) 2026-11-20 13:49:40 +01:00
Elise-F
d0e88ad88c feat(xo6): add possibility to create a new private network (#10820) 2026-11-20 12:22:10 +01:00
Florent BEAUCHAMP
4dfd4e4035 fix(xo-server): improve in depth defense of legacy api (#10858) 2026-11-20 11:11:33 +01:00
Florent BEAUCHAMP
90a9d5c27d fix(proxy): refresh authentication token in memory as soon as config is updated 2026-11-20 11:04:45 +01:00
Sylvère
dd717dbf25 fix(xo6/lite/web-core): fix wider-than-viewport dropdowns (#10854)
fix(xo6/lite/web-core): fix searchable dropdowns taking more than viewport width on mobile
2026-11-20 08:50:49 +01:00
Joris K
a9ff407d78 feat(xo6/lite/web-core): keep table cells on one line (#10850) 2026-11-19 19:50:44 +01:00
Sylvère
2093c640dd feat(web-core/lite): updated UiCircleProgressBar component (#10849) 2026-11-19 16:40:35 +01:00
Killian
65156b81ca Feat(sdn-controller): add private networks rest routes (#10708)
Description

Adds POST /rest/v0/plugins/sdn-controller/pools/actions/create_private_network. Before this, a Global Private Network could only be created with the JSON-RPC method sdnController.createPrivateNetwork. Both APIs now go through _createPrivateNetwork. With sync=true the route answers 201 { networkIds }, the id of the network created on each pool.

Defaults, the same as the JSON-RPC method's: encrypted: false, mtu: 0 (left to XAPI), no preferred center. The route is admin-only and isn't exposed to MCP. Without sync=true it answers 202 with a task.

Side effects

    XO becomes the SDN controller of every pool in the network. This isn't new, but a REST client can now trigger it.
    Networks are created one pool at a time, so if XAPI fails on one pool, the networks already created on earlier pools stay.
    Bad parameters are now refused before the first network is created:
        invalidParameters for an empty poolIds, a pool given twice, a pool with no PIF, or a preferred center outside the pools
        404 for an unknown PIF
    The JSON-RPC method now returns the ids of the networks it created. XO 5 ignores them.
    Fix: a preferred center outside the first pool made the creation fail, and left an untracked network with no tunnels. Introduced by fix(xo-server-sdn-controller): correctly find preferred center's pool #5080.

XO-3337
2026-11-19 15:47:22 +01:00
Mathieu
ca1bb83672 docs(updater): fix broken link to the Replace your XOA guide (#10846)
#10471 linked to `migrate_to_new_xoa.md`, which #10575 had removed in
favor of the Vates knowledge base. Docusaurus fails on broken relative
Markdown links, so the docs build on master broke. Point to the KB
article that the existing redirect already targets.
2026-11-19 13:01:25 +01:00
Joris K
cce68035ca feat(web-core): add UiOverridden component (#10840) 2026-11-19 11:37:38 +01:00
Thomas Moraine
948d4a23e5 docs(updater.md): link to replace your xoa from the updater page (#10471)
* docs(updater): link to Replace your XOA for getting a newer OS

The updater keeps Xen Orchestra up to date but doesn't refresh the
appliance's underlying OS/kernel/runtime; point readers to the
"Replace your XOA" guide for that.

* docs(updater): turn OS updates note into a warning

Stress that keeping XOA's OS up to date is critical given its privileged
access, and that reboots shouldn't be postponed but scheduled outside
backup windows.

* docs(updater): make OS warning title actionable

* docs(updater): emphasize not postponing XOA reboots
2026-11-19 11:29:56 +01:00
OlivierFL
68634c8c01 test(web): map @core-test to the web-core test helpers (#10831) 2026-11-19 10:29:44 +01:00
Killian
36cb16e508 fix(xen-api,xo-server): reconnect a pool whose event loop failed (#10814)
After a short network interruption, a pool could disappear from XO and its server stay in "connecting" until it was disabled and enabled again.

The cause is a chain of three things:

    xo-server processed the metrics of a VM, host or PIF whose owner had been removed in the meantime (the cached records are refreshed type by type), and threw Cannot read properties of undefined (reading '$type') from the flush of the objects collection. The owner is already gone from XO, so the metrics are now skipped.
    xo-collection stopped flushing when a listener threw: the remaining batches and finish were never emitted and the buffer was emitted again at the next flush. Every batch and finish are now emitted whatever the listeners do, then the first failure is rethrown.
    xen-api swallowed the rejection of its event loop, so nothing restarted it and the cache froze on a connection which still looked alive; the session stayed open, disconnected was never emitted and the auto-reconnection never started. It now logs the error and disconnects, so the owner of the connection reconnects with a fresh cache.
2026-11-19 10:05:07 +01:00
1230 changed files with 56159 additions and 16393 deletions

View File

@@ -59,6 +59,33 @@ module.exports = {
'n/no-unpublished-import': 'off',
},
},
// The XO 6 test files share their modules (no isolation): mocking or resetting a module from one file would leak
// into the others. See @xen-orchestra/web/docs/tests/mocking.md
{
files: ['@xen-orchestra/web/src/**/*.unit.test.ts'],
rules: {
'no-restricted-syntax': [
'error',
{
selector: "CallExpression[callee.object.name='vi'][callee.property.name=/^(mock|doMock|unmock|doUnmock)$/]",
message: 'Mock a module with `mockModule` from `@/test/spy-on-module.ts`, never `vi.mock`.',
},
{
selector: "CallExpression[callee.object.name='vi'][callee.property.name='resetModules']",
message: 'The test files share their modules: never reset them.',
},
{
selector: "CallExpression[callee.object.name='vi'][callee.property.name='hoisted']",
message: '`mockModule` is not hoisted: declare the stubs as plain constants.',
},
{
selector: "CallExpression[callee.object.name='vi'][callee.property.name='resetAllMocks']",
message:
'Reset the stubs with `resetStubs` from `@/test/reset-stubs.ts`: `vi.resetAllMocks()` also resets the module mocks.',
},
],
},
},
{
files: ['@xen-orchestra/{web-core,lite,web}/**/*.{vue,ts}'],
parser: 'vue-eslint-parser',

View File

@@ -14,7 +14,7 @@
"url": "https://vates.fr"
},
"license": "ISC",
"version": "0.1.6",
"version": "0.1.7",
"engines": {
"node": ">=8.10"
},
@@ -25,7 +25,7 @@
"dependencies": {
"@vates/multi-key-map": "^0.2.0",
"@xen-orchestra/async-map": "^0.1.5",
"@xen-orchestra/log": "^0.7.2",
"@xen-orchestra/log": "^1.0.0",
"ensure-array": "^1.0.0"
},
"devDependencies": {

View File

@@ -1,6 +1,6 @@
{
"name": "@vates/fuse-vhd",
"version": "2.1.3",
"version": "2.1.4",
"license": "ISC",
"private": false,
"homepage": "https://github.com/vatesfr/xen-orchestra/tree/master/@vates/fuse-vhd",
@@ -19,12 +19,12 @@
},
"main": "./index.mjs",
"dependencies": {
"@xen-orchestra/fs": "^4.10.0",
"@xen-orchestra/log": "^0.7.2",
"@xen-orchestra/fs": "^4.11.0",
"@xen-orchestra/log": "^1.0.0",
"fuse-native": "^2.2.6",
"lru-cache": "^7.14.0",
"promise-toolbox": "^0.21.0",
"vhd-lib": "^4.17.0"
"vhd-lib": "^4.17.1"
},
"bin": {
"xo-fuse-vhd": "./cli.mjs"

View File

@@ -1,6 +1,6 @@
{
"name": "@vates/iscsi",
"version": "0.4.0",
"version": "0.4.1",
"main": "dist/index.mjs",
"types": "dist/index.d.mts",
"bin": {
@@ -24,7 +24,7 @@
"@vates/async-each": "^1.0.3",
"@vates/read-chunk": "^1.2.1",
"@xen-orchestra/disk-transform": "^1.3.4",
"@xen-orchestra/log": "^0.7.2",
"@xen-orchestra/log": "^1.0.0",
"promise-toolbox": "^0.21.0"
},
"devDependencies": {

View File

@@ -1,6 +1,6 @@
import assert from 'node:assert'
import { spawn } from 'node:child_process'
import { pFromCallback } from 'promise-toolbox'
import { pFromCallback, pTimeout } from 'promise-toolbox'
import { createLogger } from '@xen-orchestra/log'
import AbstractNbdClient from './AbstractNbdClient.mjs'
@@ -9,6 +9,9 @@ const { warn } = createLogger('vates:nbd-client:stdio')
// only the tail is kept: it's the part describing why the server died
const STDERR_MAX_LENGTH = 4096
// how long a failed connection waits for the server to exit and its stderr to end
const CLOSE_TIMEOUT = 1e3
/**
* NBD client talking to a server through its standard streams, like
* `nbdkit -s` or `qemu-nbd` in `--fd` mode: the queries are written to the
@@ -28,7 +31,7 @@ export default class NbdStdioClient extends AbstractNbdClient {
#cwd
#env
/** @type {{ child: import('node:child_process').ChildProcess, closing: boolean, stderr: string }|undefined} */
/** @type {{ child: import('node:child_process').ChildProcess, closing: boolean, stderr: string, closed: Promise<unknown> }|undefined} */
#state
/**
@@ -68,6 +71,36 @@ export default class NbdStdioClient extends AbstractNbdClient {
return this.#state?.child.pid
}
/**
* A server dying before the handshake makes it fail with "stream has ended
* without data", and the exit handler, racing with the teardown, often
* reports nothing: what the server wrote on stderr is the only reason given,
* so it becomes the error.
*/
async connect() {
try {
return await super.connect()
} catch (error) {
const state = this.#state
const closed =
state !== undefined &&
(await pTimeout.call(state.closed, CLOSE_TIMEOUT).then(
() => true,
() => false
))
// exitCode is null when the process was killed, by us when it did not die by itself
if (closed && state.child.exitCode !== null && state.stderr !== '') {
const serverError = new Error(state.stderr.trim(), { cause: error })
serverError.code = 'NBD_SERVER_EXITED'
serverError.exitCode = state.child.exitCode
serverError.command = this.#command
serverError.stderr = state.stderr
throw serverError
}
throw error
}
}
async _openTransport() {
const child = spawn(this.#command, this.#args, {
cwd: this.#cwd,
@@ -75,7 +108,13 @@ export default class NbdStdioClient extends AbstractNbdClient {
// the protocol goes through stdin/stdout, stderr is only used for diagnostics
stdio: ['pipe', 'pipe', 'pipe'],
})
const state = { child, closing: false, stderr: '' }
const state = {
child,
closing: false,
stderr: '',
// 'close' comes after the exit and the end of the standard streams: stderr is complete
closed: new Promise(resolve => child.once('close', resolve)),
}
this.#state = state
child.stderr.setEncoding('utf8')

View File

@@ -0,0 +1,19 @@
import assert from 'node:assert/strict'
import { describe, it } from 'node:test'
import NbdStdioClient from './NbdStdioClient.mjs'
describe('NbdStdioClient', () => {
it('reports what the server wrote on stderr when it dies before the handshake', async () => {
// the end of stdout and the exit of the process come in either order: repeat
for (let i = 0; i < 20; i++) {
const client = new NbdStdioClient({ command: 'sh', args: ['-c', 'echo "the actual reason" >&2; exit 1'] })
await assert.rejects(client.connect(), {
code: 'NBD_SERVER_EXITED',
exitCode: 1,
message: 'the actual reason',
stderr: 'the actual reason\n',
})
}
})
})

View File

@@ -13,7 +13,7 @@
"url": "https://vates.fr"
},
"license": "ISC",
"version": "3.7.0",
"version": "3.7.2",
"engines": {
"node": ">=14.0"
},
@@ -23,9 +23,9 @@
"@vates/read-chunk": "^1.2.1",
"@xen-orchestra/async-map": "^0.1.5",
"@xen-orchestra/disk-transform": "^1.3.4",
"@xen-orchestra/log": "^0.7.2",
"@xen-orchestra/log": "^1.0.0",
"promise-toolbox": "^0.21.0",
"xen-api": "^5.1.0"
"xen-api": "^6.0.0"
},
"devDependencies": {
"tap": "^18.7.0",

View File

@@ -1,6 +1,6 @@
{
"name": "@vates/node-vsphere-soap",
"version": "2.2.0",
"version": "2.2.1",
"description": "interface to vSphere SOAP/WSDL from node for interfacing with vCenter or ESXi, forked from node-vsphere-soap",
"main": "lib/client.mjs",
"author": "reedog117",
@@ -11,7 +11,7 @@
},
"bugs": "https://github.com/vatesfr/xen-orchestra/issues",
"dependencies": {
"@xen-orchestra/log": "^0.7.2",
"@xen-orchestra/log": "^1.0.0",
"axios": "^1.15.0",
"soap": "^1.0.0",
"soap-cookie": "^0.10.1"

View File

@@ -13,7 +13,7 @@
"url": "https://vates.fr"
},
"license": "ISC",
"version": "0.1.0",
"version": "0.2.0",
"engines": {
"node": ">=8.10"
},

View File

@@ -19,7 +19,7 @@
"url": "https://vates.fr"
},
"license": "ISC",
"version": "0.1.0",
"version": "0.2.0",
"engines": {
"node": ">=18"
},

View File

@@ -1,7 +1,7 @@
{
"name": "@vates/types",
"private": false,
"version": "2.5.0",
"version": "3.1.0",
"main": "./dist/index.mjs",
"exports": {
".": {

View File

@@ -22,6 +22,11 @@ export const BACKUP_EXPRESSION_CONTEXT = {
tags: { type: 'string[]' },
power_state: { type: 'string' },
},
pool: {
name_label: { type: 'string' },
description: { type: 'string' },
tags: { type: 'string[]' },
},
chainLength: { type: 'number' },
} as const
@@ -33,6 +38,8 @@ export const BACKUP_SETTING_CONTEXT = {
vmFilter: ['vm', 'run'],
srs: ['sr', 'run'],
remotes: ['backupRepository', 'run'],
vms: ['vm', 'run'],
pools: ['pool', 'run'],
} as const
export type BACKUP_SETTING_CONTEXT = (typeof BACKUP_SETTING_CONTEXT)[keyof typeof BACKUP_SETTING_CONTEXT]

View File

@@ -759,6 +759,10 @@ export type TrafficRuleProtocol = (typeof TRAFFIC_RULE_PROTOCOLS)[number]
export const SDN_CONTROLLER_OF_RULES_KEY = 'xo:sdn-controller:of-rules'
export const SDN_CONTROLLER_OF_METHOD_KEY = 'xo:sdn-controller:of-method'
export const SDN_CONTROLLER_OF_FORMAT_KEY = 'xo:sdn-controller:of-format'
export const SDN_CONTROLLER_PRIVATE_NETWORK_UUID_KEY = 'xo:sdn-controller:private-network-uuid'
export const SDN_CONTROLLER_ENCRYPTED_KEY = 'xo:sdn-controller:encrypted'
export const SDN_CONTROLLER_ENCAPSULATION_KEY = 'xo:sdn-controller:encapsulation'
export const SDN_CONTROLLER_PREFERRED_CENTER_KEY = 'xo:sdn-controller:preferred-center'
export const TRAFFIC_RULE_PROTOCOLS = ['ARP', 'ICMP', 'IP', 'TCP', 'UDP'] as const
export const TRAFFIC_RULE_PROTOCOLS_WITH_PORT: readonly TrafficRuleProtocol[] = ['TCP', 'UDP']
@@ -818,3 +822,16 @@ export type RPU_RECOVERY_STEP_NAME = (typeof RPU_RECOVERY_STEP_NAMES)[number]
export const COMMON_TAG = {
NOBAK: 'xo:no-bak',
} as const
/**
* a package of the XO appliance with another version available
*
* Returned by `xoa-updater` as `upgradablePackages` at the end of an update check.
*/
export type XoaPackageUpdate = {
name: string
/** version which will be installed */
version: string
/** undefined: the package is not installed yet */
installedVersion?: string
}

View File

@@ -155,26 +155,80 @@ export type PoolRollingUpdateRecoveryError = {
}
export type PoolRollingUpdateRecoveryHost = {
status: 'pending' | 'running' | 'succeeded' | 'failed' | 'not-needed'
/** `interrupted`: left in progress by a run that is over */
status: 'pending' | 'running' | 'interrupted' | 'succeeded' | 'failed' | 'not-needed'
steps: Record<RPU_RECOVERY_STEP_NAME, PoolRollingUpdateRecoveryStep>
lastError: PoolRollingUpdateRecoveryError | null
}
/** a VM the last migrate back of the run could not bring to its original host */
export type PoolRollingUpdateRecoveryVmConflict = {
vmId: string
/** unknown for a VM deleted before the run could read it */
vmName?: string
/** UUID of the host the VM was running on before the run */
hostId: string
/** `stopped` and `deleted`: left to the operator; `migration-failed`: retried by a resume */
reason: 'stopped' | 'deleted' | 'migration-failed'
/** XAPI error of the last migration, `migration-failed` only */
message?: string
}
/** what an operator changed, since the run, on a setting the run left changed or on an object of the run */
export type PoolRollingUpdateRecoveryOperatorChange = {
/** `haHeartbeatSr`: a heartbeat SR needed to enable HA again no longer exists */
type: 'ha' | 'autoPowerOn' | 'wlb' | 'schedule' | 'haHeartbeatSr' | 'host' | 'vm'
/** pool, schedule, SR, host or VM UUID */
id: string
/** schedules enabled again only */
name?: string
/** `disabled` as the run left it, `present` for a heartbeat SR, a host or a VM */
expected: 'disabled' | 'present'
/** `missing` for a deleted schedule, heartbeat SR, host or VM */
observed: 'enabled' | 'missing'
}
/** hosts resumes added to the plan of the run: patches released since it started, or hosts new to the pool */
export type PoolRollingUpdateRecoveryPlanChange = {
/** the last resume which added hosts */
attempt: number
/** UUIDs of hosts the run did not plan to update, or had finished, added by any resume */
addedHostIds: string[]
}
export type PoolRollingUpdateRecoveryRun = {
runId: string
poolId: string
status: 'preparing' | 'running' | 'interrupted' | 'resuming' | 'failed' | 'cleaning' | 'succeeded'
/** `awaiting-acceptance`: a resume found operator changes and waits for them to be accepted */
status:
| 'preparing'
| 'running'
| 'interrupted'
| 'resuming'
| 'failed'
| 'cleaning'
| 'succeeded'
| 'awaiting-acceptance'
startedAt: string
updatedAt: string
finishedAt?: string
interruptedAt?: string
taskId?: string
variant?: 'xcp' | 'xs-cdn'
/** 1 for the first attempt, incremented by each resume of the run */
attempt?: number
/** whether a resume would be accepted: run failed, interrupted or awaiting the acceptance of operator changes */
resumable?: boolean
hostOrder?: string[]
hosts: Record<string, PoolRollingUpdateRecoveryHost>
lastError: PoolRollingUpdateRecoveryError | null
/** VM UUID -> UUID of the host it must be started on */
haltedPinnedVms: Record<string, string>
vmConflicts: PoolRollingUpdateRecoveryVmConflict[]
/** found by the last resume, the run stays `awaiting-acceptance` until they are accepted */
operatorChanges: PoolRollingUpdateRecoveryOperatorChange[]
/** absent when no resume changed the plan */
planChange?: PoolRollingUpdateRecoveryPlanChange
}
/** record unreadable or of an unknown schema version: recovery needs a human */
@@ -303,6 +357,8 @@ export type XoApp = EventEmitter & {
checkFeatureAuthorization(featureCode: FeatureCode): Promise<void>
/* whether this machine can run the tools of an import from VMware */
checkEsxiDependencies(): Promise<XoV2vStatus>
/* Throw if the proxy cannot be reached */
checkProxyHealth(id: XoProxy['id']): Promise<void>
/* validate, apply and persist the configuration of a plugin */
configurePlugin(id: string, configuration: unknown, mergeWithExisting?: boolean): Promise<void>
/* connect a server (XCP-ng/XenServer) */
@@ -416,6 +472,7 @@ export type XoApp = EventEmitter & {
getPlugin(id: XoPlugin['id']): Promise<XoPlugin>
getPlugins(): Promise<XoPlugin[]>
getProxy(id: XoProxy['id']): Promise<XoProxy>
getProxyApplianceUpdaterState(id: XoProxy['id']): Promise<{ level: string; message: string; state: string }>
getRemote(id: XoBackupRepository['id']): Promise<XoBackupRepository>
getAllRemotes(): Promise<XoBackupRepository[]>
removeRemote(id: XoBackupRepository['id']): Promise<void>
@@ -617,6 +674,10 @@ export type XoApp = EventEmitter & {
): Promise<void>
getRollingUpdateRecovery(poolId: XoPool['id']): Promise<PoolRollingUpdateRecovery | undefined>
finalizeRollingUpdate(pool: XoPool, opts?: { force?: boolean; parentTask?: VatesTask }): Promise<void>
resumeRollingPoolUpdate(
pool: XoPool,
opts?: { acceptOperatorChanges?: boolean; bypassBackupCheck?: boolean; parentTask?: VatesTask }
): Promise<void>
setVmResourceSet(vmId: XoVm['id'], resourceSetId: string | null, force?: boolean): Promise<void>
shareVmResourceSet(vmId: XoVm['id']): Promise<void>
removeUserFromGroup(userId: XoUser['id'], id: XoGroup['id']): Promise<void>

View File

@@ -579,6 +579,9 @@ export type XoBrowserMediaSession = {
export type XoProxy = {
id: Branded<'proxy'>
/**
* @deprecated no replacement for this field
*/
url: string
version?: string
name: string
@@ -643,7 +646,7 @@ export type XoVmBackupJob = BaseXoJob & {
proxy?: XoProxy['id']
mode: 'full' | 'delta'
remotes?: CMType.IdOr<XoBackupRepository['id']> | string
vms: CMType.IdOr<XoVm['id']> | Record<string, unknown>
vms: CMType.IdOr<XoVm['id']> | Record<string, unknown> | string
srs?: CMType.IdOr<XoSr['id']> | string
type: 'backup'
settings: {
@@ -660,7 +663,7 @@ export type XoMetadataBackupJobScheduleSettings = {
}
export type XoMetadataBackupJob = BaseXoJob & {
type: 'metadataBackup'
pools?: CMType.IdOr<XoPool['id']>
pools?: CMType.IdOr<XoPool['id']> | string
remotes: CMType.IdOr<XoBackupRepository['id']>
settings: {
''?: XoMetadataBackupJobGeneralSettings
@@ -693,6 +696,7 @@ export type XoMirrorBackupJob = BaseXoJob & {
sourceRemote: XoBackupRepository['id']
remotes: CMType.IdOr<XoBackupRepository['id']>
proxy?: XoProxy['id']
filter?: { vm: { uuid: { __or: XoVm['id'][] } } } | null
settings: {
'': XoMirrorBackupGeneralSettings
[scheduleId: XoSchedule['id']]: XoMirrorBackupScheduleSettings | undefined

View File

@@ -6,7 +6,7 @@
"main": "dist/index.mjs",
"name": "@xen-orchestra/acl",
"homepage": "https://github.com/vatesfr/xen-orchestra/tree/master/@xen-orchestra/acl",
"version": "1.8.0",
"version": "1.9.0",
"license": "AGPL-3.0-or-later",
"private": false,
"type": "module",
@@ -30,7 +30,7 @@
},
"devDependencies": {
"@eslint/js": "^9.19.0",
"@vates/types": "^2.5.0",
"@vates/types": "^3.1.0",
"rimraf": "^6.0.1",
"typescript": "~5.6",
"typescript-eslint": "^8.61.0"

View File

@@ -3,7 +3,16 @@ export default {
delete: true,
forget: true,
import: {
vdi: true,
vdi: {
upload: true,
/**
* Warning: lets the holder make XO send a GET request to any HTTP(S) URL, including internal addresses
* reachable from the XO server (localhost, management network, etc.).
*
* Covered by `import:vdi`, `import` and `*`: only grant these to trusted users.
*/
url: true,
},
vm: true,
},
'migrate-receive': true,

View File

@@ -38,33 +38,10 @@ export class Privilege<T extends SupportedResource> {
}
#matchAction<Resource extends SupportedResource = T>(action: SupportedActions<Resource>) {
// read:name_label - read:name_label
if (this.#action === action) {
return true
}
const [namespaceToMatch, actionToMatch] = action.split(':')
const [thisNamespace, thisAction] = this.#action.split(':')
if (thisNamespace === '*') {
return true
}
// update:vm - read:name_label
if (thisNamespace !== namespaceToMatch) {
return false
}
// read - read:name_label
if (thisAction === undefined) {
return true
}
// read:name_decription - read:name_label
if (thisAction !== actionToMatch) {
return false
}
throw new Error(`Unable to verify if ${this.#action} match ${action} `)
// A privilege allows its own action and every action below it in the tree:
// e.g. `*`, `import`, `import:vdi` and `import:vdi:url` all allow `import:vdi:url`,
// but `import:vdi:upload` does not (it is a sibling, not a parent)
return this.#action === '*' || this.#action === action || action.startsWith(`${this.#action}:`)
}
#matchSelector(object: object) {

View File

@@ -27,6 +27,12 @@ suite('Privilege.checkActionIsValid behavior', () => {
test('should work', () => {
assert.doesNotThrow(() => Privilege.checkActionIsValid('vm', 'read'))
})
test('should work with 3-level actions', () => {
assert.doesNotThrow(() => Privilege.checkActionIsValid('sr', 'import:vdi:url'))
// @ts-expect-error test invalid action
assert.throws(() => Privilege.checkActionIsValid('sr', 'import:vdi:foo'))
})
})
suite('Privilege.match behavior', () => {
@@ -59,6 +65,22 @@ suite('Privilege.match behavior', () => {
const cleanShutdownPrivilege = new Privilege({ action: 'shutdown:clean', resource: 'vm', effect: 'allow' })
assert.strictEqual(cleanShutdownPrivilege.match({ resource: 'vm', action: 'shutdown', object }), false)
})
test('Should match 3-level actions with any parent action', () => {
for (const action of ['*', 'import', 'import:vdi', 'import:vdi:url'] as const) {
const srPrivilege = new Privilege({ action, resource: 'sr', effect: 'allow' })
assert.strictEqual(srPrivilege.match({ resource: 'sr', action: 'import:vdi:url', object }), true, action)
}
})
test('Should not match 3-level actions with a sibling or a child action', () => {
const uploadPrivilege = new Privilege({ action: 'import:vdi:upload', resource: 'sr', effect: 'allow' })
assert.strictEqual(uploadPrivilege.match({ resource: 'sr', action: 'import:vdi:url', object }), false)
assert.strictEqual(uploadPrivilege.match({ resource: 'sr', action: 'import:vdi', object }), false)
const vmImportPrivilege = new Privilege({ action: 'import:vm', resource: 'sr', effect: 'allow' })
assert.strictEqual(vmImportPrivilege.match({ resource: 'sr', action: 'import:vdi:url', object }), false)
})
})
suite('ACL V2 behavior', async () => {
@@ -258,6 +280,23 @@ suite('ACL V2 behavior', async () => {
false
)
})
test('Should allow VDI upload but not URL import with import:vdi allowed and import:vdi:url denied', () => {
const sr = { id: 'sr-id' }
const userPrivileges = [
{ id: privilegeId, action: 'import:vdi', resource: 'sr', effect: 'allow', roleId },
{ id: privilegeId, action: 'import:vdi:url', resource: 'sr', effect: 'deny', roleId },
] satisfies TPrivilege<'sr'>[]
assert.strictEqual(
hasPrivilegeOn({ user, action: 'import:vdi:upload', resource: 'sr', objects: sr, userPrivileges }),
true
)
assert.strictEqual(
hasPrivilegeOn({ user, action: 'import:vdi:url', resource: 'sr', objects: sr, userPrivileges }),
false
)
})
})
suite('getMissingPrivileges behavior', () => {
@@ -375,4 +414,12 @@ suite('getActionStrings', () => {
assert.ok(actions.includes('shutdown:clean'))
assert.ok(actions.includes('shutdown:hard'))
})
test('3-level actions are included alongside their parents', () => {
const actions = getActionStrings('sr')
assert.ok(actions.includes('import'))
assert.ok(actions.includes('import:vdi'))
assert.ok(actions.includes('import:vdi:upload'))
assert.ok(actions.includes('import:vdi:url'))
})
})

View File

@@ -7,7 +7,7 @@
"type": "git",
"url": "https://github.com/vatesfr/xen-orchestra.git"
},
"version": "0.4.0",
"version": "0.4.1",
"engines": {
"node": ">=14"
},
@@ -17,7 +17,7 @@
},
"dependencies": {
"@vates/decorate-with": "^2.1.0",
"@xen-orchestra/log": "^0.7.2",
"@xen-orchestra/log": "^1.0.0",
"golike-defer": "^0.5.1",
"object-hash": "^2.0.1"
},

View File

@@ -1,7 +1,7 @@
{
"private": true,
"name": "@xen-orchestra/autopilot-docking",
"version": "0.0.0",
"version": "0.1.0",
"description": "Live ISO that prepares a VM imported from another hypervisor to boot on XCP-ng",
"homepage": "https://github.com/vatesfr/xen-orchestra/tree/master/@xen-orchestra/autopilot-docking",
"bugs": "https://github.com/vatesfr/xen-orchestra/issues",

View File

@@ -1,6 +1,6 @@
{
"name": "@xen-orchestra/backup-archive",
"version": "1.2.0",
"version": "1.2.1",
"description": "Helper to handle generic backup archives",
"license": "ISC",
"author": "",
@@ -21,18 +21,18 @@
"tar-stream": "^3.1.8",
"@types/tar-stream": "^3.1.4",
"tmp": "^0.2.1",
"@vates/types": "^2.5.0"
"@vates/types": "^3.1.0"
},
"dependencies": {
"@xen-orchestra/log": "^0.7.1",
"@xen-orchestra/fs": "^4.10.0",
"@xen-orchestra/log": "^1.0.0",
"@xen-orchestra/fs": "^4.11.0",
"@xen-orchestra/disk-transform": "^1.3.4",
"@vates/task": "0.7.0",
"golike-defer": "0.5.1",
"uuid": "^9.0.0",
"promise-toolbox": "^0.21.0",
"@vates/async-each": "^1.0.1",
"vhd-lib": "^4.17.0"
"vhd-lib": "^4.17.1"
},
"scripts": {
"build": "yarn run clean && tsc",

View File

@@ -8,8 +8,8 @@
"dependencies": {
"@vates/async-each": "^1.0.3",
"@xen-orchestra/async-map": "^0.1.5",
"@xen-orchestra/backups": "^0.78.0",
"@xen-orchestra/fs": "^4.10.0",
"@xen-orchestra/backups": "^1.0.1",
"@xen-orchestra/fs": "^4.11.0",
"filenamify": "^6.0.0",
"getopts": "^2.2.5",
"lodash": "^4.18.0",
@@ -28,7 +28,7 @@
"scripts": {
"postversion": "npm publish --access public"
},
"version": "1.1.18",
"version": "1.1.19",
"license": "AGPL-3.0-or-later",
"author": {
"name": "Vates SAS",

View File

@@ -9,6 +9,7 @@ const { warn } = createLogger('xo:backups:buildContext')
/**
* @typedef {import('@vates/types/xen-api').XenApiVm} XenApiVm
* @typedef {import('@vates/types/xo').XoSr} XoSr
* @typedef {import('@vates/types/xo').XoPool} XoPool
* @typedef {import('@vates/types/xo').XoBackupRepository} XoBackupRepository
*
* @typedef {object} RunContext
@@ -30,6 +31,10 @@ const { warn } = createLogger('xo:backups:buildContext')
* @typedef {object} BackupRepositoryContext
* @property {{name: string, type: string | undefined, tags: string[]}} backupRepository
* @property {RunContext} run
*
* @typedef {object} PoolContext
* @property {{name_label: string, description: string, tags: string[]}} pool
* @property {RunContext} run
*/
/**
@@ -109,3 +114,19 @@ export function buildBackupRepositoryContext(backupRepository, run) {
run,
}
}
/**
* @param {XoPool} pool
* @param {RunContext} run
* @returns {PoolContext}
*/
export function buildPoolContext(pool, run) {
return {
pool: {
name_label: pool.name_label,
description: pool.name_description,
tags: Array.isArray(pool.tags) ? pool.tags : [],
},
run,
}
}

View File

@@ -1,7 +1,13 @@
import { describe, it } from 'node:test'
import assert from 'node:assert/strict'
import { buildRunContext, buildVmContext, buildSrContext, buildBackupRepositoryContext } from './_buildContext.mjs'
import {
buildRunContext,
buildVmContext,
buildSrContext,
buildBackupRepositoryContext,
buildPoolContext,
} from './_buildContext.mjs'
import { BACKUP_EXPRESSION_CONTEXT } from '@vates/types/backup-expression-context'
describe('buildContext', () => {
@@ -144,4 +150,39 @@ describe('buildContext', () => {
Object.keys(BACKUP_EXPRESSION_CONTEXT.backupRepository).sort()
)
})
it('buildPoolContext', () => {
const pool1 = {
name_label: 'name_label',
name_description: 'description',
ignored: 'ignored',
}
const poolContext1 = buildPoolContext(pool1, runContext)
assert.deepEqual(poolContext1, {
pool: {
name_label: 'name_label',
description: 'description',
tags: [],
},
run: expectedRunContext,
})
assert.deepEqual(Object.keys(poolContext1.pool).sort(), Object.keys(BACKUP_EXPRESSION_CONTEXT.pool).sort())
const pool2 = {
name_label: 'name_label',
name_description: 'description',
tags: ['tag'],
ignored: 'ignored',
}
const poolContext2 = buildPoolContext(pool2, runContext)
assert.deepEqual(poolContext2, {
pool: {
name_label: 'name_label',
description: 'description',
tags: ['tag'],
},
run: expectedRunContext,
})
assert.deepEqual(Object.keys(poolContext2.pool).sort(), Object.keys(BACKUP_EXPRESSION_CONTEXT.pool).sort())
})
})

View File

@@ -83,6 +83,7 @@ const main = Disposable.wrap(async function* main(args) {
handler.unlink(taskFile).catch(error => warn('deleting task failure', { error }))
} catch (error) {
warn('failure handling task', { error })
if (error.code === 'ELOCKED') await new Promise(resolve => setTimeout(resolve, 5 * 60e3))
}
},
{ concurrency }

View File

@@ -8,7 +8,7 @@
"type": "git",
"url": "https://github.com/vatesfr/xen-orchestra.git"
},
"version": "0.78.0",
"version": "1.0.1",
"engines": {
"node": ">=22.19"
},
@@ -24,20 +24,20 @@
"@vates/cached-dns.lookup": "^1.0.0",
"@vates/compose": "^2.1.0",
"@vates/decorate-with": "^2.1.0",
"@vates/disposable": "^0.1.6",
"@vates/fuse-vhd": "^2.1.3",
"@vates/disposable": "^0.1.7",
"@vates/fuse-vhd": "^2.1.4",
"@vates/generator-toolbox": "^1.1.3",
"@vates/nbd-client": "^3.7.0",
"@vates/nbd-client": "^3.7.2",
"@vates/parse-duration": "^0.1.1",
"@vates/task": "^0.7.0",
"@vates/types": "^2.5.0",
"@vates/types": "^3.1.0",
"@xen-orchestra/async-map": "^0.1.5",
"@xen-orchestra/disk-transform": "^1.3.4",
"@xen-orchestra/fs": "^4.10.0",
"@xen-orchestra/log": "^0.7.2",
"@xen-orchestra/fs": "^4.11.0",
"@xen-orchestra/log": "^1.0.0",
"@xen-orchestra/qcow2": "^1.4.1",
"@xen-orchestra/template": "^0.1.1",
"@xen-orchestra/backup-archive": "^1.2.0",
"@xen-orchestra/backup-archive": "^1.2.1",
"app-conf": "^3.0.0",
"compare-versions": "^6.0.0",
"complex-matcher": "^1.1.1",
@@ -56,8 +56,8 @@
"tar": "^7.5.19",
"uuid": "^9.0.0",
"value-matcher": "^0.2.0",
"vhd-lib": "^4.17.0",
"xen-api": "^5.1.0",
"vhd-lib": "^4.17.1",
"xen-api": "^6.0.0",
"xo-common": "^0.11.0",
"xo-remote-parser": "^2.0.0",
"yazl": "^2.5.1"
@@ -70,7 +70,7 @@
"typescript": "^5.9.3"
},
"peerDependencies": {
"@xen-orchestra/xapi": "^9.1.0"
"@xen-orchestra/xapi": "^10.0.0"
},
"license": "AGPL-3.0-or-later",
"author": {

View File

@@ -1,7 +1,7 @@
{
"private": false,
"name": "@xen-orchestra/cr-seed-cli",
"version": "1.0.3",
"version": "1.0.4",
"homepage": "https://github.com/vatesfr/xen-orchestra/tree/master/@xen-orchestra/cr-seed-cli",
"bugs": "https://github.com/vatesfr/xen-orchestra/issues",
"repository": {
@@ -18,7 +18,7 @@
"preferGlobal": true,
"dependencies": {
"golike-defer": "^0.5.1",
"xen-api": "^5.1.0"
"xen-api": "^6.0.0"
},
"scripts": {
"postversion": "npm publish"

View File

@@ -1,7 +1,7 @@
{
"private": false,
"name": "@xen-orchestra/disk-cli",
"version": "2.2.5",
"version": "2.2.6",
"description": "CLI tool to inspect and manage disks in backup repositories",
"type": "module",
"bin": {
@@ -20,13 +20,13 @@
},
"dependencies": {
"@vates/async-each": "^1.0.3",
"@xen-orchestra/backups": "^0.78.0",
"@xen-orchestra/backup-archive": "^1.2.0",
"@xen-orchestra/backups": "^1.0.1",
"@xen-orchestra/backup-archive": "^1.2.1",
"@xen-orchestra/disk-transform": "^1.3.4",
"@xen-orchestra/fs": "^4.10.0",
"@xen-orchestra/fs": "^4.11.0",
"@xen-orchestra/qcow2": "^1.4.1",
"promise-toolbox": "^0.21.0",
"vhd-lib": "^4.17.0"
"vhd-lib": "^4.17.1"
},
"devDependencies": {
"@types/node": "^22.3.0",

View File

@@ -1,7 +1,7 @@
{
"private": false,
"name": "@xen-orchestra/fs",
"version": "4.10.0",
"version": "4.11.0",
"license": "AGPL-3.0-or-later",
"description": "The File System for Xen Orchestra backups.",
"homepage": "https://github.com/vatesfr/xen-orchestra/tree/master/@xen-orchestra/fs",
@@ -30,7 +30,7 @@
"@vates/coalesce-calls": "^0.1.0",
"@vates/decorate-with": "^2.1.0",
"@vates/read-chunk": "^1.2.1",
"@xen-orchestra/log": "^0.7.2",
"@xen-orchestra/log": "^1.0.0",
"bind-property-descriptor": "^2.0.0",
"decorator-synchronized": "^0.6.0",
"execa": "^5.0.0",

View File

@@ -16,14 +16,14 @@
"xo-immutable-remote": "./dist/protectRemotes.mjs"
},
"license": "AGPL-3.0-or-later",
"version": "3.0.9",
"version": "3.0.10",
"engines": {
"node": ">=20.0.0"
},
"dependencies": {
"@vates/async-each": "^1.0.3",
"@xen-orchestra/backups": "^0.78.0",
"@xen-orchestra/log": "^0.7.2",
"@xen-orchestra/backups": "^1.0.1",
"@xen-orchestra/log": "^1.0.0",
"app-conf": "^3.0.0",
"execa": "^5.0.0",
"ms": "^2.1.3"

View File

@@ -2,6 +2,9 @@
## **next**
- [VDIs] The used space of a VDI now includes its whole snapshot chain instead of only its last layer, which showed almost 0% for disks with snapshots. It is shown as a size, without usage bar or free space (PR [#10116](https://github.com/vatesfr/xen-orchestra/pull/10116))
- [Web-Core/UiCircleProgressBar] Add a brand accent and an option to hide the value (PR [#10849](https://github.com/vatesfr/xen-orchestra/pull/10849))
- [Tables] Cells fit on one line: long names are cut in the middle, extra tags go under "+N" and long texts end with "…" (PR [#10850](https://github.com/vatesfr/xen-orchestra/pull/10850))
- [Pages] The page header and tabs now stay in place on every page: dashboards, System tabs, consoles, tasks, settings and creation forms scroll under them instead of scrolling with them (PR [#10822](https://github.com/vatesfr/xen-orchestra/pull/10822))
- [VM/Host] Main actions (shutdown, reboot, start, resume, migrate, snapshot) are shown as buttons in the VM and host headers and move one by one into "More actions" when space runs out; "More actions" groups them under "Change state" and "Actions" sections, and VMs without guest tools get force shutdown and force reboot instead (PR [#10815](https://github.com/vatesfr/xen-orchestra/pull/10815))
- [Web-Core/UiButtonIcon] Update icon buttons design, with a counter replacing the notification dot (PR [#10799](https://github.com/vatesfr/xen-orchestra/pull/10799))
@@ -12,6 +15,12 @@
- [Web-Core/UiDropdownButton] Update dropdown buttons design (PR [#9850](https://github.com/vatesfr/xen-orchestra/pull/9850))
- [Tables] Tables are filtered as you type, half a second after the last keystroke, or right away with Enter; the "Search" button is removed (PR [#10797](https://github.com/vatesfr/xen-orchestra/pull/10797))
- [Side panels] Fix the double scrollbar when the side panel content is taller than the screen: the page header now stays in place, and the list and the side panel each scroll on their own. All scrollbars are now thin, like the side panel one (PR [#10807](https://github.com/vatesfr/xen-orchestra/pull/10807))
- [Mobile] Searchable dropdown lists no longer overflow the screen (PR [#10854](https://github.com/vatesfr/xen-orchestra/pull/10854))
- [New/VM] Fix the storage table overflowing horizontally, which hid part of the delete button (PR [#10851](https://github.com/vatesfr/xen-orchestra/pull/10851))
- [New/VM] Fix template disk settings being applied to every disk of the new VM: each disk now keeps its own name, description and SR (PR [#10898](https://github.com/vatesfr/xen-orchestra/pull/10898))
- [VM/System] Display the default 4 MiB video RAM for HVM VMs that don't define it, as XO 6 does (PR [#10901](https://github.com/vatesfr/xen-orchestra/pull/10901))
- [Pool/Host/VMs] Add a side panel and a per-VM actions menu to the VMs tables, add "Migrate" to the VM actions menu of the treeview, show the vCPUs of halted VMs, and fix the VMs actions bar no longer being displayed, on desktop and on mobile (PR [#10936](https://github.com/vatesfr/xen-orchestra/pull/10936))
- [VM/SR] Add "Delete" to the "More actions" menu of the VM header and show the master host in the hosts card of the SR side panel, as XO 6 does (PR [#10936](https://github.com/vatesfr/xen-orchestra/pull/10936))
## **0.27.0** (2026-10-29)

View File

@@ -27,13 +27,13 @@
"@types/file-saver": "^2.0.7",
"@types/lodash-es": "^4.17.12",
"@types/node": "^18.19.80",
"@vates/types": "^2.5.0",
"@vates/types": "^3.1.0",
"@vitejs/plugin-vue": "^6.0.0",
"@vue/tsconfig": "^0.9.0",
"@vueuse/core": "^14.0.0",
"@vueuse/math": "^14.0.0",
"@vueuse/shared": "^14.0.0",
"@xen-orchestra/web-core": "^0.65.0",
"@xen-orchestra/web-core": "^0.66.1",
"complex-matcher": "^1.1.1",
"d3-time-format": "^4.1.0",
"decorator-synchronized": "^0.6.0",

View File

@@ -2,12 +2,12 @@
<div class="collection-filter-row">
<span class="or">{{ t('or') }}</span>
<div class="inputs">
<UiInput v-if="newFilter.isAdvanced" v-model="filterContent" accent="brand" class="advanced-input" />
<UiInput v-if="newFilter.isAdvanced" v-model="filterContent" accent="neutral" class="advanced-input" />
<template v-else>
<VtsSelect :id="builderPropertySelectId" accent="brand" />
<VtsSelect v-if="hasComparisonSelect" :id="builderComparisonSelectId" accent="brand" />
<VtsSelect v-if="currentFilter?.type === 'enum'" :id="builderValueSelectId" accent="brand" />
<UiInput v-else-if="hasValueInput" v-model="newFilter.builder.value" accent="brand" />
<VtsSelect :id="builderPropertySelectId" accent="neutral" />
<VtsSelect v-if="hasComparisonSelect" :id="builderComparisonSelectId" accent="neutral" />
<VtsSelect v-if="currentFilter?.type === 'enum'" :id="builderValueSelectId" accent="neutral" />
<UiInput v-else-if="hasValueInput" v-model="newFilter.builder.value" accent="neutral" />
</template>
</div>
<div class="buttons">

View File

@@ -42,7 +42,7 @@ const progress = computed(() => {
.progress-circle-fill {
animation: progress 1s ease-out forwards;
fill: none;
stroke: var(--color-success-item-base);
stroke: var(--color-success-data);
stroke-width: 1.2;
stroke-linecap: round;
stroke-dasharray: v-bind(progress), 100;

View File

@@ -1,5 +1,5 @@
<template>
<VtsSelect v-if="isSelectWidget(widget)" :id="selectId" accent="brand" />
<VtsSelect v-if="isSelectWidget(widget)" :id="selectId" accent="neutral" />
<UiRadioButtonGroup v-else-if="isRadioWidget(widget)" accent="brand" gap="wide">
<UiRadioButton
v-for="choice in widget.choices"

View File

@@ -1,7 +1,7 @@
<template>
<VtsInputGroup>
<UiInput v-model.number="sizeInput" accent="brand" type="number" :max-decimals="3" />
<VtsSelect :id="prefixSelectId" accent="brand" />
<UiInput v-model.number="sizeInput" accent="neutral" type="number" :max-decimals="3" />
<VtsSelect :id="prefixSelectId" accent="neutral" />
</VtsInputGroup>
</template>

View File

@@ -2,8 +2,8 @@
<UiModal accent="info" @dismiss="emit('cancel')" @confirm="handleSubmit()">
<template #content>
<div class="form-selects">
<VtsSelect :id="sortPropertySelectId" accent="brand" />
<VtsSelect :id="isAscendingSelectId" accent="brand" />
<VtsSelect :id="sortPropertySelectId" accent="neutral" />
<VtsSelect :id="isAscendingSelectId" accent="neutral" />
</div>
</template>

View File

@@ -7,7 +7,7 @@
@dismiss="emit('cancel')"
>
<template #content>
<UiTextarea v-model="editedJson" accent="brand" class="modal-textarea" />
<UiTextarea v-model="editedJson" accent="neutral" class="modal-textarea" />
<VtsOverlayButton variant="tertiary" @click="formatJson()">
{{ t('action:reformat') }}
</VtsOverlayButton>

View File

@@ -8,7 +8,7 @@
:label="t('select-compression')"
learn-more-url="https://xcp-ng.org/blog/2018/12/19/zstd-compression-for-xcp-ng/"
>
<VtsSelect :id="compressionSelectId" accent="brand" />
<VtsSelect :id="compressionSelectId" accent="neutral" />
</VtsInputWrapper>
</template>
<template #buttons>

View File

@@ -7,7 +7,7 @@
<template #content>
<div>
<VtsInputWrapper :label="t('select-destination-host')">
<VtsSelect :id="hostSelectId" accent="brand" />
<VtsSelect :id="hostSelectId" accent="neutral" />
</VtsInputWrapper>
</div>
</template>

View File

@@ -45,6 +45,7 @@ const emit = defineEmits<{
const { t } = useI18n()
const { HeadCells, BodyCells, colspan } = useNewVmNetworkColumns({
exclude: ['rank'],
body: ({ networkInterface, onRemove }: { networkInterface: NetworkInterface; onRemove: () => void }) => {
const { id: interfaceSelectId } = useFormSelect(networks, {
model: toRef(networkInterface, 'interface'),

View File

@@ -1,5 +1,5 @@
<template>
<VtsTable>
<VtsTable class="new-vm-sr-table" fixed>
<thead>
<tr>
<HeadCells />
@@ -49,6 +49,7 @@ const emit = defineEmits<{
const { t } = useI18n()
const { HeadCells, BodyCells, colspan } = useNewVmSrColumns({
exclude: ['rank'],
body: ({ vdi, onRemove }: { vdi: Vdi; onRemove?: () => void }) => {
const { id: srSelectId } = useFormSelect(() => srs, {
model: toRef(vdi, 'SR'),
@@ -76,3 +77,9 @@ const { HeadCells, BodyCells, colspan } = useNewVmSrColumns({
},
})
</script>
<style lang="postcss" scoped>
.new-vm-sr-table {
--vts-table-min-width: 80rem;
}
</style>

View File

@@ -1,17 +1,15 @@
<template>
<tr class="pif-row" :class="{ compact }">
<td class="typo-body-regular-small host">
<UiLink
<HostLink
v-if="host"
:host
:to="{ name: '/host/[uuid]/network', params: { uuid: host.uuid }, query: { id: pif.uuid } }"
:icon="getHostIcon(host, getHostPowerState(host))"
:is-primary="isMasterHost(host.$ref)"
:primary-tooltip="t('master')"
size="small"
class="host-link"
>
<span v-tooltip class="text-ellipsis">{{ host.name_label }}</span>
</UiLink>
</HostLink>
<span v-else>{{ t('host:status:unknown') }}</span>
</td>
<td v-tooltip class="typo-body-regular-small text-ellipsis device">{{ pif.device }}</td>
@@ -23,13 +21,10 @@
<script setup lang="ts">
import type { XenApiPif } from '@/libs/xen-api/xen-api.types.ts'
import { getHostIcon } from '@/modules/host/utils/host.util.ts'
import { useHostMetricsStore } from '@/stores/xen-api/host-metrics.store.ts'
import HostLink from '@/modules/host/components/HostLink.vue'
import { useHostStore } from '@/stores/xen-api/host.store.ts'
import { usePifStore } from '@/stores/xen-api/pif.store.ts'
import { usePoolStore } from '@/stores/xen-api/pool.store.ts'
import VtsStatus from '@core/components/status/VtsStatus.vue'
import UiLink from '@core/components/ui/link/UiLink.vue'
import { vTooltip } from '@core/directives/tooltip.directive.ts'
import { computed } from 'vue'
import { useI18n } from 'vue-i18n'
@@ -42,9 +37,7 @@ const { pif } = defineProps<{
const { t } = useI18n()
const { getByOpaqueRef } = useHostStore().subscribe()
const { getHostPowerState } = useHostMetricsStore().subscribe()
const { getPifStatus } = usePifStore().subscribe()
const { isMasterHost } = usePoolStore().subscribe()
const host = computed(() => getByOpaqueRef(pif.host))

View File

@@ -68,11 +68,11 @@ const hasError = computed(() => hostStoreHasError.value || vmStoreHasError.value
<style lang="postcss" scoped>
.progress-item {
--progress-bar-height: 1.2rem;
--progress-bar-color: var(--color-brand-item-base);
--progress-bar-color: var(--color-brand-data);
--progress-bar-background-color: var(--color-neutral-background-disabled);
&.warning {
--progress-bar-color: var(--color-warning-item-base);
--progress-bar-color: var(--color-warning-data);
--footer-value-color: var(--color-warning-item-base);
}

View File

@@ -56,7 +56,7 @@ const inactive = computed(() => props.total - props.active)
width: 1.3rem;
height: 1.3rem;
border-radius: 0.65rem;
background-color: var(--color-success-item-base);
background-color: var(--color-success-data);
&.inactive {
background-color: var(--color-neutral-background-disabled);

View File

@@ -59,7 +59,7 @@ const useTaskColumns = defineColumns(() => {
const { t } = useI18n()
return {
name: useTextColumn({ headerLabel: t('name') }),
name: useTextColumn({ headerLabel: t('name'), flexible: true }),
host: useLinkColumn({ headerLabel: t('host') }),
progress: useProgressBarColumn({ headerLabel: t('progress') }),
started: useDateColumn({ headerLabel: t('started') }),

View File

@@ -17,16 +17,7 @@
<VtsKeyValueRow :label="t('uuid')" :value="vm.uuid" copy />
<VtsKeyValueRow :label="t('host')">
<template #value>
<UiLink
v-if="host"
:icon="hostIcon"
:is-primary="isPoolMaster"
:primary-tooltip="t('master')"
:to="`/host/${host.uuid}`"
size="medium"
>
{{ host.name_label }}
</UiLink>
<HostLink v-if="host" :host :to="`/host/${host.uuid}`" size="medium" />
<span v-else>
{{ t('none') }}
</span>
@@ -35,7 +26,7 @@
</VtsKeyValueList>
<VtsKeyValueList>
<VtsKeyValueRow :label="t('description')" :value="vm.name_description" />
<VtsKeyValueRow :label="t('os-name')" :value="osVersion" />
<VtsKeyValueRow :label="t('os-name')" :value="osName" />
<VtsKeyValueRow :label="t('virtualization-type')" :value="virtualizationType" />
<VtsKeyValueRow :label="t('guest-tools')" :value="guestTools" />
</VtsKeyValueList>
@@ -55,23 +46,19 @@
<script lang="ts" setup>
import type { XenApiVm } from '@/libs/xen-api/xen-api.types.ts'
import { getHostIcon } from '@/modules/host/utils/host.util.ts'
import HostLink from '@/modules/host/components/HostLink.vue'
import { useVmMetricsInfo } from '@/modules/vm/composables/vm-metrics-info.composable.ts'
import { useVmUtils } from '@/modules/vm/composables/vm-utils.composable.ts'
import { useHostMetricsStore } from '@/stores/xen-api/host-metrics.store.ts'
import { usePoolStore } from '@/stores/xen-api/pool.store.ts'
import { getVmDomainType, getVmIpAddresses } from '@/modules/vm/utils/vm.util.ts'
import { useVmGuestMetricsStore } from '@/stores/xen-api/vm-guest-metrics.store.ts'
import { useVmMetricsStore } from '@/stores/xen-api/vm-metrics.store.ts'
import { useVmStore } from '@/stores/xen-api/vm.store.ts'
import VtsIcon from '@core/components/icon/VtsIcon.vue'
import VtsKeyValueList from '@core/components/key-value-list/VtsKeyValueList.vue'
import VtsKeyValueRow from '@core/components/key-value-row/VtsKeyValueRow.vue'
import VtsQuickInfoCard from '@core/components/quick-info-card/VtsQuickInfoCard.vue'
import VtsTag from '@core/components/tag/VtsTag.vue'
import UiLink from '@core/components/ui/link/UiLink.vue'
import UiTagsList from '@core/components/ui/tag/UiTagsList.vue'
import { useTimeAgo } from '@core/composables/locale-time-ago.composable.ts'
import { formatSizeRaw } from '@core/utils/size.util.ts'
import { formatDate, parseDateTime } from '@core/utils/time.util.ts'
import { computed } from 'vue'
import { useI18n } from 'vue-i18n'
@@ -83,92 +70,24 @@ const { t } = useI18n()
const { isReady, getVmHost } = useVmStore().subscribe()
const { getByOpaqueRef: getGuestMetricsByOpaqueRef } = useVmGuestMetricsStore().subscribe()
const { getByOpaqueRef: getMetricsByOpaqueRef } = useVmMetricsStore().subscribe()
const { getHostPowerState } = useHostMetricsStore().subscribe()
const { pool } = usePoolStore().subscribe()
const guestMetrics = computed(() => getGuestMetricsByOpaqueRef(vm.guest_metrics))
const metrics = computed(() => getMetricsByOpaqueRef(vm.metrics))
const host = computed(() => getVmHost(vm))
const isPoolMaster = computed(() => pool.value?.master === host.value?.$ref)
const hostIcon = computed(() => getHostIcon(host.value, getHostPowerState(host.value)))
const { powerState } = useVmUtils(() => vm)
function getValidDateTime(dateTime: string | undefined): string | undefined {
return dateTime === '19700101T00:00:00Z' ? undefined : dateTime
}
const startTime = computed(() => {
const dateTime = getValidDateTime(metrics.value?.start_time)
return dateTime ? new Date(parseDateTime(dateTime)) : undefined
})
const vmTimeAgo = useTimeAgo(() => startTime.value ?? 0)
const relativeStartTime = computed(() => {
if (startTime.value === undefined) {
return t('not-running')
}
return vmTimeAgo.value
})
const installDateFormatted = computed(() => {
const installTime = getValidDateTime(metrics.value?.install_time)
if (installTime === undefined) {
return t('unknown')
}
return formatDate(installTime)
})
const { osName, guestTools, relativeStartTime, installDateFormatted } = useVmMetricsInfo(() => vm)
const ram = computed(() => formatSizeRaw(vm.memory_dynamic_max, 0))
const osVersion = computed(() => guestMetrics.value?.os_version.name)
const domainType = computed(() => {
if (
vm.domain_type !== undefined && // XS < 7.5
vm.domain_type !== 'unspecified' // detection failed
) {
return vm.domain_type
}
return vm.HVM_boot_policy === '' ? 'pv' : 'hvm'
})
const domainType = computed(() => getVmDomainType(vm))
const virtualizationType = computed(() =>
domainType.value === 'hvm' && guestMetrics.value?.PV_drivers_detected ? 'pvhvm' : domainType.value
)
const guestTools = computed(() => {
const version = guestMetrics.value?.PV_drivers_version
if (!guestMetrics.value?.PV_drivers_detected || !version) {
return ''
}
if (Object.entries(version).length === 0) {
return ''
}
return `${version.major}.${version.minor}.${version.micro}-${version.build}`
})
const mainIpAddress = computed(() => {
if (!guestMetrics.value?.networks) {
return undefined
}
return [...new Set(Object.values(guestMetrics.value.networks).sort())][0]
})
const mainIpAddress = computed(() => getVmIpAddresses(guestMetrics.value)[0])
</script>
<style lang="postcss" scoped>

View File

@@ -10,8 +10,8 @@
</template>
</VtsTabularKeyValueRow>
<VtsTabularKeyValueRow :label="t('video-ram')">
<template v-if="vm.platform.videoram" #value>
{{ `${vm.platform.videoram} ${t('bytes:mi')}` }}
<template v-if="videoRam" #value>
{{ `${videoRam} ${t('bytes:mi')}` }}
</template>
</VtsTabularKeyValueRow>
</VtsTabularKeyValueList>
@@ -20,14 +20,18 @@
<script setup lang="ts">
import type { XenApiVm } from '@/libs/xen-api/xen-api.types.ts'
import { getVmDomainType } from '@/modules/vm/utils/vm.util.ts'
import VtsStatus from '@core/components/status/VtsStatus.vue'
import VtsTabularKeyValueList from '@core/components/tabular-key-value-list/VtsTabularKeyValueList.vue'
import VtsTabularKeyValueRow from '@core/components/tabular-key-value-row/VtsTabularKeyValueRow.vue'
import UiCard from '@core/components/ui/card/UiCard.vue'
import UiTitle from '@core/components/ui/title/UiTitle.vue'
import { computed } from 'vue'
import { useI18n } from 'vue-i18n'
defineProps<{ vm: XenApiVm }>()
const { vm } = defineProps<{ vm: XenApiVm }>()
const { t } = useI18n()
const videoRam = computed(() => (getVmDomainType(vm) === 'hvm' ? Number(vm.platform.videoram ?? 4) : undefined))
</script>

View File

@@ -35,6 +35,7 @@
<script setup lang="ts">
import type { XenApiVm } from '@/libs/xen-api/xen-api.types.ts'
import { getVmDomainType } from '@/modules/vm/utils/vm.util.ts'
import { useHostStore } from '@/stores/xen-api/host.store.ts'
import { usePoolStore } from '@/stores/xen-api/pool.store.ts'
import { useVtpmStore } from '@/stores/xen-api/vtpm.store.ts'
@@ -55,16 +56,7 @@ const { pool } = usePoolStore().subscribe()
const { getByOpaqueRef: getHostOpaqueRef } = useHostStore().subscribe()
const { getByOpaqueRef: getVtpmOpaqueRef } = useVtpmStore().subscribe()
/**
* @see `packages/xo-server/src/xapi/utils.mjs`:57
**/
const virtualizationMode = computed(() =>
vm.domain_type !== undefined && vm.domain_type !== 'unspecified'
? vm.domain_type
: vm.HVM_boot_policy === ''
? 'pv'
: 'hvm'
)
const virtualizationMode = computed(() => getVmDomainType(vm))
const isNestedVirtualizationEnabled = computed(() => {
const poolMaster = pool.value !== undefined ? getHostOpaqueRef(pool.value.master) : undefined

View File

@@ -0,0 +1,37 @@
<template>
<UiLink
:to="to ?? { name: '/host/[uuid]/dashboard', params: { uuid: host.uuid } }"
:size
:icon
:is-primary="isMaster"
:primary-tooltip="t('master')"
>
<slot>{{ host.name_label }}</slot>
</UiLink>
</template>
<script lang="ts" setup>
import type { XenApiHost } from '@/libs/xen-api/xen-api.types.ts'
import { getHostIcon } from '@/modules/host/utils/host.util.ts'
import { useHostMetricsStore } from '@/stores/xen-api/host-metrics.store.ts'
import { usePoolStore } from '@/stores/xen-api/pool.store.ts'
import type { LinkOptions } from '@core/composables/link-component.composable.ts'
import UiLink from '@core/components/ui/link/UiLink.vue'
import { computed } from 'vue'
import { useI18n } from 'vue-i18n'
const { host, to } = defineProps<{
host: XenApiHost
size: 'small' | 'medium'
to?: LinkOptions['to']
}>()
const { t } = useI18n()
const { isMasterHost } = usePoolStore().subscribe()
const { getHostPowerState } = useHostMetricsStore().subscribe()
const icon = computed(() => getHostIcon(host, getHostPowerState(host)))
const isMaster = computed(() => isMasterHost(host.$ref))
</script>

View File

@@ -66,15 +66,7 @@
{{ t('this-host') }}
</div>
<div v-else-if="masterHost !== undefined" class="value">
<UiLink
:to="{ name: '/host/[uuid]/dashboard', params: { uuid: masterHost.uuid } }"
size="small"
:icon="masterHostIcon"
is-primary
:primary-tooltip="t('master')"
>
{{ masterHost.name_label }}
</UiLink>
<HostLink :host="masterHost" size="small" />
</div>
</template>
<template v-if="masterHost !== undefined" #addons>
@@ -105,6 +97,7 @@
<script lang="ts" setup>
import { useHostPatches } from '@/composables/host-patches.composable.ts'
import type { XenApiHost } from '@/libs/xen-api/xen-api.types.ts'
import HostLink from '@/modules/host/components/HostLink.vue'
import { useHostUtils } from '@/modules/host/composables/host-utils.composable.ts'
import { getHostIcon } from '@/modules/host/utils/host.util.ts'
import { useHostMetricsStore } from '@/stores/xen-api/host-metrics.store.ts'
@@ -137,8 +130,6 @@ const { isMaster, powerState, relativeStartTime } = useHostUtils(() => host)
const hostIcon = computed(() => getHostIcon(host, getHostPowerState(host)))
const masterHostIcon = computed(() => getHostIcon(masterHost.value, getHostPowerState(masterHost.value)))
const { count: nMissingPatches, areAllLoaded } = useHostPatches(() => [host])
const noMissingPatches = computed(() => nMissingPatches.value === 0)

View File

@@ -1,6 +1,6 @@
<template>
<VtsInputWrapper :label :message="error">
<VtsSelect :id accent="brand" />
<VtsSelect :id accent="neutral" />
</VtsInputWrapper>
</template>

View File

@@ -1,6 +1,6 @@
<template>
<VtsInputWrapper :label :message="error">
<UiInput v-model.trim="model" accent="brand" :required :disabled />
<UiInput v-model.trim="model" accent="neutral" :required :disabled />
</VtsInputWrapper>
</template>

View File

@@ -1,5 +1,5 @@
<template>
<UiTextarea v-model.trim="model" accent="brand">
<UiTextarea v-model.trim="model" accent="neutral">
{{ t('description') }}
</UiTextarea>
</template>

View File

@@ -3,13 +3,7 @@
<UiPanelCardTitle size="medium" :label="t('hosts')" :counter="hosts.length" />
<UiCollapsibleList v-if="hosts.length > 0" tag="ul" :total-items="hosts.length">
<li v-for="host in hosts" :key="host.uuid" v-tooltip class="text-ellipsis">
<UiLink
size="small"
:icon="getHostIcon(host, getHostPowerState(host))"
:to="{ name: '/host/[uuid]/dashboard', params: { uuid: host.uuid } }"
>
{{ host.name_label }}
</UiLink>
<HostLink :host size="small" />
</li>
</UiCollapsibleList>
<VtsStateHero v-else type="no-data" format="card" horizontal size="extra-small">
@@ -20,11 +14,9 @@
<script lang="ts" setup>
import type { XenApiHost } from '@/libs/xen-api/xen-api.types.ts'
import { getHostIcon } from '@/modules/host/utils/host.util.ts'
import { useHostMetricsStore } from '@/stores/xen-api/host-metrics.store.ts'
import HostLink from '@/modules/host/components/HostLink.vue'
import VtsStateHero from '@core/components/state-hero/VtsStateHero.vue'
import UiCollapsibleList from '@core/components/ui/collapsible-list/UiCollapsibleList.vue'
import UiLink from '@core/components/ui/link/UiLink.vue'
import UiPanelCard from '@core/components/ui/panel-card/UiPanelCard.vue'
import UiPanelCardTitle from '@core/components/ui/panel-card-title/UiPanelCardTitle.vue'
import { vTooltip } from '@core/directives/tooltip.directive.ts'
@@ -35,6 +27,4 @@ defineProps<{
}>()
const { t } = useI18n()
const { getHostPowerState } = useHostMetricsStore().subscribe()
</script>

View File

@@ -8,7 +8,7 @@
<template #addons>
<UiLoader v-if="isChangingState" v-tooltip="{ placement: 'top', content: currentOperation }" />
<VtsActionsMenu placement="bottom-start">
<VmTreeActions :vm-opaque-ref="leaf.data.$ref" />
<VmActions :vm="leaf.data" />
</VtsActionsMenu>
</template>
</UiTreeItemLabel>
@@ -17,7 +17,7 @@
<script lang="ts" setup>
import type { VmLeaf } from '@/modules/treeview/types/tree.type.ts'
import VmTreeActions from '@/modules/vm/components/actions/VmTreeActions.vue'
import VmActions from '@/modules/vm/components/actions/VmActions.vue'
import { useVmOperation } from '@/modules/vm/composables/vm-operation.composable.ts'
import { useVmUtils } from '@/modules/vm/composables/vm-utils.composable.ts'
import VtsActionsMenu from '@core/components/menu/VtsActionsMenu.vue'

View File

@@ -24,6 +24,7 @@
<script lang="ts" setup>
import type { XenApiVbd, XenApiVdi } from '@/libs/xen-api/xen-api.types.ts'
import { getVdiFormat, getVdiIcon } from '@/modules/vdi/utils/vdi.util.ts'
import { useVdiStore } from '@/stores/xen-api/vdi.store.ts'
import VtsRow from '@core/components/table/VtsRow.vue'
import VtsTable from '@core/components/table/VtsTable.vue'
import UiQuerySearchBar from '@core/components/ui/query-search-bar/UiQuerySearchBar.vue'
@@ -43,6 +44,7 @@ const { vdis, vbds, busy, error } = defineProps<{
error?: boolean
}>()
const { t } = useI18n()
const { getChainPhysicalUsage } = useVdiStore().subscribe()
const selectedVdiId = useRouteQuery('id')
const { items: filteredVdis, searchBindings } = useSearchFilter(() => vdis)
const state = useTableState({
@@ -56,6 +58,7 @@ const { HeadCells, BodyCells } = useVdiColumns({
exclude: ['actions'],
body: (vdi: XenApiVdi) => {
const vdiVbds = computed(() => vbds.filter(vbd => vbd.VDI === vdi.$ref))
const usedSpace = computed(() => formatSizeRaw(getChainPhysicalUsage(vdi), 2))
const size = computed(() => formatSizeRaw(vdi.virtual_size, 2))
const format = computed(() => getVdiFormat(vdi.sm_config['image-format']))
return {
@@ -65,7 +68,7 @@ const { HeadCells, BodyCells } = useVdiColumns({
icon: getVdiIcon(vdiVbds.value),
}),
description: r => r(vdi.name_description),
usedSpace: r => r(vdi.physical_utilisation, vdi.virtual_size),
usedSpace: r => r(usedSpace.value.value, usedSpace.value.prefix),
size: r => r(size.value.value, size.value.prefix),
format: r => r(format.value),
selectItem: r => r(() => (selectedVdiId.value = vdi.uuid)),

View File

@@ -1,12 +1,48 @@
<template>
<VtsSpaceCard :used="vdi.physical_utilisation" :total="vdi.virtual_size" :label="vdi.name_label" />
<UiPanelCard>
<UiPanelCardTitle size="medium" :label="t('space')" />
<VtsCardRowList>
<VtsCardRowKeyValue>
<template #key>{{ t('used-space') }}</template>
<template #value>{{ usedSpace }}</template>
<template v-if="chainPhysicalUsage > 0" #addons>
<VtsCopyButton :value="usedSpace" />
</template>
</VtsCardRowKeyValue>
<VtsCardRowKeyValue>
<template #key>{{ t('size') }}</template>
<template #value>{{ size }}</template>
<template v-if="vdi.virtual_size > 0" #addons>
<VtsCopyButton :value="size" />
</template>
</VtsCardRowKeyValue>
</VtsCardRowList>
</UiPanelCard>
</template>
<script setup lang="ts">
import type { XenApiVdi } from '@/libs/xen-api/xen-api.types.ts'
import VtsSpaceCard from '@core/components/space-card/VtsSpaceCard.vue'
import { useVdiStore } from '@/stores/xen-api/vdi.store.ts'
import VtsCardRowKeyValue from '@core/components/card/VtsCardRowKeyValue.vue'
import VtsCardRowList from '@core/components/card/VtsCardRowList.vue'
import VtsCopyButton from '@core/components/copy-button/VtsCopyButton.vue'
import UiPanelCard from '@core/components/ui/panel-card/UiPanelCard.vue'
import UiPanelCardTitle from '@core/components/ui/panel-card-title/UiPanelCardTitle.vue'
import { formatSize } from '@core/utils/size.util.ts'
import { computed } from 'vue'
import { useI18n } from 'vue-i18n'
defineProps<{
const { vdi } = defineProps<{
vdi: XenApiVdi
}>()
const { t } = useI18n()
const { getChainPhysicalUsage } = useVdiStore().subscribe()
const chainPhysicalUsage = computed(() => getChainPhysicalUsage(vdi))
const usedSpace = computed(() => formatSize(chainPhysicalUsage.value, 2))
const size = computed(() => formatSize(vdi.virtual_size, 2))
</script>

View File

@@ -1,5 +1,5 @@
<template>
<UiTextarea v-model.trim="model" :accent="errorMessage !== undefined ? 'danger' : 'brand'">
<UiTextarea v-model.trim="model" :accent="errorMessage !== undefined ? 'danger' : 'neutral'">
{{ t('allowed-ips') }}
<template #info>{{ t('allowed-ips-example') }}</template>

View File

@@ -1,6 +1,11 @@
<template>
<VtsInputWrapper :label="t('mac-address')" :message="messages" wrap-message>
<UiInput v-model.trim="model" accent="brand" :required :placeholder="required ? undefined : t('auto-generated')" />
<UiInput
v-model.trim="model"
accent="neutral"
:required
:placeholder="required ? undefined : t('auto-generated')"
/>
</VtsInputWrapper>
</template>

View File

@@ -1,6 +1,6 @@
<template>
<VtsInputWrapper :label="t('network')" :message="error">
<VtsSelect :id accent="brand">
<VtsSelect :id accent="neutral">
<template v-if="slots.option" #default="slotProps">
<slot name="option" v-bind="slotProps" />
</template>

View File

@@ -1,6 +1,6 @@
<template>
<VtsInputWrapper :label="t('rate-limit')" :message="error">
<UiInput v-model.number="model" accent="brand" type="number">
<UiInput v-model.number="model" accent="neutral" type="number">
<template #right-icon>
<span class="unit typo-body-regular">{{ t('bytes:kbs') }}</span>
</template>

View File

@@ -0,0 +1,12 @@
<template>
<VmMoreActions :vm layout="change-state-submenu" />
</template>
<script lang="ts" setup>
import type { XenApiVm } from '@/libs/xen-api/xen-api.types.ts'
import VmMoreActions from '@/modules/vm/components/actions/VmMoreActions.vue'
defineProps<{
vm: XenApiVm
}>()
</script>

View File

@@ -9,31 +9,22 @@
<VmActionMigrateItem v-if="isInline.migrate" :selected-refs="vmRefs" is-single-action />
<VmActionSnapshotItem v-if="isInline.snapshot" :vm-refs />
<VtsActionsMenu :label="t('more-actions')" size="medium" no-section-title>
<VtsMenuTitle>{{ t('action:change-state') }}</VtsMenuTitle>
<VmActionPowerStateItems :vm-refs :exclude="isInline" />
<VtsMenuTitle>{{ t('actions') }}</VtsMenuTitle>
<VmActionMigrateItem v-if="!isInline.migrate" :selected-refs="vmRefs" is-single-action />
<VmActionSnapshotItem v-if="!isInline.snapshot" :vm-refs />
<VmActionCopyItem :selected-refs="vmRefs" is-single-action />
<VmActionExportItem :vm-refs is-single-action />
<VmMoreActions :vm layout="sections" :exclude="isInline" />
</VtsActionsMenu>
</VtsHeadBarActions>
</template>
<script lang="ts" setup>
import VmActionCopyItem from '@/components/vm/VmActionItems/VmActionCopyItem.vue'
import VmActionExportItem from '@/components/vm/VmActionItems/VmActionExportItem.vue'
import VmActionMigrateItem from '@/components/vm/VmActionItems/VmActionMigrateItem.vue'
import VmActionPowerStateItems from '@/components/vm/VmActionItems/VmActionPowerStateItems.vue'
import VmActionSnapshotItem from '@/components/vm/VmActionItems/VmActionSnapshotItem.vue'
import type { XenApiVm } from '@/libs/xen-api/xen-api.types.ts'
import VmMoreActions from '@/modules/vm/components/actions/VmMoreActions.vue'
import VmPowerStateActionButton from '@/modules/vm/components/actions/VmPowerStateActionButton.vue'
import { useVmPowerStateActions } from '@/modules/vm/composables/vm-power-state-actions.composable.ts'
import { areVmToolsDetected, getVmQuickActions } from '@/modules/vm/utils/vm.util.ts'
import { useVmGuestMetricsStore } from '@/stores/xen-api/vm-guest-metrics.store.ts'
import VtsHeadBarActions from '@core/components/head-bar/VtsHeadBarActions.vue'
import VtsActionsMenu from '@core/components/menu/VtsActionsMenu.vue'
import VtsMenuTitle from '@core/components/menu/VtsMenuTitle.vue'
import { computed } from 'vue'
import { useI18n } from 'vue-i18n'

View File

@@ -0,0 +1,37 @@
<template>
<VtsChangeStateMenu v-if="!isCompact" placement="bottom-start">
<VmActionPowerStateItems :vm-refs />
</VtsChangeStateMenu>
<VtsActionsMenu :label="t('more-actions')" size="medium">
<VmMoreActions :vm :layout="isCompact ? 'change-state-submenu' : 'actions-only'" />
</VtsActionsMenu>
</template>
<script lang="ts" setup>
import VmActionPowerStateItems from '@/components/vm/VmActionItems/VmActionPowerStateItems.vue'
import type { XenApiVm } from '@/libs/xen-api/xen-api.types.ts'
import VmMoreActions from '@/modules/vm/components/actions/VmMoreActions.vue'
import VtsActionsMenu from '@core/components/menu/VtsActionsMenu.vue'
import VtsChangeStateMenu from '@core/components/menu/VtsChangeStateMenu.vue'
import { useUiStore } from '@core/stores/ui.store.ts'
import { IK_PANEL_ACTIONS_COMPACT } from '@core/utils/injection-keys.util.ts'
import { computed, inject } from 'vue'
import { useI18n } from 'vue-i18n'
const { vm } = defineProps<{
vm: XenApiVm
}>()
const { t } = useI18n()
const uiStore = useUiStore()
const arePanelActionsCompact = inject(
IK_PANEL_ACTIONS_COMPACT,
computed(() => false)
)
const isCompact = computed(() => uiStore.isSmall || arePanelActionsCompact.value)
const vmRefs = computed(() => [vm.$ref])
</script>

View File

@@ -0,0 +1,46 @@
<template>
<template v-if="layout === 'sections'">
<VtsMenuTitle>{{ t('action:change-state') }}</VtsMenuTitle>
<VmActionPowerStateItems :vm-refs :exclude />
<VtsMenuTitle>{{ t('actions') }}</VtsMenuTitle>
</template>
<VtsChangeStateMenuItem v-else-if="layout === 'change-state-submenu'">
<VmActionPowerStateItems :vm-refs />
</VtsChangeStateMenuItem>
<VmActionMigrateItem v-if="!exclude.migrate" :selected-refs="vmRefs" is-single-action />
<VmActionSnapshotItem v-if="!exclude.snapshot" :vm-refs />
<VmActionCopyItem :selected-refs="vmRefs" is-single-action />
<VmActionExportItem :vm-refs is-single-action />
<MenuSeparator v-if="layout !== 'sections'" />
<VmActionDeleteItem :vm-refs />
</template>
<script lang="ts" setup>
import VmActionCopyItem from '@/components/vm/VmActionItems/VmActionCopyItem.vue'
import VmActionDeleteItem from '@/components/vm/VmActionItems/VmActionDeleteItem.vue'
import VmActionExportItem from '@/components/vm/VmActionItems/VmActionExportItem.vue'
import VmActionMigrateItem from '@/components/vm/VmActionItems/VmActionMigrateItem.vue'
import VmActionPowerStateItems from '@/components/vm/VmActionItems/VmActionPowerStateItems.vue'
import VmActionSnapshotItem from '@/components/vm/VmActionItems/VmActionSnapshotItem.vue'
import type { XenApiVm } from '@/libs/xen-api/xen-api.types.ts'
import type { VmQuickAction } from '@/modules/vm/utils/vm.util.ts'
import MenuSeparator from '@core/components/menu/MenuSeparator.vue'
import VtsChangeStateMenuItem from '@core/components/menu/VtsChangeStateMenuItem.vue'
import VtsMenuTitle from '@core/components/menu/VtsMenuTitle.vue'
import { computed } from 'vue'
import { useI18n } from 'vue-i18n'
const {
vm,
layout = 'actions-only',
exclude = {},
} = defineProps<{
vm: XenApiVm
layout?: 'actions-only' | 'change-state-submenu' | 'sections'
exclude?: Partial<Record<VmQuickAction, boolean>>
}>()
const { t } = useI18n()
const vmRefs = computed(() => [vm.$ref])
</script>

View File

@@ -1,28 +0,0 @@
<template>
<VtsChangeStateMenuItem>
<VmActionPowerStateItems :vm-refs />
</VtsChangeStateMenuItem>
<VmActionSnapshotItem :vm-refs />
<VmActionCopyItem :selected-refs="vmRefs" is-single-action />
<VmActionExportItem :vm-refs is-single-action />
<MenuSeparator />
<VmActionDeleteItem :vm-refs />
</template>
<script setup lang="ts">
import VmActionCopyItem from '@/components/vm/VmActionItems/VmActionCopyItem.vue'
import VmActionDeleteItem from '@/components/vm/VmActionItems/VmActionDeleteItem.vue'
import VmActionExportItem from '@/components/vm/VmActionItems/VmActionExportItem.vue'
import VmActionPowerStateItems from '@/components/vm/VmActionItems/VmActionPowerStateItems.vue'
import VmActionSnapshotItem from '@/components/vm/VmActionItems/VmActionSnapshotItem.vue'
import type { XenApiVm } from '@/libs/xen-api/xen-api.types.ts'
import MenuSeparator from '@core/components/menu/MenuSeparator.vue'
import VtsChangeStateMenuItem from '@core/components/menu/VtsChangeStateMenuItem.vue'
import { computed } from 'vue'
const { vmOpaqueRef } = defineProps<{
vmOpaqueRef: XenApiVm['$ref']
}>()
const vmRefs = computed(() => [vmOpaqueRef])
</script>

View File

@@ -26,8 +26,8 @@
</template>
<script lang="ts" setup>
import VmsBulkActionItems from '@/components/vm/VmsBulkActionItems.vue'
import type { XenApiVm } from '@/libs/xen-api/xen-api.types.ts'
import VmsBulkActionItems from '@/modules/vm/components/list/VmsBulkActionItems.vue'
import MenuList from '@core/components/menu/MenuList.vue'
import VtsMobileMenu from '@core/components/menu/VtsMobileMenu.vue'
import UiButtonIcon from '@core/components/ui/button-icon/UiButtonIcon.vue'

View File

@@ -1,10 +1,7 @@
<template>
<MenuItem accent="brand" icon="fa:power-off">
{{ t('action:change-state') }}
<template #submenu>
<VmActionPowerStateItems :vm-refs="selectedRefs" />
</template>
</MenuItem>
<VtsChangeStateMenuItem>
<VmActionPowerStateItems :vm-refs="selectedRefs" />
</VtsChangeStateMenuItem>
<VmActionMigrateItem :selected-refs />
<VmActionCopyItem :selected-refs />
<VmActionSnapshotItem :vm-refs="selectedRefs" />
@@ -20,12 +17,9 @@ import VmActionMigrateItem from '@/components/vm/VmActionItems/VmActionMigrateIt
import VmActionPowerStateItems from '@/components/vm/VmActionItems/VmActionPowerStateItems.vue'
import VmActionSnapshotItem from '@/components/vm/VmActionItems/VmActionSnapshotItem.vue'
import type { XenApiVm } from '@/libs/xen-api/xen-api.types.ts'
import MenuItem from '@core/components/menu/MenuItem.vue'
import { useI18n } from 'vue-i18n'
import VtsChangeStateMenuItem from '@core/components/menu/VtsChangeStateMenuItem.vue'
defineProps<{
selectedRefs: XenApiVm['$ref'][]
}>()
const { t } = useI18n()
</script>

View File

@@ -1,8 +1,8 @@
<template>
<UiCard class="vms-page-content">
<div class="vms-table">
<UiTitle>
{{ t('vms') }}
<template v-if="uiStore.isSmall" #right>
<template v-if="uiStore.isSmall" #action>
<VmsActionsBar :selected-refs="selectedVmsRefs" />
</template>
</UiTitle>
@@ -25,7 +25,7 @@
/>
</div>
<VtsTable :state :pagination-bindings>
<VtsTable :state :pagination-bindings sticky="right">
<thead>
<tr>
<VtsHeaderCell>
@@ -35,7 +35,7 @@
</tr>
</thead>
<tbody>
<VtsRow v-for="vm in paginatedVms" :key="vm.$ref">
<VtsRow v-for="vm in paginatedVms" :key="vm.$ref" :selected="selectedVmId === vm.uuid">
<UiTableCell>
<UiCheckbox v-model="selectedVmsRefs" :value="vm.$ref" accent="brand" />
</UiTableCell>
@@ -44,33 +44,32 @@
</tbody>
</VtsTable>
</div>
</UiCard>
</div>
</template>
<script lang="ts" setup>
import CollectionFilter from '@/components/CollectionFilter.vue'
import CollectionSorter from '@/components/CollectionSorter.vue'
import VmsActionsBar from '@/components/vm/VmsActionsBar.vue'
import useCollectionFilter from '@/composables/collection-filter.composable.ts'
import useCollectionSorter from '@/composables/collection-sorter.composable.ts'
import type { XenApiVm } from '@/libs/xen-api/xen-api.types.ts'
import VmActions from '@/modules/vm/components/actions/VmActions.vue'
import VmsActionsBar from '@/modules/vm/components/list/VmsActionsBar.vue'
import { useVmResources } from '@/modules/vm/composables/vm-resources.composable.ts'
import { getVmIcon, getVmIpAddresses } from '@/modules/vm/utils/vm.util.ts'
import { usePageTitleStore } from '@/stores/page-title.store.ts'
import { useVbdStore } from '@/stores/xen-api/vbd.store.ts'
import { useVdiStore } from '@/stores/xen-api/vdi.store.ts'
import { useVmGuestMetricsStore } from '@/stores/xen-api/vm-guest-metrics.store.ts'
import { useVmMetricsStore } from '@/stores/xen-api/vm-metrics.store.ts'
import type { Filters } from '@/types/filter.ts'
import VtsHeaderCell from '@core/components/table/cells/VtsHeaderCell.vue'
import VtsRow from '@core/components/table/VtsRow.vue'
import VtsTable from '@core/components/table/VtsTable.vue'
import UiCard from '@core/components/ui/card/UiCard.vue'
import UiCheckbox from '@core/components/ui/checkbox/UiCheckbox.vue'
import UiTableCell from '@core/components/ui/table-cell/UiTableCell.vue'
import UiTitle from '@core/components/ui/title/UiTitle.vue'
import { usePagination } from '@core/composables/pagination.composable.ts'
import { useRouteQuery } from '@core/composables/route-query.composable.ts'
import useMultiSelect from '@core/composables/table/multi-select.composable.ts'
import { useTableState } from '@core/composables/table-state.composable.ts'
import { objectIcon } from '@core/icons'
import { useUiStore } from '@core/stores/ui.store.ts'
import { useVmColumns } from '@core/tables/column-sets/vm-columns.ts'
import { renderBodyCell } from '@core/tables/helpers/render-body-cell.ts'
@@ -79,7 +78,6 @@ import { formatSizeRaw } from '@core/utils/size.util.ts'
import { VM_POWER_STATE } from '@vates/types'
import { useSorted } from '@vueuse/core'
import { useArrayFilter } from '@vueuse/shared'
import { toLower } from 'lodash-es'
import { computed } from 'vue'
import { useI18n } from 'vue-i18n'
@@ -90,15 +88,12 @@ const { vms, busy, error } = defineProps<{
}>()
const { getByOpaqueRef: getGuestMetrics, isReady: areGuestMetricsReady } = useVmGuestMetricsStore().subscribe()
const { getByOpaqueRef: getVmMetrics } = useVmMetricsStore().subscribe()
const { getByOpaqueRefs: getVbds } = useVbdStore().subscribe()
const { getByOpaqueRefs: getVdis } = useVdiStore().subscribe()
const { t } = useI18n()
const uiStore = useUiStore()
const titleStore = usePageTitleStore()
titleStore.setTitle(t('vms'))
const selectedVmId = useRouteQuery('id')
const availableFilters: Filters = {
name_label: { label: t('name'), type: 'string' },
@@ -143,40 +138,41 @@ const state = useTableState({
})
const { HeadCells, BodyCells } = useVmColumns({
exclude: ['actions', 'checkbox'],
exclude: ['checkbox', 'lastBackupDate'],
body: (vm: XenApiVm) => {
const guestMetrics = computed(() => getGuestMetrics(vm.guest_metrics))
const vmMetrics = computed(() => getVmMetrics(vm.metrics))
const ips = computed(() => [...new Set(Object.values(guestMetrics.value?.networks ?? {}).sort())])
const ips = computed(() => getVmIpAddresses(getGuestMetrics(vm.guest_metrics)))
const ram = computed(() => formatSizeRaw(vm.memory_dynamic_max, 0))
const vcpus = computed(() => vmMetrics.value?.VCPUs_number ?? vm.VCPUs_at_startup)
const vbds = computed(() => getVbds(vm.VBDs).filter(vbd => vbd.type === 'Disk'))
const vdis = computed(() => getVdis(vbds.value.map(vbd => vbd.VDI)))
const diskSpace = computed(() =>
formatSizeRaw(
vdis.value.reduce((total, vdi) => total + (vdi.virtual_size ?? 0), 0),
1
)
)
const { vcpus, diskSize } = useVmResources(() => vm)
const diskSpace = computed(() => formatSizeRaw(diskSize.value, 1))
return {
vm: r =>
r({ label: vm.name_label, to: `/vm/${vm.uuid}/dashboard`, icon: objectIcon('vm', toLower(vm.power_state)) }),
r({
label: vm.name_label,
to: { name: '/vm/[uuid]/dashboard', params: { uuid: vm.uuid } },
icon: getVmIcon(vm),
}),
ipAddresses: r => (areGuestMetricsReady.value ? r(ips.value) : renderLoadingCell()),
vcpus: r => (vcpus.value ? r(vcpus.value) : renderBodyCell()),
ram: r => (ram.value.value ? r(ram.value.value, ram.value.prefix) : renderBodyCell()),
diskSpace: r => r(diskSpace.value.value, diskSpace.value.prefix),
tags: r => r(vm.tags),
actions: r =>
r({
onClick: () => (selectedVmId.value = vm.uuid),
component: VmActions,
props: { vm },
}),
}
},
})
</script>
<style lang="postcss" scoped>
.vms-page-content {
overflow: auto;
margin: 1rem;
.vms-table {
display: flex;
flex-direction: column;
gap: 2.4rem;
.filter-and-sort {
display: flex;

View File

@@ -0,0 +1,45 @@
<template>
<VtsSidePanel :has-selection="!!vm" @close="emit('close')">
<template v-if="vm" #actions>
<VmMainActions :vm />
</template>
<template v-if="vm" #default>
<VtsStateHero v-if="!isReady" format="panel" type="busy" size="medium" />
<template v-else>
<VmInfoCard :vm />
<VmNetworkCard :vm />
<VmResourcesCard :vm />
</template>
</template>
</VtsSidePanel>
</template>
<script lang="ts" setup>
import type { XenApiVm } from '@/libs/xen-api/xen-api.types.ts'
import VmMainActions from '@/modules/vm/components/actions/VmMainActions.vue'
import VmInfoCard from '@/modules/vm/components/list/panel/cards/VmInfoCard.vue'
import VmNetworkCard from '@/modules/vm/components/list/panel/cards/VmNetworkCard.vue'
import VmResourcesCard from '@/modules/vm/components/list/panel/cards/VmResourcesCard.vue'
import { useVbdStore } from '@/stores/xen-api/vbd.store.ts'
import { useVdiStore } from '@/stores/xen-api/vdi.store.ts'
import { useVmGuestMetricsStore } from '@/stores/xen-api/vm-guest-metrics.store.ts'
import { useVmMetricsStore } from '@/stores/xen-api/vm-metrics.store.ts'
import VtsSidePanel from '@core/components/panel/VtsSidePanel.vue'
import VtsStateHero from '@core/components/state-hero/VtsStateHero.vue'
import { logicAnd } from '@vueuse/math'
defineProps<{
vm?: XenApiVm
}>()
const emit = defineEmits<{
close: []
}>()
const { isReady: areVmMetricsReady } = useVmMetricsStore().subscribe()
const { isReady: areGuestMetricsReady } = useVmGuestMetricsStore().subscribe()
const { isReady: areVbdsReady } = useVbdStore().subscribe()
const { isReady: areVdisReady } = useVdiStore().subscribe()
const isReady = logicAnd(areVmMetricsReady, areGuestMetricsReady, areVbdsReady, areVdisReady)
</script>

View File

@@ -0,0 +1,162 @@
<template>
<UiPanelCard class="vm-info-card">
<UiPanelCardTitle
:id="vm.uuid"
size="medium"
:label="vm.name_label"
:icon="vmIcon"
:to="{ name: '/vm/[uuid]/dashboard', params: { uuid: vm.uuid } }"
/>
<VtsCardRowList class="content">
<VtsCardRowKeyValue>
<template #key>{{ t('state') }}</template>
<template #value>
<span class="value">
<VtsIcon :name="powerState.icon" size="medium" />
{{ powerState.text }}
</span>
</template>
</VtsCardRowKeyValue>
<VtsCardRowKeyValue truncate align-top>
<template #key>{{ t('description') }}</template>
<template #value>{{ vm.name_description }}</template>
<template v-if="vm.name_description" #addons>
<VtsCopyButton :value="vm.name_description" />
</template>
</VtsCardRowKeyValue>
<VtsCardRowKeyValue align-top>
<template #key>{{ t('tags') }}</template>
<template #value>
<UiTagsList v-if="vm.tags.length > 0">
<VtsTag v-for="tag in vm.tags" :key="tag" :value="tag" />
</UiTagsList>
</template>
<template v-if="vm.tags.length > 0" #addons>
<VtsCopyButton :value="vm.tags.join(', ')" />
</template>
</VtsCardRowKeyValue>
<VtsCardRowKeyValue>
<template #key>{{ t('pool') }}</template>
<template #value>
<div v-if="pool !== undefined" class="value">
<UiLink
:to="{ name: '/pool/[uuid]/dashboard', params: { uuid: pool.uuid } }"
size="small"
icon="object:pool"
>
{{ pool.name_label }}
</UiLink>
</div>
</template>
<template v-if="pool !== undefined" #addons>
<VtsCopyButton :value="pool.uuid" />
</template>
</VtsCardRowKeyValue>
<VtsCardRowKeyValue>
<template #key>{{ t('host') }}</template>
<template #value>
<div v-if="host !== undefined" class="value">
<HostLink :host size="small" />
</div>
</template>
<template v-if="host !== undefined" #addons>
<VtsCopyButton :value="host.uuid" />
</template>
</VtsCardRowKeyValue>
<VtsCardRowKeyValue>
<template #key>{{ t('os-name') }}</template>
<template #value>{{ osName }}</template>
<template v-if="osName" #addons>
<VtsCopyButton :value="osName" />
</template>
</VtsCardRowKeyValue>
<VtsCardRowKeyValue>
<template #key>{{ t('guest-tools') }}</template>
<template #value>{{ guestTools }}</template>
<template v-if="guestTools" #addons>
<VtsCopyButton :value="guestTools" />
</template>
</VtsCardRowKeyValue>
<VtsCardRowKeyValue>
<template #key>{{ t('template') }}</template>
<template #value>
<div v-if="templateName" class="value">
<VtsIcon name="fa:template" size="medium" />
{{ templateName }}
</div>
</template>
<template v-if="templateName" #addons>
<VtsCopyButton :value="templateName" />
</template>
</VtsCardRowKeyValue>
<VtsCardRowKeyValue>
<template #key>{{ t('created-on') }}</template>
<template #value>{{ installDateFormatted }}</template>
<template v-if="installTime !== undefined" #addons>
<VtsCopyButton :value="installDateFormatted" />
</template>
</VtsCardRowKeyValue>
<VtsCardRowKeyValue>
<template #key>{{ t('started') }}</template>
<template #value>{{ relativeStartTime }}</template>
<template v-if="startTime !== undefined" #addons>
<VtsCopyButton :value="relativeStartTime" />
</template>
</VtsCardRowKeyValue>
</VtsCardRowList>
</UiPanelCard>
</template>
<script lang="ts" setup>
import type { XenApiVm } from '@/libs/xen-api/xen-api.types.ts'
import HostLink from '@/modules/host/components/HostLink.vue'
import { useVmMetricsInfo } from '@/modules/vm/composables/vm-metrics-info.composable.ts'
import { useVmUtils } from '@/modules/vm/composables/vm-utils.composable.ts'
import { getVmIcon } from '@/modules/vm/utils/vm.util.ts'
import { usePoolStore } from '@/stores/xen-api/pool.store.ts'
import { useVmStore } from '@/stores/xen-api/vm.store.ts'
import VtsCardRowKeyValue from '@core/components/card/VtsCardRowKeyValue.vue'
import VtsCardRowList from '@core/components/card/VtsCardRowList.vue'
import VtsCopyButton from '@core/components/copy-button/VtsCopyButton.vue'
import VtsIcon from '@core/components/icon/VtsIcon.vue'
import VtsTag from '@core/components/tag/VtsTag.vue'
import UiLink from '@core/components/ui/link/UiLink.vue'
import UiPanelCard from '@core/components/ui/panel-card/UiPanelCard.vue'
import UiPanelCardTitle from '@core/components/ui/panel-card-title/UiPanelCardTitle.vue'
import UiTagsList from '@core/components/ui/tag/UiTagsList.vue'
import { computed } from 'vue'
import { useI18n } from 'vue-i18n'
const { vm } = defineProps<{
vm: XenApiVm
}>()
const { t } = useI18n()
const { getVmHost } = useVmStore().subscribe()
const { pool } = usePoolStore().subscribe()
const { powerState } = useVmUtils(() => vm)
const vmIcon = computed(() => getVmIcon(vm))
const host = computed(() => getVmHost(vm))
const { osName, guestTools, startTime, relativeStartTime, installTime, installDateFormatted } = useVmMetricsInfo(
() => vm
)
const templateName = computed(() => vm.other_config.base_template_name)
</script>
<style lang="postcss" scoped>
.vm-info-card {
.content {
.value {
display: flex;
align-items: center;
gap: 0.8rem;
}
}
}
</style>

View File

@@ -0,0 +1,39 @@
<template>
<UiPanelCard>
<UiPanelCardTitle size="medium" :label="t('networks')">
<template v-if="ipAddresses.length > 0" #action>
<UiLink size="small" :to="{ name: '/vm/[uuid]/network', params: { uuid: vm.uuid } }">
{{ t('see-details') }}
</UiLink>
</template>
</UiPanelCardTitle>
<VtsCardRowList>
<VtsCardRowKeyValue :values="ipAddresses">
<template #key>{{ t('ip-addresses') }}</template>
</VtsCardRowKeyValue>
</VtsCardRowList>
</UiPanelCard>
</template>
<script lang="ts" setup>
import type { XenApiVm } from '@/libs/xen-api/xen-api.types.ts'
import { getVmIpAddresses } from '@/modules/vm/utils/vm.util.ts'
import { useVmGuestMetricsStore } from '@/stores/xen-api/vm-guest-metrics.store.ts'
import VtsCardRowKeyValue from '@core/components/card/VtsCardRowKeyValue.vue'
import VtsCardRowList from '@core/components/card/VtsCardRowList.vue'
import UiLink from '@core/components/ui/link/UiLink.vue'
import UiPanelCard from '@core/components/ui/panel-card/UiPanelCard.vue'
import UiPanelCardTitle from '@core/components/ui/panel-card-title/UiPanelCardTitle.vue'
import { computed } from 'vue'
import { useI18n } from 'vue-i18n'
const { vm } = defineProps<{
vm: XenApiVm
}>()
const { t } = useI18n()
const { getByOpaqueRef: getGuestMetrics } = useVmGuestMetricsStore().subscribe()
const ipAddresses = computed(() => getVmIpAddresses(getGuestMetrics(vm.guest_metrics)))
</script>

View File

@@ -0,0 +1,67 @@
<template>
<UiPanelCard>
<UiPanelCardTitle size="medium" :label="t('resources')" />
<VtsCardRowList>
<VtsCardRowKeyValue>
<template #key>{{ t('vcpus') }}</template>
<template #value>{{ vcpus }}</template>
<template #addons>
<VtsCopyButton :value="String(vcpus)" />
</template>
</VtsCardRowKeyValue>
<VtsCardRowKeyValue>
<template #key>{{ t('ram') }}</template>
<template #value>{{ formattedRam }}</template>
<template #addons>
<VtsCopyButton :value="formattedRam" />
</template>
</VtsCardRowKeyValue>
<VtsCardRowKeyValue>
<template #key>{{ t('disk-space') }}</template>
<template #value>{{ formattedDiskSpace }}</template>
<template #addons>
<VtsCopyButton :value="formattedDiskSpace" />
</template>
</VtsCardRowKeyValue>
<VtsCardRowKeyValue>
<template #key>{{ t('vdis') }}</template>
<template v-if="vdis.length > 0" #value>{{ vdis.length }}</template>
<template v-if="vdis.length > 0" #addons>
<VtsCopyButton :value="String(vdis.length)" />
</template>
</VtsCardRowKeyValue>
<VtsCardRowKeyValue>
<template #key>{{ t('snapshots') }}</template>
<template v-if="vm.snapshots.length > 0" #value>{{ vm.snapshots.length }}</template>
<template v-if="vm.snapshots.length > 0" #addons>
<VtsCopyButton :value="String(vm.snapshots.length)" />
</template>
</VtsCardRowKeyValue>
</VtsCardRowList>
</UiPanelCard>
</template>
<script lang="ts" setup>
import type { XenApiVm } from '@/libs/xen-api/xen-api.types.ts'
import { useVmResources } from '@/modules/vm/composables/vm-resources.composable.ts'
import VtsCardRowKeyValue from '@core/components/card/VtsCardRowKeyValue.vue'
import VtsCardRowList from '@core/components/card/VtsCardRowList.vue'
import VtsCopyButton from '@core/components/copy-button/VtsCopyButton.vue'
import UiPanelCard from '@core/components/ui/panel-card/UiPanelCard.vue'
import UiPanelCardTitle from '@core/components/ui/panel-card-title/UiPanelCardTitle.vue'
import { formatSize } from '@core/utils/size.util.ts'
import { computed } from 'vue'
import { useI18n } from 'vue-i18n'
const { vm } = defineProps<{
vm: XenApiVm
}>()
const { t } = useI18n()
const { vcpus, vdis, diskSize } = useVmResources(() => vm)
const formattedRam = computed(() => formatSize(vm.memory_dynamic_max, 0))
const formattedDiskSpace = computed(() => formatSize(diskSize.value, 1))
</script>

View File

@@ -0,0 +1,64 @@
import type { XenApiVm } from '@/libs/xen-api/xen-api.types.ts'
import { useVmGuestMetricsStore } from '@/stores/xen-api/vm-guest-metrics.store.ts'
import { useVmMetricsStore } from '@/stores/xen-api/vm-metrics.store.ts'
import { useTimeAgo } from '@core/composables/locale-time-ago.composable.ts'
import { formatDate, parseDateTime } from '@core/utils/time.util.ts'
import { toComputed } from '@core/utils/to-computed.util.ts'
import { computed, type MaybeRefOrGetter } from 'vue'
import { useI18n } from 'vue-i18n'
const XAPI_UNSET_DATE_TIME = '19700101T00:00:00Z'
function getValidDateTime(dateTime: string | undefined): string | undefined {
return dateTime === XAPI_UNSET_DATE_TIME ? undefined : dateTime
}
export function useVmMetricsInfo(rawVm: MaybeRefOrGetter<XenApiVm>) {
const { t } = useI18n()
const vm = toComputed(rawVm)
const { getByOpaqueRef: getGuestMetrics } = useVmGuestMetricsStore().subscribe()
const { getByOpaqueRef: getVmMetrics } = useVmMetricsStore().subscribe()
const guestMetrics = computed(() => getGuestMetrics(vm.value.guest_metrics))
const vmMetrics = computed(() => getVmMetrics(vm.value.metrics))
const osName = computed(() => guestMetrics.value?.os_version.name)
const guestTools = computed(() => {
const version = guestMetrics.value?.PV_drivers_version
if (!guestMetrics.value?.PV_drivers_detected || !version || Object.entries(version).length === 0) {
return undefined
}
return `${version.major}.${version.minor}.${version.micro}-${version.build}`
})
const startTime = computed(() => {
const dateTime = getValidDateTime(vmMetrics.value?.start_time)
return dateTime ? new Date(parseDateTime(dateTime)) : undefined
})
const vmTimeAgo = useTimeAgo(() => startTime.value ?? 0)
const relativeStartTime = computed(() => (startTime.value === undefined ? t('not-running') : vmTimeAgo.value))
const installTime = computed(() => getValidDateTime(vmMetrics.value?.install_time))
const installDateFormatted = computed(() =>
installTime.value === undefined ? t('unknown') : formatDate(installTime.value)
)
return {
osName,
guestTools,
startTime,
relativeStartTime,
installTime,
installDateFormatted,
}
}

View File

@@ -0,0 +1,37 @@
import type { XenApiVm } from '@/libs/xen-api/xen-api.types.ts'
import { getVmVcpus } from '@/modules/vm/utils/vm.util.ts'
import { useVbdStore } from '@/stores/xen-api/vbd.store.ts'
import { useVdiStore } from '@/stores/xen-api/vdi.store.ts'
import { useVmGuestMetricsStore } from '@/stores/xen-api/vm-guest-metrics.store.ts'
import { useVmMetricsStore } from '@/stores/xen-api/vm-metrics.store.ts'
import { toComputed } from '@core/utils/to-computed.util.ts'
import { computed, type MaybeRefOrGetter } from 'vue'
export function useVmResources(rawVm: MaybeRefOrGetter<XenApiVm>) {
const vm = toComputed(rawVm)
const { getByOpaqueRef: getVmMetrics } = useVmMetricsStore().subscribe()
const { getByOpaqueRef: getGuestMetrics } = useVmGuestMetricsStore().subscribe()
const { getByOpaqueRefs: getVbds } = useVbdStore().subscribe()
const { getByOpaqueRefs: getVdis } = useVdiStore().subscribe()
const vcpus = computed(() =>
getVmVcpus(vm.value, getVmMetrics(vm.value.metrics), getGuestMetrics(vm.value.guest_metrics))
)
const vdis = computed(() =>
getVdis(
getVbds(vm.value.VBDs)
.filter(vbd => vbd.type === 'Disk')
.map(vbd => vbd.VDI)
)
)
const diskSize = computed(() => vdis.value.reduce((total, vdi) => total + (vdi.virtual_size ?? 0), 0))
return {
vcpus,
vdis,
diskSize,
}
}

View File

@@ -1,5 +1,7 @@
import { VM_OPERATION, VM_POWER_STATE } from '@/libs/xen-api/xen-api.enums.ts'
import type { XenApiVm, XenApiVmGuestMetrics } from '@/libs/xen-api/xen-api.types.ts'
import type { XenApiVm, XenApiVmGuestMetrics, XenApiVmMetrics } from '@/libs/xen-api/xen-api.types.ts'
import { objectIcon } from '@core/icons'
import { toLower } from 'lodash-es'
export const CHANGING_STATE_OPERATIONS: VM_OPERATION[] = [
VM_OPERATION.START,
@@ -43,6 +45,40 @@ export function areVmToolsDetected(guestMetrics: XenApiVmGuestMetrics | undefine
return managementAgentDetected && pvDriversDetected
}
export function getVmIcon(vm: XenApiVm) {
return objectIcon('vm', toLower(vm.power_state))
}
export function getVmVcpus(
vm: XenApiVm,
metrics: XenApiVmMetrics | undefined,
guestMetrics: XenApiVmGuestMetrics | undefined
): number {
if (vm.power_state === VM_POWER_STATE.RUNNING && metrics !== undefined && areVmToolsDetected(guestMetrics)) {
return metrics.VCPUs_number
}
return vm.VCPUs_at_startup
}
export function getVmIpAddresses(guestMetrics: XenApiVmGuestMetrics | undefined): string[] {
return [...new Set(Object.values(guestMetrics?.networks ?? {}).sort())]
}
/**
* @see `packages/xo-server/src/xapi/utils.mjs`:57
**/
export function getVmDomainType(vm: XenApiVm) {
if (
vm.domain_type !== undefined && // XS < 7.5
vm.domain_type !== 'unspecified' // detection failed
) {
return vm.domain_type
}
return vm.HVM_boot_policy === '' ? 'pv' : 'hvm'
}
export type VmPowerStateAction =
| 'start'
| 'pause'

View File

@@ -1,16 +1,33 @@
<template>
<VmsPageContent :vms :busy="!isReady" :error="hasError" />
<VtsContentSidePanel class="host-vms-view">
<UiCard class="container">
<VmsTable :vms :busy="!isReady" :error="hasError" />
</UiCard>
<template #panel>
<VmSidePanel :vm="selectedVm" @close="selectedVm = undefined" />
</template>
</VtsContentSidePanel>
</template>
<script lang="ts" setup>
import VmsPageContent from '@/components/vm/VmsPageContent.vue'
import type { XenApiHost } from '@/libs/xen-api/xen-api.types.ts'
import type { XenApiHost, XenApiVm } from '@/libs/xen-api/xen-api.types.ts'
import VmSidePanel from '@/modules/vm/components/list/panel/VmSidePanel.vue'
import VmsTable from '@/modules/vm/components/list/VmsTable.vue'
import { usePageTitleStore } from '@/stores/page-title.store.ts'
import { useHostStore } from '@/stores/xen-api/host.store.ts'
import { useVmStore } from '@/stores/xen-api/vm.store.ts'
import VtsContentSidePanel from '@core/components/layout/VtsContentSidePanel.vue'
import UiCard from '@core/components/ui/card/UiCard.vue'
import { useRouteQuery } from '@core/composables/route-query.composable.ts'
import { logicAnd, logicOr } from '@vueuse/math'
import { computed } from 'vue'
import { useI18n } from 'vue-i18n'
import { useRoute } from 'vue-router'
const { t } = useI18n()
usePageTitleStore().setTitle(() => t('vms'))
const { isReady: isVmReady, hasError: hasVmError, recordsByHostRef } = useVmStore().subscribe()
const { isReady: isHostReady, hasError: hasHostError, getByUuid } = useHostStore().subscribe()
@@ -24,4 +41,19 @@ const route = useRoute<'/host/[uuid]/vms'>()
const host = computed(() => getByUuid(route.params.uuid as XenApiHost['uuid']))
const vms = computed(() => (host.value ? (recordsByHostRef.value.get(host.value?.$ref) ?? []) : []))
const selectedVm = useRouteQuery<XenApiVm | undefined>('id', {
toData: id => vms.value.find(vm => vm.uuid === id),
toQuery: vm => vm?.uuid ?? '',
})
</script>
<style lang="postcss" scoped>
.host-vms-view {
.container {
height: fit-content;
margin: 0.8rem;
gap: 4rem;
}
}
</style>

View File

@@ -1,10 +1,43 @@
<template>
<VmsPageContent :vms :busy="!isReady" :error="hasError" />
<VtsContentSidePanel class="pool-vms-view">
<UiCard class="container">
<VmsTable :vms :busy="!isReady" :error="hasError" />
</UiCard>
<template #panel>
<VmSidePanel :vm="selectedVm" @close="selectedVm = undefined" />
</template>
</VtsContentSidePanel>
</template>
<script lang="ts" setup>
import VmsPageContent from '@/components/vm/VmsPageContent.vue'
import type { XenApiVm } from '@/libs/xen-api/xen-api.types.ts'
import VmSidePanel from '@/modules/vm/components/list/panel/VmSidePanel.vue'
import VmsTable from '@/modules/vm/components/list/VmsTable.vue'
import { usePageTitleStore } from '@/stores/page-title.store.ts'
import { useVmStore } from '@/stores/xen-api/vm.store.ts'
import VtsContentSidePanel from '@core/components/layout/VtsContentSidePanel.vue'
import UiCard from '@core/components/ui/card/UiCard.vue'
import { useRouteQuery } from '@core/composables/route-query.composable.ts'
import { useI18n } from 'vue-i18n'
const { t } = useI18n()
const { records: vms, isReady, hasError } = useVmStore().subscribe()
usePageTitleStore().setTitle(() => t('vms'))
const selectedVm = useRouteQuery<XenApiVm | undefined>('id', {
toData: id => vms.value.find(vm => vm.uuid === id),
toQuery: vm => vm?.uuid ?? '',
})
</script>
<style lang="postcss" scoped>
.pool-vms-view {
.container {
height: fit-content;
margin: 0.8rem;
gap: 4rem;
}
}
</style>

View File

@@ -103,7 +103,7 @@
<VtsKeyValueList>
<VtsKeyValueRow>
<template #label>
<VtsSelect :id="localeSelectId" accent="brand" />
<VtsSelect :id="localeSelectId" accent="neutral" />
</template>
<template #value>
<UiLink size="medium" href="https://translate.vates.tech/engage/xen-orchestra/">

View File

@@ -10,7 +10,7 @@
<UiTitle>{{ t('template') }}</UiTitle>
<div class="template-container">
<VtsInputWrapper :label="t('action:pick-template')">
<VtsSelect :id="templateSelectId" accent="brand" />
<VtsSelect :id="templateSelectId" accent="neutral" />
</VtsInputWrapper>
</div>
<div v-if="vmState.new_vm_template" class="form-container">
@@ -30,7 +30,7 @@
{{ t('iso-dvd') }}
</UiRadioButton>
</UiRadioButtonGroup>
<VtsSelect v-if="vmState.installMode === 'ISO'" :id="vdiIsoSelectId" accent="brand" />
<VtsSelect v-if="vmState.installMode === 'ISO'" :id="vdiIsoSelectId" accent="neutral" />
</div>
<div v-else class="install-settings-container">
<UiRadioButtonGroup
@@ -45,7 +45,7 @@
{{ t('pxe') }}
</UiRadioButton>
</UiRadioButtonGroup>
<VtsSelect v-if="vmState.installMode === 'ISO'" :id="vdiIsoSelectId" accent="brand" />
<VtsSelect v-if="vmState.installMode === 'ISO'" :id="vdiIsoSelectId" accent="neutral" />
</div>
</div>
<!-- SYSTEM SECTION -->
@@ -54,11 +54,11 @@
<div class="system-container">
<div class="column">
<VtsInputWrapper :label="t('new-vm:name')">
<UiInput v-model.trim="vmState.name" accent="brand" />
<UiInput v-model.trim="vmState.name" accent="neutral" />
</VtsInputWrapper>
<VtsInputWrapper :label="t('tags')">
<!-- TODO Change input text into select when Thierry's component is available -->
<UiInput v-model.trim="vmState.tag" accent="brand" @keydown.enter.prevent="addTag" />
<UiInput v-model.trim="vmState.tag" accent="neutral" @keydown.enter.prevent="addTag" />
</VtsInputWrapper>
<div v-if="vmState.tags.length > 0" class="chips">
<UiChip v-for="(tag, index) in vmState.tags" :key="index" accent="info" @remove="removeTag(index)">
@@ -66,7 +66,7 @@
</UiChip>
</div>
<VtsInputWrapper :label="t('boot-firmware')">
<VtsSelect :id="bootFirmwareSelectId" accent="brand" />
<VtsSelect :id="bootFirmwareSelectId" accent="neutral" />
</VtsInputWrapper>
<div
v-if="vmState.boot_firmware !== 'uefi'"
@@ -93,11 +93,11 @@
</UiCheckboxGroup>
</div>
<div class="column">
<UiTextarea v-model="vmState.description" accent="brand">
<UiTextarea v-model="vmState.description" accent="neutral">
{{ t('new-vm:description') }}
</UiTextarea>
<VtsInputWrapper :label="t('affinity-host')">
<VtsSelect :id="affinityHostSelectId" accent="brand" />
<VtsSelect :id="affinityHostSelectId" accent="neutral" />
</VtsInputWrapper>
</div>
</div>
@@ -105,15 +105,15 @@
<UiTitle>{{ t('resource-management') }}</UiTitle>
<div class="resource-management-container">
<VtsInputWrapper :label="t('vcpus')">
<UiInput v-model.number="vmState.vCPU" type="number" accent="brand" />
<UiInput v-model.number="vmState.vCPU" type="number" accent="neutral" />
</VtsInputWrapper>
<!-- TODO remove (GB) when we can use new selector -->
<VtsInputWrapper :label="`${t('ram')} (GB)`">
<UiInput v-model.number="ramFormatted" type="number" accent="brand" />
<UiInput v-model.number="ramFormatted" type="number" accent="neutral" />
</VtsInputWrapper>
<VtsInputWrapper :label="t('topology')">
<div class="topology">
<VtsSelect :id="topologySelectId" accent="brand" />
<VtsSelect :id="topologySelectId" accent="neutral" />
</div>
</VtsInputWrapper>
</div>
@@ -512,6 +512,7 @@ const getExistingVdis = (template: XenApiVm) => {
acc.push({
id: vdi.$ref,
userdevice: vbd.userdevice,
name_label: vdi.name_label,
name_description: vdi.name_description,
size: bytesToGiB(vdi.virtual_size),
@@ -698,6 +699,7 @@ const _createVm = defer(async ($defer: Defer) => {
const vdiRef = await xapi.getField<XenApiVdi['$ref']>('VBD', vbdRef, 'VDI')
const type = await xapi.getField<VBD_TYPE>('VBD', vbdRef, 'type')
const bootable = await xapi.getField<boolean>('VBD', vbdRef, 'bootable')
const userdevice = await xapi.getField<XenApiVbd['userdevice']>('VBD', vbdRef, 'userdevice')
if (!hasBootableDisk) {
hasBootableDisk = bootable
@@ -707,45 +709,49 @@ const _createVm = defer(async ($defer: Defer) => {
continue
}
for (const vdi of existingVdis) {
const srRef = await xapi.getField<XenApiSr['$ref']>('VDI', vdiRef, 'SR')
const vbdRefs = await xapi.getField<XenApiVbd['$ref'][]>('VDI', vdiRef, 'VBDs')
const vdi = existingVdis.find(vdi => vdi.userdevice === userdevice)
await xapi.vdi.setNameLabel(vdiRef, vdi.name_label)
await xapi.vdi.setNameDescription(vdiRef, vdi.name_description)
if (vdi === undefined) {
continue
}
// EDIT SR: Migrate VDI or create new one
if (vdi.SR !== srRef) {
try {
await xapi.vdi.poolMigrate(vdiRef, vdi.SR)
} catch (error) {
if (!(error instanceof Error)) {
throw error
}
const srRef = await xapi.getField<XenApiSr['$ref']>('VDI', vdiRef, 'SR')
const vbdRefs = await xapi.getField<XenApiVbd['$ref'][]>('VDI', vdiRef, 'VBDs')
const { message } = error
await xapi.vdi.setNameLabel(vdiRef, vdi.name_label)
await xapi.vdi.setNameDescription(vdiRef, vdi.name_description)
if (
message !== 'NO_HOSTS_AVAILABLE' &&
message !== 'LICENCE_RESTRICTION' &&
message !== 'VDI_NEEDS_VM_FOR_MIGRATE'
) {
throw error
}
const newVdiRef = await xapi.vdi.copy(vdiRef, vdi.SR)
if (vbdRefs) {
for (const vbdRef of vbdRefs) {
const vbd = await xapi.getField<XenApiVbd>('VBD', vbdRef, 'record')
await xapi.vbd.delete(vbdRef)
await xapi.vbd.create({ ...vbd, vmRefs, vdiRef: newVdiRef[0] })
}
}
await xapi.vdi.delete(vdiRef)
// EDIT SR: Migrate VDI or create new one
if (vdi.SR !== srRef) {
try {
await xapi.vdi.poolMigrate(vdiRef, vdi.SR)
} catch (error) {
if (!(error instanceof Error)) {
throw error
}
const { message } = error
if (
message !== 'NO_HOSTS_AVAILABLE' &&
message !== 'LICENCE_RESTRICTION' &&
message !== 'VDI_NEEDS_VM_FOR_MIGRATE'
) {
throw error
}
const newVdiRef = await xapi.vdi.copy(vdiRef, vdi.SR)
if (vbdRefs) {
for (const vbdRef of vbdRefs) {
const vbd = await xapi.getField<XenApiVbd>('VBD', vbdRef, 'record')
await xapi.vbd.delete(vbdRef)
await xapi.vbd.create({ ...vbd, vmRefs, vdiRef: newVdiRef[0] })
}
}
await xapi.vdi.delete(vdiRef)
}
}
}

View File

@@ -62,12 +62,12 @@
<FormSection :label="t('configuration')">
<div class="row">
<VtsInputWrapper :label="t('storage')" :message="t('n-gb-required', { n: REQUIRED_GB })">
<VtsSelect :id="srSelectId" accent="brand" />
<VtsSelect :id="srSelectId" accent="neutral" />
</VtsInputWrapper>
</div>
<div class="row">
<VtsInputWrapper :label="t('network')">
<VtsSelect :id="networkSelectId" accent="brand" />
<VtsSelect :id="networkSelectId" accent="neutral" />
</VtsInputWrapper>
<VtsInputWrapper
:label="t('deploy-xoa-custom-ntp-servers')"

View File

@@ -492,6 +492,13 @@ declare module 'vue-router/auto-routes' {
Record<never, never>,
| never
>,
'/story/web-core/middle-ellipsis/vts-middle-ellipsis': RouteRecordInfo<
'/story/web-core/middle-ellipsis/vts-middle-ellipsis',
'/story/web-core/middle-ellipsis/vts-middle-ellipsis',
Record<never, never>,
Record<never, never>,
| never
>,
'/story/web-core/number-input/vts-number-input': RouteRecordInfo<
'/story/web-core/number-input/vts-number-input',
'/story/web-core/number-input/vts-number-input',
@@ -555,6 +562,13 @@ declare module 'vue-router/auto-routes' {
Record<never, never>,
| never
>,
'/story/web-core/select/vts-detailed-option': RouteRecordInfo<
'/story/web-core/select/vts-detailed-option',
'/story/web-core/select/vts-detailed-option',
Record<never, never>,
Record<never, never>,
| never
>,
'/story/web-core/select/vts-select': RouteRecordInfo<
'/story/web-core/select/vts-select',
'/story/web-core/select/vts-select',
@@ -618,6 +632,20 @@ declare module 'vue-router/auto-routes' {
Record<never, never>,
| never
>,
'/story/web-core/tag/vts-tag': RouteRecordInfo<
'/story/web-core/tag/vts-tag',
'/story/web-core/tag/vts-tag',
Record<never, never>,
Record<never, never>,
| never
>,
'/story/web-core/tag-select/vts-tag-select': RouteRecordInfo<
'/story/web-core/tag-select/vts-tag-select',
'/story/web-core/tag-select/vts-tag-select',
Record<never, never>,
Record<never, never>,
| never
>,
'/story/web-core/tags-input/vts-tags-input': RouteRecordInfo<
'/story/web-core/tags-input/vts-tags-input',
'/story/web-core/tags-input/vts-tags-input',
@@ -625,6 +653,13 @@ declare module 'vue-router/auto-routes' {
Record<never, never>,
| never
>,
'/story/web-core/task/vts-task-list': RouteRecordInfo<
'/story/web-core/task/vts-task-list',
'/story/web-core/task/vts-task-list',
Record<never, never>,
Record<never, never>,
| never
>,
'/story/web-core/tree/vts-tree-item': RouteRecordInfo<
'/story/web-core/tree/vts-tree-item',
'/story/web-core/tree/vts-tree-item',
@@ -856,6 +891,13 @@ declare module 'vue-router/auto-routes' {
Record<never, never>,
| never
>,
'/story/web-core/ui/group-subcategory/ui-group-subcategory': RouteRecordInfo<
'/story/web-core/ui/group-subcategory/ui-group-subcategory',
'/story/web-core/ui/group-subcategory/ui-group-subcategory',
Record<never, never>,
Record<never, never>,
| never
>,
'/story/web-core/ui/head-bar/ui-head-bar': RouteRecordInfo<
'/story/web-core/ui/head-bar/ui-head-bar',
'/story/web-core/ui/head-bar/ui-head-bar',
@@ -863,6 +905,13 @@ declare module 'vue-router/auto-routes' {
Record<never, never>,
| never
>,
'/story/web-core/ui/image-radio-button/ui-image-radio-button': RouteRecordInfo<
'/story/web-core/ui/image-radio-button/ui-image-radio-button',
'/story/web-core/ui/image-radio-button/ui-image-radio-button',
Record<never, never>,
Record<never, never>,
| never
>,
'/story/web-core/ui/info/ui-info': RouteRecordInfo<
'/story/web-core/ui/info/ui-info',
'/story/web-core/ui/info/ui-info',
@@ -961,6 +1010,13 @@ declare module 'vue-router/auto-routes' {
Record<never, never>,
| never
>,
'/story/web-core/ui/overridden/ui-overridden': RouteRecordInfo<
'/story/web-core/ui/overridden/ui-overridden',
'/story/web-core/ui/overridden/ui-overridden',
Record<never, never>,
Record<never, never>,
| never
>,
'/story/web-core/ui/panel/ui-panel': RouteRecordInfo<
'/story/web-core/ui/panel/ui-panel',
'/story/web-core/ui/panel/ui-panel',
@@ -1010,6 +1066,20 @@ declare module 'vue-router/auto-routes' {
Record<never, never>,
| never
>,
'/story/web-core/ui/rich-checkbox/ui-rich-checkbox': RouteRecordInfo<
'/story/web-core/ui/rich-checkbox/ui-rich-checkbox',
'/story/web-core/ui/rich-checkbox/ui-rich-checkbox',
Record<never, never>,
Record<never, never>,
| never
>,
'/story/web-core/ui/rich-checkbox-group/ui-rich-checkbox-group': RouteRecordInfo<
'/story/web-core/ui/rich-checkbox-group/ui-rich-checkbox-group',
'/story/web-core/ui/rich-checkbox-group/ui-rich-checkbox-group',
Record<never, never>,
Record<never, never>,
| never
>,
'/story/web-core/ui/rich-radio-button/ui-rich-radio-button': RouteRecordInfo<
'/story/web-core/ui/rich-radio-button/ui-rich-radio-button',
'/story/web-core/ui/rich-radio-button/ui-rich-radio-button',
@@ -1017,6 +1087,13 @@ declare module 'vue-router/auto-routes' {
Record<never, never>,
| never
>,
'/story/web-core/ui/rich-radio-button-group/ui-rich-radio-button-group': RouteRecordInfo<
'/story/web-core/ui/rich-radio-button-group/ui-rich-radio-button-group',
'/story/web-core/ui/rich-radio-button-group/ui-rich-radio-button-group',
Record<never, never>,
Record<never, never>,
| never
>,
'/story/web-core/ui/stacked-bar/ui-stacked-bar': RouteRecordInfo<
'/story/web-core/ui/stacked-bar/ui-stacked-bar',
'/story/web-core/ui/stacked-bar/ui-stacked-bar',
@@ -1073,6 +1150,13 @@ declare module 'vue-router/auto-routes' {
Record<never, never>,
| never
>,
'/story/web-core/ui/tag/ui-label-value-tag': RouteRecordInfo<
'/story/web-core/ui/tag/ui-label-value-tag',
'/story/web-core/ui/tag/ui-label-value-tag',
Record<never, never>,
Record<never, never>,
| never
>,
'/story/web-core/ui/tag/ui-tag': RouteRecordInfo<
'/story/web-core/ui/tag/ui-tag',
'/story/web-core/ui/tag/ui-tag',
@@ -1087,13 +1171,6 @@ declare module 'vue-router/auto-routes' {
Record<never, never>,
| never
>,
'/story/web-core/ui/tag/ui-tertiary-tag': RouteRecordInfo<
'/story/web-core/ui/tag/ui-tertiary-tag',
'/story/web-core/ui/tag/ui-tertiary-tag',
Record<never, never>,
Record<never, never>,
| never
>,
'/story/web-core/ui/task-item/ui-task-item': RouteRecordInfo<
'/story/web-core/ui/task-item/ui-task-item',
'/story/web-core/ui/task-item/ui-task-item',
@@ -1101,13 +1178,6 @@ declare module 'vue-router/auto-routes' {
Record<never, never>,
| never
>,
'/story/web-core/ui/task-list/ui-task-list': RouteRecordInfo<
'/story/web-core/ui/task-list/ui-task-list',
'/story/web-core/ui/task-list/ui-task-list',
Record<never, never>,
Record<never, never>,
| never
>,
'/story/web-core/ui/title/ui-title': RouteRecordInfo<
'/story/web-core/ui/title/ui-title',
'/story/web-core/ui/title/ui-title',
@@ -1661,6 +1731,12 @@ declare module 'vue-router/auto-routes' {
views:
| never
}
'src/stories/web-core/middle-ellipsis/vts-middle-ellipsis.story.vue': {
routes:
| '/story/web-core/middle-ellipsis/vts-middle-ellipsis'
views:
| never
}
'src/stories/web-core/number-input/vts-number-input.story.vue': {
routes:
| '/story/web-core/number-input/vts-number-input'
@@ -1715,6 +1791,12 @@ declare module 'vue-router/auto-routes' {
views:
| never
}
'src/stories/web-core/select/vts-detailed-option.story.vue': {
routes:
| '/story/web-core/select/vts-detailed-option'
views:
| never
}
'src/stories/web-core/select/vts-select.story.vue': {
routes:
| '/story/web-core/select/vts-select'
@@ -1769,12 +1851,30 @@ declare module 'vue-router/auto-routes' {
views:
| never
}
'src/stories/web-core/tag/vts-tag.story.vue': {
routes:
| '/story/web-core/tag/vts-tag'
views:
| never
}
'src/stories/web-core/tag-select/vts-tag-select.story.vue': {
routes:
| '/story/web-core/tag-select/vts-tag-select'
views:
| never
}
'src/stories/web-core/tags-input/vts-tags-input.story.vue': {
routes:
| '/story/web-core/tags-input/vts-tags-input'
views:
| never
}
'src/stories/web-core/task/vts-task-list.story.vue': {
routes:
| '/story/web-core/task/vts-task-list'
views:
| never
}
'src/stories/web-core/tree/vts-tree-item.story.vue': {
routes:
| '/story/web-core/tree/vts-tree-item'
@@ -1973,12 +2073,24 @@ declare module 'vue-router/auto-routes' {
views:
| never
}
'src/stories/web-core/ui/group-subcategory/ui-group-subcategory.story.vue': {
routes:
| '/story/web-core/ui/group-subcategory/ui-group-subcategory'
views:
| never
}
'src/stories/web-core/ui/head-bar/ui-head-bar.story.vue': {
routes:
| '/story/web-core/ui/head-bar/ui-head-bar'
views:
| never
}
'src/stories/web-core/ui/image-radio-button/ui-image-radio-button.story.vue': {
routes:
| '/story/web-core/ui/image-radio-button/ui-image-radio-button'
views:
| never
}
'src/stories/web-core/ui/info/ui-info.story.vue': {
routes:
| '/story/web-core/ui/info/ui-info'
@@ -2063,6 +2175,12 @@ declare module 'vue-router/auto-routes' {
views:
| never
}
'src/stories/web-core/ui/overridden/ui-overridden.story.vue': {
routes:
| '/story/web-core/ui/overridden/ui-overridden'
views:
| never
}
'src/stories/web-core/ui/panel/ui-panel.story.vue': {
routes:
| '/story/web-core/ui/panel/ui-panel'
@@ -2105,12 +2223,30 @@ declare module 'vue-router/auto-routes' {
views:
| never
}
'src/stories/web-core/ui/rich-checkbox/ui-rich-checkbox.story.vue': {
routes:
| '/story/web-core/ui/rich-checkbox/ui-rich-checkbox'
views:
| never
}
'src/stories/web-core/ui/rich-checkbox-group/ui-rich-checkbox-group.story.vue': {
routes:
| '/story/web-core/ui/rich-checkbox-group/ui-rich-checkbox-group'
views:
| never
}
'src/stories/web-core/ui/rich-radio-button/ui-rich-radio-button.story.vue': {
routes:
| '/story/web-core/ui/rich-radio-button/ui-rich-radio-button'
views:
| never
}
'src/stories/web-core/ui/rich-radio-button-group/ui-rich-radio-button-group.story.vue': {
routes:
| '/story/web-core/ui/rich-radio-button-group/ui-rich-radio-button-group'
views:
| never
}
'src/stories/web-core/ui/stacked-bar/ui-stacked-bar.story.vue': {
routes:
| '/story/web-core/ui/stacked-bar/ui-stacked-bar'
@@ -2159,6 +2295,12 @@ declare module 'vue-router/auto-routes' {
views:
| never
}
'src/stories/web-core/ui/tag/ui-label-value-tag.story.vue': {
routes:
| '/story/web-core/ui/tag/ui-label-value-tag'
views:
| never
}
'src/stories/web-core/ui/tag/ui-tag.story.vue': {
routes:
| '/story/web-core/ui/tag/ui-tag'
@@ -2171,24 +2313,12 @@ declare module 'vue-router/auto-routes' {
views:
| never
}
'src/stories/web-core/ui/tag/ui-tertiary-tag.story.vue': {
routes:
| '/story/web-core/ui/tag/ui-tertiary-tag'
views:
| never
}
'src/stories/web-core/ui/task-item/ui-task-item.story.vue': {
routes:
| '/story/web-core/ui/task-item/ui-task-item'
views:
| never
}
'src/stories/web-core/ui/task-list/ui-task-list.story.vue': {
routes:
| '/story/web-core/ui/task-list/ui-task-list'
views:
| never
}
'src/stories/web-core/ui/title/ui-title.story.vue': {
routes:
| '/story/web-core/ui/title/ui-title'

View File

@@ -1,9 +1,37 @@
import type { XenApiVdi } from '@/libs/xen-api/xen-api.types.ts'
import { createXapiStoreConfig } from '@/stores/xen-api/create-xapi-store-config.ts'
import { createSubscribableStoreContext } from '@core/utils/create-subscribable-store-context.util.ts'
import { defineStore } from 'pinia'
export const useVdiStore = defineStore('xen-api-vdi', () => {
const config = createXapiStoreConfig('vdi')
const { context: baseContext, ...configRest } = createXapiStoreConfig('vdi')
return createSubscribableStoreContext(config, {})
const getChainPhysicalUsage = (vdi: XenApiVdi) => {
if (vdi.is_a_snapshot || !vdi.managed) {
return vdi.physical_utilisation
}
let total = vdi.physical_utilisation
let parentUuid = vdi.sm_config['vhd-parent'] as XenApiVdi['uuid'] | undefined
while (parentUuid !== undefined) {
const parent = baseContext.getByUuid(parentUuid)
if (parent === undefined) {
break
}
total += parent.physical_utilisation
parentUuid = parent.sm_config['vhd-parent'] as XenApiVdi['uuid'] | undefined
}
return total
}
const context = {
...baseContext,
getChainPhysicalUsage,
}
return createSubscribableStoreContext({ context, ...configRest }, {})
})

View File

@@ -4,7 +4,7 @@
<div class="row">
Choose a component
<VtsSelect :id="componentSelectId" accent="brand" />
<VtsSelect :id="componentSelectId" accent="neutral" />
</div>
<div class="row">

View File

@@ -4,7 +4,7 @@
<template #content>
<div class="demo-rename-modal-content">
<VtsInputWrapper label="New name">
<UiInput v-model.trim="newName" accent="brand" required />
<UiInput v-model.trim="newName" accent="neutral" required />
</VtsInputWrapper>
<p>
Tip: name the VM "fail" to make the fake API call fail: the confirmation modal closes and this modal stays

View File

@@ -0,0 +1,24 @@
<template>
<ComponentStory
v-slot="{ properties, settings }"
:params="[
prop('text')
.str()
.required()
.preset('prod-web-frontend-eu-west-01')
.widget()
.help('Rendered as is when it fits, cut in the middle otherwise, with the full text in a tooltip'),
prop('tailLength').num().default(10).widget().help('Number of characters kept visible at the end of a cut text'),
setting('width').widget(number()).preset(15).help('Available width, in rem'),
]"
>
<VtsMiddleEllipsis v-bind="properties" :style="{ width: `${settings.width}rem` }" />
</ComponentStory>
</template>
<script lang="ts" setup>
import ComponentStory from '@/components/component-story/ComponentStory.vue'
import { prop, setting } from '@/libs/story/story-param.ts'
import { number } from '@/libs/story/story-widget.ts'
import VtsMiddleEllipsis from '@core/components/middle-ellipsis/VtsMiddleEllipsis.vue'
</script>

View File

@@ -0,0 +1,53 @@
<template>
<ComponentStory
v-slot="{ properties }"
:params="[
prop('option')
.required()
.obj('FormOption<{ accent?: DropdownAccent }>')
.help('Given by the default slot of VtsSelect'),
iconProp().preset('object:network'),
prop('iconTooltip').str().widget(),
prop('details').str().widget().preset('eth0').help('Displayed after a dash'),
]"
:presets="{
'PIF with VLAN': {
props: {
icon: 'object:network',
details: 'eth1, VLAN 20',
},
},
'Disabled VM': {
props: {
icon: 'object:vm:running',
iconTooltip: 'Running',
details: 'No VIF detected',
},
},
'Without details': {
props: {
icon: 'object:network',
details: undefined,
},
},
}"
>
<VtsSelect :id="optionSelectId" accent="neutral">
<template #default="{ option }">
<VtsDetailedOption v-bind="properties" :option />
</template>
</VtsSelect>
</ComponentStory>
</template>
<script lang="ts" setup>
import ComponentStory from '@/components/component-story/ComponentStory.vue'
import { iconProp, prop } from '@/libs/story/story-param.ts'
import VtsDetailedOption from '@core/components/select/VtsDetailedOption.vue'
import VtsSelect from '@core/components/select/VtsSelect.vue'
import { useFormSelect } from '@core/packages/form-select'
const optionLabels = ['Pool-wide network associated with eth0', 'Storage network']
const { id: optionSelectId } = useFormSelect(optionLabels)
</script>

View File

@@ -2,36 +2,32 @@
<ComponentStory
v-slot="{ properties }"
:params="[
prop('accent').required().enum('brand', 'warning', 'danger').preset('brand').widget(),
prop('options').required().arr('FormOption<TEntry, TValue>').widget().preset(options),
prop('selectedLabel').str(),
prop('required').bool().widget(),
prop('placeholder').str().widget().preset('Choose colors'),
prop('searchPlaceholder').str().widget().preset('Search colors'),
prop('loading').bool().widget(),
model('search'),
prop('accent').required().enum('neutral', 'success', 'warning', 'danger').preset('neutral').widget(),
prop('id').required().obj('FormSelectId').preset(id),
slot(),
]"
>
<VtsSelect v-bind="properties" v-model:search="searchTerm" :selected-label />
<VtsSelect v-bind="properties" />
</ComponentStory>
</template>
<script lang="ts" setup>
import ComponentStory from '@/components/component-story/ComponentStory.vue'
import { model, prop, slot } from '@/libs/story/story-param.ts'
import { prop, slot } from '@/libs/story/story-param.ts'
import VtsSelect from '@core/components/select/VtsSelect.vue'
import { useFormSelect } from '@core/packages/form-select'
import { upperFirst } from 'lodash-es'
const colors = ['blue', 'yellow', 'red', 'green', 'orange', 'purple', 'white', 'grey', 'black']
const { options, searchTerm, selectedLabel } = useFormSelect(colors, {
properties: color => ({
value: color,
label: `${upperFirst(color)} color`,
disabled: color === 'blue' || color === 'orange' || color === 'black',
}),
const { id } = useFormSelect(colors, {
option: {
label: color => `${upperFirst(color)} color`,
disabled: color => color === 'blue' || color === 'orange' || color === 'black',
},
multiple: true,
searchable: true,
placeholder: 'Choose colors',
searchPlaceholder: 'Search colors',
})
</script>

View File

@@ -0,0 +1,46 @@
<template>
<ComponentStory
v-slot="{ properties }"
:params="[
prop('tags').arr('string').required().help('Currently selected tags. The component never mutates it'),
prop('suggestions').arr('TagSelectSuggestion').preset(suggestions).widget(),
prop('iconOnly').bool().widget().help('Displays the `Add`/`Edit` trigger as an icon with a tooltip'),
prop('busy').bool().widget().help('Displays the trigger as busy, e.g. while the tags are being saved'),
event('save')
.args({ changes: 'TagSelectChanges' })
.help('Emitted with the added and removed tags when clicking `Save`. `Cancel` discards the changes'),
]"
>
<UiTagsList>
<VtsTag v-for="tag of tags" :key="tag" :value="tag" accent="brand" />
<VtsTagSelect v-bind="properties" :tags @save="changes => saveTags(changes)" />
</UiTagsList>
</ComponentStory>
</template>
<script lang="ts" setup>
import ComponentStory from '@/components/component-story/ComponentStory.vue'
import { event, prop } from '@/libs/story/story-param.ts'
import VtsTag from '@core/components/tag/VtsTag.vue'
import VtsTagSelect, {
type TagSelectChanges,
type TagSelectSuggestion,
} from '@core/components/tag-select/VtsTagSelect.vue'
import UiTagsList from '@core/components/ui/tag/UiTagsList.vue'
import { ref } from 'vue'
const tags = ref(['production', 'env=prod'])
const suggestions: TagSelectSuggestion[] = [
{ tag: 'production' },
{ tag: 'staging' },
{ tag: 'env=prod' },
{ tag: 'env=dev' },
{ tag: 'xo:no-bak', info: 'Excludes the VM from backups' },
{ tag: 'xo:notify-on-snapshot', info: 'Notifies when a snapshot is created' },
]
function saveTags({ added, removed }: TagSelectChanges) {
tags.value = [...tags.value.filter(tag => !removed.includes(tag)), ...added]
}
</script>

View File

@@ -0,0 +1,36 @@
<template>
<ComponentStory
v-slot="{ properties }"
:params="[
prop('value')
.str()
.required()
.preset('env=prod')
.widget()
.help('Tags in the `term=label` form are displayed as a tertiary tag'),
prop('accent')
.type('TagAccent')
.enum('brand', 'info', 'neutral', 'success', 'warning', 'danger', 'muted')
.default('info')
.widget(),
prop('variant')
.type('TagVariant')
.enum('primary', 'secondary')
.default('secondary')
.widget()
.help('Ignored when the tag is displayed as a tertiary tag'),
prop('wrap')
.bool()
.widget()
.help('Stacks the term above the value when they do not fit on one line (tertiary tag only)'),
]"
>
<VtsTag v-bind="properties" />
</ComponentStory>
</template>
<script lang="ts" setup>
import ComponentStory from '@/components/component-story/ComponentStory.vue'
import { prop } from '@/libs/story/story-param.ts'
import VtsTag from '@core/components/tag/VtsTag.vue'
</script>

View File

@@ -9,6 +9,6 @@ The label comes from the surrounding `VtsInputWrapper`.
```vue-template
<VtsInputWrapper label="Values">
<VtsTagsInput v-model="values" accent="brand" placeholder="Add a value" />
<VtsTagsInput v-model="values" accent="neutral" placeholder="Add a value" />
</VtsInputWrapper>
```

View File

@@ -3,7 +3,7 @@
v-slot="{ properties }"
:params="[
model().type('string[]').preset(['alpha', 'beta']).help('Enter or comma adds the typed value'),
prop('accent').enum('brand', 'warning', 'danger').required().preset('brand').widget(),
prop('accent').enum('neutral', 'warning', 'danger').required().preset('neutral').widget(),
prop('placeholder').str().preset('Add a value').widget(),
]"
>

View File

@@ -0,0 +1,33 @@
<template>
<ComponentStory
v-slot="{ properties }"
:params="[
prop('tasks').type('Task[]').required().preset(allTasks),
prop('selectedTaskId').str().widget(),
prop('showEyeIcon').bool().widget(),
prop('autoCollapseCompleted').bool().widget(),
prop('expandAll')
.bool()
.widget()
.help('Shows every task expanded; turning it off restores the tasks expanded before'),
prop('unreadTaskIds').type('ReadonlySet<string>').help('Shows an unread dot column, with a dot for these tasks'),
event('select').args({ id: 'string' }),
]"
:presets="{
'Unread tasks': {
props: {
unreadTaskIds: new Set(['1', '1-2', '4', '9', '9-2', '9-2-1']),
},
},
}"
>
<VtsTaskList v-bind="properties" />
</ComponentStory>
</template>
<script lang="ts" setup>
import ComponentStory from '@/components/component-story/ComponentStory.vue'
import { event, prop } from '@/libs/story/story-param.ts'
import { allTasks } from '@/stories/web-core/ui/task-item/mock-tasks.ts'
import VtsTaskList from '@core/components/task/VtsTaskList.vue'
</script>

View File

@@ -3,6 +3,7 @@
v-slot="{ properties, settings }"
:params="[
prop('accent').type('CheckboxAccent').required().enum('brand', 'warning', 'danger').preset('brand').widget(),
prop('value').str().help('Used when the model is an array'),
prop('disabled').bool().widget(),
slot(),
slot('info'),
@@ -10,7 +11,7 @@
setting('defaultSlot').widget(text()).preset('Label'),
setting('info').widget(text()).preset('Lorem ipsum dolor sit amet, consectetur adipiscing elit.'),
setting('message').widget(text()).preset('Lorem ipsum dolor sit amet, consectetur adipiscing elit.'),
model().type('boolean').preset(undefined),
model().type('boolean | undefined | string[]').preset(undefined).help('undefined means partly checked'),
]"
>
<UiCheckbox v-bind="properties">

View File

@@ -7,7 +7,7 @@
prop('accent')
.type('CircleProgressBarAccent')
.required()
.enum('info', 'warning', 'danger')
.enum('brand', 'info', 'warning', 'danger')
.preset('info')
.widget(),
prop('size')
@@ -16,6 +16,7 @@
.enum('extra-small', 'small', 'medium', 'large')
.preset('large')
.widget(),
prop('noValue').bool().widget(),
]"
:presets
>
@@ -35,6 +36,7 @@ const presets = {
maxValue: 500,
size: 'medium',
accent: 'info',
noValue: false,
},
},
'75% of 300': {
@@ -43,6 +45,34 @@ const presets = {
maxValue: 300,
size: 'medium',
accent: 'info',
noValue: false,
},
},
'Value above max (success)': {
props: {
value: 150,
maxValue: 100,
size: 'medium',
accent: 'info',
noValue: false,
},
},
'Value above max (warning)': {
props: {
value: 150,
maxValue: 100,
size: 'medium',
accent: 'warning',
noValue: false,
},
},
'Brand ring without value': {
props: {
value: 1,
maxValue: 3,
size: 'small',
accent: 'brand',
noValue: true,
},
},
}

View File

@@ -0,0 +1,23 @@
<template>
<ComponentStory
v-slot="{ settings }"
:params="[
slot().help('Meant to receive the subcategory title'),
slot('info').help('Meant to receive a short text displayed on the right'),
setting('defaultSlot').widget(text()).preset('Into a pool'),
setting('info').widget(text()).preset('Writes to a pool'),
]"
>
<UiGroupSubcategory>
{{ settings.defaultSlot }}
<template v-if="settings.info" #info>{{ settings.info }}</template>
</UiGroupSubcategory>
</ComponentStory>
</template>
<script lang="ts" setup>
import ComponentStory from '@/components/component-story/ComponentStory.vue'
import { setting, slot } from '@/libs/story/story-param.ts'
import { text } from '@/libs/story/story-widget.ts'
import UiGroupSubcategory from '@core/components/ui/group-subcategory/UiGroupSubcategory.vue'
</script>

View File

@@ -0,0 +1,39 @@
<template>
<ComponentStory
v-slot="{ properties, settings }"
:params="[
prop('accent').required().enum('brand', 'warning', 'danger').preset('brand').widget(),
prop('size').required().enum('small', 'medium').preset('medium').widget(),
prop('disabled').bool().widget(),
prop('src').required().str().help('Image URL for rich mode'),
prop('alt').required().str().help('Alt text for image'),
model().type('string').preset(''),
setting('defaultSlot').widget(text()).preset('Label'),
]"
>
<div class="radio">
<UiImageRadioButton v-model="selectedRadio" value="1" v-bind="properties" :src="imageUrl" :alt="properties.alt">
{{ settings.defaultSlot }}
</UiImageRadioButton>
</div>
</ComponentStory>
</template>
<script lang="ts" setup>
import ComponentStory from '@/components/component-story/ComponentStory.vue'
import { model, prop, setting } from '@/libs/story/story-param.ts'
import { text } from '@/libs/story/story-widget.ts'
import UiImageRadioButton from '@core/components/ui/image-radio-button/UiImageRadioButton.vue'
import { ref } from 'vue'
import imageUrl from '../../../../assets/color-mode-dark.svg'
const selectedRadio = ref('')
</script>
<style lang="postcss" scoped>
.radio {
display: flex;
gap: 1.6rem;
flex-wrap: wrap;
}
</style>

Some files were not shown because too many files have changed in this diff Show More