diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/mgr-modules/mgr-module-list/mgr-module-list.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/mgr-modules/mgr-module-list/mgr-module-list.component.spec.ts index f340bd83264..46f633487ac 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/mgr-modules/mgr-module-list/mgr-module-list.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/mgr-modules/mgr-module-list/mgr-module-list.component.spec.ts @@ -129,23 +129,27 @@ describe('MgrModuleListComponent', () => { expect(component.table.refreshBtn).toHaveBeenCalled(); })); - it('should not disable module (1)', () => { + it.only('should not disable module without selecting one', () => { + expect(component.getTableActionDisabledDesc()).toBeTruthy(); + }); + + it('should not disable dashboard module', () => { component.selection.selected = [ { name: 'dashboard' } ]; - expect(component.isTableActionDisabled('enabled')).toBeTruthy(); + expect(component.getTableActionDisabledDesc()).toBeTruthy(); }); - it('should not disable module (2)', () => { + it('should not disable an always-on module', () => { component.selection.selected = [ { name: 'bar', always_on: true } ]; - expect(component.isTableActionDisabled('enabled')).toBeTruthy(); + expect(component.getTableActionDisabledDesc()).toBe('This Manager module is always on.'); }); }); }); diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/mgr-modules/mgr-module-list/mgr-module-list.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/mgr-modules/mgr-module-list/mgr-module-list.component.ts index 3e75ab9792b..636f1317041 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/mgr-modules/mgr-module-list/mgr-module-list.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/mgr-modules/mgr-module-list/mgr-module-list.component.ts @@ -88,7 +88,7 @@ export class MgrModuleListComponent extends ListWithDetails { name: $localize`Disable`, permission: 'update', click: () => this.updateModuleState(), - disable: () => () => this.getTableActionDisabledDesc(), + disable: () => this.getTableActionDisabledDesc(), icon: Icons.stop } ]; @@ -139,7 +139,7 @@ export class MgrModuleListComponent extends ListWithDetails { } getTableActionDisabledDesc(): string | boolean { - if (this.selection.first().always_on) { + if (this.selection.first()?.always_on) { return $localize`This Manager module is always on.`; }