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

New nav #64018

Merged
merged 54 commits into from
May 6, 2020
Merged

New nav #64018

Show file tree
Hide file tree
Changes from 29 commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
3aaeefe
Fix height calc to use correct EUI variable
MichaelMarcialis Apr 21, 2020
b315034
collapsible nav
Apr 23, 2020
23eeebc
fixing PR feedback
Apr 23, 2020
90e537b
updated category public api
Apr 23, 2020
ebfa324
fixing first few tests
Apr 23, 2020
84b3f2b
undoing visualize->visualization library naming
Apr 24, 2020
91fcde6
move recently viewed to the top
Apr 24, 2020
b35eacc
hotfix apps sometimes displaying a scrollbar
Apr 24, 2020
811cde3
fix euiBottomBar width calculation
Apr 24, 2020
7b8a016
translation file fix
Apr 24, 2020
ea92cd7
displaying links without a category
Apr 24, 2020
2875a35
more test fixed
Apr 24, 2020
affb4d9
Merge remote-tracking branch 'upstream/master' into new-nav
Apr 24, 2020
d1259c5
Revert "fix euiBottomBar width calculation"
Apr 27, 2020
2f3a1cf
better todo naming
Apr 27, 2020
aec8305
safely migrate bottomBar width to new nav widths
Apr 27, 2020
27531e6
addressing feedback from @pgayvallet
Apr 27, 2020
86fb664
fix visualization full screen issues
Apr 27, 2020
bbb0a33
fixing more tests
Apr 27, 2020
04fea87
fixing painless lab bottombar popover
Apr 28, 2020
9591a6f
pass onclick to nav items without category
Apr 28, 2020
9568d18
documenting category id and getNavType
Apr 28, 2020
31eec3e
Merge remote-tracking branch 'upstream/master' into new-nav
Apr 28, 2020
7c16e3a
fixing more tests
Apr 28, 2020
1f84027
fixing width overflow with legacy nav
MichaelMarcialis Apr 28, 2020
21e6255
additional test fixes
Apr 29, 2020
4891ee9
updating EUI to 22.3.1
Apr 29, 2020
421e687
fixing more tests...
Apr 29, 2020
1cc0fb5
fixing jest + a11y tests
Apr 30, 2020
283d9d0
fixing more jest + a11y tests
Apr 30, 2020
216cac8
Merge remote-tracking branch 'upstream/master' into new-nav
Apr 30, 2020
975b08c
Merge branch 'master' into new-nav
elasticmachine Apr 30, 2020
4bc97a7
Merge branch 'master' into new-nav
elasticmachine Apr 30, 2020
86f7830
Merge branch 'master' into new-nav
elasticmachine Apr 30, 2020
797dfa9
jest + a11y tests fixes
Apr 30, 2020
757df00
fixing plugin categories
Apr 30, 2020
dbb49a0
Merge remote-tracking branch 'upstream/master' into new-nav
Apr 30, 2020
b612739
fixing the last remaining tests, I hope
Apr 30, 2020
bf1b6ee
fixing discvoer test failure
May 1, 2020
1fe8bb9
implementing PR feedback and adding basic test coverage
May 5, 2020
08d83d5
Merge remote-tracking branch 'upstream/master' into new-nav
May 5, 2020
db25a51
fixing schema failure
May 5, 2020
7c61b6c
fixing canvas category type
May 5, 2020
d7f1ba1
Merge remote-tracking branch 'upstream/master' into new-nav
May 5, 2020
ca23f13
Merge remote-tracking branch 'upstream/master' into new-nav
May 5, 2020
2d57e30
Merge remote-tracking branch 'upstream/master' into new-nav
May 5, 2020
96bf7c0
attempting to fix a merge conflict
May 5, 2020
5dbc9c8
fixing react types because yarn is having a hard time
May 5, 2020
153cf49
Merge remote-tracking branch 'upstream/master' into new-nav
May 5, 2020
a947add
Merge remote-tracking branch 'upstream/master' into new-nav
May 5, 2020
485a4ee
fix DEFAULT_APP_CATEGORIES import
May 5, 2020
02dac24
update public api
May 6, 2020
4690a2f
Merge remote-tracking branch 'upstream/master' into new-nav
May 6, 2020
9c98447
Merge remote-tracking branch 'upstream/master' into new-nav
May 6, 2020
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [kibana-plugin-core-public](./kibana-plugin-core-public.md) &gt; [AppCategory](./kibana-plugin-core-public.appcategory.md) &gt; [id](./kibana-plugin-core-public.appcategory.id.md)

## AppCategory.id property

Unique identifier for the categories

<b>Signature:</b>

```typescript
id: string;
```
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export interface AppCategory
| --- | --- | --- |
| [ariaLabel](./kibana-plugin-core-public.appcategory.arialabel.md) | <code>string</code> | If the visual label isn't appropriate for screen readers, can override it here |
| [euiIconType](./kibana-plugin-core-public.appcategory.euiicontype.md) | <code>string</code> | Define an icon to be used for the category If the category is only 1 item, and no icon is defined, will default to the product icon Defaults to initials if no icon is defined |
| [id](./kibana-plugin-core-public.appcategory.id.md) | <code>string</code> | Unique identifier for the categories |
| [label](./kibana-plugin-core-public.appcategory.label.md) | <code>string</code> | Label used for cateogry name. Also used as aria-label if one isn't set. |
| [order](./kibana-plugin-core-public.appcategory.order.md) | <code>number</code> | The order that categories will be sorted in Prefer large steps between categories to allow for further editing (Default categories are in steps of 1000) |

Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [kibana-plugin-core-public](./kibana-plugin-core-public.md) &gt; [ChromeStart](./kibana-plugin-core-public.chromestart.md) &gt; [getNavType$](./kibana-plugin-core-public.chromestart.getnavtype_.md)

## ChromeStart.getNavType$() method

Get the navigation type TODO \#64541 Can delete

<b>Signature:</b>

```typescript
getNavType$(): Observable<NavType>;
```
<b>Returns:</b>

`Observable<NavType>`

Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ core.chrome.setHelpExtension(elem => {
| [getHelpExtension$()](./kibana-plugin-core-public.chromestart.gethelpextension_.md) | Get an observable of the current custom help conttent |
| [getIsNavDrawerLocked$()](./kibana-plugin-core-public.chromestart.getisnavdrawerlocked_.md) | Get an observable of the current locked state of the nav drawer. |
| [getIsVisible$()](./kibana-plugin-core-public.chromestart.getisvisible_.md) | Get an observable of the current visibility state of the chrome. |
| [getNavType$()](./kibana-plugin-core-public.chromestart.getnavtype_.md) | Get the navigation type TODO \#64541 Can delete |
| [removeApplicationClass(className)](./kibana-plugin-core-public.chromestart.removeapplicationclass.md) | Remove a className added with <code>addApplicationClass()</code>. If className is unknown it is ignored. |
| [setAppTitle(appTitle)](./kibana-plugin-core-public.chromestart.setapptitle.md) | Sets the current app's title |
| [setBadge(badge)](./kibana-plugin-core-public.chromestart.setbadge.md) | Override the current badge |
Expand Down
1 change: 1 addition & 0 deletions docs/development/core/public/kibana-plugin-core-public.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ The plugin integrates with the core system via lifecycle events: `setup`<!-- -->
| [IContextProvider](./kibana-plugin-core-public.icontextprovider.md) | A function that returns a context value for a specific key of given context type. |
| [IToasts](./kibana-plugin-core-public.itoasts.md) | Methods for adding and removing global toast messages. See [ToastsApi](./kibana-plugin-core-public.toastsapi.md)<!-- -->. |
| [MountPoint](./kibana-plugin-core-public.mountpoint.md) | A function that should mount DOM content inside the provided container element and return a handler to unmount it. |
| [NavType](./kibana-plugin-core-public.navtype.md) | |
| [PluginInitializer](./kibana-plugin-core-public.plugininitializer.md) | The <code>plugin</code> export at the root of a plugin's <code>public</code> directory should conform to this interface. |
| [PluginOpaqueId](./kibana-plugin-core-public.pluginopaqueid.md) | |
| [PublicUiSettingsParams](./kibana-plugin-core-public.publicuisettingsparams.md) | A sub-set of [UiSettingsParams](./kibana-plugin-core-public.uisettingsparams.md) exposed to the client-side. |
Expand Down
11 changes: 11 additions & 0 deletions docs/development/core/public/kibana-plugin-core-public.navtype.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [kibana-plugin-core-public](./kibana-plugin-core-public.md) &gt; [NavType](./kibana-plugin-core-public.navtype.md)

## NavType type

<b>Signature:</b>

```typescript
export declare type NavType = 'modern' | 'legacy';
```
3 changes: 3 additions & 0 deletions docs/management/advanced-options.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ into the document when displaying it.
`metrics:max_buckets`:: The maximum numbers of buckets that a single
data source can return. This might arise when the user selects a
short interval (for example, 1s) for a long time period (1 year).
`pageNavigation`:: The style of navigation menu for Kibana.
Choices are Legacy, the legacy style where every plugin is represented in the nav,
and Modern, a new format that bundles related plugins together in flyaway nested navigation.
`query:allowLeadingWildcards`:: Allows a wildcard (*) as the first character
in a query clause. Only applies when experimental query features are
enabled in the query bar. To disallow leading wildcards in Lucene queries,
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@
"@elastic/charts": "18.4.2",
"@elastic/datemath": "5.0.3",
"@elastic/ems-client": "7.8.0",
"@elastic/eui": "22.3.0",
"@elastic/eui": "22.3.1",
"@elastic/filesaver": "1.1.2",
"@elastic/good": "8.1.1-kibana2",
"@elastic/numeral": "2.4.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-ui-shared-deps/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
},
"dependencies": {
"@elastic/charts": "18.4.2",
"@elastic/eui": "22.3.0",
"@elastic/eui": "22.3.1",
"@kbn/i18n": "1.0.0",
"abortcontroller-polyfill": "^1.4.0",
"angular": "^1.7.9",
Expand Down
5 changes: 4 additions & 1 deletion src/core/public/chrome/chrome_service.mock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ import {
ChromeBreadcrumb,
ChromeService,
InternalChromeStart,
} from './chrome_service';
NavType,
} from './';

const createStartContractMock = () => {
const startContract: DeeplyMockedKeys<InternalChromeStart> = {
Expand Down Expand Up @@ -72,6 +73,7 @@ const createStartContractMock = () => {
setHelpExtension: jest.fn(),
setHelpSupportUrl: jest.fn(),
getIsNavDrawerLocked$: jest.fn(),
getNavType$: jest.fn(),
};
startContract.navLinks.getAll.mockReturnValue([]);
startContract.getBrand$.mockReturnValue(new BehaviorSubject({} as ChromeBrand));
Expand All @@ -81,6 +83,7 @@ const createStartContractMock = () => {
startContract.getBreadcrumbs$.mockReturnValue(new BehaviorSubject([{} as ChromeBreadcrumb]));
startContract.getHelpExtension$.mockReturnValue(new BehaviorSubject(undefined));
startContract.getIsNavDrawerLocked$.mockReturnValue(new BehaviorSubject(false));
startContract.getNavType$.mockReturnValue(new BehaviorSubject('modern' as NavType));
return startContract;
};

Expand Down
15 changes: 15 additions & 0 deletions src/core/public/chrome/chrome_service.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ import { DocLinksStart } from '../doc_links';
import { ChromeHelpExtensionMenuLink } from './ui/header/header_help_menu';
import { KIBANA_ASK_ELASTIC_LINK } from './constants';
import { IUiSettingsClient } from '../ui_settings';
import { NavType } from './ui/header';
export { ChromeNavControls, ChromeRecentlyAccessed, ChromeDocTitle };

const IS_LOCKED_KEY = 'core.chrome.isLocked';
Expand Down Expand Up @@ -165,6 +166,10 @@ export class ChromeService {

const getIsNavDrawerLocked$ = isNavDrawerLocked$.pipe(takeUntil(this.stop$));

// TODO #64541
// Can delete
const getNavType$ = uiSettings.get$('pageNavigation').pipe(takeUntil(this.stop$));

if (!this.params.browserSupportsCsp && injectedMetadata.getCspConfig().warnLegacyBrowsers) {
notifications.toasts.addWarning(
i18n.translate('core.chrome.legacyBrowserWarning', {
Expand Down Expand Up @@ -202,6 +207,7 @@ export class ChromeService {
navControlsRight$={navControls.getRight$()}
onIsLockedUpdate={setIsNavDrawerLocked}
isLocked$={getIsNavDrawerLocked$}
navType$={getNavType$}
/>
</React.Fragment>
),
Expand Down Expand Up @@ -262,6 +268,8 @@ export class ChromeService {
setHelpSupportUrl: (url: string) => helpSupportUrl$.next(url),

getIsNavDrawerLocked$: () => getIsNavDrawerLocked$,

getNavType$: () => getNavType$,
};
}

Expand Down Expand Up @@ -408,6 +416,13 @@ export interface ChromeStart {
* Get an observable of the current locked state of the nav drawer.
*/
getIsNavDrawerLocked$(): Observable<boolean>;

/**
* Get the navigation type
* TODO #64541
* Can delete
*/
getNavType$(): Observable<NavType>;
}

/** @internal */
Expand Down
1 change: 1 addition & 0 deletions src/core/public/chrome/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export {
ChromeHelpExtensionMenuDocumentationLink,
ChromeHelpExtensionMenuGitHubLink,
} from './ui/header/header_help_menu';
export { NavType } from './ui';
export { ChromeNavLink, ChromeNavLinks, ChromeNavLinkUpdateableFields } from './nav_links';
export { ChromeRecentlyAccessed, ChromeRecentlyAccessedHistoryItem } from './recently_accessed';
export { ChromeNavControl, ChromeNavControls } from './nav_controls';
Expand Down
36 changes: 6 additions & 30 deletions src/core/public/chrome/ui/header/_index.scss
Original file line number Diff line number Diff line change
@@ -1,25 +1,12 @@
@import '@elastic/eui/src/components/header/variables';
@import '@elastic/eui/src/components/nav_drawer/variables';

.chrHeaderWrapper {
// TODO #64541
// Delete this block
.chrHeaderWrapper:not(.headerWrapper) {
width: 100%;
position: fixed;
top: 0;
z-index: 10;
}

.chrHeaderWrapper ~ .app-wrapper:not(.hidden-chrome) {
top: $euiHeaderChildSize;
left: $euiHeaderChildSize;

// HOTFIX: Temporary fix for flyouts not inside portals
// SASSTODO: Find an actual solution
.euiFlyout {
top: $euiHeaderChildSize;
height: calc(100% - #{$euiHeaderChildSize});
}
}

.chrHeaderHelpMenu__version {
text-transform: none;
}
Expand All @@ -29,19 +16,8 @@
margin-right: $euiSize;
}

// Mobile header is smaller
@include euiBreakpoint('xs', 's') {
.chrHeaderWrapper ~ .app-wrapper:not(.hidden-chrome) {
left: 0;
}
}

@include euiBreakpoint('xl') {
.chrHeaderWrapper--navIsLocked {
~ .app-wrapper:not(.hidden-chrome) {
// Shrink the content from the left so it's no longer overlapped by the nav drawer (ALWAYS)
left: $euiNavDrawerWidthExpanded !important; // sass-lint:disable-line no-important
transition: left $euiAnimSpeedFast $euiAnimSlightResistance;
}
.header__toggleNavButtonSection {
.euiBody--collapsibleNavIsDocked & {
display: none;
Comment on lines +19 to +21
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this doing the same thing that the showButtonIfDocked prop does on EuiCollapsibleNav?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes... If I was using the button supplied by EuiCollapsibleNav... Because of the stuff on the right of the header, I'm using my own button to keep focus order predictable. (Using the button supplied by EUI makes the focus order ToggleButton -> Nav down the left -> Header -> Rest of the page; With a custom button the order is Header -> Nav down the left -> Rest of the page.)

I don't think there's a way that EUI can do this for us and is a reasonable default for them but is flexible enough for Kibana.

}
}
Loading