Compare commits

..

1 Commits

Author SHA1 Message Date
Florent BEAUCHAMP
a5e34e55d8 fix(xo-web): sanitize-html dependency
Since 2.17.6, sanitize-html depends on htmlparser2 ^12, which is
ESM-only. Browserify cannot bundle it and the build fails with:

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

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

Pin the exact version until xo-web's bundler can handle ESM-only
dependencies.
2026-11-25 03:49:45 -05:00
39 changed files with 127 additions and 477 deletions

View File

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

View File

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

View File

@@ -472,7 +472,6 @@ export type XoApp = EventEmitter & {
getPlugin(id: XoPlugin['id']): Promise<XoPlugin>
getPlugins(): Promise<XoPlugin[]>
getProxy(id: XoProxy['id']): Promise<XoProxy>
getProxyApplianceUpdaterState(id: XoProxy['id']): Promise<{ level: string; message: string; state: string }>
getRemote(id: XoBackupRepository['id']): Promise<XoBackupRepository>
getAllRemotes(): Promise<XoBackupRepository[]>
removeRemote(id: XoBackupRepository['id']): Promise<void>

View File

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

View File

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

View File

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

View File

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

View File

@@ -37,38 +37,12 @@ function getBranchName() {
}
}
function getCommitHash() {
try {
return execSync('git rev-parse --short HEAD', { encoding: 'utf8', cwd: ROOT }).trim()
} catch {
return 'unknown'
}
}
function formatDatetime(date) {
// "19/11/2026 13:43 (Paris)"
return `${date.toLocaleString('fr-FR', {
timeZone: 'Europe/Paris',
dateStyle: 'short',
timeStyle: 'short',
})} (Paris)`
}
function formatDuration(ms) {
const hours = Math.floor(ms / 3600000)
const minutes = Math.floor((ms / 60000) % 60)
.toString()
.padStart(2, '0')
return `${hours}h${minutes}`
}
function getCount(output, label) {
const match = output.match(new RegExp(`ℹ ${label} (\\d+)`))
if (match === null) {
return '?'
} else {
return match[1]
}
// "2026-05-20 08:42 UTC"
return date
.toISOString()
.replace('T', ' ')
.replace(/:\d{2}\.\d+Z$/, ' UTC')
}
// ---------------------------------------------------------------------------
@@ -149,27 +123,14 @@ if (process.argv.includes('--smtp-test')) {
// ---------------------------------------------------------------------------
const branch = getBranchName()
const commitHash = getCommitHash()
const startedAt = new Date()
process.stderr.write(`[run-and-report] branch=${branch}\n`)
const { success, output, logFilePath } = await runTests()
const runtimeInMs = Date.now() - startedAt.getTime()
const emoji = success ? '✅' : '❌'
const status = success ? 'success' : 'failure'
const successTests = getCount(output, 'pass')
const totalTests = getCount(output, 'tests')
const failedTests = getCount(output, 'fail')
const cancelledTests = getCount(output, 'cancelled')
const skippedTests = getCount(output, 'skipped')
const subject = `${emoji} ${status} ${successTests}/${totalTests} passed ${formatDatetime(startedAt)} on ${branch}@${commitHash}`
const summary = `Result: ${emoji} ${status}
Commit: ${branch}@${commitHash}
Tests: ${successTests}/${totalTests} passed, ${failedTests} failed, ${cancelledTests} cancelled, ${skippedTests} skipped
Duration: ${formatDuration(runtimeInMs)}`
const subject = `test run ${formatDatetime(startedAt)} ${branch} ${status}`
// Attach the full structured debug log if we found its path
const attachments = []
@@ -188,9 +149,7 @@ await transport.sendMail({
from: process.env.SMTP_FROM ?? process.env.SMTP_USER,
to: process.env.SMTP_TO,
subject,
text: `${summary}
----------------------------------------
${output}`,
text: output,
attachments,
})

View File

@@ -27,9 +27,3 @@ export const proxy = {
}
export const proxyHealth = { success: true }
export const proxyApplianceUpdaterState = {
level: 'info',
message: 'All up to date',
state: 'xoa-up-to-date',
}

View File

@@ -15,7 +15,7 @@ import {
import { inject } from 'inversify'
import { provide } from 'inversify-binding-decorators'
import type { Request as ExRequest } from 'express'
import type { XoApp, XoProxy } from '@vates/types'
import type { XoProxy } from '@vates/types'
import { acl } from '../middlewares/acl.middleware.mjs'
import { ApiError } from '../helpers/error.helper.mjs'
@@ -28,13 +28,7 @@ import {
unauthorizedResp,
type Unbrand,
} from '../open-api/common/response.common.mjs'
import {
partialProxies,
proxy,
proxyHealth,
proxyIds,
proxyApplianceUpdaterState,
} from '../open-api/oa-examples/proxy.oa-example.mjs'
import { partialProxies, proxy, proxyHealth, proxyIds } from '../open-api/oa-examples/proxy.oa-example.mjs'
import type { SendObjects } from '../helpers/helper.type.mjs'
import { XoController } from '../abstract-classes/xo-controller.mjs'
import { RestApi } from '../rest-api/rest-api.mjs'
@@ -152,35 +146,4 @@ export class ProxyController extends XoController<XoProxy> {
return { success: true }
}
/**
* Returns the state of the proxy appliance updater (e.g. `xoa-up-to-date`, or a state ending with `-upgrade-needed`)
*
* Before reading the state, sets the updater channel to the one expected by Xen Orchestra.
* A successful result is cached for 60 seconds per proxy, errors are not cached.
*
* Required privilege:
* - resource: proxy, action: read
*
* @example id "e625ea0c-a876-405a-b838-109d762efe88"
*/
@Example(proxyApplianceUpdaterState)
@Extension('x-mcp-exposure', 'allow')
@Get('{id}/appliance_updater_state')
@Middlewares(
acl({
resource: 'proxy',
action: 'read',
objectId: 'params.id',
getObject: ({ restApi }) => restApi.xoApp.getProxy,
})
)
@SuccessResponse(200, 'OK')
@Response(forbiddenOperationResp.status, forbiddenOperationResp.description)
@Response(notFoundResp.status, notFoundResp.description)
@Response(internalServerErrorResp.status, internalServerErrorResp.description)
@Response(proxyUnreachableResp.status, proxyUnreachableResp.description)
getProxyApplianceUpdaterState(@Path() id: string): ReturnType<XoApp['getProxyApplianceUpdaterState']> {
return callProxy(this.restApi.xoApp.getProxyApplianceUpdaterState(id as XoProxy['id']))
}
}

View File

@@ -5,65 +5,47 @@ import { ApiError } from '../helpers/error.helper.mjs'
import { ProxyController } from './proxy.controller.mjs'
import type { RestApi } from '../rest-api/rest-api.mjs'
const proxyId = 'e625ea0c-a876-405a-b838-109d762efe88'
const updaterState = { level: 'info', message: 'xoa is up to date', state: 'xoa-up-to-date' }
const unreachableErrors = [
Object.assign(new TypeError('fetch failed'), { code: 'PROXY_UNREACHABLE' }),
Object.assign(new Error('cannot get the proxy address'), { code: 'PROXY_UNREACHABLE' }),
]
function createController(result: () => Promise<unknown>) {
function createController(checkProxyHealth: (id: string) => Promise<void>) {
const calls: unknown[] = []
const record =
(method: string) =>
async (...args: unknown[]) => {
calls.push([method, ...args])
return result()
}
const restApi = {
xoApp: {
checkProxyHealth: record('checkProxyHealth'),
getProxyApplianceUpdaterState: record('getProxyApplianceUpdaterState'),
checkProxyHealth: async (id: string) => {
calls.push(['checkProxyHealth', id])
return checkProxyHealth(id)
},
},
} as unknown as RestApi
const controller = new ProxyController(restApi)
return { calls, controller }
}
for (const [method, xoAppMethod, xoAppResult, expected] of [
['getProxyHealth', 'checkProxyHealth', undefined, { success: true }],
['getProxyApplianceUpdaterState', 'getProxyApplianceUpdaterState', updaterState, updaterState],
] as const) {
describe(`ProxyController.${method}`, () => {
it(`forwards the id to ${xoAppMethod} and returns the result`, async () => {
const { calls, controller } = createController(async () => xoAppResult)
const proxyId = 'e625ea0c-a876-405a-b838-109d762efe88'
assert.deepEqual(await controller[method](proxyId), expected)
assert.deepEqual(calls, [[xoAppMethod, proxyId]])
})
describe('ProxyController.getProxyHealth', () => {
it('forwards the id and returns success when the proxy is reachable', async () => {
const { calls, controller } = createController(async () => {})
for (const unreachableError of unreachableErrors) {
it(`throws a 502 ApiError on "${unreachableError.message}"`, async () => {
const { controller } = createController(async () => {
throw unreachableError
})
await assert.rejects(
controller[method](proxyId),
error => error instanceof ApiError && error.status === 502 && error.message === 'Proxy unreachable'
)
})
}
it('rethrows unrelated errors unchanged', async () => {
const unrelatedError = new Error('401 Unauthorized')
const { controller } = createController(async () => {
throw unrelatedError
})
await assert.rejects(controller[method](proxyId), error => error === unrelatedError)
})
assert.deepEqual(await controller.getProxyHealth(proxyId), { success: true })
assert.deepEqual(calls, [['checkProxyHealth', proxyId]])
})
}
it('throws a 502 ApiError when the proxy is unreachable', async () => {
const { controller } = createController(async () => {
throw Object.assign(new TypeError('fetch failed'), { code: 'PROXY_UNREACHABLE' })
})
await assert.rejects(
controller.getProxyHealth(proxyId),
error => error instanceof ApiError && error.status === 502 && error.message === 'Proxy unreachable'
)
})
it('rethrows unrelated errors unchanged', async () => {
const unrelatedError = new Error('500 Internal Server Error')
const { controller } = createController(async () => {
throw unrelatedError
})
await assert.rejects(controller.getProxyHealth(proxyId), error => error === unrelatedError)
})
})

View File

@@ -1,4 +1,6 @@
:root {
--color-logo: #282467;
/* NEUTRALS */
--color-neutral-txt-primary: #1a1b38;
@@ -29,7 +31,6 @@
--color-brand-item-hover: color-mix(in srgb, #ffffff 20%, var(--color-brand-item-base));
--color-brand-item-active: color-mix(in srgb, #ffffff 40%, var(--color-brand-item-base));
--color-brand-item-disabled: #d2ceff;
--color-brand-data: #8a80ff;
/* INFO */
@@ -46,7 +47,6 @@
--color-info-item-hover: color-mix(in srgb, #ffffff 20%, var(--color-info-item-base));
--color-info-item-active: color-mix(in srgb, #ffffff 40%, var(--color-info-item-base));
--color-info-item-disabled: #abdafa;
--color-info-data: #1498f0;
/* SUCCESS */
@@ -63,7 +63,6 @@
--color-success-item-hover: color-mix(in srgb, #ffffff 20%, var(--color-success-item-base));
--color-success-item-active: color-mix(in srgb, #ffffff 40%, var(--color-success-item-base));
--color-success-item-disabled: #abdcc9;
--color-success-data: #2ca577;
/* WARNING */
@@ -80,7 +79,6 @@
--color-warning-item-hover: color-mix(in srgb, #ffffff 20%, var(--color-warning-item-base));
--color-warning-item-active: color-mix(in srgb, #ffffff 40%, var(--color-warning-item-base));
--color-warning-item-disabled: #f9cca3;
--color-warning-data: #e07410;
/* DANGER */
@@ -88,20 +86,20 @@
--color-danger-txt-hover: color-mix(in srgb, #000000 20%, var(--color-danger-txt-base));
--color-danger-txt-active: color-mix(in srgb, #000000 40%, var(--color-danger-txt-base));
--color-danger-background-base: #e73642;
--color-danger-background-selected: color-mix(in srgb, #ffffff 90%, var(--color-danger-background-base));
--color-danger-background-hover: color-mix(in srgb, #ffffff 80%, var(--color-danger-background-base));
--color-danger-background-active: color-mix(in srgb, #ffffff 70%, var(--color-danger-background-base));
--color-danger-background-selected: color-mix(in srgb, #ffffff 90%, var(--color-danger-item-base));
--color-danger-background-hover: color-mix(in srgb, #ffffff 80%, var(--color-danger-item-base));
--color-danger-background-active: color-mix(in srgb, #ffffff 70%, var(--color-danger-item-base));
--color-danger-txt-item: #fff0f1;
--color-danger-item-base: #be1621;
--color-danger-item-hover: color-mix(in srgb, #000000 20%, var(--color-danger-item-base));
--color-danger-item-active: color-mix(in srgb, #000000 40%, var(--color-danger-item-base));
--color-danger-item-disabled: #e5a2a6;
--color-danger-data: #be1621;
}
:root.dark {
--color-logo: #e5e5e7;
/* NEUTRALS */
--color-neutral-txt-primary: #f8f8f8;
@@ -132,7 +130,6 @@
--color-brand-item-hover: color-mix(in srgb, #ffffff 20%, var(--color-brand-item-base));
--color-brand-item-active: color-mix(in srgb, #ffffff 40%, var(--color-brand-item-base));
--color-brand-item-disabled: #393566;
--color-brand-data: #8f84ff;
/* INFO */
@@ -149,7 +146,6 @@
--color-info-item-hover: color-mix(in srgb, #ffffff 20%, var(--color-info-item-base));
--color-info-item-active: color-mix(in srgb, #ffffff 40%, var(--color-info-item-base));
--color-info-item-disabled: #124161;
--color-info-data: #2ca3f2;
/* SUCCESS */
@@ -157,16 +153,15 @@
--color-success-txt-hover: color-mix(in srgb, #ffffff 20%, var(--color-success-txt-base));
--color-success-txt-active: color-mix(in srgb, #ffffff 40%, var(--color-success-txt-base));
--color-success-background-selected: color-mix(in srgb, #000000 70%, var(--color-success-item-base));
--color-success-background-hover: color-mix(in srgb, #000000 60%, var(--color-success-item-base));
--color-success-background-active: color-mix(in srgb, #000000 50%, var(--color-success-item-base));
--color-success-background-selected: color-mix(in srgb, #000000 70%, var(--color-success-txt-base));
--color-success-background-hover: color-mix(in srgb, #000000 60%, var(--color-success-txt-base));
--color-success-background-active: color-mix(in srgb, #000000 50%, var(--color-success-txt-base));
--color-success-txt-item: #092017;
--color-success-item-base: #2ca878;
--color-success-item-hover: color-mix(in srgb, #ffffff 20%, var(--color-success-item-base));
--color-success-item-active: color-mix(in srgb, #ffffff 40%, var(--color-success-item-base));
--color-success-item-disabled: #124330;
--color-success-data: #2ca878;
/* WARNING */
@@ -174,16 +169,15 @@
--color-warning-txt-hover: color-mix(in srgb, #ffffff 20%, var(--color-warning-txt-base));
--color-warning-txt-active: color-mix(in srgb, #ffffff 40%, var(--color-warning-txt-base));
--color-warning-background-selected: color-mix(in srgb, #000000 70%, var(--color-warning-item-base));
--color-warning-background-hover: color-mix(in srgb, #000000 60%, var(--color-warning-item-base));
--color-warning-background-active: color-mix(in srgb, #000000 50%, var(--color-warning-item-base));
--color-warning-background-selected: color-mix(in srgb, #000000 70%, var(--color-warning-txt-base));
--color-warning-background-hover: color-mix(in srgb, #000000 60%, var(--color-warning-txt-base));
--color-warning-background-active: color-mix(in srgb, #000000 50%, var(--color-warning-txt-base));
--color-warning-txt-item: #261403;
--color-warning-item-base: #ef7f18;
--color-warning-item-hover: color-mix(in srgb, #ffffff 20%, var(--color-warning-item-base));
--color-warning-item-active: color-mix(in srgb, #ffffff 40%, var(--color-warning-item-base));
--color-warning-item-disabled: #60330a;
--color-warning-data: #ef7f18;
/* DANGER */
@@ -191,15 +185,13 @@
--color-danger-txt-hover: color-mix(in srgb, #ffffff 20%, var(--color-danger-txt-base));
--color-danger-txt-active: color-mix(in srgb, #ffffff 40%, var(--color-danger-txt-base));
--color-danger-background-base: #e73642;
--color-danger-background-selected: color-mix(in srgb, #000000 70%, var(--color-danger-background-base));
--color-danger-background-hover: color-mix(in srgb, #000000 60%, var(--color-danger-background-base));
--color-danger-background-active: color-mix(in srgb, #000000 50%, var(--color-danger-background-base));
--color-danger-background-selected: color-mix(in srgb, #000000 70%, var(--color-danger-txt-base));
--color-danger-background-hover: color-mix(in srgb, #000000 60%, var(--color-danger-txt-base));
--color-danger-background-active: color-mix(in srgb, #000000 50%, var(--color-danger-txt-base));
--color-danger-txt-item: #fff0f1;
--color-danger-item-base: #be1621;
--color-danger-item-hover: color-mix(in srgb, #000000 20%, var(--color-danger-item-base));
--color-danger-item-active: color-mix(in srgb, #000000 40%, var(--color-danger-item-base));
--color-danger-item-disabled: #4c090d;
--color-danger-data: #c41723;
}

View File

@@ -3,15 +3,6 @@
* Default theme is defined in web-core/_colors.pcss
*/
/* Data colors are tuned for the default theme only: themed charts keep each theme's own accent colors */
:root:is(.theme-nord, .theme-solarized, .theme-dracula, .theme-monokai) {
--color-brand-data: var(--color-brand-item-base);
--color-info-data: var(--color-info-item-base);
--color-success-data: var(--color-success-item-base);
--color-warning-data: var(--color-warning-item-base);
--color-danger-data: var(--color-danger-item-base);
}
/*
* Nord Theme - Light Mode
* An arctic, north-bluish color palette
@@ -23,6 +14,8 @@
* Aurora: #bf616a (red), #d08770 (orange), #ebcb8b (yellow), #a3be8c (green), #b48ead (purple)
*/
:root.theme-nord {
--color-logo: #5e81ac;
/* NEUTRALS */
--color-neutral-txt-primary: #2e3440;
--color-neutral-txt-secondary: #4c566a;
@@ -116,6 +109,8 @@
* Nord Theme - Dark Mode
*/
:root.dark.theme-nord {
--color-logo: #88c0d0;
/* NEUTRALS */
--color-neutral-txt-primary: #eceff4;
--color-neutral-txt-secondary: #d8dee9;
@@ -215,6 +210,8 @@
* violet #6c71c4, blue #268bd2, cyan #2aa198, green #859900
*/
:root.theme-solarized {
--color-logo: #268bd2;
/* NEUTRALS */
--color-neutral-txt-primary: #657b83;
--color-neutral-txt-secondary: #93a1a1;
@@ -308,6 +305,8 @@
* Solarized Theme - Dark Mode
*/
:root.dark.theme-solarized {
--color-logo: #268bd2;
/* NEUTRALS */
--color-neutral-txt-primary: #839496;
--color-neutral-txt-secondary: #586e75;
@@ -407,6 +406,8 @@
* Purple: #bd93f9, Red: #ff5555, Yellow: #f1fa8c
*/
:root.theme-dracula {
--color-logo: #bd93f9;
/* NEUTRALS */
--color-neutral-txt-primary: #282a36;
--color-neutral-txt-secondary: #44475a;
@@ -500,6 +501,8 @@
* Dracula Theme - Dark Mode
*/
:root.dark.theme-dracula {
--color-logo: #bd93f9;
/* NEUTRALS */
--color-neutral-txt-primary: #f8f8f2;
--color-neutral-txt-secondary: #6272a4;
@@ -598,6 +601,8 @@
* Pink: #f92672, Green: #a6e22e, Blue: #66d9ef, Orange: #fd971f, Purple: #ae81ff
*/
:root.theme-monokai {
--color-logo: #f92672;
/* NEUTRALS */
--color-neutral-txt-primary: #272822;
--color-neutral-txt-secondary: #75715e;
@@ -691,6 +696,8 @@
* Monokai Theme - Dark Mode
*/
:root.dark.theme-monokai {
--color-logo: #f92672;
/* NEUTRALS */
--color-neutral-txt-primary: #f8f8f2;
--color-neutral-txt-secondary: #a8a8a0;

View File

@@ -117,7 +117,7 @@ const className = computed(() => [
color: var(--color-brand-item-base);
.fill {
stroke: var(--color-brand-data);
stroke: var(--color-brand-item-base);
}
.background {
@@ -129,7 +129,7 @@ const className = computed(() => [
color: var(--color-info-item-base);
.fill {
stroke: var(--color-info-data);
stroke: var(--color-info-item-base);
}
.background {
@@ -137,7 +137,7 @@ const className = computed(() => [
}
.success {
stroke: var(--color-success-data);
stroke: var(--color-success-item-base);
}
.icon {
@@ -149,7 +149,7 @@ const className = computed(() => [
color: var(--color-warning-item-base);
.fill {
stroke: var(--color-warning-data);
stroke: var(--color-warning-item-base);
}
.background {
@@ -161,7 +161,7 @@ const className = computed(() => [
color: var(--color-danger-item-base);
.fill {
stroke: var(--color-danger-data);
stroke: var(--color-danger-item-base);
}
.background {

View File

@@ -80,7 +80,7 @@ const computedSegments = computed(() => {
fill: transparent;
&.accent--info {
stroke: var(--color-info-data);
stroke: var(--color-info-item-base);
}
&.accent--secondary {
@@ -88,15 +88,15 @@ const computedSegments = computed(() => {
}
&.accent--success {
stroke: var(--color-success-data);
stroke: var(--color-success-item-base);
}
&.accent--warning {
stroke: var(--color-warning-data);
stroke: var(--color-warning-item-base);
}
&.accent--danger {
stroke: var(--color-danger-data);
stroke: var(--color-danger-item-base);
}
&.accent--muted {

View File

@@ -72,7 +72,7 @@ const classNames = computed(() => toVariants({ accent }))
&.accent--info {
.circle-icon {
color: var(--color-info-data);
color: var(--color-info-item-base);
}
}
@@ -84,19 +84,19 @@ const classNames = computed(() => toVariants({ accent }))
&.accent--success {
.circle-icon {
color: var(--color-success-data);
color: var(--color-success-item-base);
}
}
&.accent--warning {
.circle-icon {
color: var(--color-warning-data);
color: var(--color-warning-item-base);
}
}
&.accent--danger {
.circle-icon {
color: var(--color-danger-data);
color: var(--color-danger-item-base);
}
}

View File

@@ -57,19 +57,19 @@ const className = computed(() => toVariants({ accent }))
/* ACCENT */
&.accent--info {
.fill {
background-color: var(--color-info-data);
background-color: var(--color-info-item-base);
}
}
&.accent--warning {
.fill {
background-color: var(--color-warning-data);
background-color: var(--color-warning-item-base);
}
}
&.accent--danger {
.fill {
background-color: var(--color-danger-data);
background-color: var(--color-danger-item-base);
}
}
}

View File

@@ -54,19 +54,19 @@ useResizeObserver(ellipsisElement, ([entry]) => {
/* ACCENT VARIANTS */
&.accent--info {
background-color: var(--color-info-data);
background-color: var(--color-info-item-base);
}
&.accent--success {
background-color: var(--color-success-data);
background-color: var(--color-success-item-base);
}
&.accent--warning {
background-color: var(--color-warning-data);
background-color: var(--color-warning-item-base);
}
&.accent--danger {
background-color: var(--color-danger-data);
background-color: var(--color-danger-item-base);
}
}
</style>

View File

@@ -12,8 +12,8 @@ export const useChartTheme = (pinia?: Pinia) => {
background: style.getPropertyValue('--color-neutral-background-primary'),
text: style.getPropertyValue('--color-neutral-txt-secondary'),
splitLine: style.getPropertyValue('--color-neutral-border'),
primary: style.getPropertyValue('--color-brand-data'),
secondary: style.getPropertyValue('--color-warning-data'),
primary: style.getPropertyValue('--color-brand-item-base'),
secondary: style.getPropertyValue('--color-warning-item-base'),
})
const colors = ref(getColors())

View File

@@ -9,18 +9,10 @@
> Users must be able to say: "Nice enhancement, I'm eager to test it"
- [REST API] Get the state of a proxy appliance updater: `GET /rest/v0/proxies/:id/appliance_updater_state` (PR [#10773](https://github.com/vatesfr/xen-orchestra/pull/10773))
### Bug fixes
> Users must be able to say: "I had this issue, happy to know it's fixed"
- [Light theme] Danger backgrounds (selected, hover and active) use the lighter red tints of the design system (PR [#10891](https://github.com/vatesfr/xen-orchestra/pull/10891))
- [Dark mode] Selected, hovered and pressed backgrounds of danger elements (buttons, tags, chips, toasters…) are darker, as designed, so their text is easier to read (PR [#10888](https://github.com/vatesfr/xen-orchestra/pull/10888))
- [Backups/Merge] The background merge no longer crashes with `ENAMETOOLONG` when a VM's backups are locked by another job: it waits 5 minutes before trying again instead of retrying in a loop (PR [#10866](https://github.com/vatesfr/xen-orchestra/pull/10866))
- [V2V] When the import of a disk fails before its transfer starts, the task shows the reason given by the migration engine (e.g. `could not connect: timed out`) instead of `stream has ended without data, was looking for 8 bytes` (PR [#10842](https://github.com/vatesfr/xen-orchestra/pull/10842))
- [XO6] A VM converted into a template no longer stays in the VM list and treeview, contribution by [@pcbeingused333](https://github.com/pcbeingused333), fixes issue [#10717](https://github.com/vatesfr/xen-orchestra/issues/10717) (PR [#10884](https://github.com/vatesfr/xen-orchestra/pull/10884))
### Packages to release
> When modifying a package, add it here with its release type.
@@ -37,13 +29,4 @@
<!--packages-start-->
- @vates/nbd-client patch
- @vates/types minor
- @xen-orchestra/backups patch
- @xen-orchestra/rest-api minor
- @xen-orchestra/web patch
- @xen-orchestra/web-core patch
- xo-collection patch
- xo-server patch
<!--packages-end-->

View File

@@ -569,7 +569,7 @@ XCP-ng is a type 1 hypervisor, similar to VMware ESXi.
You can migrate your VM from VMware vSphere to a Vates environment (Xen Orchestra and XCP-ng), directly from Xen Orchestra. For this, we use V2V ("VMware to Vates").
Since XO 6.11, the migration is driven from XO 6, in **Administration → V2V → Migrate VMs**. To know more on using V2V in Xen Orchestra to migrate your environment from VMware, refer to the [VMware migration (V2V) guide](../migrate-from-vmware/v2v-migration-guide.md).
To know more on using V2V in Xen Orchestra to migrate your environment from VMware, refer to the [XO V2V section in the XCP-ng documentation](https://docs.xcp-ng.org/installation/migrate-to-xcp-ng/#xo-v2v).
## Hosts management

View File

@@ -3,13 +3,13 @@ sidebar_label: VMware migration (V2V)
sidebar_position: 1
---
# VMware migration (V2V) — NEW
# VMware migration (V2V)
## Introduction {#-introduction}
Xen Orchestra 5.110 introduced a new migration backend for moving virtual machines from VMware to XCP-ng (V2V). It replaces the old NFS-based method with `vectura`, a standalone reader of VMware's NFC protocol, delivering better performance and reliability without any VMware-provided library.
The whole process is driven from Xen Orchestra, in **Administration → V2V → Migrate VMs**. XO connects to your vCenter or ESXi host, reads the VM disks directly, and imports them into an XCP-ng storage repository:
The whole process is driven from Xen Orchestra, in **Import → VM → From VMware**. XO connects to your vCenter or ESXi host, reads the VM disks directly, and imports them into an XCP-ng storage repository:
<Schema label="XO reads the VM disks from ESXi through vectura, and imports them into an XCP-ng pool. The source VM keeps running during most of the transfer" legend={[["#5ac8c8", "VMware"], ["#8e83fe", "XCP-ng"], ["#6aabf0", "XO"]]} maxWidth="640px">
<svg viewBox="0 0 640 240" role="img" aria-label="A VM running on an ESXi host inside a VMware infrastructure is exported by Xen Orchestra using vectura, then imported into an XCP-ng host in the destination pool, where the migrated VM is ready to boot; the source VM keeps running during the warm phase of the transfer">
@@ -46,7 +46,6 @@ This guide walks you through the entire migration process:
- Preparing your Xen Orchestra environment
- Preparing your VMware environment
- Running the migration wizard
- Running a test migration
- Executing the final cutover
- Preparing the guest to boot on XCP-ng with the [Autopilot docking](#-autopilot-docking)
@@ -54,7 +53,7 @@ This guide walks you through the entire migration process:
You will also find troubleshooting advice and best practices to maximize speed and minimize downtime.
:::note
Since XO 6.11, the V2V import is available in the XO 6 interface, in **Administration → V2V → Migrate VMs**. This guide describes the XO 6 interface. The XO 5 import form remains available: see [Using XO 5 (legacy)](#-using-xo-5).
The V2V import is currently available in the XO 5 interface. The new XO 6 web UI does not expose it yet: even if you use XO 6 daily, switch to the XO 5 interface for the migration itself.
:::
## Benefits {#-benefits}
@@ -81,8 +80,6 @@ Additionally, UEFI VMs are no longer forced into Secure Boot mode, which resolve
Recent releases keep improving the workflow: since XO 6.6, a CD-ROM drive present on the source is recreated on the destination VM, and a two-step transfer (a first warm pass followed by a final run) tells you upfront whether the next run will be a full or a delta transfer.
Since XO 6.11, the XO 6 interface brings a migration wizard: you can migrate several VMs at once, choose a storage repository for each disk and a network for each network adapter, and resume a partial import from its last sync. Migration lists are saved in your browser, one per source and destination pool.
#### Performance gains
Performance gains can be significant, though results depend on the environment:
@@ -97,9 +94,7 @@ Performance gains can be significant, though results depend on the environment:
Make sure your Xen Orchestra instance is up to date. The import page includes an automatic check that verifies that `vectura`, shipped with your Xen Orchestra, runs on this system. Errors must be resolved before the migration can start.
<UiDetail src="/img/xo6/v2v-prerequisite-check.png" alt="The prerequisite check on the Source step of the migration wizard, showing the status of vectura" width={340} />
<UiDetail src="/img/xo5/v2v-prerequisite-check.png" alt="The prerequisite check on the XO 5 import page, showing the status of vectura" width={232} />
<UiDetail src="/img/xo5/v2v-prerequisite-check.png" alt="The prerequisite check on the import page, showing the status of vectura" width={232} />
### Dependencies
@@ -108,7 +103,15 @@ is shipped with Xen Orchestra and runs from there: there is nothing to install,
from VMware or Broadcom, and nothing to compile. It needs a Linux x86-64 system with glibc 2.31 or
later, such as Debian 11 or Ubuntu 20.04.
Go to **Administration → V2V → Migrate VMs**. The prerequisite check is shown at the top of the **Connect a new VMware source** card. Until it passes, VMs cannot be migrated.
Go to the **Import → VM → From VMware** section. Once the check passes, a **transfer form** appears:
<UiDetail src="/img/xo5/v2v-transfer-form.png" alt="The transfer form used to connect to VMware and import a VM into Xen Orchestra" width={620} />
:::warning
Filling in this form and clicking the **Connect** button will start the VM import. Make sure your VMware environment is ready first!
Read [Preparing the VMware environment](#-preparing-the-vmware-environment) to know more.
:::
## Preparing the VMware environment {#-preparing-the-vmware-environment}
@@ -145,7 +148,7 @@ A snapshot taken before CBT was enabled cannot be used to compute a delta. Remov
Keep the VMware Tools (or open-vm-tools) installed and running on the source VMs. XO uses them to:
- shut the guest down cleanly when the **Stop the source VM** option is enabled, instead of powering it off;
- shut the guest down cleanly when the `Stop source` option is enabled, instead of powering it off;
- read the IP addresses of each network card, which the [Autopilot docking](#-autopilot-docking) needs for Windows VMs with several network cards in static addressing.
With the Autopilot docking, there is no need to remove the VMware Tools before the migration: the docking disables them on the migrated VM.
@@ -185,7 +188,7 @@ Here is the "surefire method" to prepare your VMware environment.
It involves a lot of manual steps, but it lets you detect and fix issues without impacting production.
:::tip
There is also a "fire-and-forget" approach: launch the migration with the **Stop the source VM** option enabled, then start the VM once the migration is complete.
There is also a "fire-and-forget" approach: launch the migration with the `Stop source` option enabled, then start the VM once the migration is complete.
This method is only recommended for non-critical VMs, and only after the first few migrations have gone smoothly.
:::
@@ -212,115 +215,6 @@ Without the Autopilot docking, take another snapshot named `vm without tools`.
This snapshot captures the state of the VM without VMware-specific components, and will be used for the initial migration.
## Running the migration wizard {#-running-the-migration-wizard}
The wizard has five steps: **Source**, **Destination**, **VMs**, **Mapping** and **Review**. Only administrators can migrate VMs.
### Source
Fill in the **Connect a new VMware source** form with the address of your vCenter or ESXi host (**Host** and **Port**, 443 by default), your VMware **Username** and **Password**, then click **Connect**.
<UiShot light="/img/xo6/v2v-source-light.png" dark="/img/xo6/v2v-source-dark.png" alt="The Source step of the migration wizard, with the remembered connections and the connection form" url="https://your-xo/v6/#/admin/v2v/migrate" />
- **Skip SSL check (self-signed certificate)** is enabled by default: the server certificate is not verified.
- **Remember connection in this browser** keeps the connection, password included, in this browser only. Xen Orchestra never stores your VMware credentials. Make sure this complies with your security guidelines.
Remembered connections are listed in the **Remembered connections** card, with the number of VMs and their migration status. Click **Connect** to reuse one. The connection remembered by the XO 5 import form is added to this list.
### Destination
Choose the **Destination pool**, then the global defaults applied to every VM:
- **Default storage repository**: prefilled with the pool default SR.
- **Default network**: prefilled with the management network of the pool master.
- **Default template**.
<UiShot light="/img/xo6/v2v-destination-light.png" dark="/img/xo6/v2v-destination-dark.png" alt="The Destination step of the migration wizard, with the destination pool and the global defaults" url="https://your-xo/v6/#/admin/v2v/migrate?step=destination" />
Each VM can override these defaults in the **Mapping** step.
Each source and destination pool pair has its own migration list, saved in your browser. If a list already exists for this pair, click **Continue with existing list** to reopen it, with the current migration state of every VM.
### VMs
The table lists the VMs of the source, with their power state, datastores, size, migration status and last sync. Filter them with the presets (**All**, **Not migrated**, **Not ready**, **In progress**, **Warm synced**, **Cutover done**), with the query builder, or by clicking a datastore.
<UiShot light="/img/xo6/v2v-vms-light.png" dark="/img/xo6/v2v-vms-dark.png" alt="The VMs step of the migration wizard, with the VMs of the source and the Selected VMs side panel" url="https://your-xo/v6/#/admin/v2v/migrate?step=vms" />
Select the VMs to migrate, then click **Add to migration list**. VMs with an [unsupported disk](#-unsupported) cannot be selected.
The **Selected VMs** side panel shows the migration list. Removing a VM from the list does not delete anything, neither on the source nor in XO.
### Mapping
The table shows every VM of the migration list, with its type:
- **New**: the VM is imported for the first time.
- **Resume**: a partial import of the VM exists on the destination pool. The import resumes from the last sync, with the mapping of the first run.
<UiShot light="/img/xo6/v2v-mapping-light.png" dark="/img/xo6/v2v-mapping-dark.png" alt="The Mapping step of the migration wizard, with the details of a VM in the side panel" url="https://your-xo/v6/#/admin/v2v/migrate?step=mapping" />
Click a VM to open its details in the side panel, then click **Edit settings** to choose:
- a **Target SR** for each disk,
- a **Target network** for each network adapter,
- the **Template**.
Each value shows whether it comes from the **Global default** or is **Overridden**. Click **Reset to default** to go back to the global default.
The mapping of a resumed VM is locked. To start over with a new mapping, click **Delete** in its side panel: the partial import is deleted, and the VM is imported as a new VM.
The **Checks** column tells whether each VM is ready. A VM with one of these checks is not migrated:
- **Not found in the source**
- An [unsupported disk](#-unsupported)
- **Import in progress**
- **Partial import on pool \{pool\}**: the partial import of the VM exists on another pool.
- **Mapping incomplete**: a chosen SR, network or template is no longer available on the pool.
A VM with the **Already migrated, confirmation at launch** check is only migrated again after your confirmation, in the **Review** step.
### Review
Set the **Default options** of the launch:
- **Stop the source VM**: enabled by default. The source VM is stopped before the last delta transfer. This is needed to fully transfer a running VM.
- **Stop on error**: enabled by default. The migration stops on the first error when importing VMs.
- **Concurrent VMs**: the number of VMs imported at the same time, 2 by default (from 1 to 8).
<UiShot light="/img/xo6/v2v-review-light.png" dark="/img/xo6/v2v-review-dark.png" alt="The Review step of the migration wizard, with the default options and the per-VM options" url="https://your-xo/v6/#/admin/v2v/migrate?step=review" />
In the **Per-VM options** table, you can override the **Stop source** option for each VM.
Before the launch, VMs are grouped as follows:
- **Excluded**: VMs with a blocking check. They are not migrated.
- **Already fully migrated**: tick **Create a second copy of \{name\}** to migrate the VM again. A second VM is created on the destination pool.
- **Resumed**: VMs resumed from their last sync.
- **New**: VMs imported for the first time.
Click **Launch \{n\} VMs** to start the migration. The migration runs in a task: click **See the task** to follow its progress.
### Limitations {#-limitations}
- The **Tags** and **Keep MAC addresses** options of the **Mapping** step are not applied yet.
- The **Start the VM on XCP-ng** and **Automatically clean up the VM** options are not supported yet.
- Do not launch the migration of the same VM twice at the same time: both imports would use the same partial import.
### Using XO 5 (legacy) {#-using-xo-5}
Go to the **Import → VM → From VMware** section. Once the check passes, a **transfer form** appears:
<UiDetail src="/img/xo5/v2v-transfer-form.png" alt="The transfer form used to connect to VMware and import a VM into Xen Orchestra" width={620} />
:::warning
Filling in this form and clicking the **Connect** button will start the VM import. Make sure your VMware environment is ready first!
Read [Preparing the VMware environment](#-preparing-the-vmware-environment) to know more.
:::
In XO 5, the `Stop source` option matches the **Stop the source VM** option of the XO 6 wizard.
## Initial test migration {#-initial-test-migration}
Before making the final switch, **run a test migration first**. This lets you catch any issues before moving to production.
@@ -330,23 +224,23 @@ Before making the final switch, **run a test migration first**. This lets you ca
Understanding the warm migration mechanism helps you follow the progress:
1. If the source VM is running and has no snapshot, XO automatically takes one, named `[V2V] migration to XCP-ng`.
2. XO creates the destination VM (its name starts with `[Importing...]` while the transfer runs) and imports the read-only snapshot chain while the source VM keeps running in production.
2. XO creates the destination VM (its name ends with `importing...` while the transfer runs) and imports the read-only snapshot chain while the source VM keeps running in production.
3. A snapshot of the destination VM is taken after this first pass, so the process can be resumed safely without creating duplicate VMs.
4. If the **Stop the source VM** option is enabled, XO then shuts the source VM down through its VMware Tools, transfers only the final delta (the blocks written since the snapshot), and takes a final `complete import from V2V` snapshot. When the VMware Tools do not run, or the guest does not shut down within 10 minutes, the VM is powered off instead, and the task reports it.
4. If the `Stop source` option is enabled, XO then shuts the source VM down through its VMware Tools, transfers only the final delta (the blocks written since the snapshot), and takes a final `complete import from V2V` snapshot. When the VMware Tools do not run, or the guest does not shut down within 10 minutes, the VM is powered off instead, and the task reports it.
5. If the [Autopilot docking](#-autopilot-docking) is enabled and the import is complete, XO boots the destination VM on the docking ISO, which prepares the guest to run on XCP-ng.
As long as the import is partial (the source VM is still live), XO blocks the destination VM from starting normally, to prevent both copies from running at once.
### Perform the first migration attempt
1. **Start the V2V migration** in Xen Orchestra, with the **Stop the source VM** option disabled (it is enabled by default).\
1. **Start the V2V migration** in Xen Orchestra, without enabling the `Stop source` option.\
This will transfer the VM data up to the snapshot named `vm without tools`.
:::tip
You can safely close your browser while the migration runs.
:::
2. **Monitor the migration progress** using one of these methods:
- Check the VM status in Xen Orchestra (its name should show `[Importing...]`).
- Follow the migration task: click **See the task** once the migration is launched.
- Check the VM status in Xen Orchestra (its name should show `importing...`).
- Follow the disk transfer progress indicators.
### Testing the migrated VM
@@ -377,7 +271,7 @@ Once you have finished your checks and taken notes, delete the test VM. This wil
When you're ready for the final migration:
- Shut down the source VM completely.
- Start the V2V migration in Xen Orchestra with the **Stop the source VM** option enabled.\
- Start the V2V migration in Xen Orchestra with the `Stop source` option enabled.\
This ensures the final sync happens while the VM is powered off, and prevents any inconsistencies.
### Post-migration tasks
@@ -491,9 +385,6 @@ If you encounter problems during migration, try these steps to diagnose and reso
- **Test network connectivity**\
Ensure stable network connectivity between the VMware environment, Xen Orchestra, and XCP-ng hosts.
- **Check the launch errors**\
When the migration cannot be started, the **Review** step lists the problem of each VM. VMs with a blocking check are listed in the **Excluded** group, with the reason.
- **Retry with cold migration**\
If warm migration fails, power off the VM, remove all snapshots, and try again.

View File

@@ -38,7 +38,6 @@ XO 6 is under active development, so this table evolves with every release. As a
| Storage | Inspect SRs and VDIs; connect, disconnect and delete SRs; create, attach, export, delete VDIs and migrate them between SRs | SR creation, advanced disk operations |
| Performance stats | Usage charts on every dashboard (last week) | Full stats views with granularity control, via the marked Stats link |
| Backups | Job list with run history, per-job pages (runs, configuration, backed up VMs, targets), per-VM protection status, dashboard health panels | Job creation and editing, restore, remotes, mirrors, sequences, health checks |
| VMware migration (V2V) | Migration wizard: several VMs at once, a storage repository per disk and a network per network adapter, resume from the last sync | VMware import form |
| Tasks | Full task history at every level, last-24-hours quick view | Task list |
| Users and access | Users list with details, groups and authentication tokens | User creation and editing, groups, roles, LDAP and other auth providers, ACLs |
| Settings | Color mode, five themes, 21 languages | Servers, plugins, proxies, licenses, everything under Settings |

Binary file not shown.

Before

Width:  |  Height:  |  Size: 134 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 132 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 181 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 178 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 149 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 147 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 136 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 134 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 194 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 192 KiB

View File

@@ -107,14 +107,7 @@ export class Index {
const type = getIndexType(value)
// Removes item from the previous type's list if any.
if (prevType != null) {
delete itemsByType[prevType][key]
// The item left this type: let the listeners of the previous type know.
if (prevType !== type) {
this.getEventEmitterByType(prevType)?.emit('remove', undefined, previousObj)
}
}
if (prevType != null) delete itemsByType[prevType][key]
// Inserts item into the new type's list if any.
if (type != null) {

View File

@@ -135,55 +135,6 @@ describe('Index', function () {
})
})
it('emits remove on the previous type when an item changes type', function () {
const removed = []
const updated = []
byGroup.getEventEmitterByType('foo').on('remove', (_, prev) => removed.push(prev))
byGroup.getEventEmitterByType('foo').on('update', value => updated.push(value))
const item1bis = {
id: item1.id,
group: 'bar',
}
col.update(item1bis)
return waitTicks().then(() => {
assert.deepEqual(removed, [item1])
assert.deepEqual(updated, [])
})
})
it('emits remove on the previous type when an item no longer has a type', function () {
const removed = []
byGroup.getEventEmitterByType('foo').on('remove', (_, prev) => removed.push(prev))
col.update({ id: item1.id })
return waitTicks().then(() => {
assert.deepEqual(removed, [item1])
})
})
it('emits update, not remove, when an item keeps the same type', function () {
const removed = []
const updated = []
const ee = byGroup.getEventEmitterByType('foo')
ee.on('remove', (_, prev) => removed.push(prev))
ee.on('update', (value, prev) => updated.push([value, prev]))
const item1bis = {
id: item1.id,
group: 'foo',
newProp: true,
}
col.update(item1bis)
return waitTicks().then(() => {
assert.deepEqual(removed, [])
assert.deepEqual(updated, [[item1bis, item1]])
})
})
it('correctly updates the value even if the same object has the same hash', function () {
const item1bis = {
id: item1.id,

View File

@@ -289,10 +289,6 @@ export default class Proxy {
// ensure the updater is using the expected channel otherwise the state will not be correct
await this.callProxyMethod(id, 'appliance.updater.configure', { channel: await this._getChannel() })
} catch (error) {
// getState would fail the same way, after waiting for another timeout
if (error.code === PROXY_UNREACHABLE) {
throw error
}
log.warn('failed to set proxy updater channel', { error })
}

View File

@@ -122,7 +122,7 @@
"relative-luminance": "^2.0.1",
"reselect": "^2.5.4",
"rimraf": "^6.0.1",
"sanitize-html": "^2.17.4",
"sanitize-html": "2.17.4",
"sass": "^1.38.1",
"semver": "^6.0.0",
"strip-ansi": "^5.2.0",

View File

@@ -17499,7 +17499,7 @@ safe-regex@^1.1.0:
resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a"
integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==
sanitize-html@^2.17.4:
sanitize-html@2.17.4:
version "2.17.4"
resolved "https://registry.yarnpkg.com/sanitize-html/-/sanitize-html-2.17.4.tgz#7db8b73b0024ccf543978c2a44da8223c4740cb1"
integrity sha512-2HW7v2ol/uAM7sX4hbD8Z59OGWmAPrvjL8E71UWlBcj6m+kcF6ilQBLny+cIgY214QJeJT5tQuxKKqX0SQqjGQ==