mirror of
https://github.com/harvester/harvester-ui-extension.git
synced 2026-10-01 03:36:04 +08:00
refactor: extract access mode strings to static ACCESS_MODE constant (#1039)
* refactor: extract access mode strings to static ACCESS_MODE constant Signed-off-by: Andy Lee <andy.lee@suse.com> * refactor: destructure ACCESS_MODE variables in CDISettings.vue accessModeOptions * refactor: destructure ACCESS_MODE at top level in all consumer files * fix(lint): reorder imports to top of module in CDISettings, harvesterhci.io.volume, and VirtualMachineVolume --------- Signed-off-by: Andy Lee <andy.lee@suse.com> Co-authored-by: Andy Lee <andy.lee@suse.com> Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -25,7 +25,9 @@ import { HCI } from '../../types';
|
||||
import { parseVolumeClaimTemplates, EMPTY_IMAGE } from '../../utils/vm';
|
||||
import impl, { QGA_JSON, USB_TABLET } from './impl';
|
||||
import { GIBIBYTE } from '../../utils/unit';
|
||||
import { VOLUME_MODE, FILESYSTEM_SOURCE_TYPE } from '@pkg/harvester/config/types';
|
||||
import { VOLUME_MODE, ACCESS_MODE, FILESYSTEM_SOURCE_TYPE } from '@pkg/harvester/config/types';
|
||||
|
||||
const { READ_WRITE_MANY } = ACCESS_MODE;
|
||||
|
||||
const LONGHORN_V2_DATA_ENGINE = 'longhorn-system/v2-data-engine';
|
||||
|
||||
@@ -276,7 +278,7 @@ export default {
|
||||
},
|
||||
|
||||
customAccessMode() {
|
||||
return this.storageClassSetting.accessModes || 'ReadWriteMany';
|
||||
return this.storageClassSetting.accessModes || READ_WRITE_MANY;
|
||||
},
|
||||
|
||||
isWindows() {
|
||||
@@ -504,7 +506,7 @@ export default {
|
||||
id: randomStr(5),
|
||||
source: SOURCE_TYPE.IMAGE,
|
||||
name: 'disk-0',
|
||||
accessMode: 'ReadWriteMany', // root disk only support LHv1 volume, should be RWX
|
||||
accessMode: READ_WRITE_MANY, // root disk only support LHv1 volume, should be RWX
|
||||
bus,
|
||||
volumeName: '',
|
||||
size,
|
||||
@@ -570,7 +572,7 @@ export default {
|
||||
const pvcResource = allPVCs.find( (O) => O.id === `${ namespace }/${ volume?.persistentVolumeClaim?.claimName }`);
|
||||
|
||||
source = SOURCE_TYPE.ATTACH_VOLUME;
|
||||
accessMode = pvcResource?.spec?.accessModes?.[0] || 'ReadWriteMany';
|
||||
accessMode = pvcResource?.spec?.accessModes?.[0] || READ_WRITE_MANY;
|
||||
size = pvcResource?.spec?.resources?.requests?.storage || '10Gi';
|
||||
storageClassName = pvcResource?.spec?.storageClassName;
|
||||
volumeMode = pvcResource?.spec?.volumeMode || VOLUME_MODE.BLOCK;
|
||||
|
||||
Reference in New Issue
Block a user