Skip to content

Commit

Permalink
[Drilldowns] Copy improvements (#65838)
Browse files Browse the repository at this point in the history
* update toast messages

* update HelloBar text

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
  • Loading branch information
Dosant and elasticmachine authored May 11, 2020
1 parent e148eb4 commit ae38c6b
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 46 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -289,8 +289,8 @@ function useDrilldownsStateManager(
await run(async () => {
await actionManager.createEvent(action, selectedTriggers);
notifications.toasts.addSuccess({
title: toastDrilldownCreated.title,
text: toastDrilldownCreated.text(action.name),
title: toastDrilldownCreated.title(action.name),
text: toastDrilldownCreated.text,
});
});
}
Expand All @@ -303,8 +303,8 @@ function useDrilldownsStateManager(
await run(async () => {
await actionManager.updateEvent(drilldownId, action, selectedTriggers);
notifications.toasts.addSuccess({
title: toastDrilldownEdited.title,
text: toastDrilldownEdited.text(action.name),
title: toastDrilldownEdited.title(action.name),
text: toastDrilldownEdited.text,
});
});
}
Expand All @@ -320,8 +320,8 @@ function useDrilldownsStateManager(
text: toastDrilldownDeleted.text,
}
: {
title: toastDrilldownsDeleted.title,
text: toastDrilldownsDeleted.text(drilldownIds.length),
title: toastDrilldownsDeleted.title(drilldownIds.length),
text: toastDrilldownsDeleted.text,
}
);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,35 +7,41 @@
import { i18n } from '@kbn/i18n';

export const toastDrilldownCreated = {
title: i18n.translate(
'xpack.drilldowns.components.flyoutDrilldownWizard.toast.drilldownCreatedTitle',
title: (drilldownName: string) =>
i18n.translate(
'xpack.drilldowns.components.flyoutDrilldownWizard.toast.drilldownCreatedTitle',
{
defaultMessage: 'Drilldown "{drilldownName}" created',
values: {
drilldownName,
},
}
),
text: i18n.translate(
'xpack.drilldowns.components.flyoutDrilldownWizard.toast.drilldownCreatedText',
{
defaultMessage: 'Drilldown created',
// TODO: remove `Save your dashboard before testing.` part
// when drilldowns are used not only in dashboard
// or after https://github.com/elastic/kibana/issues/65179 implemented
defaultMessage: 'Save your dashboard before testing.',
}
),
text: (drilldownName: string) =>
i18n.translate('xpack.drilldowns.components.flyoutDrilldownWizard.toast.drilldownCreatedText', {
defaultMessage: 'You created "{drilldownName}". Save dashboard before testing.',
values: {
drilldownName,
},
}),
};

export const toastDrilldownEdited = {
title: i18n.translate(
'xpack.drilldowns.components.flyoutDrilldownWizard.toast.drilldownEditedTitle',
{
defaultMessage: 'Drilldown edited',
}
),
text: (drilldownName: string) =>
i18n.translate('xpack.drilldowns.components.flyoutDrilldownWizard.toast.drilldownEditedText', {
defaultMessage: 'You edited "{drilldownName}". Save dashboard before testing.',
title: (drilldownName: string) =>
i18n.translate('xpack.drilldowns.components.flyoutDrilldownWizard.toast.drilldownEditedTitle', {
defaultMessage: 'Drilldown "{drilldownName}" updated',
values: {
drilldownName,
},
}),
text: i18n.translate(
'xpack.drilldowns.components.flyoutDrilldownWizard.toast.drilldownEditedText',
{
defaultMessage: 'Save your dashboard before testing.',
}
),
};

export const toastDrilldownDeleted = {
Expand All @@ -48,28 +54,26 @@ export const toastDrilldownDeleted = {
text: i18n.translate(
'xpack.drilldowns.components.flyoutDrilldownWizard.toast.drilldownDeletedText',
{
defaultMessage: 'You deleted a drilldown.',
defaultMessage: 'Save your dashboard before testing.',
}
),
};

export const toastDrilldownsDeleted = {
title: i18n.translate(
'xpack.drilldowns.components.flyoutDrilldownWizard.toast.drilldownsDeletedTitle',
{
defaultMessage: 'Drilldowns deleted',
}
),
text: (n: number) =>
title: (n: number) =>
i18n.translate(
'xpack.drilldowns.components.flyoutDrilldownWizard.toast.drilldownsDeletedText',
'xpack.drilldowns.components.flyoutDrilldownWizard.toast.drilldownsDeletedTitle',
{
defaultMessage: 'You deleted {n} drilldowns',
values: {
n,
},
defaultMessage: '{n} drilldowns deleted',
values: { n },
}
),
text: i18n.translate(
'xpack.drilldowns.components.flyoutDrilldownWizard.toast.drilldownsDeletedText',
{
defaultMessage: 'Save your dashboard before testing.',
}
),
};

export const toastDrilldownsCRUDError = i18n.translate(
Expand All @@ -79,10 +83,3 @@ export const toastDrilldownsCRUDError = i18n.translate(
description: 'Title for generic error toast when persisting drilldown updates failed',
}
);

export const toastDrilldownsFetchError = i18n.translate(
'xpack.drilldowns.components.flyoutDrilldownWizard.toast.drilldownsFetchErrorTitle',
{
defaultMessage: 'Error fetching drilldowns',
}
);
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export const txtHelpText = i18n.translate(
'xpack.drilldowns.components.DrilldownHelloBar.helpText',
{
defaultMessage:
'Drilldowns provide the ability to define a new behavior when interacting with a panel. You can add multiple options or simply override the default filtering behavior.',
'Drilldowns enable you to define new behaviors for interacting with panels. You can add multiple actions and override the default filter.',
}
);

Expand Down

0 comments on commit ae38c6b

Please sign in to comment.