@xen-orchestra/rest-api 0.21.1 → 0.21.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs
CHANGED
|
@@ -12,6 +12,7 @@ const swaggerOpenApiSpec = require('../open-api/spec/swagger.json');
|
|
|
12
12
|
export const BASE_URL = '/rest/v0';
|
|
13
13
|
const SWAGGER_UI_OPTIONS = {
|
|
14
14
|
swaggerOptions: {
|
|
15
|
+
url: `${BASE_URL}/docs/swagger.json`,
|
|
15
16
|
displayRequestDuration: true,
|
|
16
17
|
docExpansion: 'none', // collapse all tags by default
|
|
17
18
|
filter: true, // add a tags searchbar,
|
|
@@ -40,7 +41,7 @@ export default function setupRestApi(express, xoApp) {
|
|
|
40
41
|
});
|
|
41
42
|
// do not register the doc at the root level, or it may lead to unwanted behaviour
|
|
42
43
|
express.get('/rest/v0', (_req, res) => res.redirect('/rest/v0/docs'));
|
|
43
|
-
express.use(`${BASE_URL}/docs`, swaggerUi.
|
|
44
|
+
express.use(`${BASE_URL}/docs`, swaggerUi.serveFiles(undefined, SWAGGER_UI_OPTIONS), swaggerUi.setup(null, SWAGGER_UI_OPTIONS));
|
|
44
45
|
express.use(BASE_URL, tsoaToXoErrorHandler);
|
|
45
46
|
express.use(BASE_URL, genericErrorHandler);
|
|
46
47
|
}
|
|
@@ -105,7 +105,7 @@ const models = {
|
|
|
105
105
|
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
|
|
106
106
|
"XoGuiRoutes": {
|
|
107
107
|
"dataType": "refAlias",
|
|
108
|
-
"type": { "dataType": "nestedObjectLiteral", "nestedProperties": { "xo6": { "dataType": "
|
|
108
|
+
"type": { "dataType": "nestedObjectLiteral", "nestedProperties": { "xo6": { "dataType": "string" }, "xo5": { "dataType": "string" } }, "validators": {} },
|
|
109
109
|
},
|
|
110
110
|
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
|
|
111
111
|
"Record_string.string_": {
|
|
@@ -300,12 +300,12 @@ const models = {
|
|
|
300
300
|
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
|
|
301
301
|
"XoTask": {
|
|
302
302
|
"dataType": "refAlias",
|
|
303
|
-
"type": { "dataType": "nestedObjectLiteral", "nestedProperties": { "warnings": { "dataType": "array", "array": { "dataType": "nestedObjectLiteral", "nestedProperties": { "message": { "dataType": "string", "required": true }, "data": { "dataType": "any", "required": true } } } }, "updatedAt": { "dataType": "double" }, "tasks": { "dataType": "array", "array": { "dataType": "refAlias", "ref": "XoTask" } }, "status": { "dataType": "union", "subSchemas": [{ "dataType": "enum", "enums": ["failure"] }, { "dataType": "enum", "enums": ["interrupted"] }, { "dataType": "enum", "enums": ["pending"] }, { "dataType": "enum", "enums": ["success"] }], "required": true }, "start": { "dataType": "double", "required": true }, "result": { "ref": "Record_string.unknown_", "required": true }, "properties": { "dataType": "nestedObjectLiteral", "nestedProperties": { "userId": { "dataType": "string" }, "type": { "dataType": "string" }, "params": { "ref": "Record_string.unknown_" }, "objectId": { "dataType": "string" }, "name": { "dataType": "string" }, "method": { "dataType": "string" } }, "additionalProperties": { "dataType": "union", "subSchemas": [{ "dataType": "any" }, { "dataType": "undefined" }] }, "required": true }, "infos": { "dataType": "array", "array": { "dataType": "nestedObjectLiteral", "nestedProperties": { "message": { "dataType": "string", "required": true }, "data": { "dataType": "any", "required": true } } } }, "id": { "ref": "Branded_task_", "required": true }, "end": { "dataType": "double" }, "data": { "ref": "Record_string.string_" }, "abortionRequestedAt": { "dataType": "double" } }, "validators": {} },
|
|
303
|
+
"type": { "dataType": "nestedObjectLiteral", "nestedProperties": { "warnings": { "dataType": "array", "array": { "dataType": "nestedObjectLiteral", "nestedProperties": { "message": { "dataType": "string", "required": true }, "data": { "dataType": "any", "required": true } } } }, "updatedAt": { "dataType": "double" }, "tasks": { "dataType": "array", "array": { "dataType": "refAlias", "ref": "XoTask" } }, "status": { "dataType": "union", "subSchemas": [{ "dataType": "enum", "enums": ["failure"] }, { "dataType": "enum", "enums": ["interrupted"] }, { "dataType": "enum", "enums": ["pending"] }, { "dataType": "enum", "enums": ["success"] }], "required": true }, "start": { "dataType": "double", "required": true }, "result": { "ref": "Record_string.unknown_", "required": true }, "properties": { "dataType": "nestedObjectLiteral", "nestedProperties": { "userId": { "dataType": "string" }, "type": { "dataType": "string" }, "progress": { "dataType": "double" }, "params": { "ref": "Record_string.unknown_" }, "objectId": { "dataType": "string" }, "name": { "dataType": "string" }, "method": { "dataType": "string" } }, "additionalProperties": { "dataType": "union", "subSchemas": [{ "dataType": "any" }, { "dataType": "undefined" }] }, "required": true }, "infos": { "dataType": "array", "array": { "dataType": "nestedObjectLiteral", "nestedProperties": { "message": { "dataType": "string", "required": true }, "data": { "dataType": "any", "required": true } } } }, "id": { "ref": "Branded_task_", "required": true }, "end": { "dataType": "double" }, "data": { "ref": "Record_string.string_" }, "abortionRequestedAt": { "dataType": "double" } }, "validators": {} },
|
|
304
304
|
},
|
|
305
305
|
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
|
|
306
306
|
"Partial_Unbrand_XoTask__": {
|
|
307
307
|
"dataType": "refAlias",
|
|
308
|
-
"type": { "dataType": "nestedObjectLiteral", "nestedProperties": { "abortionRequestedAt": { "dataType": "union", "subSchemas": [{ "dataType": "double" }, { "dataType": "undefined" }] }, "data": { "dataType": "union", "subSchemas": [{ "ref": "Record_string.string_" }, { "dataType": "undefined" }] }, "end": { "dataType": "union", "subSchemas": [{ "dataType": "double" }, { "dataType": "undefined" }] }, "id": { "dataType": "union", "subSchemas": [{ "dataType": "string" }, { "dataType": "undefined" }] }, "infos": { "dataType": "union", "subSchemas": [{ "dataType": "array", "array": { "dataType": "nestedObjectLiteral", "nestedProperties": { "message": { "dataType": "string", "required": true }, "data": { "dataType": "any", "required": true } } } }, { "dataType": "undefined" }] }, "properties": { "dataType": "union", "subSchemas": [{ "dataType": "nestedObjectLiteral", "nestedProperties": { "userId": { "dataType": "union", "subSchemas": [{ "dataType": "string" }, { "dataType": "undefined" }] }, "type": { "dataType": "union", "subSchemas": [{ "dataType": "string" }, { "dataType": "undefined" }] }, "params": { "dataType": "union", "subSchemas": [{ "ref": "Record_string.unknown_" }, { "dataType": "undefined" }] }, "objectId": { "dataType": "union", "subSchemas": [{ "dataType": "string" }, { "dataType": "undefined" }] }, "name": { "dataType": "union", "subSchemas": [{ "dataType": "string" }, { "dataType": "undefined" }] }, "method": { "dataType": "union", "subSchemas": [{ "dataType": "string" }, { "dataType": "undefined" }] } }, "additionalProperties": { "dataType": "any" } }, { "dataType": "undefined" }] }, "result": { "dataType": "union", "subSchemas": [{ "ref": "Record_string.unknown_" }, { "dataType": "undefined" }] }, "start": { "dataType": "union", "subSchemas": [{ "dataType": "double" }, { "dataType": "undefined" }] }, "status": { "dataType": "union", "subSchemas": [{ "dataType": "enum", "enums": ["failure"] }, { "dataType": "enum", "enums": ["interrupted"] }, { "dataType": "enum", "enums": ["pending"] }, { "dataType": "enum", "enums": ["success"] }, { "dataType": "undefined" }] }, "tasks": { "dataType": "union", "subSchemas": [{ "dataType": "array", "array": { "dataType": "refAlias", "ref": "XoTask" } }, { "dataType": "undefined" }] }, "updatedAt": { "dataType": "union", "subSchemas": [{ "dataType": "double" }, { "dataType": "undefined" }] }, "warnings": { "dataType": "union", "subSchemas": [{ "dataType": "array", "array": { "dataType": "nestedObjectLiteral", "nestedProperties": { "message": { "dataType": "string", "required": true }, "data": { "dataType": "any", "required": true } } } }, { "dataType": "undefined" }] } }, "validators": {} },
|
|
308
|
+
"type": { "dataType": "nestedObjectLiteral", "nestedProperties": { "abortionRequestedAt": { "dataType": "union", "subSchemas": [{ "dataType": "double" }, { "dataType": "undefined" }] }, "data": { "dataType": "union", "subSchemas": [{ "ref": "Record_string.string_" }, { "dataType": "undefined" }] }, "end": { "dataType": "union", "subSchemas": [{ "dataType": "double" }, { "dataType": "undefined" }] }, "id": { "dataType": "union", "subSchemas": [{ "dataType": "string" }, { "dataType": "undefined" }] }, "infos": { "dataType": "union", "subSchemas": [{ "dataType": "array", "array": { "dataType": "nestedObjectLiteral", "nestedProperties": { "message": { "dataType": "string", "required": true }, "data": { "dataType": "any", "required": true } } } }, { "dataType": "undefined" }] }, "properties": { "dataType": "union", "subSchemas": [{ "dataType": "nestedObjectLiteral", "nestedProperties": { "userId": { "dataType": "union", "subSchemas": [{ "dataType": "string" }, { "dataType": "undefined" }] }, "type": { "dataType": "union", "subSchemas": [{ "dataType": "string" }, { "dataType": "undefined" }] }, "progress": { "dataType": "union", "subSchemas": [{ "dataType": "double" }, { "dataType": "undefined" }] }, "params": { "dataType": "union", "subSchemas": [{ "ref": "Record_string.unknown_" }, { "dataType": "undefined" }] }, "objectId": { "dataType": "union", "subSchemas": [{ "dataType": "string" }, { "dataType": "undefined" }] }, "name": { "dataType": "union", "subSchemas": [{ "dataType": "string" }, { "dataType": "undefined" }] }, "method": { "dataType": "union", "subSchemas": [{ "dataType": "string" }, { "dataType": "undefined" }] } }, "additionalProperties": { "dataType": "any" } }, { "dataType": "undefined" }] }, "result": { "dataType": "union", "subSchemas": [{ "ref": "Record_string.unknown_" }, { "dataType": "undefined" }] }, "start": { "dataType": "union", "subSchemas": [{ "dataType": "double" }, { "dataType": "undefined" }] }, "status": { "dataType": "union", "subSchemas": [{ "dataType": "enum", "enums": ["failure"] }, { "dataType": "enum", "enums": ["interrupted"] }, { "dataType": "enum", "enums": ["pending"] }, { "dataType": "enum", "enums": ["success"] }, { "dataType": "undefined" }] }, "tasks": { "dataType": "union", "subSchemas": [{ "dataType": "array", "array": { "dataType": "refAlias", "ref": "XoTask" } }, { "dataType": "undefined" }] }, "updatedAt": { "dataType": "union", "subSchemas": [{ "dataType": "double" }, { "dataType": "undefined" }] }, "warnings": { "dataType": "union", "subSchemas": [{ "dataType": "array", "array": { "dataType": "nestedObjectLiteral", "nestedProperties": { "message": { "dataType": "string", "required": true }, "data": { "dataType": "any", "required": true } } } }, { "dataType": "undefined" }] } }, "validators": {} },
|
|
309
309
|
},
|
|
310
310
|
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
|
|
311
311
|
"WithHref_Partial_Unbrand_XoTask___": {
|
|
@@ -350,7 +350,7 @@ const models = {
|
|
|
350
350
|
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
|
|
351
351
|
"UnbrandedVmDashboard": {
|
|
352
352
|
"dataType": "refAlias",
|
|
353
|
-
"type": { "dataType": "nestedObjectLiteral", "nestedProperties": { "backupsInfo": { "dataType": "nestedObjectLiteral", "nestedProperties": { "backupArchives": { "dataType": "array", "array": { "dataType": "refAlias", "ref": "Unbrand_VmDashboardBackupArchive_" }, "required": true }, "replication": { "ref": "Unbrand_VmDashboard-at-backupsInfo_91_replication_93__" }, "
|
|
353
|
+
"type": { "dataType": "nestedObjectLiteral", "nestedProperties": { "backupsInfo": { "dataType": "nestedObjectLiteral", "nestedProperties": { "backupArchives": { "dataType": "array", "array": { "dataType": "refAlias", "ref": "Unbrand_VmDashboardBackupArchive_" }, "required": true }, "replication": { "ref": "Unbrand_VmDashboard-at-backupsInfo_91_replication_93__" }, "vmProtection": { "dataType": "union", "subSchemas": [{ "dataType": "enum", "enums": ["protected"] }, { "dataType": "enum", "enums": ["unprotected"] }, { "dataType": "enum", "enums": ["not-in-job"] }], "required": true }, "lastRuns": { "dataType": "array", "array": { "dataType": "refAlias", "ref": "Unbrand_VmDashboardRun_" }, "required": true } }, "required": true }, "alarms": { "dataType": "array", "array": { "dataType": "string" }, "required": true }, "quickInfo": { "dataType": "intersection", "subSchemas": [{ "ref": "Omit_Unbrand_VmDashboard-at-quickInfo_.creation_" }, { "dataType": "nestedObjectLiteral", "nestedProperties": { "creation": { "ref": "Unbrand_VmDashboard-at-quickInfo_91_creation_93__", "required": true } } }], "required": true } }, "validators": {} },
|
|
354
354
|
},
|
|
355
355
|
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
|
|
356
356
|
"Partial_Unbrand_XoVmTemplate__": {
|
|
@@ -566,7 +566,7 @@ const models = {
|
|
|
566
566
|
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
|
|
567
567
|
"Unbrand_XoTask_": {
|
|
568
568
|
"dataType": "refAlias",
|
|
569
|
-
"type": { "dataType": "nestedObjectLiteral", "nestedProperties": { "abortionRequestedAt": { "dataType": "union", "subSchemas": [{ "dataType": "double" }, { "dataType": "undefined" }] }, "data": { "dataType": "union", "subSchemas": [{ "ref": "Record_string.string_" }, { "dataType": "undefined" }] }, "end": { "dataType": "union", "subSchemas": [{ "dataType": "double" }, { "dataType": "undefined" }] }, "id": { "dataType": "string", "required": true }, "infos": { "dataType": "union", "subSchemas": [{ "dataType": "array", "array": { "dataType": "nestedObjectLiteral", "nestedProperties": { "message": { "dataType": "string", "required": true }, "data": { "dataType": "any", "required": true } } } }, { "dataType": "undefined" }] }, "properties": { "dataType": "nestedObjectLiteral", "nestedProperties": { "userId": { "dataType": "union", "subSchemas": [{ "dataType": "string" }, { "dataType": "undefined" }] }, "type": { "dataType": "union", "subSchemas": [{ "dataType": "string" }, { "dataType": "undefined" }] }, "params": { "dataType": "union", "subSchemas": [{ "ref": "Record_string.unknown_" }, { "dataType": "undefined" }] }, "objectId": { "dataType": "union", "subSchemas": [{ "dataType": "string" }, { "dataType": "undefined" }] }, "name": { "dataType": "union", "subSchemas": [{ "dataType": "string" }, { "dataType": "undefined" }] }, "method": { "dataType": "union", "subSchemas": [{ "dataType": "string" }, { "dataType": "undefined" }] } }, "additionalProperties": { "dataType": "any" }, "required": true }, "result": { "ref": "Record_string.unknown_", "required": true }, "start": { "dataType": "double", "required": true }, "status": { "dataType": "union", "subSchemas": [{ "dataType": "enum", "enums": ["failure"] }, { "dataType": "enum", "enums": ["interrupted"] }, { "dataType": "enum", "enums": ["pending"] }, { "dataType": "enum", "enums": ["success"] }], "required": true }, "tasks": { "dataType": "union", "subSchemas": [{ "dataType": "array", "array": { "dataType": "refAlias", "ref": "XoTask" } }, { "dataType": "undefined" }] }, "updatedAt": { "dataType": "union", "subSchemas": [{ "dataType": "double" }, { "dataType": "undefined" }] }, "warnings": { "dataType": "union", "subSchemas": [{ "dataType": "array", "array": { "dataType": "nestedObjectLiteral", "nestedProperties": { "message": { "dataType": "string", "required": true }, "data": { "dataType": "any", "required": true } } } }, { "dataType": "undefined" }] } }, "validators": {} },
|
|
569
|
+
"type": { "dataType": "nestedObjectLiteral", "nestedProperties": { "abortionRequestedAt": { "dataType": "union", "subSchemas": [{ "dataType": "double" }, { "dataType": "undefined" }] }, "data": { "dataType": "union", "subSchemas": [{ "ref": "Record_string.string_" }, { "dataType": "undefined" }] }, "end": { "dataType": "union", "subSchemas": [{ "dataType": "double" }, { "dataType": "undefined" }] }, "id": { "dataType": "string", "required": true }, "infos": { "dataType": "union", "subSchemas": [{ "dataType": "array", "array": { "dataType": "nestedObjectLiteral", "nestedProperties": { "message": { "dataType": "string", "required": true }, "data": { "dataType": "any", "required": true } } } }, { "dataType": "undefined" }] }, "properties": { "dataType": "nestedObjectLiteral", "nestedProperties": { "userId": { "dataType": "union", "subSchemas": [{ "dataType": "string" }, { "dataType": "undefined" }] }, "type": { "dataType": "union", "subSchemas": [{ "dataType": "string" }, { "dataType": "undefined" }] }, "progress": { "dataType": "union", "subSchemas": [{ "dataType": "double" }, { "dataType": "undefined" }] }, "params": { "dataType": "union", "subSchemas": [{ "ref": "Record_string.unknown_" }, { "dataType": "undefined" }] }, "objectId": { "dataType": "union", "subSchemas": [{ "dataType": "string" }, { "dataType": "undefined" }] }, "name": { "dataType": "union", "subSchemas": [{ "dataType": "string" }, { "dataType": "undefined" }] }, "method": { "dataType": "union", "subSchemas": [{ "dataType": "string" }, { "dataType": "undefined" }] } }, "additionalProperties": { "dataType": "any" }, "required": true }, "result": { "ref": "Record_string.unknown_", "required": true }, "start": { "dataType": "double", "required": true }, "status": { "dataType": "union", "subSchemas": [{ "dataType": "enum", "enums": ["failure"] }, { "dataType": "enum", "enums": ["interrupted"] }, { "dataType": "enum", "enums": ["pending"] }, { "dataType": "enum", "enums": ["success"] }], "required": true }, "tasks": { "dataType": "union", "subSchemas": [{ "dataType": "array", "array": { "dataType": "refAlias", "ref": "XoTask" } }, { "dataType": "undefined" }] }, "updatedAt": { "dataType": "union", "subSchemas": [{ "dataType": "double" }, { "dataType": "undefined" }] }, "warnings": { "dataType": "union", "subSchemas": [{ "dataType": "array", "array": { "dataType": "nestedObjectLiteral", "nestedProperties": { "message": { "dataType": "string", "required": true }, "data": { "dataType": "any", "required": true } } } }, { "dataType": "undefined" }] } }, "validators": {} },
|
|
570
570
|
},
|
|
571
571
|
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
|
|
572
572
|
"Record_string.STORAGE_OPERATIONS_": {
|
package/dist/vms/vm.service.mjs
CHANGED
|
@@ -239,29 +239,32 @@ export class VmService {
|
|
|
239
239
|
status,
|
|
240
240
|
};
|
|
241
241
|
});
|
|
242
|
-
let
|
|
242
|
+
let vmProtection = 'not-in-job';
|
|
243
243
|
if (!vmContainsNoBakTag(vm)) {
|
|
244
244
|
const backupLogsByJob = groupBy(backupLogs, 'jobId');
|
|
245
245
|
for (const backupJob of relevantJobsWithSchedule) {
|
|
246
|
-
if (
|
|
246
|
+
if (vmProtection === 'protected') {
|
|
247
247
|
break;
|
|
248
248
|
}
|
|
249
|
+
vmProtection = 'unprotected';
|
|
249
250
|
// can be undefined if the backup did run for now
|
|
250
251
|
const jobLogs = backupLogsByJob[backupJob.id]
|
|
251
252
|
?.filter(log => log.status !== 'pending')
|
|
252
253
|
.slice(-3);
|
|
253
254
|
if (jobLogs !== undefined) {
|
|
254
|
-
|
|
255
|
+
vmProtection = jobLogs.every(log => {
|
|
255
256
|
if (log.status === 'success') {
|
|
256
257
|
return true;
|
|
257
258
|
}
|
|
258
259
|
const vmTaskLog = this.#backupLogService.getVmBackupTaskLog(log, id);
|
|
259
260
|
return vmTaskLog?.status === 'success';
|
|
260
|
-
})
|
|
261
|
+
})
|
|
262
|
+
? 'protected'
|
|
263
|
+
: 'unprotected';
|
|
261
264
|
}
|
|
262
265
|
}
|
|
263
266
|
}
|
|
264
|
-
return { lastRuns: lastBackupRuns,
|
|
267
|
+
return { lastRuns: lastBackupRuns, vmProtection };
|
|
265
268
|
}
|
|
266
269
|
async #getLastVmBackupArchives(id) {
|
|
267
270
|
const vm = this.#restApi.getObject(id, 'VM');
|
|
@@ -274,7 +277,7 @@ export class VmService {
|
|
|
274
277
|
.map(ba => ({ id: ba.id, timestamp: ba.timestamp, backupRepository: ba.backupRepository, size: ba.size }));
|
|
275
278
|
}
|
|
276
279
|
async getVmDashboard(id, { stream } = {}) {
|
|
277
|
-
const [quickInfo, alarms, lastReplication, { lastRuns,
|
|
280
|
+
const [quickInfo, alarms, lastReplication, { lastRuns, vmProtection }, lastBackupArchives] = await Promise.all([
|
|
278
281
|
promiseWriteInStream({ maybePromise: this.#getDashboardQuickInfo(id), path: 'quickInfo', stream }),
|
|
279
282
|
promiseWriteInStream({ maybePromise: Object.keys(this.getVmAlarms(id)), path: 'alarms', stream }),
|
|
280
283
|
promiseWriteInStream({ maybePromise: this.#getLastReplication(id), path: 'backupsInfo.replication', stream }),
|
|
@@ -290,7 +293,7 @@ export class VmService {
|
|
|
290
293
|
alarms: alarms,
|
|
291
294
|
backupsInfo: {
|
|
292
295
|
lastRuns,
|
|
293
|
-
|
|
296
|
+
vmProtection,
|
|
294
297
|
replication: lastReplication,
|
|
295
298
|
backupArchives: lastBackupArchives,
|
|
296
299
|
},
|
|
@@ -17,10 +17,13 @@ import { badRequestResp, unauthorizedResp } from '../open-api/common/response.co
|
|
|
17
17
|
import { xoaDashboard } from '../open-api/oa-examples/xoa.oa-example.mjs';
|
|
18
18
|
import { XoaService } from './xoa.service.mjs';
|
|
19
19
|
import { NDJSON_CONTENT_TYPE } from '../helpers/utils.helper.mjs';
|
|
20
|
+
import { RestApi } from '../rest-api/rest-api.mjs';
|
|
20
21
|
let XoaController = class XoaController extends Controller {
|
|
22
|
+
#restApi;
|
|
21
23
|
#xoaService;
|
|
22
|
-
constructor(xoaService) {
|
|
24
|
+
constructor(restApi, xoaService) {
|
|
23
25
|
super();
|
|
26
|
+
this.#restApi = restApi;
|
|
24
27
|
this.#xoaService = xoaService;
|
|
25
28
|
}
|
|
26
29
|
async getDashboard(req, ndjson) {
|
|
@@ -45,8 +48,12 @@ let XoaController = class XoaController extends Controller {
|
|
|
45
48
|
timestamp: Date.now(),
|
|
46
49
|
};
|
|
47
50
|
}
|
|
48
|
-
getGuiRoutes() {
|
|
49
|
-
|
|
51
|
+
async getGuiRoutes() {
|
|
52
|
+
const { v5, v6 } = await this.#restApi.xoApp.config.getGuiRoutes();
|
|
53
|
+
return {
|
|
54
|
+
xo5: v5?.url,
|
|
55
|
+
xo6: v6?.url,
|
|
56
|
+
};
|
|
50
57
|
}
|
|
51
58
|
};
|
|
52
59
|
__decorate([
|
|
@@ -72,6 +79,7 @@ XoaController = __decorate([
|
|
|
72
79
|
Security('*'),
|
|
73
80
|
Tags('xoa'),
|
|
74
81
|
provide(XoaController),
|
|
75
|
-
__param(0, inject(
|
|
82
|
+
__param(0, inject(RestApi)),
|
|
83
|
+
__param(1, inject(XoaService))
|
|
76
84
|
], XoaController);
|
|
77
85
|
export { XoaController };
|
package/dist/xoa/xoa.service.mjs
CHANGED
|
@@ -484,21 +484,4 @@ export class XoaService {
|
|
|
484
484
|
vmsStatus,
|
|
485
485
|
};
|
|
486
486
|
}
|
|
487
|
-
getGuiRoutes() {
|
|
488
|
-
const mounts = this.#restApi.xoApp.config.getOptional('http.mounts') ?? {};
|
|
489
|
-
let xo5Mount;
|
|
490
|
-
let xo6Mount;
|
|
491
|
-
for (const [key, value] of Object.entries(mounts)) {
|
|
492
|
-
if (value.includes('xo-web/dist')) {
|
|
493
|
-
xo5Mount = key;
|
|
494
|
-
}
|
|
495
|
-
else if (value.includes('@xen-orchestra/web/dist')) {
|
|
496
|
-
xo6Mount = key;
|
|
497
|
-
}
|
|
498
|
-
}
|
|
499
|
-
return {
|
|
500
|
-
xo5: xo5Mount,
|
|
501
|
-
xo6: xo6Mount,
|
|
502
|
-
};
|
|
503
|
-
}
|
|
504
487
|
}
|
|
@@ -2215,6 +2215,10 @@
|
|
|
2215
2215
|
"type": {
|
|
2216
2216
|
"type": "string"
|
|
2217
2217
|
},
|
|
2218
|
+
"progress": {
|
|
2219
|
+
"type": "number",
|
|
2220
|
+
"format": "double"
|
|
2221
|
+
},
|
|
2218
2222
|
"params": {
|
|
2219
2223
|
"$ref": "#/components/schemas/Record_string.unknown_"
|
|
2220
2224
|
},
|
|
@@ -2311,6 +2315,10 @@
|
|
|
2311
2315
|
"type": {
|
|
2312
2316
|
"type": "string"
|
|
2313
2317
|
},
|
|
2318
|
+
"progress": {
|
|
2319
|
+
"type": "number",
|
|
2320
|
+
"format": "double"
|
|
2321
|
+
},
|
|
2314
2322
|
"params": {
|
|
2315
2323
|
"$ref": "#/components/schemas/Record_string.unknown_"
|
|
2316
2324
|
},
|
|
@@ -2597,8 +2605,13 @@
|
|
|
2597
2605
|
"replication": {
|
|
2598
2606
|
"$ref": "#/components/schemas/Unbrand_VmDashboard-at-backupsInfo_91_replication_93__"
|
|
2599
2607
|
},
|
|
2600
|
-
"
|
|
2601
|
-
"type": "
|
|
2608
|
+
"vmProtection": {
|
|
2609
|
+
"type": "string",
|
|
2610
|
+
"enum": [
|
|
2611
|
+
"protected",
|
|
2612
|
+
"unprotected",
|
|
2613
|
+
"not-in-job"
|
|
2614
|
+
]
|
|
2602
2615
|
},
|
|
2603
2616
|
"lastRuns": {
|
|
2604
2617
|
"items": {
|
|
@@ -2609,7 +2622,7 @@
|
|
|
2609
2622
|
},
|
|
2610
2623
|
"required": [
|
|
2611
2624
|
"backupArchives",
|
|
2612
|
-
"
|
|
2625
|
+
"vmProtection",
|
|
2613
2626
|
"lastRuns"
|
|
2614
2627
|
],
|
|
2615
2628
|
"type": "object"
|
|
@@ -6250,6 +6263,10 @@
|
|
|
6250
6263
|
"type": {
|
|
6251
6264
|
"type": "string"
|
|
6252
6265
|
},
|
|
6266
|
+
"progress": {
|
|
6267
|
+
"type": "number",
|
|
6268
|
+
"format": "double"
|
|
6269
|
+
},
|
|
6253
6270
|
"params": {
|
|
6254
6271
|
"$ref": "#/components/schemas/Record_string.unknown_"
|
|
6255
6272
|
},
|
|
@@ -12004,7 +12021,7 @@
|
|
|
12004
12021
|
},
|
|
12005
12022
|
"info": {
|
|
12006
12023
|
"title": "@xen-orchestra/rest-api",
|
|
12007
|
-
"version": "0.21.
|
|
12024
|
+
"version": "0.21.3",
|
|
12008
12025
|
"description": "REST API to manage your XOA",
|
|
12009
12026
|
"license": {
|
|
12010
12027
|
"name": "AGPL-3.0-or-later"
|
package/package.json
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"main": "./dist/index.mjs",
|
|
7
7
|
"name": "@xen-orchestra/rest-api",
|
|
8
8
|
"homepage": "https://github.com/vatesfr/xen-orchestra/tree/master/@xen-orchestra/rest-api",
|
|
9
|
-
"version": "0.21.
|
|
9
|
+
"version": "0.21.3",
|
|
10
10
|
"description": "REST API to manage your XOA",
|
|
11
11
|
"license": "AGPL-3.0-or-later",
|
|
12
12
|
"private": false,
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"@vates/async-each": "^1.0.1",
|
|
37
37
|
"@vates/task": "^0.6.1",
|
|
38
38
|
"@vates/types": "^1.15.0",
|
|
39
|
-
"@xen-orchestra/backups": "^0.67.
|
|
39
|
+
"@xen-orchestra/backups": "^0.67.1",
|
|
40
40
|
"@xen-orchestra/log": "^0.7.1",
|
|
41
41
|
"@xen-orchestra/xapi": "^8.6.1",
|
|
42
42
|
"complex-matcher": "^1.0.0",
|