mirror of
https://github.com/harvester/harvester-ui-extension.git
synced 2026-10-01 03:36:04 +08:00
add feature flag config
This commit is contained in:
@@ -14,8 +14,8 @@ import { findBy, isArray } from '@shell/utils/array';
|
||||
import { ucFirst } from '@shell/utils/string';
|
||||
import HarvesterResource from '../harvester';
|
||||
import { PRODUCT_NAME as HARVESTER_PRODUCT } from '../../config/harvester';
|
||||
|
||||
import { HCI } from '../../types';
|
||||
import { featureEnabled } from '../../utils/server';
|
||||
|
||||
const ALLOW_SYSTEM_LABEL_KEYS = [
|
||||
'topology.kubernetes.io/zone',
|
||||
@@ -61,7 +61,7 @@ export default class HciNode extends HarvesterResource {
|
||||
|
||||
const enableCPUManager = {
|
||||
action: 'enableCPUManager',
|
||||
enabled: this.hasAction('enableCPUManager') && !this.isCPUManagerEnableInProgress && !this.isCPUManagerEnabled && !this.isEtcd, // witness node doesn't have CPU manager
|
||||
enabled: this.cpuPinningFeatureEnabled && this.hasAction('enableCPUManager') && !this.isCPUManagerEnableInProgress && !this.isCPUManagerEnabled && !this.isEtcd, // witness node doesn't have CPU manager
|
||||
icon: 'icon icon-fw icon-os-management',
|
||||
label: this.t('harvester.action.enableCPUManager'),
|
||||
total: 1
|
||||
@@ -69,7 +69,7 @@ export default class HciNode extends HarvesterResource {
|
||||
|
||||
const disableCPUManager = {
|
||||
action: 'disableCPUManager',
|
||||
enabled: this.hasAction('disableCPUManager') && !this.isCPUManagerEnableInProgress && this.isCPUManagerEnabled && !this.isEtcd,
|
||||
enabled: this.cpuPinningFeatureEnabled && this.hasAction('disableCPUManager') && !this.isCPUManagerEnableInProgress && this.isCPUManagerEnabled && !this.isEtcd,
|
||||
icon: 'icon icon-fw icon-os-management',
|
||||
label: this.t('harvester.action.disableCPUManager'),
|
||||
total: 1
|
||||
@@ -370,6 +370,10 @@ export default class HciNode extends HarvesterResource {
|
||||
);
|
||||
}
|
||||
|
||||
get cpuPinningFeatureEnabled() {
|
||||
return featureEnabled(this.$rootGetters, 'cpuPinning');
|
||||
}
|
||||
|
||||
get isCPUManagerEnabled() {
|
||||
return this.metadata?.labels?.[HCI_ANNOTATIONS.CPU_MANAGER] === 'true';
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ 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/server';
|
||||
|
||||
export const OFF = 'Off';
|
||||
|
||||
@@ -480,6 +481,10 @@ export default class VirtVm extends HarvesterResource {
|
||||
return null;
|
||||
}
|
||||
|
||||
get cpuPinningFeatureEnabled() {
|
||||
return featureEnabled(this.$rootGetters, 'cpuPinning');
|
||||
}
|
||||
|
||||
get isCpuPinning() {
|
||||
return this.spec?.template?.spec?.domain?.cpu?.dedicatedCpuPlacement === true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user