From c4a64ed9a1c36737f330e7605b15a0264c687b32 Mon Sep 17 00:00:00 2001 From: Afreen Misbah Date: Fri, 11 Jul 2025 02:45:08 +0530 Subject: [PATCH] mgr/dashboard: Fix smb module enablement - changed prop name to `module_name` to avoid confusion while pasisng input props - the module name is required to enable module Signed-off-by: Afreen Misbah (cherry picked from commit 8f2a88eb4dd8e779044e7cd5b48c90f290303912) --- .../dashboard/frontend/src/app/app-routing.module.ts | 2 +- .../frontend/src/app/core/error/error.component.html | 4 ++-- .../frontend/src/app/core/error/error.component.ts | 11 +++-------- .../shared/services/module-status-guard.service.ts | 2 +- 4 files changed, 7 insertions(+), 12 deletions(-) diff --git a/src/pybind/mgr/dashboard/frontend/src/app/app-routing.module.ts b/src/pybind/mgr/dashboard/frontend/src/app/app-routing.module.ts index c8f9de71e022c..fc2dd0b561099 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/app-routing.module.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/app-routing.module.ts @@ -446,7 +446,7 @@ const routes: Routes = [ uiApiPath: 'smb', redirectTo: 'error', header: 'SMB module is not enabled', - button_to_enable_module: 'smb', + module_name: 'smb', navigate_to: 'cephfs/smb' }, breadcrumbs: 'File/SMB' diff --git a/src/pybind/mgr/dashboard/frontend/src/app/core/error/error.component.html b/src/pybind/mgr/dashboard/frontend/src/app/core/error/error.component.html index d82e122ff0ea8..6bcb216c4c8c3 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/core/error/error.component.html +++ b/src/pybind/mgr/dashboard/frontend/src/app/core/error/error.component.html @@ -69,9 +69,9 @@
+ *ngIf="module_name && !(buttonName && buttonRoute)"> + i18n>Enable {{ module_name | upperFirst }} module
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/core/error/error.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/core/error/error.component.ts index 4ade21c832dd9..f1d3a5a65d811 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/core/error/error.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/core/error/error.component.ts @@ -32,7 +32,7 @@ export class ErrorComponent implements OnDestroy, OnInit { secondaryButtonRoute: string; secondaryButtonName: string; secondaryButtonTitle: string; - buttonToEnableModule: string; + module_name: string; navigateTo: string; component: string; @@ -91,7 +91,7 @@ export class ErrorComponent implements OnDestroy, OnInit { this.secondaryButtonRoute = history.state.secondary_button_route; this.secondaryButtonName = history.state.secondary_button_name; this.secondaryButtonTitle = history.state.secondary_button_title; - this.buttonToEnableModule = history.state.button_to_enable_module; + this.module_name = history.state.module_name; this.navigateTo = history.state.navigate_to; this.component = history.state.component; this.docUrl = this.docService.urlGenerator(this.section); @@ -107,11 +107,6 @@ export class ErrorComponent implements OnDestroy, OnInit { } enableModule(): void { - this.mgrModuleService.updateModuleState( - this.buttonToEnableModule, - false, - null, - this.navigateTo - ); + this.mgrModuleService.updateModuleState(this.module_name, false, null, this.navigateTo); } } diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/module-status-guard.service.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/module-status-guard.service.ts index e828a5ba523cf..5c7eee256db40 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/module-status-guard.service.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/module-status-guard.service.ts @@ -86,7 +86,7 @@ export class ModuleStatusGuardService { secondary_button_name: config.secondary_button_name, secondary_button_route: config.secondary_button_route, secondary_button_title: config.secondary_button_title, - button_to_enable_module: config.button_to_enable_module, + module_name: config.module_name, navigate_to: config.navigate_to, uiConfig: config.uiConfig, uiApiPath: config.uiApiPath, -- 2.39.5