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:
Scotty Bollinger 2021-09-09 09:50:14 -05:00 committed by GitHub
parent 72dfb9c7e3
commit a045c8ab4a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 22 additions and 0 deletions

View file

@ -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', () => {

View file

@ -178,6 +178,7 @@ export const RoleMappingsLogic = kea<MakeLogicType<RoleMappingsValues, RoleMappi
null,
{
setRoleMapping: (_, { roleMapping }) => roleMapping,
initializeRoleMappings: () => null,
resetState: () => null,
closeUsersAndRolesFlyout: () => null,
},

View file

@ -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', () => {

View file

@ -168,6 +168,7 @@ export const RoleMappingsLogic = kea<MakeLogicType<RoleMappingsValues, RoleMappi
null,
{
setRoleMapping: (_, { roleMapping }) => roleMapping,
initializeRoleMappings: () => null,
resetState: () => null,
closeUsersAndRolesFlyout: () => null,
},