Compare commits

..

2 Commits

Author SHA1 Message Date
mathieu
a9cae763e1 fix sort for simple array 2024-06-25 15:45:08 +02:00
mathieu
49e38d6742 feat(core): creation of the useInteractiveTable composable 2024-06-24 14:28:07 +02:00
608 changed files with 9789 additions and 36679 deletions

View File

@@ -39,12 +39,6 @@ module.exports = {
version: '>=16',
},
],
'n/no-unsupported-features/es-builtins': [
'error',
{
version: '>=16',
},
],
'n/no-unsupported-features/es-syntax': [
'error',
{
@@ -109,9 +103,6 @@ module.exports = {
'n/no-missing-import': 'off', // using 'import' plugin instead, to support TS aliases
'no-redeclare': 'off', // automatically checked by the TypeScript compiler
'no-dupe-class-members': 'off', // automatically checked by the TypeScript compiler
'no-undef': 'off', // automatically checked by the TypeScript compiler
'no-use-before-define': 'off', // replaced with the rule below
'@typescript-eslint/no-use-before-define': ['error', { functions: false }],
'@typescript-eslint/no-explicit-any': 'off',
'vue/multi-word-component-names': 'off',
// Vue 3 - Strongly Recommended
@@ -146,7 +137,6 @@ module.exports = {
'vue/no-v-html': 'error',
'vue/this-in-template': 'error',
// Vue 3 - Uncategorized
'vue/block-lang': ['error', { script: { lang: 'ts' }, style: { lang: 'postcss' } }],
'vue/block-order': ['error', { order: ['template', 'script', 'style'] }],
'vue/block-tag-newline': ['error', { singleline: 'consistent', multiline: 'always', maxEmptyLines: 0 }],
'vue/component-api-style': ['error', ['script-setup']],
@@ -225,7 +215,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'] }],
'@intlify/vue-i18n/no-missing-keys-in-other-locales': ['error', { ignoreLocales: ['de'] }],
},
},
// Specific rules for XO dev-related files
@@ -284,7 +274,7 @@ module.exports = {
// this rule can prevent race condition bugs like parallel `a += await foo()`
//
// as it has a lots of false positive, it is only enabled as a warning for now
'require-atomic-updates': ['warn', { allowProperties: true }],
'require-atomic-updates': 'warn',
strict: 'error',
},

View File

@@ -1,6 +1,6 @@
{
"name": "@vates/fuse-vhd",
"version": "2.1.1",
"version": "2.1.0",
"license": "ISC",
"private": false,
"homepage": "https://github.com/vatesfr/xen-orchestra/tree/master/@vates/fuse-vhd",
@@ -24,7 +24,7 @@
"fuse-native": "^2.2.6",
"lru-cache": "^7.14.0",
"promise-toolbox": "^0.21.0",
"vhd-lib": "^4.11.0"
"vhd-lib": "^4.9.2"
},
"bin": {
"xo-fuse-vhd": "./cli.mjs"

View File

@@ -1,18 +0,0 @@
The use for this librariy is to create a composite key from a JSON value, ignoring objects identity and properties order.
The hash algorithm used is intended to be fast and with low collisions and is not guaranteed to be be secure.
The hash is encoded using [Base64 URL](https://en.wikipedia.org/wiki/Base64#URL_applications) to make it easy to use in URLs and filenames.
```js
import { jsonHash } from '@vates/json-hash'
console.log(jsonHash('foo'))
// → "siEyldVkkW-JpqQkVVZ8h8P0gPzXocFeIg8X1xaaeQs"
// order of properties is ignored
console.log(jsonHash({ foo: 0, bar: 1 }))
// → "JckoRSMIBjNlgEWIXhgpBOuyLQYqABZqvf1ccb3BPg0"
console.log(jsonHash({ bar: 1, foo: 0 }))
// → "JckoRSMIBjNlgEWIXhgpBOuyLQYqABZqvf1ccb3BPg0"
```

View File

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

View File

@@ -1,51 +0,0 @@
<!-- DO NOT EDIT MANUALLY, THIS FILE HAS BEEN GENERATED -->
# @vates/json-hash
[![Package Version](https://badgen.net/npm/v/@vates/json-hash)](https://npmjs.org/package/@vates/json-hash) ![License](https://badgen.net/npm/license/@vates/json-hash) [![PackagePhobia](https://badgen.net/bundlephobia/minzip/@vates/json-hash)](https://bundlephobia.com/result?p=@vates/json-hash) [![Node compatibility](https://badgen.net/npm/node/@vates/json-hash)](https://npmjs.org/package/@vates/json-hash)
> Compute a stable hash from a JSON-ifiable value
## Install
Installation of the [npm package](https://npmjs.org/package/@vates/json-hash):
```sh
npm install --save @vates/json-hash
```
## Usage
The use for this librariy is to create a composite key from a JSON value, ignoring objects identity and properties order.
The hash algorithm used is intended to be fast and with low collisions and is not guaranteed to be be secure.
The hash is encoded using [Base64 URL](https://en.wikipedia.org/wiki/Base64#URL_applications) to make it easy to use in URLs and filenames.
```js
import { jsonHash } from '@vates/json-hash'
console.log(jsonHash('foo'))
// → "siEyldVkkW-JpqQkVVZ8h8P0gPzXocFeIg8X1xaaeQs"
// order of properties is ignored
console.log(jsonHash({ foo: 0, bar: 1 }))
// → "JckoRSMIBjNlgEWIXhgpBOuyLQYqABZqvf1ccb3BPg0"
console.log(jsonHash({ bar: 1, foo: 0 }))
// → "JckoRSMIBjNlgEWIXhgpBOuyLQYqABZqvf1ccb3BPg0"
```
## 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
[ISC](https://spdx.org/licenses/ISC) © [Vates SAS](https://vates.fr)

View File

@@ -1,38 +0,0 @@
'use strict'
const { createHash } = require('node:crypto')
function updateJsonHash(value, hash) {
if (value !== null && typeof value === 'object') {
if (Array.isArray(value)) {
hash.update('[')
for (const item of value) {
updateJsonHash(item, hash)
// trailing is not a big deal because it does not need to be valid JSON
hash.update(',')
}
hash.update(']')
} else {
hash.update('{')
for (const key of Object.keys(value).sort()) {
updateJsonHash(key, hash)
hash.update(':')
updateJsonHash(value[key], hash)
// trailing is not a big deal because it does not need to be valid JSON
hash.update(',')
}
hash.update('}')
}
} else {
hash.update(JSON.stringify(value))
}
}
exports.jsonHash = function jsonHash(value) {
// this hash does not need to be secure, it just needs to be fast and with low collisions
const hash = createHash('sha256')
updateJsonHash(value, hash)
return hash.digest('base64url')
}

View File

@@ -1,21 +0,0 @@
'use strict'
const { jsonHash } = require('@vates/json-hash')
const assert = require('node:assert/strict')
const test = require('test')
const cases = [
[null, 'dCNOmK_nSY-12vHzasLXiswzlGT5UHA7jAGYkvmCuQs'],
[42, 'c0dctApWjo2ooEXO0RATfhWfiQrE2og7axfcZRs6gEk'],
['foo', 'siEyldVkkW-JpqQkVVZ8h8P0gPzXocFeIg8X1xaaeQs'],
[[], 'T1PNoYwrqgwDVLtfmj7L5e0Sq02OEbqHPC8RFhICuUU'],
[{}, 'RBNvo1WzZ4oRRq0W9-hknpT7T8If536DEMBg9hyq_4o'],
[{ a: 1, b: 2 }, 'LMjVxyj2vtMZ3W1cZ2cJrQij5zn7FBOlPiyBB38OmFE'],
[{ b: 2, a: 1 }, 'LMjVxyj2vtMZ3W1cZ2cJrQij5zn7FBOlPiyBB38OmFE'],
]
for (const [value, hash] of cases) {
test(JSON.stringify(value), function () {
assert.equal(jsonHash(value), hash)
})
}

View File

@@ -1,33 +0,0 @@
{
"private": false,
"name": "@vates/json-hash",
"description": "Compute a stable hash from a JSON-ifiable value",
"keywords": [
"hash",
"json",
"stable"
],
"homepage": "https://github.com/vatesfr/xen-orchestra/tree/master/@vates/json-hash",
"bugs": "https://github.com/vatesfr/xen-orchestra/issues",
"repository": {
"directory": "@vates/json-hash",
"type": "git",
"url": "https://github.com/vatesfr/xen-orchestra.git"
},
"author": {
"name": "Vates SAS",
"url": "https://vates.fr"
},
"license": "ISC",
"version": "0.2.0",
"engines": {
"node": ">=14.18.0"
},
"devDependencies": {
"test": "^3.3.0"
},
"scripts": {
"postversion": "npm publish --access public",
"test": "node--test"
}
}

View File

@@ -34,6 +34,7 @@ export default class NbdClient {
#exportSize
#waitBeforeReconnect
#readAhead
#readBlockRetries
#reconnectRetry
#connectTimeout
@@ -54,6 +55,7 @@ export default class NbdClient {
connectTimeout = 6e4,
messageTimeout = 6e4,
waitBeforeReconnect = 1e3,
readAhead = 10,
readBlockRetries = 5,
reconnectRetry = 5,
} = {}
@@ -63,6 +65,7 @@ export default class NbdClient {
this.#exportName = exportname
this.#serverCert = cert
this.#waitBeforeReconnect = waitBeforeReconnect
this.#readAhead = readAhead
this.#readBlockRetries = readBlockRetries
this.#reconnectRetry = reconnectRetry
this.#connectTimeout = connectTimeout

View File

@@ -6,10 +6,7 @@ import { createLogger } from '@xen-orchestra/log'
const { warn } = createLogger('vates:nbd-client:multi')
export default class MultiNbdClient {
#clients = []
#nbdConcurrency
#options
#readAhead
#settings
get exportSize() {
return this.#clients[0].exportSize
@@ -17,64 +14,36 @@ export default class MultiNbdClient {
constructor(settings, { nbdConcurrency = 8, readAhead = 16, ...options } = {}) {
this.#readAhead = readAhead
this.#options = options
this.#nbdConcurrency = nbdConcurrency
if (!Array.isArray(settings)) {
settings = [settings]
}
this.#settings = settings
for (let i = 0; i < nbdConcurrency; i++) {
this.#clients.push(
new NbdClient(settings[i % settings.length], { ...options, readAhead: Math.ceil(readAhead / nbdConcurrency) })
)
}
}
/**
*
* open nbdConcurrency connections to NBD servers
* it must obtain at least one connection to succeed
* it tries to spread connections on multiple host
*/
async connect() {
const candidates = [...this.#settings]
const promises = []
const baseOptions = this.#options
const _connect = async () => {
if (candidates.length === 0) {
return
}
// a little bit of randomization to spread the load
const nbdInfo = candidates[Math.floor(Math.random() * candidates.length)]
const client = new NbdClient(nbdInfo, {
...baseOptions,
readAhead: Math.ceil(this.#readAhead / this.#nbdConcurrency),
})
const connectedClients = []
for (const clientId in this.#clients) {
const client = this.#clients[clientId]
try {
await client.connect()
this.#clients.push(client)
connectedClients.push(client)
} catch (err) {
client.disconnect().catch(() => {})
// do not hammer unreachable hosts, once failed, remove from the list
const candidateIndex = candidates.findIndex(({ address }) => address === nbdInfo.address)
if (candidateIndex >= 0) {
// this candidate may have already been deleted by another parallel promise
candidates.splice(candidateIndex, 1)
}
warn(`can't connect to one nbd client`, { err })
// retry with another candidate (if available)
return _connect()
}
}
for (let i = 0; i < this.#nbdConcurrency; i++) {
promises.push(_connect())
}
await Promise.all(promises)
if (this.#clients.length === 0) {
if (connectedClients.length === 0) {
throw new Error(`Fail to connect to any Nbd client`)
}
if (this.#clients.length < this.#nbdConcurrency) {
if (connectedClients.length < this.#clients.length) {
warn(
`incomplete connection by multi Nbd, only ${this.#clients.length} over ${this.#nbdConcurrency} expected clients`
`incomplete connection by multi Nbd, only ${connectedClients.length} over ${this.#clients.length} expected clients`
)
this.#clients = connectedClients
}
}

View File

@@ -13,7 +13,7 @@
"url": "https://vates.fr"
},
"license": "ISC",
"version": "3.1.0",
"version": "3.0.2",
"engines": {
"node": ">=14.0"
},
@@ -24,7 +24,7 @@
"@xen-orchestra/async-map": "^0.1.2",
"@xen-orchestra/log": "^0.6.0",
"promise-toolbox": "^0.21.0",
"xen-api": "^4.3.1"
"xen-api": "^4.0.0"
},
"devDependencies": {
"tap": "^18.7.0",

View File

@@ -78,14 +78,15 @@ async function killNbdKit() {
)
}
test('it works secured network', async tap => {
test('it works with unsecured network', async tap => {
const path = await createTempFile(FILE_SIZE)
let nbdServer = await spawnNbdKit(path)
const connectionSettings = {
address: '127.0.0.1',
exportname: 'MY_SECRET_EXPORT',
cert: `-----BEGIN CERTIFICATE-----
const client = new MultiNbdClient(
{
address: '127.0.0.1',
exportname: 'MY_SECRET_EXPORT',
cert: `-----BEGIN CERTIFICATE-----
MIIDazCCAlOgAwIBAgIUeHpQ0IeD6BmP2zgsv3LV3J4BI/EwDQYJKoZIhvcNAQEL
BQAwRTELMAkGA1UEBhMCQVUxEzARBgNVBAgMClNvbWUtU3RhdGUxITAfBgNVBAoM
GEludGVybmV0IFdpZGdpdHMgUHR5IEx0ZDAeFw0yMzA1MTcxMzU1MzBaFw0yNDA1
@@ -107,18 +108,12 @@ CYu1Xn/FVPx1HoRgWc7E8wFhDcA/P3SJtfIQWHB9FzSaBflKGR4t8WCE2eE8+cTB
57ABhfYpMlZ4aHjuN1bL
-----END CERTIFICATE-----
`,
}
const invalid = {
address: '500.500.500.500',
port: 0,
exportname: 'nop',
}
// it should work even with some broken servers
const nbdInfos = [connectionSettings, connectionSettings, invalid]
const client = new MultiNbdClient(nbdInfos, {
nbdConcurrency: 4,
readAhead: 2,
})
},
{
nbdConcurrency: 1,
readAhead: 2,
}
)
await client.connect()
tap.equal(client.exportSize, BigInt(FILE_SIZE))
@@ -161,18 +156,3 @@ CYu1Xn/FVPx1HoRgWc7E8wFhDcA/P3SJtfIQWHB9FzSaBflKGR4t8WCE2eE8+cTB
nbdServer.kill()
await fs.unlink(path)
})
test('fails if server does not answer', async () => {
const client = new MultiNbdClient(
{
address: '500.500.500.500',
port: 0,
exportname: 'nop',
},
{
nbdConcurrency: 1,
readAhead: 2,
}
)
await assert.rejects(client.connect())
})

View File

@@ -6,11 +6,9 @@ exports.parseDuration = value => {
if (typeof value === 'number') {
return value
}
if (typeof value === 'string' && value !== '') {
const duration = ms(value)
if (duration !== undefined) {
return duration
}
const duration = ms(value)
if (duration === undefined) {
throw new TypeError(`not a valid duration: ${value}`)
}
throw new TypeError(`not a valid duration: ${value}`)
return duration
}

View File

@@ -1,22 +0,0 @@
import { describe, it } from 'node:test'
import { parseDuration } from '@vates/parse-duration'
import assert from 'node:assert/strict'
describe('parseDuration()', () => {
it('should parse string', () => {
const input = '2 days'
const expected = 172800000
assert.strictEqual(parseDuration(input), expected)
})
it('should return its input if already a number', () => {
const input = 172800000
assert.strictEqual(parseDuration(input), input)
})
for (const input of [undefined, '', 'invalid duration']) {
it('should throw an error for ' + input, () => {
assert.throws(() => parseDuration(input), { message: `not a valid duration: ${input}` })
})
}
})

View File

@@ -27,7 +27,6 @@
"ms": "^2.1.2"
},
"scripts": {
"postversion": "npm publish --access public",
"test": "node --test"
"postversion": "npm publish --access public"
}
}

View File

@@ -44,8 +44,6 @@ exports.makeOnProgress = function ({ onRootTaskEnd = noop, onRootTaskStart = noo
} else if (type === 'property') {
;(taskLog.properties ?? (taskLog.properties = { __proto__: null }))[event.name] = event.value
} else if (type === 'end') {
taskLogs.delete(id)
taskLog.end = event.timestamp
taskLog.result = event.result
taskLog.status = event.status

View File

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

View File

@@ -7,7 +7,7 @@
"bugs": "https://github.com/vatesfr/xen-orchestra/issues",
"dependencies": {
"@xen-orchestra/async-map": "^0.1.2",
"@xen-orchestra/backups": "^0.54.0",
"@xen-orchestra/backups": "^0.49.1",
"@xen-orchestra/fs": "^4.1.7",
"filenamify": "^6.0.0",
"getopts": "^2.2.5",
@@ -27,7 +27,7 @@
"scripts": {
"postversion": "npm publish --access public"
},
"version": "1.0.25",
"version": "1.0.19",
"license": "AGPL-3.0-or-later",
"author": {
"name": "Vates SAS",

View File

@@ -49,25 +49,26 @@ export class HealthCheckVmBackup {
}
// wait for the 'Running' event to be really stored in local xapi object cache
restoredVm = await xapi.waitObjectState(restoredVm.$ref, vm => vm.power_state === 'Running', {
timeout: remainingTimeout,
timeoutMessage: refOrUuid =>
`local xapi did not get Running state for VM ${refOrUuid} after ${timeout / 1000} second`,
})
const running = new Date()
remainingTimeout -= running - started
if (remainingTimeout < 0) {
throw new Error(`local xapi did not get Running state for VM ${restoredId} after ${timeout / 1000} second`)
}
// wait for the guest tool version to be defined
await xapi.waitObjectState(restoredVm.guest_metrics, gm => gm?.PV_drivers_version?.major !== undefined, {
timeout: remainingTimeout,
timeoutMessage: refOrUuid =>
`timeout reached while waiting for ${refOrUuid} to report the driver version through the Xen tools. Please check or update the Xen tools.`,
})
const guestToolsReady = new Date()
remainingTimeout -= guestToolsReady - running
if (remainingTimeout < 0) {
throw new Error(`local xapi did not get he guest tools check ${restoredId} after ${timeout / 1000} second`)
}
if (waitForScript) {
const startedRestoredVm = await xapi.waitObjectState(
@@ -78,10 +79,19 @@ export class HealthCheckVmBackup {
vm.xenstore_data['vm-data/xo-backup-health-check'] === 'failure'),
{
timeout: remainingTimeout,
timeoutMessage: refOrUuid =>
`timeout reached while waiting for ${refOrUuid} to report the startup script execution.`,
}
)
const scriptOk = new Date()
remainingTimeout -= scriptOk - guestToolsReady
if (remainingTimeout < 0) {
throw new Error(
`Backup health check script did not update vm-data/xo-backup-health-check of ${restoredId} after ${
timeout / 1000
} second, got ${
startedRestoredVm.xenstore_data['vm-data/xo-backup-health-check']
} instead of 'success' or 'failure'`
)
}
if (startedRestoredVm.xenstore_data['vm-data/xo-backup-health-check'] !== 'success') {
const message = startedRestoredVm.xenstore_data['vm-data/xo-backup-health-check-error']

View File

@@ -18,7 +18,6 @@ import fromEvent from 'promise-toolbox/fromEvent'
import groupBy from 'lodash/groupBy.js'
import pDefer from 'promise-toolbox/defer'
import pickBy from 'lodash/pickBy.js'
import reduce from 'lodash/reduce.js'
import tar from 'tar'
import zlib from 'zlib'
@@ -827,29 +826,6 @@ export class RemoteAdapter {
}
return metadata
}
#computeTotalBackupSizeRecursively(backups) {
return reduce(
backups,
(prev, backup) => {
const _backup = Array.isArray(backup) ? this.#computeTotalBackupSizeRecursively(backup) : backup
return {
onDisk: prev.onDisk + (_backup.onDisk ?? _backup.size),
}
},
{ onDisk: 0 }
)
}
async getTotalVmBackupSize() {
return this.#computeTotalBackupSizeRecursively(await this.listAllVmBackups())
}
async getTotalBackupSize() {
const vmBackupSize = await this.getTotalVmBackupSize()
// @TODO: add `getTotalXoBackupSize` and `getTotalPoolBackupSize` once `size` is implemented by fs
return vmBackupSize
}
}
Object.assign(RemoteAdapter.prototype, {

View File

@@ -23,7 +23,7 @@ createCachedLookup().patchGlobal()
const logger = createLogger('xo:backups:worker')
catchGlobalErrors(logger)
const { debug, info, warn } = logger
const { debug, info } = logger
class BackupWorker {
#config
@@ -204,13 +204,6 @@ process.on('message', async message => {
info('backup has ended')
await ignoreErrors.call(backupWorker.debounceResource.flushAll())
process.disconnect()
setTimeout(() => {
warn('worker process did not exit automatically, forcing...')
// eslint-disable-next-line n/no-process-exit
process.exit()
}, 30e3).unref()
}
}
})

View File

@@ -3,6 +3,7 @@ import ignoreErrors from 'promise-toolbox/ignoreErrors'
import { asyncMap } from '@xen-orchestra/async-map'
import { CancelToken } from 'promise-toolbox'
import { compareVersions } from 'compare-versions'
import { createVhdStreamWithLength } from 'vhd-lib'
import { defer } from 'golike-defer'
import { cancelableMap } from './_cancelableMap.mjs'
@@ -226,6 +227,9 @@ export const importIncrementalVm = defer(async function importIncrementalVm(
if (typeof stream === 'function') {
stream = await stream()
}
if (stream.length === undefined) {
stream = await createVhdStreamWithLength(stream)
}
await xapi.setField('VDI', vdi.$ref, 'name_label', `[Importing] ${vdiRecords[id].name_label}`)
await vdi.$importContent(stream, { cancelToken, format: 'vhd' })
await xapi.setField('VDI', vdi.$ref, 'name_label', vdiRecords[id].name_label)

View File

@@ -15,7 +15,6 @@ const noop = Function.prototype
const DEFAULT_XAPI_VM_SETTINGS = {
bypassVdiChainsCheck: false,
cbtDestroySnapshotData: false,
checkpointSnapshot: false,
concurrency: 2,
copyRetention: 0,

View File

@@ -2,39 +2,39 @@ import { AbstractRemote } from './_AbstractRemote.mjs'
import { FullRemoteWriter } from '../_writers/FullRemoteWriter.mjs'
import { forkStreamUnpipe } from '../_forkStreamUnpipe.mjs'
import { watchStreamSize } from '../../_watchStreamSize.mjs'
import { Task } from '../../Task.mjs'
export const FullRemote = class FullRemoteVmBackupRunner extends AbstractRemote {
_getRemoteWriter() {
return FullRemoteWriter
}
_filterTransferList(transferList) {
return transferList.filter(this._filterPredicate)
}
async _run() {
const transferList = await this._computeTransferList(({ mode }) => mode === 'full')
for (const metadata of transferList) {
const stream = await this._sourceRemoteAdapter.readFullVmBackup(metadata)
const sizeContainer = watchStreamSize(stream)
if (transferList.length > 0) {
for (const metadata of transferList) {
const stream = await this._sourceRemoteAdapter.readFullVmBackup(metadata)
const sizeContainer = watchStreamSize(stream)
// @todo shouldn't transfer backup if it will be deleted by retention policy (higher retention on source than destination)
await this._callWriters(
writer =>
writer.run({
stream: forkStreamUnpipe(stream),
// stream will be forked and transformed, it's not safe to attach additionnal properties to it
streamLength: stream.length,
timestamp: metadata.timestamp,
vm: metadata.vm,
vmSnapshot: metadata.vmSnapshot,
sizeContainer,
}),
'writer.run()'
)
// for healthcheck
this._tags = metadata.vm.tags
// @todo shouldn't transfer backup if it will be deleted by retention policy (higher retention on source than destination)
await this._callWriters(
writer =>
writer.run({
stream: forkStreamUnpipe(stream),
// stream will be forked and transformed, it's not safe to attach additionnal properties to it
streamLength: stream.length,
timestamp: metadata.timestamp,
vm: metadata.vm,
vmSnapshot: metadata.vmSnapshot,
sizeContainer,
}),
'writer.run()'
)
// for healthcheck
this._tags = metadata.vm.tags
}
} else {
Task.info('No new data to upload for this VM')
}
}
}

View File

@@ -7,6 +7,7 @@ import mapValues from 'lodash/mapValues.js'
import { AbstractRemote } from './_AbstractRemote.mjs'
import { forkDeltaExport } from './_forkDeltaExport.mjs'
import { IncrementalRemoteWriter } from '../_writers/IncrementalRemoteWriter.mjs'
import { Task } from '../../Task.mjs'
import { Disposable } from 'promise-toolbox'
import { openVhd } from 'vhd-lib'
import { getVmBackupDir } from '../../_getVmBackupDir.mjs'
@@ -15,16 +16,6 @@ class IncrementalRemoteVmBackupRunner extends AbstractRemote {
_getRemoteWriter() {
return IncrementalRemoteWriter
}
// we'll transfer the full list if at least one backup should be transfered
// to ensure we don't cut the delta chain
_filterTransferList(transferList) {
if (transferList.some(vmBackupMetadata => this._filterPredicate(vmBackupMetadata))) {
return transferList
}
return []
}
async _selectBaseVm(metadata) {
// for each disk , get the parent
const baseUuidToSrcVdi = new Map()
@@ -62,46 +53,50 @@ class IncrementalRemoteVmBackupRunner extends AbstractRemote {
async _run() {
const transferList = await this._computeTransferList(({ mode }) => mode === 'delta')
for (const metadata of transferList) {
assert.strictEqual(metadata.mode, 'delta')
await this._selectBaseVm(metadata)
await this._callWriters(writer => writer.prepare({ isBase: metadata.isBase }), 'writer.prepare()')
const incrementalExport = await this._sourceRemoteAdapter.readIncrementalVmBackup(metadata, undefined, {
useChain: false,
})
if (transferList.length > 0) {
for (const metadata of transferList) {
assert.strictEqual(metadata.mode, 'delta')
await this._selectBaseVm(metadata)
await this._callWriters(writer => writer.prepare({ isBase: metadata.isBase }), 'writer.prepare()')
const incrementalExport = await this._sourceRemoteAdapter.readIncrementalVmBackup(metadata, undefined, {
useChain: false,
})
const isVhdDifferencing = {}
const isVhdDifferencing = {}
await asyncEach(Object.entries(incrementalExport.streams), async ([key, stream]) => {
isVhdDifferencing[key] = await isVhdDifferencingDisk(stream)
})
await asyncEach(Object.entries(incrementalExport.streams), async ([key, stream]) => {
isVhdDifferencing[key] = await isVhdDifferencingDisk(stream)
})
incrementalExport.streams = mapValues(incrementalExport.streams, this._throttleStream)
await this._callWriters(
writer =>
writer.transfer({
deltaExport: forkDeltaExport(incrementalExport),
isVhdDifferencing,
timestamp: metadata.timestamp,
vm: metadata.vm,
vmSnapshot: metadata.vmSnapshot,
}),
'writer.transfer()'
)
// this will update parent name with the needed alias
await this._callWriters(
writer =>
writer.updateUuidAndChain({
isVhdDifferencing,
timestamp: metadata.timestamp,
vdis: incrementalExport.vdis,
}),
'writer.updateUuidAndChain()'
)
incrementalExport.streams = mapValues(incrementalExport.streams, this._throttleStream)
await this._callWriters(
writer =>
writer.transfer({
deltaExport: forkDeltaExport(incrementalExport),
isVhdDifferencing,
timestamp: metadata.timestamp,
vm: metadata.vm,
vmSnapshot: metadata.vmSnapshot,
}),
'writer.transfer()'
)
// this will update parent name with the needed alias
await this._callWriters(
writer =>
writer.updateUuidAndChain({
isVhdDifferencing,
timestamp: metadata.timestamp,
vdis: incrementalExport.vdis,
}),
'writer.updateUuidAndChain()'
)
await this._callWriters(writer => writer.cleanup(), 'writer.cleanup()')
// for healthcheck
this._tags = metadata.vm.tags
await this._callWriters(writer => writer.cleanup(), 'writer.cleanup()')
// for healthcheck
this._tags = metadata.vm.tags
}
} else {
Task.info('No new data to upload for this VM')
}
}
}

View File

@@ -147,13 +147,8 @@ export const IncrementalXapi = class IncrementalXapiVmBackupRunner extends Abstr
...lastExportedVdis.map(({ other_config }) => Number(other_config[DELTA_CHAIN_LENGTH] ?? 0))
)
const fullInterval = this._settings.fullInterval
if (fullInterval !== 0 && fullInterval <= deltaChainLength + 1) {
debug('not using base VM because fullInterval reached', {
fullInterval,
deltaChainLength,
eq: fullInterval < deltaChainLength + 1,
dc1: deltaChainLength + 1,
})
if ( fullInterval !== 0 && fullInterval < deltaChainLength + 1) {
debug('not using base VM because fullInterval reached', { fullInterval, deltaChainLength, eq: fullInterval < deltaChainLength + 1, dc1: deltaChainLength + 1 })
return
}

View File

@@ -1,18 +1,14 @@
import groupBy from 'lodash/groupBy.js'
import { asyncEach } from '@vates/async-each'
import { decorateMethodsWith } from '@vates/decorate-with'
import { defer } from 'golike-defer'
import { Disposable } from 'promise-toolbox'
import { createPredicate } from 'value-matcher'
import { getVmBackupDir } from '../../_getVmBackupDir.mjs'
import { Abstract } from './_Abstract.mjs'
import { extractIdsFromSimplePattern } from '../../extractIdsFromSimplePattern.mjs'
import { Task } from '../../Task.mjs'
export const AbstractRemote = class AbstractRemoteVmBackupRunner extends Abstract {
_filterPredicate
constructor({
config,
job,
@@ -61,74 +57,39 @@ export const AbstractRemote = class AbstractRemoteVmBackupRunner extends Abstrac
})
)
})
const { filter } = job
if (filter === undefined) {
this._filterPredicate = () => true
} else {
this._filterPredicate = createPredicate(filter)
}
}
async #computeTransferListPerJob(sourceBackups, remotesBackups) {
async _computeTransferList(predicate) {
const vmBackups = await this._sourceRemoteAdapter.listVmBackups(this._vmUuid, predicate)
const localMetada = new Map()
sourceBackups.forEach(metadata => {
Object.values(vmBackups).forEach(metadata => {
const timestamp = metadata.timestamp
localMetada.set(timestamp, metadata)
})
const nbRemotes = remotesBackups.length
const nbRemotes = Object.keys(this.remoteAdapters).length
const remoteMetadatas = {}
remotesBackups.forEach(async remoteBackups => {
remoteBackups.forEach(metadata => {
await asyncEach(Object.values(this.remoteAdapters), async remoteAdapter => {
const remoteMetadata = await remoteAdapter.listVmBackups(this._vmUuid, predicate)
remoteMetadata.forEach(metadata => {
const timestamp = metadata.timestamp
remoteMetadatas[timestamp] = (remoteMetadatas[timestamp] ?? 0) + 1
})
})
let transferList = []
let chain = []
const timestamps = [...localMetada.keys()]
timestamps.sort()
for (const timestamp of timestamps) {
if (remoteMetadatas[timestamp] !== nbRemotes) {
// this backup is not present in all the remote
// should be retransfered if not found later
transferList.push(localMetada.get(timestamp))
chain.push(localMetada.get(timestamp))
} else {
// backup is present in local and remote : the chain has already been transferred
transferList = []
chain = []
}
}
if (transferList.length > 0) {
const filteredTransferList = this._filterTransferList(transferList)
if (filteredTransferList.length > 0) {
return filteredTransferList
} else {
Task.info('This VM is excluded by the job filter')
return []
}
} else {
Task.info('No new data to upload for this VM')
}
return []
}
/**
*
* @param {*} vmPredicate a callback checking if backup is eligible for transfer. This filter MUST NOT cut delta chains
* @returns
*/
async _computeTransferList(vmPredicate) {
const sourceBackups = Object.values(await this._sourceRemoteAdapter.listVmBackups(this._vmUuid, vmPredicate))
const remotesBackups = await Promise.all(
Object.values(this.remoteAdapters).map(remoteAdapter => remoteAdapter.listVmBackups(this._vmUuid, vmPredicate))
)
const sourceBackupByJobId = groupBy(sourceBackups, 'jobId')
const transferByJobs = await Promise.all(
Object.values(sourceBackupByJobId).map(vmBackupsByJob =>
this.#computeTransferListPerJob(vmBackupsByJob, remotesBackups)
)
)
return transferByJobs.flat(1)
return chain
}
async run($defer) {

View File

@@ -157,7 +157,7 @@ export const AbstractXapi = class AbstractXapiVmBackupRunner extends Abstract {
}
const snapshotRef = await vm[settings.checkpointSnapshot ? '$checkpoint' : '$snapshot']({
ignoredVdisTag: '[NOBAK]',
ignoreNobakVdis: true,
name_label: this._getSnapshotNameLabel(vm),
unplugVusbs: true,
})
@@ -214,12 +214,8 @@ export const AbstractXapi = class AbstractXapiVmBackupRunner extends Abstract {
const allSettings = this.job.settings
const baseSettings = this._baseSettings
const xapi = this._xapi
// ensure all the event has been processed by the xapi
await xapi.barrier()
// ensure cached object are up to date
this._jobSnapshotVdis = this._jobSnapshotVdis.map(vdi => xapi.getObject(vdi.$ref))
const snapshotsPerSchedule = groupBy(this._jobSnapshotVdis, _ => _.other_config[SCHEDULE_ID])
const xapi = this._xapi
await asyncMap(Object.entries(snapshotsPerSchedule), async ([scheduleId, snapshots]) => {
const snapshotPerDatetime = groupBy(snapshots, _ => _.other_config[DATETIME])
@@ -231,20 +227,22 @@ export const AbstractXapi = class AbstractXapiVmBackupRunner extends Abstract {
...allSettings[scheduleId],
...allSettings[this._vm.uuid],
}
// ensure we never delete the last one for delta
const minRetention = this.job.mode === 'delta' ? 1 : 0
const retention = Math.max(settings.snapshotRetention ?? 0, minRetention)
// ensure we never delete the last one
const retention = Math.max(settings.snapshotRetention ?? 0, 1)
await asyncMap(getOldEntries(retention, datetimes), async datetime => {
const vdis = snapshotPerDatetime[datetime]
let vmRef
// if there is an attached VM => destroy the VM (Non CBT backups)
for (const vdi of vdis) {
const vbds = vdi.$VBDs.filter(({ $VM }) => $VM.is_control_domain === false)
if (vbds.length > 0) {
if (vdi.$VBDs.length > 0) {
const vbds = vdi.$VBDs
// only one VM linked to this vdi
// this will throw error for VDI still attached to control domain
assert.strictEqual(vbds.length, 1, 'VDI must be free or attached to exactly one VM')
const vm = vbds[0].$VM
assert.strictEqual(vm.is_control_domain, false, `Disk is still attached to DOM0 VM`) // don't delete a VM (especially a control domain)
assert.strictEqual(vm.is_a_snapshot, true, `VM must be a snapshot`) // don't delete a VM (especially a control domain)
const vmRefVdi = vm.$ref
@@ -267,9 +265,7 @@ export const AbstractXapi = class AbstractXapiVmBackupRunner extends Abstract {
}
})
})
}
async _removeSnapshotData() {
// now that we use CBT, we can destroy the data of the snapshot used for this backup
// going back to a previous version of XO not supporting CBT will create a full backup
// this will only do something after snapshot and transfer
@@ -278,22 +274,21 @@ export const AbstractXapi = class AbstractXapiVmBackupRunner extends Abstract {
this._exportedVm?.is_a_snapshot &&
// user don't want to keep the snapshot data
this._settings.snapshotRetention === 0 &&
// preferNbd is not a guarantee that the backup used NBD, depending on the network configuration,
// in that case next runs will be full, but there is not an easy way to prevent that
// preferNbd is not a guarantee that the backup used NBD, depending on the network configuration
this._settings.preferNbd &&
// only delete snapshost data if the config allows it
this._settings.cbtDestroySnapshotData
this.config.purgeSnapshotData
) {
Task.info('will delete snapshot data')
const vdiRefs = await this._xapi.VM_getDisks(this._exportedVm.$ref)
await this._xapi.call('VM.destroy', this._exportedVm.$ref)
const vdiRefs = await this._xapi.VM_getDisks(this._exportedVm?.$ref)
await xapi.call('VM.destroy', this._exportedVm.$ref)
for (const vdiRef of vdiRefs) {
try {
// data_destroy will fail with a VDI_NO_CBT_METADATA error if CBT is not enabled on this VDI
await this._xapi.VDI_dataDestroy(vdiRef)
await xapi.VDI_dataDestroy(vdiRef)
Task.info(`Snapshot data has been deleted`, { vdiRef })
} catch (error) {
Task.warning(`Couldn't delete snapshot data`, { error, vdiRef })
Task.warning(`Couldn't deleted snapshot data`, { error, vdiRef })
}
}
}
@@ -338,22 +333,15 @@ export const AbstractXapi = class AbstractXapiVmBackupRunner extends Abstract {
const reason = 'VM migration is blocked during backup'
await vm.update_blocked_operations({ pool_migrate: reason, migrate_send: reason })
$defer(async () => {
$defer(() =>
// delete the entries if they did not exist previously or if they were
// equal to reason (which happen if a previous backup was interrupted
// before resetting them)
await vm.update_blocked_operations({
vm.update_blocked_operations({
migrate_send: migrate_send === undefined || migrate_send === reason ? null : migrate_send,
pool_migrate: pool_migrate === undefined || pool_migrate === reason ? null : pool_migrate,
})
// 2024-08-19 - Work-around a XAPI bug where allowed_operations are not properly computed when blocked_operations is updated
//
// this is a problem because some clients (e.g. XenCenter) use this field to allow operations.
//
// internal source: https://team.vates.fr/vates/pl/mjmxnce9qfdx587r3qpe4z91ho
await vm.$call('update_allowed_operations')
})
)
}
await this._fetchJobSnapshots()
@@ -385,7 +373,6 @@ export const AbstractXapi = class AbstractXapiVmBackupRunner extends Abstract {
await this._fetchJobSnapshots()
await this._removeUnusedSnapshots()
await this._removeSnapshotData()
}
await this._healthCheck()
}

View File

@@ -140,7 +140,6 @@ export class IncrementalRemoteWriter extends MixinRemoteWriter(AbstractIncrement
if (isDifferencing) {
assert.notStrictEqual(
parentVdiPaths,
undefined,
'checkbasevdi must be called before updateUuidAndChain for incremental backups'
)
const parentPath = parentVdiPaths[dirname(path)]

View File

@@ -19,10 +19,10 @@ export class IncrementalXapiWriter extends MixinXapiWriter(AbstractIncrementalWr
// @todo use an index if possible
// @todo : this seems similare to decorateVmMetadata
const replicatedVdis = sr.$VDIs
.filter(vdi => {
const replicatedVdis = sr.$VDIs
.filter(({ other_config }) => {
// REPLICATED_TO_SR_UUID is not used here since we are already filtering from sr.$VDIs
return baseUuidToSrcVdi.has(vdi?.other_config[COPY_OF])
return baseUuidToSrcVdi.has(other_config?.[COPY_OF])
})
.map(({ other_config }) => other_config?.[COPY_OF])
.filter(_ => !!_)
@@ -52,10 +52,10 @@ export class IncrementalXapiWriter extends MixinXapiWriter(AbstractIncrementalWr
this.cleanup = task.wrapFn(this.cleanup, !hasHealthCheckSr)
this.healthCheck = task.wrapFn(this.healthCheck, hasHealthCheckSr)
return task.run(() => this._prepare(isFull))
return task.run(() => this._prepare())
}
async _prepare(isFull) {
async _prepare() {
const settings = this._settings
const { uuid: srUuid, $xapi: xapi } = this._sr
const vmUuid = this._vmUuid
@@ -67,19 +67,14 @@ export class IncrementalXapiWriter extends MixinXapiWriter(AbstractIncrementalWr
this._oldEntries = getOldEntries(settings.copyRetention - 1, listReplicatedVms(xapi, scheduleId, srUuid, vmUuid))
if (settings.deleteFirst) {
// we want to keep the baseVM when copying a delta
// even if we want to keep only one after
let mostRecentEntry
if (this._oldEntries.length > 1 && settings.copyRetention === 1 && !isFull) {
mostRecentEntry = this._oldEntries.pop()
}
await this._deleteOldEntries()
this._oldEntries = mostRecentEntry !== undefined ? [mostRecentEntry] : []
}
}
async cleanup() {
await this._deleteOldEntries()
if (!this._settings.deleteFirst) {
await this._deleteOldEntries()
}
}
async _deleteOldEntries() {
@@ -103,11 +98,10 @@ export class IncrementalXapiWriter extends MixinXapiWriter(AbstractIncrementalWr
.filter(_ => !!_)
// @todo use index ?
const replicatedVdis = sr.$VDIs
.filter(vdi => {
// REPLICATED_TO_SR_UUID is not used here since we are already filtering from sr.$VDIs
return sourceVdiUuids.includes(vdi?.other_config[COPY_OF])
})
const replicatedVdis = sr.$VDIs.filter(({ other_config }) => {
// REPLICATED_TO_SR_UUID is not used here since we are already filtering from sr.$VDIs
return sourceVdiUuids.includes(other_config?.[COPY_OF])
})
Object.values(backup.vdis).forEach(vdi => {
vdi.other_config[COPY_OF] = vdi.uuid

View File

@@ -8,7 +8,7 @@
"type": "git",
"url": "https://github.com/vatesfr/xen-orchestra.git"
},
"version": "0.54.0",
"version": "0.49.1",
"engines": {
"node": ">=14.18"
},
@@ -24,8 +24,8 @@
"@vates/compose": "^2.1.0",
"@vates/decorate-with": "^2.1.0",
"@vates/disposable": "^0.1.5",
"@vates/fuse-vhd": "^2.1.1",
"@vates/nbd-client": "^3.1.0",
"@vates/fuse-vhd": "^2.1.0",
"@vates/nbd-client": "^3.0.2",
"@vates/parse-duration": "^0.1.1",
"@xen-orchestra/async-map": "^0.1.2",
"@xen-orchestra/fs": "^4.1.7",
@@ -46,9 +46,8 @@
"proper-lockfile": "^4.1.2",
"tar": "^6.1.15",
"uuid": "^9.0.0",
"value-matcher": "^0.2.0",
"vhd-lib": "^4.11.0",
"xen-api": "^4.3.1",
"vhd-lib": "^4.9.2",
"xen-api": "^4.0.0",
"yazl": "^2.5.1"
},
"devDependencies": {
@@ -59,7 +58,7 @@
"tmp": "^0.2.1"
},
"peerDependencies": {
"@xen-orchestra/xapi": "^7.6.0"
"@xen-orchestra/xapi": "^6.0.0"
},
"license": "AGPL-3.0-or-later",
"author": {

View File

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

View File

@@ -1,29 +0,0 @@
### `defined()`
Returns the first non-`undefined` value from a list of arguments, evaluating functions if needed.
There is two ways to use this function:
- either with a single array argument: it should return the first non-undefined item
- or with multiple arguments: it should return the first non-undefined argument
If only `undefined` values, return `undefined`.
```js
import defined from '@xen-orchestra/defined/index.js'
defined(undefined, 'foo', 42)
// Returns 'foo'
defined([undefined, null, 10])
// Returns null
defined([undefined, undefined], [undefined, undefined, 10])
// Returns [undefined, undefined]
defined(() => 'bar', 42)
// Returns 'bar'
defined(undefined, undefined)
// Returns undefined
```

View File

@@ -14,37 +14,6 @@ Installation of the [npm package](https://npmjs.org/package/@xen-orchestra/defin
npm install --save @xen-orchestra/defined
```
## Usage
### `defined()`
Returns the first non-`undefined` value from a list of arguments, evaluating functions if needed.
There is two ways to use this function:
- either with a single array argument: it should return the first non-undefined item
- or with multiple arguments: it should return the first non-undefined argument
If only `undefined` values, return `undefined`.
```js
import defined from '@xen-orchestra/defined/index.js'
defined(undefined, 'foo', 42)
// Returns 'foo'
defined([undefined, null, 10])
// Returns null
defined([undefined, undefined], [undefined, undefined, 10])
// Returns [undefined, undefined]
defined(() => 'bar', 42)
// Returns 'bar'
defined(undefined, undefined)
// Returns undefined
```
## Contributions
Contributions are _very_ welcomed, either on the documentation or on

View File

@@ -22,7 +22,7 @@ function defined() {
}
for (let i = 0; i < n; ++i) {
let arg = args[i]
let arg = arguments[i]
if (typeof arg === 'function') {
arg = get(arg)
}

View File

@@ -1,30 +0,0 @@
import { describe, it } from 'node:test'
import assert from 'node:assert/strict'
import defined_ from '@xen-orchestra/defined/index.js'
// for each test, use the flat syntax and the array syntax
for (const [title, defined] of Object.entries({
'defined(...values)': defined_,
'defined([ ...values ])': (...args) => defined_(args),
})) {
describe(title, () => {
it('returns the first non undefined value', () => {
assert.deepEqual(defined(undefined, 'foo', 42), 'foo')
})
it('returns undefined if only undefined values', () => {
assert.equal(defined(undefined, undefined), undefined)
})
it('resolves functions with `get(fn)`', () => {
const o = { foo: undefined, baz: 'baz' }
assert.deepEqual(
defined(
() => o.foo.bar,
() => o.baz
),
'baz'
)
})
})
}

View File

@@ -1,7 +1,7 @@
{
"private": false,
"name": "@xen-orchestra/defined",
"version": "0.0.2",
"version": "0.0.1",
"license": "ISC",
"description": "Utilities to help handling (possibly) undefined values",
"homepage": "https://github.com/vatesfr/xen-orchestra/tree/master/@xen-orchestra/defined",
@@ -23,7 +23,6 @@
"node": ">=6"
},
"scripts": {
"postversion": "npm publish",
"test": "node --test"
"postversion": "npm publish"
}
}

View File

@@ -17,19 +17,19 @@
"xo-lift-remote-immutability": "./liftProtection.mjs"
},
"license": "AGPL-3.0-or-later",
"version": "1.0.12",
"version": "1.0.6",
"engines": {
"node": ">=14.0.0"
},
"dependencies": {
"@vates/async-each": "^1.0.0",
"@xen-orchestra/backups": "^0.54.0",
"@xen-orchestra/backups": "^0.49.1",
"@xen-orchestra/log": "^0.6.0",
"app-conf": "^3.0.0",
"chokidar": "^3.5.3",
"execa": "^5.0.0",
"ms": "^2.1.3",
"vhd-lib": "^4.11.0"
"vhd-lib": "^4.9.2"
},
"devDependencies": {
"rimraf": "^5.0.5",

View File

@@ -2,17 +2,7 @@
## **next**
- Handle IPv6 hosts
## **0.4.0** (2024-09-30)
- [Settings] Default UI theme is now _auto_ instead of _dark_
## **0.2.7** (2024-07-31)
- [Pool/Dashboard] Add missing translations for hosts and VMs statuses (PR [#7744](https://github.com/vatesfr/xen-orchestra/pull/7744))
- [i18n] Add Persian translation (based on the contribution made by [@Jokar-xen](https://github.com/Jokar-xen)) (PR [#7775](https://github.com/vatesfr/xen-orchestra/pull/7775))
- [Access XOA] Support `xo-server`'s' setting `http.publicUrl` to redirect to a custom URL when "Access XOA" button is clicked in XO Lite [Forum#9392](https://xcp-ng.org/forum/topic/9392) (PR [#7849](https://github.com/vatesfr/xen-orchestra/pull/7849))
## **0.2.3** (2024-05-31)

View File

@@ -5,6 +5,213 @@
- `yarn`
- `yarn dev`
## Guidelines
## Conventions
Please follow the guidelines from the `@xen-orchestra/web-core/docs/guidelines` directory.
### File names
| Type | Format | Exemple |
| ---------- | ---------------------------------------- | ----------------------------------- |
| Component | `components/<PascalCase>.vue` | `components/FooBar.vue` |
| View | `views/<PascalCase>View.vue` | `views/FooBarView.vue` |
| Composable | `composables/<kebab-case>.composable.ts` | `composables/foo-bar.composable.ts` |
| Store | `stores/<kebab-case>.store.ts` | `stores/foo-bar.store.ts` |
| Other | `libs/<kebab-case>.ts` | `libs/foo-bar.ts` |
For components and views, prepend the subdirectories names to the resulting filename.
Example: `components/foo/bar/FooBarBaz.vue`
### Vue Components
Use Vue Single File Components (`*.vue`).
Insert blocks in the following order: `template`, `script` then `style`.
#### Template
Use HTML.
If your component only has one root element, add the component name as a class.
```vue
<!-- MyComponent.vue -->
<template>
<div class="my-component">...</div>
</template>
```
#### Script
Use composition API + TypeScript + `setup` attribute (`<script lang="ts" setup>`).
Note: When reading Vue official doc, don't forget to set "API Preference" toggle (in the upper left) on "Composition".
```vue
<script lang="ts" setup>
import { computed, ref } from 'vue'
const props = defineProps<{
greetings: string
}>()
const firstName = ref('')
const lastName = ref('')
const fullName = computed(() => `${props.greetings} ${firstName.value} ${lastName.value}`)
</script>
```
#### CSS
Always use `scoped` attribute (`<style scoped>`).
Nested rules are allowed.
Vue variables can be interpolated with `v-bind`.
```vue
<script lang="ts" setup>
import { ref } from 'vue'
const fontSize = ref('2rem')
</script>
<style scoped>
.my-item {
.nested {
font-size: v-bind(fontSize);
}
}
</style>
```
### Icons
This project is using Font Awesome 6 Free.
Icons can be displayed with the `UiIcon` component.
Passing `undefined` as `icon` prop will disable the component (no need to use an additional `v-if` condition).
Use the `busy` prop to display a loader icon.
```vue
<template>
<div>
<UiIcon :icon="faDisplay" />
</div>
</template>
<script lang="ts" setup>
import UiIcon from '@/components/ui/icon/UiIcon.vue'
import { faDisplay } from '@fortawesome/free-solid-svg-icons'
</script>
```
#### Font weight <=> Style name
Here is the equivalent between font weight and style name.
| Style name | Font weight |
| ---------- | ----------- |
| Solid | 900 |
| Regular | 400 |
### CSS
Always use `rem` unit (`1rem` = `10px`)
### Store
Use Pinia store with setup function.
State are `ref`
Getters are `computed`
Actions/Mutations are simple functions
#### Naming convention
For a `foobar` store, create a `store/foobar.store.ts` then use `defineStore('foobar', setupFunc)`
#### Example
```typescript
import { computed, ref } from 'vue'
export const useFoobarStore = defineStore('foobar', () => {
const aStateVar = ref(0)
const otherStateVar = ref(0)
const aGetter = computed(() => aStateVar.value * 2)
const anAction = () => (otherStateVar.value += 10)
return {
aStateVar,
otherStateVar,
aGetter,
anAction,
}
})
```
### I18n
Internationalization of the app is done with [Vue-i18n](https://vue-i18n.intlify.dev/).
Locale files are located in `src/locales` directory.
Source of truth is `en-US.json` file.
To quickly check if there are missing translations in other locale files, open `main.ts` and check the `messages`
property of `createI18n()` for TypeScript error.
#### Example
```json
{
"hello": "Hello",
"hello_name": "Hello {name}",
"hello_linked": "@:hello_name how are you?",
"hello_plural": "No hello | Hello to you | Hello to {count} persons"
}
```
```html
<!-- String -->
<p>{{ $t("hello") }}</p>
<!-- Hello -->
<p>{{ $t("hello_name", { name: "World" }) }}</p>
<!-- Hello World -->
<p>{{ $t("hello_linked", { name: "World" }) }}</p>
<!-- Hello World how are you? -->
<p>{{ $tc("hello_plural", 0) }}</p>
<!-- No hello -->
<p>{{ $tc("hello_plural", 1) }}</p>
<!-- Hello to you -->
<p>{{ $tc("hello_plural", 4) }}</p>
<!-- Hello to 4 persons -->
<!-- Date and time -->
<p>{{ $d(date, "date_short") }}</p>
<!-- 9/10/2022 -->
<p>{{ $d(date, "date_medium") }}</p>
<!-- Sep 10, 2022 -->
<p>{{ $d(date, "date_long") }}</p>
<!-- September 10, 2022 -->
<p>{{ $d(date, "datetime_short") }}</p>
<!-- 9/10/2022, 06:30 PM -->
<p>{{ $d(date, "datetime_medium") }}</p>
<!-- Sep 10, 2022, 06:30 PM -->
<p>{{ $d(date, "datetime_long") }}</p>
<!-- September 10, 2022 at 06:30 PM -->
<p>{{ $d(date, "time") }}</p>
<!-- 06:30 PM -->
<!-- Number -->
<p>{{ $n(1234567.898765) }}</p>
<!-- 1,234,567.899 -->
```

View File

@@ -1,7 +1,6 @@
/// <reference types="vite/client" />
/// <reference types="json-rpc-2.0/dist" />
/// <reference types="vite-plugin-pages/client" />
/// <reference types="novnc__novnc" />
declare const XO_LITE_VERSION: string
declare const XO_LITE_GIT_HEAD: string

View File

@@ -1,6 +1,6 @@
{
"name": "@xen-orchestra/lite",
"version": "0.4.0",
"version": "0.2.3",
"type": "module",
"scripts": {
"dev": "GIT_HEAD=$(git rev-parse HEAD) vite",
@@ -31,7 +31,7 @@
"@vueuse/core": "^10.7.1",
"@vueuse/math": "^10.7.1",
"@vueuse/shared": "^10.7.1",
"@xen-orchestra/web-core": "^0.3.0",
"@xen-orchestra/web-core": "*",
"complex-matcher": "^0.7.1",
"d3-time-format": "^4.1.0",
"decorator-synchronized": "^0.6.0",
@@ -56,10 +56,10 @@
"postcss-nested": "^6.0.1",
"typescript": "~5.3.3",
"vite": "^5.0.11",
"vue": "~3.4.13",
"vue": "^3.4.13",
"vue-echarts": "^6.6.8",
"vue-i18n": "^9.9.0",
"vue-router": "^4.4.0",
"vue-router": "^4.2.5",
"vue-tsc": "^1.8.27",
"zx": "^7.2.3"
},

View File

@@ -270,13 +270,8 @@ if (ghRelease || deploy) {
if (ghRelease) {
console.log(`Adding LICENSE file to ${dist}`)
await fs.copy(fileURLToPath(new URL('agpl-3.0.txt', import.meta.url)), path.join(dist, 'LICENSE'))
console.log(`Adding CHANGELOG.md file to ${dist}`)
await fs.copy(fileURLToPath(new URL('../CHANGELOG.md', import.meta.url)), path.join(dist, 'CHANGELOG.md'))
console.log(`Adding xolite-loader.html to ${dist}`)
await fs.copy(path.join(dist, 'index.html'), path.join(dist, 'xolite.html'))
await fs.copy(fileURLToPath(new URL('xolite-loader.html', import.meta.url)), path.join(dist, 'index.html'))
}
if (deploy) {

View File

@@ -1,30 +0,0 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
<meta name="theme-color" content="#cc584c" />
<title>XO Lite</title>
<script>
;(async () => {
try {
// Try to load XO Lite from lite.xen-orchestra.com
const response = await fetch('https://lite.xen-orchestra.com/dist/index.html')
if (!response.ok) {
throw new Error(`Cannot download XO Lite from lite.xen-orchestra.com (${response.status})`)
}
document.open()
document.write(await response.text())
document.close()
} catch (err) {
console.log(err?.message ?? err)
// Fallback to local version of XO Lite
document.open()
document.write(await (await fetch('./xolite.html')).text())
document.close()
}
})()
</script>
</head>
</html>

View File

@@ -75,7 +75,7 @@ useUnreachableHosts()
overflow: auto;
flex: 1;
height: calc(100vh - 5.5rem);
background-color: var(--color-neutral-background-secondary);
background-color: var(--background-color-secondary);
&.no-ui {
height: 100vh;

View File

@@ -1,5 +1,5 @@
<template>
<MenuList placement="bottom-end" border>
<MenuList placement="bottom-end" shadow>
<template #trigger="{ open, isOpen }">
<button type="button" :class="{ active: isOpen }" class="account-button" @click="open">
<UiIcon :icon="faCircleUser" class="user-icon" />
@@ -46,19 +46,19 @@ const openFeedbackUrl = () => {
const openSettings = () => router.push({ name: 'settings' })
</script>
<style lang="postcss" scoped>
<style scoped>
.account-button {
display: flex;
align-items: center;
padding: 1rem;
color: var(--color-neutral-txt-primary);
color: var(--color-grey-100);
border: none;
border-radius: 0.8rem;
background-color: var(--color-neutral-background-secondary);
background-color: var(--background-color-secondary);
gap: 0.8rem;
&:disabled {
color: var(--color-neutral-border);
color: var(--color-grey-500);
}
&:not(:disabled) {
@@ -67,12 +67,12 @@ const openSettings = () => router.push({ name: 'settings' })
&:hover,
&:active,
&.active {
background-color: var(--color-neutral-background-primary);
background-color: var(--background-color-primary);
}
&:active,
&.active {
color: var(--color-normal-txt-base);
color: var(--color-purple-base);
}
}
}
@@ -86,6 +86,6 @@ const openSettings = () => router.push({ name: 'settings' })
}
.menu-item-logout {
color: var(--color-danger-txt-base);
color: var(--color-red-base);
}
</style>

View File

@@ -39,8 +39,8 @@ const { trigger: navigationTrigger } = storeToRefs(navigationStore)
justify-content: space-between;
height: 5.5rem;
padding: 1rem;
border-bottom: 0.1rem solid var(--color-neutral-border);
background-color: var(--color-neutral-background-secondary);
border-bottom: 0.1rem solid var(--color-grey-500);
background-color: var(--background-color-secondary);
img {
width: 4rem;

View File

@@ -27,7 +27,7 @@
<FormCheckbox v-model="rememberMe" />
{{ $t('keep-me-logged') }}
</label>
<UiButton size="medium" color="normal" level="primary" type="submit" :busy="isConnecting">
<UiButton type="submit" :busy="isConnecting">
{{ $t('login') }}
</UiButton>
</template>
@@ -107,7 +107,6 @@ async function handleSubmit() {
display: flex;
margin: 1rem;
width: fit-content;
& .form-checkbox {
margin: auto 1rem auto auto;
}
@@ -120,7 +119,7 @@ async function handleSubmit() {
justify-content: center;
min-height: 100vh;
max-width: 100vw;
background-color: var(--color-neutral-background-primary);
background-color: var(--background-color-primary);
}
form {
@@ -132,10 +131,10 @@ form {
justify-content: center;
margin: 0 auto;
padding: 8.5rem;
background-color: var(--color-neutral-background-secondary);
background-color: var(--background-color-secondary);
.error {
color: var(--color-danger-txt-base);
color: var(--color-red-base);
}
}
@@ -156,7 +155,7 @@ input {
max-width: 100%;
margin-bottom: 1rem;
padding: 1rem 1.5rem;
border: 1px solid var(--color-neutral-border);
border: 1px solid var(--color-grey-500);
border-radius: 0.8rem;
background-color: white;
}

View File

@@ -60,7 +60,7 @@ useEventListener(
}
code:not(.hljs-code) {
background-color: var(--color-normal-background-selected);
background-color: var(--background-color-purple-10);
padding: 0.3rem 0.6rem;
border-radius: 0.6rem;
}
@@ -81,12 +81,12 @@ useEventListener(
}
thead th {
border-bottom: 2px solid var(--color-neutral-border);
background-color: var(--color-neutral-background-secondary);
border-bottom: 2px solid var(--color-grey-500);
background-color: var(--background-color-secondary);
}
tbody td {
border-bottom: 1px solid var(--color-neutral-border);
border-bottom: 1px solid var(--color-grey-500);
}
}
@@ -103,11 +103,11 @@ useEventListener(
background-color: transparent;
&:hover {
color: var(--color-normal-txt-base);
color: var(--color-purple-base);
}
&:active {
color: var(--color-normal-txt-hover);
color: var(--color-purple-d20);
}
}
}

View File

@@ -45,8 +45,8 @@ whenever(isOpen, () => {
max-width: 37rem;
height: calc(100vh - 5.5rem);
padding: 0.5rem;
border-right: 1px solid var(--color-neutral-border);
background-color: var(--color-neutral-background-primary);
border-right: 1px solid var(--color-grey-500);
background-color: var(--background-color-primary);
&.collapsible {
position: fixed;

View File

@@ -181,7 +181,7 @@ const valueInputAfter = computed(() => (newFilter.value.builder.comparison === '
.collection-filter-row {
display: flex;
align-items: center;
border-bottom: 1px solid var(--color-neutral-background-secondary);
border-bottom: 1px solid var(--background-color-secondary);
gap: 1rem;
.or {

View File

@@ -54,14 +54,14 @@ const isIcon = (maybeIcon: any): maybeIcon is IconDefinition => typeof maybeIcon
align-items: stretch;
overflow: hidden;
padding: 0 0.7rem;
border: 1px solid var(--color-neutral-border);
border: 1px solid var(--color-grey-500);
border-radius: 0.8rem;
background-color: var(--color-neutral-background-primary);
background-color: var(--color-grey-600);
box-shadow: var(--shadow-100);
gap: 0.1rem;
&:focus-within {
outline: 1px solid var(--color-normal-item-active);
outline: 1px solid var(--color-purple-l40);
}
}
@@ -71,7 +71,7 @@ const isIcon = (maybeIcon: any): maybeIcon is IconDefinition => typeof maybeIcon
}
.form-widget:hover .widget {
border-color: var(--color-normal-item-hover);
border-color: var(--color-purple-l60);
}
.element {
@@ -93,8 +93,8 @@ const isIcon = (maybeIcon: any): maybeIcon is IconDefinition => typeof maybeIcon
font-size: inherit;
border: none;
outline: none;
color: var(--color-neutral-txt-primary);
background-color: var(--color-neutral-background-primary);
color: var(--color-grey-100);
background-color: var(--color-grey-600);
flex: 1;
&:disabled {
@@ -134,7 +134,7 @@ const isIcon = (maybeIcon: any): maybeIcon is IconDefinition => typeof maybeIcon
&:disabled {
cursor: not-allowed;
color: var(--color-neutral-txt-secondary);
color: var(--color-grey-200);
}
}
</style>

View File

@@ -9,7 +9,7 @@
</th>
<td v-if="hasMultipleHosts">
<UiSpinner v-if="!areAllLoaded" />
<VtsCounter
<UiCounter
v-else
v-tooltip="{
placement: 'left',
@@ -19,9 +19,7 @@
}"
:value="patch.$hostRefs.size"
class="counter"
accent="danger"
variant="primary"
size="small"
color="error"
/>
</td>
</tr>
@@ -33,7 +31,7 @@ import UiCardSpinner from '@/components/ui/UiCardSpinner.vue'
import UiSpinner from '@/components/ui/UiSpinner.vue'
import UiTable from '@/components/ui/UiTable.vue'
import type { XenApiPatchWithHostRefs } from '@/composables/host-patches.composable'
import VtsCounter from '@core/components/counter/VtsCounter.vue'
import UiCounter from '@core/components/UiCounter.vue'
import { vTooltip } from '@core/directives/tooltip.directive'
import { useUiStore } from '@core/stores/ui.store'
import { computed } from 'vue'

View File

@@ -23,7 +23,7 @@ defineProps<{
<style lang="postcss" scoped>
.error {
margin: 0.5rem 0;
color: var(--color-danger-txt-base);
color: var(--color-red-base);
& svg {
margin-right: 0.5rem;

View File

@@ -22,6 +22,6 @@
margin: auto;
width: 8em;
font-style: normal;
color: var(--color-danger-txt-base);
color: var(--color-red-base);
}
</style>

View File

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

View File

@@ -79,7 +79,7 @@ const objectRoute = computed(() => {
<style lang="postcss" scoped>
.unknown {
color: var(--color-neutral-txt-secondary);
color: var(--color-grey-300);
font-style: italic;
}
</style>

View File

@@ -26,14 +26,14 @@ const id = computed(() => props.id ?? (currentRoute.value.params.uuid as I))
const isRecordNotFound = computed(() => props.isReady && !props.uuidChecker(id.value))
</script>
<style lang="postcss" scoped>
<style scoped>
.wrapper-spinner {
display: flex;
height: 100%;
}
.spinner {
color: var(--color-normal-txt-base);
color: var(--color-purple-base);
display: flex;
margin: auto;
width: 10rem;

View File

@@ -24,7 +24,7 @@ import UiStatusPanel from '@/components/ui/UiStatusPanel.vue'
<style lang="postcss" scoped>
.contact {
color: var(--color-neutral-txt-primary);
color: var(--color-grey-100);
& a {
text-transform: lowercase;

View File

@@ -43,7 +43,7 @@ const masterSessionStorage = useSessionStorage('master', null)
<style lang="postcss" scoped>
.warning-not-current-pool {
color: var(--color-warning-txt-base);
color: var(--color-orange-base);
cursor: pointer;
.wrapper {

View File

@@ -26,22 +26,18 @@ const className = computed(() => `state-${props.state.toLocaleLowerCase()}`)
<style lang="postcss" scoped>
.power-state-icon {
color: var(--color-normal-txt-item);
color: var(--color-purple-d60);
&.state-running {
color: var(--color-success-item-base);
color: var(--color-green-base);
}
&.state-paused {
color: var(--color-neutral-txt-secondary);
color: var(--color-grey-300);
}
&.state-suspended {
color: var(--color-normal-txt-hover);
}
&.state-halted {
color: var(--color-danger-item-base);
color: var(--color-purple-d20);
}
}
</style>

View File

@@ -39,7 +39,7 @@ const progress = computed(() => {
.progress-circle-fill {
animation: progress 1s ease-out forwards;
fill: none;
stroke: var(--color-success-item-base);
stroke: var(--color-green-base);
stroke-width: 1.2;
stroke-linecap: round;
stroke-dasharray: v-bind(progress), 100;
@@ -48,13 +48,13 @@ const progress = computed(() => {
.progress-circle-background {
fill: none;
stroke-width: 1.2;
stroke: var(--color-neutral-background-disabled);
stroke: var(--color-grey-500);
}
.progress-circle-text {
font-size: 0.7rem;
font-weight: bold;
fill: var(--color-success-item-base);
fill: var(--color-green-base);
text-anchor: middle;
alignment-baseline: middle;
}

View File

@@ -4,7 +4,7 @@
<script lang="ts" setup>
import { useXenApiStore } from '@/stores/xen-api.store'
import VncClient from '@novnc/novnc/lib/rfb'
import VncClient from '@novnc/novnc/core/rfb'
import { promiseTimeout } from '@vueuse/shared'
import { fibonacci } from 'iterable-backoff'
import { computed, onBeforeUnmount, ref, watchEffect } from 'vue'
@@ -32,7 +32,7 @@ const url = computed(() => {
let vncClient: VncClient | undefined
let nConnectionAttempts = 0
function handleDisconnectionEvent() {
const handleDisconnectionEvent = () => {
clearVncClient()
if (props.isConsoleAvailable) {
@@ -51,12 +51,9 @@ function handleDisconnectionEvent() {
createVncConnection()
}
}
const handleConnectionEvent = () => (nConnectionAttempts = 0)
function handleConnectionEvent() {
nConnectionAttempts = 0
}
function clearVncClient() {
const clearVncClient = () => {
if (vncClient === undefined) {
return
}
@@ -64,12 +61,14 @@ function clearVncClient() {
vncClient.removeEventListener('disconnect', handleDisconnectionEvent)
vncClient.removeEventListener('connect', handleConnectionEvent)
vncClient.disconnect()
if (vncClient._rfbConnectionState !== 'disconnected') {
vncClient.disconnect()
}
vncClient = undefined
}
async function createVncConnection() {
const createVncConnection = async () => {
if (nConnectionAttempts !== 0) {
await promiseTimeout(FIBONACCI_MS_ARRAY[nConnectionAttempts - 1])

View File

@@ -29,18 +29,18 @@ defineProps<{
align-items: center;
height: 6rem;
padding: 0 1.5rem;
border-bottom: 1px solid var(--color-neutral-border);
background-color: var(--color-neutral-background-primary);
border-bottom: 1px solid var(--color-grey-500);
background-color: var(--background-color-primary);
gap: 0.8rem;
}
.icon {
font-size: 2.5rem;
color: var(--color-normal-txt-base);
color: var(--color-purple-base);
}
.title {
color: var(--color-neutral-txt-primary);
color: var(--color-grey-100);
}
.actions {

View File

@@ -60,28 +60,28 @@ const computedData = computed(() => {
}
.progress-item:nth-child(1) {
--progress-bar-color: var(--color-normal-txt-item);
--progress-bar-color: var(--color-purple-d60);
}
.progress-item:nth-child(2) {
--progress-bar-color: var(--color-normal-txt-active);
--progress-bar-color: var(--color-purple-d40);
}
.progress-item:nth-child(3) {
--progress-bar-color: var(--color-normal-txt-hover);
--progress-bar-color: var(--color-purple-d20);
}
.progress-item {
--progress-bar-height: 1.2rem;
--progress-bar-color: var(--color-normal-item-hover);
--progress-bar-background-color: var(--color-neutral-background-disabled);
--progress-bar-color: var(--color-purple-l20);
--progress-bar-background-color: var(--color-grey-500);
&.warning {
--progress-bar-color: var(--color-warning-item-base);
--progress-bar-color: var(--color-orange-base);
}
&.error {
--progress-bar-color: var(--color-danger-item-base);
--progress-bar-color: var(--color-red-base);
}
}
</style>

View File

@@ -1,24 +1,8 @@
<template>
<UiButton
v-if="xoaFound"
size="medium"
color="normal"
level="primary"
:left-icon="faArrowUpRightFromSquare"
class="xoa-button"
@click="openXoa()"
>
<UiButton v-if="xoaFound" :left-icon="faArrowUpRightFromSquare" class="xoa-button" @click="openXoa()">
{{ $t('access-xoa') }}
</UiButton>
<UiButton
v-else
size="medium"
color="normal"
level="primary"
:left-icon="faDownload"
class="xoa-button"
@click="openXoaDeploy()"
>
<UiButton v-else :left-icon="faDownload" class="xoa-button" @click="openXoaDeploy()">
{{ $t('deploy-xoa') }}
</UiButton>
</template>
@@ -46,8 +30,7 @@ interface InterfaceInfo {
interface ClientInfo {
lastConnected: number
networkInterfaces?: Record<string, InterfaceInfo[]>
publicUrl?: string
networkInterfaces: Record<string, InterfaceInfo[]>
}
const xoasInfo = computed(() => {
@@ -77,12 +60,7 @@ const xoaAddress = computed(() => {
return
}
const { networkInterfaces, publicUrl } = xoaInfo.value
if (publicUrl !== undefined) {
return publicUrl
}
const { networkInterfaces } = xoaInfo.value
if (networkInterfaces === undefined || Object.keys(networkInterfaces).length === 0) {
return
}

View File

@@ -3,17 +3,11 @@
<TabItem v-bind="tab(TAB.PROPS, propParams)">Props</TabItem>
<TabItem class="event-tab" v-bind="tab(TAB.EVENTS, eventParams)">
Events
<VtsCounter
v-if="unreadEventsCount > 0"
:value="unreadEventsCount"
accent="success"
variant="primary"
size="small"
/>
<UiCounter v-if="unreadEventsCount > 0" :value="unreadEventsCount" color="success" />
</TabItem>
<TabItem v-bind="tab(TAB.SLOTS, slotParams)">Slots</TabItem>
<TabItem v-bind="tab(TAB.SETTINGS, settingParams)">Settings</TabItem>
<MenuList placement="bottom" border>
<MenuList placement="bottom" shadow>
<template #trigger="{ open, isOpen }">
<TabItem :active="isOpen" :disabled="presets === undefined" class="preset-tab" @click="open">
<UiIcon :icon="faSliders" />
@@ -41,9 +35,7 @@
<UiCardTitle>
Logs
<template #right>
<UiButton v-if="eventsLog.length > 0" size="medium" color="normal" level="tertiary" @click="eventsLog = []">
Clear
</UiButton>
<UiButton v-if="eventsLog.length > 0" level="tertiary" @click="eventsLog = []"> Clear </UiButton>
</template>
</UiCardTitle>
<div class="events-log">
@@ -86,11 +78,11 @@ import {
type Param,
} from '@/libs/story/story-param'
import UiButton from '@core/components/button/UiButton.vue'
import VtsCounter from '@core/components/counter/VtsCounter.vue'
import MenuItem from '@core/components/menu/MenuItem.vue'
import MenuList from '@core/components/menu/MenuList.vue'
import TabItem from '@core/components/tab/TabItem.vue'
import TabList from '@core/components/tab/TabList.vue'
import UiCounter from '@core/components/UiCounter.vue'
import { faSliders } from '@fortawesome/free-solid-svg-icons'
import 'highlight.js/styles/github-dark.css'
import { uniqueId, upperFirst } from 'lodash-es'
@@ -117,8 +109,6 @@ enum TAB {
SETTINGS,
}
const selectedTab = ref<TAB>(TAB.NONE)
const tab = (tab: TAB, params: Param[]) =>
reactive({
onClick: () => (selectedTab.value = tab),
@@ -141,6 +131,8 @@ const eventParams = computed(() => [
const settingParams = computed(() => props.params.filter(isSettingParam))
const slotParams = computed(() => props.params.filter(isSlotParam))
const selectedTab = ref<TAB>(TAB.NONE)
onBeforeMount(() => {
if (propParams.value.length !== 0) {
selectedTab.value = TAB.PROPS

View File

@@ -22,12 +22,12 @@
th,
td {
padding: 0.3rem 0.6rem;
border-bottom: 0.1rem solid var(--color-neutral-border);
border-bottom: 0.1rem solid var(--color-grey-500);
vertical-align: center;
}
&:nth-child(odd) {
background-color: var(--color-normal-background-selected);
background-color: var(--background-color-purple-10);
}
}

View File

@@ -127,14 +127,14 @@ const openRawValueModal = (code: string) =>
align-items: center;
padding: 0.4rem 0.6rem;
cursor: pointer;
color: var(--color-neutral-txt-secondary);
color: var(--color-grey-300);
border-radius: 0.4rem;
gap: 0.6rem;
&.active {
font-weight: 600;
cursor: default;
color: var(--color-success-item-hover);
color: var(--color-green-l20);
}
}
}
@@ -157,7 +157,7 @@ const openRawValueModal = (code: string) =>
.help {
font-style: italic;
color: var(--color-neutral-txt-secondary);
color: var(--color-grey-200);
}
.default-value {
@@ -168,12 +168,12 @@ const openRawValueModal = (code: string) =>
font-weight: 600;
font-style: normal;
opacity: 1;
color: var(--color-success-txt-base);
color: var(--color-green-base);
}
}
.v-model-indicator,
.context-indicator {
color: var(--color-success-txt-base);
color: var(--color-green-base);
}
</style>

View File

@@ -81,7 +81,7 @@ const isIndeterminate = computed(() => (type === 'checkbox' || type === 'toggle'
.input.indeterminate + .fake-checkbox > .icon {
opacity: 1;
color: var(--color-normal-txt-item);
color: var(--color-grey-300);
}
}
@@ -91,7 +91,7 @@ const isIndeterminate = computed(() => (type === 'checkbox' || type === 'toggle'
.fake-checkbox {
width: 1.25em;
--background-color: var(--color-neutral-background-primary);
--background-color: var(--background-color-primary);
}
.icon {
@@ -114,7 +114,7 @@ const isIndeterminate = computed(() => (type === 'checkbox' || type === 'toggle'
.fake-checkbox {
width: 2.5em;
--background-color: var(--color-neutral-border);
--background-color: var(--color-grey-500);
}
.icon {
@@ -128,7 +128,7 @@ const isIndeterminate = computed(() => (type === 'checkbox' || type === 'toggle'
.input.indeterminate + .fake-checkbox > .icon {
opacity: 1;
color: var(--color-neutral-txt-secondary);
color: var(--color-grey-300);
transform: translateX(0);
}
}
@@ -143,7 +143,7 @@ const isIndeterminate = computed(() => (type === 'checkbox' || type === 'toggle'
.icon {
font-size: var(--checkbox-icon-size);
position: absolute;
color: var(--color-normal-txt-item);
color: var(--color-grey-600);
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));
@@ -162,43 +162,44 @@ const isIndeterminate = computed(() => (type === 'checkbox' || type === 'toggle'
background-color: var(--background-color);
box-shadow: var(--shadow-100);
--border-color: var(--color-normal-item-base);
--border-color: var(--color-grey-500);
}
.input:disabled {
& + .fake-checkbox {
cursor: not-allowed;
--border-color: var(--color-neutral-txt-secondary);
--background-color: var(--background-color-secondary);
--border-color: var(--color-grey-500);
}
&:checked + .fake-checkbox {
--border-color: transparent;
--background-color: var(--color-normal-item-disabled);
--background-color: var(--color-purple-l60);
}
}
.input:not(:disabled) {
&:hover + .fake-checkbox,
&:focus + .fake-checkbox {
--border-color: var(--color-normal-item-hover);
--border-color: var(--color-purple-l40);
}
&:active + .fake-checkbox {
--border-color: var(--color-normal-item-active);
--border-color: var(--color-purple-l20);
}
&:checked + .fake-checkbox {
--border-color: transparent;
--background-color: var(--color-normal-item-base);
--background-color: var(--color-purple-base);
}
&:checked:hover + .fake-checkbox,
&:checked:focus + .fake-checkbox {
--background-color: var(--color-normal-item-hover);
--background-color: var(--color-purple-d20);
}
&:checked:active + .fake-checkbox {
--background-color: var(--color-normal-item-active);
--background-color: var(--color-purple-d40);
}
}
</style>

View File

@@ -144,14 +144,14 @@ defineExpose({
--after-width: v-bind('afterWidth || "1.625em"');
--caret-width: 1.5em;
--text-color: var(--color-neutral-txt-primary);
--text-color: var(--color-grey-100);
&.empty {
--text-color: var(--color-neutral-txt-secondary);
--text-color: var(--color-grey-300);
}
&.disabled {
--text-color: var(--color-neutral-border);
--text-color: var(--color-grey-500);
}
}
@@ -188,74 +188,74 @@ defineExpose({
text-align: right;
}
--background-color: var(--color-neutral-background-primary);
--border-color: var(--color-neutral-border);
--background-color: var(--background-color-primary);
--border-color: var(--color-grey-500);
&:disabled {
cursor: not-allowed;
--background-color: var(--color-neutral-background-disabled);
--background-color: var(--background-color-secondary);
}
&:not(:disabled) {
&.info {
&:hover {
--border-color: var(--color-normal-item-hover);
--border-color: var(--color-purple-l60);
}
&:active {
--border-color: var(--color-normal-item-active);
--border-color: var(--color-purple-l40);
}
&:focus {
--border-color: var(--color-normal-item-base);
--border-color: var(--color-purple-base);
}
}
&.success {
--border-color: var(--color-success-item-base);
--border-color: var(--color-green-base);
&:hover {
--border-color: var(--color-success-item-hover);
--border-color: var(--color-green-l60);
}
&:active {
--border-color: var(--color-success-item-active);
--border-color: var(--color-green-l40);
}
&:focus {
--border-color: var(--color-success-item-base);
--border-color: var(--color-green-base);
}
}
&.warning {
--border-color: var(--color-warning-item-base);
--border-color: var(--color-orange-base);
&:hover {
--border-color: var(--color-warning-item-hover);
--border-color: var(--color-orange-l60);
}
&:active {
--border-color: var(--color-warning-item-active);
--border-color: var(--color-orange-l40);
}
&:focus {
--border-color: var(--color-warning-item-base);
--border-color: var(--color-orange-base);
}
}
&.error {
--border-color: var(--color-danger-item-base);
--border-color: var(--color-red-base);
&:hover {
--border-color: var(--color-danger-item-hover);
--border-color: var(--color-red-l60);
}
&:active {
--border-color: var(--color-danger-item-active);
--border-color: var(--color-red-l40);
}
&:focus-within {
--border-color: var(--color-danger-item-base);
--border-color: var(--color-red-base);
}
}
}

View File

@@ -101,12 +101,12 @@ useContext(DisabledContext, () => props.disabled)
padding: 1rem 0;
&.light {
color: var(--color-neutral-txt-secondary);
color: var(--color-grey-300);
}
&:not(.light) {
text-transform: uppercase;
color: var(--color-neutral-txt-primary);
color: var(--color-grey-100);
}
}
@@ -128,7 +128,7 @@ useContext(DisabledContext, () => props.disabled)
align-items: center;
gap: 0.5rem;
text-decoration: none;
color: var(--color-normal-txt-base);
color: var(--color-purple-base);
& > span {
text-decoration: underline;
@@ -136,14 +136,14 @@ useContext(DisabledContext, () => props.disabled)
}
.warning {
color: var(--color-warning-txt-base);
color: var(--color-orange-base);
}
.error {
color: var(--color-danger-txt-base);
color: var(--color-red-base);
}
.help {
color: var(--color-neutral-txt-secondary);
color: var(--color-grey-300);
}
</style>

View File

@@ -53,7 +53,7 @@ whenever(
<style lang="postcss" scoped>
.collapsible {
padding: 1rem 1.5rem;
background-color: var(--color-normal-background-selected);
background-color: var(--background-color-purple-10);
border-radius: 0.8rem;
}
@@ -67,14 +67,14 @@ whenever(
display: flex;
align-items: center;
justify-content: space-between;
color: var(--color-normal-txt-base);
color: var(--color-purple-base);
border: none;
border-bottom: 1px solid var(--color-normal-txt-base);
border-bottom: 1px solid var(--color-purple-base);
width: 100%;
padding-bottom: 1rem;
.collapsible & {
color: var(--color-neutral-txt-primary);
color: var(--color-grey-100);
padding-bottom: 0;
cursor: pointer;
}
@@ -85,6 +85,6 @@ whenever(
}
.collapse-icon {
color: var(--color-normal-txt-base);
color: var(--color-purple-base);
}
</style>

View File

@@ -1,17 +1,10 @@
<template>
<TreeItem v-if="host !== undefined" :expanded="isExpanded" class="infra-host-item">
<TreeItemLabel :icon="faServer" :route="{ name: 'host.dashboard', params: { uuid: host.uuid } }" @toggle="toggle()">
<TreeItem v-if="host !== undefined" class="infra-host-item">
<TreeItemLabel :icon="faServer" :route="{ name: 'host.dashboard', params: { uuid: host.uuid } }">
{{ host.name_label || '(Host)' }}
<template #addons>
<VtsIcon v-if="isPoolMaster" v-tooltip="$t('master')" :icon="faStar" accent="warning" />
<VtsCounter
v-if="isReady"
v-tooltip="$t('running-vm', { count: vmCount })"
:value="vmCount"
accent="brand"
variant="secondary"
size="small"
/>
<UiIcon v-if="isPoolMaster" v-tooltip="$t('master')" :icon="faStar" color="warning" />
<UiCounter v-if="isReady" v-tooltip="$t('vm-running', { count: vmCount })" :value="vmCount" color="info" />
</template>
</TreeItemLabel>
<template #sublist>
@@ -28,14 +21,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 VtsCounter from '@core/components/counter/VtsCounter.vue'
import VtsIcon from '@core/components/icon/VtsIcon.vue'
import UiIcon from '@core/components/icon/UiIcon.vue'
import TreeItem from '@core/components/tree/TreeItem.vue'
import TreeItemLabel from '@core/components/tree/TreeItemLabel.vue'
import TreeList from '@core/components/tree/TreeList.vue'
import UiCounter from '@core/components/UiCounter.vue'
import { vTooltip } from '@core/directives/tooltip.directive'
import { faServer, faStar } from '@fortawesome/free-solid-svg-icons'
import { useToggle } from '@vueuse/shared'
import { computed } from 'vue'
const props = defineProps<{
@@ -51,6 +43,4 @@ const isPoolMaster = computed(() => pool.value?.master === props.hostOpaqueRef)
const { recordsByHostRef, isReady } = useVmStore().subscribe()
const vmCount = computed(() => recordsByHostRef.value.get(props.hostOpaqueRef)?.length ?? 0)
const [isExpanded, toggle] = useToggle(true)
</script>

View File

@@ -5,9 +5,9 @@
class="infra-item-label"
v-bind="$attrs"
>
<a v-tooltip="{ selector: '.text-ellipsis' }" :href class="link" @click="navigate">
<a v-tooltip="{ selector: '.text' }" :href class="link" @click="navigate">
<UiIcon :icon class="icon" />
<div class="text-ellipsis typo h6-medium">
<div class="text typo h6-medium">
<slot />
</div>
</a>
@@ -39,27 +39,27 @@ defineProps<{
.infra-item-label {
display: flex;
align-items: stretch;
color: var(--color-neutral-txt-primary);
color: var(--color-grey-100);
border-radius: 0.8rem;
background-color: var(--color-neutral-background-primary);
background-color: var(--background-color-primary);
&:hover {
color: var(--color-neutral-txt-primary);
background-color: var(--color-neutral-background-secondary);
color: var(--color-grey-100);
background-color: var(--background-color-secondary);
}
&:active,
&.active {
color: var(--color-normal-txt-base);
background-color: var(--color-neutral-background-primary);
color: var(--color-purple-base);
background-color: var(--background-color-primary);
}
&.exact-active {
color: var(--color-neutral-txt-primary);
background-color: var(--color-normal-background-selected);
color: var(--color-grey-100);
background-color: var(--background-color-purple-10);
.icon {
color: var(--color-normal-txt-base);
color: var(--color-purple-base);
}
}
}
@@ -77,6 +77,12 @@ defineProps<{
font-size: 2rem;
}
.text {
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.actions {
display: flex;
align-items: center;

View File

@@ -23,11 +23,11 @@ defineProps<{
display: flex;
height: 6rem;
margin-bottom: 0.2rem;
background-color: var(--color-neutral-background-primary);
background-color: var(--background-color-primary);
}
.icon {
color: var(--color-neutral-txt-primary);
color: var(--color-grey-100);
}
.link-placeholder {
@@ -41,7 +41,7 @@ defineProps<{
.loader {
flex: 1;
animation: pulse alternate 1s infinite;
background-color: var(--color-normal-background-selected);
background-color: var(--background-color-purple-10);
}
@keyframes pulse {

View File

@@ -1,16 +1,11 @@
<template>
<TreeList class="infra-pool-list">
<TreeItem :expanded="isExpanded">
<TreeItem>
<TreeItemError v-if="hasError">
{{ $t('error-no-data') }}
</TreeItemError>
<TreeLoadingItem v-else-if="!isReady || pool === undefined" :icon="faCity" />
<TreeItemLabel
v-else
:icon="faCity"
:route="{ name: 'pool.dashboard', params: { uuid: pool.uuid } }"
@toggle="toggle()"
>
<TreeItemLabel v-else :icon="faCity" :route="{ name: 'pool.dashboard', params: { uuid: pool.uuid } }">
{{ pool.name_label || '(Pool)' }}
</TreeItemLabel>
<template #sublist>
@@ -33,9 +28,6 @@ import TreeItemLabel from '@core/components/tree/TreeItemLabel.vue'
import TreeList from '@core/components/tree/TreeList.vue'
import TreeLoadingItem from '@core/components/tree/TreeLoadingItem.vue'
import { faCity } from '@fortawesome/free-solid-svg-icons'
import { useToggle } from '@vueuse/shared'
const { isReady, hasError, pool } = usePoolStore().subscribe()
const [isExpanded, toggle] = useToggle(true)
</script>

View File

@@ -1,5 +1,5 @@
<template>
<TreeItem v-if="vm !== undefined" ref="rootElement" expanded class="infra-vm-item">
<TreeItem v-if="vm !== undefined" ref="rootElement" class="infra-vm-item">
<TreeItemLabel v-if="isVisible" :route="{ name: 'vm.console', params: { uuid: vm.uuid } }" no-indent>
{{ vm.name_label || '(VM)' }}
<template #icon>

View File

@@ -23,7 +23,7 @@
</template>
<template #buttons>
<UiButton size="medium" color="normal" level="tertiary" @click="addNewFilter()">
<UiButton level="tertiary" @click="addNewFilter()">
{{ $t('add-or') }}
</UiButton>
<ModalDeclineButton />

View File

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

View File

@@ -3,7 +3,7 @@
<UiCardTitle>
{{ $t('alarms') }}
<template v-if="isReady && alarms.length > 0" #right>
<VtsCounter :value="alarms.length" accent="danger" variant="primary" size="small" />
<UiCounter :value="alarms.length" color="error" />
</template>
</UiCardTitle>
<div v-if="!isStarted" class="pre-start">
@@ -11,7 +11,7 @@
<p class="text typo h4-medium">
{{ $t('click-to-display-alarms') }}
</p>
<UiButton size="medium" color="normal" level="primary" @click="start">{{ $t('load-now') }}</UiButton>
<UiButton @click="start">{{ $t('load-now') }}</UiButton>
</div>
<div>
<img alt="" src="@/assets/server-status.svg" />
@@ -46,7 +46,7 @@ import UiCardTitle from '@/components/ui/UiCardTitle.vue'
import UiTable from '@/components/ui/UiTable.vue'
import { useAlarmStore } from '@/stores/xen-api/alarm.store'
import UiButton from '@core/components/button/UiButton.vue'
import VtsCounter from '@core/components/counter/VtsCounter.vue'
import UiCounter from '@core/components/UiCounter.vue'
const { records: alarms, start, isStarted, isReady, hasError } = useAlarmStore().subscribe({ defer: true })
</script>
@@ -70,7 +70,7 @@ const { records: alarms, start, isStarted, isReady, hasError } = useAlarmStore()
}
.no-alarm & {
color: var(--color-success-txt-base);
color: var(--color-green-base);
}
}

View File

@@ -60,8 +60,6 @@ const { hasError: vmStoreHasError, isReady: isVmStoreReady, records: vms } = use
const { getByOpaqueRef: getVmMetrics, isReady: isVmMetricsStoreReady } = useVmMetricsStore().subscribe()
const isReady = logicAnd(isVmStoreReady, isHostStoreReady, isVmMetricsStoreReady)
const nPCpu = computed(() => runningHosts.value.reduce((total, host) => total + Number(host.cpu_info.cpu_count), 0))
const nVCpuInUse = computed(() => {
@@ -77,7 +75,7 @@ const nVCpuInUse = computed(() => {
const value = computed(() => Math.round(percent(nVCpuInUse.value, nPCpu.value)))
const maxValue = computed(() => Math.ceil(value.value / 100) * 100)
const state = computed(() => (value.value > 100 ? 'warning' : 'success'))
const isReady = logicAnd(isVmStoreReady, isHostStoreReady, isVmMetricsStoreReady)
const hasError = computed(() => hostStoreHasError.value || vmStoreHasError.value)
</script>
@@ -85,12 +83,12 @@ const hasError = computed(() => hostStoreHasError.value || vmStoreHasError.value
.progress-item {
margin-top: 2.6rem;
--progress-bar-height: 1.2rem;
--progress-bar-color: var(--color-normal-item-base);
--progress-bar-background-color: var(--color-neutral-background-disabled);
--progress-bar-color: var(--color-purple-base);
--progress-bar-background-color: var(--color-grey-500);
&.warning {
--progress-bar-color: var(--color-warning-item-base);
--footer-value-color: var(--color-warning-item-base);
--progress-bar-color: var(--color-orange-base);
--footer-value-color: var(--color-orange-base);
}
& .footer-value {

View File

@@ -31,7 +31,7 @@ const { count, patches, areSomeLoaded, areAllLoaded } = useHostPatches(hosts)
<style lang="postcss" scoped>
.patches-title {
--section-title-right-color: var(--color-danger-txt-base);
--section-title-right-color: var(--color-red-base);
}
.table-container {

View File

@@ -53,10 +53,10 @@ const inactive = computed(() => props.total - props.active)
width: 1.3rem;
height: 1.3rem;
border-radius: 0.65rem;
background-color: var(--color-success-item-base);
background-color: var(--color-green-base);
&.inactive {
background-color: var(--color-neutral-background-disabled);
background-color: var(--color-grey-500);
}
}

View File

@@ -1,12 +1,12 @@
<template>
<tr>
<th>
<div v-tooltip="new Date(parseDateTime(alarm.timestamp)).toLocaleString()" class="text-ellipsis time">
<div v-tooltip="new Date(parseDateTime(alarm.timestamp)).toLocaleString()" class="ellipsis time">
<RelativeTime :date="alarm.timestamp" />
</div>
</th>
<td>
<div v-tooltip class="text-ellipsis description">
<div v-tooltip class="ellipsis description">
{{ $t(`alarm-type.${alarm.type}`, { n: alarm.triggerLevel * 100 }) }}
</div>
</td>
@@ -36,14 +36,17 @@ defineProps<{
</script>
<style lang="postcss" scoped>
.level {
color: var(--color-danger-txt-base);
.ellipsis {
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.level {
color: var(--color-red-base);
}
.on {
white-space: nowrap;
}
.object-link {
white-space: nowrap;
}

View File

@@ -56,7 +56,7 @@ const hasTasks = computed(() => props.pendingTasks.length > 0 || (props.finished
.no-tasks {
text-align: center;
color: var(--color-neutral-txt-secondary);
color: var(--color-grey-300);
font-style: italic;
}
@@ -65,11 +65,11 @@ td[colspan='5'] {
}
.text-error {
color: var(--color-danger-txt-base);
color: var(--color-red-base);
}
.loader {
color: var(--color-normal-txt-base);
color: var(--color-purple-base);
display: block;
font-size: 4rem;
margin: 2rem auto 0;

View File

@@ -40,12 +40,12 @@ const isDisplayed = computed(() => !isNaN(percentUsed.value) && !isNaN(percentFr
.summary {
display: flex;
justify-content: space-between;
color: var(--color-neutral-txt-secondary);
color: var(--color-grey-300);
margin-top: 2rem;
}
.summary-card {
color: var(--color-neutral-txt-secondary);
color: var(--color-grey-200);
display: flex;
}

View File

@@ -46,24 +46,24 @@ const isDisabled = useContext(DisabledContext, () => props.disabled)
border: none;
border-radius: 0.8rem;
gap: 1rem;
background-color: var(--color-neutral-background-primary);
background-color: var(--background-color-primary);
&.disabled {
color: var(--color-neutral-border);
color: var(--color-grey-500);
}
&:not(.disabled) {
color: var(--color-neutral-txt-secondary);
color: var(--color-grey-200);
&:hover {
background-color: var(--color-neutral-background-secondary);
background-color: var(--background-color-secondary);
}
&:active,
&.active,
&.busy {
color: var(--color-normal-txt-base);
background-color: var(--color-normal-background-selected);
color: var(--color-purple-base);
background-color: var(--background-color-purple-10);
}
}
}

View File

@@ -22,8 +22,8 @@ defineProps<{
gap: 0.4rem;
padding: 0 0.8rem;
height: 1.8em;
color: var(--color-neutral-txt-primary);
color: var(--color-grey-600);
border-radius: 9.6rem;
background-color: var(--color-neutral-background-disabled);
background-color: var(--color-grey-300);
}
</style>

View File

@@ -34,6 +34,6 @@ const classProp = computed(() => {
}
.bg-primary {
background-color: var(--color-neutral-background-primary);
background-color: var(--background-color-primary);
}
</style>

View File

@@ -11,7 +11,7 @@
<style lang="postcss" scoped>
.footer {
color: var(--color-neutral-txt-secondary);
color: var(--color-grey-200);
display: flex;
justify-content: space-between;
}

View File

@@ -17,7 +17,7 @@ import UiSpinner from '@/components/ui/UiSpinner.vue'
}
.spinner {
color: var(--color-normal-txt-base);
color: var(--color-purple-base);
font-size: 4rem;
}
</style>

View File

@@ -2,7 +2,7 @@
<div class="ui-section-title" :class="tags.left">
<component :is="tags.left" v-if="$slots.default || left" class="left">
<slot>{{ left }}</slot>
<VtsCounter v-if="count > 0" class="count" :value="count" accent="brand" variant="primary" size="small" />
<UiCounter v-if="count > 0" class="count" :value="count" color="info" />
</component>
<component :is="tags.right" v-if="$slots.right || right" class="right">
<slot name="right">{{ right }}</slot>
@@ -12,7 +12,7 @@
<script lang="ts" setup>
import { UiCardTitleLevel } from '@/types/enums'
import VtsCounter from '@core/components/counter/VtsCounter.vue'
import UiCounter from '@core/components/UiCounter.vue'
import { computed } from 'vue'
const props = withDefaults(
@@ -44,28 +44,28 @@ const tags = computed(() => {
justify-content: space-between;
--section-title-left-size: 2rem;
--section-title-left-color: var(--color-neutral-txt-primary);
--section-title-left-color: var(--color-grey-100);
--section-title-left-weight: 500;
--section-title-right-size: 1.6rem;
--section-title-right-color: var(--color-normal-txt-base);
--section-title-right-color: var(--color-purple-base);
--section-title-right-weight: 700;
&.h6 {
margin-bottom: 1rem;
--section-title-left-size: 1.5rem;
--section-title-left-color: var(--color-neutral-txt-secondary);
--section-title-left-color: var(--color-grey-300);
--section-title-left-weight: 400;
}
&.h5 {
margin-top: 2rem;
margin-bottom: 1rem;
border-bottom: 1px solid var(--color-normal-txt-base);
border-bottom: 1px solid var(--color-purple-base);
--section-title-left-size: 1.6rem;
--section-title-left-color: var(--color-normal-txt-base);
--section-title-left-color: var(--color-purple-base);
--section-title-left-weight: 700;
--section-title-right-size: 1.4rem;
--section-title-right-color: var(--color-normal-txt-base);
--section-title-right-color: var(--color-purple-base);
--section-title-right-weight: 400;
}
}

View File

@@ -26,11 +26,11 @@ const emit = defineEmits<{
align-items: stretch;
justify-content: center;
height: 3.4rem;
color: var(--color-normal-txt-base);
color: var(--color-purple-base);
border-radius: 1.7rem;
background-color: var(--color-normal-background-selected);
background-color: var(--background-color-purple-10);
gap: 1rem;
border: 1px solid var(--color-normal-txt-base);
border: 1px solid var(--color-purple-base);
}
.label,
@@ -54,10 +54,10 @@ const emit = defineEmits<{
border-radius: 1.4rem;
width: 2.8rem;
margin: 0.2rem;
background-color: var(--color-normal-item-active);
background-color: var(--color-purple-l40);
&:hover {
background-color: var(----color-danger-item-hover);
background-color: var(--color-red-l20);
}
}
</style>

View File

@@ -9,7 +9,7 @@
display: flex;
align-items: center;
padding: 1rem;
background-color: var(--color-neutral-background-primary);
background-color: var(--background-color-primary);
gap: 1rem;
}
</style>

View File

@@ -19,7 +19,7 @@
.key {
padding-right: 2rem;
text-align: left;
color: var(--color-neutral-txt-secondary);
color: var(--color-grey-300);
@media (--desktop) {
min-width: 20rem;

View File

@@ -4,7 +4,7 @@
<style lang="postcss" scoped>
.ui-raw {
background-color: var(--color-neutral-border);
background-color: var(--color-grey-500);
text-align: left;
overflow: auto;
max-width: 100%;

View File

@@ -5,7 +5,7 @@
<style lang="postcss" scoped>
.ui-separator {
border: none;
border-top: 1px solid var(--color-neutral-border);
border-top: 1px solid var(--color-grey-500);
margin: 2rem 0;
}
</style>

View File

@@ -24,7 +24,7 @@ defineProps<{
flex-direction: column;
align-items: center;
justify-content: center;
color: var(--color-normal-txt-base);
color: var(--color-purple-base);
}
.title {

View File

@@ -15,14 +15,14 @@ defineProps<{
.ui-table {
width: 100%;
border-spacing: 0;
background-color: var(--color-neutral-background-primary);
background-color: var(--background-color-primary);
line-height: 2.4rem;
color: var(--color-neutral-txt-secondary);
color: var(--color-grey-200);
:deep(th),
:deep(td) {
padding: 1rem;
border-top: 1px solid var(--color-neutral-border);
border-top: 1px solid var(--color-grey-500);
text-align: left;
}
@@ -33,7 +33,7 @@ defineProps<{
:deep(thead) {
th,
td {
color: var(--color-normal-txt-base);
color: var(--color-purple-base);
font-size: 1.4rem;
font-weight: 400;
text-transform: uppercase;
@@ -43,7 +43,7 @@ defineProps<{
&.vertical-border {
:deep(th),
:deep(td) {
border-right: 1px solid var(--color-neutral-border);
border-right: 1px solid var(--color-grey-500);
&:last-child {
border-right: none;
@@ -53,6 +53,6 @@ defineProps<{
}
.error {
background-color: var(--color-danger-background-selected);
background-color: var(--background-color-red-10);
}
</style>

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