chore: format with Prettier

This commit is contained in:
Julien Fontanet 2023-09-26 14:34:37 +02:00
parent 8eb0bdbda7
commit 6665d6a8e6
20 changed files with 82 additions and 77 deletions

View File

@ -13,12 +13,15 @@ describe('decorateWith', () => {
const expectedFn = Function.prototype const expectedFn = Function.prototype
const newFn = () => {} const newFn = () => {}
const decorator = decorateWith(function wrapper(fn, ...args) { const decorator = decorateWith(
assert.deepStrictEqual(fn, expectedFn) function wrapper(fn, ...args) {
assert.deepStrictEqual(args, expectedArgs) assert.deepStrictEqual(fn, expectedFn)
assert.deepStrictEqual(args, expectedArgs)
return newFn return newFn
}, ...expectedArgs) },
...expectedArgs
)
const descriptor = { const descriptor = {
configurable: true, configurable: true,

View File

@ -1,4 +1,4 @@
<!DOCTYPE html> <!doctype html>
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="UTF-8" /> <meta charset="UTF-8" />

View File

@ -66,8 +66,8 @@ onUnmounted(() => {
store.value?.unsubscribe(subscriptionId); store.value?.unsubscribe(subscriptionId);
}); });
const record = computed<ObjectTypeToRecord<HandledTypes> | undefined>(() => const record = computed<ObjectTypeToRecord<HandledTypes> | undefined>(
store.value?.getByUuid(props.uuid as any) () => store.value?.getByUuid(props.uuid as any)
); );
const isReady = computed(() => { const isReady = computed(() => {

View File

@ -12,12 +12,12 @@ export type MixinAbstractConstructor<T = unknown> = abstract new (
export type MixinFunction< export type MixinFunction<
T extends MixinConstructor | MixinAbstractConstructor = MixinConstructor, T extends MixinConstructor | MixinAbstractConstructor = MixinConstructor,
R extends T = T & MixinConstructor R extends T = T & MixinConstructor,
> = (Base: T) => R; > = (Base: T) => R;
export type MixinReturnValue< export type MixinReturnValue<
T extends MixinConstructor | MixinAbstractConstructor, T extends MixinConstructor | MixinAbstractConstructor,
M extends MixinFunction<T, any>[] M extends MixinFunction<T, any>[],
> = UnionToIntersection< > = UnionToIntersection<
| T | T
| { | {
@ -27,7 +27,7 @@ export type MixinReturnValue<
export default function mixin< export default function mixin<
T extends MixinConstructor | MixinAbstractConstructor, T extends MixinConstructor | MixinAbstractConstructor,
M extends MixinFunction<T, any>[] M extends MixinFunction<T, any>[],
>(Base: T, ...mixins: M): MixinReturnValue<T, M> { >(Base: T, ...mixins: M): MixinReturnValue<T, M> {
return mixins.reduce( return mixins.reduce(
(mix, applyMixin) => applyMixin(mix), (mix, applyMixin) => applyMixin(mix),

View File

@ -38,7 +38,7 @@ type StoreToRefs<SS extends Store<any, any, any, any>> = ToRefs<
type Output< type Output<
S extends StoreDefinition<any, any, any, any>, S extends StoreDefinition<any, any, any, any>,
Defer extends boolean Defer extends boolean,
> = Omit<S, keyof StoreToRefs<S> | IgnoredProperties> & > = Omit<S, keyof StoreToRefs<S> | IgnoredProperties> &
StoreToRefs<S> & StoreToRefs<S> &
(Defer extends true (Defer extends true
@ -54,7 +54,7 @@ export const createUseCollection = <
infer A infer A
> >
? Store<Id, S, G, A> ? Store<Id, S, G, A>
: never : never,
>( >(
useStore: SD useStore: SD
) => { ) => {

View File

@ -110,19 +110,19 @@ const template = computed(() => {
]" ]"
> >
<${componentName} v-bind="properties"${ <${componentName} v-bind="properties"${
slotsNames.length > 0 slotsNames.length > 0
? `>\n ${slotsNames ? `>\n ${slotsNames
.map((name) => .map((name) =>
name === "default" name === "default"
? `{{ settings.${camel(name)}SlotContent }}` ? `{{ settings.${camel(name)}SlotContent }}`
: `<template #${name}>{{ settings.${camel( : `<template #${name}>{{ settings.${camel(
name name
)}SlotContent }}</template>` )}SlotContent }}</template>`
) )
.join("\n ")} .join("\n ")}
</${componentName}>` </${componentName}>`
: ` />` : ` />`
} }
</ComponentStory> </ComponentStory>
</template> </template>

View File

@ -8,7 +8,7 @@
> Users must be able to say: “Nice enhancement, I'm eager to test it” > Users must be able to say: “Nice enhancement, I'm eager to test it”
- [Netbox] Don't delete VMs that have been created manually in XO-synced cluster [Forum#7639](https://xcp-ng.org/forum/topic/7639) (PR [#7008](https://github.com/vatesfr/xen-orchestra/pull/7008)) - [Netbox] Don't delete VMs that have been created manually in XO-synced cluster [Forum#7639](https://xcp-ng.org/forum/topic/7639) (PR [#7008](https://github.com/vatesfr/xen-orchestra/pull/7008))
- [Kubernetes] *Search domains* field is now optional [#7028](https://github.com/vatesfr/xen-orchestra/pull/7028) - [Kubernetes] _Search domains_ field is now optional [#7028](https://github.com/vatesfr/xen-orchestra/pull/7028)
- [Patches] Support new XenServer Updates system. See [our documentation](https://xen-orchestra.com/docs/updater.html#xenserver-updates). (PR [#7044](https://github.com/vatesfr/xen-orchestra/pull/7044)) - [Patches] Support new XenServer Updates system. See [our documentation](https://xen-orchestra.com/docs/updater.html#xenserver-updates). (PR [#7044](https://github.com/vatesfr/xen-orchestra/pull/7044))
- [REST API] Hosts' audit and system logs can be downloaded [#3968](https://github.com/vatesfr/xen-orchestra/issues/3968) (PR [#7048](https://github.com/vatesfr/xen-orchestra/pull/7048)) - [REST API] Hosts' audit and system logs can be downloaded [#3968](https://github.com/vatesfr/xen-orchestra/issues/3968) (PR [#7048](https://github.com/vatesfr/xen-orchestra/pull/7048))
- [Host/Advanced] New button to download system logs [#3968](https://github.com/vatesfr/xen-orchestra/issues/3968) (PR [#7048](https://github.com/vatesfr/xen-orchestra/pull/7048)) - [Host/Advanced] New button to download system logs [#3968](https://github.com/vatesfr/xen-orchestra/issues/3968) (PR [#7048](https://github.com/vatesfr/xen-orchestra/pull/7048))

View File

@ -6,7 +6,6 @@ ISC License may be found here: https://www.isc.org/licenses/
The texts of the two licenses are inserted at the root of this repo. The texts of the two licenses are inserted at the root of this repo.
Below is the list of the various components and their corresponding licenses, AGPL or ISC. Below is the list of the various components and their corresponding licenses, AGPL or ISC.
- @xen-orchestra/audit-core - AGPL-3.0-or-later - @xen-orchestra/audit-core - AGPL-3.0-or-later
- @xen-orchestra/babel-config - AGPL-3.0-or-later - @xen-orchestra/babel-config - AGPL-3.0-or-later
- @xen-orchestra/backups - AGPL-3.0-or-later - @xen-orchestra/backups - AGPL-3.0-or-later
@ -51,7 +50,6 @@ Below is the list of the various components and their corresponding licenses, AG
- xo-vmdk-to-vhd - AGPL-3.0-or-later - xo-vmdk-to-vhd - AGPL-3.0-or-later
- xo-web - AGPL-3.0-or-later - xo-web - AGPL-3.0-or-later
- @vates/async-each - ISC - @vates/async-each - ISC
- @vates/cached-dns.lookup - ISC - @vates/cached-dns.lookup - ISC
- @vates/coalesce-calls - ISC - @vates/coalesce-calls - ISC

View File

@ -654,7 +654,7 @@ List of the VMs with more than the recommended amount of snapshots (3). There is
### Duplicated MAC addresses ### Duplicated MAC addresses
Machines with the same MAC addresses on a network will result in unexpected behavior if they run simultaneously. Machines with the same MAC addresses on a network will result in unexpected behavior if they run simultaneously.
### Guest Tools status ### Guest Tools status

View File

@ -96,8 +96,11 @@ describe('VhdDirectory', async () => {
for await (const block of vhd.blocks()) { for await (const block of vhd.blocks()) {
await compressedVhd.writeEntireBlock(block) await compressedVhd.writeEntireBlock(block)
} }
await Promise await Promise.all[
.all[(await compressedVhd.writeHeader(), await compressedVhd.writeFooter(), await compressedVhd.writeBlockAllocationTable())] (await compressedVhd.writeHeader(),
await compressedVhd.writeFooter(),
await compressedVhd.writeBlockAllocationTable())
]
// compressed vhd have a metadata file // compressed vhd have a metadata file
assert.equal(await fs.exists(`${tempDir}/compressed.vhd/chunk-filters.json`), true) assert.equal(await fs.exists(`${tempDir}/compressed.vhd/chunk-filters.json`), true)

View File

@ -285,9 +285,11 @@ execPromise(async function main() {
const require = (await import('module')).createRequire(import.meta.url) const require = (await import('module')).createRequire(import.meta.url)
// eslint-disable-next-line n/no-extraneous-require // eslint-disable-next-line n/no-extraneous-require
const { repair } = require(require.resolve('level', { const { repair } = require(
paths: [require.resolve('level-party')], require.resolve('level', {
})) paths: [require.resolve('level-party')],
})
)
await new Promise((resolve, reject) => { await new Promise((resolve, reject) => {
repair(`${config.datadir}/leveldb`, error => { repair(`${config.datadir}/leveldb`, error => {
if (error) { if (error) {

View File

@ -252,12 +252,15 @@ export default class XapiStats {
}) })
// clear cache when too old // clear cache when too old
setTimeout(() => { setTimeout(
// only if it has not been updated () => {
if (this.#hostCache[hostUuid]?.[step]?.timestamp === timestamp) { // only if it has not been updated
delete this.#hostCache[hostUuid][step] if (this.#hostCache[hostUuid]?.[step]?.timestamp === timestamp) {
} delete this.#hostCache[hostUuid][step]
}, (step + 1) * 1000) }
},
(step + 1) * 1000
)
this.#hostCache[hostUuid][step] = { this.#hostCache[hostUuid][step] = {
timestamp, timestamp,

View File

@ -68,9 +68,7 @@ export default class IpPools {
if (await store.has(id)) { if (await store.has(id)) {
await Promise.all( await Promise.all(
( (await this._app.getAllResourceSets()).map(async set => {
await this._app.getAllResourceSets()
).map(async set => {
await this._app.removeLimitFromResourceSet(`ipPool:${id}`, set.id) await this._app.removeLimitFromResourceSet(`ipPool:${id}`, set.id)
return this._app.removeIpPoolFromResourceSet(id, set.id) return this._app.removeIpPoolFromResourceSet(id, set.id)
}) })

View File

@ -196,9 +196,7 @@ export default class {
await Promise.all( await Promise.all(
difference(set.subjects, subjects).map(async subjectId => difference(set.subjects, subjects).map(async subjectId =>
Promise.all( Promise.all(
( (await this._app.getAclsForSubject(subjectId)).map(async acl => {
await this._app.getAclsForSubject(subjectId)
).map(async acl => {
try { try {
const object = this._app.getObject(acl.object) const object = this._app.getObject(acl.object)
if ((object.type === 'VM' || object.type === 'VM-snapshot') && object.resourceSet === id) { if ((object.type === 'VM' || object.type === 'VM-snapshot') && object.resourceSet === id) {

View File

@ -6,7 +6,7 @@ import React from 'react'
import omit from 'lodash/omit.js' import omit from 'lodash/omit.js'
const STYLE = { const STYLE = {
marginBottom: 0 marginBottom: 0,
} }
export default class SelectFiles extends Component { export default class SelectFiles extends Component {

View File

@ -11,7 +11,10 @@
padding: 8px 21px; padding: 8px 21px;
pointer-events: none; pointer-events: none;
position: fixed; position: fixed;
transition: opacity 0.3s ease-out, margin-top 0.3s ease-out, margin-left 0.3s ease-out; transition:
opacity 0.3s ease-out,
margin-top 0.3s ease-out,
margin-left 0.3s ease-out;
z-index: 9999; z-index: 9999;
} }

View File

@ -72,12 +72,11 @@ const getInitialState = () => ({
}) })
export default decorate([ export default decorate([
New => props => New => props => (
( <Upgrade place='newMetadataBackup' required={3}>
<Upgrade place='newMetadataBackup' required={3}> <New {...props} />
<New {...props} /> </Upgrade>
</Upgrade> ),
),
addSubscriptions({ addSubscriptions({
remotes: subscribeRemotes, remotes: subscribeRemotes,
}), }),

View File

@ -282,22 +282,21 @@ const AttachedVdisTable = decorate([
vdiSnapshots: createGetObjectsOfType('VDI-snapshot'), vdiSnapshots: createGetObjectsOfType('VDI-snapshot'),
}), }),
({ columns, rowTransform }) => ({ columns, rowTransform }) =>
({ pools, srs, vbds, vdis, vdiSnapshots }) => ({ pools, srs, vbds, vdis, vdiSnapshots }) => (
( <NoObjects
<NoObjects actions={CONTROL_DOMAIN_VDIS_ACTIONS}
actions={CONTROL_DOMAIN_VDIS_ACTIONS} collection={vbds}
collection={vbds} columns={columns}
columns={columns} component={SortedTable}
component={SortedTable} data-pools={pools}
data-pools={pools} data-srs={srs}
data-srs={srs} data-vdis={vdis}
data-vdis={vdis} data-vdiSnapshots={vdiSnapshots}
data-vdiSnapshots={vdiSnapshots} emptyMessage={_('noControlDomainVdis')}
emptyMessage={_('noControlDomainVdis')} rowTransform={rowTransform}
rowTransform={rowTransform} stateUrlParam='s_controldomain'
stateUrlParam='s_controldomain' />
/> ),
),
{ {
columns: [ columns: [
{ {

View File

@ -533,12 +533,11 @@ export default decorate([
}, },
optionRenderer: optionRenderer:
({ countByStatus }) => ({ countByStatus }) =>
({ label, value }) => ({ label, value }) => (
( <span>
<span> {_(label)} ({countByStatus[value] || 0})
{_(label)} ({countByStatus[value] || 0}) </span>
</span> ),
),
countByStatus: ({ preFilteredTasksLogs }) => ({ countByStatus: ({ preFilteredTasksLogs }) => ({
all: get(() => preFilteredTasksLogs.length), all: get(() => preFilteredTasksLogs.length),
...countBy(preFilteredTasksLogs, 'status'), ...countBy(preFilteredTasksLogs, 'status'),

View File

@ -285,7 +285,7 @@ export default class NewVm extends BaseComponent {
() => this.props.resourceSets, () => this.props.resourceSets,
createSelector( createSelector(
() => this.props.location.query.resourceSet, () => this.props.location.query.resourceSet,
resourceSetId => resourceSet => resourceSet !== undefined ? resourceSetId === resourceSet.id : undefined resourceSetId => resourceSet => (resourceSet !== undefined ? resourceSetId === resourceSet.id : undefined)
) )
) )