Skip to content

Commit

Permalink
Implement improveMaintenanceMode feature flag
Browse files Browse the repository at this point in the history
Signed-off-by: Francesco Torchia <[email protected]>
  • Loading branch information
torchiaf committed Nov 12, 2024
1 parent 927e050 commit a694288
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
3 changes: 2 additions & 1 deletion pkg/harvester/config/feature-flags.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ const featuresV132 = [
'autoRotateRke2CertsSetting',
'supportBundleNodeCollectionTimeoutSetting',
'kubeconfigDefaultTokenTTLMinutesSetting',
'improveMaintenanceMode',
];

// TODO: change to https://github.com/harvester/dashboard/releases/tag/v1.4.0 after v1.4.0 release
Expand All @@ -30,7 +31,7 @@ const featuresV140 = [
'schedulingVMBackup',
'vmSnapshotQuota',
'longhornV2LVMSupport',
'improveMaintainMode',
'improveMaintenanceMode',
];

export const RELEASE_FEATURES = {
Expand Down
14 changes: 12 additions & 2 deletions pkg/harvester/dialog/HarvesterMaintenanceDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ export default {
computed: {
...mapGetters({ t: 'i18n/t' }),
improveMaintenanceModeFeatureEnabled() {
return this.$store.getters['harvester-common/getFeatureEnabled']('improveMaintenanceMode');
},
actionResource() {
return this.resources[0];
},
Expand Down Expand Up @@ -73,8 +77,14 @@ export default {
} else if (res._status === 200 || res._status === 204) {
const res = await this.actionResource.doAction('listUnhealthyVM');
if (res?.length) {
this.unhealthyVMs = res;
let data = res;
if (!this.improveMaintenanceModeFeatureEnabled) {
data = res.message ? [res] : [];
}
if (data?.length) {
this.unhealthyVMs = data;
buttonCb(false);
} else {
await this.actionResource.doAction('enableMaintenanceMode', { force: 'false' });
Expand Down

0 comments on commit a694288

Please sign in to comment.