Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Align top menus to new header design #78332

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ export function getTopNavConfig(
getShareConfig(actions[TopNavIds.SHARE]),
]
: [
getEditConfig(actions[TopNavIds.ENTER_EDIT_MODE]),
getFullScreenConfig(actions[TopNavIds.FULL_SCREEN]),
getShareConfig(actions[TopNavIds.SHARE]),
getCloneConfig(actions[TopNavIds.CLONE]),
getEditConfig(actions[TopNavIds.ENTER_EDIT_MODE]),
];
case ViewMode.EDIT:
return [
Expand Down Expand Up @@ -80,6 +80,7 @@ function getFullScreenConfig(action: NavAction) {
function getEditConfig(action: NavAction) {
return {
id: 'edit',
iconType: 'pencil',
label: i18n.translate('dashboard.topNave.editButtonAriaLabel', {
defaultMessage: 'edit',
}),
Expand Down Expand Up @@ -167,9 +168,8 @@ function getAddConfig(action: NavAction) {
*/
function getCreateNewConfig(action: NavAction) {
return {
emphasize: true,
iconType: 'plusInCircle',
id: 'addNew',
iconType: 'plusInCircleFilled',
label: i18n.translate('dashboard.topNave.addNewButtonAriaLabel', {
defaultMessage: 'Create new',
}),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,7 @@ export const getTopNavConfig = (
label: i18n.translate('visualize.topNavMenu.saveAndReturnVisualizationButtonLabel', {
defaultMessage: 'Save and return',
}),
emphasize: true,
iconType: 'check',
iconType: 'checkInCircleFilled',
description: i18n.translate(
'visualize.topNavMenu.saveAndReturnVisualizationButtonAriaLabel',
{
Expand Down Expand Up @@ -223,6 +222,7 @@ export const getTopNavConfig = (
? [
{
id: 'save',
iconType: savedVis?.id && originatingApp ? undefined : 'save',
label:
savedVis?.id && originatingApp
? i18n.translate('visualize.topNavMenu.saveVisualizationAsButtonLabel', {
Expand All @@ -231,7 +231,6 @@ export const getTopNavConfig = (
: i18n.translate('visualize.topNavMenu.saveVisualizationButtonLabel', {
defaultMessage: 'save',
}),
emphasize: (savedVis && !savedVis.id) || !originatingApp,
description: i18n.translate('visualize.topNavMenu.saveVisualizationButtonAriaLabel', {
defaultMessage: 'Save Visualization',
}),
Expand Down
18 changes: 6 additions & 12 deletions x-pack/plugins/lens/public/app_plugin/app.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,12 @@ describe('Lens App', () => {
let defaultSavedObjectId: string;

const navMenuItems = {
expectedSaveButton: { emphasize: true, testId: 'lnsApp_saveButton' },
expectedSaveAsButton: { emphasize: false, testId: 'lnsApp_saveButton' },
expectedSaveAndReturnButton: { emphasize: true, testId: 'lnsApp_saveAndReturnButton' },
expectedSaveButton: { testId: 'lnsApp_saveButton' },
expectedSaveAsButton: { testId: 'lnsApp_saveButton' },
expectedSaveAndReturnButton: {
iconType: 'checkInCircleFilled',
testId: 'lnsApp_saveAndReturnButton',
},
};

function makeAttributeService(): LensAttributeService {
Expand Down Expand Up @@ -614,9 +617,6 @@ describe('Lens App', () => {
expect(topNavMenuConfig).not.toContainEqual(
expect.objectContaining(navMenuItems.expectedSaveAndReturnButton)
);
expect(topNavMenuConfig).not.toContainEqual(
expect.objectContaining(navMenuItems.expectedSaveAsButton)
);
expect(topNavMenuConfig).toContainEqual(
expect.objectContaining(navMenuItems.expectedSaveButton)
);
Expand Down Expand Up @@ -649,9 +649,6 @@ describe('Lens App', () => {
expect(topNavMenuConfig).toContainEqual(
expect.objectContaining(navMenuItems.expectedSaveAsButton)
);
expect(topNavMenuConfig).not.toContainEqual(
expect.objectContaining(navMenuItems.expectedSaveButton)
);
});
});

Expand All @@ -672,9 +669,6 @@ describe('Lens App', () => {
expect(topNavMenuConfig).toContainEqual(
expect.objectContaining(navMenuItems.expectedSaveAsButton)
);
expect(topNavMenuConfig).not.toContainEqual(
expect.objectContaining(navMenuItems.expectedSaveButton)
);
});
});

Expand Down
5 changes: 2 additions & 3 deletions x-pack/plugins/lens/public/app_plugin/lens_top_nav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@ export function getLensTopNavConfig(options: {
label: i18n.translate('xpack.lens.app.saveAndReturn', {
defaultMessage: 'Save and return',
}),
emphasize: true,
iconType: 'check',
iconType: 'checkInCircleFilled',
run: actions.saveAndReturn,
testId: 'lnsApp_saveAndReturnButton',
disableButton: !savingPermitted,
Expand All @@ -48,7 +47,7 @@ export function getLensTopNavConfig(options: {

topNavMenu.push({
label: saveButtonLabel,
emphasize: !showSaveAndReturn,
iconType: !showSaveAndReturn ? 'save' : undefined,
run: actions.showSaveModal,
testId: 'lnsApp_saveButton',
description: i18n.translate('xpack.lens.app.saveButtonAriaLabel', {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,7 @@ export function getTopNavConfig({
label: i18n.translate('xpack.maps.topNav.saveAndReturnButtonLabel', {
defaultMessage: 'Save and return',
}),
emphasize: true,
iconType: 'check',
iconType: 'checkInCircleFilled',
run: () => {
onSave({
newTitle: savedMap.title ? savedMap.title : '',
Expand All @@ -148,6 +147,7 @@ export function getTopNavConfig({
if (hasWritePermissions) {
topNavConfigs.push({
id: 'save',
iconType: 'save',
label: hasSaveAndReturnConfig
? i18n.translate('xpack.maps.topNav.saveAsButtonLabel', {
defaultMessage: 'Save as',
Expand All @@ -158,7 +158,6 @@ export function getTopNavConfig({
description: i18n.translate('xpack.maps.topNav.saveMapDescription', {
defaultMessage: `Save map`,
}),
emphasize: !hasSaveAndReturnConfig,
testId: 'mapSaveButton',
disableButton() {
return isSaveDisabled;
Expand Down