Latest changes from Harvester master - a537c1ae38eb7030542ac371f24ae3336cd9d422

Signed-off-by: Francesco Torchia <francesco.torchia@suse.com>
This commit is contained in:
Francesco Torchia
2024-10-23 17:01:40 +02:00
parent 2ca86930ad
commit 118aaf16b7
35 changed files with 1484 additions and 93 deletions
@@ -1,6 +1,7 @@
import { get, clone } from '@shell/utils/object';
import { findBy } from '@shell/utils/array';
import { colorForState } from '@shell/plugins/dashboard-store/resource-class';
import { HCI as HCI_ANNOTATIONS } from '@pkg/harvester/config/labels-annotations';
import { _CREATE } from '@shell/config/query-params';
import { HCI } from '../types';
import { PRODUCT_NAME as HARVESTER_PRODUCT } from '../config/harvester';
@@ -18,9 +19,8 @@ export default class HciVmBackup extends HarvesterResource {
get detailLocation() {
const detailLocation = clone(this._detailLocation);
const route = this.currentRoute();
detailLocation.params.resource = route.params.resource;
detailLocation.params.resource = HCI.BACKUP;
return detailLocation;
}
@@ -81,24 +81,30 @@ export default class HciVmBackup extends HarvesterResource {
}
restoreExistingVM(resource = this) {
const route = this.currentRoute();
const router = this.currentRouter();
const targetResource = resource.spec.type === BACKUP_TYPE.BACKUP ? HCI.BACKUP : HCI.VM_SNAPSHOT;
router.push({
name: `${ HARVESTER_PRODUCT }-c-cluster-resource-create`,
params: { resource: route.params.resource },
query: { restoreMode: 'existing', resourceName: resource.name }
params: { resource: targetResource },
query: {
restoreMode: 'existing',
resourceName: resource.name,
}
});
}
restoreNewVM(resource = this) {
const route = this.currentRoute();
const router = this.currentRouter();
const targetResource = resource.spec.type === BACKUP_TYPE.BACKUP ? HCI.BACKUP : HCI.VM_SNAPSHOT;
router.push({
name: `${ HARVESTER_PRODUCT }-c-cluster-resource-create`,
params: { resource: route.params.resource },
query: { restoreMode: 'new', resourceName: resource.name }
params: { resource: targetResource },
query: {
restoreMode: 'new',
resourceName: resource.name,
}
});
}
@@ -125,6 +131,10 @@ export default class HciVmBackup extends HarvesterResource {
return colorForState(state);
}
get sourceSchedule() {
return this.metadata?.annotations[HCI_ANNOTATIONS.SVM_BACKUP_ID];
}
get attachVM() {
return this.spec.source.name;
}