[Dashboard] Use factory's displayName
in save modal
#164105
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
As part of a larger navigation embeddable discussion, it was noted that there were inconsistencies between how we display the panel type between the saved object modal and the context menu action. Turns out, this is because we were using the embeddable
type
in the"Save to library"
modal title while the context menu action uses the factory'sdisplayName
- while this coincidentally worked in most cases (maps
andvisualization
), it does not work for Lens panels, since we want to use the proper noun"Lens"
in this case rather than the saved object type"lens"
:This was even more obvious with the navigation embeddable, since the saved object type is currently
"navigation_embeddable"
(this may change in the future):Therefore, by switching to use the factory's
displayName
(if available), the saved object modal will now stay consistent with the"Edit <x>"
option in the context menu for each panel.No change, as expected.
No change, as expected.
Note that, in the above "After" screenshots,
Links
is still capitalized unnecessarily - this is because, if we change the factory'sdisplayName
to be the lowercase"links"
, this fixes the modal but it also impacts the item in the add panel context menu and the panel actions context menu, like so:This is because the link embeddable is not currently registered as a "visualization" and so the
"Add panel"
context menu logic is handled as part ofgetEmbeddableFactoryMenuItem
in./src/plugins/dashboard/public/dashboard_app/top_nav/editor_menu.tsx
rather thangetVisTypeMenuItem
(this could potentially be fixed by #162840 since we have custom logic for displaying aliases). While the lowercase"links"
in the panel actions context menu is desired, it is not desirable to have the lowercase"links"
in the add panel context menu - however, it is not currently possible to change one without changing the other.Note that this is also true for the
"Image"
embeddable - by changing thedisplayName
of the image factory from"Image"
to"image"
, the"Edit"
panel actions context menu item would be displayed correctly as"Edit image"
(currently, it is"Edit Image"
) but the lowercase"image"
would also be displayed in the add panel context menu, which is undesirable.It will require a larger refactor to fix these inconsistencies, so it should be addressed separately.
Checklist
For maintainers