From a694288162ed75a20b8760eb470f377b7c81fef3 Mon Sep 17 00:00:00 2001 From: Francesco Torchia Date: Mon, 11 Nov 2024 12:43:42 +0100 Subject: [PATCH] Implement improveMaintenanceMode feature flag Signed-off-by: Francesco Torchia --- pkg/harvester/config/feature-flags.js | 3 ++- .../dialog/HarvesterMaintenanceDialog.vue | 14 ++++++++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/pkg/harvester/config/feature-flags.js b/pkg/harvester/config/feature-flags.js index 6421761b..c6573e6b 100644 --- a/pkg/harvester/config/feature-flags.js +++ b/pkg/harvester/config/feature-flags.js @@ -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 @@ -30,7 +31,7 @@ const featuresV140 = [ 'schedulingVMBackup', 'vmSnapshotQuota', 'longhornV2LVMSupport', - 'improveMaintainMode', + 'improveMaintenanceMode', ]; export const RELEASE_FEATURES = { diff --git a/pkg/harvester/dialog/HarvesterMaintenanceDialog.vue b/pkg/harvester/dialog/HarvesterMaintenanceDialog.vue index 8bb137d1..c5755f40 100644 --- a/pkg/harvester/dialog/HarvesterMaintenanceDialog.vue +++ b/pkg/harvester/dialog/HarvesterMaintenanceDialog.vue @@ -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]; }, @@ -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' });