mirror of
https://github.com/harvester/harvester-ui-extension.git
synced 2026-10-03 20:56:06 +08:00
Latest changes from Harvester master - a537c1ae38eb7030542ac371f24ae3336cd9d422
Signed-off-by: Francesco Torchia <francesco.torchia@suse.com>
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user