-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[Serverless Chrome] Polish of home logo and project switcher #158523
Merged
tsullivan
merged 24 commits into
elastic:main
from
tsullivan:shared-ux/chrome/navigation-polish-ii
Jun 14, 2023
Merged
Changes from 19 commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
2e904ff
[Serverless Chrome] Polish of home logo and project switcher
tsullivan 8f785d1
declare validateChromeStyle before it is used
tsullivan f7f64f2
fix i18n in project switcher
tsullivan d3106b2
[CI] Auto-commit changed files from 'node scripts/lint_ts_projects --…
kibanamachine e320e05
fix ts
tsullivan a1786f5
Merge branch 'main' into shared-ux/chrome/navigation-polish-ii
tsullivan f09ea54
Merge branch 'main' into shared-ux/chrome/navigation-polish-ii
tsullivan 459c0de
Merge branch 'main' into shared-ux/chrome/navigation-polish-ii
tsullivan 3328255
set security project home
tsullivan 61834f6
ensure logo links have basepath and can be opened in new tab
tsullivan 9290dda
debounce updates to the home icon/loading spinner
tsullivan 6c428a4
Merge branch 'main' into shared-ux/chrome/navigation-polish-ii
tsullivan 20263e7
update loading spinner debounce time
tsullivan 3bbf1d6
Merge branch 'main' into shared-ux/chrome/navigation-polish-ii
tsullivan 2fac0aa
fix misalignment of action menu
tsullivan 2fba2ac
correction to observability landing page
tsullivan 7328a7a
Merge branch 'main' into shared-ux/chrome/navigation-polish-ii
tsullivan 4da4059
Revert project switcher
tsullivan c808a4b
restore cloud link
tsullivan b7e3731
Merge branch 'main' into shared-ux/chrome/navigation-polish-ii
tsullivan 2d61cca
fix ts for removed homeRef prop
tsullivan 3cdb41a
update test fixture
tsullivan cb5763f
update test fixture II
tsullivan 3a68196
Merge branch 'main' into shared-ux/chrome/navigation-polish-ii
tsullivan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,7 @@ | |
import React from 'react'; | ||
import { FormattedMessage } from '@kbn/i18n-react'; | ||
import { BehaviorSubject, combineLatest, merge, type Observable, of, ReplaySubject } from 'rxjs'; | ||
import { flatMap, map, takeUntil } from 'rxjs/operators'; | ||
import { mergeMap, map, takeUntil } from 'rxjs/operators'; | ||
import { parse } from 'url'; | ||
import { EuiLink } from '@elastic/eui'; | ||
import useObservable from 'react-use/lib/useObservable'; | ||
|
@@ -89,7 +89,7 @@ export class ChromeService { | |
// in the sense that the chrome UI should not be displayed until a non-chromeless app is mounting or mounted | ||
of(true), | ||
application.currentAppId$.pipe( | ||
flatMap((appId) => | ||
mergeMap((appId) => | ||
application.applications$.pipe( | ||
map((applications) => { | ||
return !!appId && applications.has(appId) && !!applications.get(appId)!.chromeless; | ||
|
@@ -177,25 +177,23 @@ export class ChromeService { | |
chromeStyle$.next(style); | ||
}; | ||
|
||
const setProjectSideNavComponent = (component: ISideNavComponent | null) => { | ||
const validateChromeStyle = () => { | ||
const chromeStyle = chromeStyle$.getValue(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. changed the validation into a helper function |
||
if (chromeStyle !== 'project') { | ||
// Helps ensure callers go through the serverless plugin to get here. | ||
throw new Error( | ||
`Invalid ChromeStyle value of "${chromeStyle}". setProjectSideNavComponent requires ChromeStyle set to "project".` | ||
`Invalid ChromeStyle value of "${chromeStyle}". This method requires ChromeStyle set to "project".` | ||
); | ||
} | ||
}; | ||
|
||
const setProjectSideNavComponent = (component: ISideNavComponent | null) => { | ||
validateChromeStyle(); | ||
projectNavigation.setProjectSideNavComponent(component); | ||
}; | ||
|
||
const setProjectNavigation = (config: ChromeProjectNavigation) => { | ||
const chromeStyle = chromeStyle$.getValue(); | ||
if (chromeStyle !== 'project') { | ||
// Helps ensure callers go through the serverless plugin to get here. | ||
throw new Error( | ||
`Invalid ChromeStyle value of "${chromeStyle}". setProjectNavigation requires ChromeStyle set to "project".` | ||
); | ||
} | ||
validateChromeStyle(); | ||
projectNavigation.setProjectNavigation(config); | ||
}; | ||
|
||
|
@@ -206,6 +204,11 @@ export class ChromeService { | |
projectNavigation.setProjectBreadcrumbs(breadcrumbs, params); | ||
}; | ||
|
||
const setProjectHome = (homeHref: string) => { | ||
validateChromeStyle(); | ||
projectNavigation.setProjectHome(homeHref); | ||
}; | ||
|
||
const isIE = () => { | ||
const ua = window.navigator.userAgent; | ||
const msie = ua.indexOf('MSIE '); // IE 10 or older | ||
|
@@ -288,9 +291,14 @@ export class ChromeService { | |
breadcrumbs$={projectBreadcrumbs$.pipe(takeUntil(this.stop$))} | ||
helpExtension$={helpExtension$.pipe(takeUntil(this.stop$))} | ||
helpSupportUrl$={helpSupportUrl$.pipe(takeUntil(this.stop$))} | ||
navControlsLeft$={navControls.getLeft$()} | ||
navControlsCenter$={navControls.getCenter$()} | ||
navControlsRight$={navControls.getRight$()} | ||
loadingCount$={http.getLoadingCount$()} | ||
homeHref$={projectNavigation.getProjectHome$()} | ||
kibanaDocLink={docLinks.links.kibana.guide} | ||
kibanaVersion={injectedMetadata.getKibanaVersion()} | ||
prependBasePath={http.basePath.prepend} | ||
> | ||
{/* TODO: pass down the SideNavCompProps once they are defined */} | ||
<SideNavComponent /> | ||
|
@@ -405,6 +413,7 @@ export class ChromeService { | |
setChromeStyle, | ||
getChromeStyle$: () => chromeStyle$.pipe(takeUntil(this.stop$)), | ||
project: { | ||
setHome: setProjectHome, | ||
setNavigation: setProjectNavigation, | ||
setSideNavComponent: setProjectSideNavComponent, | ||
setBreadcrumbs: setProjectBreadcrumbs, | ||
|
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.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
flatMap
is deprecated