mirror of
https://github.com/vatesfr/xen-orchestra.git
synced 2026-11-22 06:46:22 -06:00
Compare commits
351 Commits
core/sorte
...
proxy-api-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7e65a139ab | ||
|
|
78ae16b21e | ||
|
|
4102810be6 | ||
|
|
86883857d4 | ||
|
|
79450a1c51 | ||
|
|
6495d563f5 | ||
|
|
761c03e46c | ||
|
|
1eeff13de1 | ||
|
|
2027f8a282 | ||
|
|
2e8d398623 | ||
|
|
fff3ec1f8b | ||
|
|
a7d7cf18c0 | ||
|
|
00d1792578 | ||
|
|
8f6c087e3a | ||
|
|
e886e91271 | ||
|
|
3d054c8358 | ||
|
|
a596702a96 | ||
|
|
bfb2ea6b17 | ||
|
|
52c79caa45 | ||
|
|
8d48797639 | ||
|
|
30172caa1f | ||
|
|
a9b99a8b45 | ||
|
|
9321b04c5f | ||
|
|
6c258af43a | ||
|
|
0a28abaada | ||
|
|
a609e98c40 | ||
|
|
ac06a8ef49 | ||
|
|
2ea2f8040a | ||
|
|
f6e6e052ef | ||
|
|
748ed07241 | ||
|
|
e5b833dada | ||
|
|
68b1641e07 | ||
|
|
ad8cd3791b | ||
|
|
030b3ad4d1 | ||
|
|
cfea2b3a2b | ||
|
|
44e33666cf | ||
|
|
939ab29d04 | ||
|
|
cdfe0b0374 | ||
|
|
eb39e14972 | ||
|
|
d520e53f9e | ||
|
|
f7df1c4109 | ||
|
|
558ea84880 | ||
|
|
0e9242be51 | ||
|
|
943ad781cc | ||
|
|
6b21f08ab0 | ||
|
|
ea5358e76b | ||
|
|
742109ccba | ||
|
|
00f2f8c103 | ||
|
|
291c5a430d | ||
|
|
9ad13608eb | ||
|
|
fc3e954d3e | ||
|
|
cc3d5f2efc | ||
|
|
090c4ecb23 | ||
|
|
b78c7d228d | ||
|
|
13f2afb0d6 | ||
|
|
f651943add | ||
|
|
c0f1d61c01 | ||
|
|
e65823b4a5 | ||
|
|
75684cbe12 | ||
|
|
971a561879 | ||
|
|
d6bba81d36 | ||
|
|
206f59575a | ||
|
|
dbf3d82a1b | ||
|
|
d3414a94c6 | ||
|
|
7e9b4447bf | ||
|
|
8a10070f4d | ||
|
|
b365e4aa25 | ||
|
|
28709b660e | ||
|
|
19067f7f6c | ||
|
|
a297160432 | ||
|
|
381c83d0b3 | ||
|
|
7e14152473 | ||
|
|
21bd7394fa | ||
|
|
89aa7df744 | ||
|
|
b62e8035fc | ||
|
|
02ed1bcee2 | ||
|
|
63a88b1525 | ||
|
|
2b1d6f21a0 | ||
|
|
e13c0789e8 | ||
|
|
778362d8db | ||
|
|
530c30fd50 | ||
|
|
4debc0f893 | ||
|
|
57a399c64d | ||
|
|
0acd7c3530 | ||
|
|
088bd7cfd3 | ||
|
|
b47019e0e4 | ||
|
|
aa490dc066 | ||
|
|
b8388bb255 | ||
|
|
f969056d02 | ||
|
|
5e11547439 | ||
|
|
04f3a09ab0 | ||
|
|
385ff21f4a | ||
|
|
40f5f48f17 | ||
|
|
74e6fa26a6 | ||
|
|
e26e1a2f90 | ||
|
|
c7970b3809 | ||
|
|
4c7acc1614 | ||
|
|
fd18bee62f | ||
|
|
a9ad679933 | ||
|
|
cd2b7a2553 | ||
|
|
b061ff63e7 | ||
|
|
28d1d8b473 | ||
|
|
8f5c4f336d | ||
|
|
3c5ad184b5 | ||
|
|
3ced19b4dc | ||
|
|
9504132585 | ||
|
|
fc67abd25b | ||
|
|
72d0866174 | ||
|
|
073b15ed07 | ||
|
|
7c31b44bb0 | ||
|
|
e830bf0f0c | ||
|
|
790ba9bdd1 | ||
|
|
6c8d41db00 | ||
|
|
576a3aa007 | ||
|
|
af17f4a28a | ||
|
|
2f7e0d0963 | ||
|
|
01c71414ae | ||
|
|
1ca468064f | ||
|
|
69ffac65f0 | ||
|
|
f38b449624 | ||
|
|
07cd06c245 | ||
|
|
813ca246c4 | ||
|
|
3b217ea975 | ||
|
|
2151450584 | ||
|
|
7cebe46e86 | ||
|
|
89b9a1f4b7 | ||
|
|
974668587d | ||
|
|
dfe6911aba | ||
|
|
f1780b7b0f | ||
|
|
20c88b4e90 | ||
|
|
aa9c49ce6a | ||
|
|
951de95e4b | ||
|
|
385b6b2fee | ||
|
|
a976a5a3b3 | ||
|
|
e8b32fef81 | ||
|
|
edb021e40e | ||
|
|
ae2e9e1a58 | ||
|
|
83a8f295c7 | ||
|
|
bddfb21e2d | ||
|
|
cf7dbd1c36 | ||
|
|
204cb25d2b | ||
|
|
5656ab1d48 | ||
|
|
99ffefae10 | ||
|
|
a78e1346f6 | ||
|
|
0d5f86620d | ||
|
|
18bea75d28 | ||
|
|
5e6bb22025 | ||
|
|
091da7b913 | ||
|
|
ec3fe212e1 | ||
|
|
259beead81 | ||
|
|
b1ce62f23a | ||
|
|
cd25873182 | ||
|
|
a7165da4a0 | ||
|
|
95f0ef504d | ||
|
|
732cab3ac0 | ||
|
|
fb01d20c2e | ||
|
|
034d4faa6a | ||
|
|
beb93cf66f | ||
|
|
ad1bf3b348 | ||
|
|
43c3a82800 | ||
|
|
7fc5b850ca | ||
|
|
916c15d8c7 | ||
|
|
4b47bf9220 | ||
|
|
877fe9a663 | ||
|
|
88c7c8d3ae | ||
|
|
23720dd05f | ||
|
|
d796e37df5 | ||
|
|
9734410833 | ||
|
|
aa7ff37b94 | ||
|
|
0eaa6a93a3 | ||
|
|
b33a84e5c7 | ||
|
|
e65c5d02f3 | ||
|
|
dc7fd78b4a | ||
|
|
8eae8e7f46 | ||
|
|
da84ab1590 | ||
|
|
290b5df27c | ||
|
|
72592a54d2 | ||
|
|
e5c53dfa52 | ||
|
|
9d196c4211 | ||
|
|
e15f2a1428 | ||
|
|
f78a140fbb | ||
|
|
79ce97b3fd | ||
|
|
1e7d02603b | ||
|
|
59bf23a41a | ||
|
|
39e34eede7 | ||
|
|
32228e8c6a | ||
|
|
7163002c51 | ||
|
|
700149dabe | ||
|
|
06af045dac | ||
|
|
b6ccb72e43 | ||
|
|
14da422b8b | ||
|
|
5dd305228b | ||
|
|
e75cccf1be | ||
|
|
0e6bc063db | ||
|
|
0291d42af7 | ||
|
|
656786eb86 | ||
|
|
4dfd77b2d2 | ||
|
|
895a551c7b | ||
|
|
e750a66c02 | ||
|
|
4d768252f0 | ||
|
|
f0f5cdba72 | ||
|
|
8cc3d0cbaf | ||
|
|
3284021964 | ||
|
|
e333332131 | ||
|
|
14325fe992 | ||
|
|
ddfdce9da5 | ||
|
|
a2c62117a1 | ||
|
|
cb6cfc3a74 | ||
|
|
9d61e0232d | ||
|
|
fedab820f1 | ||
|
|
7eac1d1c5a | ||
|
|
06a9ab6718 | ||
|
|
d0bd6562d0 | ||
|
|
7b60fab7ea | ||
|
|
045cae24fb | ||
|
|
bd7e82cb6b | ||
|
|
307179b142 | ||
|
|
0a3c32f9d2 | ||
|
|
124d96f31a | ||
|
|
916418b6cf | ||
|
|
7592734c9a | ||
|
|
b1088e2a5b | ||
|
|
83715bedc6 | ||
|
|
e30f289073 | ||
|
|
0977542dbd | ||
|
|
c9699c8f02 | ||
|
|
636c88539f | ||
|
|
333012bd29 | ||
|
|
8fd516040b | ||
|
|
2017ec26ad | ||
|
|
72d6da38c5 | ||
|
|
59784315a8 | ||
|
|
c5f6bf574f | ||
|
|
991b4641ae | ||
|
|
0fee31b345 | ||
|
|
d58ee9611f | ||
|
|
da9d796d3f | ||
|
|
e4c66bc0e8 | ||
|
|
d61429852d | ||
|
|
a06e78c77c | ||
|
|
e66bdda6a1 | ||
|
|
659c735b70 | ||
|
|
35c6248251 | ||
|
|
4344e1567c | ||
|
|
2291505865 | ||
|
|
92acd16779 | ||
|
|
3c5307cd64 | ||
|
|
f55ffc7d06 | ||
|
|
6c118e6af5 | ||
|
|
d0984a7cb4 | ||
|
|
76336fa422 | ||
|
|
2a9f5bcf53 | ||
|
|
9d3ec46086 | ||
|
|
79690fcdfa | ||
|
|
23e42c1764 | ||
|
|
4b8f7146f6 | ||
|
|
8172a327e4 | ||
|
|
919d215b64 | ||
|
|
161169f295 | ||
|
|
e91b7f8571 | ||
|
|
60291e317c | ||
|
|
c704f156fc | ||
|
|
9a811d7f1e | ||
|
|
a97d55c53c | ||
|
|
8542b83f7c | ||
|
|
73755c0e8c | ||
|
|
0702454fa8 | ||
|
|
a0c3920d00 | ||
|
|
d4637e3335 | ||
|
|
6fcb838b70 | ||
|
|
065c44cc92 | ||
|
|
b539b5f5e3 | ||
|
|
d1ce35f20a | ||
|
|
3f754fdc05 | ||
|
|
57d2d301ae | ||
|
|
d2507025a9 | ||
|
|
de934ec609 | ||
|
|
6894841038 | ||
|
|
c5e4f05d3b | ||
|
|
dad3dc5926 | ||
|
|
3fe46cae64 | ||
|
|
14c5d2c4ec | ||
|
|
4a4122b9a6 | ||
|
|
acffdbec8f | ||
|
|
f9220cd272 | ||
|
|
518b0f77bd | ||
|
|
b35a5cffa6 | ||
|
|
bb88834fcd | ||
|
|
e492be3a67 | ||
|
|
a223207ff3 | ||
|
|
4d42f86b2c | ||
|
|
da3aa59781 | ||
|
|
2b46e6cf30 | ||
|
|
9406d20672 | ||
|
|
0e6d3ae27a | ||
|
|
ee3bc185da | ||
|
|
28f94b3888 | ||
|
|
e44933e2f7 | ||
|
|
30dd89243f | ||
|
|
96b7673e27 | ||
|
|
69a312a0c4 | ||
|
|
a0e6c8b115 | ||
|
|
dc047d47ea | ||
|
|
a00b24f6b8 | ||
|
|
7601dee7f2 | ||
|
|
1ace3cbbe8 | ||
|
|
8651e61210 | ||
|
|
6c6b6b9fa1 | ||
|
|
6374e0d3f5 | ||
|
|
664d4b1af6 | ||
|
|
0117e9dbc8 | ||
|
|
174e32173f | ||
|
|
0e4a300058 | ||
|
|
76b54ec579 | ||
|
|
7b256ab8ee | ||
|
|
7a2bb5104c | ||
|
|
56c881fd2a | ||
|
|
db89485efe | ||
|
|
3c6a7a9575 | ||
|
|
992d636bcd | ||
|
|
253aac4eaa | ||
|
|
ea551a5175 | ||
|
|
fe1f5cbad7 | ||
|
|
ce4c2e17af | ||
|
|
e5608680ec | ||
|
|
6ee7a274d9 | ||
|
|
ffc93250f0 | ||
|
|
52b27ae884 | ||
|
|
f5cee45c02 | ||
|
|
818a5b7f5b | ||
|
|
19a2f4e002 | ||
|
|
83920589db | ||
|
|
bc1db9960a | ||
|
|
5bf1aea761 | ||
|
|
dcf6885dfa | ||
|
|
37a0d9da7c | ||
|
|
abcbeb8719 | ||
|
|
8db808a415 | ||
|
|
9383306231 | ||
|
|
3235963cfb | ||
|
|
b393d72eb9 | ||
|
|
cd2942af71 | ||
|
|
e92cb66954 | ||
|
|
dac0b20a19 | ||
|
|
0fc5d60791 | ||
|
|
2df144d43d | ||
|
|
758e3c47b8 | ||
|
|
cfcc78b6d8 | ||
|
|
5f5580925d | ||
|
|
a667e7cdbd | ||
|
|
a14c4bbb1c |
14
.eslintrc.js
14
.eslintrc.js
@@ -39,6 +39,12 @@ module.exports = {
|
||||
version: '>=16',
|
||||
},
|
||||
],
|
||||
'n/no-unsupported-features/es-builtins': [
|
||||
'error',
|
||||
{
|
||||
version: '>=16',
|
||||
},
|
||||
],
|
||||
'n/no-unsupported-features/es-syntax': [
|
||||
'error',
|
||||
{
|
||||
@@ -103,6 +109,9 @@ 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
|
||||
@@ -137,6 +146,7 @@ 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']],
|
||||
@@ -215,7 +225,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'] }],
|
||||
'@intlify/vue-i18n/no-missing-keys-in-other-locales': ['error', { ignoreLocales: ['de', 'fa'] }],
|
||||
},
|
||||
},
|
||||
// Specific rules for XO dev-related files
|
||||
@@ -274,7 +284,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',
|
||||
'require-atomic-updates': ['warn', { allowProperties: true }],
|
||||
|
||||
strict: 'error',
|
||||
},
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@vates/fuse-vhd",
|
||||
"version": "2.1.0",
|
||||
"version": "2.1.1",
|
||||
"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.9.2"
|
||||
"vhd-lib": "^4.11.0"
|
||||
},
|
||||
"bin": {
|
||||
"xo-fuse-vhd": "./cli.mjs"
|
||||
|
||||
18
@vates/json-hash/.USAGE.md
Normal file
18
@vates/json-hash/.USAGE.md
Normal file
@@ -0,0 +1,18 @@
|
||||
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"
|
||||
```
|
||||
1
@vates/json-hash/.npmignore
Symbolic link
1
@vates/json-hash/.npmignore
Symbolic link
@@ -0,0 +1 @@
|
||||
../../scripts/npmignore
|
||||
51
@vates/json-hash/README.md
Normal file
51
@vates/json-hash/README.md
Normal file
@@ -0,0 +1,51 @@
|
||||
<!-- DO NOT EDIT MANUALLY, THIS FILE HAS BEEN GENERATED -->
|
||||
|
||||
# @vates/json-hash
|
||||
|
||||
[](https://npmjs.org/package/@vates/json-hash)  [](https://bundlephobia.com/result?p=@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)
|
||||
38
@vates/json-hash/index.js
Normal file
38
@vates/json-hash/index.js
Normal file
@@ -0,0 +1,38 @@
|
||||
'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')
|
||||
}
|
||||
21
@vates/json-hash/index.test.js
Normal file
21
@vates/json-hash/index.test.js
Normal file
@@ -0,0 +1,21 @@
|
||||
'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)
|
||||
})
|
||||
}
|
||||
33
@vates/json-hash/package.json
Normal file
33
@vates/json-hash/package.json
Normal file
@@ -0,0 +1,33 @@
|
||||
{
|
||||
"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"
|
||||
}
|
||||
}
|
||||
@@ -34,7 +34,6 @@ export default class NbdClient {
|
||||
#exportSize
|
||||
|
||||
#waitBeforeReconnect
|
||||
#readAhead
|
||||
#readBlockRetries
|
||||
#reconnectRetry
|
||||
#connectTimeout
|
||||
@@ -55,7 +54,6 @@ export default class NbdClient {
|
||||
connectTimeout = 6e4,
|
||||
messageTimeout = 6e4,
|
||||
waitBeforeReconnect = 1e3,
|
||||
readAhead = 10,
|
||||
readBlockRetries = 5,
|
||||
reconnectRetry = 5,
|
||||
} = {}
|
||||
@@ -65,7 +63,6 @@ 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
|
||||
|
||||
@@ -6,7 +6,10 @@ 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
|
||||
@@ -14,36 +17,64 @@ 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]
|
||||
}
|
||||
for (let i = 0; i < nbdConcurrency; i++) {
|
||||
this.#clients.push(
|
||||
new NbdClient(settings[i % settings.length], { ...options, readAhead: Math.ceil(readAhead / nbdConcurrency) })
|
||||
)
|
||||
}
|
||||
this.#settings = settings
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* 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 connectedClients = []
|
||||
for (const clientId in this.#clients) {
|
||||
const client = this.#clients[clientId]
|
||||
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),
|
||||
})
|
||||
try {
|
||||
await client.connect()
|
||||
connectedClients.push(client)
|
||||
this.#clients.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()
|
||||
}
|
||||
}
|
||||
if (connectedClients.length === 0) {
|
||||
for (let i = 0; i < this.#nbdConcurrency; i++) {
|
||||
promises.push(_connect())
|
||||
}
|
||||
await Promise.all(promises)
|
||||
|
||||
if (this.#clients.length === 0) {
|
||||
throw new Error(`Fail to connect to any Nbd client`)
|
||||
}
|
||||
if (connectedClients.length < this.#clients.length) {
|
||||
if (this.#clients.length < this.#nbdConcurrency) {
|
||||
warn(
|
||||
`incomplete connection by multi Nbd, only ${connectedClients.length} over ${this.#clients.length} expected clients`
|
||||
`incomplete connection by multi Nbd, only ${this.#clients.length} over ${this.#nbdConcurrency} expected clients`
|
||||
)
|
||||
this.#clients = connectedClients
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
"url": "https://vates.fr"
|
||||
},
|
||||
"license": "ISC",
|
||||
"version": "3.0.2",
|
||||
"version": "3.1.0",
|
||||
"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.0.0"
|
||||
"xen-api": "^4.3.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"tap": "^18.7.0",
|
||||
|
||||
@@ -78,15 +78,14 @@ async function killNbdKit() {
|
||||
)
|
||||
}
|
||||
|
||||
test('it works with unsecured network', async tap => {
|
||||
test('it works secured network', async tap => {
|
||||
const path = await createTempFile(FILE_SIZE)
|
||||
|
||||
let nbdServer = await spawnNbdKit(path)
|
||||
const client = new MultiNbdClient(
|
||||
{
|
||||
address: '127.0.0.1',
|
||||
exportname: 'MY_SECRET_EXPORT',
|
||||
cert: `-----BEGIN CERTIFICATE-----
|
||||
const connectionSettings = {
|
||||
address: '127.0.0.1',
|
||||
exportname: 'MY_SECRET_EXPORT',
|
||||
cert: `-----BEGIN CERTIFICATE-----
|
||||
MIIDazCCAlOgAwIBAgIUeHpQ0IeD6BmP2zgsv3LV3J4BI/EwDQYJKoZIhvcNAQEL
|
||||
BQAwRTELMAkGA1UEBhMCQVUxEzARBgNVBAgMClNvbWUtU3RhdGUxITAfBgNVBAoM
|
||||
GEludGVybmV0IFdpZGdpdHMgUHR5IEx0ZDAeFw0yMzA1MTcxMzU1MzBaFw0yNDA1
|
||||
@@ -108,12 +107,18 @@ CYu1Xn/FVPx1HoRgWc7E8wFhDcA/P3SJtfIQWHB9FzSaBflKGR4t8WCE2eE8+cTB
|
||||
57ABhfYpMlZ4aHjuN1bL
|
||||
-----END CERTIFICATE-----
|
||||
`,
|
||||
},
|
||||
{
|
||||
nbdConcurrency: 1,
|
||||
readAhead: 2,
|
||||
}
|
||||
)
|
||||
}
|
||||
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,
|
||||
})
|
||||
|
||||
await client.connect()
|
||||
tap.equal(client.exportSize, BigInt(FILE_SIZE))
|
||||
@@ -156,3 +161,18 @@ 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())
|
||||
})
|
||||
|
||||
@@ -6,9 +6,11 @@ exports.parseDuration = value => {
|
||||
if (typeof value === 'number') {
|
||||
return value
|
||||
}
|
||||
const duration = ms(value)
|
||||
if (duration === undefined) {
|
||||
throw new TypeError(`not a valid duration: ${value}`)
|
||||
if (typeof value === 'string' && value !== '') {
|
||||
const duration = ms(value)
|
||||
if (duration !== undefined) {
|
||||
return duration
|
||||
}
|
||||
}
|
||||
return duration
|
||||
throw new TypeError(`not a valid duration: ${value}`)
|
||||
}
|
||||
|
||||
22
@vates/parse-duration/index.test.mjs
Normal file
22
@vates/parse-duration/index.test.mjs
Normal file
@@ -0,0 +1,22 @@
|
||||
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}` })
|
||||
})
|
||||
}
|
||||
})
|
||||
@@ -27,6 +27,7 @@
|
||||
"ms": "^2.1.2"
|
||||
},
|
||||
"scripts": {
|
||||
"postversion": "npm publish --access public"
|
||||
"postversion": "npm publish --access public",
|
||||
"test": "node --test"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,6 +44,8 @@ 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
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
"url": "https://vates.fr"
|
||||
},
|
||||
"license": "ISC",
|
||||
"version": "0.3.0",
|
||||
"version": "0.4.1",
|
||||
"engines": {
|
||||
"node": ">=14"
|
||||
},
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
"bugs": "https://github.com/vatesfr/xen-orchestra/issues",
|
||||
"dependencies": {
|
||||
"@xen-orchestra/async-map": "^0.1.2",
|
||||
"@xen-orchestra/backups": "^0.49.1",
|
||||
"@xen-orchestra/backups": "^0.54.0",
|
||||
"@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.19",
|
||||
"version": "1.0.25",
|
||||
"license": "AGPL-3.0-or-later",
|
||||
"author": {
|
||||
"name": "Vates SAS",
|
||||
|
||||
@@ -49,26 +49,25 @@ 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(
|
||||
@@ -79,19 +78,10 @@ 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']
|
||||
|
||||
@@ -18,6 +18,7 @@ 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'
|
||||
|
||||
@@ -826,6 +827,29 @@ 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, {
|
||||
|
||||
@@ -23,7 +23,7 @@ createCachedLookup().patchGlobal()
|
||||
|
||||
const logger = createLogger('xo:backups:worker')
|
||||
catchGlobalErrors(logger)
|
||||
const { debug, info } = logger
|
||||
const { debug, info, warn } = logger
|
||||
|
||||
class BackupWorker {
|
||||
#config
|
||||
@@ -204,6 +204,13 @@ 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()
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
@@ -3,7 +3,6 @@ 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'
|
||||
@@ -227,9 +226,6 @@ 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)
|
||||
|
||||
@@ -15,6 +15,7 @@ const noop = Function.prototype
|
||||
|
||||
const DEFAULT_XAPI_VM_SETTINGS = {
|
||||
bypassVdiChainsCheck: false,
|
||||
cbtDestroySnapshotData: false,
|
||||
checkpointSnapshot: false,
|
||||
concurrency: 2,
|
||||
copyRetention: 0,
|
||||
|
||||
@@ -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')
|
||||
|
||||
if (transferList.length > 0) {
|
||||
for (const metadata of transferList) {
|
||||
const stream = await this._sourceRemoteAdapter.readFullVmBackup(metadata)
|
||||
const sizeContainer = watchStreamSize(stream)
|
||||
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
|
||||
}
|
||||
} else {
|
||||
Task.info('No new data to upload for this VM')
|
||||
// @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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,6 @@ 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'
|
||||
@@ -16,6 +15,16 @@ 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()
|
||||
@@ -53,50 +62,46 @@ class IncrementalRemoteVmBackupRunner extends AbstractRemote {
|
||||
async _run() {
|
||||
const transferList = await this._computeTransferList(({ mode }) => mode === 'delta')
|
||||
|
||||
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,
|
||||
})
|
||||
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
|
||||
}
|
||||
} else {
|
||||
Task.info('No new data to upload for this VM')
|
||||
await this._callWriters(writer => writer.cleanup(), 'writer.cleanup()')
|
||||
// for healthcheck
|
||||
this._tags = metadata.vm.tags
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -147,8 +147,13 @@ 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
|
||||
}
|
||||
|
||||
|
||||
@@ -1,14 +1,18 @@
|
||||
import { asyncEach } from '@vates/async-each'
|
||||
import groupBy from 'lodash/groupBy.js'
|
||||
|
||||
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,
|
||||
@@ -57,39 +61,74 @@ export const AbstractRemote = class AbstractRemoteVmBackupRunner extends Abstrac
|
||||
})
|
||||
)
|
||||
})
|
||||
const { filter } = job
|
||||
if (filter === undefined) {
|
||||
this._filterPredicate = () => true
|
||||
} else {
|
||||
this._filterPredicate = createPredicate(filter)
|
||||
}
|
||||
}
|
||||
|
||||
async _computeTransferList(predicate) {
|
||||
const vmBackups = await this._sourceRemoteAdapter.listVmBackups(this._vmUuid, predicate)
|
||||
async #computeTransferListPerJob(sourceBackups, remotesBackups) {
|
||||
const localMetada = new Map()
|
||||
Object.values(vmBackups).forEach(metadata => {
|
||||
sourceBackups.forEach(metadata => {
|
||||
const timestamp = metadata.timestamp
|
||||
localMetada.set(timestamp, metadata)
|
||||
})
|
||||
const nbRemotes = Object.keys(this.remoteAdapters).length
|
||||
const nbRemotes = remotesBackups.length
|
||||
const remoteMetadatas = {}
|
||||
await asyncEach(Object.values(this.remoteAdapters), async remoteAdapter => {
|
||||
const remoteMetadata = await remoteAdapter.listVmBackups(this._vmUuid, predicate)
|
||||
remoteMetadata.forEach(metadata => {
|
||||
remotesBackups.forEach(async remoteBackups => {
|
||||
remoteBackups.forEach(metadata => {
|
||||
const timestamp = metadata.timestamp
|
||||
remoteMetadatas[timestamp] = (remoteMetadatas[timestamp] ?? 0) + 1
|
||||
})
|
||||
})
|
||||
|
||||
let chain = []
|
||||
let transferList = []
|
||||
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
|
||||
chain.push(localMetada.get(timestamp))
|
||||
transferList.push(localMetada.get(timestamp))
|
||||
} else {
|
||||
// backup is present in local and remote : the chain has already been transferred
|
||||
chain = []
|
||||
transferList = []
|
||||
}
|
||||
}
|
||||
return 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)
|
||||
}
|
||||
|
||||
async run($defer) {
|
||||
|
||||
@@ -157,7 +157,7 @@ export const AbstractXapi = class AbstractXapiVmBackupRunner extends Abstract {
|
||||
}
|
||||
|
||||
const snapshotRef = await vm[settings.checkpointSnapshot ? '$checkpoint' : '$snapshot']({
|
||||
ignoreNobakVdis: true,
|
||||
ignoredVdisTag: '[NOBAK]',
|
||||
name_label: this._getSnapshotNameLabel(vm),
|
||||
unplugVusbs: true,
|
||||
})
|
||||
@@ -214,8 +214,12 @@ export const AbstractXapi = class AbstractXapiVmBackupRunner extends Abstract {
|
||||
const allSettings = this.job.settings
|
||||
const baseSettings = this._baseSettings
|
||||
|
||||
const snapshotsPerSchedule = groupBy(this._jobSnapshotVdis, _ => _.other_config[SCHEDULE_ID])
|
||||
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])
|
||||
await asyncMap(Object.entries(snapshotsPerSchedule), async ([scheduleId, snapshots]) => {
|
||||
const snapshotPerDatetime = groupBy(snapshots, _ => _.other_config[DATETIME])
|
||||
|
||||
@@ -227,22 +231,20 @@ export const AbstractXapi = class AbstractXapiVmBackupRunner extends Abstract {
|
||||
...allSettings[scheduleId],
|
||||
...allSettings[this._vm.uuid],
|
||||
}
|
||||
// ensure we never delete the last one
|
||||
const retention = Math.max(settings.snapshotRetention ?? 0, 1)
|
||||
|
||||
// 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)
|
||||
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) {
|
||||
if (vdi.$VBDs.length > 0) {
|
||||
const vbds = vdi.$VBDs
|
||||
const vbds = vdi.$VBDs.filter(({ $VM }) => $VM.is_control_domain === false)
|
||||
if (vbds.length > 0) {
|
||||
// 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
|
||||
@@ -265,7 +267,9 @@ 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
|
||||
@@ -274,21 +278,22 @@ 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
|
||||
// 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
|
||||
this._settings.preferNbd &&
|
||||
// only delete snapshost data if the config allows it
|
||||
this.config.purgeSnapshotData
|
||||
this._settings.cbtDestroySnapshotData
|
||||
) {
|
||||
Task.info('will delete snapshot data')
|
||||
const vdiRefs = await this._xapi.VM_getDisks(this._exportedVm?.$ref)
|
||||
await xapi.call('VM.destroy', this._exportedVm.$ref)
|
||||
const vdiRefs = await this._xapi.VM_getDisks(this._exportedVm.$ref)
|
||||
await this._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 xapi.VDI_dataDestroy(vdiRef)
|
||||
await this._xapi.VDI_dataDestroy(vdiRef)
|
||||
Task.info(`Snapshot data has been deleted`, { vdiRef })
|
||||
} catch (error) {
|
||||
Task.warning(`Couldn't deleted snapshot data`, { error, vdiRef })
|
||||
Task.warning(`Couldn't delete snapshot data`, { error, vdiRef })
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -333,15 +338,22 @@ 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(() =>
|
||||
$defer(async () => {
|
||||
// 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)
|
||||
vm.update_blocked_operations({
|
||||
await 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()
|
||||
@@ -373,6 +385,7 @@ export const AbstractXapi = class AbstractXapiVmBackupRunner extends Abstract {
|
||||
|
||||
await this._fetchJobSnapshots()
|
||||
await this._removeUnusedSnapshots()
|
||||
await this._removeSnapshotData()
|
||||
}
|
||||
await this._healthCheck()
|
||||
}
|
||||
|
||||
@@ -140,6 +140,7 @@ 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)]
|
||||
|
||||
@@ -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(({ other_config }) => {
|
||||
const replicatedVdis = sr.$VDIs
|
||||
.filter(vdi => {
|
||||
// REPLICATED_TO_SR_UUID is not used here since we are already filtering from sr.$VDIs
|
||||
return baseUuidToSrcVdi.has(other_config?.[COPY_OF])
|
||||
return baseUuidToSrcVdi.has(vdi?.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())
|
||||
return task.run(() => this._prepare(isFull))
|
||||
}
|
||||
|
||||
async _prepare() {
|
||||
async _prepare(isFull) {
|
||||
const settings = this._settings
|
||||
const { uuid: srUuid, $xapi: xapi } = this._sr
|
||||
const vmUuid = this._vmUuid
|
||||
@@ -67,14 +67,19 @@ 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() {
|
||||
if (!this._settings.deleteFirst) {
|
||||
await this._deleteOldEntries()
|
||||
}
|
||||
await this._deleteOldEntries()
|
||||
}
|
||||
|
||||
async _deleteOldEntries() {
|
||||
@@ -98,10 +103,11 @@ export class IncrementalXapiWriter extends MixinXapiWriter(AbstractIncrementalWr
|
||||
.filter(_ => !!_)
|
||||
// @todo use index ?
|
||||
|
||||
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])
|
||||
})
|
||||
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])
|
||||
})
|
||||
|
||||
Object.values(backup.vdis).forEach(vdi => {
|
||||
vdi.other_config[COPY_OF] = vdi.uuid
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
"type": "git",
|
||||
"url": "https://github.com/vatesfr/xen-orchestra.git"
|
||||
},
|
||||
"version": "0.49.1",
|
||||
"version": "0.54.0",
|
||||
"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.0",
|
||||
"@vates/nbd-client": "^3.0.2",
|
||||
"@vates/fuse-vhd": "^2.1.1",
|
||||
"@vates/nbd-client": "^3.1.0",
|
||||
"@vates/parse-duration": "^0.1.1",
|
||||
"@xen-orchestra/async-map": "^0.1.2",
|
||||
"@xen-orchestra/fs": "^4.1.7",
|
||||
@@ -46,8 +46,9 @@
|
||||
"proper-lockfile": "^4.1.2",
|
||||
"tar": "^6.1.15",
|
||||
"uuid": "^9.0.0",
|
||||
"vhd-lib": "^4.9.2",
|
||||
"xen-api": "^4.0.0",
|
||||
"value-matcher": "^0.2.0",
|
||||
"vhd-lib": "^4.11.0",
|
||||
"xen-api": "^4.3.1",
|
||||
"yazl": "^2.5.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
@@ -58,7 +59,7 @@
|
||||
"tmp": "^0.2.1"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@xen-orchestra/xapi": "^6.0.0"
|
||||
"@xen-orchestra/xapi": "^7.6.0"
|
||||
},
|
||||
"license": "AGPL-3.0-or-later",
|
||||
"author": {
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
"preferGlobal": true,
|
||||
"dependencies": {
|
||||
"golike-defer": "^0.5.1",
|
||||
"xen-api": "^4.0.0"
|
||||
"xen-api": "^4.3.1"
|
||||
},
|
||||
"scripts": {
|
||||
"postversion": "npm publish"
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
### `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
|
||||
```
|
||||
|
||||
@@ -14,6 +14,37 @@ 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
|
||||
|
||||
@@ -22,7 +22,7 @@ function defined() {
|
||||
}
|
||||
|
||||
for (let i = 0; i < n; ++i) {
|
||||
let arg = arguments[i]
|
||||
let arg = args[i]
|
||||
if (typeof arg === 'function') {
|
||||
arg = get(arg)
|
||||
}
|
||||
|
||||
30
@xen-orchestra/defined/index.test.mjs
Normal file
30
@xen-orchestra/defined/index.test.mjs
Normal file
@@ -0,0 +1,30 @@
|
||||
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'
|
||||
)
|
||||
})
|
||||
})
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"private": false,
|
||||
"name": "@xen-orchestra/defined",
|
||||
"version": "0.0.1",
|
||||
"version": "0.0.2",
|
||||
"license": "ISC",
|
||||
"description": "Utilities to help handling (possibly) undefined values",
|
||||
"homepage": "https://github.com/vatesfr/xen-orchestra/tree/master/@xen-orchestra/defined",
|
||||
@@ -23,6 +23,7 @@
|
||||
"node": ">=6"
|
||||
},
|
||||
"scripts": {
|
||||
"postversion": "npm publish"
|
||||
"postversion": "npm publish",
|
||||
"test": "node --test"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,19 +17,19 @@
|
||||
"xo-lift-remote-immutability": "./liftProtection.mjs"
|
||||
},
|
||||
"license": "AGPL-3.0-or-later",
|
||||
"version": "1.0.6",
|
||||
"version": "1.0.12",
|
||||
"engines": {
|
||||
"node": ">=14.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@vates/async-each": "^1.0.0",
|
||||
"@xen-orchestra/backups": "^0.49.1",
|
||||
"@xen-orchestra/backups": "^0.54.0",
|
||||
"@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.9.2"
|
||||
"vhd-lib": "^4.11.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"rimraf": "^5.0.5",
|
||||
|
||||
@@ -2,7 +2,17 @@
|
||||
|
||||
## **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)
|
||||
|
||||
|
||||
@@ -5,213 +5,6 @@
|
||||
- `yarn`
|
||||
- `yarn dev`
|
||||
|
||||
## Conventions
|
||||
## Guidelines
|
||||
|
||||
### 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 -->
|
||||
```
|
||||
Please follow the guidelines from the `@xen-orchestra/web-core/docs/guidelines` directory.
|
||||
|
||||
1
@xen-orchestra/lite/env.d.ts
vendored
1
@xen-orchestra/lite/env.d.ts
vendored
@@ -1,6 +1,7 @@
|
||||
/// <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
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@xen-orchestra/lite",
|
||||
"version": "0.2.3",
|
||||
"version": "0.4.0",
|
||||
"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": "*",
|
||||
"@xen-orchestra/web-core": "^0.3.0",
|
||||
"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.2.5",
|
||||
"vue-router": "^4.4.0",
|
||||
"vue-tsc": "^1.8.27",
|
||||
"zx": "^7.2.3"
|
||||
},
|
||||
|
||||
@@ -270,8 +270,13 @@ 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) {
|
||||
|
||||
30
@xen-orchestra/lite/scripts/xolite-loader.html
Normal file
30
@xen-orchestra/lite/scripts/xolite-loader.html
Normal file
@@ -0,0 +1,30 @@
|
||||
<!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>
|
||||
@@ -75,7 +75,7 @@ useUnreachableHosts()
|
||||
overflow: auto;
|
||||
flex: 1;
|
||||
height: calc(100vh - 5.5rem);
|
||||
background-color: var(--background-color-secondary);
|
||||
background-color: var(--color-neutral-background-secondary);
|
||||
|
||||
&.no-ui {
|
||||
height: 100vh;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<MenuList placement="bottom-end" shadow>
|
||||
<MenuList placement="bottom-end" border>
|
||||
<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 scoped>
|
||||
<style lang="postcss" scoped>
|
||||
.account-button {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 1rem;
|
||||
color: var(--color-grey-100);
|
||||
color: var(--color-neutral-txt-primary);
|
||||
border: none;
|
||||
border-radius: 0.8rem;
|
||||
background-color: var(--background-color-secondary);
|
||||
background-color: var(--color-neutral-background-secondary);
|
||||
gap: 0.8rem;
|
||||
|
||||
&:disabled {
|
||||
color: var(--color-grey-500);
|
||||
color: var(--color-neutral-border);
|
||||
}
|
||||
|
||||
&:not(:disabled) {
|
||||
@@ -67,12 +67,12 @@ const openSettings = () => router.push({ name: 'settings' })
|
||||
&:hover,
|
||||
&:active,
|
||||
&.active {
|
||||
background-color: var(--background-color-primary);
|
||||
background-color: var(--color-neutral-background-primary);
|
||||
}
|
||||
|
||||
&:active,
|
||||
&.active {
|
||||
color: var(--color-purple-base);
|
||||
color: var(--color-normal-txt-base);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -86,6 +86,6 @@ const openSettings = () => router.push({ name: 'settings' })
|
||||
}
|
||||
|
||||
.menu-item-logout {
|
||||
color: var(--color-red-base);
|
||||
color: var(--color-danger-txt-base);
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -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-grey-500);
|
||||
background-color: var(--background-color-secondary);
|
||||
border-bottom: 0.1rem solid var(--color-neutral-border);
|
||||
background-color: var(--color-neutral-background-secondary);
|
||||
|
||||
img {
|
||||
width: 4rem;
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
<FormCheckbox v-model="rememberMe" />
|
||||
{{ $t('keep-me-logged') }}
|
||||
</label>
|
||||
<UiButton type="submit" :busy="isConnecting">
|
||||
<UiButton size="medium" color="normal" level="primary" type="submit" :busy="isConnecting">
|
||||
{{ $t('login') }}
|
||||
</UiButton>
|
||||
</template>
|
||||
@@ -107,6 +107,7 @@ async function handleSubmit() {
|
||||
display: flex;
|
||||
margin: 1rem;
|
||||
width: fit-content;
|
||||
|
||||
& .form-checkbox {
|
||||
margin: auto 1rem auto auto;
|
||||
}
|
||||
@@ -119,7 +120,7 @@ async function handleSubmit() {
|
||||
justify-content: center;
|
||||
min-height: 100vh;
|
||||
max-width: 100vw;
|
||||
background-color: var(--background-color-primary);
|
||||
background-color: var(--color-neutral-background-primary);
|
||||
}
|
||||
|
||||
form {
|
||||
@@ -131,10 +132,10 @@ form {
|
||||
justify-content: center;
|
||||
margin: 0 auto;
|
||||
padding: 8.5rem;
|
||||
background-color: var(--background-color-secondary);
|
||||
background-color: var(--color-neutral-background-secondary);
|
||||
|
||||
.error {
|
||||
color: var(--color-red-base);
|
||||
color: var(--color-danger-txt-base);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -155,7 +156,7 @@ input {
|
||||
max-width: 100%;
|
||||
margin-bottom: 1rem;
|
||||
padding: 1rem 1.5rem;
|
||||
border: 1px solid var(--color-grey-500);
|
||||
border: 1px solid var(--color-neutral-border);
|
||||
border-radius: 0.8rem;
|
||||
background-color: white;
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ useEventListener(
|
||||
}
|
||||
|
||||
code:not(.hljs-code) {
|
||||
background-color: var(--background-color-purple-10);
|
||||
background-color: var(--color-normal-background-selected);
|
||||
padding: 0.3rem 0.6rem;
|
||||
border-radius: 0.6rem;
|
||||
}
|
||||
@@ -81,12 +81,12 @@ useEventListener(
|
||||
}
|
||||
|
||||
thead th {
|
||||
border-bottom: 2px solid var(--color-grey-500);
|
||||
background-color: var(--background-color-secondary);
|
||||
border-bottom: 2px solid var(--color-neutral-border);
|
||||
background-color: var(--color-neutral-background-secondary);
|
||||
}
|
||||
|
||||
tbody td {
|
||||
border-bottom: 1px solid var(--color-grey-500);
|
||||
border-bottom: 1px solid var(--color-neutral-border);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -103,11 +103,11 @@ useEventListener(
|
||||
background-color: transparent;
|
||||
|
||||
&:hover {
|
||||
color: var(--color-purple-base);
|
||||
color: var(--color-normal-txt-base);
|
||||
}
|
||||
|
||||
&:active {
|
||||
color: var(--color-purple-d20);
|
||||
color: var(--color-normal-txt-hover);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,8 +45,8 @@ whenever(isOpen, () => {
|
||||
max-width: 37rem;
|
||||
height: calc(100vh - 5.5rem);
|
||||
padding: 0.5rem;
|
||||
border-right: 1px solid var(--color-grey-500);
|
||||
background-color: var(--background-color-primary);
|
||||
border-right: 1px solid var(--color-neutral-border);
|
||||
background-color: var(--color-neutral-background-primary);
|
||||
|
||||
&.collapsible {
|
||||
position: fixed;
|
||||
|
||||
@@ -181,7 +181,7 @@ const valueInputAfter = computed(() => (newFilter.value.builder.comparison === '
|
||||
.collection-filter-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
border-bottom: 1px solid var(--background-color-secondary);
|
||||
border-bottom: 1px solid var(--color-neutral-background-secondary);
|
||||
gap: 1rem;
|
||||
|
||||
.or {
|
||||
|
||||
@@ -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-grey-500);
|
||||
border: 1px solid var(--color-neutral-border);
|
||||
border-radius: 0.8rem;
|
||||
background-color: var(--color-grey-600);
|
||||
background-color: var(--color-neutral-background-primary);
|
||||
box-shadow: var(--shadow-100);
|
||||
gap: 0.1rem;
|
||||
|
||||
&:focus-within {
|
||||
outline: 1px solid var(--color-purple-l40);
|
||||
outline: 1px solid var(--color-normal-item-active);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@ const isIcon = (maybeIcon: any): maybeIcon is IconDefinition => typeof maybeIcon
|
||||
}
|
||||
|
||||
.form-widget:hover .widget {
|
||||
border-color: var(--color-purple-l60);
|
||||
border-color: var(--color-normal-item-hover);
|
||||
}
|
||||
|
||||
.element {
|
||||
@@ -93,8 +93,8 @@ const isIcon = (maybeIcon: any): maybeIcon is IconDefinition => typeof maybeIcon
|
||||
font-size: inherit;
|
||||
border: none;
|
||||
outline: none;
|
||||
color: var(--color-grey-100);
|
||||
background-color: var(--color-grey-600);
|
||||
color: var(--color-neutral-txt-primary);
|
||||
background-color: var(--color-neutral-background-primary);
|
||||
flex: 1;
|
||||
|
||||
&:disabled {
|
||||
@@ -134,7 +134,7 @@ const isIcon = (maybeIcon: any): maybeIcon is IconDefinition => typeof maybeIcon
|
||||
|
||||
&:disabled {
|
||||
cursor: not-allowed;
|
||||
color: var(--color-grey-200);
|
||||
color: var(--color-neutral-txt-secondary);
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
</th>
|
||||
<td v-if="hasMultipleHosts">
|
||||
<UiSpinner v-if="!areAllLoaded" />
|
||||
<UiCounter
|
||||
<VtsCounter
|
||||
v-else
|
||||
v-tooltip="{
|
||||
placement: 'left',
|
||||
@@ -19,7 +19,9 @@
|
||||
}"
|
||||
:value="patch.$hostRefs.size"
|
||||
class="counter"
|
||||
color="error"
|
||||
accent="danger"
|
||||
variant="primary"
|
||||
size="small"
|
||||
/>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -31,7 +33,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 UiCounter from '@core/components/UiCounter.vue'
|
||||
import VtsCounter from '@core/components/counter/VtsCounter.vue'
|
||||
import { vTooltip } from '@core/directives/tooltip.directive'
|
||||
import { useUiStore } from '@core/stores/ui.store'
|
||||
import { computed } from 'vue'
|
||||
|
||||
@@ -23,7 +23,7 @@ defineProps<{
|
||||
<style lang="postcss" scoped>
|
||||
.error {
|
||||
margin: 0.5rem 0;
|
||||
color: var(--color-red-base);
|
||||
color: var(--color-danger-txt-base);
|
||||
|
||||
& svg {
|
||||
margin-right: 0.5rem;
|
||||
|
||||
@@ -22,6 +22,6 @@
|
||||
margin: auto;
|
||||
width: 8em;
|
||||
font-style: normal;
|
||||
color: var(--color-red-base);
|
||||
color: var(--color-danger-txt-base);
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -27,6 +27,6 @@
|
||||
font-weight: 500;
|
||||
font-size: 2rem;
|
||||
line-height: 150%;
|
||||
color: var(--color-purple-base);
|
||||
color: var(--color-normal-txt-base);
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -79,7 +79,7 @@ const objectRoute = computed(() => {
|
||||
|
||||
<style lang="postcss" scoped>
|
||||
.unknown {
|
||||
color: var(--color-grey-300);
|
||||
color: var(--color-neutral-txt-secondary);
|
||||
font-style: italic;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -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 scoped>
|
||||
<style lang="postcss" scoped>
|
||||
.wrapper-spinner {
|
||||
display: flex;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.spinner {
|
||||
color: var(--color-purple-base);
|
||||
color: var(--color-normal-txt-base);
|
||||
display: flex;
|
||||
margin: auto;
|
||||
width: 10rem;
|
||||
|
||||
@@ -24,7 +24,7 @@ import UiStatusPanel from '@/components/ui/UiStatusPanel.vue'
|
||||
|
||||
<style lang="postcss" scoped>
|
||||
.contact {
|
||||
color: var(--color-grey-100);
|
||||
color: var(--color-neutral-txt-primary);
|
||||
|
||||
& a {
|
||||
text-transform: lowercase;
|
||||
|
||||
@@ -43,7 +43,7 @@ const masterSessionStorage = useSessionStorage('master', null)
|
||||
|
||||
<style lang="postcss" scoped>
|
||||
.warning-not-current-pool {
|
||||
color: var(--color-orange-base);
|
||||
color: var(--color-warning-txt-base);
|
||||
cursor: pointer;
|
||||
|
||||
.wrapper {
|
||||
|
||||
@@ -26,18 +26,22 @@ const className = computed(() => `state-${props.state.toLocaleLowerCase()}`)
|
||||
|
||||
<style lang="postcss" scoped>
|
||||
.power-state-icon {
|
||||
color: var(--color-purple-d60);
|
||||
color: var(--color-normal-txt-item);
|
||||
|
||||
&.state-running {
|
||||
color: var(--color-green-base);
|
||||
color: var(--color-success-item-base);
|
||||
}
|
||||
|
||||
&.state-paused {
|
||||
color: var(--color-grey-300);
|
||||
color: var(--color-neutral-txt-secondary);
|
||||
}
|
||||
|
||||
&.state-suspended {
|
||||
color: var(--color-purple-d20);
|
||||
color: var(--color-normal-txt-hover);
|
||||
}
|
||||
|
||||
&.state-halted {
|
||||
color: var(--color-danger-item-base);
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -39,7 +39,7 @@ const progress = computed(() => {
|
||||
.progress-circle-fill {
|
||||
animation: progress 1s ease-out forwards;
|
||||
fill: none;
|
||||
stroke: var(--color-green-base);
|
||||
stroke: var(--color-success-item-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-grey-500);
|
||||
stroke: var(--color-neutral-background-disabled);
|
||||
}
|
||||
|
||||
.progress-circle-text {
|
||||
font-size: 0.7rem;
|
||||
font-weight: bold;
|
||||
fill: var(--color-green-base);
|
||||
fill: var(--color-success-item-base);
|
||||
text-anchor: middle;
|
||||
alignment-baseline: middle;
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { useXenApiStore } from '@/stores/xen-api.store'
|
||||
import VncClient from '@novnc/novnc/core/rfb'
|
||||
import VncClient from '@novnc/novnc/lib/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
|
||||
|
||||
const handleDisconnectionEvent = () => {
|
||||
function handleDisconnectionEvent() {
|
||||
clearVncClient()
|
||||
|
||||
if (props.isConsoleAvailable) {
|
||||
@@ -51,9 +51,12 @@ const handleDisconnectionEvent = () => {
|
||||
createVncConnection()
|
||||
}
|
||||
}
|
||||
const handleConnectionEvent = () => (nConnectionAttempts = 0)
|
||||
|
||||
const clearVncClient = () => {
|
||||
function handleConnectionEvent() {
|
||||
nConnectionAttempts = 0
|
||||
}
|
||||
|
||||
function clearVncClient() {
|
||||
if (vncClient === undefined) {
|
||||
return
|
||||
}
|
||||
@@ -61,14 +64,12 @@ const clearVncClient = () => {
|
||||
vncClient.removeEventListener('disconnect', handleDisconnectionEvent)
|
||||
vncClient.removeEventListener('connect', handleConnectionEvent)
|
||||
|
||||
if (vncClient._rfbConnectionState !== 'disconnected') {
|
||||
vncClient.disconnect()
|
||||
}
|
||||
vncClient.disconnect()
|
||||
|
||||
vncClient = undefined
|
||||
}
|
||||
|
||||
const createVncConnection = async () => {
|
||||
async function createVncConnection() {
|
||||
if (nConnectionAttempts !== 0) {
|
||||
await promiseTimeout(FIBONACCI_MS_ARRAY[nConnectionAttempts - 1])
|
||||
|
||||
|
||||
@@ -29,18 +29,18 @@ defineProps<{
|
||||
align-items: center;
|
||||
height: 6rem;
|
||||
padding: 0 1.5rem;
|
||||
border-bottom: 1px solid var(--color-grey-500);
|
||||
background-color: var(--background-color-primary);
|
||||
border-bottom: 1px solid var(--color-neutral-border);
|
||||
background-color: var(--color-neutral-background-primary);
|
||||
gap: 0.8rem;
|
||||
}
|
||||
|
||||
.icon {
|
||||
font-size: 2.5rem;
|
||||
color: var(--color-purple-base);
|
||||
color: var(--color-normal-txt-base);
|
||||
}
|
||||
|
||||
.title {
|
||||
color: var(--color-grey-100);
|
||||
color: var(--color-neutral-txt-primary);
|
||||
}
|
||||
|
||||
.actions {
|
||||
|
||||
@@ -60,28 +60,28 @@ const computedData = computed(() => {
|
||||
}
|
||||
|
||||
.progress-item:nth-child(1) {
|
||||
--progress-bar-color: var(--color-purple-d60);
|
||||
--progress-bar-color: var(--color-normal-txt-item);
|
||||
}
|
||||
|
||||
.progress-item:nth-child(2) {
|
||||
--progress-bar-color: var(--color-purple-d40);
|
||||
--progress-bar-color: var(--color-normal-txt-active);
|
||||
}
|
||||
|
||||
.progress-item:nth-child(3) {
|
||||
--progress-bar-color: var(--color-purple-d20);
|
||||
--progress-bar-color: var(--color-normal-txt-hover);
|
||||
}
|
||||
|
||||
.progress-item {
|
||||
--progress-bar-height: 1.2rem;
|
||||
--progress-bar-color: var(--color-purple-l20);
|
||||
--progress-bar-background-color: var(--color-grey-500);
|
||||
--progress-bar-color: var(--color-normal-item-hover);
|
||||
--progress-bar-background-color: var(--color-neutral-background-disabled);
|
||||
|
||||
&.warning {
|
||||
--progress-bar-color: var(--color-orange-base);
|
||||
--progress-bar-color: var(--color-warning-item-base);
|
||||
}
|
||||
|
||||
&.error {
|
||||
--progress-bar-color: var(--color-red-base);
|
||||
--progress-bar-color: var(--color-danger-item-base);
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,8 +1,24 @@
|
||||
<template>
|
||||
<UiButton v-if="xoaFound" :left-icon="faArrowUpRightFromSquare" class="xoa-button" @click="openXoa()">
|
||||
<UiButton
|
||||
v-if="xoaFound"
|
||||
size="medium"
|
||||
color="normal"
|
||||
level="primary"
|
||||
:left-icon="faArrowUpRightFromSquare"
|
||||
class="xoa-button"
|
||||
@click="openXoa()"
|
||||
>
|
||||
{{ $t('access-xoa') }}
|
||||
</UiButton>
|
||||
<UiButton v-else :left-icon="faDownload" class="xoa-button" @click="openXoaDeploy()">
|
||||
<UiButton
|
||||
v-else
|
||||
size="medium"
|
||||
color="normal"
|
||||
level="primary"
|
||||
:left-icon="faDownload"
|
||||
class="xoa-button"
|
||||
@click="openXoaDeploy()"
|
||||
>
|
||||
{{ $t('deploy-xoa') }}
|
||||
</UiButton>
|
||||
</template>
|
||||
@@ -30,7 +46,8 @@ interface InterfaceInfo {
|
||||
|
||||
interface ClientInfo {
|
||||
lastConnected: number
|
||||
networkInterfaces: Record<string, InterfaceInfo[]>
|
||||
networkInterfaces?: Record<string, InterfaceInfo[]>
|
||||
publicUrl?: string
|
||||
}
|
||||
|
||||
const xoasInfo = computed(() => {
|
||||
@@ -60,7 +77,12 @@ const xoaAddress = computed(() => {
|
||||
return
|
||||
}
|
||||
|
||||
const { networkInterfaces } = xoaInfo.value
|
||||
const { networkInterfaces, publicUrl } = xoaInfo.value
|
||||
|
||||
if (publicUrl !== undefined) {
|
||||
return publicUrl
|
||||
}
|
||||
|
||||
if (networkInterfaces === undefined || Object.keys(networkInterfaces).length === 0) {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -3,11 +3,17 @@
|
||||
<TabItem v-bind="tab(TAB.PROPS, propParams)">Props</TabItem>
|
||||
<TabItem class="event-tab" v-bind="tab(TAB.EVENTS, eventParams)">
|
||||
Events
|
||||
<UiCounter v-if="unreadEventsCount > 0" :value="unreadEventsCount" color="success" />
|
||||
<VtsCounter
|
||||
v-if="unreadEventsCount > 0"
|
||||
:value="unreadEventsCount"
|
||||
accent="success"
|
||||
variant="primary"
|
||||
size="small"
|
||||
/>
|
||||
</TabItem>
|
||||
<TabItem v-bind="tab(TAB.SLOTS, slotParams)">Slots</TabItem>
|
||||
<TabItem v-bind="tab(TAB.SETTINGS, settingParams)">Settings</TabItem>
|
||||
<MenuList placement="bottom" shadow>
|
||||
<MenuList placement="bottom" border>
|
||||
<template #trigger="{ open, isOpen }">
|
||||
<TabItem :active="isOpen" :disabled="presets === undefined" class="preset-tab" @click="open">
|
||||
<UiIcon :icon="faSliders" />
|
||||
@@ -35,7 +41,9 @@
|
||||
<UiCardTitle>
|
||||
Logs
|
||||
<template #right>
|
||||
<UiButton v-if="eventsLog.length > 0" level="tertiary" @click="eventsLog = []"> Clear </UiButton>
|
||||
<UiButton v-if="eventsLog.length > 0" size="medium" color="normal" level="tertiary" @click="eventsLog = []">
|
||||
Clear
|
||||
</UiButton>
|
||||
</template>
|
||||
</UiCardTitle>
|
||||
<div class="events-log">
|
||||
@@ -78,11 +86,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'
|
||||
@@ -109,6 +117,8 @@ enum TAB {
|
||||
SETTINGS,
|
||||
}
|
||||
|
||||
const selectedTab = ref<TAB>(TAB.NONE)
|
||||
|
||||
const tab = (tab: TAB, params: Param[]) =>
|
||||
reactive({
|
||||
onClick: () => (selectedTab.value = tab),
|
||||
@@ -131,8 +141,6 @@ 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
|
||||
|
||||
@@ -22,12 +22,12 @@
|
||||
th,
|
||||
td {
|
||||
padding: 0.3rem 0.6rem;
|
||||
border-bottom: 0.1rem solid var(--color-grey-500);
|
||||
border-bottom: 0.1rem solid var(--color-neutral-border);
|
||||
vertical-align: center;
|
||||
}
|
||||
|
||||
&:nth-child(odd) {
|
||||
background-color: var(--background-color-purple-10);
|
||||
background-color: var(--color-normal-background-selected);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -127,14 +127,14 @@ const openRawValueModal = (code: string) =>
|
||||
align-items: center;
|
||||
padding: 0.4rem 0.6rem;
|
||||
cursor: pointer;
|
||||
color: var(--color-grey-300);
|
||||
color: var(--color-neutral-txt-secondary);
|
||||
border-radius: 0.4rem;
|
||||
gap: 0.6rem;
|
||||
|
||||
&.active {
|
||||
font-weight: 600;
|
||||
cursor: default;
|
||||
color: var(--color-green-l20);
|
||||
color: var(--color-success-item-hover);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -157,7 +157,7 @@ const openRawValueModal = (code: string) =>
|
||||
|
||||
.help {
|
||||
font-style: italic;
|
||||
color: var(--color-grey-200);
|
||||
color: var(--color-neutral-txt-secondary);
|
||||
}
|
||||
|
||||
.default-value {
|
||||
@@ -168,12 +168,12 @@ const openRawValueModal = (code: string) =>
|
||||
font-weight: 600;
|
||||
font-style: normal;
|
||||
opacity: 1;
|
||||
color: var(--color-green-base);
|
||||
color: var(--color-success-txt-base);
|
||||
}
|
||||
}
|
||||
|
||||
.v-model-indicator,
|
||||
.context-indicator {
|
||||
color: var(--color-green-base);
|
||||
color: var(--color-success-txt-base);
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -81,7 +81,7 @@ const isIndeterminate = computed(() => (type === 'checkbox' || type === 'toggle'
|
||||
|
||||
.input.indeterminate + .fake-checkbox > .icon {
|
||||
opacity: 1;
|
||||
color: var(--color-grey-300);
|
||||
color: var(--color-normal-txt-item);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -91,7 +91,7 @@ const isIndeterminate = computed(() => (type === 'checkbox' || type === 'toggle'
|
||||
|
||||
.fake-checkbox {
|
||||
width: 1.25em;
|
||||
--background-color: var(--background-color-primary);
|
||||
--background-color: var(--color-neutral-background-primary);
|
||||
}
|
||||
|
||||
.icon {
|
||||
@@ -114,7 +114,7 @@ const isIndeterminate = computed(() => (type === 'checkbox' || type === 'toggle'
|
||||
|
||||
.fake-checkbox {
|
||||
width: 2.5em;
|
||||
--background-color: var(--color-grey-500);
|
||||
--background-color: var(--color-neutral-border);
|
||||
}
|
||||
|
||||
.icon {
|
||||
@@ -128,7 +128,7 @@ const isIndeterminate = computed(() => (type === 'checkbox' || type === 'toggle'
|
||||
|
||||
.input.indeterminate + .fake-checkbox > .icon {
|
||||
opacity: 1;
|
||||
color: var(--color-grey-300);
|
||||
color: var(--color-neutral-txt-secondary);
|
||||
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-grey-600);
|
||||
color: var(--color-normal-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));
|
||||
@@ -162,44 +162,43 @@ const isIndeterminate = computed(() => (type === 'checkbox' || type === 'toggle'
|
||||
background-color: var(--background-color);
|
||||
box-shadow: var(--shadow-100);
|
||||
|
||||
--border-color: var(--color-grey-500);
|
||||
--border-color: var(--color-normal-item-base);
|
||||
}
|
||||
|
||||
.input:disabled {
|
||||
& + .fake-checkbox {
|
||||
cursor: not-allowed;
|
||||
--background-color: var(--background-color-secondary);
|
||||
--border-color: var(--color-grey-500);
|
||||
--border-color: var(--color-neutral-txt-secondary);
|
||||
}
|
||||
|
||||
&:checked + .fake-checkbox {
|
||||
--border-color: transparent;
|
||||
--background-color: var(--color-purple-l60);
|
||||
--background-color: var(--color-normal-item-disabled);
|
||||
}
|
||||
}
|
||||
|
||||
.input:not(:disabled) {
|
||||
&:hover + .fake-checkbox,
|
||||
&:focus + .fake-checkbox {
|
||||
--border-color: var(--color-purple-l40);
|
||||
--border-color: var(--color-normal-item-hover);
|
||||
}
|
||||
|
||||
&:active + .fake-checkbox {
|
||||
--border-color: var(--color-purple-l20);
|
||||
--border-color: var(--color-normal-item-active);
|
||||
}
|
||||
|
||||
&:checked + .fake-checkbox {
|
||||
--border-color: transparent;
|
||||
--background-color: var(--color-purple-base);
|
||||
--background-color: var(--color-normal-item-base);
|
||||
}
|
||||
|
||||
&:checked:hover + .fake-checkbox,
|
||||
&:checked:focus + .fake-checkbox {
|
||||
--background-color: var(--color-purple-d20);
|
||||
--background-color: var(--color-normal-item-hover);
|
||||
}
|
||||
|
||||
&:checked:active + .fake-checkbox {
|
||||
--background-color: var(--color-purple-d40);
|
||||
--background-color: var(--color-normal-item-active);
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -144,14 +144,14 @@ defineExpose({
|
||||
--after-width: v-bind('afterWidth || "1.625em"');
|
||||
--caret-width: 1.5em;
|
||||
|
||||
--text-color: var(--color-grey-100);
|
||||
--text-color: var(--color-neutral-txt-primary);
|
||||
|
||||
&.empty {
|
||||
--text-color: var(--color-grey-300);
|
||||
--text-color: var(--color-neutral-txt-secondary);
|
||||
}
|
||||
|
||||
&.disabled {
|
||||
--text-color: var(--color-grey-500);
|
||||
--text-color: var(--color-neutral-border);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -188,74 +188,74 @@ defineExpose({
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
--background-color: var(--background-color-primary);
|
||||
--border-color: var(--color-grey-500);
|
||||
--background-color: var(--color-neutral-background-primary);
|
||||
--border-color: var(--color-neutral-border);
|
||||
|
||||
&:disabled {
|
||||
cursor: not-allowed;
|
||||
--background-color: var(--background-color-secondary);
|
||||
--background-color: var(--color-neutral-background-disabled);
|
||||
}
|
||||
|
||||
&:not(:disabled) {
|
||||
&.info {
|
||||
&:hover {
|
||||
--border-color: var(--color-purple-l60);
|
||||
--border-color: var(--color-normal-item-hover);
|
||||
}
|
||||
|
||||
&:active {
|
||||
--border-color: var(--color-purple-l40);
|
||||
--border-color: var(--color-normal-item-active);
|
||||
}
|
||||
|
||||
&:focus {
|
||||
--border-color: var(--color-purple-base);
|
||||
--border-color: var(--color-normal-item-base);
|
||||
}
|
||||
}
|
||||
|
||||
&.success {
|
||||
--border-color: var(--color-green-base);
|
||||
--border-color: var(--color-success-item-base);
|
||||
|
||||
&:hover {
|
||||
--border-color: var(--color-green-l60);
|
||||
--border-color: var(--color-success-item-hover);
|
||||
}
|
||||
|
||||
&:active {
|
||||
--border-color: var(--color-green-l40);
|
||||
--border-color: var(--color-success-item-active);
|
||||
}
|
||||
|
||||
&:focus {
|
||||
--border-color: var(--color-green-base);
|
||||
--border-color: var(--color-success-item-base);
|
||||
}
|
||||
}
|
||||
|
||||
&.warning {
|
||||
--border-color: var(--color-orange-base);
|
||||
--border-color: var(--color-warning-item-base);
|
||||
|
||||
&:hover {
|
||||
--border-color: var(--color-orange-l60);
|
||||
--border-color: var(--color-warning-item-hover);
|
||||
}
|
||||
|
||||
&:active {
|
||||
--border-color: var(--color-orange-l40);
|
||||
--border-color: var(--color-warning-item-active);
|
||||
}
|
||||
|
||||
&:focus {
|
||||
--border-color: var(--color-orange-base);
|
||||
--border-color: var(--color-warning-item-base);
|
||||
}
|
||||
}
|
||||
|
||||
&.error {
|
||||
--border-color: var(--color-red-base);
|
||||
--border-color: var(--color-danger-item-base);
|
||||
|
||||
&:hover {
|
||||
--border-color: var(--color-red-l60);
|
||||
--border-color: var(--color-danger-item-hover);
|
||||
}
|
||||
|
||||
&:active {
|
||||
--border-color: var(--color-red-l40);
|
||||
--border-color: var(--color-danger-item-active);
|
||||
}
|
||||
|
||||
&:focus-within {
|
||||
--border-color: var(--color-red-base);
|
||||
--border-color: var(--color-danger-item-base);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -101,12 +101,12 @@ useContext(DisabledContext, () => props.disabled)
|
||||
padding: 1rem 0;
|
||||
|
||||
&.light {
|
||||
color: var(--color-grey-300);
|
||||
color: var(--color-neutral-txt-secondary);
|
||||
}
|
||||
|
||||
&:not(.light) {
|
||||
text-transform: uppercase;
|
||||
color: var(--color-grey-100);
|
||||
color: var(--color-neutral-txt-primary);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -128,7 +128,7 @@ useContext(DisabledContext, () => props.disabled)
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
text-decoration: none;
|
||||
color: var(--color-purple-base);
|
||||
color: var(--color-normal-txt-base);
|
||||
|
||||
& > span {
|
||||
text-decoration: underline;
|
||||
@@ -136,14 +136,14 @@ useContext(DisabledContext, () => props.disabled)
|
||||
}
|
||||
|
||||
.warning {
|
||||
color: var(--color-orange-base);
|
||||
color: var(--color-warning-txt-base);
|
||||
}
|
||||
|
||||
.error {
|
||||
color: var(--color-red-base);
|
||||
color: var(--color-danger-txt-base);
|
||||
}
|
||||
|
||||
.help {
|
||||
color: var(--color-grey-300);
|
||||
color: var(--color-neutral-txt-secondary);
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -53,7 +53,7 @@ whenever(
|
||||
<style lang="postcss" scoped>
|
||||
.collapsible {
|
||||
padding: 1rem 1.5rem;
|
||||
background-color: var(--background-color-purple-10);
|
||||
background-color: var(--color-normal-background-selected);
|
||||
border-radius: 0.8rem;
|
||||
}
|
||||
|
||||
@@ -67,14 +67,14 @@ whenever(
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
color: var(--color-purple-base);
|
||||
color: var(--color-normal-txt-base);
|
||||
border: none;
|
||||
border-bottom: 1px solid var(--color-purple-base);
|
||||
border-bottom: 1px solid var(--color-normal-txt-base);
|
||||
width: 100%;
|
||||
padding-bottom: 1rem;
|
||||
|
||||
.collapsible & {
|
||||
color: var(--color-grey-100);
|
||||
color: var(--color-neutral-txt-primary);
|
||||
padding-bottom: 0;
|
||||
cursor: pointer;
|
||||
}
|
||||
@@ -85,6 +85,6 @@ whenever(
|
||||
}
|
||||
|
||||
.collapse-icon {
|
||||
color: var(--color-purple-base);
|
||||
color: var(--color-normal-txt-base);
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,10 +1,17 @@
|
||||
<template>
|
||||
<TreeItem v-if="host !== undefined" class="infra-host-item">
|
||||
<TreeItemLabel :icon="faServer" :route="{ name: 'host.dashboard', params: { uuid: host.uuid } }">
|
||||
<TreeItem v-if="host !== undefined" :expanded="isExpanded" class="infra-host-item">
|
||||
<TreeItemLabel :icon="faServer" :route="{ name: 'host.dashboard', params: { uuid: host.uuid } }" @toggle="toggle()">
|
||||
{{ host.name_label || '(Host)' }}
|
||||
<template #addons>
|
||||
<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" />
|
||||
<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"
|
||||
/>
|
||||
</template>
|
||||
</TreeItemLabel>
|
||||
<template #sublist>
|
||||
@@ -21,13 +28,14 @@ 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 UiIcon from '@core/components/icon/UiIcon.vue'
|
||||
import VtsCounter from '@core/components/counter/VtsCounter.vue'
|
||||
import VtsIcon from '@core/components/icon/VtsIcon.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<{
|
||||
@@ -43,4 +51,6 @@ 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>
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
class="infra-item-label"
|
||||
v-bind="$attrs"
|
||||
>
|
||||
<a v-tooltip="{ selector: '.text' }" :href class="link" @click="navigate">
|
||||
<a v-tooltip="{ selector: '.text-ellipsis' }" :href class="link" @click="navigate">
|
||||
<UiIcon :icon class="icon" />
|
||||
<div class="text typo h6-medium">
|
||||
<div class="text-ellipsis typo h6-medium">
|
||||
<slot />
|
||||
</div>
|
||||
</a>
|
||||
@@ -39,27 +39,27 @@ defineProps<{
|
||||
.infra-item-label {
|
||||
display: flex;
|
||||
align-items: stretch;
|
||||
color: var(--color-grey-100);
|
||||
color: var(--color-neutral-txt-primary);
|
||||
border-radius: 0.8rem;
|
||||
background-color: var(--background-color-primary);
|
||||
background-color: var(--color-neutral-background-primary);
|
||||
|
||||
&:hover {
|
||||
color: var(--color-grey-100);
|
||||
background-color: var(--background-color-secondary);
|
||||
color: var(--color-neutral-txt-primary);
|
||||
background-color: var(--color-neutral-background-secondary);
|
||||
}
|
||||
|
||||
&:active,
|
||||
&.active {
|
||||
color: var(--color-purple-base);
|
||||
background-color: var(--background-color-primary);
|
||||
color: var(--color-normal-txt-base);
|
||||
background-color: var(--color-neutral-background-primary);
|
||||
}
|
||||
|
||||
&.exact-active {
|
||||
color: var(--color-grey-100);
|
||||
background-color: var(--background-color-purple-10);
|
||||
color: var(--color-neutral-txt-primary);
|
||||
background-color: var(--color-normal-background-selected);
|
||||
|
||||
.icon {
|
||||
color: var(--color-purple-base);
|
||||
color: var(--color-normal-txt-base);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -77,12 +77,6 @@ defineProps<{
|
||||
font-size: 2rem;
|
||||
}
|
||||
|
||||
.text {
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
@@ -23,11 +23,11 @@ defineProps<{
|
||||
display: flex;
|
||||
height: 6rem;
|
||||
margin-bottom: 0.2rem;
|
||||
background-color: var(--background-color-primary);
|
||||
background-color: var(--color-neutral-background-primary);
|
||||
}
|
||||
|
||||
.icon {
|
||||
color: var(--color-grey-100);
|
||||
color: var(--color-neutral-txt-primary);
|
||||
}
|
||||
|
||||
.link-placeholder {
|
||||
@@ -41,7 +41,7 @@ defineProps<{
|
||||
.loader {
|
||||
flex: 1;
|
||||
animation: pulse alternate 1s infinite;
|
||||
background-color: var(--background-color-purple-10);
|
||||
background-color: var(--color-normal-background-selected);
|
||||
}
|
||||
|
||||
@keyframes pulse {
|
||||
|
||||
@@ -1,11 +1,16 @@
|
||||
<template>
|
||||
<TreeList class="infra-pool-list">
|
||||
<TreeItem>
|
||||
<TreeItem :expanded="isExpanded">
|
||||
<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 } }">
|
||||
<TreeItemLabel
|
||||
v-else
|
||||
:icon="faCity"
|
||||
:route="{ name: 'pool.dashboard', params: { uuid: pool.uuid } }"
|
||||
@toggle="toggle()"
|
||||
>
|
||||
{{ pool.name_label || '(Pool)' }}
|
||||
</TreeItemLabel>
|
||||
<template #sublist>
|
||||
@@ -28,6 +33,9 @@ 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>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<TreeItem v-if="vm !== undefined" ref="rootElement" class="infra-vm-item">
|
||||
<TreeItem v-if="vm !== undefined" ref="rootElement" expanded class="infra-vm-item">
|
||||
<TreeItemLabel v-if="isVisible" :route="{ name: 'vm.console', params: { uuid: vm.uuid } }" no-indent>
|
||||
{{ vm.name_label || '(VM)' }}
|
||||
<template #icon>
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
</template>
|
||||
|
||||
<template #buttons>
|
||||
<UiButton level="tertiary" @click="addNewFilter()">
|
||||
<UiButton size="medium" color="normal" level="tertiary" @click="addNewFilter()">
|
||||
{{ $t('add-or') }}
|
||||
</UiButton>
|
||||
<ModalDeclineButton />
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
</template>
|
||||
|
||||
<template #buttons>
|
||||
<UiButton level="tertiary" @click="formatJson()">
|
||||
<UiButton size="medium" color="normal" level="tertiary" @click="formatJson()">
|
||||
{{ $t('reformat') }}
|
||||
</UiButton>
|
||||
<ModalDeclineButton />
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<UiCardTitle>
|
||||
{{ $t('alarms') }}
|
||||
<template v-if="isReady && alarms.length > 0" #right>
|
||||
<UiCounter :value="alarms.length" color="error" />
|
||||
<VtsCounter :value="alarms.length" accent="danger" variant="primary" size="small" />
|
||||
</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 @click="start">{{ $t('load-now') }}</UiButton>
|
||||
<UiButton size="medium" color="normal" level="primary" @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 UiCounter from '@core/components/UiCounter.vue'
|
||||
import VtsCounter from '@core/components/counter/VtsCounter.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-green-base);
|
||||
color: var(--color-success-txt-base);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -60,6 +60,8 @@ 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(() => {
|
||||
@@ -75,7 +77,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>
|
||||
|
||||
@@ -83,12 +85,12 @@ const hasError = computed(() => hostStoreHasError.value || vmStoreHasError.value
|
||||
.progress-item {
|
||||
margin-top: 2.6rem;
|
||||
--progress-bar-height: 1.2rem;
|
||||
--progress-bar-color: var(--color-purple-base);
|
||||
--progress-bar-background-color: var(--color-grey-500);
|
||||
--progress-bar-color: var(--color-normal-item-base);
|
||||
--progress-bar-background-color: var(--color-neutral-background-disabled);
|
||||
|
||||
&.warning {
|
||||
--progress-bar-color: var(--color-orange-base);
|
||||
--footer-value-color: var(--color-orange-base);
|
||||
--progress-bar-color: var(--color-warning-item-base);
|
||||
--footer-value-color: var(--color-warning-item-base);
|
||||
}
|
||||
|
||||
& .footer-value {
|
||||
|
||||
@@ -31,7 +31,7 @@ const { count, patches, areSomeLoaded, areAllLoaded } = useHostPatches(hosts)
|
||||
|
||||
<style lang="postcss" scoped>
|
||||
.patches-title {
|
||||
--section-title-right-color: var(--color-red-base);
|
||||
--section-title-right-color: var(--color-danger-txt-base);
|
||||
}
|
||||
|
||||
.table-container {
|
||||
|
||||
@@ -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-green-base);
|
||||
background-color: var(--color-success-item-base);
|
||||
|
||||
&.inactive {
|
||||
background-color: var(--color-grey-500);
|
||||
background-color: var(--color-neutral-background-disabled);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
<template>
|
||||
<tr>
|
||||
<th>
|
||||
<div v-tooltip="new Date(parseDateTime(alarm.timestamp)).toLocaleString()" class="ellipsis time">
|
||||
<div v-tooltip="new Date(parseDateTime(alarm.timestamp)).toLocaleString()" class="text-ellipsis time">
|
||||
<RelativeTime :date="alarm.timestamp" />
|
||||
</div>
|
||||
</th>
|
||||
<td>
|
||||
<div v-tooltip class="ellipsis description">
|
||||
<div v-tooltip class="text-ellipsis description">
|
||||
{{ $t(`alarm-type.${alarm.type}`, { n: alarm.triggerLevel * 100 }) }}
|
||||
</div>
|
||||
</td>
|
||||
@@ -36,17 +36,14 @@ defineProps<{
|
||||
</script>
|
||||
|
||||
<style lang="postcss" scoped>
|
||||
.ellipsis {
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
.level {
|
||||
color: var(--color-red-base);
|
||||
color: var(--color-danger-txt-base);
|
||||
}
|
||||
|
||||
.on {
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.object-link {
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ const hasTasks = computed(() => props.pendingTasks.length > 0 || (props.finished
|
||||
|
||||
.no-tasks {
|
||||
text-align: center;
|
||||
color: var(--color-grey-300);
|
||||
color: var(--color-neutral-txt-secondary);
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
@@ -65,11 +65,11 @@ td[colspan='5'] {
|
||||
}
|
||||
|
||||
.text-error {
|
||||
color: var(--color-red-base);
|
||||
color: var(--color-danger-txt-base);
|
||||
}
|
||||
|
||||
.loader {
|
||||
color: var(--color-purple-base);
|
||||
color: var(--color-normal-txt-base);
|
||||
display: block;
|
||||
font-size: 4rem;
|
||||
margin: 2rem auto 0;
|
||||
|
||||
@@ -40,12 +40,12 @@ const isDisplayed = computed(() => !isNaN(percentUsed.value) && !isNaN(percentFr
|
||||
.summary {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
color: var(--color-grey-300);
|
||||
color: var(--color-neutral-txt-secondary);
|
||||
margin-top: 2rem;
|
||||
}
|
||||
|
||||
.summary-card {
|
||||
color: var(--color-grey-200);
|
||||
color: var(--color-neutral-txt-secondary);
|
||||
display: flex;
|
||||
}
|
||||
|
||||
|
||||
@@ -46,24 +46,24 @@ const isDisabled = useContext(DisabledContext, () => props.disabled)
|
||||
border: none;
|
||||
border-radius: 0.8rem;
|
||||
gap: 1rem;
|
||||
background-color: var(--background-color-primary);
|
||||
background-color: var(--color-neutral-background-primary);
|
||||
|
||||
&.disabled {
|
||||
color: var(--color-grey-500);
|
||||
color: var(--color-neutral-border);
|
||||
}
|
||||
|
||||
&:not(.disabled) {
|
||||
color: var(--color-grey-200);
|
||||
color: var(--color-neutral-txt-secondary);
|
||||
|
||||
&:hover {
|
||||
background-color: var(--background-color-secondary);
|
||||
background-color: var(--color-neutral-background-secondary);
|
||||
}
|
||||
|
||||
&:active,
|
||||
&.active,
|
||||
&.busy {
|
||||
color: var(--color-purple-base);
|
||||
background-color: var(--background-color-purple-10);
|
||||
color: var(--color-normal-txt-base);
|
||||
background-color: var(--color-normal-background-selected);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,8 +22,8 @@ defineProps<{
|
||||
gap: 0.4rem;
|
||||
padding: 0 0.8rem;
|
||||
height: 1.8em;
|
||||
color: var(--color-grey-600);
|
||||
color: var(--color-neutral-txt-primary);
|
||||
border-radius: 9.6rem;
|
||||
background-color: var(--color-grey-300);
|
||||
background-color: var(--color-neutral-background-disabled);
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -34,6 +34,6 @@ const classProp = computed(() => {
|
||||
}
|
||||
|
||||
.bg-primary {
|
||||
background-color: var(--background-color-primary);
|
||||
background-color: var(--color-neutral-background-primary);
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
<style lang="postcss" scoped>
|
||||
.footer {
|
||||
color: var(--color-grey-200);
|
||||
color: var(--color-neutral-txt-secondary);
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ import UiSpinner from '@/components/ui/UiSpinner.vue'
|
||||
}
|
||||
|
||||
.spinner {
|
||||
color: var(--color-purple-base);
|
||||
color: var(--color-normal-txt-base);
|
||||
font-size: 4rem;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -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>
|
||||
<UiCounter v-if="count > 0" class="count" :value="count" color="info" />
|
||||
<VtsCounter v-if="count > 0" class="count" :value="count" accent="brand" variant="primary" size="small" />
|
||||
</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 UiCounter from '@core/components/UiCounter.vue'
|
||||
import VtsCounter from '@core/components/counter/VtsCounter.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-grey-100);
|
||||
--section-title-left-color: var(--color-neutral-txt-primary);
|
||||
--section-title-left-weight: 500;
|
||||
--section-title-right-size: 1.6rem;
|
||||
--section-title-right-color: var(--color-purple-base);
|
||||
--section-title-right-color: var(--color-normal-txt-base);
|
||||
--section-title-right-weight: 700;
|
||||
|
||||
&.h6 {
|
||||
margin-bottom: 1rem;
|
||||
--section-title-left-size: 1.5rem;
|
||||
--section-title-left-color: var(--color-grey-300);
|
||||
--section-title-left-color: var(--color-neutral-txt-secondary);
|
||||
--section-title-left-weight: 400;
|
||||
}
|
||||
|
||||
&.h5 {
|
||||
margin-top: 2rem;
|
||||
margin-bottom: 1rem;
|
||||
border-bottom: 1px solid var(--color-purple-base);
|
||||
border-bottom: 1px solid var(--color-normal-txt-base);
|
||||
--section-title-left-size: 1.6rem;
|
||||
--section-title-left-color: var(--color-purple-base);
|
||||
--section-title-left-color: var(--color-normal-txt-base);
|
||||
--section-title-left-weight: 700;
|
||||
--section-title-right-size: 1.4rem;
|
||||
--section-title-right-color: var(--color-purple-base);
|
||||
--section-title-right-color: var(--color-normal-txt-base);
|
||||
--section-title-right-weight: 400;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,11 +26,11 @@ const emit = defineEmits<{
|
||||
align-items: stretch;
|
||||
justify-content: center;
|
||||
height: 3.4rem;
|
||||
color: var(--color-purple-base);
|
||||
color: var(--color-normal-txt-base);
|
||||
border-radius: 1.7rem;
|
||||
background-color: var(--background-color-purple-10);
|
||||
background-color: var(--color-normal-background-selected);
|
||||
gap: 1rem;
|
||||
border: 1px solid var(--color-purple-base);
|
||||
border: 1px solid var(--color-normal-txt-base);
|
||||
}
|
||||
|
||||
.label,
|
||||
@@ -54,10 +54,10 @@ const emit = defineEmits<{
|
||||
border-radius: 1.4rem;
|
||||
width: 2.8rem;
|
||||
margin: 0.2rem;
|
||||
background-color: var(--color-purple-l40);
|
||||
background-color: var(--color-normal-item-active);
|
||||
|
||||
&:hover {
|
||||
background-color: var(--color-red-l20);
|
||||
background-color: var(----color-danger-item-hover);
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 1rem;
|
||||
background-color: var(--background-color-primary);
|
||||
background-color: var(--color-neutral-background-primary);
|
||||
gap: 1rem;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
.key {
|
||||
padding-right: 2rem;
|
||||
text-align: left;
|
||||
color: var(--color-grey-300);
|
||||
color: var(--color-neutral-txt-secondary);
|
||||
|
||||
@media (--desktop) {
|
||||
min-width: 20rem;
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
<style lang="postcss" scoped>
|
||||
.ui-raw {
|
||||
background-color: var(--color-grey-500);
|
||||
background-color: var(--color-neutral-border);
|
||||
text-align: left;
|
||||
overflow: auto;
|
||||
max-width: 100%;
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<style lang="postcss" scoped>
|
||||
.ui-separator {
|
||||
border: none;
|
||||
border-top: 1px solid var(--color-grey-500);
|
||||
border-top: 1px solid var(--color-neutral-border);
|
||||
margin: 2rem 0;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -24,7 +24,7 @@ defineProps<{
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
color: var(--color-purple-base);
|
||||
color: var(--color-normal-txt-base);
|
||||
}
|
||||
|
||||
.title {
|
||||
|
||||
@@ -15,14 +15,14 @@ defineProps<{
|
||||
.ui-table {
|
||||
width: 100%;
|
||||
border-spacing: 0;
|
||||
background-color: var(--background-color-primary);
|
||||
background-color: var(--color-neutral-background-primary);
|
||||
line-height: 2.4rem;
|
||||
color: var(--color-grey-200);
|
||||
color: var(--color-neutral-txt-secondary);
|
||||
|
||||
:deep(th),
|
||||
:deep(td) {
|
||||
padding: 1rem;
|
||||
border-top: 1px solid var(--color-grey-500);
|
||||
border-top: 1px solid var(--color-neutral-border);
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ defineProps<{
|
||||
:deep(thead) {
|
||||
th,
|
||||
td {
|
||||
color: var(--color-purple-base);
|
||||
color: var(--color-normal-txt-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-grey-500);
|
||||
border-right: 1px solid var(--color-neutral-border);
|
||||
|
||||
&:last-child {
|
||||
border-right: none;
|
||||
@@ -53,6 +53,6 @@ defineProps<{
|
||||
}
|
||||
|
||||
.error {
|
||||
background-color: var(--background-color-red-10);
|
||||
background-color: var(--color-danger-background-selected);
|
||||
}
|
||||
</style>
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user