mirror of
https://github.com/ceph/ceph
synced 2025-02-24 19:47:44 +00:00
mgr/dashboard: fix disable action for MGR modules
Fixes: https://tracker.ceph.com/issues/47947 Signed-off-by: Kiefer Chang <kiefer.chang@suse.com>
This commit is contained in:
parent
0acdb82146
commit
d8c393bafa
@ -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.');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -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.`;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user