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

[OneDiscover] Contextual App Menu Extension Point #195448

Merged
merged 79 commits into from
Oct 30, 2024
Merged
Show file tree
Hide file tree
Changes from 56 commits
Commits
Show all changes
79 commits
Select commit Hold shift + click to select a range
f8f2b0d
[Discover] Initial implementation
jughosta Oct 8, 2024
6cf8d90
[CI] Auto-commit changed files from 'node scripts/notice'
kibanamachine Oct 8, 2024
2e96f8d
[Discover] Refactor further
jughosta Oct 8, 2024
39c67a1
Merge remote-tracking branch 'origin/194269-app-menu-extension-point'…
jughosta Oct 8, 2024
1a2ba08
[Discover] Extract actions
jughosta Oct 8, 2024
80bcf51
[CI] Auto-commit changed files from 'node scripts/notice'
kibanamachine Oct 8, 2024
0197f7a
[Discover] Fix test ids
jughosta Oct 9, 2024
96dda65
Merge remote-tracking branch 'origin/194269-app-menu-extension-point'…
jughosta Oct 9, 2024
8fbc4da
[Discover] Fix circular deps
jughosta Oct 9, 2024
b3cab7c
[CI] Auto-commit changed files from 'node scripts/notice'
kibanamachine Oct 9, 2024
37f5ce3
[Discover] Fix circular deps
jughosta Oct 9, 2024
e4b0296
[CI] Auto-commit changed files from 'node scripts/notice'
kibanamachine Oct 9, 2024
16756e5
[Discover] Start using icons for the primary actions
davismcphee Sep 25, 2024
4363ece
Merge remote-tracking branch 'origin/194269-app-menu-extension-point'…
jughosta Oct 9, 2024
0c89b3e
[Discover] Avoid the circular deps
jughosta Oct 9, 2024
53bacc1
[Discover] Clean up unused customization option
jughosta Oct 9, 2024
4666a4d
[CI] Auto-commit changed files from 'node scripts/notice'
kibanamachine Oct 9, 2024
0b6c159
[Discover] Add a registry
jughosta Oct 9, 2024
73e1ace
Merge remote-tracking branch 'origin/194269-app-menu-extension-point'…
jughosta Oct 9, 2024
df1b0dd
[Discover] Commit the registry
jughosta Oct 10, 2024
36a4514
[Discover] Fix lint issues
jughosta Oct 10, 2024
0817e7a
[Discover] Introduce the new extension point
jughosta Oct 10, 2024
4270bf9
[Discover] Update tests
jughosta Oct 10, 2024
e8f5da4
[Discover] Fix checks
jughosta Oct 10, 2024
a5a5474
[Discover] Add to the example profile
jughosta Oct 10, 2024
1c88df4
[Discover] Update types
jughosta Oct 11, 2024
3720043
[Discover] Make types stricter
jughosta Oct 11, 2024
e387f50
[Discover] Update types
jughosta Oct 11, 2024
48faa35
[Discover] Add horizontal rule support
jughosta Oct 11, 2024
82deba6
[Discover] Add comments
jughosta Oct 11, 2024
a388627
Merge branch 'main' into 194269-app-menu-extension-point
jughosta Oct 14, 2024
ab3c171
[Discover] Change how submenu items are registered
jughosta Oct 14, 2024
4ee6153
[Discover] Limit number of custom items
jughosta Oct 14, 2024
12a92f2
Merge remote-tracking branch 'upstream/main' into 194269-app-menu-ext…
jughosta Oct 15, 2024
3dde34b
[Discover] Update share icon
jughosta Oct 15, 2024
2f76f87
[Discover] Update tooltip delay
jughosta Oct 15, 2024
9863d8c
[Discover] Update top nav gap
jughosta Oct 15, 2024
c129bf4
Merge branch 'main' into 194269-app-menu-extension-point
jughosta Oct 16, 2024
fa0372f
[Discover] Add top nav tests
jughosta Oct 16, 2024
c909227
[Discover] Add app menu registry tests
jughosta Oct 16, 2024
934359c
[Discover] Add more tests
jughosta Oct 16, 2024
c0a405b
[Discover] Add more tests
jughosta Oct 16, 2024
e7964f0
[Discover] Add e2e tests
jughosta Oct 16, 2024
dbd897d
[Discover] Add comment
jughosta Oct 16, 2024
179290f
[Discover] Fix tests
jughosta Oct 16, 2024
5b84058
Merge branch 'main' into 194269-app-menu-extension-point
jughosta Oct 16, 2024
b8f2868
[Discover] Fix tests
jughosta Oct 17, 2024
f36b74b
Merge remote-tracking branch 'origin/194269-app-menu-extension-point'…
jughosta Oct 17, 2024
4e8580d
Merge branch 'main' into 194269-app-menu-extension-point
jughosta Oct 17, 2024
8ed5792
[Discover] Update tests
jughosta Oct 17, 2024
25466dc
Merge branch 'main' into 194269-app-menu-extension-point
jughosta Oct 17, 2024
f3aa321
Merge remote-tracking branch 'origin/194269-app-menu-extension-point'…
jughosta Oct 17, 2024
33edf76
[Discover] Update tests
jughosta Oct 17, 2024
6f0210b
Merge branch 'main' into 194269-app-menu-extension-point
jughosta Oct 21, 2024
fecdaad
[Discover] Fix getSortedItems
jughosta Oct 21, 2024
b4586c8
[Discover] Remove memo
jughosta Oct 21, 2024
750e281
Merge branch 'main' into 194269-app-menu-extension-point
jughosta Oct 22, 2024
092c450
[Discover] Simplify badges
jughosta Oct 22, 2024
a958803
[Discover] Switch to discoverParams
jughosta Oct 22, 2024
ecefecc
Update src/plugins/discover/public/context_awareness/types.ts
jughosta Oct 22, 2024
72df414
[Discover] Add serverless tests
jughosta Oct 22, 2024
c889492
Merge remote-tracking branch 'origin/194269-app-menu-extension-point'…
jughosta Oct 22, 2024
c9377cd
[Discover] Fix clearing the items on data view change
jughosta Oct 22, 2024
bbe7dc7
[Discover] Update serverless tests
jughosta Oct 22, 2024
81f5794
[Discover] Update example labels
jughosta Oct 22, 2024
3a530e9
[Discover] Allow to add icons to submenu items
jughosta Oct 22, 2024
2f7a0ae
[Discover] Fix types
jughosta Oct 22, 2024
db648d1
[Discover] Update tests
jughosta Oct 22, 2024
fb84ca9
[Discover] Update types
jughosta Oct 22, 2024
0970bd5
[Discover] Update tests
jughosta Oct 23, 2024
c041657
[Discover] Remove services from the extension params
jughosta Oct 23, 2024
5c5c983
[Discover] Update tests
jughosta Oct 23, 2024
814a654
[Discover] Allow to override submenu actions with custom ones
jughosta Oct 23, 2024
24e9c5c
[Discover] Fix types
jughosta Oct 23, 2024
2c3b1c7
[Discover] Fix types
jughosta Oct 23, 2024
91da211
Merge remote-tracking branch 'upstream/main' into 194269-app-menu-ext…
jughosta Oct 23, 2024
d918635
[Discover] Fix after the merge
jughosta Oct 23, 2024
bf13cb4
Merge branch 'main' into 194269-app-menu-extension-point
jughosta Oct 28, 2024
79982bd
Merge branch 'main' into 194269-app-menu-extension-point
jughosta Oct 30, 2024
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
108 changes: 1 addition & 107 deletions examples/discover_customization_examples/public/plugin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,9 @@
* License v3.0 only", or the "Server Side Public License, v 1".
*/

import {
EuiButton,
EuiContextMenu,
EuiFlexItem,
EuiPopover,
EuiWrappingPopover,
IconType,
} from '@elastic/eui';
import { EuiButton, EuiContextMenu, EuiFlexItem, EuiPopover, IconType } from '@elastic/eui';
import { CoreSetup, CoreStart, Plugin, SimpleSavedObject } from '@kbn/core/public';
import type { DeveloperExamplesSetup } from '@kbn/developer-examples-plugin/public';
import { KibanaRenderContextProvider } from '@kbn/react-kibana-context-render';
import type {
CustomizationCallback,
DiscoverSetup,
Expand Down Expand Up @@ -102,112 +94,14 @@ export class DiscoverCustomizationExamplesPlugin implements Plugin {
}

start(core: CoreStart, plugins: DiscoverCustomizationExamplesStartPlugins) {
const { discover } = plugins;

let isOptionsOpen = false;
const optionsContainer = document.createElement('div');
const closeOptionsPopover = () => {
ReactDOM.unmountComponentAtNode(optionsContainer);
document.body.removeChild(optionsContainer);
isOptionsOpen = false;
};

this.customizationCallback = ({ customizations, stateContainer }) => {
customizations.set({
id: 'top_nav',
defaultMenu: {
newItem: { disabled: true },
openItem: { disabled: true },
shareItem: { order: 200 },
alertsItem: { disabled: true },
inspectItem: { disabled: true },
saveItem: { order: 400 },
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reduced the scope of Discover customization (deleted order and getMenuItems configuration) as it was not used anyway and we will offer only contextual profiles going forward.

},
getMenuItems: () => [
{
data: {
id: 'options',
label: 'Options',
iconType: 'arrowDown',
iconSide: 'right',
testId: 'customOptionsButton',
run: (anchorElement: HTMLElement) => {
if (isOptionsOpen) {
closeOptionsPopover();
return;
}

isOptionsOpen = true;
document.body.appendChild(optionsContainer);

const element = (
<KibanaRenderContextProvider {...core}>
<EuiWrappingPopover
ownFocus
button={anchorElement}
isOpen={true}
panelPaddingSize="s"
closePopover={closeOptionsPopover}
>
<EuiContextMenu
size="s"
initialPanelId={0}
panels={[
{
id: 0,
items: [
{
name: 'Create new',
icon: 'plusInCircle',
onClick: () => alert('Create new clicked'),
},
{
name: 'Make a copy',
icon: 'copy',
onClick: () => alert('Make a copy clicked'),
},
{
name: 'Manage saved searches',
icon: 'gear',
onClick: () => alert('Manage saved searches clicked'),
},
],
},
]}
data-test-subj="customOptionsPopover"
/>
</EuiWrappingPopover>
</KibanaRenderContextProvider>
);

ReactDOM.render(element, optionsContainer);
},
},
order: 100,
},
{
data: {
id: 'documentExplorer',
label: 'Document explorer',
iconType: 'discoverApp',
testId: 'documentExplorerButton',
run: () => {
discover.locator?.navigate({});
},
},
order: 300,
},
],
getBadges: () => {
return [
{
data: {
badgeText: 'Example badge',
color: 'warning',
},
order: 10,
},
];
},
});

Expand Down
1 change: 0 additions & 1 deletion examples/discover_customization_examples/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
"@kbn/i18n-react",
"@kbn/react-kibana-context-theme",
"@kbn/data-plugin",
"@kbn/react-kibana-context-render",
],
"exclude": ["target/**/*"]
}
1 change: 1 addition & 0 deletions packages/kbn-discover-utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ export {
getVisibleColumns,
canPrependTimeFieldColumn,
DiscoverFlyouts,
AppMenuRegistry,
dismissAllFlyoutsExceptFor,
dismissFlyouts,
} from './src';
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading