Fix bug where flyout state was not reset (#111662)
This PR fixes a bug in both App Search and Workplace Search where the role mappings flyout state was not being cleared when updating a role mapping. The issue is that the state of the flyout is determined by the existence of a role mapping and this was not being cleared when the role mapping was saved.
This commit is contained in:
parent
72dfb9c7e3
commit
a045c8ab4a
|
@ -418,6 +418,16 @@ describe('RoleMappingsLogic', () => {
|
|||
|
||||
expect(flashAPIErrors).toHaveBeenCalledWith('this is an error');
|
||||
});
|
||||
|
||||
it('resets roleMapping state', () => {
|
||||
mount({
|
||||
...mappingsServerProps,
|
||||
roleMapping: asRoleMapping,
|
||||
});
|
||||
RoleMappingsLogic.actions.initializeRoleMappings();
|
||||
|
||||
expect(RoleMappingsLogic.values.roleMapping).toEqual(null);
|
||||
});
|
||||
});
|
||||
|
||||
describe('initializeRoleMapping', () => {
|
||||
|
|
|
@ -178,6 +178,7 @@ export const RoleMappingsLogic = kea<MakeLogicType<RoleMappingsValues, RoleMappi
|
|||
null,
|
||||
{
|
||||
setRoleMapping: (_, { roleMapping }) => roleMapping,
|
||||
initializeRoleMappings: () => null,
|
||||
resetState: () => null,
|
||||
closeUsersAndRolesFlyout: () => null,
|
||||
},
|
||||
|
|
|
@ -376,6 +376,16 @@ describe('RoleMappingsLogic', () => {
|
|||
|
||||
expect(flashAPIErrors).toHaveBeenCalledWith('this is an error');
|
||||
});
|
||||
|
||||
it('resets roleMapping state', () => {
|
||||
mount({
|
||||
...mappingsServerProps,
|
||||
roleMapping: wsRoleMapping,
|
||||
});
|
||||
RoleMappingsLogic.actions.initializeRoleMappings();
|
||||
|
||||
expect(RoleMappingsLogic.values.roleMapping).toEqual(null);
|
||||
});
|
||||
});
|
||||
|
||||
describe('initializeRoleMapping', () => {
|
||||
|
|
|
@ -168,6 +168,7 @@ export const RoleMappingsLogic = kea<MakeLogicType<RoleMappingsValues, RoleMappi
|
|||
null,
|
||||
{
|
||||
setRoleMapping: (_, { roleMapping }) => roleMapping,
|
||||
initializeRoleMappings: () => null,
|
||||
resetState: () => null,
|
||||
closeUsersAndRolesFlyout: () => null,
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue