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

Grouped Kibana nav #53545

Merged
merged 42 commits into from
Jan 21, 2020
Merged
Show file tree
Hide file tree
Changes from 37 commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
c187078
rendering something semi-functional
Dec 19, 2019
c8bbcee
improving nested nav support
Dec 20, 2019
fe54ec9
Merge remote-tracking branch 'upstream/master' into kibana-grouped-nav
Dec 20, 2019
8a82938
adding categories for more apps
Dec 20, 2019
897e11b
Merge remote-tracking branch 'upstream/master' into kibana-grouped-nav
Jan 7, 2020
05e5b5d
aligning on category enum
Jan 10, 2020
0eb1a91
Merge remote-tracking branch 'upstream/master' into kibana-grouped-nav
Jan 10, 2020
f425dbc
added advanced settings
Jan 10, 2020
3234902
add license check
Jan 10, 2020
5f04ed5
forcing tests to run with individual nav items
Jan 10, 2020
b5f53a3
cleaning up nits and typings
Jan 12, 2020
ea85827
regenerating core documentation
Jan 12, 2020
629d486
Merge remote-tracking branch 'upstream/master' into kibana-grouped-nav
Jan 12, 2020
c15de44
add category to timelion
Jan 12, 2020
6ad9d3e
test fixes
Jan 13, 2020
f34f763
regenerating core documentation
Jan 13, 2020
321e2f7
Merge remote-tracking branch 'upstream/master' into kibana-grouped-nav
Jan 13, 2020
23a51b6
working around EUI nav bug
Jan 13, 2020
3efdaf5
fix recently visited links
Jan 13, 2020
29585ec
PR feedback and test fixes
Jan 13, 2020
bed3650
undoing stack management rename in favor of group rename
Jan 13, 2020
356c5b0
fixing ML nav placement
Jan 13, 2020
7ebb397
pr revisions and test fixes
Jan 14, 2020
a21c249
Merge remote-tracking branch 'upstream/master' into kibana-grouped-nav
Jan 14, 2020
f666437
updating types and api docs
Jan 14, 2020
efbb04e
fixing tests
Jan 14, 2020
7f3576d
fixing more tests
Jan 14, 2020
cb3b947
fixing more tests
Jan 14, 2020
8b26d41
Merge remote-tracking branch 'upstream/master' into kibana-grouped-nav
Jan 14, 2020
b35266d
fixing the last, I hope, test
Jan 14, 2020
e18acbb
fixing the last test, I hope
Jan 14, 2020
c951a97
improving advanced setting
Jan 14, 2020
e542a03
PR feedback and first attempt at renaming management -> stack management
Jan 14, 2020
f8564f8
Merge remote-tracking branch 'upstream/master' into kibana-grouped-nav
Jan 14, 2020
3d80243
fixing tests
Jan 15, 2020
6bc77cf
Merge remote-tracking branch 'upstream/master' into kibana-grouped-nav
Jan 15, 2020
06a2663
refactoring header component to prep for writing tests
Jan 16, 2020
7cd30ee
i18n fix
Jan 16, 2020
3110e0a
adding tests to header component
Jan 17, 2020
181d384
Merge remote-tracking branch 'upstream/master' into kibana-grouped-nav
Jan 18, 2020
fe9f10d
fixing type error
Jan 18, 2020
9a16416
Merge branch 'master' into kibana-grouped-nav
elasticmachine Jan 21, 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-public](./kibana-plugin-public.md) &gt; [AppBase](./kibana-plugin-public.appbase.md) &gt; [category](./kibana-plugin-public.appbase.category.md)

## AppBase.category property

The category definition of the product See [AppCategory](./kibana-plugin-public.appcategory.md) See DEFAULT\_APP\_CATEGORIES for more reference

<b>Signature:</b>

```typescript
category?: AppCategory;
```
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export interface AppBase
| Property | Type | Description |
| --- | --- | --- |
| [capabilities](./kibana-plugin-public.appbase.capabilities.md) | <code>Partial&lt;Capabilities&gt;</code> | Custom capabilities defined by the app. |
| [category](./kibana-plugin-public.appbase.category.md) | <code>AppCategory</code> | The category definition of the product See [AppCategory](./kibana-plugin-public.appcategory.md) See DEFAULT\_APP\_CATEGORIES for more reference |
| [chromeless](./kibana-plugin-public.appbase.chromeless.md) | <code>boolean</code> | Hide the UI chrome when the application is mounted. Defaults to <code>false</code>. Takes precedence over chrome service visibility settings. |
| [euiIconType](./kibana-plugin-public.appbase.euiicontype.md) | <code>string</code> | A EUI iconType that will be used for the app's icon. This icon takes precendence over the <code>icon</code> property. |
| [icon](./kibana-plugin-public.appbase.icon.md) | <code>string</code> | A URL to an image file used as an icon. Used as a fallback if <code>euiIconType</code> is not provided. |
Expand Down
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-public](./kibana-plugin-public.md) &gt; [AppCategory](./kibana-plugin-public.appcategory.md) &gt; [ariaLabel](./kibana-plugin-public.appcategory.arialabel.md)

## AppCategory.ariaLabel property

If the visual label isn't appropriate for screen readers, can override it here

<b>Signature:</b>

```typescript
ariaLabel?: string;
```
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-public](./kibana-plugin-public.md) &gt; [AppCategory](./kibana-plugin-public.appcategory.md) &gt; [euiIconType](./kibana-plugin-public.appcategory.euiicontype.md)

## AppCategory.euiIconType property

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

<b>Signature:</b>

```typescript
euiIconType?: string;
```
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-public](./kibana-plugin-public.md) &gt; [AppCategory](./kibana-plugin-public.appcategory.md) &gt; [label](./kibana-plugin-public.appcategory.label.md)

## AppCategory.label property

Label used for cateogry name. Also used as aria-label if one isn't set.

<b>Signature:</b>

```typescript
label: string;
```
23 changes: 23 additions & 0 deletions docs/development/core/public/kibana-plugin-public.appcategory.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

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

## AppCategory interface

A category definition for nav links to know where to sort them in the left hand nav

<b>Signature:</b>

```typescript
export interface AppCategory
```

## Properties

| Property | Type | Description |
| --- | --- | --- |
| [ariaLabel](./kibana-plugin-public.appcategory.arialabel.md) | <code>string</code> | If the visual label isn't appropriate for screen readers, can override it here |
| [euiIconType](./kibana-plugin-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 |
| [label](./kibana-plugin-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-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,13 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

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

## AppCategory.order property

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)

<b>Signature:</b>

```typescript
order?: number;
```
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-public](./kibana-plugin-public.md) &gt; [ChromeNavLink](./kibana-plugin-public.chromenavlink.md) &gt; [category](./kibana-plugin-public.chromenavlink.category.md)

## ChromeNavLink.category property

The category the app lives in

<b>Signature:</b>

```typescript
readonly category?: AppCategory;
```
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export interface ChromeNavLink
| --- | --- | --- |
| [active](./kibana-plugin-public.chromenavlink.active.md) | <code>boolean</code> | Indicates whether or not this app is currently on the screen. |
| [baseUrl](./kibana-plugin-public.chromenavlink.baseurl.md) | <code>string</code> | The base route used to open the root of an application. |
| [category](./kibana-plugin-public.chromenavlink.category.md) | <code>AppCategory</code> | The category the app lives in |
| [disabled](./kibana-plugin-public.chromenavlink.disabled.md) | <code>boolean</code> | Disables a link from being clickable. |
| [euiIconType](./kibana-plugin-public.chromenavlink.euiicontype.md) | <code>string</code> | A EUI iconType that will be used for the app's icon. This icon takes precendence over the <code>icon</code> property. |
| [hidden](./kibana-plugin-public.chromenavlink.hidden.md) | <code>boolean</code> | Hides a link from the navigation. |
Expand Down
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-public](./kibana-plugin-public.md) &gt; [LegacyNavLink](./kibana-plugin-public.legacynavlink.md) &gt; [category](./kibana-plugin-public.legacynavlink.category.md)

## LegacyNavLink.category property

<b>Signature:</b>

```typescript
category?: AppCategory;
```
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export interface LegacyNavLink

| Property | Type | Description |
| --- | --- | --- |
| [category](./kibana-plugin-public.legacynavlink.category.md) | <code>AppCategory</code> | |
| [euiIconType](./kibana-plugin-public.legacynavlink.euiicontype.md) | <code>string</code> | |
| [icon](./kibana-plugin-public.legacynavlink.icon.md) | <code>string</code> | |
| [id](./kibana-plugin-public.legacynavlink.id.md) | <code>string</code> | |
Expand Down
1 change: 1 addition & 0 deletions docs/development/core/public/kibana-plugin-public.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ The plugin integrates with the core system via lifecycle events: `setup`<!-- -->
| --- | --- |
| [App](./kibana-plugin-public.app.md) | Extension of [common app properties](./kibana-plugin-public.appbase.md) with the mount function. |
| [AppBase](./kibana-plugin-public.appbase.md) | |
| [AppCategory](./kibana-plugin-public.appcategory.md) | A category definition for nav links to know where to sort them in the left hand nav |
| [AppLeaveConfirmAction](./kibana-plugin-public.appleaveconfirmaction.md) | Action to return from a [AppLeaveHandler](./kibana-plugin-public.appleavehandler.md) to show a confirmation message when trying to leave an application.<!-- -->See |
| [AppLeaveDefaultAction](./kibana-plugin-public.appleavedefaultaction.md) | Action to return from a [AppLeaveHandler](./kibana-plugin-public.appleavehandler.md) to execute the default behaviour when leaving the application.<!-- -->See |
| [ApplicationSetup](./kibana-plugin-public.applicationsetup.md) | |
Expand Down
7 changes: 3 additions & 4 deletions packages/kbn-i18n/src/loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,13 @@
* under the License.
*/

import { readFile } from 'fs';
import * as fs from 'fs';
import * as path from 'path';
import { promisify } from 'util';

import { unique } from './core/helper';
import { Translation } from './translation';

const asyncReadFile = promisify(readFile);

const TRANSLATION_FILE_EXTENSION = '.json';

/**
Expand Down Expand Up @@ -69,7 +67,8 @@ function getLocaleFromFileName(fullFileName: string) {
* @returns
*/
async function loadFile(pathToFile: string): Promise<Translation> {
return JSON.parse(await asyncReadFile(pathToFile, 'utf8'));
// doing this at the moment because fs is mocked in a lot of places where this would otherwise fail
return JSON.parse(await promisify(fs.readFile)(pathToFile, 'utf8'));
}

/**
Expand Down
8 changes: 8 additions & 0 deletions src/core/public/application/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import { PluginOpaqueId } from '../plugins';
import { IUiSettingsClient } from '../ui_settings';
import { RecursiveReadonly } from '../../utils';
import { SavedObjectsStart } from '../saved_objects';
import { AppCategory } from '../../types';

/** @public */
export interface AppBase {
Expand All @@ -44,6 +45,13 @@ export interface AppBase {
*/
title: string;

/**
* The category definition of the product
* See {@link AppCategory}
* See DEFAULT_APP_CATEGORIES for more reference
*/
category?: AppCategory;
myasonik marked this conversation as resolved.
Show resolved Hide resolved

/**
* The initial status of the application.
* Defaulting to `accessible`
Expand Down
2 changes: 2 additions & 0 deletions src/core/public/chrome/chrome_service.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import { notificationServiceMock } from '../notifications/notifications_service.
import { docLinksServiceMock } from '../doc_links/doc_links_service.mock';
import { ChromeService } from './chrome_service';
import { App } from '../application';
import { uiSettingsServiceMock } from '../ui_settings/ui_settings_service.mock';

class FakeApp implements App {
public title = `${this.id} App`;
Expand All @@ -51,6 +52,7 @@ function defaultStartDeps(availableApps?: App[]) {
http: httpServiceMock.createStartContract(),
injectedMetadata: injectedMetadataServiceMock.createStartContract(),
notifications: notificationServiceMock.createStartContract(),
uiSettings: uiSettingsServiceMock.createStartContract(),
};

if (availableApps) {
Expand Down
6 changes: 4 additions & 2 deletions src/core/public/chrome/chrome_service.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import { LoadingIndicator, HeaderWrapper as Header } from './ui';
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';
export { ChromeNavControls, ChromeRecentlyAccessed, ChromeDocTitle };

const IS_COLLAPSED_KEY = 'core.chrome.isCollapsed';
Expand Down Expand Up @@ -85,6 +85,7 @@ interface StartDeps {
http: HttpStart;
injectedMetadata: InjectedMetadataStart;
notifications: NotificationsStart;
uiSettings: IUiSettingsClient;
}

/** @internal */
Expand Down Expand Up @@ -139,6 +140,7 @@ export class ChromeService {
http,
injectedMetadata,
notifications,
uiSettings,
}: StartDeps): Promise<InternalChromeStart> {
this.initVisibility(application);

Expand Down Expand Up @@ -173,7 +175,6 @@ export class ChromeService {
getHeaderComponent: () => (
<React.Fragment>
<LoadingIndicator loadingCount$={http.getLoadingCount$()} />

<Header
application={application}
appTitle$={appTitle$.pipe(takeUntil(this.stop$))}
Expand All @@ -192,6 +193,7 @@ export class ChromeService {
recentlyAccessed$={recentlyAccessed.get$()}
navControlsLeft$={navControls.getLeft$()}
navControlsRight$={navControls.getRight$()}
navSetting$={uiSettings.get$('pageNavigation')}
/>
</React.Fragment>
),
Expand Down
6 changes: 6 additions & 0 deletions src/core/public/chrome/nav_links/nav_link.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
*/

import { pick } from '../../../utils';
import { AppCategory } from '../../';

/**
* @public
Expand All @@ -33,6 +34,11 @@ export interface ChromeNavLink {
*/
readonly title: string;

/**
* The category the app lives in
*/
readonly category?: AppCategory;

/**
* The base route used to open the root of an application.
*/
Expand Down
Loading