Skip to content

Commit

Permalink
Update role mappings create/update/delete success messages
Browse files Browse the repository at this point in the history
- to use a toast instead of a callout
- update copy to match EUI guidelines
  • Loading branch information
cee-chen committed Jun 26, 2021
1 parent 8f5957c commit 2dc4826
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,21 @@ import { AdvanceRoleType } from '../../types';
export const ROLE_MAPPING_DELETED_MESSAGE = i18n.translate(
'xpack.enterpriseSearch.appSearch.roleMappingDeletedMessage',
{
defaultMessage: 'Successfully deleted role mapping',
defaultMessage: 'Your role mapping was deleted',
}
);

export const ROLE_MAPPING_CREATED_MESSAGE = i18n.translate(
'xpack.enterpriseSearch.appSearch.roleMappingCreatedMessage',
{
defaultMessage: 'Role mapping successfully created.',
defaultMessage: 'Your role mapping was created',
}
);

export const ROLE_MAPPING_UPDATED_MESSAGE = i18n.translate(
'xpack.enterpriseSearch.appSearch.roleMappingUpdatedMessage',
{
defaultMessage: 'Role mapping successfully updated.',
defaultMessage: 'Your role mapping was updated',
}
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const emptyUser = { username: '', email: '' };

describe('RoleMappingsLogic', () => {
const { http } = mockHttpValues;
const { clearFlashMessages, flashAPIErrors, setSuccessMessage } = mockFlashMessageHelpers;
const { clearFlashMessages, flashAPIErrors, flashSuccessToast } = mockFlashMessageHelpers;
const { mount } = new LogicMounter(RoleMappingsLogic);
const DEFAULT_VALUES = {
attributes: [],
Expand Down Expand Up @@ -519,7 +519,7 @@ describe('RoleMappingsLogic', () => {
await nextTick();

expect(initializeRoleMappingsSpy).toHaveBeenCalled();
expect(setSuccessMessage).toHaveBeenCalled();
expect(flashSuccessToast).toHaveBeenCalled();
});

it('sends array when "accessAllEngines" is false', () => {
Expand Down Expand Up @@ -670,7 +670,7 @@ describe('RoleMappingsLogic', () => {
await nextTick();

expect(initializeRoleMappingsSpy).toHaveBeenCalled();
expect(setSuccessMessage).toHaveBeenCalled();
expect(flashSuccessToast).toHaveBeenCalled();
});

it('handles error', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { kea, MakeLogicType } from 'kea';
import {
clearFlashMessages,
flashAPIErrors,
setSuccessMessage,
flashSuccessToast,
} from '../../../shared/flash_messages';
import { HttpLogic } from '../../../shared/http';
import {
Expand Down Expand Up @@ -396,7 +396,7 @@ export const RoleMappingsLogic = kea<MakeLogicType<RoleMappingsValues, RoleMappi
try {
await http.delete(route);
actions.initializeRoleMappings();
setSuccessMessage(ROLE_MAPPING_DELETED_MESSAGE);
flashSuccessToast(ROLE_MAPPING_DELETED_MESSAGE);
} catch (e) {
flashAPIErrors(e);
}
Expand Down Expand Up @@ -435,7 +435,7 @@ export const RoleMappingsLogic = kea<MakeLogicType<RoleMappingsValues, RoleMappi
try {
await request;
actions.initializeRoleMappings();
setSuccessMessage(SUCCESS_MESSAGE);
flashSuccessToast(SUCCESS_MESSAGE);
} catch (e) {
actions.setRoleMappingErrors(e?.body?.attributes?.errors);
}
Expand Down

0 comments on commit 2dc4826

Please sign in to comment.