forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Dashboard Navigation] Add Links to Visualization library (elastic#17…
…0810) Closes elastic#162840 ## Summary This PR adds a visualization alias for the new Links embeddable so that all Links library items can be managed/edited from the Visualization library, like so: https://github.com/elastic/kibana/assets/8698078/8541506b-cfdd-4a2f-8bc2-841220def7a3 However, in order to get the above working, it was unfortunately not as simple as just adding a visualization alias. Because the Links embeddable does not have a dedicated editing app (all editing/creation is done through a flyout), the usual `aliasPath` + `aliasApp` redirect that happens for editing an alias did not work in this case. To get around this, I've had to make changes to how aliases are registered, as well as both the Visualization `VisualizeListing` component and the generic `TableListViewTableComp` content management component: - **Summary of visualization alias changes:** First off, I made changes to the typing of aliases - specifically, rather than taking two independent `aliasPath` and `aliasApp` props, I've combined them into a singular `alias` prop which will either be of type `{ alias: string; path: string; }` or `{ embeddableType: string; }`. This makes it easier to determine (a) whether a visualization is of type `BaseVisType` or `VisTypeAlias` and (b) if it **is** of type `VisTypeAlias`, how the editing of that vis should be handled. Specifically, if `alias` is of type `{ alias: string; path: string; }`, then it is a normal visualization and behaviour should be the same as it was previously; however, if it is of type `{ embeddableType: string; }`, then this is an **inline** alias - i.e. editing should be done inline via the embeddable factory's edit method. - **Summary of `VisualizeListing` changes** The primary changes here were made to the `editItem` callback - specifically, if the fetched saved object has neither an `editApp` nor an `editUrl`, then it will now try to fetch the embeddable factory for the given saved object type and, if this factory exists, it will call the `getExplicitInput` method in order to handle editing. - **Summary of `TableListViewTableComp` changes** Previously, an error would be thrown if both a `getDetailViewLink` and an `onClickTitle` prop were provided - while I understand the original reasoning for adding this catch, this no longer works if we want to support inline editing like this. In this case, I needed **only** the Link embeddable items to have an `onClick` while keeping the behaviour for other visualizations the same (i.e. all other visualization types should continue to link off to their specific editor apps) - however, since this method is not provided **per item**, I had no way of making an exception for just one specific item type. Therefore, to get around this, it is now considered to be valid for **both** the `getDetailViewLink` and `onClickTitle` props to be defined for the `TableListViewTableComp` component. In order to prevent conflict between the two props, I have made it so that, if both are provided, `getDetailViewLink` **always takes precedence** over `onClickTitle` - in this case, `onClickTitle` will **only** be called if `getDetailViewLink` returns `undefined` for a given item. I have added a comment to hopefully make this clear for consumers. ### Checklist - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios - [x] Any UI touched in this PR is usable by keyboard only (learn more about [keyboard accessibility](https://webaim.org/techniques/keyboard/)) - [x] Any UI touched in this PR does not create any new axe failures (run axe in browser: [FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/), [Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US)) - [x] This renders correctly on smaller devices using a responsive layout. (You can test this [in your browser](https://www.browserstack.com/guide/responsive-testing-on-local-server)) - [x] This was checked for [cross-browser compatibility](https://www.elastic.co/support/matrix#matrix_browsers) ### For maintainers - [ ] This was checked for breaking API changes and was [labeled appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)
- Loading branch information
Showing
25 changed files
with
227 additions
and
104 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.