mirror of
https://github.com/harvester/harvester-ui-extension.git
synced 2026-10-01 03:36:04 +08:00
Latest changes from Harvester master - e6796a6fc0cffe03f47f6081c09469d59b97faf9
Signed-off-by: Francesco Torchia <francesco.torchia@suse.com>
This commit is contained in:
@@ -9,11 +9,13 @@ import { colorForState } from '@shell/plugins/dashboard-store/resource-class';
|
||||
import { HCI, VOLUME_SNAPSHOT } from '../../types';
|
||||
import HarvesterResource from '../harvester';
|
||||
import { PRODUCT_NAME as HARVESTER_PRODUCT } from '../../config/harvester';
|
||||
|
||||
import { DATA_ENGINE_V2 } from '../../edit/harvesterhci.io.storage/index.vue';
|
||||
import { LVM_DRIVER } from './storage.k8s.io.storageclass';
|
||||
|
||||
const DEGRADED_ERRORS = ['replica scheduling failed', 'precheck new replica failed'];
|
||||
|
||||
export const DATA_ENGINE_V1 = 'v1';
|
||||
export const DATA_ENGINE_V2 = 'v2';
|
||||
|
||||
export default class HciPv extends HarvesterResource {
|
||||
applyDefaults(_, realMode) {
|
||||
const accessModes = realMode === _CLONE ? this.spec.accessModes : [];
|
||||
@@ -34,7 +36,7 @@ export default class HciPv extends HarvesterResource {
|
||||
let out = super._availableActions;
|
||||
|
||||
// Longhorn V2 provisioner do not support volume clone feature yet
|
||||
if (this.storageClass.longhornVersion === DATA_ENGINE_V2) {
|
||||
if (this.isLonghornV2) {
|
||||
out = out.filter((action) => action.action !== 'goToClone');
|
||||
} else {
|
||||
const clone = out.find((action) => action.action === 'goToClone');
|
||||
@@ -44,7 +46,7 @@ export default class HciPv extends HarvesterResource {
|
||||
}
|
||||
}
|
||||
|
||||
if (this.storageClass.provisioner !== LONGHORN_DRIVER || this.storageClass.longhornVersion !== DATA_ENGINE_V2) {
|
||||
if (!this.isLonghorn || !this.isLonghornV2) {
|
||||
out = [
|
||||
{
|
||||
action: 'exportImage',
|
||||
@@ -303,6 +305,26 @@ export default class HciPv extends HarvesterResource {
|
||||
return this.$rootGetters['harvester/all'](PV).find((pv) => pv.metadata?.name === this.spec?.volumeName);
|
||||
}
|
||||
|
||||
get volumeProvider() {
|
||||
return this.relatedPV?.spec.csi?.driver;
|
||||
}
|
||||
|
||||
get dataEngine() {
|
||||
return this.relatedPV?.spec.csi?.volumeAttributes?.dataEngine;
|
||||
}
|
||||
|
||||
get isLvm() {
|
||||
return this.volumeProvider === LVM_DRIVER;
|
||||
}
|
||||
|
||||
get isLonghorn() {
|
||||
return this.volumeProvider === LONGHORN_DRIVER;
|
||||
}
|
||||
|
||||
get isLonghornV2() {
|
||||
return this.dataEngine === DATA_ENGINE_V2;
|
||||
}
|
||||
|
||||
get resourceExternalLink() {
|
||||
const host = window.location.host;
|
||||
const { params } = this.currentRoute();
|
||||
|
||||
@@ -3,7 +3,7 @@ import StorageClass from '@shell/models/storage.k8s.io.storageclass';
|
||||
import { HCI } from '../../types';
|
||||
import { PRODUCT_NAME as HARVESTER_PRODUCT } from '../../config/harvester';
|
||||
import { LONGHORN_DRIVER } from '@shell/config/types';
|
||||
import { DATA_ENGINE_V1, DATA_ENGINE_V2 } from '../../edit/harvesterhci.io.storage/index.vue';
|
||||
import { DATA_ENGINE_V1, DATA_ENGINE_V2 } from '../../models/harvester/persistentvolumeclaim';
|
||||
|
||||
export const LVM_DRIVER = 'lvm.driver.harvesterhci.io';
|
||||
|
||||
@@ -55,7 +55,7 @@ export default class HciStorageClass extends StorageClass {
|
||||
key = `harvester.storage.storageClass.lvm.label`;
|
||||
}
|
||||
|
||||
return this.$rootGetters['i18n/t'](key);
|
||||
return key ? this.$rootGetters['i18n/t'](key) : null;
|
||||
}
|
||||
|
||||
get isLonghornV2() {
|
||||
|
||||
@@ -13,7 +13,6 @@ import { parseVolumeClaimTemplates } from '@pkg/utils/vm';
|
||||
import { BACKUP_TYPE } from '../config/types';
|
||||
import { HCI } from '../types';
|
||||
import HarvesterResource from './harvester';
|
||||
import { LVM_DRIVER } from './harvester/storage.k8s.io.storageclass';
|
||||
import { featureEnabled } from '../utils/feature-flags';
|
||||
|
||||
export const OFF = 'Off';
|
||||
@@ -613,11 +612,11 @@ export default class VirtVm extends HarvesterResource {
|
||||
}
|
||||
|
||||
get lvmVolumes() {
|
||||
return this.volumes.filter((volume) => volume.storageClass.provisioner === LVM_DRIVER);
|
||||
return this.volumes.filter((volume) => volume?.isLvm);
|
||||
}
|
||||
|
||||
get longhornV2Volumes() {
|
||||
return this.volumes.filter((volume) => volume.storageClass.isLonghornV2);
|
||||
return this.volumes.filter((volume) => volume?.isLonghornV2);
|
||||
}
|
||||
|
||||
get encryptedVolumeType() {
|
||||
|
||||
Reference in New Issue
Block a user