Compare commits

..

3 Commits

Author SHA1 Message Date
Thierry
5dba45f6cf update readme and componentstory to use new menu components 2025-01-10 10:38:40 +01:00
Thierry
b112a72f23 continue menu implementation 2025-01-10 10:08:36 +01:00
Thierry
069ed9215f feat(web-stack): start new menu implementation 2025-01-09 11:32:52 +01:00
500 changed files with 7846 additions and 19174 deletions

View File

@@ -192,14 +192,18 @@ module.exports = {
// Specific rules for XO i18n-related files
{
files: [
'@xen-orchestra/lite/**/*.{vue,ts}',
'@xen-orchestra/web/**/*.{vue,ts}',
'@xen-orchestra/lite/**/*.{vue,ts,json}',
'@xen-orchestra/web/**/*.{vue,ts,json}',
'@xen-orchestra/web-core/**/*.{vue,ts,json}',
],
extends: ['plugin:@intlify/vue-i18n/base'],
settings: {
'vue-i18n': {
localeDir: ['@xen-orchestra/web-core/lib/locales/*.json'],
localeDir: [
'@xen-orchestra/lite/src/locales/*.json',
'@xen-orchestra/web/src/locales/*.json',
'@xen-orchestra/web-core/lib/locales/*.json',
],
messageSyntaxVersion: '^9.9.0',
},
},
@@ -223,10 +227,7 @@ module.exports = {
'@intlify/vue-i18n/no-v-html': 'error',
'@intlify/vue-i18n/valid-message-syntax': 'error',
'@intlify/vue-i18n/no-duplicate-keys-in-locale': 'error',
'@intlify/vue-i18n/no-missing-keys-in-other-locales': [
'error',
{ ignoreLocales: ['de', 'fa', 'cs', 'es', 'sv'] },
],
'@intlify/vue-i18n/no-missing-keys-in-other-locales': ['error', { ignoreLocales: ['de', 'fa', 'cs'] }],
},
},
// Specific rules for XO dev-related files

2
.gitignore vendored
View File

@@ -7,8 +7,6 @@
/@vates/*/node_modules/
/@xen-orchestra/*/dist/
/@xen-orchestra/*/node_modules/
/@xen-orchestra/rest-api/open-api/spec/swagger.json
/@xen-orchestra/rest-api/src/open-api/routes/routes.ts
/packages/*/dist/
/packages/*/node_modules/

View File

@@ -11,8 +11,8 @@ class AggregateError extends Error {
/**
* @template Item
* @param {Iterable<Item>|AsyncIterable<Item>} iterable
* @param {(item: Item, index: number, iterable: Iterable<Item>|AsyncIterable<Item>) => Promise<void>} iteratee
* @param {Iterable<Item>} iterable
* @param {(item: Item, index: number, iterable: Iterable<Item>) => Promise<void>} iteratee
* @returns {Promise<void>}
*/
exports.asyncEach = function asyncEach(iterable, iteratee, { concurrency = 10, signal, stopOnError = true } = {}) {

3
@vates/fatfs/.gitignore vendored Normal file
View File

@@ -0,0 +1,3 @@
.DS_Store
.vscode/
node_modules/

View File

@@ -1 +0,0 @@
../../scripts/npmignore

View File

@@ -8,9 +8,8 @@
"postversion": "npm publish --access public"
},
"repository": {
"directory": "@vates/fatfs",
"type": "git",
"url": "https://github.com/vatesfr/xen-orchestra.git"
"url": "https://github.com/vatesfr/xen-orchestra"
},
"keywords": [
"filesystem",
@@ -21,14 +20,13 @@
],
"author": "Vates SAS",
"license": "Apache-2.0",
"bugs": "https://github.com/vatesfr/xen-orchestra/issues",
"homepage": "https://github.com/vatesfr/xen-orchestra/tree/master/@vates/fatfs",
"bugs": {
"url": "https://github.com/vatesfr/xen-orchestra/issues"
},
"homepage": "https://github.com/vatesfr/xen-orchestra",
"dependencies": {
"fifolock": "^1.0.0",
"struct-fu": "^1.2.1",
"xok": "^1.0.0"
},
"engines": {
"node": ">=18"
}
}

View File

@@ -13,7 +13,7 @@ await mount(handler, diskId, mountPoint)
### cli
From the install folder:
From the install folder :
```
cli.mjs <remoteUrl> <vhdPathInRemote> <mountPoint>
@@ -25,25 +25,4 @@ After installing the package
xo-fuse-vhd <remoteUrl> <vhdPathInRemote> <mountPoint>
```
The `remoteUrl` can be found using the following command from the XOA CLI, and then picking the right `url` property:
`xo-server-db ls remote`
The `vhdPathInRemote` follows a file structure described [here](https://github.com/vatesfr/xen-orchestra/blob/master/%40xen-orchestra/backups/docs/VM%20backups/README.md).
## Restore a file from a VHD using `fuse-vhd` CLI
1. Mount a VHD to the Filesystem (see **Usage**).
2. Verify the VHD is Correctly Mounted:
`mount | grep fuse`
3. Get the `START` and `SIZE` of the disk whose file you want to restore. Multiply `START` by 512 (block size) to get the offset value. (`mountedVhdPath` is the `mountPoint` value from earlier, followed by `/vhd0`, for example). Depending on the partition type, you may need to do some additional setup to discover the partitions.
`partx --bytes --output=NR,START,SIZE,NAME,UUID,TYPE --pairs <mountedVhdPath>`
4. Mount the disk. Depending on the partition type, you may need to add some additionnal options. The `norecovery` option is used for ext3/ext4/xfs file systems, otherwise remove this option.
`mount --options=loop,ro,norecovery,sizelimit=<SIZE>,offset=<START*512> --source=<mountedVhdPath> --target=<diskMountPoint>`
5. Copy your files from the mounted partition, then unmount the partition.
remoteUrl can be found by using cli in `@xen-orchestra/fs` , for example a local remote will have a url like `file:///path/to/remote/root`

View File

@@ -29,7 +29,7 @@ await mount(handler, diskId, mountPoint)
### cli
From the install folder:
From the install folder :
```
cli.mjs <remoteUrl> <vhdPathInRemote> <mountPoint>
@@ -41,28 +41,7 @@ After installing the package
xo-fuse-vhd <remoteUrl> <vhdPathInRemote> <mountPoint>
```
The `remoteUrl` can be found using the following command from the XOA CLI, and then picking the right `url` property:
`xo-server-db ls remote`
The `vhdPathInRemote` follows a file structure described [here](https://github.com/vatesfr/xen-orchestra/blob/master/%40xen-orchestra/backups/docs/VM%20backups/README.md).
## Restore a file from a VHD using `fuse-vhd` CLI
1. Mount a VHD to the Filesystem (see **Usage**).
2. Verify the VHD is Correctly Mounted:
`mount | grep fuse`
3. Get the `START` and `SIZE` of the disk whose file you want to restore. Multiply `START` by 512 (block size) to get the offset value. (`mountedVhdPath` is the `mountPoint` value from earlier, followed by `/vhd0`, for example). Depending on the partition type, you may need to do some additional setup to discover the partitions.
`partx --bytes --output=NR,START,SIZE,NAME,UUID,TYPE --pairs <mountedVhdPath>`
4. Mount the disk. Depending on the partition type, you may need to add some additionnal options. The `norecovery` option is used for ext3/ext4/xfs file systems, otherwise remove this option.
`mount --options=loop,ro,norecovery,sizelimit=<SIZE>,offset=<START*512> --source=<mountedVhdPath> --target=<diskMountPoint>`
5. Copy your files from the mounted partition, then unmount the partition.
remoteUrl can be found by using cli in `@xen-orchestra/fs` , for example a local remote will have a url like `file:///path/to/remote/root`
## Contributions

View File

@@ -19,12 +19,12 @@
},
"main": "./index.mjs",
"dependencies": {
"@xen-orchestra/fs": "^4.4.0",
"@xen-orchestra/fs": "^4.3.0",
"@xen-orchestra/log": "^0.7.1",
"fuse-native": "^2.2.6",
"lru-cache": "^7.14.0",
"promise-toolbox": "^0.21.0",
"vhd-lib": "^4.11.3"
"vhd-lib": "^4.11.2"
},
"bin": {
"xo-fuse-vhd": "./cli.mjs"

View File

@@ -1,58 +0,0 @@
A toolbox to ease the use of generator
### Timeout
wrap a source async generator to have it throw an error when timeout is reached
timeout is a positive number in milliseconds
```js
import { Timeout } from '@vates/generator-toolbox'
const wrappedGenerator = new Timeout(sourceGenerator, timeout)
```
### Throttle
wrap a source async generator to have it respect a max speed ( in bytes per seconds).
speed is either a strictly positive number or a function returning a strictly positive number. A speed change will be used for the next emitted packet.
The source generator must yield object with a length property.
Optimized for small yields regarding to the speed, since it won't split incoming packet.
If the generator reached the max speed it will be paused, limiting memory consumption.
```js
import { Throttle } from '@vates/generator-toolbox'
const wrappedGenerator = new Throttle(sourceGenerator, speed)
```
### Synchronized
Fork a generator. The rules ares:
- if the source returns, all the forks returns
- if the forks errors, all the forks errors with the same error
- if a the fork return , it is stopped, but the generator continue with the other
- if a the fork error , it is stopped, but the generator continue with the other
- if all the fork return , the source is stopped
- if all the fork error , the source is errored with the last error
- the source start producing a packet when the fastest forked ask for it
- the source forks get the packet only when all the forks asked for it, no buffer stores in memory
```ts
import { Synchronized } from '@vates/generator-toolbox'
async function consume(generator: AsyncGenerator) {
for await (const val of generator) {
console.log({ val })
}
}
const forker = new Synchronized(generator)
const first = forker.fork('first')
const second = forker.fork('second')
await Promise.all([consume(first), consume(second)])
```
Note: you can stop early a generator by calling `generator.return()`, and you can stop in in error by calling `generator.throw(error)`

View File

@@ -1 +0,0 @@
../../scripts/npmignore

View File

@@ -1,89 +0,0 @@
<!-- DO NOT EDIT MANUALLY, THIS FILE HAS BEEN GENERATED -->
# @vates/generator-toolbox
[![Package Version](https://badgen.net/npm/v/@vates/generator-toolbox)](https://npmjs.org/package/@vates/generator-toolbox) ![License](https://badgen.net/npm/license/@vates/generator-toolbox) [![PackagePhobia](https://badgen.net/bundlephobia/minzip/@vates/generator-toolbox)](https://bundlephobia.com/result?p=@vates/generator-toolbox) [![Node compatibility](https://badgen.net/npm/node/@vates/generator-toolbox)](https://npmjs.org/package/@vates/generator-toolbox)
## Install
Installation of the [npm package](https://npmjs.org/package/@vates/generator-toolbox):
```sh
npm install --save @vates/generator-toolbox
```
## Usage
A toolbox to ease the use of generator
### Timeout
wrap a source async generator to have it throw an error when timeout is reached
timeout is a positive number in milliseconds
```js
import { Timeout } from '@vates/generator-toolbox'
const wrappedGenerator = new Timeout(sourceGenerator, timeout)
```
### Throttle
wrap a source async generator to have it respect a max speed ( in bytes per seconds).
speed is either a strictly positive number or a function returning a strictly positive number. A speed change will be used for the next emitted packet.
The source generator must yield object with a length property.
Optimized for small yields regarding to the speed, since it won't split incoming packet.
If the generator reached the max speed it will be paused, limiting memory consumption.
```js
import { Throttle } from '@vates/generator-toolbox'
const wrappedGenerator = new Throttle(sourceGenerator, speed)
```
### Synchronized
Fork a generator. The rules ares:
- if the source returns, all the forks returns
- if the forks errors, all the forks errors with the same error
- if a the fork return , it is stopped, but the generator continue with the other
- if a the fork error , it is stopped, but the generator continue with the other
- if all the fork return , the source is stopped
- if all the fork error , the source is errored with the last error
- the source start producing a packet when the fastest forked ask for it
- the source forks get the packet only when all the forks asked for it, no buffer stores in memory
```ts
import { Synchronized } from '@vates/generator-toolbox'
async function consume(generator: AsyncGenerator) {
for await (const val of generator) {
console.log({ val })
}
}
const forker = new Synchronized(generator)
const first = forker.fork('first')
const second = forker.fork('second')
await Promise.all([consume(first), consume(second)])
```
Note: you can stop early a generator by calling `generator.return()`, and you can stop in in error by calling `generator.throw(error)`
## Contributions
Contributions are _very_ welcomed, either on the documentation or on
the code.
You may:
- report any [issue](https://github.com/vatesfr/xen-orchestra/issues)
you've encountered;
- fork and create a pull request.
## License
[MIT](https://spdx.org/licenses/MIT) © [Vates SAS](https://vates.fr)

View File

@@ -1,6 +0,0 @@
// @ts-check
import eslint from '@eslint/js'
import tseslint from 'typescript-eslint'
export default tseslint.config(eslint.configs.recommended, tseslint.configs.recommended)

View File

@@ -1,34 +0,0 @@
{
"name": "@vates/generator-toolbox",
"version": "1.0.1",
"main": "dist/index.mjs",
"license": "MIT",
"private": false,
"type": "module",
"devDependencies": {
"@eslint/js": "^9.19.0",
"@types/node": "^20.6",
"typescript": "~5.6",
"typescript-eslint": "^8.23.0"
},
"scripts": {
"build": "tsc",
"dev": "tsc --watch",
"postversion": "npm publish --access public",
"test": "tsc && node --test **/*.test.mjs"
},
"homepage": "https://github.com/vatesfr/xen-orchestra/tree/master/@vates/generator-toolbox",
"bugs": "https://github.com/vatesfr/xen-orchestra/issues",
"repository": {
"directory": "@vates/generator-toolbox",
"type": "git",
"url": "https://github.com/vatesfr/xen-orchestra.git"
},
"author": {
"name": "Vates SAS",
"url": "https://vates.fr"
},
"engines": {
"node": ">=20.18"
}
}

View File

@@ -1,3 +0,0 @@
export { Synchronized } from './synchronized.mjs'
export { Throttle } from './throttle.mjs'
export { Timeout } from './timeout.mjs'

View File

@@ -1,148 +0,0 @@
import assert from 'node:assert'
export class Synchronized<T, TReturn, TNext> {
#source: AsyncGenerator<T, TReturn, TNext>
#forks = new Map<string, Forked<T, TReturn, TNext>>()
#removedForks = new Set<string>()
#waitingForks = new Set<string>()
#started = false
#nextValueForksReady?: {
promise: Promise<IteratorResult<T>>
forksWaitingReject: (error: Error) => void
forksWaitingResolve: () => void
}
constructor(source: AsyncGenerator<T, TReturn, TNext>) {
this.#source = source
}
fork(uid: string): AsyncGenerator {
assert.strictEqual(this.#started, false, `can't create a fork after consuming the data`)
const fork = new Forked<T, TReturn, TNext>(this, uid)
this.#forks.set(uid, fork)
return fork
}
async #resolveWhenAllForksReady(): Promise<IteratorResult<T>> {
if (!this.#nextValueForksReady) {
throw new Error('Can t wait forks if there are noone waiting')
}
const { promise, forksWaitingResolve } = this.#nextValueForksReady
if (this.#waitingForks.size === this.#forks.size) {
// reset value
this.#waitingForks.clear()
this.#nextValueForksReady = undefined
forksWaitingResolve() // for the other forks waiting
}
return promise
}
async next(uid: string): Promise<IteratorResult<T>> {
if (this.#removedForks.has(uid)) {
return { done: true, value: undefined }
}
if (!this.#forks.has(uid)) {
throw new Error(`trying to advance fork ${uid} that is not a fork of this one`)
}
if (this.#waitingForks.has(uid)) {
throw new Error(`Fork ${uid} is already waiting`)
}
this.#started = true
if (this.#nextValueForksReady === undefined) {
let forksWaitingResolve = () => {}
let forksWaitingReject: (reason?: Error) => void = () => {}
const next = this.#source.next().catch(async error => {
const e = new Error(`Error in the source generator ${error.message}`, { cause: error })
forksWaitingReject(e)
// source has failed, kill everything, and stop the forks
for (const uid of [...this.#forks.keys()]) {
await this.remove(uid, error)
}
})
const promise = Promise.all([
next,
new Promise((_resolve, _reject) => {
forksWaitingResolve = () => _resolve(undefined)
forksWaitingReject = _reject
}),
]).then(([_]) => _ as IteratorResult<T>)
this.#nextValueForksReady = { promise, forksWaitingResolve, forksWaitingReject }
}
this.#waitingForks.add(uid)
return this.#resolveWhenAllForksReady()
}
async remove(uid: string, error?: Error): Promise<IteratorResult<T>> {
const fork = this.#forks.get(uid)
if (fork === undefined) {
if (this.#removedForks.has(uid)) {
// already removed
return { done: true, value: undefined }
}
throw new Error(`trying to remove fork wih uid ${uid} that is not a fork of this one`)
}
this.#forks.delete(uid)
this.#waitingForks.delete(uid)
this.#removedForks.add(uid)
try {
if (error === undefined) {
await fork.return()
} else {
await fork.throw(error)
}
} catch (cleaningError) {
console.error('Error while cleaning the forked', {
cleaningError,
sourceError: error,
})
}
if (this.#forks.size === 0) {
if (error === undefined) {
await this.#source.return(undefined as TReturn)
} else {
await this.#source.throw(error)
}
// Reject any pending forks waiting for the next value
if (this.#nextValueForksReady) {
this.#nextValueForksReady.forksWaitingReject(new Error('Source generator terminated.', { cause: error }))
this.#nextValueForksReady = undefined
}
// clear state
this.#removedForks.clear()
this.#waitingForks.clear()
} else {
// this fork was maybe blocking the others
if (this.#nextValueForksReady) {
await this.#resolveWhenAllForksReady()
}
}
return { done: true, value: undefined }
}
}
class Forked<T, TReturn, TNext> implements AsyncGenerator<T, TReturn, TNext> {
#parent: Synchronized<T, TReturn, TNext>
#uid: string
constructor(parent: Synchronized<T, TReturn, TNext>, uid: string) {
this.#parent = parent
this.#uid = uid
}
next(): Promise<IteratorResult<T>> {
return this.#parent.next(this.#uid)
}
async return(): Promise<IteratorResult<T>> {
return this.#parent.remove(this.#uid)
}
async throw(e: Error): Promise<IteratorResult<T>> {
return this.#parent.remove(this.#uid, e)
}
[Symbol.asyncIterator](): AsyncGenerator<T> {
return this
}
}

View File

@@ -1,142 +0,0 @@
import assert from 'node:assert'
import { suite, test } from 'node:test'
import { Synchronized } from './synchronized.mjs'
// eslint-disable-next-line @typescript-eslint/no-unused-vars
async function* makeRangeGenerator(end = Infinity, progress = { yielded: 0 }, onYielded = (val: unknown) => {}) {
for (let i = 0; i < end; i++) {
await new Promise(resolve => setTimeout(resolve, 10))
yield i
onYielded(i)
progress.yielded = i
}
return progress
}
async function consume(
iterable: AsyncGenerator,
delay = 2500,
// eslint-disable-next-line @typescript-eslint/no-unused-vars
onConsumed = (val: unknown, iterable: AsyncGenerator) => Promise.resolve(false)
) {
for await (const val of iterable) {
await new Promise(resolve => setTimeout(resolve, delay))
if (await onConsumed(val, iterable)) {
iterable.return(undefined)
}
}
}
suite('success', () => {
test('if works with multiple consumer', async () => {
const progress = { yielded: 0 }
const generator = makeRangeGenerator(3, progress)
const forker = new Synchronized(generator)
const first = forker.fork('first')
const second = forker.fork('second')
await Promise.all([consume(first, 50), consume(second, 500)])
assert.strictEqual(progress.yielded, 2)
})
test('if works with one consumer returning', async () => {
const progress = { yielded: 0 }
const generator = makeRangeGenerator(10, progress)
const forker = new Synchronized(generator)
const first = forker.fork('first')
const second = forker.fork('second')
await new Promise(resolve => setTimeout(resolve, 500))
await Promise.all([
consume(first, 1),
consume(second, 1, async (val: unknown) => {
return Promise.resolve(val === 2)
}),
])
assert.strictEqual(progress.yielded, 9)
})
test('if works with all consumers returning', async () => {
const progress = { yielded: 0 }
const generator = makeRangeGenerator(10, progress)
const forker = new Synchronized(generator)
const first = forker.fork('first')
const second = forker.fork('second')
await new Promise(resolve => setTimeout(resolve, 500))
await Promise.all([
consume(first, 1, async (val: unknown) => {
return Promise.resolve(val === 5)
}),
consume(second, 1, async (val: unknown) => {
return Promise.resolve(val === 2)
}),
])
assert.strictEqual(progress.yielded, 4)
})
})
suite('error', () => {
test('it fails all if error on source', async () => {
const progress = { yielded: 0 }
const generator = makeRangeGenerator(5, progress, (val: unknown) => {
if (val === 2) {
throw new Error('source stop')
}
})
const forker = new Synchronized(generator)
const first = forker.fork('first')
const second = forker.fork('second')
await assert.rejects(Promise.all([consume(first, 1), consume(second, 1)]))
assert.strictEqual(progress.yielded, 1)
})
test('it flows until the end if one consumer throws', async () => {
const progress = { yielded: 0 }
const generator = makeRangeGenerator(10, progress)
const forker = new Synchronized(generator)
const first = forker.fork('first')
const second = forker.fork('second')
const firstConsume = consume(first, 1)
const secondConsume = assert.rejects(() =>
consume(second, 1, async (val: unknown, iterable) => {
if (val === 1) {
await iterable.throw(new Error('error on second'))
}
return false
})
)
await Promise.allSettled([firstConsume, secondConsume])
assert.strictEqual(progress.yielded, 9)
})
test('it throw if ALL consumer throws', async () => {
const progress = { yielded: 0 }
const generator = makeRangeGenerator(5, progress)
const forker = new Synchronized(generator)
const first = forker.fork('first')
const second = forker.fork('second')
const firstConsume = consume(first, 1, async (val: unknown, iterable) => {
if (val === 3) {
await iterable.throw(new Error('error on first'))
}
return false
})
const secondConsume = consume(second, 1, async (val: unknown, iterable) => {
if (val === 1) {
await iterable.throw(new Error('error on second'))
}
return false
})
await assert.rejects(Promise.all([firstConsume, secondConsume]))
assert.strictEqual(progress.yielded, 2)
})
test('It should not allow a new fork after the start', async () => {
const progress = { yielded: 0 }
const generator = makeRangeGenerator(5, progress)
const forker = new Synchronized(generator)
const first = forker.fork('first')
await first.next()
assert.throws(() => forker.fork('second'))
})
})

View File

@@ -1,66 +0,0 @@
import assert from 'node:assert'
/**
*
* This class will throttle the production of a group of generators
*
* limits: depends on the event loop, so don't expect it to be very precise
* works better with more small blocks
* The source generator must yield object with a length property
* Changing the speed will only be takin into account fot the next packets asked
*/
export class Throttle {
#previousSlot = 0
#bytesPerSecond: number | (() => number)
get speed(): number {
let speed: number
if (typeof this.#bytesPerSecond === 'function') {
speed = this.#bytesPerSecond()
} else {
speed = this.#bytesPerSecond
}
assert.ok(speed > 0, `speed must be greater than zero, ${speed} computed`)
return speed
}
constructor(speed: number | (() => number)) {
this.#bytesPerSecond = speed
}
getNextSlot(length: number): { timeout?: ReturnType<typeof setTimeout>; promise?: Promise<unknown> } {
assert.notStrictEqual(length, undefined, `throttled stream need to expose a length property }`)
assert.ok(length > 0, `throttled stream must expose a positive length property , ${length} given }`)
const previous = this.#previousSlot
const nextSlot = Math.round(previous + (length * 1000) / this.speed)
if (nextSlot < Date.now()) {
// we're above the limit, go now
this.#previousSlot = Date.now()
return {}
}
this.#previousSlot = nextSlot
// wait till the next slot
// it won't be extremely precise since the event loop is not
let timeout: ReturnType<typeof setTimeout> | undefined = undefined
const promise = new Promise(function (resolve) {
timeout = setTimeout(resolve, nextSlot - Date.now())
})
return { promise, timeout }
}
async *createThrottledGenerator(source: AsyncGenerator<{ length: number }>): AsyncGenerator<{ length: number }> {
let timeout: ReturnType<typeof setTimeout> | undefined
try {
for await (const value of source) {
const res = this.getNextSlot(value.length)
timeout = res.timeout
// wait for the time slot before yielding the data
if (res.promise !== undefined) {
await res.promise
}
yield value
}
} finally {
clearTimeout(timeout)
}
}
}

View File

@@ -1,63 +0,0 @@
import { Throttle } from './throttle.mjs'
import { suite, test } from 'node:test'
import assert from 'node:assert'
async function* makeGenerator(chunkSize = 1024 * 1024, nbChunks = 100) {
for (let i = 0; i < nbChunks; i++) {
yield Buffer.allocUnsafe(chunkSize)
}
}
async function consumes(generator: AsyncGenerator) {
// eslint-disable-next-line no-empty,@typescript-eslint/no-unused-vars
for await (const data of generator) {
}
}
suite('it throttle one', () => {
test('base test', async () => {
// 10MB/s
const throttler = new Throttle(10 * 1024 * 1024)
const throttled = throttler.createThrottledGenerator(makeGenerator(1024 * 1024, 20))
const start = Date.now()
await consumes(throttled)
const end = Date.now()
assert.strictEqual(Math.round((end - start) / 1000), 2)
})
test('variable speed test', async () => {
// 10MB/s
const throttler = new Throttle(() => 10 * 1024 * 1024)
const throttled = throttler.createThrottledGenerator(makeGenerator(1024 * 1024, 20))
const start = Date.now()
await consumes(throttled)
const end = Date.now()
assert.strictEqual(Math.round((end - start) / 1000), 2)
})
test('multiple generator test', async () => {
// 10MB/s
const throttler = new Throttle(10 * 1024 * 1024)
const first = throttler.createThrottledGenerator(makeGenerator(1024 * 1024, 10))
const second = throttler.createThrottledGenerator(makeGenerator(1024 * 1024, 10))
const start = Date.now()
await Promise.all([consumes(first), consumes(second)])
const end = Date.now()
assert.strictEqual(Math.round((end - start) / 1000), 2)
})
test(`it doesn't accept negative value`, async () => {
// 10MB/s
let throttler = new Throttle(-10 * 1024 * 1024)
let generator = throttler.createThrottledGenerator(makeGenerator(1024 * 1024, 10))
await assert.rejects(() => consumes(generator))
let index = 5
throttler = new Throttle(() => {
index--
return index > 0 ? 10 * 1024 * 1024 : -10 * 1024 * 1024
})
generator = throttler.createThrottledGenerator(makeGenerator(1024 * 1024, 10))
await assert.rejects(() => consumes(generator))
})
})

View File

@@ -1,37 +0,0 @@
import assert from 'node:assert'
export class Timeout<T> implements AsyncGenerator {
#source: AsyncGenerator<T>
#timeout: number
constructor(source: AsyncGenerator<T>, timeout: number) {
assert.ok(timeout > 0, `Timeout value must be positive, ${timeout} received`)
this.#source = source
this.#timeout = timeout
}
async next(): Promise<IteratorResult<T>> {
let timeout: ReturnType<typeof setTimeout>
const promiseTimeout = new Promise((_, reject) => {
timeout = setTimeout(() => {
reject(new Error('Timeout reached '))
}, this.#timeout)
})
const promiseNext = new Promise((resolve, reject) => {
this.#source.next().then(res => {
// ensure timetout won't fire later
clearTimeout(timeout)
resolve(res)
}, reject)
})
// promiseTimeout will never resolve
return Promise.race([promiseNext, promiseTimeout]) as Promise<IteratorResult<T>>
}
return(): Promise<IteratorResult<T>> {
return this.#source.return(undefined)
}
throw(e: Error): Promise<IteratorResult<T>> {
return this.#source.throw(e)
}
[Symbol.asyncIterator](): AsyncGenerator<T> {
return this
}
}

View File

@@ -1,67 +0,0 @@
import { describe, it } from 'node:test'
import assert from 'node:assert'
import { Timeout } from './timeout.mjs'
describe('Timeout class', () => {
it('should reject a timeout with a negative or zero value ', async () => {
// Create a mock async generator that never resolves
const mockGenerator = (async function* () {
yield 1
})()
assert.throws(() => new Timeout(mockGenerator, 0))
assert.throws(() => new Timeout(mockGenerator, -10))
})
it('should resolve with the value from the source generator if it completes before the timeout', async () => {
// Create a mock async generator that resolves immediately
const mockGenerator = (async function* () {
yield 1
})()
const timeout = new Timeout(mockGenerator, 100) // 100ms timeout
const result = await timeout.next()
assert.strictEqual(result.value, 1)
assert.strictEqual(result.done, false)
})
it('should reject with a timeout error if the source generator takes too long', async () => {
// Create a mock async generator that never resolves
// eslint-disable-next-line require-yield
const mockGenerator = (async function* () {
await new Promise(() => {}) // Never resolves
})()
const timeout = new Timeout(mockGenerator, 10) // 10ms timeout
await assert.rejects(timeout.next(), 'Expected timeout error was not thrown')
})
it('should allow iteration using for-await-of', async () => {
// Create a mock async generator that yields values
const mockGenerator: AsyncGenerator<number> = (async function* () {
yield 1
yield 2
yield 3
})()
const timeout = new Timeout(mockGenerator, 100) // 100ms timeout
const results: Array<number> = []
for await (const value of timeout) {
results.push(value as number)
}
assert.deepStrictEqual(results, [1, 2, 3])
})
it('should handle the throw method correctly', async () => {
// Create a mock async generator with a throw method
const mockGenerator = (async function* () {
yield 1
})()
const timeout = new Timeout(mockGenerator, 100) // 100ms timeout
await assert.rejects(timeout.throw(new Error('Test error')), 'Expected error was not thrown')
})
})

View File

@@ -1,12 +0,0 @@
{
"compilerOptions": {
"target": "es2023",
"module": "ESNext",
"moduleResolution": "bundler",
"strict": true,
"declaration": true, // Generates `.d.ts` files for type safety
"outDir": "dist" // Outputs compiled code to the `dist` directory
},
"include": ["src/**/*"],
"exclude": ["node_modules", "dist"]
}

View File

@@ -24,7 +24,7 @@
"@xen-orchestra/async-map": "^0.1.2",
"@xen-orchestra/log": "^0.7.1",
"promise-toolbox": "^0.21.0",
"xen-api": "^4.7.1"
"xen-api": "^4.7.0"
},
"devDependencies": {
"tap": "^18.7.0",

View File

@@ -29,7 +29,7 @@ class Task {
static get abortSignal() {
const task = getTask()
if (task !== undefined) {
return task._abortController.signal
return task.#abortController.signal
}
}
@@ -65,11 +65,8 @@ class Task {
}
}
// These two properties should not be used outside the class
//
// To ensure compatibility between multiple versions of this lib, they are kept public for now
_abortController = new AbortController()
_onProgress
#abortController = new AbortController()
#onProgress
get id() {
return (this.id = Math.random().toString(36).slice(2))
@@ -89,23 +86,23 @@ class Task {
this.#startData = { properties }
if (onProgress !== undefined) {
this._onProgress = onProgress
this.#onProgress = onProgress
} else {
const parent = getTask()
if (parent !== undefined) {
const { signal } = parent._abortController
const { signal } = parent.#abortController
signal.addEventListener('abort', () => {
this._abortController.abort(signal.reason)
this.#abortController.abort(signal.reason)
})
this._onProgress = parent._onProgress
this.#onProgress = parent.#onProgress
this.#startData.parentId = parent.id
} else {
this._onProgress = noop
this.#onProgress = noop
}
}
const { signal } = this._abortController
const { signal } = this.#abortController
signal.addEventListener('abort', () => {
if (this.status === PENDING) {
this.#maybeStart()
@@ -120,7 +117,7 @@ class Task {
}
abort(reason) {
this._abortController.abort(reason)
this.#abortController.abort(reason)
}
#emit(type, data) {
@@ -129,7 +126,7 @@ class Task {
data.id = this.id
data.timestamp = Date.now()
data.type = type
this._onProgress(data)
this.#onProgress(data)
}
#end(status, result) {
@@ -137,7 +134,7 @@ class Task {
assert.equal(this.#running, false)
this.#emit('end', { status, result })
this._onProgress = alreadyEnded
this.#onProgress = alreadyEnded
this.#status = status
}

View File

@@ -13,7 +13,7 @@
"url": "https://vates.fr"
},
"license": "ISC",
"version": "0.6.1",
"version": "0.6.0",
"engines": {
"node": ">=14"
},

View File

@@ -1 +0,0 @@
../../scripts/npmignore

View File

@@ -1,8 +0,0 @@
// @ts-check
import eslint from '@eslint/js'
import tseslint from 'typescript-eslint'
export default tseslint.config(eslint.configs.recommended, tseslint.configs.recommended, {
ignores: ['dist'],
})

View File

@@ -1,48 +0,0 @@
{
"name": "@vates/types",
"private": false,
"version": "1.0.1",
"main": "./dist/index.mjs",
"exports": {
".": {
"default": "./dist/index.mjs",
"types": "./dist/index.d.mts"
},
"./xo": "./dist/xo.d.mts",
"./xen-api": "./dist/xen-api.d.mts",
"./common": {
"default": "./dist/common.mjs",
"types": "./dist/common.d.mts"
},
"./lib/vates/*": {
"default": "./dist/lib/vates-*.mjs",
"type": "./dist/lib/vates-*.d.mts"
}
},
"type": "module",
"devDependencies": {
"@eslint/js": "^9.19.0",
"typescript": "~5.6.3",
"typescript-eslint": "^8.23.0"
},
"scripts": {
"build": "tsc",
"prepublishOnly": "yarn run build",
"postversion": "npm publish --access public"
},
"license": "AGPL-3.0-or-later",
"homepage": "https://github.com/vatesfr/xen-orchestra/tree/master/@vates/types",
"bugs": "https://github.com/vatesfr/xen-orchestra/issues",
"repository": {
"directory": "@vates/types",
"type": "git",
"url": "https://github.com/vatesfr/xen-orchestra.git"
},
"author": {
"name": "Vates SAS",
"url": "https://vates.fr"
},
"engines": {
"node": ">=18.18"
}
}

View File

@@ -1,698 +0,0 @@
declare const __brand: unique symbol
export type Branded<TBrand extends string, TType = string> = TType & { [__brand]: TBrand }
export const HOST_POWER_STATE = {
RUNNING: 'Running',
HALTED: 'Halted',
UNKNOWN: 'Unknown',
} as const
export type HOST_POWER_STATE = (typeof HOST_POWER_STATE)[keyof typeof HOST_POWER_STATE]
export const TASK_ALLOWED_OPERATIONS = {
CANCEL: 'cancel',
DESTROY: 'destroy',
} as const
export type TASK_ALLOWED_OPERATIONS = (typeof TASK_ALLOWED_OPERATIONS)[keyof typeof TASK_ALLOWED_OPERATIONS]
export const TASK_STATUS_TYPE = {
CANCELLED: 'cancelled',
CANCELLING: 'cancelling',
FAILURE: 'failure',
PENDING: 'pending',
SUCCESS: 'success',
} as const
export type TASK_STATUS_TYPE = (typeof TASK_STATUS_TYPE)[keyof typeof TASK_STATUS_TYPE]
export const EVENT_OPERATION = {
ADD: 'add',
DEL: 'del',
MOD: 'mod',
} as const
export type EVENT_OPERATION = (typeof EVENT_OPERATION)[keyof typeof EVENT_OPERATION]
export const POOL_ALLOWED_OPERATIONS = {
APPLY_UPDATES: 'apply_updates',
CERT_REFRESH: 'cert_refresh',
CLUSTER_CREATE: 'cluster_create',
CONFIGURE_REPOSITORIES: 'configure_repositories',
COPY_PRIMARY_HOST_CERTS: 'copy_primary_host_certs',
DESIGNATE_NEW_MASTER: 'designate_new_master',
EJECT: 'eject',
EXCHANGE_CA_CERTIFICATES_ON_JOIN: 'exchange_ca_certificates_on_join',
EXCHANGE_CERTIFICATES_ON_JOIN: 'exchange_certificates_on_join',
GET_UPDATES: 'get_updates',
HA_DISABLE: 'ha_disable',
HA_ENABLE: 'ha_enable',
SYNC_UPDATES: 'sync_updates',
TLS_VERIFICATION_ENABLE: 'tls_verification_enable',
} as const
export type POOL_ALLOWED_OPERATIONS = (typeof POOL_ALLOWED_OPERATIONS)[keyof typeof POOL_ALLOWED_OPERATIONS]
export const TELEMETRY_FREQUENCY = {
DAILY: 'daily',
MONTHLY: 'monthly',
WEEKLY: 'weekly',
} as const
export type TELEMETRY_FREQUENCY = (typeof TELEMETRY_FREQUENCY)[keyof typeof TELEMETRY_FREQUENCY]
export const UPDATE_SYNC_FREQUENCY = {
DAILY: 'daily',
WEEKLY: 'weekly',
} as const
export type UPDATE_SYNC_FREQUENCY = (typeof UPDATE_SYNC_FREQUENCY)[keyof typeof UPDATE_SYNC_FREQUENCY]
export const AFTER_APPLY_GUIDANCE = {
RESTART_HOST: 'restartHost',
RESTART_HVM: 'restartHVM',
RESTART_PV: 'restartPV',
RESTART_XAPI: 'restartXAPI',
} as const
export type AFTER_APPLY_GUIDANCE = (typeof AFTER_APPLY_GUIDANCE)[keyof typeof AFTER_APPLY_GUIDANCE]
export const UPDATE_AFTER_APPLY_GUIDANCE = {
RESTART_HOST: 'restartHost',
RESTART_HVM: 'restartHVM',
RESTART_PV: 'restartPV',
RESTART_XAPI: 'restartXAPI',
} as const
export type UPDATE_AFTER_APPLY_GUIDANCE = (typeof UPDATE_AFTER_APPLY_GUIDANCE)[keyof typeof UPDATE_AFTER_APPLY_GUIDANCE]
export const LIVEPATCH_STATUS = {
OK: 'ok',
OK_LIVEPATCH_COMPLETE: 'ok_livepatch_complete',
OK_LIVEPATCH_INCOMPLETE: 'ok_livepatch_incomplete',
} as const
export type LIVEPATCH_STATUS = (typeof LIVEPATCH_STATUS)[keyof typeof LIVEPATCH_STATUS]
export const VM_POWER_STATE = {
HALTED: 'Halted',
PAUSED: 'Paused',
RUNNING: 'Running',
SUSPENDED: 'Suspended',
} as const
export type VM_POWER_STATE = (typeof VM_POWER_STATE)[keyof typeof VM_POWER_STATE]
export const UPDATE_GUIDANCES = {
REBOOT_HOST: 'reboot_host',
REBOOT_HOST_ON_KERNEL_LIVEPATCH_FAILURE: 'reboot_host_on_kernel_livepatch_failure',
REBOOT_HOST_ON_LIVEPATCH_FAILURE: 'reboot_host_on_livepatch_failure',
REBOOT_HOST_ON_XEN_LIVEPATCH_FAILURE: 'reboot_host_on_xen_livepatch_failure',
RESTART_DEVICE_MODEL: 'restart_device_model',
RESTART_TOOLSTACK: 'restart_toolstack',
RESTART_VM: 'restart_vm',
} as const
export type UPDATE_GUIDANCES = (typeof UPDATE_GUIDANCES)[keyof typeof UPDATE_GUIDANCES]
export const ON_SOFTREBOOT_BEHAVIOR = {
DESTROY: 'destroy',
PRESERVE: 'preserve',
RESTART: 'restart',
SOFT_REBOOT: 'soft_reboot',
} as const
export type ON_SOFTREBOOT_BEHAVIOR = (typeof ON_SOFTREBOOT_BEHAVIOR)[keyof typeof ON_SOFTREBOOT_BEHAVIOR]
export const ON_NORMAL_EXIT = {
DESTROY: 'destroy',
RESTART: 'restart',
} as const
export type ON_NORMAL_EXIT = (typeof ON_NORMAL_EXIT)[keyof typeof ON_NORMAL_EXIT]
export const VM_OPERATIONS = {
ASSERT_OPERATION_VALID: 'assert_operation_valid',
AWAITING_MEMORY_LIVE: 'awaiting_memory_live',
CALL_PLUGIN: 'call_plugin',
CHANGING_DYNAMIC_RANGE: 'changing_dynamic_range',
CHANGING_MEMORY_LIMITS: 'changing_memory_limits',
CHANGING_MEMORY_LIVE: 'changing_memory_live',
CHANGING_NVRAM: 'changing_NVRAM',
CHANGING_SHADOW_MEMORY: 'changing_shadow_memory',
CHANGING_SHADOW_MEMORY_LIVE: 'changing_shadow_memory_live',
CHANGING_STATIC_RANGE: 'changing_static_range',
CHANGING_VCPUS: 'changing_VCPUs',
CHANGING_VCPUS_LIVE: 'changing_VCPUs_live',
CHECKPOINT: 'checkpoint',
CLEAN_REBOOT: 'clean_reboot',
CLEAN_SHUTDOWN: 'clean_shutdown',
CLONE: 'clone',
COPY: 'copy',
CREATE_TEMPLATE: 'create_template',
CREATE_VTPM: 'create_vtpm',
CSVM: 'csvm',
DATA_SOURCE_OP: 'data_source_op',
DESTROY: 'destroy',
EXPORT: 'export',
GET_BOOT_RECORD: 'get_boot_record',
HARD_REBOOT: 'hard_reboot',
HARD_SHUTDOWN: 'hard_shutdown',
IMPORT: 'import',
MAKE_INTO_TEMPLATE: 'make_into_template',
METADATA_EXPORT: 'metadata_export',
MIGRATE_SEND: 'migrate_send',
PAUSE: 'pause',
POOL_MIGRATE: 'pool_migrate',
POWER_STATE_RESET: 'power_state_reset',
PROVISION: 'provision',
QUERY_SERVICES: 'query_services',
RESUME: 'resume',
RESUME_ON: 'resume_on',
REVERT: 'revert',
REVERTING: 'reverting',
SEND_SYSRQ: 'send_sysrq',
SEND_TRIGGER: 'send_trigger',
SHUTDOWN: 'shutdown',
SNAPSHOT: 'snapshot',
SNAPSHOT_WITH_QUIESCE: 'snapshot_with_quiesce',
START: 'start',
START_ON: 'start_on',
SUSPEND: 'suspend',
UNPAUSE: 'unpause',
UPDATE_ALLOWED_OPERATIONS: 'update_allowed_operations',
} as const
export type VM_OPERATIONS = (typeof VM_OPERATIONS)[keyof typeof VM_OPERATIONS]
export const ON_CRASH_BEHAVIOUR = {
COREDUMP_AND_DESTROY: 'coredump_and_destroy',
COREDUMP_AND_RESTART: 'coredump_and_restart',
DESTROY: 'destroy',
PRESERVE: 'preserve',
RENAME_RESTART: 'rename_restart',
RESTART: 'restart',
} as const
export type ON_CRASH_BEHAVIOUR = (typeof ON_CRASH_BEHAVIOUR)[keyof typeof ON_CRASH_BEHAVIOUR]
export const DOMAIN_TYPE = {
HVM: 'hvm',
PV: 'pv',
PVH: 'pvh',
PV_IN_PVH: 'pv_in_pvh',
UNSPECIFIED: 'unspecified',
} as const
export type DOMAIN_TYPE = (typeof DOMAIN_TYPE)[keyof typeof DOMAIN_TYPE]
export const TRISTATE_TYPE = {
NO: 'no',
UNSPECIFIED: 'unspecified',
YES: 'yes',
} as const
export type TRISTATE_TYPE = (typeof TRISTATE_TYPE)[keyof typeof TRISTATE_TYPE]
export const VMPP_BACKUP_TYPE = {
CHECKPOINT: 'checkpoint',
SNAPSHOT: 'snapshot',
} as const
export type VMPP_BACKUP_TYPE = (typeof VMPP_BACKUP_TYPE)[keyof typeof VMPP_BACKUP_TYPE]
export const VMPP_BACKUP_FREQUENCY = {
DAILY: 'daily',
HOURLY: 'hourly',
WEEKLY: 'weekly',
} as const
export type VMPP_BACKUP_FREQUENCY = (typeof VMPP_BACKUP_FREQUENCY)[keyof typeof VMPP_BACKUP_FREQUENCY]
export const VMPP_ARCHIVE_FREQUENCY = {
ALWAYS_AFTER_BACKUP: 'always_after_backup',
DAILY: 'daily',
NEVER: 'never',
WEEKLY: 'weekly',
} as const
export type VMPP_ARCHIVE_FREQUENCY = (typeof VMPP_ARCHIVE_FREQUENCY)[keyof typeof VMPP_ARCHIVE_FREQUENCY]
export const VMPP_ARCHIVE_TARGET_TYPE = {
CIFS: 'cifs',
NFS: 'nfs',
NONE: 'none',
} as const
export type VMPP_ARCHIVE_TARGET_TYPE = (typeof VMPP_ARCHIVE_TARGET_TYPE)[keyof typeof VMPP_ARCHIVE_TARGET_TYPE]
export const VMSS_FREQUENCY = {
DAILY: 'daily',
HOURLY: 'hourly',
WEEKLY: 'weekly',
} as const
export type VMSS_FREQUENCY = (typeof VMSS_FREQUENCY)[keyof typeof VMSS_FREQUENCY]
export const VMSS_TYPE = {
CHECKPOINT: 'checkpoint',
SNAPSHOT: 'snapshot',
SNAPSHOT_WITH_QUIESCE: 'snapshot_with_quiesce',
} as const
export type VMSS_TYPE = (typeof VMSS_TYPE)[keyof typeof VMSS_TYPE]
export const VM_APPLIANCE_OPERATION = {
CLEAN_SHUTDOWN: 'clean_shutdown',
HARD_SHUTDOWN: 'hard_shutdown',
SHUTDOWN: 'shutdown',
START: 'start',
} as const
export type VM_APPLIANCE_OPERATION = (typeof VM_APPLIANCE_OPERATION)[keyof typeof VM_APPLIANCE_OPERATION]
export const HOST_ALLOWED_OPERATIONS = {
APPLY_UPDATES: 'apply_updates',
ENABLE: 'enable',
EVACUATE: 'evacuate',
POWER_ON: 'power_on',
PROVISION: 'provision',
REBOOT: 'reboot',
SHUTDOWN: 'shutdown',
VM_MIGRATE: 'vm_migrate',
VM_RESUME: 'vm_resume',
VM_START: 'vm_start',
} as const
export type HOST_ALLOWED_OPERATIONS = (typeof HOST_ALLOWED_OPERATIONS)[keyof typeof HOST_ALLOWED_OPERATIONS]
export const LATEST_SYNCED_UPDATES_APPLIED_STATE = {
NO: 'no',
UNKNOWN: 'unknown',
YES: 'yes',
} as const
export type LATEST_SYNCED_UPDATES_APPLIED_STATE =
(typeof LATEST_SYNCED_UPDATES_APPLIED_STATE)[keyof typeof LATEST_SYNCED_UPDATES_APPLIED_STATE]
export const HOST_DISPLAY = {
DISABLED: 'disabled',
DISABLE_ON_REBOOT: 'disable_on_reboot',
ENABLED: 'enabled',
ENABLE_ON_REBOOT: 'enable_on_reboot',
} as const
export type HOST_DISPLAY = (typeof HOST_DISPLAY)[keyof typeof HOST_DISPLAY]
export const HOST_SCHED_GRAN = {
CORE: 'core',
CPU: 'cpu',
SOCKET: 'socket',
} as const
export type HOST_SCHED_GRAN = (typeof HOST_SCHED_GRAN)[keyof typeof HOST_SCHED_GRAN]
export const HOST_NUMA_AFFINITY_POLICY = {
ANY: 'any',
BEST_EFFORT: 'best_effort',
DEFAULT_POLICY: 'default_policy',
} as const
export type HOST_NUMA_AFFINITY_POLICY = (typeof HOST_NUMA_AFFINITY_POLICY)[keyof typeof HOST_NUMA_AFFINITY_POLICY]
export const NETWORK_OPERATIONS = {
ATTACHING: 'attaching',
} as const
export type NETWORK_OPERATIONS = (typeof NETWORK_OPERATIONS)[keyof typeof NETWORK_OPERATIONS]
export const NETWORK_DEFAULT_LOCKING_MODE = {
DISABLED: 'disabled',
UNLOCKED: 'unlocked',
} as const
export type NETWORK_DEFAULT_LOCKING_MODE =
(typeof NETWORK_DEFAULT_LOCKING_MODE)[keyof typeof NETWORK_DEFAULT_LOCKING_MODE]
export const NETWORK_PURPOSE = {
INSECURE_NBD: 'insecure_nbd',
NBD: 'nbd',
} as const
export type NETWORK_PURPOSE = (typeof NETWORK_PURPOSE)[keyof typeof NETWORK_PURPOSE]
export const VIF_OPERATIONS = {
ATTACH: 'attach',
PLUG: 'plug',
UNPLUG: 'unplug',
} as const
export type VIF_OPERATIONS = (typeof VIF_OPERATIONS)[keyof typeof VIF_OPERATIONS]
export const VIF_LOCKING_MODE = {
DISABLED: 'disabled',
LOCKED: 'locked',
NETWORK_DEFAULT: 'network_default',
UNLOCKED: 'unlocked',
} as const
export type VIF_LOCKING_MODE = (typeof VIF_LOCKING_MODE)[keyof typeof VIF_LOCKING_MODE]
export const VIF_IPV4_CONFIGURATION_MODE = {
NONE: 'None',
STATIC: 'Static',
} as const
export type VIF_IPV4_CONFIGURATION_MODE = (typeof VIF_IPV4_CONFIGURATION_MODE)[keyof typeof VIF_IPV4_CONFIGURATION_MODE]
export const VIF_IPV6_CONFIGURATION_MODE = {
NONE: 'None',
STATIC: 'Static',
} as const
export type VIF_IPV6_CONFIGURATION_MODE = (typeof VIF_IPV6_CONFIGURATION_MODE)[keyof typeof VIF_IPV6_CONFIGURATION_MODE]
export const PIF_IGMP_STATUS = {
DISABLED: 'disabled',
ENABLED: 'enabled',
UNKNOWN: 'unknown',
} as const
export type PIF_IGMP_STATUS = (typeof PIF_IGMP_STATUS)[keyof typeof PIF_IGMP_STATUS]
export const IP_CONFIGURATION_MODE = {
DHCP: 'DHCP',
NONE: 'None',
STATIC: 'Static',
} as const
export type IP_CONFIGURATION_MODE = (typeof IP_CONFIGURATION_MODE)[keyof typeof IP_CONFIGURATION_MODE]
export const IPV6_CONFIGURATION_MODE = {
AUTOCONF: 'Autoconf',
DHCP: 'DHCP',
NONE: 'None',
STATIC: 'Static',
} as const
export type IPV6_CONFIGURATION_MODE = (typeof IPV6_CONFIGURATION_MODE)[keyof typeof IPV6_CONFIGURATION_MODE]
export const PRIMARY_ADDRESS_TYPE = {
IPV4: 'IPv4',
IPV6: 'IPv6',
} as const
export type PRIMARY_ADDRESS_TYPE = (typeof PRIMARY_ADDRESS_TYPE)[keyof typeof PRIMARY_ADDRESS_TYPE]
export const BOND_MODE = {
ACTIVE_BACKUP: 'active-backup',
BALANCE_SLB: 'balance-slb',
LACP: 'lacp',
} as const
export type BOND_MODE = (typeof BOND_MODE)[keyof typeof BOND_MODE]
export const STORAGE_OPERATIONS = {
DESTROY: 'destroy',
FORGET: 'forget',
PBD_CREATE: 'pbd_create',
PBD_DESTROY: 'pbd_destroy',
PLUG: 'plug',
SCAN: 'scan',
UNPLUG: 'unplug',
UPDATE: 'update',
VDI_CLONE: 'vdi_clone',
VDI_CREATE: 'vdi_create',
VDI_DATA_DESTROY: 'vdi_data_destroy',
VDI_DESTROY: 'vdi_destroy',
VDI_DISABLE_CBT: 'vdi_disable_cbt',
VDI_ENABLE_CBT: 'vdi_enable_cbt',
VDI_INTRODUCE: 'vdi_introduce',
VDI_LIST_CHANGED_BLOCKS: 'vdi_list_changed_blocks',
VDI_MIRROR: 'vdi_mirror',
VDI_RESIZE: 'vdi_resize',
VDI_SET_ON_BOOT: 'vdi_set_on_boot',
VDI_SNAPSHOT: 'vdi_snapshot',
} as const
export type STORAGE_OPERATIONS = (typeof STORAGE_OPERATIONS)[keyof typeof STORAGE_OPERATIONS]
export const SR_HEALTH = {
HEALTHY: 'healthy',
RECOVERING: 'recovering',
} as const
export type SR_HEALTH = (typeof SR_HEALTH)[keyof typeof SR_HEALTH]
export const VDI_OPERATIONS = {
BLOCKED: 'blocked',
CLONE: 'clone',
COPY: 'copy',
DATA_DESTROY: 'data_destroy',
DESTROY: 'destroy',
DISABLE_CBT: 'disable_cbt',
ENABLE_CBT: 'enable_cbt',
FORCE_UNLOCK: 'force_unlock',
FORGET: 'forget',
GENERATE_CONFIG: 'generate_config',
LIST_CHANGED_BLOCKS: 'list_changed_blocks',
MIRROR: 'mirror',
RESIZE: 'resize',
RESIZE_ONLINE: 'resize_online',
SET_ON_BOOT: 'set_on_boot',
SNAPSHOT: 'snapshot',
UPDATE: 'update',
} as const
export type VDI_OPERATIONS = (typeof VDI_OPERATIONS)[keyof typeof VDI_OPERATIONS]
export const VDI_TYPE = {
CBT_METADATA: 'cbt_metadata',
CRASHDUMP: 'crashdump',
EPHEMERAL: 'ephemeral',
HA_STATEFILE: 'ha_statefile',
METADATA: 'metadata',
PVS_CACHE: 'pvs_cache',
REDO_LOG: 'redo_log',
RRD: 'rrd',
SUSPEND: 'suspend',
SYSTEM: 'system',
USER: 'user',
} as const
export type VDI_TYPE = (typeof VDI_TYPE)[keyof typeof VDI_TYPE]
export const ON_BOOT = {
PERSIST: 'persist',
RESET: 'reset',
} as const
export type ON_BOOT = (typeof ON_BOOT)[keyof typeof ON_BOOT]
export const VBD_OPERATIONS = {
ATTACH: 'attach',
EJECT: 'eject',
INSERT: 'insert',
PAUSE: 'pause',
PLUG: 'plug',
UNPAUSE: 'unpause',
UNPLUG: 'unplug',
UNPLUG_FORCE: 'unplug_force',
} as const
export type VBD_OPERATIONS = (typeof VBD_OPERATIONS)[keyof typeof VBD_OPERATIONS]
export const VBD_TYPE = {
CD: 'CD',
DISK: 'Disk',
FLOPPY: 'Floppy',
} as const
export type VBD_TYPE = (typeof VBD_TYPE)[keyof typeof VBD_TYPE]
export const VBD_MODE = {
RO: 'RO',
RW: 'RW',
} as const
export type VBD_MODE = (typeof VBD_MODE)[keyof typeof VBD_MODE]
export const VTPM_OPERATIONS = {
DESTROY: 'destroy',
} as const
export type VTPM_OPERATIONS = (typeof VTPM_OPERATIONS)[keyof typeof VTPM_OPERATIONS]
export const PERSISTENCE_BACKEND = {
XAPI: 'xapi',
} as const
export type PERSISTENCE_BACKEND = (typeof PERSISTENCE_BACKEND)[keyof typeof PERSISTENCE_BACKEND]
export const CONSOLE_PROTOCOL = {
RDP: 'rdp',
RFB: 'rfb',
VT100: 'vt100',
} as const
export type CONSOLE_PROTOCOL = (typeof CONSOLE_PROTOCOL)[keyof typeof CONSOLE_PROTOCOL]
export const CLS = {
CERTIFICATE: 'Certificate',
HOST: 'Host',
POOL: 'Pool',
PVS_PROXY: 'PVS_proxy',
SR: 'SR',
VDI: 'VDI',
VM: 'VM',
VMPP: 'VMPP',
VMSS: 'VMSS',
} as const
export type CLS = (typeof CLS)[keyof typeof CLS]
export const TUNNEL_PROTOCOL = {
GRE: 'gre',
VXLAN: 'vxlan',
} as const
export type TUNNEL_PROTOCOL = (typeof TUNNEL_PROTOCOL)[keyof typeof TUNNEL_PROTOCOL]
export const SRIOV_CONFIGURATION_MODE = {
MANUAL: 'manual',
MODPROBE: 'modprobe',
SYSFS: 'sysfs',
UNKNOWN: 'unknown',
} as const
export type SRIOV_CONFIGURATION_MODE = (typeof SRIOV_CONFIGURATION_MODE)[keyof typeof SRIOV_CONFIGURATION_MODE]
export const PGPU_DOM0_ACCESS = {
DISABLED: 'disabled',
DISABLE_ON_REBOOT: 'disable_on_reboot',
ENABLED: 'enabled',
ENABLE_ON_REBOOT: 'enable_on_reboot',
} as const
export type PGPU_DOM0_ACCESS = (typeof PGPU_DOM0_ACCESS)[keyof typeof PGPU_DOM0_ACCESS]
export const ALLOCATION_ALGORITHM = {
BREADTH_FIRST: 'breadth_first',
DEPTH_FIRST: 'depth_first',
} as const
export type ALLOCATION_ALGORITHM = (typeof ALLOCATION_ALGORITHM)[keyof typeof ALLOCATION_ALGORITHM]
export const VGPU_TYPE_IMPLEMENTATION = {
GVT_G: 'gvt_g',
MXGPU: 'mxgpu',
NVIDIA: 'nvidia',
NVIDIA_SRIOV: 'nvidia_sriov',
PASSTHROUGH: 'passthrough',
} as const
export type VGPU_TYPE_IMPLEMENTATION = (typeof VGPU_TYPE_IMPLEMENTATION)[keyof typeof VGPU_TYPE_IMPLEMENTATION]
export const PVS_PROXY_STATUS = {
CACHING: 'caching',
INCOMPATIBLE_PROTOCOL_VERSION: 'incompatible_protocol_version',
INCOMPATIBLE_WRITE_CACHE_MODE: 'incompatible_write_cache_mode',
INITIALISED: 'initialised',
STOPPED: 'stopped',
} as const
export type PVS_PROXY_STATUS = (typeof PVS_PROXY_STATUS)[keyof typeof PVS_PROXY_STATUS]
export const SDN_CONTROLLER_PROTOCOL = {
PSSL: 'pssl',
SSL: 'ssl',
} as const
export type SDN_CONTROLLER_PROTOCOL = (typeof SDN_CONTROLLER_PROTOCOL)[keyof typeof SDN_CONTROLLER_PROTOCOL]
export const VUSB_OPERATIONS = {
ATTACH: 'attach',
PLUG: 'plug',
UNPLUG: 'unplug',
} as const
export type VUSB_OPERATIONS = (typeof VUSB_OPERATIONS)[keyof typeof VUSB_OPERATIONS]
export const CLUSTER_OPERATION = {
ADD: 'add',
DESTROY: 'destroy',
DISABLE: 'disable',
ENABLE: 'enable',
REMOVE: 'remove',
} as const
export type CLUSTER_OPERATION = (typeof CLUSTER_OPERATION)[keyof typeof CLUSTER_OPERATION]
export const CLUSTER_HOST_OPERATION = {
DESTROY: 'destroy',
DISABLE: 'disable',
ENABLE: 'enable',
} as const
export type CLUSTER_HOST_OPERATION = (typeof CLUSTER_HOST_OPERATION)[keyof typeof CLUSTER_HOST_OPERATION]
export const CERTIFICATE_TYPE = {
CA: 'ca',
HOST: 'host',
HOST_INTERNAL: 'host_internal',
} as const
export type CERTIFICATE_TYPE = (typeof CERTIFICATE_TYPE)[keyof typeof CERTIFICATE_TYPE]
// ----- XAPI Stats
type XapiStatsResponse<T> = {
endTimestamp: number
interval: number
stats: T
}
export type XapiStatsGranularity = 'seconds' | 'minutes' | 'hours' | 'days'
export type XapiHostStats = XapiStatsResponse<{
cpus: Record<string, number[]>
ioThroughput: {
r: Record<string, number[]>
w: Record<string, number[]>
}
iops: {
r: Record<string, number[]>
w: Record<string, number[]>
}
iowait: Record<string, number[]>
latency: {
r: Record<string, number[]>
w: Record<string, number[]>
}
load: number[]
memory: number[]
memoryFree: number[]
pifs: {
rx: Record<string, number[]>
tx: Record<string, number[]>
}
}>
export type XapiVmStats = XapiStatsResponse<{
cpus: Record<string, number[]>
iops: {
r: Record<string, number[]>
w: Record<string, number[]>
}
memory: number[]
memoryFree?: number[]
vifs: {
rx: Record<string, number[]>
tx: Record<string, number[]>
}
xvds: {
w: Record<string, number[]>
r: Record<string, number[]>
}
}>

View File

@@ -1,3 +0,0 @@
export * from './common.mjs'
export * from './xen-api.mjs'
export * from './xo.mjs'

View File

@@ -1,7 +0,0 @@
import { Branded } from '../common.mjs'
export type Task = {
id: Branded<'task'>
run: <T>(fn: () => T) => Promise<T>
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,349 +0,0 @@
// Types based on xapi-object-to-xo
import type {
Branded,
DOMAIN_TYPE,
HOST_ALLOWED_OPERATIONS,
HOST_POWER_STATE,
STORAGE_OPERATIONS,
VM_OPERATIONS,
VM_POWER_STATE,
} from './common.mjs'
type BaseXapiXo = {
$pool: XoPool['id']
/**
* @deprecated use $pool instead
*/
$poolId: XoPool['id']
_xapiRef: string
uuid: string
}
type BaseXoVm = BaseXapiXo & {
$VBDs: XoVbd['id'][]
$VGPUs: XoVgpu['id'][]
$container: XoPool['id'] | XoHost['id']
CPUs: {
max: number
number: number
}
PV_args?: string
VGPUs: XoVgpu['id'][]
VIFs: XoVif['id'][]
VTPMs: XoVtpm['id'][]
addresses: Record<string, string>
affinityHost?: XoHost['id']
attachedPcis?: string[]
auto_poweron: boolean
bios_strings: Record<string, string>
blockedOperations: Record<VM_OPERATIONS, string>
boot: Record<string, string>
coresPerSocket?: number
cpuCap?: number | null
cpuMask?: (number | null)[]
cpuWeight?: number | null
creation: Record<string, string>
current_operations: Record<string, VM_OPERATIONS>
docker?: {
containers?: string[]
enabled: boolean
info?: string
process?: string
version?: string
}
expNestedHvm: boolean
hasVendorDevice: boolean
high_availability: string
installTime?: number | null
isFirmwareSupported: boolean
memory: {
dynamic: number[]
size: number
static: number[]
usage?: number
}
mainIpAddress?: string
managementAgentDetected?: boolean
name_description: string
name_label: string
needsVtpm: boolean
nicType?: string
notes?: string
os_version: Record<string, string> | null
other: Record<string, string>
parent?: XoVm['id']
power_state: VM_POWER_STATE
pvDriversDetected?: boolean
pvDriversUpToDate?: boolean
pvDriversVersion?: string
resourceSet?: string
secureBoot: boolean
snapshots: XoVmSnapshot['id'][]
startDelay: number
startTime?: number | null
suspendSr?: XoSr['id']
tags: string[]
vga?: string
videoram?: number
viridian: boolean
virtualizationMode: DOMAIN_TYPE
xenStoreData: Record<string, string>
/**
* @deprecated use pvDriversVersion instead
*/
xentools?:
| false
| {
major: null | number
minor: null | number
version: null | string
}
}
export type XoGroup = {
id: Branded<'group'>
name: string
users: XoUser['id'][]
}
export type XoHost = BaseXapiXo & {
$PBDs: XoPbd['id'][]
$PCIs: XoPci['id'][]
$PGPUs: XoPgpu['id'][]
$PIFs: XoPif['id'][]
PCIs: XoPci['id'][]
PGPUs: XoPgpu['id'][]
PIFs: XoPif['id'][]
/**
* @deprecated use cpus instead
*/
CPUs: Record<string, string>
address?: string
agentStartTime: null | number
bios_string: Record<string, string>
build: string
certificates?: {
fingerprint: string
notAfter: number
}
chipset_info: {
iommu?: boolean
}
controlDomain?: XoVm['id']
cpus: {
cores?: null | number
sockets?: null | number
}
current_operations: Record<string, HOST_ALLOWED_OPERATIONS>
enabled: boolean
hostname?: string
hvmCapable: boolean
id: Branded<'host'>
iscsiIqn: string
license_expiry: null | number
license_params: Record<string, string>
license_server: Record<string, string>
logging?: Record<string, string>
memory: {
size: number
/**
* @deprecated
*/
total?: number
usage: number
}
multipathing: boolean
name_description: string
name_label: string
otherConfig: Record<string, string>
/**
* @deprecated
*/
patches: XoHostPatch['id'][]
power_state: HOST_POWER_STATE
powerOnMode: string
productBrand: string
rebootRequired: boolean
residentVms: XoVm['id'][]
startTime: null | number
supplementalPacks:
| {
author: string
description: string
guidance: string
hosts: XoHost['id'][]
name: string
size: number
version: string
vdi: XoVdi['id']
}[]
| {
author: string
description: string
name: string
version: string
}[]
tags: string[]
type: 'host'
version: string
zstdSupported: boolean
}
export type XoHostPatch = BaseXapiXo & {
id: Branded<'host_patch'>
type: 'host_patch'
}
export type XoPbd = BaseXapiXo & {
id: Branded<'PBD'>
type: 'PBD'
}
export type XoPci = BaseXapiXo & {
id: Branded<'PCI'>
type: 'PCI'
}
export type XoPgpu = BaseXapiXo & {
id: Branded<'PGPU'>
type: 'PGPU'
}
export type XoPif = BaseXapiXo & {
id: Branded<'PIF'>
type: 'PIF'
}
export type XoPool = BaseXapiXo & {
id: Branded<'pool'>
type: 'pool'
}
export type XoSr = BaseXapiXo & {
$PBDs: XoPbd['id'][]
$container: XoPool['id'] | XoHost['id']
VDIs: XoVdi['id'][]
allocationStrategy: 'thin' | 'thick' | 'unknown'
content_type?: string
current_operations: Record<string, STORAGE_OPERATIONS>
id: Branded<'SR'>
inMaintenanceMode: boolean
name_description: string
name_label: string
other_config: Record<string, string>
physical_usage: number | null
shared: boolean
size: number | null
sm_config: Record<string, string>
SR_type?: string
tags: string[]
type: 'SR'
usage: number | null
}
export type XoUser = {
authProviders?: Record<string, string>
email: string
groups: XoGroup['id'][]
id: Branded<'user'>
name: string
permission: string
pw_hash: string
preferences: Record<string, string>
}
export type XoVbd = BaseXapiXo & {
attached: boolean
bootable: boolean
device: string | null
id: Branded<'VBD'>
is_cd_drive: boolean
position?: string
read_only: boolean
type: 'VBD'
VDI: XoVdi['id']
VM: XoVm['id']
}
export type XoVdi = BaseXapiXo & {
id: Branded<'VDI'>
type: 'VDI'
}
export type XoVgpu = BaseXapiXo & {
id: Branded<'VGPU'>
type: 'VGPU'
}
export type XoVif = BaseXapiXo & {
id: Branded<'VIF'>
type: 'VIF'
}
export type XoVm = BaseXoVm & {
id: Branded<'VM'>
type: 'VM'
}
export type XoVmController = BaseXoVm & {
id: Branded<'VM-controller'>
type: 'VM-controller'
}
export type XoVmSnapshot = BaseXoVm & {
$snapshot_of: XoVm['id']
id: Branded<'VM-snapshot'>
snapshot_time: number
suspendVdi?: XoVdi['id']
type: 'VM-snapshot'
}
export type XoVmTemplate = BaseXoVm & {
id: Branded<'VM-template'>
isDefaultTemplate: boolean
template_info: {
arch?: string
disks: {
bootable: true
size: number
SR: string
type: string
}[]
install_methods: string[]
install_repository?: string
}
type: 'VM-template'
}
export type XoVtpm = BaseXapiXo & {
id: Branded<'VTPM'>
type: 'VTPM'
}
export type XapiXoRecord =
| XoHost
| XoPool
| XoSr
| XoVbd
| XoVdi
| XoVgpu
| XoVif
| XoVm
| XoVmController
| XoVmSnapshot
| XoVmTemplate
| XoVtpm
export type XoRecord = XapiXoRecord | XoGroup | XoUser

View File

@@ -1,12 +0,0 @@
{
"compilerOptions": {
"outDir": "./dist",
"declaration": true,
"strict": true,
"module": "ESNext",
"target": "ES2022",
"skipLibCheck": true
},
"include": ["src/**/*"],
"exclude": ["node_modules", "dist"]
}

View File

@@ -7,8 +7,8 @@
"bugs": "https://github.com/vatesfr/xen-orchestra/issues",
"dependencies": {
"@xen-orchestra/async-map": "^0.1.2",
"@xen-orchestra/backups": "^0.58.3",
"@xen-orchestra/fs": "^4.4.0",
"@xen-orchestra/backups": "^0.57.0",
"@xen-orchestra/fs": "^4.3.0",
"filenamify": "^6.0.0",
"getopts": "^2.2.5",
"lodash": "^4.17.15",
@@ -27,7 +27,7 @@
"scripts": {
"postversion": "npm publish --access public"
},
"version": "1.0.29",
"version": "1.0.28",
"license": "AGPL-3.0-or-later",
"author": {
"name": "Vates SAS",

View File

@@ -257,14 +257,7 @@ export class ImportVmBackup {
: await importIncrementalVm(backup, await xapi.getRecord('SR', srRef), {
newMacAddresses,
})
const remoteName = adapter._handler._remote.name
let desc = `Restored on ${formatFilenameDate(+new Date())}`
if (remoteName !== undefined) {
desc += ` from ${remoteName}`
}
if (metadata.vm.name_description) {
desc += ` - ${metadata.vm.name_description}`
}
await Promise.all([
xapi.call('VM.add_tags', vmRef, 'restored from backup'),
xapi.call(
@@ -272,7 +265,13 @@ export class ImportVmBackup {
vmRef,
`${metadata.vm.name_label} (${formatFilenameDate(metadata.timestamp)})`
),
xapi.call('VM.set_name_description', vmRef, desc),
xapi.call(
'VM.set_name_description',
vmRef,
`Restored on ${formatFilenameDate(+new Date())} from ${adapter._handler._remote.name} -
${metadata.vm.name_description}
`
),
])
return {

View File

@@ -700,11 +700,7 @@ export class RemoteAdapter {
}
}
async outputStream(
path,
input,
{ checksum = !this._handler.isEncrypted, maxStreamLength, streamLength, validator = noop } = {}
) {
async outputStream(path, input, { checksum = true, maxStreamLength, streamLength, validator = noop } = {}) {
const container = watchStreamSize(input)
await this._handler.outputStream(path, input, {
checksum,

View File

@@ -288,7 +288,8 @@ test('it finish unterminated merge ', async () => {
// each of the vhd can be a file, a directory, an alias to a file or an alias to a directory
// the message an resulting files should be identical to the output with vhd files which is tested independantly
describe('tests multiple combination ', { concurrency: 1 }, () => {
describe('tests multiple combination ', () => {
for (const useAlias of [true, false]) {
for (const vhdMode of ['file', 'directory']) {
test(`alias : ${useAlias}, mode: ${vhdMode}`, async () => {
@@ -430,6 +431,7 @@ describe('tests multiple combination ', { concurrency: 1 }, () => {
}
}
})
test('it cleans orphan merge states ', async () => {
await handler.writeFile(`${basePath}/.orphan.vhd.merge.json`, '')

View File

@@ -129,29 +129,10 @@ export async function checkAliases(
logWarn('missing target of alias', { alias })
if (remove) {
logInfo('removing alias and non VHD target', { alias, target })
await handler.unlink(target)
await handler.unlink(alias)
}
continue
}
if (err.code === 'EISDIR') {
logWarn('alias is a vhd directory', { alias })
if (remove) {
logInfo('removing vhd directory named as alias', { alias, target })
await VhdAbstract.unlink(handler, alias)
}
continue
}
logWarn('unhandled error while checking alias', { alias, err })
continue
}
if (target === '') {
logWarn('empty target for alias ', { alias })
if (remove) {
logInfo('removing alias and non VHD target', { alias, target })
await handler.unlink(alias)
}
continue
}
if (!isVhdFile(target)) {
@@ -594,7 +575,7 @@ export async function cleanVm(
if (mergedSize) {
// all disks are now key disk
metadata.isVhdDifferencing = {}
for (const id of Object.keys(metadata.vdis ?? {})) {
for (const id of Object.values(metadata.vdis ?? {})) {
metadata.isVhdDifferencing[`${id}.vhd`] = false
}
}

View File

@@ -27,7 +27,7 @@ const LTR_DEFINITIONS = {
copy.date(date.date() - firstDayOfWeek)
// warning, the year in term of week may different from YYYY
// since the computation of the first week of a year is timezone dependant
return copy.format('gggg-ww')
return copy.format('gggg-WW')
}
},
ancestor: 'daily',

View File

@@ -11,6 +11,7 @@ import { MixinXapiWriter } from './_MixinXapiWriter.mjs'
import { listReplicatedVms } from './_listReplicatedVms.mjs'
import { COPY_OF, setVmOtherConfig, BASE_DELTA_VDI } from '../../_otherConfig.mjs'
import assert from 'node:assert'
export class IncrementalXapiWriter extends MixinXapiWriter(AbstractIncrementalWriter) {
async checkBaseVdis(baseUuidToSrcVdi) {
const sr = this._sr
@@ -117,10 +118,9 @@ export class IncrementalXapiWriter extends MixinXapiWriter(AbstractIncrementalWr
const baseReplicatedTo = replicatedVdis.find(
replicatedVdi => replicatedVdi.other_config[COPY_OF] === vdi.other_config[BASE_DELTA_VDI]
)
// baseReplicatedTo can be undefined if a new disk is added and other are already replicated
assert.notStrictEqual(baseReplicatedTo, undefined)
vdi.baseVdi = baseReplicatedTo
} else {
// first replication of this disk
vdi.baseVdi = undefined
}
// ensure the VDI are created on the target SR

View File

@@ -29,7 +29,7 @@
│ └─ <YYYYMMDD>T<HHmmss>.vhd
├─ <YYYYMMDD>T<HHmmss>.json // backup metadata
├─ <YYYYMMDD>T<HHmmss>.xva
└─ <YYYYMMDD>T<HHmmss>.xva.checksum // only on backup before 01/02/2025 or non encrypted
└─ <YYYYMMDD>T<HHmmss>.xva.checksum
```
### with vhd directories

View File

@@ -8,7 +8,7 @@
"type": "git",
"url": "https://github.com/vatesfr/xen-orchestra.git"
},
"version": "0.58.3",
"version": "0.57.0",
"engines": {
"node": ">=14.18"
},
@@ -28,7 +28,7 @@
"@vates/nbd-client": "^3.1.2",
"@vates/parse-duration": "^0.1.1",
"@xen-orchestra/async-map": "^0.1.2",
"@xen-orchestra/fs": "^4.4.0",
"@xen-orchestra/fs": "^4.3.0",
"@xen-orchestra/log": "^0.7.1",
"@xen-orchestra/template": "^0.1.0",
"app-conf": "^3.0.0",
@@ -48,8 +48,8 @@
"tar": "^6.1.15",
"uuid": "^9.0.0",
"value-matcher": "^0.2.0",
"vhd-lib": "^4.11.3",
"xen-api": "^4.7.1",
"vhd-lib": "^4.11.2",
"xen-api": "^4.7.0",
"yazl": "^2.5.1"
},
"devDependencies": {
@@ -59,7 +59,7 @@
"tmp": "^0.2.1"
},
"peerDependencies": {
"@xen-orchestra/xapi": "^8.1.0"
"@xen-orchestra/xapi": "^7.10.0"
},
"license": "AGPL-3.0-or-later",
"author": {

View File

@@ -4,22 +4,10 @@ import { fork } from 'child_process'
const { warn } = createLogger('xo:backups:backupWorker')
const PATH = new URL('_backupWorker.mjs', import.meta.url).pathname
const DEFAULT_INSPECTOR_PORT = 9229
export function runBackupWorker(params, onLog) {
return new Promise((resolve, reject) => {
// run Node inspector on port+1 if --inspect or --inspect-brk
const inspectArg = process.execArgv.find(arg => arg.startsWith('--inspect') || arg.startsWith('--inspect-brk'))
const execArgv = inspectArg
? [
inspectArg.replace(/^(--inspect(-brk)?)(=([^:]+:)?(\d+))?$/, (_, prefix, brk, _fullMatch, host, port) => {
const basePort = port ? parseInt(port) : DEFAULT_INSPECTOR_PORT
return `${prefix}=${host || ''}${basePort + 1}`
}),
]
: []
const worker = fork(PATH, [], { execArgv })
const worker = fork(PATH)
worker.on('exit', (code, signal) => reject(new Error(`worker exited with code ${code} and signal ${signal}`)))
worker.on('error', reject)

View File

@@ -18,7 +18,7 @@
"preferGlobal": true,
"dependencies": {
"golike-defer": "^0.5.1",
"xen-api": "^4.7.1"
"xen-api": "^4.7.0"
},
"scripts": {
"postversion": "npm publish"

View File

@@ -1,7 +1,7 @@
{
"private": false,
"name": "@xen-orchestra/fs",
"version": "4.4.0",
"version": "4.3.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",

View File

@@ -2,11 +2,8 @@ const { pipeline } = require('node:stream')
const { readChunk } = require('@vates/read-chunk')
const crypto = require('crypto')
const CHACHA20 = 'chacha20-poly1305'
const AES256 = 'aes-256-gcm'
export const DEFAULT_ENCRYPTION_ALGORITHM = CHACHA20
export const DEFAULT_ENCRYPTION_ALGORITHM = 'aes-256-gcm'
export const UNENCRYPTED_ALGORITHM = 'none'
export const SUPPORTED_ALGORITHM = new Set([UNENCRYPTED_ALGORITHM, AES256, CHACHA20, DEFAULT_ENCRYPTION_ALGORITHM])
export function isLegacyEncryptionAlgorithm(algorithm) {
return algorithm !== UNENCRYPTED_ALGORITHM && algorithm !== DEFAULT_ENCRYPTION_ALGORITHM
@@ -36,7 +33,7 @@ function getEncryptor(algorithm = DEFAULT_ENCRYPTION_ALGORITHM, key) {
throw error
}
const { ivLength, mode } = info
const authTagLength = ['gcm', 'ccm', 'ocb'].includes(mode) || algorithm === CHACHA20 ? 16 : 0
const authTagLength = ['gcm', 'ccm', 'ocb'].includes(mode) ? 16 : 0
function encryptStream(input) {
return pipeline(

View File

@@ -17,19 +17,19 @@
"xo-lift-remote-immutability": "./liftProtection.mjs"
},
"license": "AGPL-3.0-or-later",
"version": "1.0.17",
"version": "1.0.16",
"engines": {
"node": ">=14.0.0"
},
"dependencies": {
"@vates/async-each": "^1.0.0",
"@xen-orchestra/backups": "^0.58.3",
"@xen-orchestra/backups": "^0.57.0",
"@xen-orchestra/log": "^0.7.1",
"app-conf": "^3.0.0",
"chokidar": "^3.5.3",
"execa": "^5.0.0",
"ms": "^2.1.3",
"vhd-lib": "^4.11.3"
"vhd-lib": "^4.11.2"
},
"devDependencies": {
"rimraf": "^5.0.5",

View File

@@ -1,26 +1,8 @@
# ChangeLog
## **0.8.0** (2025-02-27)
- [i18n] Add Swedish, update Czech and Spanish translations (contributions made by [@xiscoj](https://github.com/xiscoj), [@p-bo](https://github.com/p-bo) and [Jonas](https://translate.vates.tech/user/Jonas/)) (PR [#8294](https://github.com/vatesfr/xen-orchestra/pull/8294))
- [i18n] Merge XO Lite translations files into one file in web-core ([PR #8380](https://github.com/vatesfr/xen-orchestra/pull/8380))
- [Pool/Network]: Display networks and host internal networks information in side panel (PR [#8150](https://github.com/vatesfr/xen-orchestra/pull/8150))
- [Host/Network]: Display pifs information in side panel (PR [#8186](https://github.com/vatesfr/xen-orchestra/pull/8186))
## **0.7.1** (2025-02-04)
- [Host/Console] Fix console sometimes not correctly displayed (PR [#8305](https://github.com/vatesfr/xen-orchestra/pull/8305))
## **0.7.0** (2025-01-30)
## **next**
- Fix persistent scrollbar on the right (PR [#8191](https://github.com/vatesfr/xen-orchestra/pull/8191))
- [Console]: Displays a loader when the console is loading (PR [#8226](https://github.com/vatesfr/xen-orchestra/pull/8226))
- [i18n] Add Spanish translation (contribution made by [@DSJ2](https://github.com/DSJ2)) (PR [#8220](https://github.com/vatesfr/xen-orchestra/pull/8220))
- [Console]: Adding a border when console is focused (PR [#8235](https://github.com/vatesfr/xen-orchestra/pull/8235))
- [Pool/Network]: Display networks and host internal networks lists in pool view (PR [#8147](https://github.com/vatesfr/xen-orchestra/pull/8147))
- [Host/Network]: Display pifs list in host view (PR [#8180](https://github.com/vatesfr/xen-orchestra/pull/8180))
- [Host/Network]: Fix issue with wording in host pif table (PR [8285](https://github.com/vatesfr/xen-orchestra/pull/8285))
- [Pool/Network]: Fix issue with network status (PR [#8284](https://github.com/vatesfr/xen-orchestra/pull/8284))
## **0.6.0** (2024-11-29)

View File

@@ -1,6 +1,6 @@
{
"name": "@xen-orchestra/lite",
"version": "0.8.0",
"version": "0.6.0",
"type": "module",
"scripts": {
"dev": "GIT_HEAD=$(git rev-parse HEAD) vite",
@@ -14,31 +14,31 @@
"type-check": "vue-tsc --build --force tsconfig.type-check.json"
},
"devDependencies": {
"@csstools/postcss-global-data": "^3.0.0",
"@floating-ui/vue": "^1.1.6",
"@fontsource/poppins": "^5.2.5",
"@fortawesome/fontawesome-svg-core": "^6.7.2",
"@fortawesome/free-regular-svg-icons": "^6.7.2",
"@fortawesome/free-solid-svg-icons": "^6.7.2",
"@fortawesome/vue-fontawesome": "^3.0.8",
"@intlify/unplugin-vue-i18n": "^6.0.3",
"@novnc/novnc": "~1.5.0",
"@tsconfig/node18": "^18.2.4",
"@csstools/postcss-global-data": "^2.1.1",
"@floating-ui/vue": "^1.1.5",
"@fortawesome/fontawesome-svg-core": "^6.5.1",
"@fortawesome/free-regular-svg-icons": "^6.5.1",
"@fortawesome/free-solid-svg-icons": "^6.5.1",
"@fortawesome/vue-fontawesome": "^3.0.5",
"@intlify/unplugin-vue-i18n": "^2.0.0",
"@novnc/novnc": "^1.4.0",
"@tsconfig/node18": "^18.2.2",
"@types/d3-time-format": "^4.0.3",
"@types/file-saver": "^2.0.7",
"@types/lodash-es": "^4.17.12",
"@types/node": "^18.19.80",
"@vitejs/plugin-vue": "^5.2.1",
"@vue/tsconfig": "^0.7.0",
"@vueuse/core": "^13.0.0",
"@vueuse/math": "^13.0.0",
"@vueuse/shared": "^13.0.0",
"@xen-orchestra/web-core": "^0.16.0",
"@types/node": "^18.19.7",
"@vitejs/plugin-vue": "^5.1.4",
"@vue/tsconfig": "^0.5.1",
"@vueuse/core": "^10.7.1",
"@vueuse/math": "^10.7.1",
"@vueuse/shared": "^10.7.1",
"@xen-orchestra/web-core": "^0.10.0",
"complex-matcher": "^0.7.1",
"d3-time-format": "^4.1.0",
"decorator-synchronized": "^0.6.0",
"echarts": "^5.4.3",
"file-saver": "^2.0.5",
"highlight.js": "^11.11.1",
"highlight.js": "^11.9.0",
"human-format": "^1.2.1",
"iterable-backoff": "^0.1.0",
"json-rpc-2.0": "^1.7.0",
@@ -46,21 +46,22 @@
"limit-concurrency-decorator": "^0.6.0",
"lodash-es": "^4.17.21",
"make-error": "^1.3.6",
"marked": "^15.0.7",
"marked": "^9.1.5",
"minimist": "^1.2.8",
"npm-run-all": "^4.1.5",
"pinia": "^3.0.1",
"pinia": "^2.2.6",
"placement.js": "^1.0.0-beta.5",
"postcss": "^8.5.3",
"postcss": "^8.4.33",
"postcss-color-function": "^4.1.0",
"postcss-custom-media": "^11.0.5",
"postcss-nested": "^7.0.2",
"typescript": "~5.8.2",
"vite": "^6.2.1",
"vue": "~3.5.13",
"vue-i18n": "^11.1.2",
"vue-router": "^4.5.0",
"vue-tsc": "~2.2.8",
"postcss-custom-media": "^10.0.2",
"postcss-nested": "^6.0.1",
"typescript": "~5.6.3",
"vite": "^5.4.10",
"vue": "~3.5.12",
"vue-echarts": "^6.6.8",
"vue-i18n": "^9.9.0",
"vue-router": "^4.4.0",
"vue-tsc": "^2.1.10",
"zx": "^7.2.3"
},
"private": true,

View File

@@ -138,17 +138,6 @@ const ghApiUploadReleaseAsset = async (releaseId, assetName, file) => {
return JSON.parse(await res.text())
}
const getChangelogForVersion = async (version, changelogPath = './CHANGELOG.md') => {
const changelog = await fs.readFile(changelogPath, 'utf8')
const escapeRegex = str => str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')
const escapedVersion = escapeRegex(version)
const versionRegex = new RegExp(`## \\*\\*${escapedVersion}\\*\\*.*?(?=\\n## \\*\\*|$)`, 's')
const match = changelog.match(versionRegex)
return match ? match[0].trim() : undefined
}
// Validate args and assign defaults -------------------------------------------
const headSha = (await $`git rev-parse HEAD`).stdout.trim()
@@ -342,31 +331,22 @@ if (ghRelease) {
let release = (await ghApiCall('/releases')).find(release => release.tag_name === tag)
if (
release !== undefined &&
(await no(
`Release with tag ${tag} already exists on GitHub (${chalk.blue(
release.html_url
)}). Skip and proceed with upload?`
))
) {
stop()
}
if (release === undefined) {
const releaseNotes = await getChangelogForVersion(version)
if (release !== undefined) {
if (
releaseNotes === undefined &&
(await no(`Could not find changelog for version ${version}. Create release without changelog?`))
await no(
`Release with tag ${tag} already exists on GitHub (${chalk.blue(
release.html_url
)}). Skip and proceed with upload?`
)
) {
stop()
}
} else {
release = await ghApiCall('/releases', 'POST', {
tag_name: tag,
target_commitish: headSha,
name: tag,
draft: true,
body: releaseNotes,
})
console.log(`Created GitHub release ${tag}: ${chalk.blue(release.html_url)}`)

View File

@@ -20,11 +20,11 @@ import AppHeader from '@/components/AppHeader.vue'
import AppLogin from '@/components/AppLogin.vue'
import AppNavigation from '@/components/AppNavigation.vue'
import ModalList from '@/components/ui/modals/ModalList.vue'
import { useChartTheme } from '@/composables/chart-theme.composable'
import { useUnreachableHosts } from '@/composables/unreachable-hosts.composable'
import { usePoolStore } from '@/stores/xen-api/pool.store'
import { useXenApiStore } from '@/stores/xen-api.store'
import VtsTooltipList from '@core/components/tooltip-list/VtsTooltipList.vue'
import { useChartTheme } from '@core/composables/chart-theme.composable'
import { useUiStore } from '@core/stores/ui.store'
import { useActiveElement, useMagicKeys, whenever } from '@vueuse/core'
import { logicAnd } from '@vueuse/math'

View File

@@ -1,14 +1,14 @@
<template>
<header class="app-header">
<UiIcon v-if="uiStore.isMobile" ref="navigationTrigger" :icon="faBars" class="toggle-navigation" />
<UiIcon v-if="isMobile" ref="navigationTrigger" :icon="faBars" class="toggle-navigation" />
<RouterLink :to="{ name: 'home' }">
<img v-if="uiStore.isMobile" alt="XO Lite" src="../assets/logo.svg" />
<img v-if="isMobile" alt="XO Lite" src="../assets/logo.svg" />
<TextLogo v-else />
</RouterLink>
<slot />
<div class="right">
<PoolOverrideWarning as-tooltip />
<XoaButton v-if="uiStore.isDesktop" />
<XoaButton v-if="isDesktop" />
<AccountMenu />
</div>
</header>
@@ -26,6 +26,7 @@ import { faBars } from '@fortawesome/free-solid-svg-icons'
import { storeToRefs } from 'pinia'
const uiStore = useUiStore()
const { isMobile, isDesktop } = storeToRefs(uiStore)
const navigationStore = useNavigationStore()
const { trigger: navigationTrigger } = storeToRefs(navigationStore)

View File

@@ -27,7 +27,7 @@
<FormCheckbox v-model="rememberMe" />
{{ $t('keep-me-logged') }}
</label>
<UiButton size="medium" accent="brand" variant="primary" type="submit" :busy="isConnecting">
<UiButton size="medium" accent="info" variant="primary" type="submit" :busy="isConnecting">
{{ $t('login') }}
</UiButton>
</template>

View File

@@ -1,11 +1,6 @@
<template>
<Transition name="slide">
<nav
v-if="uiStore.isDesktop || isOpen"
ref="navElement"
:class="{ collapsible: uiStore.isMobile }"
class="app-navigation"
>
<nav v-if="isDesktop || isOpen" ref="navElement" :class="{ collapsible: isMobile }" class="app-navigation">
<StoryMenu v-if="route.meta.hasStoryNav" />
<InfraPoolList v-else />
</nav>
@@ -25,6 +20,7 @@ import { useRoute } from 'vue-router'
const route = useRoute()
const uiStore = useUiStore()
const { isMobile, isDesktop } = storeToRefs(uiStore)
const navigationStore = useNavigationStore()
const { isOpen, trigger } = storeToRefs(navigationStore)
@@ -40,7 +36,6 @@ whenever(isOpen, () => {
},
{
ignore: [trigger],
controls: false,
}
)
})

View File

@@ -68,7 +68,7 @@ const isIcon = (maybeIcon: any): maybeIcon is IconDefinition => typeof maybeIcon
gap: 0.1rem;
&:focus-within {
outline: 1px solid var(--color-brand-item-active);
outline: 1px solid var(--color-info-item-active);
}
}
@@ -78,7 +78,7 @@ const isIcon = (maybeIcon: any): maybeIcon is IconDefinition => typeof maybeIcon
}
.form-widget:hover .widget {
border-color: var(--color-brand-item-hover);
border-color: var(--color-info-item-hover);
}
.element {

View File

@@ -1,5 +1,5 @@
<template>
<div v-if="error !== undefined" class="error typo-body-regular-small">
<div v-if="error !== undefined" class="error typo p2-regular">
<UiIcon :icon="faExclamationCircle" />
<span v-if="error.message === 'SESSION_AUTHENTICATION_FAILED'">
{{ $t('password-invalid') }}

View File

@@ -1,7 +1,7 @@
<template>
<div class="no-data">
<img alt="" class="img" src="@/assets/undraw-bug-fixing.svg" />
<p class="text-error typo-h4">{{ $t('error-no-data') }}</p>
<p class="text-error typo h4-medium">{{ $t('error-no-data') }}</p>
</div>
</template>
@@ -18,7 +18,6 @@
width: 17em;
height: 13em;
}
.text-error {
margin: auto;
width: 8em;

View File

@@ -27,6 +27,6 @@
font-weight: 500;
font-size: 2rem;
line-height: 150%;
color: var(--color-brand-txt-base);
color: var(--color-info-txt-base);
}
</style>

View File

@@ -33,7 +33,7 @@ const isRecordNotFound = computed(() => props.isReady && !props.uuidChecker(id.v
}
.spinner {
color: var(--color-brand-txt-base);
color: var(--color-info-txt-base);
display: flex;
margin: auto;
width: 10rem;

View File

@@ -4,7 +4,7 @@
:subtitle="$t('new-features-are-coming')"
:title="$t('xo-lite-under-construction')"
>
<p class="contact typo-body-regular">
<p class="contact typo p1-regular">
{{ $t('do-you-have-needs') }}
<a
href="https://xcp-ng.org/forum/topic/5018/xo-lite-building-an-embedded-ui-in-xcp-ng"

View File

@@ -26,7 +26,7 @@ const className = computed(() => `state-${props.state.toLocaleLowerCase()}`)
<style lang="postcss" scoped>
.power-state-icon {
color: var(--color-brand-txt-item);
color: var(--color-info-txt-item);
&.state-running {
color: var(--color-success-item-base);
@@ -37,7 +37,7 @@ const className = computed(() => `state-${props.state.toLocaleLowerCase()}`)
}
&.state-suspended {
color: var(--color-brand-txt-hover);
color: var(--color-info-txt-hover);
}
&.state-halted {

View File

@@ -0,0 +1,125 @@
<template>
<div ref="vmConsoleContainer" class="vm-console" />
</template>
<script lang="ts" setup>
import { useXenApiStore } from '@/stores/xen-api.store'
import VncClient from '@novnc/novnc/lib/rfb'
import { promiseTimeout } from '@vueuse/shared'
import { fibonacci } from 'iterable-backoff'
import { computed, onBeforeUnmount, ref, watchEffect } from 'vue'
const props = defineProps<{
location: string
isConsoleAvailable: boolean
}>()
const N_TOTAL_TRIES = 8
const FIBONACCI_MS_ARRAY: number[] = Array.from(fibonacci().toMs().take(N_TOTAL_TRIES))
const vmConsoleContainer = ref<HTMLDivElement>()
const xenApiStore = useXenApiStore()
const url = computed(() => {
if (xenApiStore.currentSessionId == null) {
return
}
const _url = new URL(props.location)
_url.protocol = window.location.protocol === 'https:' ? 'wss:' : 'ws:'
_url.searchParams.set('session_id', xenApiStore.currentSessionId)
return _url
})
let vncClient: VncClient | undefined
let nConnectionAttempts = 0
function handleDisconnectionEvent() {
clearVncClient()
if (props.isConsoleAvailable) {
nConnectionAttempts++
if (nConnectionAttempts > N_TOTAL_TRIES) {
console.error('The number of reconnection attempts has been exceeded for:', props.location)
return
}
console.error(
`Connection lost for the remote console: ${props.location}. New attempt in ${
FIBONACCI_MS_ARRAY[nConnectionAttempts - 1]
}ms`
)
createVncConnection()
}
}
function handleConnectionEvent() {
nConnectionAttempts = 0
}
function clearVncClient() {
if (vncClient === undefined) {
return
}
vncClient.removeEventListener('disconnect', handleDisconnectionEvent)
vncClient.removeEventListener('connect', handleConnectionEvent)
vncClient.disconnect()
vncClient = undefined
}
async function createVncConnection() {
if (nConnectionAttempts !== 0) {
await promiseTimeout(FIBONACCI_MS_ARRAY[nConnectionAttempts - 1])
if (vncClient !== undefined) {
// New VNC Client may have been created in the meantime
return
}
}
vncClient = new VncClient(vmConsoleContainer.value!, url.value!.toString(), {
wsProtocols: ['binary'],
})
vncClient.scaleViewport = true
vncClient.addEventListener('disconnect', handleDisconnectionEvent)
vncClient.addEventListener('connect', handleConnectionEvent)
}
watchEffect(() => {
if (url.value === undefined || vmConsoleContainer.value === undefined || !props.isConsoleAvailable) {
return
}
nConnectionAttempts = 0
clearVncClient()
createVncConnection()
})
onBeforeUnmount(() => {
clearVncClient()
})
defineExpose({
sendCtrlAltDel: () => vncClient?.sendCtrlAltDel(),
})
</script>
<style lang="postcss" scoped>
.vm-console {
flex: 1;
max-width: 100%;
& > :deep(div) {
background-color: transparent !important;
}
/* Required because the library adds "margin: auto" to the canvas which makes the canvas centered in space and not aligned to the rest of the layout */
:deep(canvas) {
margin: 0 auto !important;
}
}
</style>

View File

@@ -13,13 +13,17 @@
<script lang="ts" setup>
import TabItem from '@core/components/tab/TabItem.vue'
import { useDisabled } from '@core/composables/disabled.composable'
import { useContext } from '@core/composables/context.composable'
import { DisabledContext } from '@core/context'
import type { RouteLocationRaw } from 'vue-router'
const props = defineProps<{
to: RouteLocationRaw
disabled?: boolean
}>()
const props = withDefaults(
defineProps<{
to: RouteLocationRaw
disabled?: boolean
}>(),
{ disabled: undefined }
)
const isDisabled = useDisabled(() => props.disabled)
const isDisabled = useContext(DisabledContext, () => props.disabled)
</script>

View File

@@ -1,7 +1,7 @@
<template>
<div class="title-bar">
<UiIcon :icon class="icon" />
<div class="title typo-h4">
<div class="title typo h4-medium">
<slot />
</div>
<div class="actions">
@@ -36,7 +36,7 @@ defineProps<{
.icon {
font-size: 2.5rem;
color: var(--color-brand-txt-base);
color: var(--color-info-txt-base);
}
.title {

View File

@@ -60,20 +60,20 @@ const computedData = computed(() => {
}
.progress-item:nth-child(1) {
--progress-bar-color: var(--color-brand-txt-item);
--progress-bar-color: var(--color-info-txt-item);
}
.progress-item:nth-child(2) {
--progress-bar-color: var(--color-brand-txt-active);
--progress-bar-color: var(--color-info-txt-active);
}
.progress-item:nth-child(3) {
--progress-bar-color: var(--color-brand-txt-hover);
--progress-bar-color: var(--color-info-txt-hover);
}
.progress-item {
--progress-bar-height: 1.2rem;
--progress-bar-color: var(--color-brand-item-hover);
--progress-bar-color: var(--color-info-item-hover);
--progress-bar-background-color: var(--color-neutral-background-disabled);
&.warning {

View File

@@ -2,7 +2,7 @@
<UiButton
v-if="xoaFound"
size="medium"
accent="brand"
accent="info"
variant="primary"
:left-icon="faArrowUpRightFromSquare"
class="xoa-button"
@@ -13,7 +13,7 @@
<UiButton
v-else
size="medium"
accent="brand"
accent="info"
variant="primary"
:left-icon="faDownload"
class="xoa-button"

View File

@@ -1,61 +1,53 @@
<template>
<MenuList placement="bottom-end">
<template #trigger="{ open, isOpen }">
<UiAccountMenuButton
v-tooltip="isOpen ? false : { content: $t('settings'), placement: 'left' }"
:selected="isOpen"
size="medium"
@click="open($event)"
/>
</template>
<MenuItem :icon="faGear" @click="openSettings">{{ $t('settings') }}</MenuItem>
<MenuItem :icon="faBook" @click="openUrl('https://docs.xcp-ng.org?utm_campaign=xolite&utm_term=xcpdoc')">
<UiAccountMenuButton
v-tooltip="menu.$isOpen ? false : { content: $t('settings'), placement: 'left' }"
size="medium"
v-bind="omit(menu.$trigger, ['as', 'submenu'])"
/>
<VtsMenuList border v-bind="menu.$target">
<VtsMenuItem :icon="faGear" v-bind="menu.settings">{{ $t('settings') }}</VtsMenuItem>
<VtsMenuItem :icon="faBook" v-bind="menu.documentation">
{{ $t('documentation-name', { name: 'XCP-ng' }) }}
</MenuItem>
<MenuItem
:icon="faHeadset"
@click="openUrl('https://vates.tech/pricing-and-support?utm_campaign=xolite&utm_term=pricing')"
>
{{ $t('professional-support') }}
</MenuItem>
<MenuItem
:icon="faComments"
@click="openUrl('https://xcp-ng.org/forum/topic/4731/xen-orchestra-lite?utm_campaign=xolite&utm_term=forum')"
>
{{ $t('access-forum') }}
</MenuItem>
<MenuItem :icon="faArrowRightFromBracket" class="menu-item-logout" @click="logout">
</VtsMenuItem>
<VtsMenuItem :icon="faHeadset" v-bind="menu.support">{{ $t('professional-support') }}</VtsMenuItem>
<VtsMenuItem :icon="faComments" v-bind="menu.forum">{{ $t('access-forum') }}</VtsMenuItem>
<VtsMenuItem :icon="faArrowRightFromBracket" class="menu-item-logout" v-bind="menu.logout">
{{ $t('log-out') }}
</MenuItem>
</MenuList>
</VtsMenuItem>
</VtsMenuList>
</template>
<script lang="ts" setup>
import { useXenApiStore } from '@/stores/xen-api.store'
import MenuItem from '@core/components/menu/MenuItem.vue'
import MenuList from '@core/components/menu/MenuList.vue'
import VtsMenuItem from '@core/components/menu/VtsMenuItem.vue'
import VtsMenuList from '@core/components/menu/VtsMenuList.vue'
import UiAccountMenuButton from '@core/components/ui/account-menu-button/UiAccountMenuButton.vue'
import { vTooltip } from '@core/directives/tooltip.directive'
import { action, link, routerLink, useMenuToggle } from '@core/packages/menu'
import { faArrowRightFromBracket, faBook, faComments, faGear, faHeadset } from '@fortawesome/free-solid-svg-icons'
import { nextTick } from 'vue'
import { objectOmit as omit } from '@vueuse/shared'
import { useRouter } from 'vue-router'
const router = useRouter()
const logout = () => {
const xenApiStore = useXenApiStore()
xenApiStore.disconnect()
nextTick(() => router.push({ name: 'home' }))
}
const openUrl = (url: string) => {
window.open(url, '_blank', 'noopener noreferrer')
}
const openSettings = () => router.push({ name: 'settings' })
const menu = useMenuToggle({
placement: 'bottom-end',
items: {
settings: routerLink({ name: 'settings' }),
documentation: link('https://docs.xcp-ng.org?utm_campaign=xolite&utm_term=xcpdoc'),
support: link('https://vates.tech/pricing-and-support?utm_campaign=xolite&utm_term=pricing'),
forum: link('https://xcp-ng.org/forum/topic/4731/xen-orchestra-lite?utm_campaign=xolite&utm_term=forum'),
logout: action(async () => {
await useXenApiStore().disconnect()
void router.push({ name: 'home' })
}),
},
})
</script>
<style lang="postcss" scoped>
.menu-item-logout {
:deep(.menu-item-logout) {
color: var(--color-danger-txt-base);
}
</style>

View File

@@ -3,8 +3,8 @@
</template>
<script lang="ts" setup>
import type { LinearChartData, ValueFormatter } from '@core/types/chart'
import { IK_CHART_VALUE_FORMATTER } from '@core/utils/injection-keys.util'
import type { LinearChartData, ValueFormatter } from '@/types/chart'
import { IK_CHART_VALUE_FORMATTER } from '@/types/injection-keys'
import { utcFormat } from 'd3-time-format'
import type { EChartsOption } from 'echarts'
import { LineChart } from 'echarts/charts'

View File

@@ -7,23 +7,23 @@
v-if="unreadEventsCount > 0"
:value="unreadEventsCount"
accent="success"
variant="primary"
size="small"
variant="primary"
/>
</TabItem>
<TabItem v-bind="tab(TAB.SLOTS, slotParams)">Slots</TabItem>
<TabItem v-bind="tab(TAB.SETTINGS, settingParams)">Settings</TabItem>
<MenuList placement="bottom">
<template #trigger="{ open, isOpen }">
<TabItem :active="isOpen" :disabled="presets === undefined" class="preset-tab" @click="open">
<UiIcon :icon="faSliders" />
Presets
</TabItem>
</template>
<MenuItem v-for="(preset, label) in presets" :key="label" @click="applyPreset(preset)">
{{ label }}
</MenuItem>
</MenuList>
<TabItem class="preset-tab" v-bind="presetMenu.$trigger">
<UiIcon :icon="faSliders" />
Presets
</TabItem>
<Teleport to="body">
<VtsMenuList border v-bind="presetMenu.$target">
<VtsMenuItem v-for="(preset, label) in presets" :key="label" v-bind="presetMenu[label]">
{{ label }}
</VtsMenuItem>
</VtsMenuList>
</Teleport>
</TabList>
<div :class="{ 'full-width': fullWidthComponent }" class="tabs">
@@ -43,8 +43,8 @@
<template #right>
<UiButton
v-if="eventsLog.length > 0"
accent="info"
size="medium"
accent="brand"
variant="tertiary"
@click="eventsLog = []"
>
@@ -91,12 +91,13 @@ import {
ModelParam,
type Param,
} from '@/libs/story/story-param'
import MenuItem from '@core/components/menu/MenuItem.vue'
import MenuList from '@core/components/menu/MenuList.vue'
import VtsMenuItem from '@core/components/menu/VtsMenuItem.vue'
import VtsMenuList from '@core/components/menu/VtsMenuList.vue'
import TabItem from '@core/components/tab/TabItem.vue'
import TabList from '@core/components/tab/TabList.vue'
import UiButton from '@core/components/ui/button/UiButton.vue'
import UiCounter from '@core/components/ui/counter/UiCounter.vue'
import { action, useMenuToggle } from '@core/packages/menu'
import { faSliders } from '@fortawesome/free-solid-svg-icons'
import 'highlight.js/styles/github-dark.css'
import { uniqueId, upperFirst } from 'lodash-es'
@@ -266,6 +267,17 @@ const applyPreset = (preset: { props?: Record<string, any>; settings?: Record<st
})
}
}
const presetMenu = useMenuToggle({
placement: 'bottom-end',
items: computed(() =>
Object.fromEntries(
Object.entries(props.presets ?? {}).map(([label, preset]) => {
return [label, action(() => applyPreset(preset))]
})
)
),
})
</script>
<style lang="postcss" scoped>

View File

@@ -3,13 +3,13 @@
<li v-for="[key, node] in tree" :key="key">
<span
v-if="node.children.size > 0"
class="directory typo-body-bold"
class="directory typo p1-medium"
@click="emit('toggleDirectory', node.directory)"
>
<UiIcon :icon="isOpen(node.directory) ? faFolderOpen : faFolderClosed" />
{{ formatName(key) }}
</span>
<RouterLink v-else :to="node.path" class="link typo-body-regular">
<RouterLink v-else :to="node.path" class="link typo p1-regular">
<UiIcon :icon="faFile" />
{{ formatName(key) }}
</RouterLink>

View File

@@ -1,5 +1,5 @@
<template>
<table class="story-params-table typo-body-regular-small">
<table class="story-params-table typo p2-regular">
<slot />
</table>
</template>
@@ -27,7 +27,7 @@
}
&:nth-child(odd) {
background-color: var(--color-brand-background-selected);
background-color: var(--color-info-background-selected);
}
}

View File

@@ -3,7 +3,7 @@
v-if="isSelectWidget(widget)"
v-model="model"
:wrapper-attrs="{ class: 'full-width' }"
class="typo-body-regular-small"
class="typo p2-regular"
>
<option v-if="!required && model === undefined" :value="undefined" />
<option v-for="choice in widget.choices" :key="choice.label" :value="choice.value">
@@ -19,9 +19,9 @@
<div v-else-if="isBooleanWidget(widget)">
<FormCheckbox v-model="model" />
</div>
<FormInput v-else-if="isNumberWidget(widget)" v-model.number="model" type="number" class="typo-body-regular-small" />
<FormInput v-else-if="isTextWidget(widget)" v-model="model" class="typo-body-regular-small" />
<FormJson v-else-if="isObjectWidget(widget)" v-model="model" class="typo-body-regular-small" />
<FormInput v-else-if="isNumberWidget(widget)" v-model.number="model" type="number" class="typo p2-regular" />
<FormInput v-else-if="isTextWidget(widget)" v-model="model" class="typo p2-regular" />
<FormJson v-else-if="isObjectWidget(widget)" v-model="model" class="typo p2-regular" />
</template>
<script lang="ts" setup>

View File

@@ -16,19 +16,23 @@
<script lang="ts" setup>
import UiIcon from '@/components/ui/icon/UiIcon.vue'
import { useContext } from '@/composables/context.composable'
import { DisabledContext } from '@/context'
import { IK_CHECKBOX_TYPE, IK_FORM_HAS_LABEL } from '@/types/injection-keys'
import { useDisabled } from '@core/composables/disabled.composable'
import { faCheck, faCircle, faMinus } from '@fortawesome/free-solid-svg-icons'
import { useVModel } from '@vueuse/core'
import { computed, type HTMLAttributes, inject, useAttrs } from 'vue'
defineOptions({ inheritAttrs: false })
const props = defineProps<{
modelValue?: unknown
disabled?: boolean
wrapperAttrs?: HTMLAttributes
}>()
const props = withDefaults(
defineProps<{
modelValue?: unknown
disabled?: boolean
wrapperAttrs?: HTMLAttributes
}>(),
{ disabled: undefined }
)
const emit = defineEmits<{
'update:modelValue': [value: boolean]
@@ -42,7 +46,7 @@ const hasLabel = inject(
IK_FORM_HAS_LABEL,
computed(() => false)
)
const isDisabled = useDisabled(() => props.disabled)
const isDisabled = useContext(DisabledContext, () => props.disabled)
const icon = computed(() => {
if (type !== 'checkbox') {
return faCircle
@@ -79,7 +83,7 @@ const isIndeterminate = computed(() => (type === 'checkbox' || type === 'toggle'
.input.indeterminate + .fake-checkbox > .icon {
opacity: 1;
color: var(--color-brand-txt-item);
color: var(--color-info-txt-item);
}
}
@@ -141,7 +145,7 @@ const isIndeterminate = computed(() => (type === 'checkbox' || type === 'toggle'
.icon {
font-size: var(--checkbox-icon-size);
position: absolute;
color: var(--color-brand-txt-item);
color: var(--color-info-txt-item);
filter: drop-shadow(0 0.0625em 0.5em rgba(0, 0, 0, 0.1)) drop-shadow(0 0.1875em 0.1875em rgba(0, 0, 0, 0.06))
drop-shadow(0 0.1875em 0.25em rgba(0, 0, 0, 0.08));
@@ -160,7 +164,7 @@ const isIndeterminate = computed(() => (type === 'checkbox' || type === 'toggle'
background-color: var(--background-color);
box-shadow: var(--shadow-100);
--border-color: var(--color-brand-item-base);
--border-color: var(--color-info-item-base);
}
.input:disabled {
@@ -171,32 +175,32 @@ const isIndeterminate = computed(() => (type === 'checkbox' || type === 'toggle'
&:checked + .fake-checkbox {
--border-color: transparent;
--background-color: var(--color-brand-item-disabled);
--background-color: var(--color-info-item-disabled);
}
}
.input:not(:disabled) {
&:hover + .fake-checkbox,
&:focus + .fake-checkbox {
--border-color: var(--color-brand-item-hover);
--border-color: var(--color-info-item-hover);
}
&:active + .fake-checkbox {
--border-color: var(--color-brand-item-active);
--border-color: var(--color-info-item-active);
}
&:checked + .fake-checkbox {
--border-color: transparent;
--background-color: var(--color-brand-item-base);
--background-color: var(--color-info-item-base);
}
&:checked:hover + .fake-checkbox,
&:checked:focus + .fake-checkbox {
--background-color: var(--color-brand-item-hover);
--background-color: var(--color-info-item-hover);
}
&:checked:active + .fake-checkbox {
--background-color: var(--color-brand-item-active);
--background-color: var(--color-info-item-active);
}
}
</style>

View File

@@ -53,10 +53,9 @@
<script lang="ts" setup>
import UiIcon from '@/components/ui/icon/UiIcon.vue'
import { useContext } from '@/composables/context.composable'
import { ColorContext } from '@/context'
import { ColorContext, DisabledContext } from '@/context'
import type { Color } from '@/types'
import { IK_INPUT_ID, IK_INPUT_TYPE } from '@/types/injection-keys'
import { useDisabled } from '@core/composables/disabled.composable'
import type { IconDefinition } from '@fortawesome/fontawesome-common-types'
import { faAngleDown } from '@fortawesome/free-solid-svg-icons'
import { useTextareaAutosize, useVModel } from '@vueuse/core'
@@ -64,19 +63,22 @@ import { computed, type HTMLAttributes, inject, nextTick, ref, useAttrs, watch }
defineOptions({ inheritAttrs: false })
const props = defineProps<{
id?: string
modelValue?: any
color?: Color
before?: IconDefinition | string
after?: IconDefinition | string
beforeWidth?: string
afterWidth?: string
disabled?: boolean
required?: boolean
right?: boolean
wrapperAttrs?: HTMLAttributes
}>()
const props = withDefaults(
defineProps<{
id?: string
modelValue?: any
color?: Color
before?: IconDefinition | string
after?: IconDefinition | string
beforeWidth?: string
afterWidth?: string
disabled?: boolean
required?: boolean
right?: boolean
wrapperAttrs?: HTMLAttributes
}>(),
{ disabled: undefined }
)
const emit = defineEmits<{
'update:modelValue': [value: any]
@@ -92,7 +94,7 @@ const value = useVModel(props, 'modelValue', emit)
const isEmpty = computed(() => props.modelValue == null || String(props.modelValue).trim() === '')
const inputType = inject(IK_INPUT_TYPE, 'input')
const isDisabled = useDisabled(() => props.disabled)
const isDisabled = useContext(DisabledContext, () => props.disabled)
const wrapperClass = computed(() => [
`form-${inputType}`,

View File

@@ -1,7 +1,7 @@
<template>
<div class="form-input-wrapper">
<div v-if="label !== undefined || learnMoreUrl !== undefined" class="label-container">
<label :class="[light ? 'typo-body-regular light' : 'typo-body-bold-small']" :for="id" class="label">
<label :class="[light ? 'p1-regular light' : 'h7-semi-bold']" :for="id" class="label typo">
<UiIcon :icon />
{{ label }}
</label>
@@ -36,26 +36,28 @@
<script lang="ts" setup>
import UiIcon from '@/components/ui/icon/UiIcon.vue'
import { useContext } from '@/composables/context.composable'
import { ColorContext } from '@/context'
import { ColorContext, DisabledContext } from '@/context'
import type { Color } from '@/types'
import { IK_FORM_HAS_LABEL, IK_INPUT_ID } from '@/types/injection-keys'
import { useDisabled } from '@core/composables/disabled.composable'
import type { IconDefinition } from '@fortawesome/fontawesome-common-types'
import { faInfoCircle } from '@fortawesome/free-solid-svg-icons'
import { uniqueId } from 'lodash-es'
import { computed, provide } from 'vue'
const props = defineProps<{
label?: string
id?: string
icon?: IconDefinition
learnMoreUrl?: string
warning?: string
error?: string
help?: string
disabled?: boolean
light?: boolean
}>()
const props = withDefaults(
defineProps<{
label?: string
id?: string
icon?: IconDefinition
learnMoreUrl?: string
warning?: string
error?: string
help?: string
disabled?: boolean
light?: boolean
}>(),
{ disabled: undefined }
)
const id = computed(() => props.id ?? uniqueId('form-input-'))
provide(IK_INPUT_ID, id)
@@ -78,7 +80,7 @@ provide(
)
useContext(ColorContext, color)
useDisabled(() => props.disabled)
useContext(DisabledContext, () => props.disabled)
</script>
<style lang="postcss" scoped>
@@ -124,7 +126,7 @@ useDisabled(() => props.disabled)
align-items: center;
gap: 0.5rem;
text-decoration: none;
color: var(--color-brand-txt-base);
color: var(--color-info-txt-base);
& > span {
text-decoration: underline;

View File

@@ -1,7 +1,7 @@
<template>
<div :class="{ collapsible }" class="form-section">
<fieldset class="fieldset">
<legend class="legend typo-h4" @click="toggleCollapse">
<legend class="legend typo h4-medium" @click="toggleCollapse">
{{ label }}
<UiIcon :icon class="collapse-icon" />
</legend>
@@ -53,7 +53,7 @@ whenever(
<style lang="postcss" scoped>
.collapsible {
padding: 1rem 1.5rem;
background-color: var(--color-brand-background-selected);
background-color: var(--color-info-background-selected);
border-radius: 0.8rem;
}
@@ -67,9 +67,9 @@ whenever(
display: flex;
align-items: center;
justify-content: space-between;
color: var(--color-brand-txt-base);
color: var(--color-info-txt-base);
border: none;
border-bottom: 1px solid var(--color-brand-txt-base);
border-bottom: 1px solid var(--color-info-txt-base);
width: 100%;
padding-bottom: 1rem;
@@ -85,6 +85,6 @@ whenever(
}
.collapse-icon {
color: var(--color-brand-txt-base);
color: var(--color-info-txt-base);
}
</style>

View File

@@ -6,7 +6,7 @@
<RouterTab :to="{ name: 'host.console', params: { uuid } }">
{{ $t('console') }}
</RouterTab>
<RouterTab :to="{ name: 'host.network', params: { uuid } }">
<RouterTab :to="{ name: 'host.network', params: { uuid } }" disabled>
{{ $t('network') }}
</RouterTab>
<RouterTab :to="{ name: 'host.tasks', params: { uuid } }" disabled>

View File

@@ -1,460 +0,0 @@
<template>
<UiPanel>
<template #header>
<UiButton
v-tooltip="$t('coming-soon')"
disabled
size="medium"
variant="tertiary"
accent="brand"
:left-icon="faEdit"
>
{{ $t('edit') }}
</UiButton>
<UiButton
v-tooltip="$t('coming-soon')"
disabled
size="medium"
variant="tertiary"
accent="danger"
:left-icon="faTrash"
>
{{ $t('delete') }}
</UiButton>
</template>
<template #default>
<!-- PIF -->
<UiCard class="card">
<UiCardTitle>{{ isBond ? $t('bond') : $t('pif') }}</UiCardTitle>
<div class="content">
<!-- UUID -->
<VtsCardRowKeyValue>
<template #key>
{{ $t('uuid') }}
</template>
<template #value>
{{ pif.uuid }}
</template>
<template #addons>
<VtsIcon
v-if="pif.management"
v-tooltip="$t('management')"
accent="info"
:icon="faCircle"
:overlay-icon="faStar"
/>
<UiButtonIcon
v-tooltip="copied && $t('core.copied')"
:icon="faCopy"
size="medium"
accent="brand"
@click="copy(pif.uuid)"
/>
</template>
</VtsCardRowKeyValue>
<!-- NETWORK -->
<VtsCardRowKeyValue>
<template #key>
{{ $t('network') }}
</template>
<template #value>
<div class="network">
<!-- TODO Remove the span when the link works and the icon is fixed -->
<!--
<UiComplexIcon size="medium">
<VtsIcon :icon="faNetworkWired" accent="current" />
<VtsIcon accent="success" :icon="faCircle" :overlay-icon="faCheck" />
</UiComplexIcon>
<a href="">{{ networkNameLabel }}</a>
-->
<span v-tooltip class="text-ellipsis">{{ network?.name_label }}</span>
</div>
</template>
<template v-if="network?.name_label" #addons>
<UiButtonIcon
v-tooltip="copied && $t('core.copied')"
:icon="faCopy"
size="medium"
accent="brand"
@click="copy(network?.name_label)"
/>
</template>
</VtsCardRowKeyValue>
<!-- DEVICE -->
<VtsCardRowKeyValue>
<template #key>
{{ $t('device') }}
</template>
<template #value>
{{ pif.device }}
</template>
<template v-if="pif.device" #addons>
<UiButtonIcon
v-tooltip="copied && $t('core.copied')"
:icon="faCopy"
size="medium"
accent="brand"
@click="copy(pif.device)"
/>
</template>
</VtsCardRowKeyValue>
<!-- PIF STATUS -->
<VtsCardRowKeyValue>
<template #key>
{{ isBond ? $t('bond-status') : $t('pif-status') }}
</template>
<template #value>
<VtsConnectionStatus :status />
</template>
</VtsCardRowKeyValue>
<!-- PHYSICAL INTERFACE STATUS -->
<VtsCardRowKeyValue>
<template #key>
{{ $t('physical-interface-status') }}
</template>
<template #value>
<VtsConnectionStatus :status="physicalInterfaceStatus" />
</template>
</VtsCardRowKeyValue>
<!-- VLAN -->
<VtsCardRowKeyValue>
<template #key>
{{ $t('vlan') }}
</template>
<template #value>
{{ pif.VLAN === -1 ? $t('none') : pif.VLAN }}
</template>
<template v-if="pif.VLAN !== -1" #addons>
<UiButtonIcon
v-tooltip="copied && $t('core.copied')"
:icon="faCopy"
size="medium"
accent="brand"
@click="copy(String(pif.VLAN))"
/>
</template>
</VtsCardRowKeyValue>
<!-- TAGS -->
<VtsCardRowKeyValue>
<template #key>
{{ $t('tags') }}
</template>
<template #value>
<UiTagsList class="tags value">
<UiTag v-for="tag in network?.tags" :key="tag" accent="info" variant="secondary">
{{ tag }}
</UiTag>
</UiTagsList>
</template>
</VtsCardRowKeyValue>
</div>
</UiCard>
<!-- NETWORK INFORMATION -->
<UiCard class="card">
<UiCardTitle>{{ $t('network-information') }}</UiCardTitle>
<div class="content">
<!-- IP ADDRESSES -->
<div v-if="ipAddresses.length">
<VtsCardRowKeyValue v-for="(ip, index) in ipAddresses" :key="ip">
<template #key>
<div v-if="index === 0">{{ $t('ip-addresses') }}</div>
</template>
<template #value>
<span class="text-ellipsis">{{ ip }}</span>
</template>
<template #addons>
<UiButtonIcon
v-if="ipAddresses.length"
v-tooltip="copied && $t('core.copied')"
:icon="faCopy"
size="medium"
accent="brand"
@click="copy(ip)"
/>
<UiButtonIcon
v-if="index === 0 && ipAddresses.length > 1"
v-tooltip="$t('coming-soon')"
disabled
:icon="faEllipsis"
size="medium"
accent="brand"
/>
</template>
</VtsCardRowKeyValue>
</div>
<VtsCardRowKeyValue v-else>
<template #key>
{{ $t('ip-addresses') }}
</template>
<template #value>
<span class="value" />
</template>
</VtsCardRowKeyValue>
<!-- MAC ADDRESSES -->
<VtsCardRowKeyValue>
<template #key>
{{ $t('mac-address') }}
</template>
<template #value>
{{ pif.MAC }}
</template>
<template v-if="pif.MAC" #addons>
<UiButtonIcon
v-tooltip="copied && $t('core.copied')"
:icon="faCopy"
size="medium"
accent="brand"
@click="copy(pif.MAC)"
/>
</template>
</VtsCardRowKeyValue>
<!-- NETMASK -->
<VtsCardRowKeyValue>
<template #key>
{{ $t('netmask') }}
</template>
<template #value>
<span class="value">{{ pif.netmask }}</span>
</template>
<template v-if="pif.netmask" #addons>
<UiButtonIcon
v-tooltip="copied && $t('core.copied')"
:icon="faCopy"
size="medium"
accent="brand"
@click="copy(String(pif.netmask))"
/>
</template>
</VtsCardRowKeyValue>
<!-- DNS -->
<VtsCardRowKeyValue>
<template #key>
{{ $t('dns') }}
</template>
<template #value>
<span class="value">
{{ pif.DNS }}
</span>
</template>
<template v-if="pif.DNS" #addons>
<UiButtonIcon
v-tooltip="copied && $t('core.copied')"
:icon="faCopy"
size="medium"
accent="brand"
@click="copy(String(pif.DNS))"
/>
</template>
</VtsCardRowKeyValue>
<!-- GATEWAY -->
<VtsCardRowKeyValue>
<template #key>
{{ $t('gateway') }}
</template>
<template #value>
<span class="value">
{{ pif.gateway }}
</span>
</template>
<template v-if="pif.gateway" #addons>
<UiButtonIcon
v-tooltip="copied && $t('core.copied')"
:icon="faCopy"
size="medium"
accent="brand"
@click="copy(String(pif.gateway))"
/>
</template>
</VtsCardRowKeyValue>
<!-- IP CONFIGURATION MODE -->
<VtsCardRowKeyValue>
<template #key>
{{ $t('ip-mode') }}
</template>
<template #value>
{{ ipConfigurationMode }}
</template>
</VtsCardRowKeyValue>
<!-- BOND DEVICES -->
<div>
<VtsCardRowKeyValue v-for="(device, index) in bondDevices" :key="device">
<template #key>
<div v-if="index === 0">{{ $t('bond-devices') }}</div>
</template>
<template #value>
<span class="text-ellipsis">{{ device }}</span>
</template>
<template #addons>
<UiButtonIcon
v-if="device"
v-tooltip="copied && $t('core.copied')"
:icon="faCopy"
size="medium"
accent="brand"
@click="copy(device)"
/>
<UiButtonIcon
v-if="index === 0 && bondDevices.length > 1"
v-tooltip="$t('coming-soon')"
disabled
:icon="faEllipsis"
size="medium"
accent="brand"
/>
</template>
</VtsCardRowKeyValue>
</div>
</div>
</UiCard>
<!-- PROPERTIES -->
<UiCard class="card">
<UiCardTitle>{{ $t('properties') }}</UiCardTitle>
<div class="content">
<!-- MTU -->
<VtsCardRowKeyValue>
<template #key>
{{ $t('mtu') }}
</template>
<template #value>
{{ pif.MTU === -1 ? $t('none') : pif.MTU }}
</template>
<template v-if="pif.MTU !== -1" #addons>
<UiButtonIcon
v-tooltip="copied && $t('core.copied')"
:icon="faCopy"
size="medium"
accent="brand"
@click="copy(String(pif.MTU))"
/>
</template>
</VtsCardRowKeyValue>
<!-- SPEED -->
<VtsCardRowKeyValue>
<template #key>
{{ $t('speed') }}
</template>
<template #value>
{{ speed }}
</template>
</VtsCardRowKeyValue>
<!-- NETWORK BLOCK DEVICE -->
<VtsCardRowKeyValue>
<template #key>
{{ $t('network-block-device') }}
</template>
<template #value>
{{ networkPurpose }}
</template>
<template v-if="networkPurpose" #addons>
<UiButtonIcon
v-tooltip="copied && $t('core.copied')"
:icon="faCopy"
size="medium"
accent="brand"
@click="copy(networkPurpose)"
/>
</template>
</VtsCardRowKeyValue>
</div>
</UiCard>
</template>
</UiPanel>
</template>
<script setup lang="ts">
import type { XenApiPif } from '@/libs/xen-api/xen-api.types'
import { useNetworkStore } from '@/stores/xen-api/network.store'
import { usePifMetricsStore } from '@/stores/xen-api/pif-metrics.store'
import { usePifStore } from '@/stores/xen-api/pif.store'
import VtsCardRowKeyValue from '@core/components/card/VtsCardRowKeyValue.vue'
import VtsConnectionStatus from '@core/components/connection-status/VtsConnectionStatus.vue'
import VtsIcon from '@core/components/icon/VtsIcon.vue'
import UiButton from '@core/components/ui/button/UiButton.vue'
import UiButtonIcon from '@core/components/ui/button-icon/UiButtonIcon.vue'
import UiCard from '@core/components/ui/card/UiCard.vue'
import UiCardTitle from '@core/components/ui/card-title/UiCardTitle.vue'
import UiPanel from '@core/components/ui/panel/UiPanel.vue'
import UiTag from '@core/components/ui/tag/UiTag.vue'
import UiTagsList from '@core/components/ui/tag/UiTagsList.vue'
import { vTooltip } from '@core/directives/tooltip.directive'
import { faCircle, faCopy, faEdit, faEllipsis, faStar, faTrash } from '@fortawesome/free-solid-svg-icons'
import { useClipboard } from '@vueuse/core'
import humanFormat from 'human-format'
import { computed } from 'vue'
import { useI18n } from 'vue-i18n'
const { pif } = defineProps<{
pif: XenApiPif
}>()
const { getByOpaqueRef: getPifMetricsByOpaqueRef, getPifCarrier } = usePifMetricsStore().subscribe()
const { getByOpaqueRef: getNetworkByOpaqueRef } = useNetworkStore().subscribe()
const { getBondsDevices, isBondMaster } = usePifStore().subscribe()
const { t } = useI18n()
const ipAddresses = computed(() => [pif.IP, ...pif.IPv6].filter(ip => ip))
const network = computed(() => getNetworkByOpaqueRef(pif.network))
const networkPurpose = computed(() => (network.value?.purpose?.[0] ? t('on') : t('off')))
const status = computed(() => (pif.currently_attached ? 'connected' : 'disconnected'))
const physicalInterfaceStatus = computed(() => (getPifCarrier(pif) ? 'connected' : 'physically-disconnected'))
const ipConfigurationMode = computed(() => {
switch (pif.ip_configuration_mode) {
case 'Static':
return t('static')
case 'DHCP':
return t('dhcp')
default:
return t('none')
}
})
const bondDevices = computed(() => getBondsDevices(pif))
const isBond = computed(() => isBondMaster(pif))
const speed = computed(() => {
const speed = getPifMetricsByOpaqueRef(pif.metrics)?.speed || 0
const speedInBytes = speed * 1000000
return humanFormat(speedInBytes, {
scale: 'SI',
unit: 'b/s',
maxDecimals: 2,
})
})
const { copy, copied } = useClipboard()
</script>
<style scoped lang="postcss">
.card {
gap: 1.6rem;
.content {
display: flex;
flex-direction: column;
gap: 0.8rem;
}
.network {
display: flex;
gap: 0.8rem;
}
.tags {
width: 100%;
display: flex;
gap: 0.8rem;
}
.value:empty::before {
content: '-';
}
}
</style>

View File

@@ -1,304 +0,0 @@
<template>
<div class="host-pif-table">
<UiTitle>
{{ $t('pifs') }}
<template #actions>
<UiButton
v-tooltip="$t('coming-soon')"
disabled
:left-icon="faPlus"
variant="secondary"
accent="brand"
size="medium"
>
{{ $t('scan-pifs') }}
</UiButton>
</template>
</UiTitle>
<div class="container">
<div class="table-actions">
<UiQuerySearchBar @search="(value: string) => (searchQuery = value)" />
<UiTableActions :title="$t('table-actions')">
<UiButton
v-tooltip="$t('coming-soon')"
disabled
:left-icon="faEdit"
variant="tertiary"
accent="brand"
size="medium"
>
{{ $t('edit') }}
</UiButton>
<UiButton
v-tooltip="$t('coming-soon')"
disabled
:left-icon="faTrash"
variant="tertiary"
accent="danger"
size="medium"
>
{{ $t('delete') }}
</UiButton>
</UiTableActions>
<UiTopBottomTable :selected-items="0" :total-items="0" />
</div>
<VtsDataTable :is-ready :has-error :no-data-message="pifs.length === 0 ? $t('no-pif-detected') : undefined">
<template #thead>
<tr>
<template v-for="column of visibleColumns" :key="column.id">
<th v-if="column.id === 'checkbox'" class="checkbox">
<div v-tooltip="$t('coming-soon')">
<UiCheckbox disabled :v-model="areAllSelected" accent="brand" />
</div>
</th>
<th v-else-if="column.id === 'more'" class="more">
<UiButtonIcon v-tooltip="$t('coming-soon')" :icon="faEllipsis" accent="brand" disabled size="small" />
</th>
<th v-else>
<div v-tooltip class="text-ellipsis">
<VtsIcon accent="brand" :icon="headerIcon[column.id]" />
{{ column.label }}
</div>
</th>
</template>
</tr>
</template>
<template #tbody>
<tr
v-for="row of rows"
:key="row.id"
:class="{ selected: selectedPifId === row.id }"
@click="selectedPifId = row.id"
>
<td
v-for="column of row.visibleColumns"
:key="column.id"
class="typo-body-regular-small"
:class="{ checkbox: column.id === 'checkbox' }"
>
<div v-if="column.id === 'checkbox'" v-tooltip="$t('coming-soon')">
<UiCheckbox v-model="selected" disabled accent="brand" :value="row.id" />
</div>
<UiButtonIcon
v-else-if="column.id === 'more'"
v-tooltip="$t('coming-soon')"
:icon="faEllipsis"
accent="brand"
disabled
size="small"
/>
<div v-else-if="column.id === 'status'" v-tooltip>
<VtsConnectionStatus :status="column.value" />
</div>
<div v-else-if="column.id === 'network'" class="network">
<!-- TODO Remove the span when the link works and the icon is fixed -->
<!--
<UiComplexIcon size="medium" class="icon">
<VtsIcon :icon="faNetworkWired" accent="current" />
<VtsIcon accent="success" :icon="faCircle" :overlay-icon="faCheck" />
</UiComplexIcon>
<a v-tooltip href="" class="text-ellipsis name">{{ column.value.name }}</a>
-->
<span v-tooltip class="text-ellipsis name">{{ column.value.name }}</span>
<VtsIcon
v-if="column.value.management"
v-tooltip="$t('management')"
accent="info"
:icon="faCircle"
:overlay-icon="faStar"
/>
</div>
<div v-else-if="column.id === 'IP'" class="ip-addresses">
<span v-tooltip class="value text-ellipsis">{{ column.value[0] }}</span>
<span v-if="column.value.length > 1" class="typo-body-regular-small more-ips">
{{ `+${column.value.length - 1}` }}
</span>
</div>
<div v-else v-tooltip="{ placement: 'bottom-end' }" class="text-ellipsis">
{{ column.value }}
</div>
</td>
</tr>
</template>
</VtsDataTable>
<VtsStateHero v-if="searchQuery && filteredPifs.length === 0" type="table" image="no-result">
<div>{{ $t('no-result') }}</div>
</VtsStateHero>
<UiTopBottomTable :selected-items="0" :total-items="0" />
</div>
</div>
</template>
<script lang="ts" setup>
import useMultiSelect from '@/composables/multi-select.composable'
import type { XenApiNetwork, XenApiPif } from '@/libs/xen-api/xen-api.types'
import { useNetworkStore } from '@/stores/xen-api/network.store'
import { usePifStore } from '@/stores/xen-api/pif.store'
import VtsConnectionStatus from '@core/components/connection-status/VtsConnectionStatus.vue'
import VtsDataTable from '@core/components/data-table/VtsDataTable.vue'
import VtsIcon from '@core/components/icon/VtsIcon.vue'
import VtsStateHero from '@core/components/state-hero/VtsStateHero.vue'
import UiButton from '@core/components/ui/button/UiButton.vue'
import UiButtonIcon from '@core/components/ui/button-icon/UiButtonIcon.vue'
import UiCheckbox from '@core/components/ui/checkbox/UiCheckbox.vue'
import UiQuerySearchBar from '@core/components/ui/query-search-bar/UiQuerySearchBar.vue'
import UiTableActions from '@core/components/ui/table-actions/UiTableActions.vue'
import UiTitle from '@core/components/ui/title/UiTitle.vue'
import UiTopBottomTable from '@core/components/ui/top-bottom-table/UiTopBottomTable.vue'
import { useRouteQuery } from '@core/composables/route-query.composable'
import { useTable } from '@core/composables/table.composable'
import { vTooltip } from '@core/directives/tooltip.directive'
import type { IconDefinition } from '@fortawesome/fontawesome-common-types'
import {
faAlignLeft,
faAt,
faCaretDown,
faCircle,
faEdit,
faEllipsis,
faPlus,
faPowerOff,
faStar,
faTrash,
} from '@fortawesome/free-solid-svg-icons'
import { noop } from '@vueuse/shared'
import { computed, ref } from 'vue'
import { useI18n } from 'vue-i18n'
const { pifs } = defineProps<{
pifs: XenApiPif[]
}>()
const { isReady, hasError } = usePifStore().subscribe()
const { getByOpaqueRef } = useNetworkStore().subscribe()
const { getPifStatus } = usePifStore().subscribe()
const { t } = useI18n()
const selectedPifId = useRouteQuery('id')
const pifsUuids = computed(() => pifs.map(pif => pif.uuid))
const { selected, areAllSelected } = useMultiSelect(pifsUuids)
const getNetworkName = (networkRef: XenApiNetwork['$ref']) => getByOpaqueRef(networkRef)?.name_label
const getVlanData = (vlan: number) => (vlan !== -1 ? vlan : t('none'))
const getIpAddresses = (pif: XenApiPif) => [pif.IP, ...pif.IPv6].filter(ip => ip)
const getIpConfigurationMode = (ipMode: string) => {
switch (ipMode) {
case 'Static':
return t('static')
case 'DHCP':
return t('dhcp')
default:
return t('none')
}
}
const searchQuery = ref('')
const filteredPifs = computed(() => {
const searchTerm = searchQuery.value.trim().toLocaleLowerCase()
if (!searchTerm) {
return pifs
}
return pifs.filter(pif =>
[...Object.values(pif), getNetworkName(pif.network)].some(value =>
String(value).toLocaleLowerCase().includes(searchTerm)
)
)
})
const { visibleColumns, rows } = useTable('pifs', filteredPifs, {
rowId: record => record.uuid,
columns: define => [
define('checkbox', noop, { label: '', isHideable: false }),
define(
'network',
record => ({
name: getNetworkName(record.network),
management: record.management,
}),
{ label: t('network') }
),
define('device', { label: t('device') }),
define('status', record => getPifStatus(record), { label: t('status') }),
define('VLAN', record => getVlanData(record.VLAN), { label: t('vlan') }),
define('IP', record => getIpAddresses(record), { label: t('ip-addresses') }),
define('MAC', { label: t('mac-addresses') }),
define('ip_configuration_mode', record => getIpConfigurationMode(record.ip_configuration_mode), {
label: t('ip-mode'),
}),
define('more', noop, { label: '', isHideable: false }),
],
})
type PifHeader = 'network' | 'device' | 'status' | 'VLAN' | 'IP' | 'MAC' | 'ip_configuration_mode'
const headerIcon: Record<PifHeader, IconDefinition> = {
network: faAlignLeft,
device: faAlignLeft,
status: faPowerOff,
VLAN: faAlignLeft,
IP: faAt,
MAC: faAt,
ip_configuration_mode: faCaretDown,
}
</script>
<style scoped lang="postcss">
.host-pif-table,
.table-actions,
.container {
display: flex;
flex-direction: column;
}
.host-pif-table {
gap: 2.4rem;
.container,
.table-actions {
gap: 0.8rem;
}
.network {
display: flex;
align-items: center;
gap: 1.8rem;
}
.ip-addresses {
display: flex;
justify-content: space-between;
align-items: center;
.more-ips {
color: var(--color-neutral-txt-secondary);
}
&:has(.value:empty) {
justify-content: center;
}
}
.checkbox,
.more {
width: 4.8rem;
}
.checkbox {
text-align: center;
line-height: 1;
}
.value:empty::before {
content: '-';
}
}
</style>

View File

@@ -3,12 +3,12 @@
<UiTreeItemLabel :icon="faServer" :route="{ name: 'host.console', params: { uuid: host.uuid } }" @toggle="toggle()">
{{ host.name_label || '(Host)' }}
<template #addons>
<VtsIcon v-if="isPoolMaster" v-tooltip="$t('master')" accent="info" :icon="faCircle" :overlay-icon="faStar" />
<UiIcon v-if="isPoolMaster" v-tooltip="$t('master')" :icon="faStar" accent="warning" />
<UiCounter
v-if="isReady"
v-tooltip="$t('running-vm', { count: vmCount })"
:value="vmCount"
accent="brand"
accent="info"
variant="secondary"
size="small"
/>
@@ -28,13 +28,13 @@ import type { XenApiHost } from '@/libs/xen-api/xen-api.types'
import { useHostStore } from '@/stores/xen-api/host.store'
import { usePoolStore } from '@/stores/xen-api/pool.store'
import { useVmStore } from '@/stores/xen-api/vm.store'
import VtsIcon from '@core/components/icon/VtsIcon.vue'
import UiIcon from '@core/components/icon/VtsIcon.vue'
import VtsTreeItem from '@core/components/tree/VtsTreeItem.vue'
import VtsTreeList from '@core/components/tree/VtsTreeList.vue'
import UiCounter from '@core/components/ui/counter/UiCounter.vue'
import UiTreeItemLabel from '@core/components/ui/tree-item-label/UiTreeItemLabel.vue'
import { vTooltip } from '@core/directives/tooltip.directive'
import { faCircle, faServer, faStar } from '@fortawesome/free-solid-svg-icons'
import { faServer, faStar } from '@fortawesome/free-solid-svg-icons'
import { useToggle } from '@vueuse/shared'
import { computed } from 'vue'

View File

@@ -14,7 +14,7 @@
<div v-if="newFilters.some(filter => filter.isAdvanced)" class="available-properties">
{{ $t('available-properties-for-advanced-filter') }}
<div class="properties typo-body-regular">
<div class="properties typo p1-regular">
<UiBadge v-for="(filter, property) in availableFilters" :key="property" :icon="getFilterIcon(filter)">
{{ property }}
</UiBadge>
@@ -23,7 +23,7 @@
</template>
<template #buttons>
<UiButton size="medium" accent="brand" variant="tertiary" @click="addNewFilter()">
<UiButton size="medium" accent="info" variant="tertiary" @click="addNewFilter()">
{{ $t('add-or') }}
</UiButton>
<ModalDeclineButton />

View File

@@ -6,7 +6,7 @@
</template>
<template #buttons>
<UiButton size="medium" accent="brand" variant="tertiary" @click="formatJson()">
<UiButton size="medium" accent="info" variant="tertiary" @click="formatJson()">
{{ $t('reformat') }}
</UiButton>
<ModalDeclineButton />

View File

@@ -1,109 +0,0 @@
<template>
<tr class="pif-row" :class="{ clickable: pifHost }" @click="pifHost?.redirect()">
<td v-tooltip class="typo-body-regular-small text-ellipsis host-container">
<div v-if="pifHost" class="host">
<UiObjectIcon :state="pifHost.powerState" type="host" size="small" />
<span v-tooltip class="typo-body-regular-small text-ellipsis host-name">
{{ pifHost.label }}
</span>
</div>
<div v-else>
<span>{{ $t('host-unknown') }}</span>
</div>
</td>
<td v-tooltip class="typo-body-regular-small text-ellipsis device">{{ pif.device }}</td>
<td v-tooltip class="typo-body-regular-small status">
<VtsConnectionStatus :status />
</td>
<td>
<UiButtonIcon size="small" accent="brand" :icon="faAngleRight" :disabled="!pifHost" />
</td>
</tr>
</template>
<script setup lang="ts">
import type { XenApiPif } from '@/libs/xen-api/xen-api.types'
import { useHostMetricsStore } from '@/stores/xen-api/host-metrics.store'
import { useHostStore } from '@/stores/xen-api/host.store'
import { usePifStore } from '@/stores/xen-api/pif.store'
import VtsConnectionStatus from '@core/components/connection-status/VtsConnectionStatus.vue'
import UiButtonIcon from '@core/components/ui/button-icon/UiButtonIcon.vue'
import UiObjectIcon from '@core/components/ui/object-icon/UiObjectIcon.vue'
import { vTooltip } from '@core/directives/tooltip.directive'
import { faAngleRight } from '@fortawesome/free-solid-svg-icons'
import { computed } from 'vue'
import { useRouter } from 'vue-router'
const { pif } = defineProps<{
pif: XenApiPif
}>()
const { getByOpaqueRef } = useHostStore().subscribe()
const { isHostRunning } = useHostMetricsStore().subscribe()
const { getPifStatus } = usePifStore().subscribe()
const router = useRouter()
const status = computed(() => getPifStatus(pif))
const pifHost = computed(() => {
const host = getByOpaqueRef(pif.host)
if (!host) {
return
}
return {
label: host.name_label,
powerState: isHostRunning(host) ? 'running' : 'halted',
redirect() {
router.push({
name: 'host.network',
params: { uuid: host.uuid },
query: { id: pif.uuid },
})
},
} as const
})
</script>
<style lang="postcss" scoped>
.pif-row {
&.clickable {
cursor: pointer;
&:hover {
background-color: var(--color-brand-background-hover);
}
}
td {
color: var(--color-neutral-txt-primary);
}
.host-container {
width: 14rem;
max-width: 14rem;
.host {
display: flex;
align-items: center;
gap: 0.8rem;
}
.host-name {
color: var(--color-brand-txt-base);
}
}
.device {
width: 8rem;
max-width: 8rem;
}
.status {
width: 11.5rem;
max-width: 11.5rem;
}
}
</style>

View File

@@ -12,7 +12,7 @@
<RouterTab :to="{ name: 'pool.system', params: { uuid: pool?.uuid } }" disabled>
{{ $t('system') }}
</RouterTab>
<RouterTab :to="{ name: 'pool.network', params: { uuid: pool?.uuid } }">
<RouterTab :to="{ name: 'pool.network', params: { uuid: pool?.uuid } }" disabled>
{{ $t('network') }}
</RouterTab>
<RouterTab :to="{ name: 'pool.storage', params: { uuid: pool?.uuid } }" disabled>

View File

@@ -8,10 +8,10 @@
</UiCardTitle>
<div v-if="!isStarted" class="pre-start">
<div>
<p class="text typo-h4">
<p class="text typo h4-medium">
{{ $t('click-to-display-alarms') }}
</p>
<UiButton size="medium" accent="brand" variant="primary" @click="start">{{ $t('load-now') }}</UiButton>
<UiButton size="medium" accent="info" variant="primary" @click="start">{{ $t('load-now') }}</UiButton>
</div>
<div>
<img alt="" src="@/assets/server-status.svg" />
@@ -25,7 +25,7 @@
<div>
<img alt="" src="@/assets/server-status.svg" />
</div>
<p class="text typo-h4">{{ $t('all-good') }}<br />{{ $t('no-alarm-triggered') }}</p>
<p class="text typo h4-medium">{{ $t('all-good') }}<br />{{ $t('no-alarm-triggered') }}</p>
</div>
<div v-else class="table-container">
<UiTable>

View File

@@ -85,7 +85,7 @@ const hasError = computed(() => hostStoreHasError.value || vmStoreHasError.value
.progress-item {
margin-top: 2.6rem;
--progress-bar-height: 1.2rem;
--progress-bar-color: var(--color-brand-item-base);
--progress-bar-color: var(--color-info-item-base);
--progress-bar-background-color: var(--color-neutral-background-disabled);
&.warning {

View File

@@ -19,16 +19,16 @@ import { formatSize } from '@/libs/utils'
import { RRD_STEP_FROM_STRING } from '@/libs/xapi-stats'
import type { HostStats } from '@/libs/xapi-stats'
import { useHostStore } from '@/stores/xen-api/host.store'
import type { LinearChartData } from '@/types/chart'
import { UiCardTitleLevel } from '@/types/enums'
import { IK_HOST_LAST_WEEK_STATS } from '@/types/injection-keys'
import type { LinearChartData } from '@core/types/chart'
import { map } from 'lodash-es'
import { computed, defineAsyncComponent, inject } from 'vue'
import { useI18n } from 'vue-i18n'
const { t } = useI18n()
const LinearChart = defineAsyncComponent(() => import('@core/components/charts/LinearChart.vue'))
const LinearChart = defineAsyncComponent(() => import('@/components/charts/LinearChart.vue'))
const hostLastWeekStats = inject(IK_HOST_LAST_WEEK_STATS)
const { hasError, isFetching } = useHostStore().subscribe()

View File

@@ -2,18 +2,18 @@
<div class="pool-dashboard-status-item">
<ProgressCircle :max-value="total" :value="active" />
<div class="content">
<h6 class="typo-h6">{{ label }}</h6>
<div class="status-line typo-body-regular">
<h6 class="typo h6-semi-bold">{{ label }}</h6>
<div class="status-line typo p1-regular">
<div class="bullet" />
<div class="label">{{ activeLabel }}</div>
<div class="count">{{ active }}</div>
</div>
<div class="status-line typo-body-regular">
<div class="status-line typo p1-regular">
<div class="bullet inactive" />
<div class="label">{{ inactiveLabel }}</div>
<div class="count">{{ inactive }}</div>
</div>
<div class="total typo-caption-small">
<div class="total typo c2-semi-bold">
{{ $t('total') }} <span>{{ total }}</span>
</div>
</div>

View File

@@ -10,7 +10,7 @@
{{ $t(`alarm-type.${alarm.type}`, { n: alarm.triggerLevel * 100 }) }}
</div>
</td>
<td class="level typo-body-bold-small">
<td class="level typo h7-semi-bold">
<!-- Using `Math.min` because `alarm.level` can be `Infinity` -->
{{ $n(Math.min(alarm.level, 1), 'percent') }}
</td>

View File

@@ -18,14 +18,14 @@ import UiCardTitle from '@/components/ui/UiCardTitle.vue'
import type { HostStats } from '@/libs/xapi-stats'
import { RRD_STEP_FROM_STRING } from '@/libs/xapi-stats'
import { useHostStore } from '@/stores/xen-api/host.store'
import type { LinearChartData, ValueFormatter } from '@/types/chart'
import { UiCardTitleLevel } from '@/types/enums'
import { IK_HOST_LAST_WEEK_STATS } from '@/types/injection-keys'
import type { LinearChartData, ValueFormatter } from '@core/types/chart'
import { sumBy } from 'lodash-es'
import { computed, defineAsyncComponent, inject } from 'vue'
import { useI18n } from 'vue-i18n'
const LinearChart = defineAsyncComponent(() => import('@core/components/charts/LinearChart.vue'))
const LinearChart = defineAsyncComponent(() => import('@/components/charts/LinearChart.vue'))
const { t, n } = useI18n()

View File

@@ -21,14 +21,14 @@ import { formatSize } from '@/libs/utils'
import { RRD_STEP_FROM_STRING } from '@/libs/xapi-stats'
import { useHostMetricsStore } from '@/stores/xen-api/host-metrics.store'
import { useHostStore } from '@/stores/xen-api/host.store'
import type { LinearChartData } from '@/types/chart'
import { UiCardTitleLevel } from '@/types/enums'
import { IK_HOST_LAST_WEEK_STATS } from '@/types/injection-keys'
import type { LinearChartData } from '@core/types/chart'
import { sumBy } from 'lodash-es'
import { computed, defineAsyncComponent, inject } from 'vue'
import { useI18n } from 'vue-i18n'
const LinearChart = defineAsyncComponent(() => import('@core/components/charts/LinearChart.vue'))
const LinearChart = defineAsyncComponent(() => import('@/components/charts/LinearChart.vue'))
const { runningHosts, isFetching, hasError } = useHostStore().subscribe()
const { getHostMemory } = useHostMetricsStore().subscribe()

View File

@@ -1,230 +0,0 @@
<template>
<div class="pool-host-internal-networks-table">
<UiTitle>
{{ $t('host-internal-networks') }}
<template #actions>
<UiButton
v-tooltip="$t('coming-soon')"
disabled
:left-icon="faPlus"
variant="secondary"
accent="brand"
size="medium"
>
{{ $t('new') }}
</UiButton>
</template>
</UiTitle>
<div class="container">
<div class="table-actions">
<UiQuerySearchBar @search="value => (searchQuery = value)" />
<UiTableActions :title="t('table-actions')">
<UiButton
v-tooltip="$t('coming-soon')"
disabled
:left-icon="faEdit"
variant="tertiary"
accent="brand"
size="medium"
>
{{ $t('edit') }}
</UiButton>
<UiButton
v-tooltip="$t('coming-soon')"
disabled
:left-icon="faTrash"
variant="tertiary"
accent="danger"
size="medium"
>
{{ $t('delete') }}
</UiButton>
</UiTableActions>
<UiTopBottomTable :selected-items="0" :total-items="0" @toggle-select-all="toggleSelect" />
</div>
<VtsDataTable
:is-ready
:has-error
:no-data-message="networks.length === 0 ? $t('no-network-detected') : undefined"
>
<template #thead>
<tr>
<template v-for="column of visibleColumns" :key="column.id">
<th v-if="column.id === 'checkbox'" class="checkbox">
<div v-tooltip="$t('coming-soon')">
<UiCheckbox disabled :v-model="areAllSelected" accent="brand" @update:model-value="toggleSelect" />
</div>
</th>
<th v-else-if="column.id === 'more'" class="more">
<UiButtonIcon v-tooltip="$t('coming-soon')" :icon="faEllipsis" accent="brand" disabled size="small" />
</th>
<th v-else>
<div v-tooltip class="text-ellipsis">
<VtsIcon accent="brand" :icon="headerIcon[column.id]" />
{{ column.label }}
</div>
</th>
</template>
</tr>
</template>
<template #tbody>
<tr
v-for="row of rows"
:key="row.id"
:class="{ selected: selectedNetworkId === row.id }"
@click="selectedNetworkId = row.id"
>
<td
v-for="column of row.visibleColumns"
:key="column.id"
class="typo-body-regular-small"
:class="{ checkbox: column.id === 'checkbox' }"
>
<div v-if="column.id === 'checkbox'" v-tooltip="$t('coming-soon')">
<UiCheckbox v-model="selected" disabled accent="brand" :value="row.id" />
</div>
<UiButtonIcon
v-else-if="column.id === 'more'"
v-tooltip="$t('coming-soon')"
:icon="faEllipsis"
accent="brand"
disabled
size="small"
/>
<div v-else v-tooltip="{ placement: 'bottom-end' }" class="value text-ellipsis">
{{ column.value }}
</div>
</td>
</tr>
</template>
</VtsDataTable>
<VtsStateHero v-if="searchQuery && filteredNetworks.length === 0" type="table" image="no-result">
<div>{{ $t('no-result') }}</div>
</VtsStateHero>
<UiTopBottomTable :selected-items="0" :total-items="0" @toggle-select-all="toggleSelect" />
</div>
</div>
</template>
<script setup lang="ts">
import useMultiSelect from '@/composables/multi-select.composable'
import type { XenApiNetwork } from '@/libs/xen-api/xen-api.types'
import { useNetworkStore } from '@/stores/xen-api/network.store'
import VtsDataTable from '@core/components/data-table/VtsDataTable.vue'
import VtsIcon from '@core/components/icon/VtsIcon.vue'
import VtsStateHero from '@core/components/state-hero/VtsStateHero.vue'
import UiButton from '@core/components/ui/button/UiButton.vue'
import UiButtonIcon from '@core/components/ui/button-icon/UiButtonIcon.vue'
import UiCheckbox from '@core/components/ui/checkbox/UiCheckbox.vue'
import UiQuerySearchBar from '@core/components/ui/query-search-bar/UiQuerySearchBar.vue'
import UiTableActions from '@core/components/ui/table-actions/UiTableActions.vue'
import UiTitle from '@core/components/ui/title/UiTitle.vue'
import UiTopBottomTable from '@core/components/ui/top-bottom-table/UiTopBottomTable.vue'
import { useRouteQuery } from '@core/composables/route-query.composable'
import { useTable } from '@core/composables/table.composable'
import { vTooltip } from '@core/directives/tooltip.directive'
import type { IconDefinition } from '@fortawesome/fontawesome-common-types'
import {
faAlignLeft,
faCaretDown,
faEdit,
faEllipsis,
faHashtag,
faPlus,
faTrash,
} from '@fortawesome/free-solid-svg-icons'
import { noop } from '@vueuse/shared'
import { computed, ref } from 'vue'
import { useI18n } from 'vue-i18n'
const { networks } = defineProps<{
networks: XenApiNetwork[]
}>()
const { isReady, hasError } = useNetworkStore().subscribe()
const { t } = useI18n()
const selectedNetworkId = useRouteQuery('id')
const networkUuids = computed(() => networks.map(network => network.uuid))
const { selected, areAllSelected } = useMultiSelect(networkUuids)
const toggleSelect = () => {
selected.value = selected.value.length === 0 ? networkUuids.value : []
}
const getLockingMode = (lockingMode: string) => (lockingMode === 'disabled' ? t('disabled') : t('unlocked'))
const searchQuery = ref('')
const filteredNetworks = computed(() => {
const searchTerm = searchQuery.value.trim().toLocaleLowerCase()
if (!searchTerm) {
return networks
}
return networks.filter(network =>
Object.values(network).some(value => String(value).toLocaleLowerCase().includes(searchTerm))
)
})
const { visibleColumns, rows } = useTable('networks', filteredNetworks, {
rowId: record => record.uuid,
columns: define => [
define('checkbox', noop, { label: '', isHideable: false }),
define('name_label', { label: t('name') }),
define('name_description', { label: t('description') }),
define('MTU', { label: t('mtu') }),
define('default_locking_mode', record => getLockingMode(record.default_locking_mode), {
label: t('default-locking-mode'),
}),
define('more', noop, { label: '', isHideable: false }),
],
})
type NetworkHeader = 'name_label' | 'name_description' | 'MTU' | 'default_locking_mode'
const headerIcon: Record<NetworkHeader, IconDefinition> = {
name_label: faAlignLeft,
name_description: faAlignLeft,
MTU: faHashtag,
default_locking_mode: faCaretDown,
}
</script>
<style scoped lang="postcss">
.pool-host-internal-networks-table,
.table-actions,
.container {
display: flex;
flex-direction: column;
}
.pool-host-internal-networks-table {
gap: 2.4rem;
.container,
.table-actions {
gap: 0.8rem;
}
.checkbox,
.more {
width: 4.8rem;
}
.checkbox {
text-align: center;
line-height: 1;
}
.value:empty::before {
content: '-';
display: flex;
justify-content: center;
}
}
</style>

View File

@@ -1,218 +0,0 @@
<template>
<UiPanel>
<template #header>
<UiButton
v-tooltip="$t('coming-soon')"
disabled
variant="tertiary"
size="medium"
accent="brand"
:left-icon="faEdit"
>
{{ $t('edit') }}
</UiButton>
<UiButton
v-tooltip="$t('coming-soon')"
disabled
variant="tertiary"
size="medium"
accent="danger"
:left-icon="faTrash"
>
{{ $t('delete') }}
</UiButton>
<UiButtonIcon v-tooltip="$t('coming-soon')" disabled accent="brand" size="medium" :icon="faEllipsis" />
</template>
<template #default>
<UiCard class="card-container">
<UiCardTitle v-tooltip="{ placement: 'bottom-end' }" class="typo-body-bold text-ellipsis">
{{ network.name_label }}
</UiCardTitle>
<div class="content">
<!-- UUID -->
<VtsCardRowKeyValue>
<template #key>
{{ $t('uuid') }}
</template>
<template #value>{{ network.uuid }}</template>
<template v-if="network.uuid" #addons>
<UiButtonIcon
v-tooltip="copied && $t('core.copied')"
accent="brand"
size="medium"
:icon="faCopy"
@click="copy(network.uuid)"
/>
</template>
</VtsCardRowKeyValue>
<!-- DESCRIPTION -->
<VtsCardRowKeyValue>
<template #key>{{ $t('description') }}</template>
<template #value>
<span class="value">{{ network.name_description }}</span>
</template>
<template v-if="network.name_description" #addons>
<UiButtonIcon
v-tooltip="copied && $t('core.copied')"
accent="brand"
size="medium"
:icon="faCopy"
@click="copy(network.name_description)"
/>
</template>
</VtsCardRowKeyValue>
<!-- VLAN -->
<VtsCardRowKeyValue v-if="networkVlan">
<template #key>{{ $t('vlan') }}</template>
<template #value>{{ networkVlan }}</template>
<template #addons>
<UiButtonIcon
v-tooltip="copied && $t('core.copied')"
accent="brand"
size="medium"
:icon="faCopy"
@click="copy(String(networkVlan))"
/>
</template>
</VtsCardRowKeyValue>
<!-- MTU -->
<VtsCardRowKeyValue>
<template #key>{{ $t('mtu') }}</template>
<template #value>
<span class="value">{{ network.MTU }}</span>
</template>
<template v-if="network.MTU" #addons>
<UiButtonIcon
v-tooltip="copied && $t('core.copied')"
accent="brand"
size="medium"
:icon="faCopy"
@click="copy(String(network.MTU))"
/>
</template>
</VtsCardRowKeyValue>
<!-- NBD -->
<VtsCardRowKeyValue>
<template #key>{{ $t('network-block-device') }}</template>
<template #value>{{ networkNbd }}</template>
<template #addons>
<UiButtonIcon
v-tooltip="copied && $t('core.copied')"
accent="brand"
size="medium"
:icon="faCopy"
@click="copy(networkNbd)"
/>
</template>
</VtsCardRowKeyValue>
<!-- DEFAULT LOCKING MODE -->
<VtsCardRowKeyValue>
<template #key>{{ $t('locking-mode-default') }}</template>
<template #value>{{ networkDefaultLockingMode }}</template>
</VtsCardRowKeyValue>
</div>
</UiCard>
<UiCard v-if="pifsCount && pifsCount > 0" class="card-container">
<div class="typo-body-bold">
{{ $t('pifs') }}
<UiCounter :value="pifsCount" variant="primary" size="small" accent="neutral" />
</div>
<table class="simple-table">
<thead>
<tr>
<th class="text-left typo-body-regular-small">
{{ $t('host') }}
</th>
<th class="text-left typo-body-regular-small">
{{ $t('device') }}
</th>
<th class="text-left typo-body-regular-small">
{{ $t('pifs-status') }}
</th>
<th />
</tr>
</thead>
<tbody>
<PifRow v-for="pif in pifs" :key="pif.uuid" :pif />
</tbody>
</table>
</UiCard>
</template>
</UiPanel>
</template>
<script setup lang="ts">
import PifRow from '@/components/pif/PifRow.vue'
import type { XenApiNetwork } from '@/libs/xen-api/xen-api.types'
import { usePifStore } from '@/stores/xen-api/pif.store'
import VtsCardRowKeyValue from '@core/components/card/VtsCardRowKeyValue.vue'
import UiButton from '@core/components/ui/button/UiButton.vue'
import UiButtonIcon from '@core/components/ui/button-icon/UiButtonIcon.vue'
import UiCard from '@core/components/ui/card/UiCard.vue'
import UiCardTitle from '@core/components/ui/card-title/UiCardTitle.vue'
import UiCounter from '@core/components/ui/counter/UiCounter.vue'
import UiPanel from '@core/components/ui/panel/UiPanel.vue'
import { vTooltip } from '@core/directives/tooltip.directive'
import { faCopy, faEdit, faEllipsis, faTrash } from '@fortawesome/free-solid-svg-icons'
import { useClipboard } from '@vueuse/core'
import { computed } from 'vue'
import { useI18n } from 'vue-i18n'
const { network } = defineProps<{
network: XenApiNetwork
}>()
const { getPifsByNetworkRef } = usePifStore().subscribe()
const { t } = useI18n()
const pifs = computed(() => getPifsByNetworkRef(network.$ref))
const networkVlan = computed(() => {
if (pifs.value.length === 0) {
return ''
}
return pifs.value[0].VLAN !== -1 ? pifs.value[0].VLAN.toString() : t('none')
})
const networkNbd = computed(() => (network.purpose[0] ? t('on') : t('off')))
const networkDefaultLockingMode = computed(() =>
network.default_locking_mode === 'disabled' ? t('disabled') : t('unlocked')
)
const pifsCount = computed(() => pifs.value.length)
const { copy, copied } = useClipboard()
</script>
<style scoped lang="postcss">
.card-container {
display: flex;
flex-direction: column;
gap: 1.6rem;
.content {
display: flex;
flex-direction: column;
gap: 0.4rem;
}
.text-left {
text-align: left;
}
.simple-table {
border-spacing: 0;
padding: 0.4rem;
thead tr th {
color: var(--color-neutral-txt-secondary);
}
}
.value:empty::before {
content: '-';
}
}
</style>

View File

@@ -1,272 +0,0 @@
<template>
<div class="pool-networks-table">
<UiTitle>
{{ $t('networks') }}
<template #actions>
<UiDropdownButton v-tooltip="$t('coming-soon')" disabled>
{{ $t('new') }}
</UiDropdownButton>
</template>
</UiTitle>
<div class="container">
<div class="table-actions">
<UiQuerySearchBar @search="value => (searchQuery = value)" />
<UiTableActions :title="t('table-actions')">
<UiButton
v-tooltip="$t('coming-soon')"
disabled
:left-icon="faEdit"
variant="tertiary"
accent="brand"
size="medium"
>
{{ $t('edit') }}
</UiButton>
<UiButton
v-tooltip="$t('coming-soon')"
disabled
:left-icon="faCopy"
variant="tertiary"
accent="brand"
size="medium"
>
{{ $t('copy-info-json') }}
</UiButton>
<UiButton
v-tooltip="$t('coming-soon')"
disabled
:left-icon="faTrash"
variant="tertiary"
accent="danger"
size="medium"
>
{{ $t('delete') }}
</UiButton>
</UiTableActions>
<UiTopBottomTable :selected-items="0" :total-items="0" @toggle-select-all="toggleSelect" />
</div>
<VtsDataTable
:is-ready
:has-error
:no-data-message="networks.length === 0 ? $t('no-network-detected') : undefined"
>
<template #thead>
<tr>
<template v-for="column of visibleColumns" :key="column.id">
<th v-if="column.id === 'checkbox'" class="checkbox">
<div v-tooltip="$t('coming-soon')">
<UiCheckbox disabled :v-model="areAllSelected" accent="brand" @update:model-value="toggleSelect" />
</div>
</th>
<th v-else-if="column.id === 'more'" class="more">
<UiButtonIcon v-tooltip="$t('coming-soon')" :icon="faEllipsis" accent="brand" disabled size="small" />
</th>
<th v-else>
<div v-tooltip class="text-ellipsis">
<VtsIcon accent="brand" :icon="headerIcon[column.id]" />
{{ column.label }}
</div>
</th>
</template>
</tr>
</template>
<template #tbody>
<tr
v-for="row of rows"
:key="row.id"
:class="{ selected: selectedNetworkId === row.id }"
@click="selectedNetworkId = row.id"
>
<td
v-for="column of row.visibleColumns"
:key="column.id"
class="typo-body-regular-small"
:class="{ checkbox: column.id === 'checkbox' }"
>
<div v-if="column.id === 'checkbox'" v-tooltip="$t('coming-soon')">
<UiCheckbox v-model="selected" disabled accent="brand" :value="row.id" />
</div>
<UiButtonIcon
v-else-if="column.id === 'more'"
v-tooltip="$t('coming-soon')"
:icon="faEllipsis"
accent="brand"
disabled
size="small"
/>
<VtsConnectionStatus v-else-if="column.id === 'status'" :status="column.value" />
<div v-else v-tooltip="{ placement: 'bottom-end' }" class="value text-ellipsis">
{{ column.value }}
</div>
</td>
</tr>
</template>
</VtsDataTable>
<VtsStateHero v-if="searchQuery && filteredNetworks.length === 0" type="table" image="no-result">
<div>{{ $t('no-result') }}</div>
</VtsStateHero>
<UiTopBottomTable :selected-items="0" :total-items="0" @toggle-select-all="toggleSelect" />
</div>
</div>
</template>
<script setup lang="ts">
import useMultiSelect from '@/composables/multi-select.composable'
import type { XenApiNetwork } from '@/libs/xen-api/xen-api.types'
import { useNetworkStore } from '@/stores/xen-api/network.store'
import { usePifMetricsStore } from '@/stores/xen-api/pif-metrics.store'
import { usePifStore } from '@/stores/xen-api/pif.store'
import VtsConnectionStatus from '@core/components/connection-status/VtsConnectionStatus.vue'
import VtsDataTable from '@core/components/data-table/VtsDataTable.vue'
import VtsIcon from '@core/components/icon/VtsIcon.vue'
import VtsStateHero from '@core/components/state-hero/VtsStateHero.vue'
import UiButton from '@core/components/ui/button/UiButton.vue'
import UiButtonIcon from '@core/components/ui/button-icon/UiButtonIcon.vue'
import UiCheckbox from '@core/components/ui/checkbox/UiCheckbox.vue'
import UiDropdownButton from '@core/components/ui/dropdown-button/UiDropdownButton.vue'
import UiQuerySearchBar from '@core/components/ui/query-search-bar/UiQuerySearchBar.vue'
import UiTableActions from '@core/components/ui/table-actions/UiTableActions.vue'
import UiTitle from '@core/components/ui/title/UiTitle.vue'
import UiTopBottomTable from '@core/components/ui/top-bottom-table/UiTopBottomTable.vue'
import { useRouteQuery } from '@core/composables/route-query.composable'
import { useTable } from '@core/composables/table.composable'
import { vTooltip } from '@core/directives/tooltip.directive'
import type { IconDefinition } from '@fortawesome/fontawesome-common-types'
import {
faAlignLeft,
faCaretDown,
faCopy,
faEdit,
faEllipsis,
faHashtag,
faPowerOff,
faTrash,
} from '@fortawesome/free-solid-svg-icons'
import { noop } from '@vueuse/shared'
import { computed, ref } from 'vue'
import { useI18n } from 'vue-i18n'
const { networks } = defineProps<{
networks: XenApiNetwork[]
}>()
const { isReady, hasError } = useNetworkStore().subscribe()
const { records: pifs } = usePifStore().subscribe()
const { getPifCarrier } = usePifMetricsStore().subscribe()
const { t } = useI18n()
const selectedNetworkId = useRouteQuery('id')
const networkUuids = computed(() => networks.map(network => network.uuid))
const { selected, areAllSelected } = useMultiSelect(networkUuids)
const toggleSelect = () => {
selected.value = selected.value.length === 0 ? networkUuids.value : []
}
const getNetworkVlan = (network: XenApiNetwork) => {
const networkPIFs = pifs.value.filter(pif => network.PIFs?.includes(pif.$ref))
if (networkPIFs.length > 0) {
return networkPIFs[0].VLAN !== -1 ? networkPIFs[0].VLAN.toString() : t('none')
}
}
const getNetworkStatus = (network: XenApiNetwork) => {
const networkPIFs = pifs.value.filter(pif => network.PIFs?.includes(pif.$ref))
if (networkPIFs.length === 0) {
return 'disconnected'
}
const isConnected = networkPIFs.map(pif => pif.currently_attached && getPifCarrier(pif))
if (isConnected.every(Boolean)) {
return 'connected'
}
if (isConnected.some(Boolean)) {
return 'partially-connected'
}
return 'disconnected'
}
const getLockingMode = (lockingMode: string) => (lockingMode === 'disabled' ? t('disabled') : t('unlocked'))
const searchQuery = ref('')
const filteredNetworks = computed(() => {
const searchTerm = searchQuery.value.trim().toLocaleLowerCase()
if (!searchTerm) {
return networks
}
return networks.filter(network =>
Object.values(network).some(value => String(value).toLocaleLowerCase().includes(searchTerm))
)
})
const { visibleColumns, rows } = useTable('networks', filteredNetworks, {
rowId: record => record.uuid,
columns: define => [
define('checkbox', noop, { label: '', isHideable: false }),
define('name_label', { label: t('name') }),
define('name_description', { label: t('description') }),
define('status', record => getNetworkStatus(record), { label: t('pifs-status') }),
define('vlan', record => getNetworkVlan(record), { label: t('vlan') }),
define('MTU', { label: t('mtu') }),
define('default_locking_mode', record => getLockingMode(record.default_locking_mode), {
label: t('default-locking-mode'),
}),
define('more', noop, { label: '', isHideable: false }),
],
})
type NetworkHeader = 'name_label' | 'name_description' | 'status' | 'vlan' | 'MTU' | 'default_locking_mode'
const headerIcon: Record<NetworkHeader, IconDefinition> = {
name_label: faAlignLeft,
name_description: faAlignLeft,
status: faPowerOff,
vlan: faAlignLeft,
MTU: faHashtag,
default_locking_mode: faCaretDown,
}
</script>
<style scoped lang="postcss">
.pool-networks-table,
.table-actions,
.container {
display: flex;
flex-direction: column;
}
.pool-networks-table {
gap: 2.4rem;
.container,
.table-actions {
gap: 0.8rem;
}
.checkbox,
.more {
width: 4.8rem;
}
.checkbox {
text-align: center;
line-height: 1;
}
.value:empty::before {
content: '-';
display: flex;
justify-content: center;
}
}
</style>

View File

@@ -12,7 +12,7 @@
<tbody>
<tr v-if="hasError">
<td colspan="5">
<span class="text-error typo-h6">{{ $t('error-no-data') }}</span>
<span class="text-error typo h6-semi-bold">{{ $t('error-no-data') }}</span>
</td>
</tr>
<tr v-else-if="isFetching">
@@ -69,7 +69,7 @@ td[colspan='5'] {
}
.loader {
color: var(--color-brand-txt-base);
color: var(--color-info-txt-base);
display: block;
font-size: 4rem;
margin: 2rem auto 0;

View File

@@ -1,5 +1,5 @@
<template>
<div v-if="isDisplayed" class="summary typo-caption-small">
<div v-if="isDisplayed" class="summary typo c2-semi-bold">
<div class="summary-card">
<p>{{ $t('total-used:') }}</p>
<div class="summary-value">
@@ -24,7 +24,6 @@
<script lang="ts" setup>
import { formatSize, percent } from '@/libs/utils'
import { computed } from 'vue'
const props = defineProps<{
size: number
usage: number

View File

@@ -17,17 +17,21 @@
<script lang="ts" setup>
import UiIcon from '@/components/ui/icon/UiIcon.vue'
import { useDisabled } from '@core/composables/disabled.composable'
import { useContext } from '@/composables/context.composable'
import { DisabledContext } from '@/context'
import type { IconDefinition } from '@fortawesome/fontawesome-common-types'
const props = defineProps<{
busy?: boolean
disabled?: boolean
icon?: IconDefinition
active?: boolean
}>()
const props = withDefaults(
defineProps<{
busy?: boolean
disabled?: boolean
icon?: IconDefinition
active?: boolean
}>(),
{ disabled: undefined }
)
const isDisabled = useDisabled(() => props.disabled)
const isDisabled = useContext(DisabledContext, () => props.disabled)
</script>
<style lang="postcss" scoped>
@@ -58,8 +62,8 @@ const isDisabled = useDisabled(() => props.disabled)
&:active,
&.active,
&.busy {
color: var(--color-brand-txt-base);
background-color: var(--color-brand-background-selected);
color: var(--color-info-txt-base);
background-color: var(--color-info-background-selected);
}
}
}

View File

@@ -1,5 +1,5 @@
<template>
<span class="ui-badge typo-body-bold-small">
<span class="ui-badge typo p2-medium">
<UiIcon :icon />
<slot />
</span>

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