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.
[Log Explorer] Add "Add data" button (elastic#166266)
## 📓 Summary Closes elastic#165486 This work restructured the entry point for the 2 different header menus (stateful, serverless) and added both of them the Add data button to navigate to the onboarding page. **Stateful** <img width="1780" alt="Screenshot 2023-09-12 at 16 01 16" src="https://github.com/elastic/kibana/assets/34506779/535a9a5c-603e-4c35-976a-70421c5e36d8"> **Serverless** <img width="1783" alt="Screenshot 2023-09-12 at 15 49 09" src="https://github.com/elastic/kibana/assets/34506779/aaa57f41-c4d8-4da1-a808-8b55954df716"> --------- Co-authored-by: Marco Antonio Ghiani <[email protected]> Co-authored-by: kibanamachine <[email protected]>
- Loading branch information
1 parent
5106852
commit 39cf371
Showing
12 changed files
with
259 additions
and
37 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
35 changes: 35 additions & 0 deletions
35
x-pack/plugins/observability_log_explorer/public/utils/get_router_link_props.ts
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
interface GetRouterLinkPropsDeps { | ||
href?: string; | ||
onClick(): void; | ||
} | ||
|
||
const isModifiedEvent = (event: React.MouseEvent<HTMLAnchorElement>) => | ||
!!(event.metaKey || event.altKey || event.ctrlKey || event.shiftKey); | ||
|
||
const isLeftClickEvent = (event: React.MouseEvent<HTMLAnchorElement>) => event.button === 0; | ||
|
||
export const getRouterLinkProps = ({ href, onClick }: GetRouterLinkPropsDeps) => { | ||
const guardedClickHandler = (event: React.MouseEvent<HTMLAnchorElement>) => { | ||
if (event.defaultPrevented) { | ||
return; | ||
} | ||
|
||
if (isModifiedEvent(event) || !isLeftClickEvent(event)) { | ||
return; | ||
} | ||
|
||
// Prevent regular link behavior, which causes a browser refresh. | ||
event.preventDefault(); | ||
|
||
onClick(); | ||
}; | ||
|
||
return { href, onClick: guardedClickHandler }; | ||
}; |
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.