mirror of
https://github.com/harvester/harvester-ui-extension.git
synced 2026-10-01 03:36:04 +08:00
feat: support advance option and creation from DataVolume (#776)
* feat: support advance option and creation from DataVolume
- advance option would let user change the accessMode/volumeMode
- creation from DataVolume could supports various scenario with
3rd-party storage
Signed-off-by: Vicente Cheng <freeze.bilsted@gmail.com>
* feat: add data migration action on volume page
Signed-off-by: Vicente Cheng <freeze.bilsted@gmail.com>
* refactor: use show advanced options link instead of checkbox
Signed-off-by: Andy Lee <andy.lee@suse.com>
* feat: add feature flag
Signed-off-by: Andy Lee <andy.lee@suse.com>
* feat: add feature flag for dataMigration action
Signed-off-by: Andy Lee <andy.lee@suse.com>
---------
Signed-off-by: Vicente Cheng <freeze.bilsted@gmail.com>
Signed-off-by: Andy Lee <andy.lee@suse.com>
Co-authored-by: Andy Lee <andy.lee@suse.com>
This commit is contained in:
@@ -9,6 +9,7 @@ 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 { CDI_POPULATOR_KIND } from '../../config/types';
|
||||
import { LVM_DRIVER } from './storage.k8s.io.storageclass';
|
||||
|
||||
const DEGRADED_ERRORS = ['replica scheduling failed', 'precheck new replica failed'];
|
||||
@@ -44,7 +45,7 @@ export default class HciPv extends HarvesterResource {
|
||||
const exportImageAction = {
|
||||
action: 'exportImage',
|
||||
enabled: this.hasAction('export') && !this.isEncrypted,
|
||||
icon: 'icon icon-copy',
|
||||
icon: 'icon icon-external-link',
|
||||
label: this.t('harvester.action.exportImage')
|
||||
};
|
||||
const takeSnapshotAction = {
|
||||
@@ -77,10 +78,23 @@ export default class HciPv extends HarvesterResource {
|
||||
icon: 'icon icon-backup',
|
||||
label: this.t('harvester.action.cancelExpand')
|
||||
},
|
||||
{
|
||||
action: 'dataMigration',
|
||||
enabled: this.hasAction('dataMigration') && this.createPVCWithDataVolumeFeatureEnabled,
|
||||
icon: 'icon icon-copy',
|
||||
label: this.t('harvester.action.dataMigration')
|
||||
},
|
||||
...out
|
||||
];
|
||||
}
|
||||
|
||||
dataMigration(resources = this) {
|
||||
this.$dispatch('promptModal', {
|
||||
resources,
|
||||
component: 'HarvesterDataMigrationDialog'
|
||||
});
|
||||
}
|
||||
|
||||
exportImage(resources = this) {
|
||||
this.$dispatch('promptModal', {
|
||||
resources,
|
||||
@@ -339,10 +353,20 @@ export default class HciPv extends HarvesterResource {
|
||||
return this?.metadata?.annotations?.[HCI_ANNOTATIONS.GOLDEN_IMAGE] === 'true';
|
||||
}
|
||||
|
||||
get isCDIPopulatorVolume() {
|
||||
const kind = this?.metadata?.annotations?.[HCI_ANNOTATIONS.CDI_POPULATOR_KIND];
|
||||
|
||||
return kind === CDI_POPULATOR_KIND.VOLUME_IMPORT_SOURCE || kind === CDI_POPULATOR_KIND.VOLUME_CLONE_SOURCE;
|
||||
}
|
||||
|
||||
get thirdPartyStorageFeatureEnabled() {
|
||||
return this.$rootGetters['harvester-common/getFeatureEnabled']('thirdPartyStorage');
|
||||
}
|
||||
|
||||
get createPVCWithDataVolumeFeatureEnabled() {
|
||||
return this.$rootGetters['harvester-common/getFeatureEnabled']('createPVCWithDataVolume');
|
||||
}
|
||||
|
||||
get resourceExternalLink() {
|
||||
const host = window.location.host;
|
||||
const { params } = this.currentRoute();
|
||||
|
||||
Reference in New Issue
Block a user