From c187078e9a251f2bebe1a1ca9e9cfbbe2dbc2297 Mon Sep 17 00:00:00 2001 From: Michail Yasonik Date: Thu, 19 Dec 2019 17:55:35 -0600 Subject: [PATCH 01/31] rendering something semi-functional --- src/core/public/application/index.ts | 1 + src/core/public/application/types.ts | 19 ++ src/core/public/chrome/nav_links/nav_link.ts | 12 + src/core/public/chrome/ui/header/header.tsx | 294 +++++++++++------- .../injected_metadata_service.ts | 15 + src/core/public/legacy/legacy_service.ts | 1 + src/legacy/core_plugins/kibana/index.js | 14 +- src/legacy/ui/ui_apps/ui_app.js | 4 + src/legacy/ui/ui_nav_links/ui_nav_link.js | 3 + .../legacy/plugins/monitoring/ui_exports.js | 8 + 10 files changed, 259 insertions(+), 112 deletions(-) diff --git a/src/core/public/application/index.ts b/src/core/public/application/index.ts index 9c4427c772a5e..ee8ad403cd761 100644 --- a/src/core/public/application/index.ts +++ b/src/core/public/application/index.ts @@ -22,6 +22,7 @@ export { Capabilities } from './capabilities'; export { App, AppBase, + AppCategoryObj, AppMount, AppMountDeprecated, AppUnmount, diff --git a/src/core/public/application/types.ts b/src/core/public/application/types.ts index fd009066fc664..85a938188627d 100644 --- a/src/core/public/application/types.ts +++ b/src/core/public/application/types.ts @@ -32,6 +32,20 @@ import { IUiSettingsClient } from '../ui_settings'; import { RecursiveReadonly } from '../../utils'; import { SavedObjectsStart } from '../saved_objects'; +export const AppCategoryObj = { + analyze: 'analyze', + observability: 'observability', + security: 'security', + management: 'management', +}; + +enum AppCategory { + analyze, + observability, + security, + management, +} + /** @public */ export interface AppBase { id: string; @@ -41,6 +55,11 @@ export interface AppBase { */ title: string; + /** + * The category the app lives in + */ + category?: AppCategory; + /** * An ordinal used to sort nav links relative to one another for display. */ diff --git a/src/core/public/chrome/nav_links/nav_link.ts b/src/core/public/chrome/nav_links/nav_link.ts index d87d171e028e1..0d0cda640423c 100644 --- a/src/core/public/chrome/nav_links/nav_link.ts +++ b/src/core/public/chrome/nav_links/nav_link.ts @@ -19,6 +19,13 @@ import { pick } from '../../../utils'; +enum AppCategory { + analyze, + observability, + security, + management, +} + /** * @public */ @@ -33,6 +40,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. */ diff --git a/src/core/public/chrome/ui/header/header.tsx b/src/core/public/chrome/ui/header/header.tsx index 75f78ac8b2fa0..4c54cef03cf24 100644 --- a/src/core/public/chrome/ui/header/header.tsx +++ b/src/core/public/chrome/ui/header/header.tsx @@ -43,6 +43,7 @@ import { import { i18n } from '@kbn/i18n'; import { InjectedIntl, injectI18n } from '@kbn/i18n/react'; +import { groupBy, sortBy } from 'lodash'; import { HeaderBadge } from './header_badge'; import { HeaderBreadcrumbs } from './header_breadcrumbs'; import { HeaderHelpMenu } from './header_help_menu'; @@ -58,6 +59,7 @@ import { import { HttpStart } from '../../../http'; import { ChromeHelpExtension } from '../../chrome_service'; import { ApplicationStart, InternalApplicationStart } from '../../../application/types'; +import { NavLinkWrapper } from '../../nav_links/nav_link'; // Providing a buffer between the limit and the cut off index // protects from truncating just the last couple (6) characters @@ -65,7 +67,6 @@ const TRUNCATE_LIMIT: number = 64; const TRUNCATE_AT: number = 58; /** - * * @param {string} url - a relative or root relative url. If a relative path is given then the * absolute url returned will depend on the current page where this function is called from. For example * if you are on page "http://www.mysite.com/shopping/kids" and you pass this function "adults", you would get @@ -74,54 +75,97 @@ const TRUNCATE_AT: number = 58; * @return {string} the relative url transformed into an absolute url */ function relativeToAbsolute(url: string) { - // convert all link urls to absolute urls const a = document.createElement('a'); a.setAttribute('href', url); return a.href; } -function extendRecentlyAccessedHistoryItem( +function euiRecentItem( navLinks: ChromeNavLink[], recentlyAccessed: ChromeRecentlyAccessedHistoryItem, basePath: HttpStart['basePath'] ) { const href = relativeToAbsolute(basePath.prepend(recentlyAccessed.link)); const navLink = navLinks.find(nl => href.startsWith(nl.subUrlBase || nl.baseUrl)); - let titleAndAriaLabel = recentlyAccessed.label; + if (navLink) { - const objectTypeForAriaAppendix = navLink.title; titleAndAriaLabel = i18n.translate('core.ui.recentLinks.linkItem.screenReaderLabel', { defaultMessage: '{recentlyAccessedItemLinklabel}, type: {pageType}', values: { recentlyAccessedItemLinklabel: recentlyAccessed.label, - pageType: objectTypeForAriaAppendix, + pageType: navLink.title, }, }); } return { - ...recentlyAccessed, href, - euiIconType: navLink ? navLink.euiIconType : undefined, + label: truncateRecentItemLabel(recentlyAccessed.label), title: titleAndAriaLabel, + 'aria-label': titleAndAriaLabel, + euiIconType: navLink?.euiIconType, }; } -function extendNavLink(navLink: ChromeNavLink, urlForApp: ApplicationStart['getUrlForApp']) { - if (navLink.legacy) { - return { - ...navLink, - href: navLink.url && !navLink.active ? navLink.url : navLink.baseUrl, - }; +function euiNavLink( + navLink: ChromeNavLink, + urlForApp: ApplicationStart['getUrlForApp'], + legacyMode: boolean, + navigateToApp: ApplicationStart['navigateToApp'], + currentAppId: string | undefined, + basePath: HttpStart['basePath'] +) { + const { + legacy, + url, + active, + baseUrl, + id, + title, + disabled, + euiIconType, + icon, + category, + order, + } = navLink; + let href = urlForApp(id); + + if (legacy) { + href = url && !active ? url : baseUrl; } return { - ...navLink, - href: urlForApp(navLink.id), + category, + key: id, + label: title, + href, // Use href and onClick to support "open in new tab" and SPA navigation in the same link + onClick(event: MouseEvent) { + if ( + !legacyMode && // ignore when in legacy mode + !legacy && // ignore links to legacy apps + !event.defaultPrevented && // onClick prevented default + event.button === 0 && // ignore everything but left clicks + !isModifiedEvent(event) // ignore clicks with modifier keys + ) { + event.preventDefault(); + navigateToApp(id); + } + }, + // Legacy apps use `active` property, NP apps should match the current app + isActive: active || currentAppId === id, + isDisabled: disabled, + iconType: euiIconType, + icon: !euiIconType && icon ? renderLinkIcon(basePath.prepend(`/${icon}`)) : undefined, + order, + 'data-test-subj': 'navDrawerAppsMenuLink', }; } +function renderLinkIcon(url: string) { + return ; +} + function isModifiedEvent(event: MouseEvent) { return !!(event.metaKey || event.altKey || event.ctrlKey || event.shiftKey); } @@ -141,6 +185,15 @@ function findClosestAnchor(element: HTMLElement): HTMLAnchorElement | void { } } +// TODO@myasonik use an enum or something +const categoryIcon = { + management: 'managementApp', +}; + +function getGroupIcon(groupName: string) { + return categoryIcon[groupName]; +} + function truncateRecentItemLabel(label: string): string { if (label.length > TRUNCATE_LIMIT) { label = `${label.substring(0, TRUNCATE_AT)}…`; @@ -174,12 +227,13 @@ interface Props { onIsLockedUpdate?: (isLocked: boolean) => void; } +type ExtendedRecentlyAccessedHistoryItem = ReturnType; + interface State { appTitle: string; - currentAppId?: string; isVisible: boolean; - navLinks: ReadonlyArray>; - recentlyAccessed: ReadonlyArray>; + navLinks: ReadonlyArray>; + recentlyAccessed: ExtendedRecentlyAccessedHistoryItem[]; forceNavigation: boolean; navControlsLeft: readonly ChromeNavControl[]; navControlsRight: readonly ChromeNavControl[]; @@ -229,15 +283,23 @@ class HeaderUI extends Component { appTitle, isVisible, forceNavigation, - navLinks: navLinks.map(navLink => - extendNavLink(navLink, this.props.application.getUrlForApp) - ), + navLinks: navLinks + .filter(navLink => !navLink.hidden) + .map(navLink => + euiNavLink( + navLink, + this.props.application.getUrlForApp, + this.props.legacyMode, + this.props.application.navigateToApp, + currentAppId, + this.props.basePath + ) + ), recentlyAccessed: recentlyAccessed.map(ra => - extendRecentlyAccessedHistoryItem(navLinks, ra, this.props.basePath) + euiRecentItem(navLinks, ra, this.props.basePath) ), navControlsLeft, navControlsRight, - currentAppId, }); }, }); @@ -250,15 +312,14 @@ class HeaderUI extends Component { } public renderLogo() { - const { homeHref, intl } = this.props; + const { homeHref } = this.props; return ( @@ -268,7 +329,9 @@ class HeaderUI extends Component { public renderMenuTrigger() { return ( this.navDrawerRef.current.toggleOpen()} > @@ -276,24 +339,108 @@ class HeaderUI extends Component { ); } + public renderRecentLinks(recentlyAccessed: ExtendedRecentlyAccessedHistoryItem[]) { + return ( + 0), + flyoutMenu: { + title: i18n.translate('core.ui.chrome.sideGlobalNav.viewRecentItemsFlyoutTitle', { + defaultMessage: 'Recent items', + }), + listItems: recentlyAccessed, + }, + }, + ]} + aria-label={i18n.translate('core.ui.recentLinks.screenReaderLabel', { + defaultMessage: 'Recently viewed links, navigation', + })} + /> + ); + } + + public renderNavLinks(navLinks: NavLinkWrapper[]) { + const isOSS = false; // TODO@myasonik + if (navLinks.length < 6 || isOSS) { + return ( + + ); + } + + // TODO@myasonik use an enum or something + const { undefined: unknowns, management, ...mainNav } = groupBy(navLinks, 'category'); + return ( + ({ + label: groupName, + iconType: getGroupIcon(groupName), + flyoutMenu: { title: groupName, listItems: sortBy(mainNav[groupName], 'order') }, + })), + ...sortBy(unknowns, 'order'), + ]} + /> + ); + } + // <> + // ({ + // label: groupName, + // iconType: getGroupIcon(groupName), + // flyoutMenu: { title: groupName, listItems: sortBy(mainNav[groupName], 'order') }, + // })), + // ...sortBy(unknowns, 'order'), + // ]} + // /> + // + // + // + public render() { const { - application, badge$, - basePath, breadcrumbs$, helpExtension$, helpSupportUrl$, - intl, isLocked, kibanaDocLink, kibanaVersion, onIsLockedUpdate, - legacyMode, } = this.props; const { appTitle, - currentAppId, isVisible, navControlsLeft, navControlsRight, @@ -305,70 +452,6 @@ class HeaderUI extends Component { return null; } - const navLinksArray = navLinks - .filter(navLink => !navLink.hidden) - .map(navLink => ({ - key: navLink.id, - label: navLink.title, - - // Use href and onClick to support "open in new tab" and SPA navigation in the same link - href: navLink.href, - onClick: (event: MouseEvent) => { - if ( - !legacyMode && // ignore when in legacy mode - !navLink.legacy && // ignore links to legacy apps - !event.defaultPrevented && // onClick prevented default - event.button === 0 && // ignore everything but left clicks - !isModifiedEvent(event) // ignore clicks with modifier keys - ) { - event.preventDefault(); - application.navigateToApp(navLink.id); - } - }, - - // Legacy apps use `active` property, NP apps should match the current app - isActive: navLink.active || currentAppId === navLink.id, - isDisabled: navLink.disabled, - - iconType: navLink.euiIconType, - icon: - !navLink.euiIconType && navLink.icon ? ( - - ) : ( - undefined - ), - 'data-test-subj': 'navDrawerAppsMenuLink', - })); - - const recentLinksArray = [ - { - label: intl.formatMessage({ - id: 'core.ui.chrome.sideGlobalNav.viewRecentItemsLabel', - defaultMessage: 'Recently viewed', - }), - iconType: 'clock', - isDisabled: recentlyAccessed.length > 0 ? false : true, - flyoutMenu: { - title: intl.formatMessage({ - id: 'core.ui.chrome.sideGlobalNav.viewRecentItemsFlyoutTitle', - defaultMessage: 'Recent items', - }), - listItems: recentlyAccessed.map(item => ({ - label: truncateRecentItemLabel(item.label), - title: item.title, - 'aria-label': item.title, - href: item.href, - iconType: item.euiIconType, - })), - }, - }, - ]; - return (
@@ -411,20 +494,9 @@ class HeaderUI extends Component { defaultMessage: 'Primary', })} > - + {this.renderRecentLinks(recentlyAccessed)} - + {this.renderNavLinks(navLinks)}
); @@ -437,7 +509,7 @@ class HeaderUI extends Component { } const navLink = this.state.navLinks.find(item => item.href === anchor.href); - if (navLink && navLink.disabled) { + if (navLink && navLink.isDisabled) { event.preventDefault(); return; } diff --git a/src/core/public/injected_metadata/injected_metadata_service.ts b/src/core/public/injected_metadata/injected_metadata_service.ts index 0bde1b68e1876..c5ea186ed44be 100644 --- a/src/core/public/injected_metadata/injected_metadata_service.ts +++ b/src/core/public/injected_metadata/injected_metadata_service.ts @@ -27,9 +27,17 @@ import { } from '../../server/types'; import { deepFreeze } from '../../utils/'; +enum AppCategory { + analyze, + observability, + security, + management, +} + /** @public */ export interface LegacyNavLink { id: string; + category: AppCategory; title: string; order: number; url: string; @@ -52,6 +60,7 @@ export interface InjectedMetadataParams { buildNumber: number; branch: string; basePath: string; + category: AppCategory; csp: { warnLegacyBrowsers: boolean; }; @@ -108,6 +117,10 @@ export class InjectedMetadataService { return this.state.basePath; }, + getCategory: () => { + return this.state.category; + }, + getKibanaVersion: () => { return this.state.version; }, @@ -154,6 +167,7 @@ export class InjectedMetadataService { */ export interface InjectedMetadataSetup { getBasePath: () => string; + getCategory: () => AppCategory; getKibanaBuildNumber: () => number; getKibanaBranch: () => string; getKibanaVersion: () => string; @@ -168,6 +182,7 @@ export interface InjectedMetadataSetup { getLegacyMode: () => boolean; getLegacyMetadata: () => { app: unknown; + category?: AppCategory; bundleId: string; nav: LegacyNavLink[]; version: string; diff --git a/src/core/public/legacy/legacy_service.ts b/src/core/public/legacy/legacy_service.ts index a4fdd86de5311..ac05f92793b71 100644 --- a/src/core/public/legacy/legacy_service.ts +++ b/src/core/public/legacy/legacy_service.ts @@ -74,6 +74,7 @@ export class LegacyPlatformService { appUrl: navLink.url, subUrlBase: navLink.subUrlBase, linkToLastSubUrl: navLink.linkToLastSubUrl, + category: navLink.category, }) ); diff --git a/src/legacy/core_plugins/kibana/index.js b/src/legacy/core_plugins/kibana/index.js index 8dc470e20c619..1cbcba273df41 100644 --- a/src/legacy/core_plugins/kibana/index.js +++ b/src/legacy/core_plugins/kibana/index.js @@ -41,6 +41,13 @@ import { i18n } from '@kbn/i18n'; const mkdirAsync = promisify(Fs.mkdir); +const AppCategory = { + analyze: 'analyze', + observability: 'observability', + security: 'security', + management: 'management', +}; + export default function(kibana) { const kbnBaseUrl = '/app/kibana'; return new kibana.Plugin({ @@ -85,6 +92,7 @@ export default function(kibana) { order: -1003, url: `${kbnBaseUrl}#/discover`, euiIconType: 'discoverApp', + category: AppCategory.analyze, }, { id: 'kibana:visualize', @@ -94,6 +102,7 @@ export default function(kibana) { order: -1002, url: `${kbnBaseUrl}#/visualize`, euiIconType: 'visualizeApp', + category: AppCategory.analyze, }, { id: 'kibana:dashboard', @@ -109,6 +118,7 @@ export default function(kibana) { // to determine what url to use for the app link. subUrlBase: `${kbnBaseUrl}#/dashboard`, euiIconType: 'dashboardApp', + category: AppCategory.analyze, }, { id: 'kibana:dev_tools', @@ -118,16 +128,18 @@ export default function(kibana) { order: 9001, url: '/app/kibana#/dev_tools', euiIconType: 'devToolsApp', + category: AppCategory.management, }, { id: 'kibana:management', title: i18n.translate('kbn.managementTitle', { - defaultMessage: 'Management', + defaultMessage: 'Stack Management', }), order: 9003, url: `${kbnBaseUrl}#/management`, euiIconType: 'managementApp', linkToLastSubUrl: false, + category: AppCategory.management, }, ], diff --git a/src/legacy/ui/ui_apps/ui_app.js b/src/legacy/ui/ui_apps/ui_app.js index 9c82ff2abedb5..1cfd54588b516 100644 --- a/src/legacy/ui/ui_apps/ui_app.js +++ b/src/legacy/ui/ui_apps/ui_app.js @@ -32,6 +32,7 @@ export class UiApp { hidden, linkToLastSubUrl, listed, + category, url = `/app/${id}`, } = spec; @@ -46,6 +47,7 @@ export class UiApp { this._icon = icon; this._euiIconType = euiIconType; this._linkToLastSubUrl = linkToLastSubUrl; + this._category = category; this._hidden = hidden; this._listed = listed; this._url = url; @@ -68,6 +70,7 @@ export class UiApp { euiIconType: this._euiIconType, url: this._url, linkToLastSubUrl: this._linkToLastSubUrl, + category: this._category, }); } } @@ -115,6 +118,7 @@ export class UiApp { main: this._main, navLink: this._navLink, linkToLastSubUrl: this._linkToLastSubUrl, + category: this._category, }; } } diff --git a/src/legacy/ui/ui_nav_links/ui_nav_link.js b/src/legacy/ui/ui_nav_links/ui_nav_link.js index 7537a60adbcf2..5888c21a53c95 100644 --- a/src/legacy/ui/ui_nav_links/ui_nav_link.js +++ b/src/legacy/ui/ui_nav_links/ui_nav_link.js @@ -31,6 +31,7 @@ export class UiNavLink { hidden = false, disabled = false, tooltip = '', + category, } = spec; this._id = id; @@ -44,6 +45,7 @@ export class UiNavLink { this._hidden = hidden; this._disabled = disabled; this._tooltip = tooltip; + this._category = category; } getOrder() { @@ -63,6 +65,7 @@ export class UiNavLink { hidden: this._hidden, disabled: this._disabled, tooltip: this._tooltip, + category: this._category, }; } } diff --git a/x-pack/legacy/plugins/monitoring/ui_exports.js b/x-pack/legacy/plugins/monitoring/ui_exports.js index ba659aa74f10c..ab51b703335ad 100644 --- a/x-pack/legacy/plugins/monitoring/ui_exports.js +++ b/x-pack/legacy/plugins/monitoring/ui_exports.js @@ -7,6 +7,13 @@ import { i18n } from '@kbn/i18n'; import { resolve } from 'path'; +const AppCategory = { + analyze: 'analyze', + observability: 'observability', + security: 'security', + management: 'management', +}; + /** * Configuration of dependency objects for the UI, which are needed for the * Monitoring UI app and views and data for outside the monitoring @@ -26,6 +33,7 @@ export const getUiExports = () => ({ euiIconType: 'monitoringApp', linkToLastSubUrl: false, main: 'plugins/monitoring/monitoring', + category: AppCategory.management, }, injectDefaultVars(server) { const config = server.config(); From c8bbcee85a3b5de05931d1b73f61292b28c0d4ea Mon Sep 17 00:00:00 2001 From: Michail Yasonik Date: Fri, 20 Dec 2019 14:27:24 -0600 Subject: [PATCH 02/31] improving nested nav support --- src/core/public/application/types.ts | 2 +- src/core/public/chrome/nav_links/nav_link.ts | 2 +- src/core/public/chrome/ui/header/header.tsx | 151 +++++++++--------- .../injected_metadata_service.ts | 2 +- src/legacy/plugin_discovery/types.ts | 1 + x-pack/legacy/plugins/apm/index.ts | 10 +- x-pack/legacy/plugins/infra/index.ts | 9 ++ x-pack/legacy/plugins/ml/index.ts | 8 + 8 files changed, 106 insertions(+), 79 deletions(-) diff --git a/src/core/public/application/types.ts b/src/core/public/application/types.ts index 85a938188627d..bcebeedb19d97 100644 --- a/src/core/public/application/types.ts +++ b/src/core/public/application/types.ts @@ -58,7 +58,7 @@ export interface AppBase { /** * The category the app lives in */ - category?: AppCategory; + category: AppCategory; /** * An ordinal used to sort nav links relative to one another for display. diff --git a/src/core/public/chrome/nav_links/nav_link.ts b/src/core/public/chrome/nav_links/nav_link.ts index 0d0cda640423c..3a60ac49ce141 100644 --- a/src/core/public/chrome/nav_links/nav_link.ts +++ b/src/core/public/chrome/nav_links/nav_link.ts @@ -43,7 +43,7 @@ export interface ChromeNavLink { /** * The category the app lives in */ - readonly category?: AppCategory; + readonly category: AppCategory; /** * The base route used to open the root of an application. diff --git a/src/core/public/chrome/ui/header/header.tsx b/src/core/public/chrome/ui/header/header.tsx index 4c54cef03cf24..6445f522fc75e 100644 --- a/src/core/public/chrome/ui/header/header.tsx +++ b/src/core/public/chrome/ui/header/header.tsx @@ -364,89 +364,102 @@ class HeaderUI extends Component { ); } - public renderNavLinks(navLinks: NavLinkWrapper[]) { + public renderNavLinks() { const isOSS = false; // TODO@myasonik - if (navLinks.length < 6 || isOSS) { + if (isOSS || this.state.navLinks.length < 7) { return ( - + > + {this.renderRecentLinks(this.state.recentlyAccessed)} + + + ); } // TODO@myasonik use an enum or something - const { undefined: unknowns, management, ...mainNav } = groupBy(navLinks, 'category'); + const { undefined: unknowns, management, ...mainNav } = groupBy( + this.state.navLinks, + 'category' + ); + + // Have to conditional the whole nav because of an EUI bug + // https://github.com/elastic/eui/issues/2709) return ( - ({ - label: groupName, - iconType: getGroupIcon(groupName), - flyoutMenu: { title: groupName, listItems: sortBy(mainNav[groupName], 'order') }, - })), - ...sortBy(unknowns, 'order'), - ]} - /> + > + {this.renderRecentLinks(this.state.recentlyAccessed)} + + { + const childLinks = mainNav[groupName]; + + if (childLinks.length === 1) { + return { ...childLinks[0], label: groupName, iconType: getGroupIcon(groupName) }; + } + + return { + label: groupName, + iconType: getGroupIcon(groupName), + flyoutMenu: { title: groupName, listItems: sortBy(childLinks, 'order') }, + }; + }), + ...sortBy(unknowns, 'order'), + ]} + /> + + + ); } - // <> - // ({ - // label: groupName, - // iconType: getGroupIcon(groupName), - // flyoutMenu: { title: groupName, listItems: sortBy(mainNav[groupName], 'order') }, - // })), - // ...sortBy(unknowns, 'order'), - // ]} - // /> - // - // - // public render() { + const { appTitle, isVisible, navControlsLeft, navControlsRight } = this.state; const { badge$, breadcrumbs$, helpExtension$, helpSupportUrl$, - isLocked, kibanaDocLink, kibanaVersion, - onIsLockedUpdate, } = this.props; - const { - appTitle, - isVisible, - navControlsLeft, - navControlsRight, - navLinks, - recentlyAccessed, - } = this.state; if (!isVisible) { return null; @@ -485,19 +498,7 @@ class HeaderUI extends Component { - - {this.renderRecentLinks(recentlyAccessed)} - - {this.renderNavLinks(navLinks)} - + {this.renderNavLinks()} ); } diff --git a/src/core/public/injected_metadata/injected_metadata_service.ts b/src/core/public/injected_metadata/injected_metadata_service.ts index c5ea186ed44be..7c0b69bf880e7 100644 --- a/src/core/public/injected_metadata/injected_metadata_service.ts +++ b/src/core/public/injected_metadata/injected_metadata_service.ts @@ -182,7 +182,7 @@ export interface InjectedMetadataSetup { getLegacyMode: () => boolean; getLegacyMetadata: () => { app: unknown; - category?: AppCategory; + category: AppCategory; bundleId: string; nav: LegacyNavLink[]; version: string; diff --git a/src/legacy/plugin_discovery/types.ts b/src/legacy/plugin_discovery/types.ts index fe886b9d17811..ffa2ba46fbbe6 100644 --- a/src/legacy/plugin_discovery/types.ts +++ b/src/legacy/plugin_discovery/types.ts @@ -59,6 +59,7 @@ export interface LegacyPluginOptions { euiIconType: string; order: number; listed: boolean; + category: string; }>; apps: any; hacks: string[]; diff --git a/x-pack/legacy/plugins/apm/index.ts b/x-pack/legacy/plugins/apm/index.ts index cf2cbd2507215..0a20e158e1034 100644 --- a/x-pack/legacy/plugins/apm/index.ts +++ b/x-pack/legacy/plugins/apm/index.ts @@ -12,6 +12,13 @@ import { LegacyPluginInitializer } from '../../../../src/legacy/types'; import mappings from './mappings.json'; import { makeApmUsageCollector } from './server/lib/apm_telemetry'; +export const AppCategoryObj = { + analyze: 'analyze', + observability: 'observability', + security: 'security', + management: 'management' +}; + export const apm: LegacyPluginInitializer = kibana => { return new kibana.Plugin({ require: ['kibana', 'elasticsearch', 'xpack_main', 'apm_oss'], @@ -28,7 +35,8 @@ export const apm: LegacyPluginInitializer = kibana => { main: 'plugins/apm/index', icon: 'plugins/apm/icon.svg', euiIconType: 'apmApp', - order: 8100 + order: 8100, + category: AppCategoryObj.observability }, styleSheetPaths: resolve(__dirname, 'public/index.scss'), home: ['plugins/apm/legacy_register_feature'], diff --git a/x-pack/legacy/plugins/infra/index.ts b/x-pack/legacy/plugins/infra/index.ts index 5466f2572a48e..9a4b0921add25 100644 --- a/x-pack/legacy/plugins/infra/index.ts +++ b/x-pack/legacy/plugins/infra/index.ts @@ -21,6 +21,13 @@ const logsSampleDataLinkLabel = i18n.translate('xpack.infra.sampleDataLinkLabel' defaultMessage: 'Logs', }); +export const AppCategoryObj = { + analyze: 'analyze', + observability: 'observability', + security: 'security', + management: 'management', +}; + export function infra(kibana: any) { return new kibana.Plugin({ id: APP_ID, @@ -55,6 +62,7 @@ export function infra(kibana: any) { defaultMessage: 'Metrics', }), url: `/app/${APP_ID}#/infrastructure`, + category: AppCategoryObj.observability, }, { description: i18n.translate('xpack.infra.linkLogsDescription', { @@ -68,6 +76,7 @@ export function infra(kibana: any) { defaultMessage: 'Logs', }), url: `/app/${APP_ID}#/logs`, + category: AppCategoryObj.observability, }, ], mappings: savedObjectMappings, diff --git a/x-pack/legacy/plugins/ml/index.ts b/x-pack/legacy/plugins/ml/index.ts index 3078a0c812ff1..33da4a14fbda7 100755 --- a/x-pack/legacy/plugins/ml/index.ts +++ b/x-pack/legacy/plugins/ml/index.ts @@ -23,6 +23,13 @@ interface MlServer extends Server { addAppLinksToSampleDataset: () => {}; } +enum AppCategory { + analyze, + observability, + security, + management, +} + export const ml = (kibana: any) => { return new kibana.Plugin({ require: ['kibana', 'elasticsearch', 'xpack_main'], @@ -42,6 +49,7 @@ export const ml = (kibana: any) => { icon: 'plugins/ml/application/ml.svg', euiIconType: 'machineLearningApp', main: 'plugins/ml/legacy', + category: AppCategory.management, }, styleSheetPaths: resolve(__dirname, 'public/application/index.scss'), hacks: ['plugins/ml/application/hacks/toggle_app_link_in_nav'], From 8a82938285f3f79046f07f68f4eddf5737c80028 Mon Sep 17 00:00:00 2001 From: Michail Yasonik Date: Fri, 20 Dec 2019 16:13:49 -0600 Subject: [PATCH 03/31] adding categories for more apps --- src/core/public/chrome/ui/header/header.tsx | 5 +++-- .../injected_metadata/injected_metadata_service.ts | 1 + .../ui/ui_exports/ui_export_types/ui_apps.js | 2 ++ x-pack/legacy/plugins/canvas/index.js | 8 ++++++++ x-pack/legacy/plugins/dashboard_mode/index.js | 10 +++++++++- x-pack/legacy/plugins/graph/index.ts | 8 ++++++++ x-pack/legacy/plugins/maps/index.js | 8 ++++++++ x-pack/legacy/plugins/ml/index.ts | 14 +++++++------- x-pack/legacy/plugins/siem/index.ts | 8 ++++++++ x-pack/legacy/plugins/uptime/index.ts | 8 ++++++++ 10 files changed, 62 insertions(+), 10 deletions(-) diff --git a/src/core/public/chrome/ui/header/header.tsx b/src/core/public/chrome/ui/header/header.tsx index 6445f522fc75e..460169756eae4 100644 --- a/src/core/public/chrome/ui/header/header.tsx +++ b/src/core/public/chrome/ui/header/header.tsx @@ -59,7 +59,6 @@ import { import { HttpStart } from '../../../http'; import { ChromeHelpExtension } from '../../chrome_service'; import { ApplicationStart, InternalApplicationStart } from '../../../application/types'; -import { NavLinkWrapper } from '../../nav_links/nav_link'; // Providing a buffer between the limit and the cut off index // protects from truncating just the last couple (6) characters @@ -191,6 +190,7 @@ const categoryIcon = { }; function getGroupIcon(groupName: string) { + // @ts-ignore TODO@myasonik return categoryIcon[groupName]; } @@ -366,7 +366,8 @@ class HeaderUI extends Component { public renderNavLinks() { const isOSS = false; // TODO@myasonik - if (isOSS || this.state.navLinks.length < 7) { + const disableGroupedNavSetting = false; // TODO@myasonik + if (isOSS || disableGroupedNavSetting || this.state.navLinks.length < 7) { return ( ; user?: Record; diff --git a/src/legacy/ui/ui_exports/ui_export_types/ui_apps.js b/src/legacy/ui/ui_exports/ui_export_types/ui_apps.js index d7ac49d9d49a3..639a5a7c58e18 100644 --- a/src/legacy/ui/ui_exports/ui_export_types/ui_apps.js +++ b/src/legacy/ui/ui_exports/ui_export_types/ui_apps.js @@ -34,6 +34,7 @@ function applySpecDefaults(spec, type, pluginSpec) { linkToLastSubUrl = true, listed = !hidden, url = `/app/${id}`, + category, } = spec; if (spec.injectVars) { @@ -61,6 +62,7 @@ function applySpecDefaults(spec, type, pluginSpec) { linkToLastSubUrl, listed, url, + category, }; } diff --git a/x-pack/legacy/plugins/canvas/index.js b/x-pack/legacy/plugins/canvas/index.js index 8e742de6de944..20e6c5a0d01b7 100644 --- a/x-pack/legacy/plugins/canvas/index.js +++ b/x-pack/legacy/plugins/canvas/index.js @@ -10,6 +10,13 @@ import { mappings } from './server/mappings'; import { CANVAS_APP, CANVAS_TYPE, CUSTOM_ELEMENT_TYPE } from './common/lib'; import { migrations } from './migrations'; +export const AppCategoryObj = { + analyze: 'analyze', + observability: 'observability', + security: 'security', + management: 'management', +}; + export function canvas(kibana) { return new kibana.Plugin({ id: CANVAS_APP, @@ -23,6 +30,7 @@ export function canvas(kibana) { icon: 'plugins/canvas/icon.svg', euiIconType: 'canvasApp', main: 'plugins/canvas/legacy_start', + category: AppCategoryObj.analyze, }, interpreter: [ 'plugins/canvas/browser_functions', diff --git a/x-pack/legacy/plugins/dashboard_mode/index.js b/x-pack/legacy/plugins/dashboard_mode/index.js index 4a04249844322..0c589cb9027a8 100644 --- a/x-pack/legacy/plugins/dashboard_mode/index.js +++ b/x-pack/legacy/plugins/dashboard_mode/index.js @@ -12,8 +12,15 @@ import { createDashboardModeRequestInterceptor } from './server'; import { i18n } from '@kbn/i18n'; +export const AppCategoryObj = { + analyze: 'analyze', + observability: 'observability', + security: 'security', + management: 'management', +}; + // Copied largely from plugins/kibana/index.js. The dashboard viewer includes just the dashboard section of -// the standard kibana plugin. We don't want to include code for the other links (visualize, dev tools, etc) +// the standard kibana plugin. We don't want to include code for the other links (visualize, dev tools, etc) // since it's view only, but we want the urls to be the same, so we are using largely the same setup. export function dashboardMode(kibana) { const kbnBaseUrl = '/app/kibana'; @@ -64,6 +71,7 @@ export function dashboardMode(kibana) { } ), icon: 'plugins/kibana/dashboard/assets/dashboard.svg', + category: AppCategoryObj.analyze, }, ], }, diff --git a/x-pack/legacy/plugins/graph/index.ts b/x-pack/legacy/plugins/graph/index.ts index 601a239574e6b..f0eedb0fe9dc6 100644 --- a/x-pack/legacy/plugins/graph/index.ts +++ b/x-pack/legacy/plugins/graph/index.ts @@ -12,6 +12,13 @@ import migrations from './migrations'; import mappings from './mappings.json'; import { LegacyPluginInitializer } from '../../../../src/legacy/plugin_discovery/types'; +export const AppCategoryObj = { + analyze: 'analyze', + observability: 'observability', + security: 'security', + management: 'management', +}; + export const graph: LegacyPluginInitializer = kibana => { return new kibana.Plugin({ id: 'graph', @@ -25,6 +32,7 @@ export const graph: LegacyPluginInitializer = kibana => { icon: 'plugins/graph/icon.png', euiIconType: 'graphApp', main: 'plugins/graph/index', + category: AppCategoryObj.analyze, }, styleSheetPaths: resolve(__dirname, 'public/index.scss'), mappings, diff --git a/x-pack/legacy/plugins/maps/index.js b/x-pack/legacy/plugins/maps/index.js index 83362e73fb314..5f713c95b167c 100644 --- a/x-pack/legacy/plugins/maps/index.js +++ b/x-pack/legacy/plugins/maps/index.js @@ -14,6 +14,13 @@ import _ from 'lodash'; import { MapPlugin } from './server/plugin'; import { APP_ID, APP_ICON, createMapPath, MAP_SAVED_OBJECT_TYPE } from './common/constants'; +export const AppCategoryObj = { + analyze: 'analyze', + observability: 'observability', + security: 'security', + management: 'management', +}; + export function maps(kibana) { return new kibana.Plugin({ // task_manager could be required, but is only used for telemetry @@ -30,6 +37,7 @@ export function maps(kibana) { main: 'plugins/maps/legacy', icon: 'plugins/maps/icon.svg', euiIconType: APP_ICON, + category: AppCategoryObj.analyze, }, injectDefaultVars(server) { const serverConfig = server.config(); diff --git a/x-pack/legacy/plugins/ml/index.ts b/x-pack/legacy/plugins/ml/index.ts index 0a716f8742b52..bdc4830d75c1b 100755 --- a/x-pack/legacy/plugins/ml/index.ts +++ b/x-pack/legacy/plugins/ml/index.ts @@ -23,12 +23,12 @@ interface MlServer extends Server { addAppLinksToSampleDataset: () => {}; } -enum AppCategory { - analyze, - observability, - security, - management, -} +export const AppCategoryObj = { + analyze: 'analyze', + observability: 'observability', + security: 'security', + management: 'management', +}; export const ml = (kibana: any) => { return new kibana.Plugin({ @@ -49,7 +49,7 @@ export const ml = (kibana: any) => { icon: 'plugins/ml/application/ml.svg', euiIconType: 'machineLearningApp', main: 'plugins/ml/legacy', - category: AppCategory.management, + category: AppCategoryObj.management, }, styleSheetPaths: resolve(__dirname, 'public/application/index.scss'), hacks: ['plugins/ml/application/hacks/toggle_app_link_in_nav'], diff --git a/x-pack/legacy/plugins/siem/index.ts b/x-pack/legacy/plugins/siem/index.ts index cf9fffc6a1455..d5b1a104c47b6 100644 --- a/x-pack/legacy/plugins/siem/index.ts +++ b/x-pack/legacy/plugins/siem/index.ts @@ -31,6 +31,13 @@ import { import { defaultIndexPattern } from './default_index_pattern'; import { initServerWithKibana } from './server/kibana.index'; +export const AppCategoryObj = { + analyze: 'analyze', + observability: 'observability', + security: 'security', + management: 'management', +}; + // eslint-disable-next-line @typescript-eslint/no-explicit-any export const siem = (kibana: any) => { return new kibana.Plugin({ @@ -60,6 +67,7 @@ export const siem = (kibana: any) => { order: 9000, title: APP_NAME, url: `/app/${APP_ID}`, + // category: AppCategoryObj.security, }, ], uiSettingDefaults: { diff --git a/x-pack/legacy/plugins/uptime/index.ts b/x-pack/legacy/plugins/uptime/index.ts index e090a2c85e136..92541436729a5 100644 --- a/x-pack/legacy/plugins/uptime/index.ts +++ b/x-pack/legacy/plugins/uptime/index.ts @@ -10,6 +10,13 @@ import { PluginInitializerContext } from 'src/core/server'; import { PLUGIN } from './common/constants'; import { KibanaServer, plugin } from './server'; +export const AppCategoryObj = { + analyze: 'analyze', + observability: 'observability', + security: 'security', + management: 'management', +}; + export const uptime = (kibana: any) => new kibana.Plugin({ configPrefix: 'xpack.uptime', @@ -30,6 +37,7 @@ export const uptime = (kibana: any) => main: 'plugins/uptime/app', order: 8900, url: '/app/uptime#/', + category: AppCategoryObj.observability, }, home: ['plugins/uptime/register_feature'], }, From 05e5b5dac142ff7fe07c71cdb6db478d19eda931 Mon Sep 17 00:00:00 2001 From: Michail Yasonik Date: Fri, 10 Jan 2020 14:10:58 -0600 Subject: [PATCH 04/31] aligning on category enum --- src/core/public/application/index.ts | 1 - src/core/public/application/types.ts | 9 +- src/core/public/chrome/nav_links/nav_link.ts | 8 +- src/core/public/chrome/ui/header/header.tsx | 164 ++++++++++-------- .../injected_metadata_service.ts | 8 +- src/core/public/legacy/legacy_service.ts | 8 +- .../plugins/find_legacy_plugin_specs.ts | 1 + src/legacy/core_plugins/kibana/index.js | 9 +- .../timelion/public/register_feature.ts | 2 +- src/legacy/plugin_discovery/types.ts | 4 +- test/accessibility/services/a11y/a11y.ts | 10 -- x-pack/legacy/plugins/apm/index.ts | 11 +- x-pack/legacy/plugins/canvas/index.js | 10 +- x-pack/legacy/plugins/dashboard_mode/index.js | 10 +- x-pack/legacy/plugins/graph/index.ts | 10 +- x-pack/legacy/plugins/infra/index.ts | 12 +- x-pack/legacy/plugins/lens/index.ts | 2 + x-pack/legacy/plugins/maps/index.js | 10 +- x-pack/legacy/plugins/ml/index.ts | 12 +- .../legacy/plugins/monitoring/ui_exports.js | 9 +- x-pack/legacy/plugins/siem/index.ts | 11 +- x-pack/legacy/plugins/uptime/index.ts | 11 +- 22 files changed, 142 insertions(+), 190 deletions(-) diff --git a/src/core/public/application/index.ts b/src/core/public/application/index.ts index ee8ad403cd761..9c4427c772a5e 100644 --- a/src/core/public/application/index.ts +++ b/src/core/public/application/index.ts @@ -22,7 +22,6 @@ export { Capabilities } from './capabilities'; export { App, AppBase, - AppCategoryObj, AppMount, AppMountDeprecated, AppUnmount, diff --git a/src/core/public/application/types.ts b/src/core/public/application/types.ts index 25763eb22226d..c4d4daad6cead 100644 --- a/src/core/public/application/types.ts +++ b/src/core/public/application/types.ts @@ -32,14 +32,7 @@ import { IUiSettingsClient } from '../ui_settings'; import { RecursiveReadonly } from '../../utils'; import { SavedObjectsStart } from '../saved_objects'; -export const AppCategoryObj = { - analyze: 'analyze', - observability: 'observability', - security: 'security', - management: 'management', -}; - -enum AppCategory { +export enum AppCategory { analyze, observability, security, diff --git a/src/core/public/chrome/nav_links/nav_link.ts b/src/core/public/chrome/nav_links/nav_link.ts index 3a60ac49ce141..728223a729d00 100644 --- a/src/core/public/chrome/nav_links/nav_link.ts +++ b/src/core/public/chrome/nav_links/nav_link.ts @@ -18,13 +18,7 @@ */ import { pick } from '../../../utils'; - -enum AppCategory { - analyze, - observability, - security, - management, -} +import { AppCategory } from '../../application/types'; /** * @public diff --git a/src/core/public/chrome/ui/header/header.tsx b/src/core/public/chrome/ui/header/header.tsx index 460169756eae4..35ec6b590699d 100644 --- a/src/core/public/chrome/ui/header/header.tsx +++ b/src/core/public/chrome/ui/header/header.tsx @@ -59,6 +59,7 @@ import { import { HttpStart } from '../../../http'; import { ChromeHelpExtension } from '../../chrome_service'; import { ApplicationStart, InternalApplicationStart } from '../../../application/types'; +import { AppCategory } from '../../../application/types'; // Providing a buffer between the limit and the cut off index // protects from truncating just the last couple (6) characters @@ -184,14 +185,34 @@ function findClosestAnchor(element: HTMLElement): HTMLAnchorElement | void { } } -// TODO@myasonik use an enum or something -const categoryIcon = { - management: 'managementApp', -}; +function getGroupIcon(groupName: AppCategory) { + switch (groupName) { + case AppCategory.management: + return 'managementApp'; + } +} -function getGroupIcon(groupName: string) { - // @ts-ignore TODO@myasonik - return categoryIcon[groupName]; +function getGroupLabel(groupName: AppCategory) { + switch (groupName) { + case AppCategory.analyze: + return i18n.translate('core.ui.analyzeNavList.label', { + defaultMessage: 'Analyze', + }); + case AppCategory.observability: + return i18n.translate('core.ui.observabilityNavList.label', { + defaultMessage: 'Observability', + }); + case AppCategory.security: + return i18n.translate('core.ui.securityNavList.label', { + defaultMessage: 'Security', + }); + case AppCategory.management: + return i18n.translate('core.ui.managementNavList.label', { + defaultMessage: 'Management', + }); + default: + return groupName; + } } function truncateRecentItemLabel(label: string): string { @@ -364,89 +385,94 @@ class HeaderUI extends Component { ); } - public renderNavLinks() { - const isOSS = false; // TODO@myasonik - const disableGroupedNavSetting = false; // TODO@myasonik - if (isOSS || disableGroupedNavSetting || this.state.navLinks.length < 7) { - return ( - - {this.renderRecentLinks(this.state.recentlyAccessed)} - - - - ); - } - - // TODO@myasonik use an enum or something - const { undefined: unknowns, management, ...mainNav } = groupBy( + public renderGroupedNav() { + const { undefined: unknowns, [AppCategory.management]: management, ...mainNav } = groupBy( this.state.navLinks, 'category' ); - // Have to conditional the whole nav because of an EUI bug - // https://github.com/elastic/eui/issues/2709) return ( - - {this.renderRecentLinks(this.state.recentlyAccessed)} - + <> { - const childLinks = mainNav[groupName]; - + ...Object.keys(mainNav).map(categoryName => { + const category = parseInt(categoryName, 10); + const childLinks = mainNav[categoryName]; if (childLinks.length === 1) { - return { ...childLinks[0], label: groupName, iconType: getGroupIcon(groupName) }; + return { + ...childLinks[0], + label: getGroupLabel(category), + iconType: getGroupIcon(category), + }; } return { - label: groupName, - iconType: getGroupIcon(groupName), - flyoutMenu: { title: groupName, listItems: sortBy(childLinks, 'order') }, + label: getGroupLabel(category), + iconType: getGroupIcon(category), + flyoutMenu: { + title: getGroupLabel(category), + listItems: sortBy(childLinks, 'order'), + }, }; }), ...sortBy(unknowns, 'order'), ]} /> - + {management.length > 0 && ( + + )} + + ); + } + + public renderNavLinks() { + const isOSS = false; // TODO@myasonik + const disableGroupedNavSetting = false; // TODO@myasonik + const showUngroupedNav = isOSS || disableGroupedNavSetting || this.state.navLinks.length < 7; + + return ( + + {this.renderRecentLinks(this.state.recentlyAccessed)} + + {showUngroupedNav ? ( + + ) : ( + this.renderGroupedNav() + )} ); } diff --git a/src/core/public/injected_metadata/injected_metadata_service.ts b/src/core/public/injected_metadata/injected_metadata_service.ts index 504d48af19bc9..782a7ddc5766b 100644 --- a/src/core/public/injected_metadata/injected_metadata_service.ts +++ b/src/core/public/injected_metadata/injected_metadata_service.ts @@ -26,13 +26,7 @@ import { UserProvidedValues, } from '../../server/types'; import { deepFreeze } from '../../utils/'; - -enum AppCategory { - analyze, - observability, - security, - management, -} +import { AppCategory } from '../application/types'; /** @public */ export interface LegacyNavLink { diff --git a/src/core/public/legacy/legacy_service.ts b/src/core/public/legacy/legacy_service.ts index ac05f92793b71..2fcba4ed2a320 100644 --- a/src/core/public/legacy/legacy_service.ts +++ b/src/core/public/legacy/legacy_service.ts @@ -64,8 +64,8 @@ export class LegacyPlatformService { public setup({ core, plugins }: SetupDeps) { // Always register legacy apps, even if not in legacy mode. - core.injectedMetadata.getLegacyMetadata().nav.forEach((navLink: any) => - core.application.registerLegacyApp({ + core.injectedMetadata.getLegacyMetadata().nav.forEach((navLink: any) => { + return core.application.registerLegacyApp({ id: navLink.id, order: navLink.order, title: navLink.title, @@ -75,8 +75,8 @@ export class LegacyPlatformService { subUrlBase: navLink.subUrlBase, linkToLastSubUrl: navLink.linkToLastSubUrl, category: navLink.category, - }) - ); + }); + }); const legacyCore: LegacyCoreSetup = { ...core, diff --git a/src/core/server/legacy/plugins/find_legacy_plugin_specs.ts b/src/core/server/legacy/plugins/find_legacy_plugin_specs.ts index d2e7a39236d0a..aad26b051514b 100644 --- a/src/core/server/legacy/plugins/find_legacy_plugin_specs.ts +++ b/src/core/server/legacy/plugins/find_legacy_plugin_specs.ts @@ -77,6 +77,7 @@ function getNavLinks(uiExports: LegacyUiExports, pluginSpecs: LegacyPluginSpec[] return (uiExports.navLinkSpecs || []) .map(spec => ({ id: spec.id, + category: spec.category, title: spec.title, order: typeof spec.order === 'number' ? spec.order : 0, url: spec.url, diff --git a/src/legacy/core_plugins/kibana/index.js b/src/legacy/core_plugins/kibana/index.js index 51177aabddf4f..19df35d2e2d90 100644 --- a/src/legacy/core_plugins/kibana/index.js +++ b/src/legacy/core_plugins/kibana/index.js @@ -34,16 +34,11 @@ import { getUiSettingDefaults } from './ui_setting_defaults'; import { registerCspCollector } from './server/lib/csp_usage_collector'; import { injectVars } from './inject_vars'; import { i18n } from '@kbn/i18n'; +// eslint-disable-next-line +import { AppCategory } from '../../../core/public/application/types'; const mkdirAsync = promisify(Fs.mkdir); -const AppCategory = { - analyze: 'analyze', - observability: 'observability', - security: 'security', - management: 'management', -}; - export default function(kibana) { const kbnBaseUrl = '/app/kibana'; return new kibana.Plugin({ diff --git a/src/legacy/core_plugins/timelion/public/register_feature.ts b/src/legacy/core_plugins/timelion/public/register_feature.ts index 7dd44b58bd1d7..907ae65b783e4 100644 --- a/src/legacy/core_plugins/timelion/public/register_feature.ts +++ b/src/legacy/core_plugins/timelion/public/register_feature.ts @@ -31,6 +31,6 @@ export const registerFeature = () => { icon: 'timelionApp', path: '/app/timelion', showOnHomePage: false, - category: FeatureCatalogueCategory.DATA, + category: FeatureCatalogueCategory.DATA, // TODO@myasonik #awkward }; }; diff --git a/src/legacy/plugin_discovery/types.ts b/src/legacy/plugin_discovery/types.ts index ffa2ba46fbbe6..43cb03cc2c97b 100644 --- a/src/legacy/plugin_discovery/types.ts +++ b/src/legacy/plugin_discovery/types.ts @@ -24,6 +24,8 @@ import { Capabilities } from '../../core/server'; import { SavedObjectsSchemaDefinition } from '../../core/server/saved_objects/schema'; // eslint-disable-next-line @kbn/eslint/no-restricted-paths import { SavedObjectsManagementDefinition } from '../../core/server/saved_objects/management'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths +import { AppCategory } from '../../../../src/core/public/application/types'; /** * Usage @@ -59,7 +61,7 @@ export interface LegacyPluginOptions { euiIconType: string; order: number; listed: boolean; - category: string; + category: AppCategory; }>; apps: any; hacks: string[]; diff --git a/test/accessibility/services/a11y/a11y.ts b/test/accessibility/services/a11y/a11y.ts index 7adfe7ebfcc7d..6687fb60935a0 100644 --- a/test/accessibility/services/a11y/a11y.ts +++ b/test/accessibility/services/a11y/a11y.ts @@ -78,11 +78,6 @@ export function A11yProvider({ getService }: FtrProviderContext) { private testAxeReport(report: AxeReport) { const errorMsgs = []; - for (const result of report.incomplete) { - // these items require human review and can't be definitively validated - log.warning(printResult(chalk.yellow('UNABLE TO VALIDATE'), result)); - } - for (const result of report.violations) { errorMsgs.push(printResult(chalk.red('VIOLATION'), result)); } @@ -96,11 +91,6 @@ export function A11yProvider({ getService }: FtrProviderContext) { const axeOptions = { reporter: 'v2', runOnly: ['wcag2a', 'wcag2aa'], - rules: { - 'color-contrast': { - enabled: false, - }, - }, }; await (Wd.driver.manage() as any).setTimeouts({ diff --git a/x-pack/legacy/plugins/apm/index.ts b/x-pack/legacy/plugins/apm/index.ts index 0a20e158e1034..1109d8b8b1f64 100644 --- a/x-pack/legacy/plugins/apm/index.ts +++ b/x-pack/legacy/plugins/apm/index.ts @@ -12,12 +12,8 @@ import { LegacyPluginInitializer } from '../../../../src/legacy/types'; import mappings from './mappings.json'; import { makeApmUsageCollector } from './server/lib/apm_telemetry'; -export const AppCategoryObj = { - analyze: 'analyze', - observability: 'observability', - security: 'security', - management: 'management' -}; +// eslint-disable-next-line +import { AppCategory } from '../../../../src/core/public/application/types'; export const apm: LegacyPluginInitializer = kibana => { return new kibana.Plugin({ @@ -25,7 +21,6 @@ export const apm: LegacyPluginInitializer = kibana => { id: 'apm', configPrefix: 'xpack.apm', publicDir: resolve(__dirname, 'public'), - uiExports: { app: { title: 'APM', @@ -36,7 +31,7 @@ export const apm: LegacyPluginInitializer = kibana => { icon: 'plugins/apm/icon.svg', euiIconType: 'apmApp', order: 8100, - category: AppCategoryObj.observability + category: AppCategory.observability }, styleSheetPaths: resolve(__dirname, 'public/index.scss'), home: ['plugins/apm/legacy_register_feature'], diff --git a/x-pack/legacy/plugins/canvas/index.js b/x-pack/legacy/plugins/canvas/index.js index 20e6c5a0d01b7..844977ef9aea4 100644 --- a/x-pack/legacy/plugins/canvas/index.js +++ b/x-pack/legacy/plugins/canvas/index.js @@ -10,12 +10,8 @@ import { mappings } from './server/mappings'; import { CANVAS_APP, CANVAS_TYPE, CUSTOM_ELEMENT_TYPE } from './common/lib'; import { migrations } from './migrations'; -export const AppCategoryObj = { - analyze: 'analyze', - observability: 'observability', - security: 'security', - management: 'management', -}; +// eslint-disable-next-line +import { AppCategory } from '../../../../src/core/public/application/types'; export function canvas(kibana) { return new kibana.Plugin({ @@ -30,7 +26,7 @@ export function canvas(kibana) { icon: 'plugins/canvas/icon.svg', euiIconType: 'canvasApp', main: 'plugins/canvas/legacy_start', - category: AppCategoryObj.analyze, + category: AppCategory.analyze, }, interpreter: [ 'plugins/canvas/browser_functions', diff --git a/x-pack/legacy/plugins/dashboard_mode/index.js b/x-pack/legacy/plugins/dashboard_mode/index.js index 0c589cb9027a8..12817a6072f92 100644 --- a/x-pack/legacy/plugins/dashboard_mode/index.js +++ b/x-pack/legacy/plugins/dashboard_mode/index.js @@ -12,12 +12,8 @@ import { createDashboardModeRequestInterceptor } from './server'; import { i18n } from '@kbn/i18n'; -export const AppCategoryObj = { - analyze: 'analyze', - observability: 'observability', - security: 'security', - management: 'management', -}; +// eslint-disable-next-line +import { AppCategory } from '../../../../src/core/public/application/types'; // Copied largely from plugins/kibana/index.js. The dashboard viewer includes just the dashboard section of // the standard kibana plugin. We don't want to include code for the other links (visualize, dev tools, etc) @@ -71,7 +67,7 @@ export function dashboardMode(kibana) { } ), icon: 'plugins/kibana/dashboard/assets/dashboard.svg', - category: AppCategoryObj.analyze, + category: AppCategory.analyze, }, ], }, diff --git a/x-pack/legacy/plugins/graph/index.ts b/x-pack/legacy/plugins/graph/index.ts index f0eedb0fe9dc6..04311a2a3cb59 100644 --- a/x-pack/legacy/plugins/graph/index.ts +++ b/x-pack/legacy/plugins/graph/index.ts @@ -12,12 +12,8 @@ import migrations from './migrations'; import mappings from './mappings.json'; import { LegacyPluginInitializer } from '../../../../src/legacy/plugin_discovery/types'; -export const AppCategoryObj = { - analyze: 'analyze', - observability: 'observability', - security: 'security', - management: 'management', -}; +// eslint-disable-next-line +import { AppCategory } from '../../../../src/core/public/application/types'; export const graph: LegacyPluginInitializer = kibana => { return new kibana.Plugin({ @@ -32,7 +28,7 @@ export const graph: LegacyPluginInitializer = kibana => { icon: 'plugins/graph/icon.png', euiIconType: 'graphApp', main: 'plugins/graph/index', - category: AppCategoryObj.analyze, + category: AppCategory.analyze, }, styleSheetPaths: resolve(__dirname, 'public/index.scss'), mappings, diff --git a/x-pack/legacy/plugins/infra/index.ts b/x-pack/legacy/plugins/infra/index.ts index f23046bcc418c..aa46d1abc505b 100644 --- a/x-pack/legacy/plugins/infra/index.ts +++ b/x-pack/legacy/plugins/infra/index.ts @@ -21,12 +21,8 @@ import { APMPluginContract } from '../../../plugins/apm/server'; export const APP_ID = 'infra'; -export const AppCategoryObj = { - analyze: 'analyze', - observability: 'observability', - security: 'security', - management: 'management', -}; +// eslint-disable-next-line +import { AppCategory } from '../../../../src/core/public/application/types'; export function infra(kibana: any) { return new kibana.Plugin({ @@ -62,7 +58,7 @@ export function infra(kibana: any) { defaultMessage: 'Metrics', }), url: `/app/${APP_ID}#/infrastructure`, - category: AppCategoryObj.observability, + category: AppCategory.observability, }, { description: i18n.translate('xpack.infra.linkLogsDescription', { @@ -76,7 +72,7 @@ export function infra(kibana: any) { defaultMessage: 'Logs', }), url: `/app/${APP_ID}#/logs`, - category: AppCategoryObj.observability, + category: AppCategory.observability, }, ], mappings: savedObjectMappings, diff --git a/x-pack/legacy/plugins/lens/index.ts b/x-pack/legacy/plugins/lens/index.ts index c4a684381b17c..8d3eaf60c7f7b 100644 --- a/x-pack/legacy/plugins/lens/index.ts +++ b/x-pack/legacy/plugins/lens/index.ts @@ -4,6 +4,8 @@ * you may not use this file except in compliance with the Elastic License. */ +// TODO@myasonik Lens needs a category probably + import * as Joi from 'joi'; import { resolve } from 'path'; import { LegacyPluginInitializer } from 'src/legacy/types'; diff --git a/x-pack/legacy/plugins/maps/index.js b/x-pack/legacy/plugins/maps/index.js index 5f713c95b167c..7dc9a5f778768 100644 --- a/x-pack/legacy/plugins/maps/index.js +++ b/x-pack/legacy/plugins/maps/index.js @@ -14,12 +14,8 @@ import _ from 'lodash'; import { MapPlugin } from './server/plugin'; import { APP_ID, APP_ICON, createMapPath, MAP_SAVED_OBJECT_TYPE } from './common/constants'; -export const AppCategoryObj = { - analyze: 'analyze', - observability: 'observability', - security: 'security', - management: 'management', -}; +// eslint-disable-next-line +import { AppCategory } from '../../../../src/core/public/application/types'; export function maps(kibana) { return new kibana.Plugin({ @@ -37,7 +33,7 @@ export function maps(kibana) { main: 'plugins/maps/legacy', icon: 'plugins/maps/icon.svg', euiIconType: APP_ICON, - category: AppCategoryObj.analyze, + category: AppCategory.analyze, }, injectDefaultVars(server) { const serverConfig = server.config(); diff --git a/x-pack/legacy/plugins/ml/index.ts b/x-pack/legacy/plugins/ml/index.ts index 1c2884e1750ea..f1374860e11dd 100755 --- a/x-pack/legacy/plugins/ml/index.ts +++ b/x-pack/legacy/plugins/ml/index.ts @@ -19,17 +19,13 @@ import { // @ts-ignore: could not find declaration file for module import mappings from './mappings'; +// eslint-disable-next-line +import { AppCategory } from '../../../../src/core/public/application/types'; + interface MlServer extends Server { addAppLinksToSampleDataset: () => {}; } -export const AppCategoryObj = { - analyze: 'analyze', - observability: 'observability', - security: 'security', - management: 'management', -}; - export const ml = (kibana: any) => { return new kibana.Plugin({ require: ['kibana', 'elasticsearch', 'xpack_main'], @@ -49,7 +45,7 @@ export const ml = (kibana: any) => { icon: 'plugins/ml/application/ml.svg', euiIconType: 'machineLearningApp', main: 'plugins/ml/legacy', - category: AppCategoryObj.management, + category: AppCategory.management, }, styleSheetPaths: resolve(__dirname, 'public/application/index.scss'), hacks: ['plugins/ml/application/hacks/toggle_app_link_in_nav'], diff --git a/x-pack/legacy/plugins/monitoring/ui_exports.js b/x-pack/legacy/plugins/monitoring/ui_exports.js index ab51b703335ad..7dc91263da417 100644 --- a/x-pack/legacy/plugins/monitoring/ui_exports.js +++ b/x-pack/legacy/plugins/monitoring/ui_exports.js @@ -6,13 +6,8 @@ import { i18n } from '@kbn/i18n'; import { resolve } from 'path'; - -const AppCategory = { - analyze: 'analyze', - observability: 'observability', - security: 'security', - management: 'management', -}; +// eslint-disable-next-line +import { AppCategory } from '../../../../src/core/public/application/types'; /** * Configuration of dependency objects for the UI, which are needed for the diff --git a/x-pack/legacy/plugins/siem/index.ts b/x-pack/legacy/plugins/siem/index.ts index d5b1a104c47b6..a132779b5da51 100644 --- a/x-pack/legacy/plugins/siem/index.ts +++ b/x-pack/legacy/plugins/siem/index.ts @@ -30,13 +30,8 @@ import { } from './common/constants'; import { defaultIndexPattern } from './default_index_pattern'; import { initServerWithKibana } from './server/kibana.index'; - -export const AppCategoryObj = { - analyze: 'analyze', - observability: 'observability', - security: 'security', - management: 'management', -}; +// eslint-disable-next-line +import { AppCategory } from '../../../../src/core/public/application/types'; // eslint-disable-next-line @typescript-eslint/no-explicit-any export const siem = (kibana: any) => { @@ -67,7 +62,7 @@ export const siem = (kibana: any) => { order: 9000, title: APP_NAME, url: `/app/${APP_ID}`, - // category: AppCategoryObj.security, + category: AppCategory.security, }, ], uiSettingDefaults: { diff --git a/x-pack/legacy/plugins/uptime/index.ts b/x-pack/legacy/plugins/uptime/index.ts index 92541436729a5..8ceb91dc0bd30 100644 --- a/x-pack/legacy/plugins/uptime/index.ts +++ b/x-pack/legacy/plugins/uptime/index.ts @@ -9,13 +9,8 @@ import { resolve } from 'path'; import { PluginInitializerContext } from 'src/core/server'; import { PLUGIN } from './common/constants'; import { KibanaServer, plugin } from './server'; - -export const AppCategoryObj = { - analyze: 'analyze', - observability: 'observability', - security: 'security', - management: 'management', -}; +// eslint-disable-next-line +import { AppCategory } from '../../../../src/core/public/application/types'; export const uptime = (kibana: any) => new kibana.Plugin({ @@ -37,7 +32,7 @@ export const uptime = (kibana: any) => main: 'plugins/uptime/app', order: 8900, url: '/app/uptime#/', - category: AppCategoryObj.observability, + category: AppCategory.observability, }, home: ['plugins/uptime/register_feature'], }, From f425dbce03a753aa9ad997528db93701a18eef7e Mon Sep 17 00:00:00 2001 From: Michail Yasonik Date: Fri, 10 Jan 2020 16:04:44 -0600 Subject: [PATCH 05/31] added advanced settings --- src/core/public/application/index.ts | 1 + src/core/public/chrome/chrome_service.tsx | 7 ++++++- src/core/public/chrome/ui/header/header.tsx | 5 ++++- src/core/public/index.ts | 1 + .../plugins/find_legacy_plugin_specs.ts | 1 + src/core/server/legacy/types.ts | 4 ++-- .../kibana/ui_setting_defaults.js | 19 +++++++++++++++++++ 7 files changed, 34 insertions(+), 4 deletions(-) diff --git a/src/core/public/application/index.ts b/src/core/public/application/index.ts index 17fec9261accf..6932da8bf38c2 100644 --- a/src/core/public/application/index.ts +++ b/src/core/public/application/index.ts @@ -22,6 +22,7 @@ export { Capabilities } from './capabilities'; export { App, AppBase, + AppCategory, AppMount, AppMountDeprecated, AppUnmount, diff --git a/src/core/public/chrome/chrome_service.tsx b/src/core/public/chrome/chrome_service.tsx index 18c0c9870d72f..9a4ff1697e4ff 100644 --- a/src/core/public/chrome/chrome_service.tsx +++ b/src/core/public/chrome/chrome_service.tsx @@ -163,6 +163,11 @@ export class ChromeService { ); } + const settings = injectedMetadata.getLegacyMetadata().uiSettings; + + const navSetting = + settings?.user?.pageNavigation.userValue || settings.defaults.pageNavigation.value; + return { navControls, navLinks, @@ -172,7 +177,6 @@ export class ChromeService { getHeaderComponent: () => ( -
), diff --git a/src/core/public/chrome/ui/header/header.tsx b/src/core/public/chrome/ui/header/header.tsx index 35ec6b590699d..79e28bfc3a8f1 100644 --- a/src/core/public/chrome/ui/header/header.tsx +++ b/src/core/public/chrome/ui/header/header.tsx @@ -245,6 +245,7 @@ interface Props { intl: InjectedIntl; basePath: HttpStart['basePath']; isLocked?: boolean; + navSetting: 'individual' | 'grouped'; onIsLockedUpdate?: (isLocked: boolean) => void; } @@ -447,7 +448,7 @@ class HeaderUI extends Component { public renderNavLinks() { const isOSS = false; // TODO@myasonik - const disableGroupedNavSetting = false; // TODO@myasonik + const disableGroupedNavSetting = this.props.navSetting === 'individual'; const showUngroupedNav = isOSS || disableGroupedNavSetting || this.state.navLinks.length < 7; return ( @@ -492,6 +493,8 @@ class HeaderUI extends Component { return null; } + // console.log(this.props.application); + return (
diff --git a/src/core/public/index.ts b/src/core/public/index.ts index ea704749c6131..93acc312c224c 100644 --- a/src/core/public/index.ts +++ b/src/core/public/index.ts @@ -84,6 +84,7 @@ export { ApplicationStart, App, AppBase, + AppCategory, AppMount, AppMountDeprecated, AppUnmount, diff --git a/src/core/server/legacy/plugins/find_legacy_plugin_specs.ts b/src/core/server/legacy/plugins/find_legacy_plugin_specs.ts index aad26b051514b..d51e7babfd464 100644 --- a/src/core/server/legacy/plugins/find_legacy_plugin_specs.ts +++ b/src/core/server/legacy/plugins/find_legacy_plugin_specs.ts @@ -63,6 +63,7 @@ function getUiAppsNavLinks({ uiAppSpecs = [] }: LegacyUiExports, pluginSpecs: Le return { id, + category: spec.category, title: spec.title, order: typeof spec.order === 'number' ? spec.order : 0, icon: spec.icon, diff --git a/src/core/server/legacy/types.ts b/src/core/server/legacy/types.ts index 6ec893be9b310..f037001e25820 100644 --- a/src/core/server/legacy/types.ts +++ b/src/core/server/legacy/types.ts @@ -19,7 +19,7 @@ import { Server } from 'hapi'; -import { ChromeNavLink } from '../../public'; +import { ChromeNavLink, AppCategory } from '../../public'; import { LegacyRequest } from '../http'; import { InternalCoreSetup, InternalCoreStart } from '../internal_types'; import { PluginsServiceSetup, PluginsServiceStart } from '../plugins'; @@ -139,7 +139,7 @@ export type LegacyNavLinkSpec = Record & ChromeNavLink; */ export type LegacyAppSpec = Pick< ChromeNavLink, - 'title' | 'order' | 'icon' | 'euiIconType' | 'url' | 'linkToLastSubUrl' | 'hidden' + 'title' | 'order' | 'icon' | 'euiIconType' | 'url' | 'linkToLastSubUrl' | 'hidden' | 'category' > & { pluginId?: string; id?: string; listed?: boolean }; /** diff --git a/src/legacy/core_plugins/kibana/ui_setting_defaults.js b/src/legacy/core_plugins/kibana/ui_setting_defaults.js index 196d9662f8b15..6df01fc0ac22f 100644 --- a/src/legacy/core_plugins/kibana/ui_setting_defaults.js +++ b/src/legacy/core_plugins/kibana/ui_setting_defaults.js @@ -1164,5 +1164,24 @@ export function getUiSettingDefaults() { category: ['accessibility'], requiresPageReload: true, }, + pageNavigation: { + name: i18n.translate('kbn.advancedSettings.pageNavigationName', { + defaultMessage: 'Side nav style', + }), + value: 'grouped', + description: i18n.translate('kbn.advancedSettings.pageNavigationDesc', { + defaultMessage: 'Change the style of navigation', + }), + type: 'select', + options: ['grouped', 'individual'], + optionLabels: { + grouped: i18n.translate('kbn.advancedSettings.pageNavigationGrouped', { + defaultMessage: 'Grouped', + }), + individual: i18n.translate('kbn.advancedSettings.pageNavigationIndividual', { + defaultMessage: 'Individual', + }), + }, + }, }; } From 32349023fbe9477a13f40cdfd4c8d7f31ca677b9 Mon Sep 17 00:00:00 2001 From: Michail Yasonik Date: Fri, 10 Jan 2020 16:41:05 -0600 Subject: [PATCH 06/31] add license check --- src/core/public/chrome/chrome_service.tsx | 7 ++++++- src/core/public/chrome/ui/header/header.tsx | 3 ++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/core/public/chrome/chrome_service.tsx b/src/core/public/chrome/chrome_service.tsx index 9a4ff1697e4ff..30372efd145e5 100644 --- a/src/core/public/chrome/chrome_service.tsx +++ b/src/core/public/chrome/chrome_service.tsx @@ -166,7 +166,11 @@ export class ChromeService { const settings = injectedMetadata.getLegacyMetadata().uiSettings; const navSetting = - settings?.user?.pageNavigation.userValue || settings.defaults.pageNavigation.value; + settings?.user?.pageNavigation?.userValue || settings.defaults.pageNavigation.value; + + const license = (injectedMetadata.getInjectedVars().xpackInitialInfo as { + license: { type: string }; + }).license.type; return { navControls, @@ -196,6 +200,7 @@ export class ChromeService { navControlsLeft$={navControls.getLeft$()} navControlsRight$={navControls.getRight$()} navSetting={navSetting} + license={license} /> ), diff --git a/src/core/public/chrome/ui/header/header.tsx b/src/core/public/chrome/ui/header/header.tsx index 79e28bfc3a8f1..b7de523c386b1 100644 --- a/src/core/public/chrome/ui/header/header.tsx +++ b/src/core/public/chrome/ui/header/header.tsx @@ -246,6 +246,7 @@ interface Props { basePath: HttpStart['basePath']; isLocked?: boolean; navSetting: 'individual' | 'grouped'; + license: string; onIsLockedUpdate?: (isLocked: boolean) => void; } @@ -447,7 +448,7 @@ class HeaderUI extends Component { } public renderNavLinks() { - const isOSS = false; // TODO@myasonik + const isOSS = this.props.license === 'oss'; const disableGroupedNavSetting = this.props.navSetting === 'individual'; const showUngroupedNav = isOSS || disableGroupedNavSetting || this.state.navLinks.length < 7; From 5f04ed5f2b7fe5f555c88546472e3a6d1b978d8b Mon Sep 17 00:00:00 2001 From: Michail Yasonik Date: Fri, 10 Jan 2020 16:59:39 -0600 Subject: [PATCH 07/31] forcing tests to run with individual nav items --- test/functional/apps/dashboard/create_and_add_embeddables.js | 1 + .../feature_controls/advanced_settings_security.ts | 2 +- .../test/functional/apps/dashboard_mode/dashboard_view_mode.js | 1 + .../index_patterns/feature_controls/index_patterns_security.ts | 2 +- 4 files changed, 4 insertions(+), 2 deletions(-) diff --git a/test/functional/apps/dashboard/create_and_add_embeddables.js b/test/functional/apps/dashboard/create_and_add_embeddables.js index 90f02c36b3b7f..042e766d963ba 100644 --- a/test/functional/apps/dashboard/create_and_add_embeddables.js +++ b/test/functional/apps/dashboard/create_and_add_embeddables.js @@ -34,6 +34,7 @@ export default function({ getService, getPageObjects }) { await esArchiver.load('dashboard/current/kibana'); await kibanaServer.uiSettings.replace({ defaultIndex: '0bf35f60-3dc9-11e8-8660-4d65aa086b3c', + pageNavigation: 'individual', }); await PageObjects.common.navigateToApp('dashboard'); await PageObjects.dashboard.preserveCrossAppState(); diff --git a/x-pack/test/functional/apps/advanced_settings/feature_controls/advanced_settings_security.ts b/x-pack/test/functional/apps/advanced_settings/feature_controls/advanced_settings_security.ts index f148d62421ff8..cd77b65ae986c 100644 --- a/x-pack/test/functional/apps/advanced_settings/feature_controls/advanced_settings_security.ts +++ b/x-pack/test/functional/apps/advanced_settings/feature_controls/advanced_settings_security.ts @@ -54,7 +54,7 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { expectSpaceSelector: false, } ); - await kibanaServer.uiSettings.replace({}); + await kibanaServer.uiSettings.replace({ pageNavigation: 'individual' }); await PageObjects.settings.navigateTo(); }); diff --git a/x-pack/test/functional/apps/dashboard_mode/dashboard_view_mode.js b/x-pack/test/functional/apps/dashboard_mode/dashboard_view_mode.js index 510a8b035f053..7fab4143e0497 100644 --- a/x-pack/test/functional/apps/dashboard_mode/dashboard_view_mode.js +++ b/x-pack/test/functional/apps/dashboard_mode/dashboard_view_mode.js @@ -39,6 +39,7 @@ export default function({ getService, getPageObjects }) { await esArchiver.load('dashboard_view_mode'); await kibanaServer.uiSettings.replace({ defaultIndex: 'logstash-*', + pageNavigation: 'individual', }); await browser.setWindowSize(1600, 1000); diff --git a/x-pack/test/functional/apps/index_patterns/feature_controls/index_patterns_security.ts b/x-pack/test/functional/apps/index_patterns/feature_controls/index_patterns_security.ts index 4929bb52c170c..9411b97c3b1ec 100644 --- a/x-pack/test/functional/apps/index_patterns/feature_controls/index_patterns_security.ts +++ b/x-pack/test/functional/apps/index_patterns/feature_controls/index_patterns_security.ts @@ -115,7 +115,7 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { } ); - await kibanaServer.uiSettings.replace({}); + await kibanaServer.uiSettings.replace({ pageNavigation: 'individual' }); await PageObjects.settings.navigateTo(); }); From b5f53a322449da32293ded46be465b4a6e740189 Mon Sep 17 00:00:00 2001 From: Michail Yasonik Date: Sun, 12 Jan 2020 13:41:06 -0500 Subject: [PATCH 08/31] cleaning up nits and typings --- src/core/public/application/index.ts | 1 - src/core/public/application/types.ts | 10 ++------ src/core/public/chrome/nav_links/nav_link.ts | 4 +-- src/core/public/chrome/ui/header/header.tsx | 4 +-- src/core/public/index.ts | 1 - .../injected_metadata_service.ts | 12 ++++----- src/core/public/legacy/legacy_service.ts | 8 +++--- src/core/server/legacy/types.ts | 2 +- src/core/types/app_categories.ts | 25 +++++++++++++++++++ src/core/types/index.ts | 1 + src/legacy/core_plugins/kibana/index.js | 3 +-- src/legacy/plugin_discovery/types.ts | 5 ++-- x-pack/legacy/plugins/apm/index.ts | 4 +-- x-pack/legacy/plugins/canvas/index.js | 4 +-- x-pack/legacy/plugins/dashboard_mode/index.js | 9 ++----- x-pack/legacy/plugins/graph/index.ts | 4 +-- x-pack/legacy/plugins/infra/index.ts | 4 +-- x-pack/legacy/plugins/maps/index.js | 8 +++--- x-pack/legacy/plugins/ml/index.ts | 5 +--- .../legacy/plugins/monitoring/ui_exports.js | 3 +-- x-pack/legacy/plugins/siem/index.ts | 3 +-- x-pack/legacy/plugins/uptime/index.ts | 3 +-- 22 files changed, 58 insertions(+), 65 deletions(-) create mode 100644 src/core/types/app_categories.ts diff --git a/src/core/public/application/index.ts b/src/core/public/application/index.ts index 6932da8bf38c2..17fec9261accf 100644 --- a/src/core/public/application/index.ts +++ b/src/core/public/application/index.ts @@ -22,7 +22,6 @@ export { Capabilities } from './capabilities'; export { App, AppBase, - AppCategory, AppMount, AppMountDeprecated, AppUnmount, diff --git a/src/core/public/application/types.ts b/src/core/public/application/types.ts index 72c3f4cb307da..691480040b5ec 100644 --- a/src/core/public/application/types.ts +++ b/src/core/public/application/types.ts @@ -31,13 +31,7 @@ import { PluginOpaqueId } from '../plugins'; import { IUiSettingsClient } from '../ui_settings'; import { RecursiveReadonly } from '../../utils'; import { SavedObjectsStart } from '../saved_objects'; - -export enum AppCategory { - analyze, - observability, - security, - management, -} +import { AppCategory } from '../../types'; /** @public */ export interface AppBase { @@ -51,7 +45,7 @@ export interface AppBase { /** * The category the app lives in */ - category: AppCategory; + category?: AppCategory; /** * An ordinal used to sort nav links relative to one another for display. diff --git a/src/core/public/chrome/nav_links/nav_link.ts b/src/core/public/chrome/nav_links/nav_link.ts index 313689ffa5338..4ac71aa278c70 100644 --- a/src/core/public/chrome/nav_links/nav_link.ts +++ b/src/core/public/chrome/nav_links/nav_link.ts @@ -18,7 +18,7 @@ */ import { pick } from '../../../utils'; -import { AppCategory } from '../../application/types'; +import { AppCategory } from '../../../types'; /** * @public @@ -37,7 +37,7 @@ export interface ChromeNavLink { /** * The category the app lives in */ - readonly category: AppCategory; + readonly category?: AppCategory; /** * The base route used to open the root of an application. diff --git a/src/core/public/chrome/ui/header/header.tsx b/src/core/public/chrome/ui/header/header.tsx index b7de523c386b1..9c4251075ee61 100644 --- a/src/core/public/chrome/ui/header/header.tsx +++ b/src/core/public/chrome/ui/header/header.tsx @@ -59,7 +59,7 @@ import { import { HttpStart } from '../../../http'; import { ChromeHelpExtension } from '../../chrome_service'; import { ApplicationStart, InternalApplicationStart } from '../../../application/types'; -import { AppCategory } from '../../../application/types'; +import { AppCategory } from '../../../../types'; // Providing a buffer between the limit and the cut off index // protects from truncating just the last couple (6) characters @@ -494,8 +494,6 @@ class HeaderUI extends Component { return null; } - // console.log(this.props.application); - return (
diff --git a/src/core/public/index.ts b/src/core/public/index.ts index 93acc312c224c..ea704749c6131 100644 --- a/src/core/public/index.ts +++ b/src/core/public/index.ts @@ -84,7 +84,6 @@ export { ApplicationStart, App, AppBase, - AppCategory, AppMount, AppMountDeprecated, AppUnmount, diff --git a/src/core/public/injected_metadata/injected_metadata_service.ts b/src/core/public/injected_metadata/injected_metadata_service.ts index 782a7ddc5766b..e214bae995fd2 100644 --- a/src/core/public/injected_metadata/injected_metadata_service.ts +++ b/src/core/public/injected_metadata/injected_metadata_service.ts @@ -26,12 +26,12 @@ import { UserProvidedValues, } from '../../server/types'; import { deepFreeze } from '../../utils/'; -import { AppCategory } from '../application/types'; +import { AppCategory } from '../../types'; /** @public */ export interface LegacyNavLink { id: string; - category: AppCategory; + category?: AppCategory; title: string; order: number; url: string; @@ -54,7 +54,7 @@ export interface InjectedMetadataParams { buildNumber: number; branch: string; basePath: string; - category: AppCategory; + category?: AppCategory; csp: { warnLegacyBrowsers: boolean; }; @@ -78,7 +78,7 @@ export interface InjectedMetadataParams { basePath: string; serverName: string; devMode: boolean; - category: AppCategory; + category?: AppCategory; uiSettings: { defaults: Record; user?: Record; @@ -162,7 +162,7 @@ export class InjectedMetadataService { */ export interface InjectedMetadataSetup { getBasePath: () => string; - getCategory: () => AppCategory; + getCategory: () => AppCategory | undefined; getKibanaBuildNumber: () => number; getKibanaBranch: () => string; getKibanaVersion: () => string; @@ -177,7 +177,7 @@ export interface InjectedMetadataSetup { getLegacyMode: () => boolean; getLegacyMetadata: () => { app: unknown; - category: AppCategory; + category?: AppCategory; bundleId: string; nav: LegacyNavLink[]; version: string; diff --git a/src/core/public/legacy/legacy_service.ts b/src/core/public/legacy/legacy_service.ts index 2fcba4ed2a320..ac05f92793b71 100644 --- a/src/core/public/legacy/legacy_service.ts +++ b/src/core/public/legacy/legacy_service.ts @@ -64,8 +64,8 @@ export class LegacyPlatformService { public setup({ core, plugins }: SetupDeps) { // Always register legacy apps, even if not in legacy mode. - core.injectedMetadata.getLegacyMetadata().nav.forEach((navLink: any) => { - return core.application.registerLegacyApp({ + core.injectedMetadata.getLegacyMetadata().nav.forEach((navLink: any) => + core.application.registerLegacyApp({ id: navLink.id, order: navLink.order, title: navLink.title, @@ -75,8 +75,8 @@ export class LegacyPlatformService { subUrlBase: navLink.subUrlBase, linkToLastSubUrl: navLink.linkToLastSubUrl, category: navLink.category, - }); - }); + }) + ); const legacyCore: LegacyCoreSetup = { ...core, diff --git a/src/core/server/legacy/types.ts b/src/core/server/legacy/types.ts index f037001e25820..58dfa72ab9f3d 100644 --- a/src/core/server/legacy/types.ts +++ b/src/core/server/legacy/types.ts @@ -19,7 +19,7 @@ import { Server } from 'hapi'; -import { ChromeNavLink, AppCategory } from '../../public'; +import { ChromeNavLink } from '../../public'; import { LegacyRequest } from '../http'; import { InternalCoreSetup, InternalCoreStart } from '../internal_types'; import { PluginsServiceSetup, PluginsServiceStart } from '../plugins'; diff --git a/src/core/types/app_categories.ts b/src/core/types/app_categories.ts new file mode 100644 index 0000000000000..4b5e0f27ef8ac --- /dev/null +++ b/src/core/types/app_categories.ts @@ -0,0 +1,25 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +export enum AppCategory { + analyze, + observability, + security, + management, +} diff --git a/src/core/types/index.ts b/src/core/types/index.ts index d01b514c770a7..8c47e6601cce7 100644 --- a/src/core/types/index.ts +++ b/src/core/types/index.ts @@ -23,3 +23,4 @@ */ export * from './core_service'; export * from './capabilities'; +export * from './app_categories'; diff --git a/src/legacy/core_plugins/kibana/index.js b/src/legacy/core_plugins/kibana/index.js index 19df35d2e2d90..eab9dda76857e 100644 --- a/src/legacy/core_plugins/kibana/index.js +++ b/src/legacy/core_plugins/kibana/index.js @@ -34,8 +34,7 @@ import { getUiSettingDefaults } from './ui_setting_defaults'; import { registerCspCollector } from './server/lib/csp_usage_collector'; import { injectVars } from './inject_vars'; import { i18n } from '@kbn/i18n'; -// eslint-disable-next-line -import { AppCategory } from '../../../core/public/application/types'; +import { AppCategory } from '../../../core/types'; const mkdirAsync = promisify(Fs.mkdir); diff --git a/src/legacy/plugin_discovery/types.ts b/src/legacy/plugin_discovery/types.ts index 43cb03cc2c97b..a5d716ad958f2 100644 --- a/src/legacy/plugin_discovery/types.ts +++ b/src/legacy/plugin_discovery/types.ts @@ -24,8 +24,7 @@ import { Capabilities } from '../../core/server'; import { SavedObjectsSchemaDefinition } from '../../core/server/saved_objects/schema'; // eslint-disable-next-line @kbn/eslint/no-restricted-paths import { SavedObjectsManagementDefinition } from '../../core/server/saved_objects/management'; -// eslint-disable-next-line @kbn/eslint/no-restricted-paths -import { AppCategory } from '../../../../src/core/public/application/types'; +import { AppCategory } from '../../core/types'; /** * Usage @@ -61,7 +60,7 @@ export interface LegacyPluginOptions { euiIconType: string; order: number; listed: boolean; - category: AppCategory; + category?: AppCategory; }>; apps: any; hacks: string[]; diff --git a/x-pack/legacy/plugins/apm/index.ts b/x-pack/legacy/plugins/apm/index.ts index 1109d8b8b1f64..b97ddf9ac4e87 100644 --- a/x-pack/legacy/plugins/apm/index.ts +++ b/x-pack/legacy/plugins/apm/index.ts @@ -9,12 +9,10 @@ import { Server } from 'hapi'; import { resolve } from 'path'; import { APMPluginContract } from '../../../plugins/apm/server'; import { LegacyPluginInitializer } from '../../../../src/legacy/types'; +import { AppCategory } from '../../../../src/core/types'; import mappings from './mappings.json'; import { makeApmUsageCollector } from './server/lib/apm_telemetry'; -// eslint-disable-next-line -import { AppCategory } from '../../../../src/core/public/application/types'; - export const apm: LegacyPluginInitializer = kibana => { return new kibana.Plugin({ require: ['kibana', 'elasticsearch', 'xpack_main', 'apm_oss'], diff --git a/x-pack/legacy/plugins/canvas/index.js b/x-pack/legacy/plugins/canvas/index.js index 844977ef9aea4..684570c6f547c 100644 --- a/x-pack/legacy/plugins/canvas/index.js +++ b/x-pack/legacy/plugins/canvas/index.js @@ -5,14 +5,12 @@ */ import { resolve } from 'path'; +import { AppCategory } from '../../../../src/core/types'; import { init } from './init'; import { mappings } from './server/mappings'; import { CANVAS_APP, CANVAS_TYPE, CUSTOM_ELEMENT_TYPE } from './common/lib'; import { migrations } from './migrations'; -// eslint-disable-next-line -import { AppCategory } from '../../../../src/core/public/application/types'; - export function canvas(kibana) { return new kibana.Plugin({ id: CANVAS_APP, diff --git a/x-pack/legacy/plugins/dashboard_mode/index.js b/x-pack/legacy/plugins/dashboard_mode/index.js index 12817a6072f92..72a2aab24ee98 100644 --- a/x-pack/legacy/plugins/dashboard_mode/index.js +++ b/x-pack/legacy/plugins/dashboard_mode/index.js @@ -5,16 +5,11 @@ */ import { resolve } from 'path'; - +import { i18n } from '@kbn/i18n'; +import { AppCategory } from '../../../../src/core/types'; import { CONFIG_DASHBOARD_ONLY_MODE_ROLES } from './common'; - import { createDashboardModeRequestInterceptor } from './server'; -import { i18n } from '@kbn/i18n'; - -// eslint-disable-next-line -import { AppCategory } from '../../../../src/core/public/application/types'; - // Copied largely from plugins/kibana/index.js. The dashboard viewer includes just the dashboard section of // the standard kibana plugin. We don't want to include code for the other links (visualize, dev tools, etc) // since it's view only, but we want the urls to be the same, so we are using largely the same setup. diff --git a/x-pack/legacy/plugins/graph/index.ts b/x-pack/legacy/plugins/graph/index.ts index 04311a2a3cb59..c827a70a930c6 100644 --- a/x-pack/legacy/plugins/graph/index.ts +++ b/x-pack/legacy/plugins/graph/index.ts @@ -11,9 +11,7 @@ import { i18n } from '@kbn/i18n'; import migrations from './migrations'; import mappings from './mappings.json'; import { LegacyPluginInitializer } from '../../../../src/legacy/plugin_discovery/types'; - -// eslint-disable-next-line -import { AppCategory } from '../../../../src/core/public/application/types'; +import { AppCategory } from '../../../../src/core/types'; export const graph: LegacyPluginInitializer = kibana => { return new kibana.Plugin({ diff --git a/x-pack/legacy/plugins/infra/index.ts b/x-pack/legacy/plugins/infra/index.ts index aa46d1abc505b..4021c73e6026d 100644 --- a/x-pack/legacy/plugins/infra/index.ts +++ b/x-pack/legacy/plugins/infra/index.ts @@ -18,12 +18,10 @@ import { PluginSetupContract as FeaturesPluginSetup } from '../../../plugins/fea import { SpacesPluginSetup } from '../../../plugins/spaces/server'; import { VisTypeTimeseriesSetup } from '../../../../src/plugins/vis_type_timeseries/server'; import { APMPluginContract } from '../../../plugins/apm/server'; +import { AppCategory } from '../../../../src/core/types'; export const APP_ID = 'infra'; -// eslint-disable-next-line -import { AppCategory } from '../../../../src/core/public/application/types'; - export function infra(kibana: any) { return new kibana.Plugin({ id: APP_ID, diff --git a/x-pack/legacy/plugins/maps/index.js b/x-pack/legacy/plugins/maps/index.js index 7dc9a5f778768..599fccc3f7f42 100644 --- a/x-pack/legacy/plugins/maps/index.js +++ b/x-pack/legacy/plugins/maps/index.js @@ -4,18 +4,16 @@ * you may not use this file except in compliance with the Elastic License. */ +import _ from 'lodash'; +import mappings from './mappings.json'; import { i18n } from '@kbn/i18n'; import { resolve } from 'path'; -import mappings from './mappings.json'; import { migrations } from './migrations'; import { initTelemetryCollection } from './server/maps_telemetry'; import { getAppTitle } from './common/i18n_getters'; -import _ from 'lodash'; import { MapPlugin } from './server/plugin'; import { APP_ID, APP_ICON, createMapPath, MAP_SAVED_OBJECT_TYPE } from './common/constants'; - -// eslint-disable-next-line -import { AppCategory } from '../../../../src/core/public/application/types'; +import { AppCategory } from '../../../../src/core/types'; export function maps(kibana) { return new kibana.Plugin({ diff --git a/x-pack/legacy/plugins/ml/index.ts b/x-pack/legacy/plugins/ml/index.ts index f1374860e11dd..144ffdc2d74ea 100755 --- a/x-pack/legacy/plugins/ml/index.ts +++ b/x-pack/legacy/plugins/ml/index.ts @@ -10,7 +10,7 @@ import KbnServer, { Server } from 'src/legacy/server/kbn_server'; import { UsageCollectionSetup } from 'src/plugins/usage_collection/server'; import { plugin } from './server/new_platform'; import { CloudSetup } from '../../../plugins/cloud/server'; - +import { AppCategory } from '../../../../src/core/types'; import { MlInitializerContext, MlCoreSetup, @@ -19,9 +19,6 @@ import { // @ts-ignore: could not find declaration file for module import mappings from './mappings'; -// eslint-disable-next-line -import { AppCategory } from '../../../../src/core/public/application/types'; - interface MlServer extends Server { addAppLinksToSampleDataset: () => {}; } diff --git a/x-pack/legacy/plugins/monitoring/ui_exports.js b/x-pack/legacy/plugins/monitoring/ui_exports.js index 7dc91263da417..4c1739b5ec56a 100644 --- a/x-pack/legacy/plugins/monitoring/ui_exports.js +++ b/x-pack/legacy/plugins/monitoring/ui_exports.js @@ -6,8 +6,7 @@ import { i18n } from '@kbn/i18n'; import { resolve } from 'path'; -// eslint-disable-next-line -import { AppCategory } from '../../../../src/core/public/application/types'; +import { AppCategory } from '../../../../src/core/types'; /** * Configuration of dependency objects for the UI, which are needed for the diff --git a/x-pack/legacy/plugins/siem/index.ts b/x-pack/legacy/plugins/siem/index.ts index 83ab658d76398..f337a8e51fa40 100644 --- a/x-pack/legacy/plugins/siem/index.ts +++ b/x-pack/legacy/plugins/siem/index.ts @@ -30,8 +30,7 @@ import { } from './common/constants'; import { defaultIndexPattern } from './default_index_pattern'; import { initServerWithKibana } from './server/kibana.index'; -// eslint-disable-next-line -import { AppCategory } from '../../../../src/core/public/application/types'; +import { AppCategory } from '../../../../src/core/types'; // eslint-disable-next-line @typescript-eslint/no-explicit-any export const siem = (kibana: any) => { diff --git a/x-pack/legacy/plugins/uptime/index.ts b/x-pack/legacy/plugins/uptime/index.ts index 8ceb91dc0bd30..084f3fe8a2a50 100644 --- a/x-pack/legacy/plugins/uptime/index.ts +++ b/x-pack/legacy/plugins/uptime/index.ts @@ -9,8 +9,7 @@ import { resolve } from 'path'; import { PluginInitializerContext } from 'src/core/server'; import { PLUGIN } from './common/constants'; import { KibanaServer, plugin } from './server'; -// eslint-disable-next-line -import { AppCategory } from '../../../../src/core/public/application/types'; +import { AppCategory } from '../../../../src/core/types'; export const uptime = (kibana: any) => new kibana.Plugin({ From ea858270e8284c5c12f35b8dec92d74cce3c4377 Mon Sep 17 00:00:00 2001 From: Michail Yasonik Date: Sun, 12 Jan 2020 13:43:11 -0500 Subject: [PATCH 09/31] regenerating core documentation --- .../public/kibana-plugin-public.appbase.category.md | 13 +++++++++++++ .../core/public/kibana-plugin-public.appbase.md | 1 + .../kibana-plugin-public.chromenavlink.category.md | 13 +++++++++++++ .../public/kibana-plugin-public.chromenavlink.md | 1 + .../kibana-plugin-public.legacynavlink.category.md | 11 +++++++++++ .../public/kibana-plugin-public.legacynavlink.md | 1 + src/core/public/public.api.md | 5 +++++ 7 files changed, 45 insertions(+) create mode 100644 docs/development/core/public/kibana-plugin-public.appbase.category.md create mode 100644 docs/development/core/public/kibana-plugin-public.chromenavlink.category.md create mode 100644 docs/development/core/public/kibana-plugin-public.legacynavlink.category.md diff --git a/docs/development/core/public/kibana-plugin-public.appbase.category.md b/docs/development/core/public/kibana-plugin-public.appbase.category.md new file mode 100644 index 0000000000000..36a583693674b --- /dev/null +++ b/docs/development/core/public/kibana-plugin-public.appbase.category.md @@ -0,0 +1,13 @@ + + +[Home](./index.md) > [kibana-plugin-public](./kibana-plugin-public.md) > [AppBase](./kibana-plugin-public.appbase.md) > [category](./kibana-plugin-public.appbase.category.md) + +## AppBase.category property + +The category the app lives in + +Signature: + +```typescript +category?: AppCategory; +``` diff --git a/docs/development/core/public/kibana-plugin-public.appbase.md b/docs/development/core/public/kibana-plugin-public.appbase.md index a93a195c559b1..a65cc340d8e3f 100644 --- a/docs/development/core/public/kibana-plugin-public.appbase.md +++ b/docs/development/core/public/kibana-plugin-public.appbase.md @@ -16,6 +16,7 @@ export interface AppBase | Property | Type | Description | | --- | --- | --- | | [capabilities](./kibana-plugin-public.appbase.capabilities.md) | Partial<Capabilities> | Custom capabilities defined by the app. | +| [category](./kibana-plugin-public.appbase.category.md) | AppCategory | The category the app lives in | | [euiIconType](./kibana-plugin-public.appbase.euiicontype.md) | string | A EUI iconType that will be used for the app's icon. This icon takes precendence over the icon property. | | [icon](./kibana-plugin-public.appbase.icon.md) | string | A URL to an image file used as an icon. Used as a fallback if euiIconType is not provided. | | [id](./kibana-plugin-public.appbase.id.md) | string | | diff --git a/docs/development/core/public/kibana-plugin-public.chromenavlink.category.md b/docs/development/core/public/kibana-plugin-public.chromenavlink.category.md new file mode 100644 index 0000000000000..19d5a43a29307 --- /dev/null +++ b/docs/development/core/public/kibana-plugin-public.chromenavlink.category.md @@ -0,0 +1,13 @@ + + +[Home](./index.md) > [kibana-plugin-public](./kibana-plugin-public.md) > [ChromeNavLink](./kibana-plugin-public.chromenavlink.md) > [category](./kibana-plugin-public.chromenavlink.category.md) + +## ChromeNavLink.category property + +The category the app lives in + +Signature: + +```typescript +readonly category?: AppCategory; +``` diff --git a/docs/development/core/public/kibana-plugin-public.chromenavlink.md b/docs/development/core/public/kibana-plugin-public.chromenavlink.md index 4cb9080222ac5..2afd6ce2d58c4 100644 --- a/docs/development/core/public/kibana-plugin-public.chromenavlink.md +++ b/docs/development/core/public/kibana-plugin-public.chromenavlink.md @@ -17,6 +17,7 @@ export interface ChromeNavLink | --- | --- | --- | | [active](./kibana-plugin-public.chromenavlink.active.md) | boolean | Indicates whether or not this app is currently on the screen. | | [baseUrl](./kibana-plugin-public.chromenavlink.baseurl.md) | string | The base route used to open the root of an application. | +| [category](./kibana-plugin-public.chromenavlink.category.md) | AppCategory | The category the app lives in | | [disabled](./kibana-plugin-public.chromenavlink.disabled.md) | boolean | Disables a link from being clickable. | | [euiIconType](./kibana-plugin-public.chromenavlink.euiicontype.md) | string | A EUI iconType that will be used for the app's icon. This icon takes precendence over the icon property. | | [hidden](./kibana-plugin-public.chromenavlink.hidden.md) | boolean | Hides a link from the navigation. | diff --git a/docs/development/core/public/kibana-plugin-public.legacynavlink.category.md b/docs/development/core/public/kibana-plugin-public.legacynavlink.category.md new file mode 100644 index 0000000000000..7026e9b519cc0 --- /dev/null +++ b/docs/development/core/public/kibana-plugin-public.legacynavlink.category.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-public](./kibana-plugin-public.md) > [LegacyNavLink](./kibana-plugin-public.legacynavlink.md) > [category](./kibana-plugin-public.legacynavlink.category.md) + +## LegacyNavLink.category property + +Signature: + +```typescript +category?: AppCategory; +``` diff --git a/docs/development/core/public/kibana-plugin-public.legacynavlink.md b/docs/development/core/public/kibana-plugin-public.legacynavlink.md index fc0c445f517b3..e112110dd10f8 100644 --- a/docs/development/core/public/kibana-plugin-public.legacynavlink.md +++ b/docs/development/core/public/kibana-plugin-public.legacynavlink.md @@ -15,6 +15,7 @@ export interface LegacyNavLink | Property | Type | Description | | --- | --- | --- | +| [category](./kibana-plugin-public.legacynavlink.category.md) | AppCategory | | | [euiIconType](./kibana-plugin-public.legacynavlink.euiicontype.md) | string | | | [icon](./kibana-plugin-public.legacynavlink.icon.md) | string | | | [id](./kibana-plugin-public.legacynavlink.id.md) | string | | diff --git a/src/core/public/public.api.md b/src/core/public/public.api.md index c76d6191de8a3..ac740ddd2b3b0 100644 --- a/src/core/public/public.api.md +++ b/src/core/public/public.api.md @@ -26,6 +26,8 @@ export interface App extends AppBase { // @public (undocumented) export interface AppBase { capabilities?: Partial; + // Warning: (ae-forgotten-export) The symbol "AppCategory" needs to be exported by the entry point index.d.ts + category?: AppCategory; euiIconType?: string; icon?: string; // (undocumented) @@ -225,6 +227,7 @@ export interface ChromeNavLink { // @deprecated readonly active?: boolean; readonly baseUrl: string; + readonly category?: AppCategory; // @deprecated readonly disabled?: boolean; readonly euiIconType?: string; @@ -711,6 +714,8 @@ export interface LegacyCoreStart extends CoreStart { // @public (undocumented) export interface LegacyNavLink { + // (undocumented) + category?: AppCategory; // (undocumented) euiIconType?: string; // (undocumented) From c15de4444de2d165ed9fb0ab101e123e57e36732 Mon Sep 17 00:00:00 2001 From: Michail Yasonik Date: Sun, 12 Jan 2020 14:09:01 -0500 Subject: [PATCH 10/31] add category to timelion --- src/legacy/core_plugins/timelion/index.ts | 2 ++ src/legacy/core_plugins/timelion/public/register_feature.ts | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/legacy/core_plugins/timelion/index.ts b/src/legacy/core_plugins/timelion/index.ts index ec121647f4e47..1bb860ee3f791 100644 --- a/src/legacy/core_plugins/timelion/index.ts +++ b/src/legacy/core_plugins/timelion/index.ts @@ -24,6 +24,7 @@ import { LegacyPluginApi, LegacyPluginInitializer } from 'src/legacy/plugin_disc import { CoreSetup, PluginInitializerContext } from 'src/core/server'; import { plugin } from './server'; import { CustomCoreSetup } from './server/plugin'; +import { AppCategory } from '../../../core/types'; const experimentalLabel = i18n.translate('timelion.uiSettings.experimentalLabel', { defaultMessage: 'experimental', @@ -60,6 +61,7 @@ const timelionPluginInitializer: LegacyPluginInitializer = ({ Plugin }: LegacyPl icon: 'plugins/timelion/icon.svg', euiIconType: 'timelionApp', main: 'plugins/timelion/app', + category: AppCategory.analyze, }, styleSheetPaths: resolve(__dirname, 'public/index.scss'), hacks: [resolve(__dirname, 'public/legacy')], diff --git a/src/legacy/core_plugins/timelion/public/register_feature.ts b/src/legacy/core_plugins/timelion/public/register_feature.ts index 907ae65b783e4..7dd44b58bd1d7 100644 --- a/src/legacy/core_plugins/timelion/public/register_feature.ts +++ b/src/legacy/core_plugins/timelion/public/register_feature.ts @@ -31,6 +31,6 @@ export const registerFeature = () => { icon: 'timelionApp', path: '/app/timelion', showOnHomePage: false, - category: FeatureCatalogueCategory.DATA, // TODO@myasonik #awkward + category: FeatureCatalogueCategory.DATA, }; }; From 6ad9d3e0e25f0a62190939bdc66c831b1c15c84e Mon Sep 17 00:00:00 2001 From: Michail Yasonik Date: Sun, 12 Jan 2020 21:39:49 -0500 Subject: [PATCH 11/31] test fixes --- src/core/public/chrome/chrome_service.tsx | 4 ++-- test/accessibility/services/a11y/a11y.ts | 10 ++++++++++ .../apps/dashboard/create_and_add_embeddables.js | 4 ++-- .../apps/management/_index_pattern_filter.js | 2 +- test/functional/apps/visualize/_lab_mode.js | 5 ++--- test/functional/page_objects/header_page.js | 4 ++-- 6 files changed, 19 insertions(+), 10 deletions(-) diff --git a/src/core/public/chrome/chrome_service.tsx b/src/core/public/chrome/chrome_service.tsx index 30372efd145e5..7568997bd8248 100644 --- a/src/core/public/chrome/chrome_service.tsx +++ b/src/core/public/chrome/chrome_service.tsx @@ -168,9 +168,9 @@ export class ChromeService { const navSetting = settings?.user?.pageNavigation?.userValue || settings.defaults.pageNavigation.value; - const license = (injectedMetadata.getInjectedVars().xpackInitialInfo as { + const license = (injectedMetadata.getInjectedVars()?.xpackInitialInfo as { license: { type: string }; - }).license.type; + })?.license?.type; return { navControls, diff --git a/test/accessibility/services/a11y/a11y.ts b/test/accessibility/services/a11y/a11y.ts index 6687fb60935a0..7adfe7ebfcc7d 100644 --- a/test/accessibility/services/a11y/a11y.ts +++ b/test/accessibility/services/a11y/a11y.ts @@ -78,6 +78,11 @@ export function A11yProvider({ getService }: FtrProviderContext) { private testAxeReport(report: AxeReport) { const errorMsgs = []; + for (const result of report.incomplete) { + // these items require human review and can't be definitively validated + log.warning(printResult(chalk.yellow('UNABLE TO VALIDATE'), result)); + } + for (const result of report.violations) { errorMsgs.push(printResult(chalk.red('VIOLATION'), result)); } @@ -91,6 +96,11 @@ export function A11yProvider({ getService }: FtrProviderContext) { const axeOptions = { reporter: 'v2', runOnly: ['wcag2a', 'wcag2aa'], + rules: { + 'color-contrast': { + enabled: false, + }, + }, }; await (Wd.driver.manage() as any).setTimeouts({ diff --git a/test/functional/apps/dashboard/create_and_add_embeddables.js b/test/functional/apps/dashboard/create_and_add_embeddables.js index 042e766d963ba..0b628100a98bd 100644 --- a/test/functional/apps/dashboard/create_and_add_embeddables.js +++ b/test/functional/apps/dashboard/create_and_add_embeddables.js @@ -84,7 +84,7 @@ export default function({ getService, getPageObjects }) { describe('is false', () => { before(async () => { - await PageObjects.header.clickManagement(); + await PageObjects.header.clickStackManagement(); await PageObjects.settings.clickKibanaSettings(); await PageObjects.settings.toggleAdvancedSettingCheckbox('visualize:enableLabs'); }); @@ -99,7 +99,7 @@ export default function({ getService, getPageObjects }) { }); after(async () => { - await PageObjects.header.clickManagement(); + await PageObjects.header.clickStackManagement(); await PageObjects.settings.clickKibanaSettings(); await PageObjects.settings.clearAdvancedSettings('visualize:enableLabs'); await PageObjects.header.clickDashboard(); diff --git a/test/functional/apps/management/_index_pattern_filter.js b/test/functional/apps/management/_index_pattern_filter.js index a32024adb5ec7..e685c43e9ce98 100644 --- a/test/functional/apps/management/_index_pattern_filter.js +++ b/test/functional/apps/management/_index_pattern_filter.js @@ -27,7 +27,7 @@ export default function({ getService, getPageObjects }) { describe('index pattern filter', function describeIndexTests() { before(async function() { // delete .kibana index and then wait for Kibana to re-create it - await kibanaServer.uiSettings.replace({}); + await kibanaServer.uiSettings.replace({ pageNavigation: 'individual' }); await PageObjects.settings.navigateTo(); await PageObjects.settings.clickKibanaIndexPatterns(); }); diff --git a/test/functional/apps/visualize/_lab_mode.js b/test/functional/apps/visualize/_lab_mode.js index 3ee806af8165d..b082480d95a2e 100644 --- a/test/functional/apps/visualize/_lab_mode.js +++ b/test/functional/apps/visualize/_lab_mode.js @@ -23,7 +23,6 @@ export default function({ getService, getPageObjects }) { const log = getService('log'); const PageObjects = getPageObjects(['common', 'header', 'discover', 'settings']); - // Flaky: https://github.com/elastic/kibana/issues/19743 describe('visualize lab mode', () => { it('disabling does not break loading saved searches', async () => { await PageObjects.common.navigateToUrl('discover', ''); @@ -36,7 +35,7 @@ export default function({ getService, getPageObjects }) { log.info('found saved search before toggling enableLabs mode'); // Navigate to advanced setting and disable lab mode - await PageObjects.header.clickManagement(); + await PageObjects.header.clickStackManagement(); await PageObjects.settings.clickKibanaSettings(); await PageObjects.settings.toggleAdvancedSettingCheckbox('visualize:enableLabs'); @@ -50,7 +49,7 @@ export default function({ getService, getPageObjects }) { after(async () => { await PageObjects.discover.closeLoadSaveSearchPanel(); - await PageObjects.header.clickManagement(); + await PageObjects.header.clickStackManagement(); await PageObjects.settings.clickKibanaSettings(); await PageObjects.settings.clearAdvancedSettings('visualize:enableLabs'); }); diff --git a/test/functional/page_objects/header_page.js b/test/functional/page_objects/header_page.js index f82e4e4387e27..05edd64545a56 100644 --- a/test/functional/page_objects/header_page.js +++ b/test/functional/page_objects/header_page.js @@ -59,8 +59,8 @@ export function HeaderPageProvider({ getService, getPageObjects }) { await this.awaitGlobalLoadingIndicatorHidden(); } - async clickManagement() { - await appsMenu.clickLink('Management'); + async clickStackManagement() { + await appsMenu.clickLink('Stack Management'); await this.awaitGlobalLoadingIndicatorHidden(); } From f34f7636f7649762b1627016cb68e585b0245711 Mon Sep 17 00:00:00 2001 From: Michail Yasonik Date: Sun, 12 Jan 2020 22:04:11 -0500 Subject: [PATCH 12/31] regenerating core documentation --- .../core/server/kibana-plugin-server.basepath.get.md | 2 +- docs/development/core/server/kibana-plugin-server.basepath.md | 4 ++-- .../core/server/kibana-plugin-server.basepath.set.md | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/development/core/server/kibana-plugin-server.basepath.get.md b/docs/development/core/server/kibana-plugin-server.basepath.get.md index 6ef7022f10e62..a20bc1a4e3174 100644 --- a/docs/development/core/server/kibana-plugin-server.basepath.get.md +++ b/docs/development/core/server/kibana-plugin-server.basepath.get.md @@ -9,5 +9,5 @@ returns `basePath` value, specific for an incoming request. Signature: ```typescript -get: (request: KibanaRequest | LegacyRequest) => string; +get: (request: LegacyRequest | KibanaRequest) => string; ``` diff --git a/docs/development/core/server/kibana-plugin-server.basepath.md b/docs/development/core/server/kibana-plugin-server.basepath.md index 50a30f7c43fe6..63aeb7f711d97 100644 --- a/docs/development/core/server/kibana-plugin-server.basepath.md +++ b/docs/development/core/server/kibana-plugin-server.basepath.md @@ -20,9 +20,9 @@ The constructor for this class is marked as internal. Third-party code should no | Property | Modifiers | Type | Description | | --- | --- | --- | --- | -| [get](./kibana-plugin-server.basepath.get.md) | | (request: KibanaRequest<unknown, unknown, unknown, any> | LegacyRequest) => string | returns basePath value, specific for an incoming request. | +| [get](./kibana-plugin-server.basepath.get.md) | | (request: LegacyRequest | KibanaRequest<unknown, unknown, unknown, any>) => string | returns basePath value, specific for an incoming request. | | [prepend](./kibana-plugin-server.basepath.prepend.md) | | (path: string) => string | Prepends path with the basePath. | | [remove](./kibana-plugin-server.basepath.remove.md) | | (path: string) => string | Removes the prepended basePath from the path. | | [serverBasePath](./kibana-plugin-server.basepath.serverbasepath.md) | | string | returns the server's basePathSee [BasePath.get](./kibana-plugin-server.basepath.get.md) for getting the basePath value for a specific request | -| [set](./kibana-plugin-server.basepath.set.md) | | (request: KibanaRequest<unknown, unknown, unknown, any> | LegacyRequest, requestSpecificBasePath: string) => void | sets basePath value, specific for an incoming request. | +| [set](./kibana-plugin-server.basepath.set.md) | | (request: LegacyRequest | KibanaRequest<unknown, unknown, unknown, any>, requestSpecificBasePath: string) => void | sets basePath value, specific for an incoming request. | diff --git a/docs/development/core/server/kibana-plugin-server.basepath.set.md b/docs/development/core/server/kibana-plugin-server.basepath.set.md index 56a7f644d34cc..ac08baa0bb99e 100644 --- a/docs/development/core/server/kibana-plugin-server.basepath.set.md +++ b/docs/development/core/server/kibana-plugin-server.basepath.set.md @@ -9,5 +9,5 @@ sets `basePath` value, specific for an incoming request. Signature: ```typescript -set: (request: KibanaRequest | LegacyRequest, requestSpecificBasePath: string) => void; +set: (request: LegacyRequest | KibanaRequest, requestSpecificBasePath: string) => void; ``` From 23a51b622a60c3378ac427cda1dfb9440aec2a0e Mon Sep 17 00:00:00 2001 From: Michail Yasonik Date: Sun, 12 Jan 2020 22:46:46 -0500 Subject: [PATCH 13/31] working around EUI nav bug --- src/core/public/chrome/ui/header/header.tsx | 112 ++++++++++---------- 1 file changed, 58 insertions(+), 54 deletions(-) diff --git a/src/core/public/chrome/ui/header/header.tsx b/src/core/public/chrome/ui/header/header.tsx index 9c4251075ee61..c96ae20532f50 100644 --- a/src/core/public/chrome/ui/header/header.tsx +++ b/src/core/public/chrome/ui/header/header.tsx @@ -362,7 +362,7 @@ class HeaderUI extends Component { ); } - public renderRecentLinks(recentlyAccessed: ExtendedRecentlyAccessedHistoryItem[]) { + public renderRecentLinks() { return ( { defaultMessage: 'Recently viewed', }), iconType: 'clock', - isDisabled: !(recentlyAccessed.length > 0), + isDisabled: !(this.state.recentlyAccessed.length > 0), flyoutMenu: { title: i18n.translate('core.ui.chrome.sideGlobalNav.viewRecentItemsFlyoutTitle', { defaultMessage: 'Recent items', }), - listItems: recentlyAccessed, + listItems: this.state.recentlyAccessed, }, }, ]} @@ -387,14 +387,52 @@ class HeaderUI extends Component { ); } - public renderGroupedNav() { + public renderNavLinks() { + const isOSS = this.props.license === 'oss'; + const disableGroupedNavSetting = this.props.navSetting === 'individual'; + const showUngroupedNav = isOSS || disableGroupedNavSetting || this.state.navLinks.length < 7; + + if (showUngroupedNav) { + return ( + + {this.renderRecentLinks()} + + + + ); + } + const { undefined: unknowns, [AppCategory.management]: management, ...mainNav } = groupBy( this.state.navLinks, 'category' ); return ( - <> + + {this.renderRecentLinks()} + { ]} /> - {management.length > 0 && ( - - )} - - ); - } - - public renderNavLinks() { - const isOSS = this.props.license === 'oss'; - const disableGroupedNavSetting = this.props.navSetting === 'individual'; - const showUngroupedNav = isOSS || disableGroupedNavSetting || this.state.navLinks.length < 7; - - return ( - - {this.renderRecentLinks(this.state.recentlyAccessed)} - - {showUngroupedNav ? ( - - ) : ( - this.renderGroupedNav() - )} + }, + ]} + /> ); } From 3efdaf55aa9f4949b2dfaf119103c9de7289c6b0 Mon Sep 17 00:00:00 2001 From: Michail Yasonik Date: Sun, 12 Jan 2020 23:14:28 -0500 Subject: [PATCH 14/31] fix recently visited links --- src/core/public/chrome/ui/header/header.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/core/public/chrome/ui/header/header.tsx b/src/core/public/chrome/ui/header/header.tsx index c96ae20532f50..99137614a9f46 100644 --- a/src/core/public/chrome/ui/header/header.tsx +++ b/src/core/public/chrome/ui/header/header.tsx @@ -376,7 +376,13 @@ class HeaderUI extends Component { title: i18n.translate('core.ui.chrome.sideGlobalNav.viewRecentItemsFlyoutTitle', { defaultMessage: 'Recent items', }), - listItems: this.state.recentlyAccessed, + listItems: this.state.recentlyAccessed.map(item => ({ + label: truncateRecentItemLabel(item.label), + title: item.title, + 'aria-label': item.title, + href: item.href, + iconType: item.euiIconType, + })), }, }, ]} From 29585ec39b953320c89b179df59d0dccd2df95de Mon Sep 17 00:00:00 2001 From: Michail Yasonik Date: Mon, 13 Jan 2020 11:35:21 -0500 Subject: [PATCH 15/31] PR feedback and test fixes --- .../public/kibana-plugin-public.appbase.md | 32 +- .../kibana-plugin-public.appcategory.md | 22 + .../core/public/kibana-plugin-public.md | 303 ++-- src/core/public/application/types.ts | 2 +- src/core/public/chrome/nav_links/nav_link.ts | 2 +- src/core/public/chrome/ui/header/header.tsx | 2 +- src/core/public/index.ts | 1 + .../injected_metadata_service.ts | 7 +- src/core/public/public.api.md | 1587 ++++++++--------- src/core/types/app_categories.ts | 1 + .../kibana/public/management/index.js | 2 +- .../ui/public/management/breadcrumbs.ts | 2 +- .../management_sidebar_nav.tsx | 2 +- .../public/legacy/sections_register.js | 2 +- .../management/public/management_app.tsx | 2 +- .../core_plugins/application_status.ts | 5 + .../test_suites/core_plugins/applications.ts | 2 +- x-pack/legacy/plugins/lens/index.ts | 2 - .../advanced_settings_security.ts | 6 +- .../advanced_settings_spaces.ts | 2 +- .../dashboard_mode/dashboard_view_mode.js | 4 +- .../graph/feature_controls/graph_security.ts | 4 +- .../index_patterns_security.ts | 6 +- .../feature_controls/index_patterns_spaces.ts | 2 +- .../feature_controls/spaces_security.ts | 4 +- 25 files changed, 957 insertions(+), 1049 deletions(-) create mode 100644 docs/development/core/public/kibana-plugin-public.appcategory.md diff --git a/docs/development/core/public/kibana-plugin-public.appbase.md b/docs/development/core/public/kibana-plugin-public.appbase.md index 3332a4d8e47cd..388414f167aeb 100644 --- a/docs/development/core/public/kibana-plugin-public.appbase.md +++ b/docs/development/core/public/kibana-plugin-public.appbase.md @@ -4,25 +4,27 @@ ## AppBase interface + Signature: ```typescript -export interface AppBase +export interface AppBase ``` ## Properties -| Property | Type | Description | -| ---------------------------------------------------------------- | ----------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| [capabilities](./kibana-plugin-public.appbase.capabilities.md) | Partial<Capabilities> | Custom capabilities defined by the app. | -| [category](./kibana-plugin-public.appbase.category.md) | AppCategory | The category the app lives in | -| [chromeless](./kibana-plugin-public.appbase.chromeless.md) | boolean | Hide the UI chrome when the application is mounted. Defaults to false. Takes precedence over chrome service visibility settings. | -| [euiIconType](./kibana-plugin-public.appbase.euiicontype.md) | string | A EUI iconType that will be used for the app's icon. This icon takes precendence over the icon property. | -| [icon](./kibana-plugin-public.appbase.icon.md) | string | A URL to an image file used as an icon. Used as a fallback if euiIconType is not provided. | -| [id](./kibana-plugin-public.appbase.id.md) | string | The unique identifier of the application | -| [navLinkStatus](./kibana-plugin-public.appbase.navlinkstatus.md) | AppNavLinkStatus | The initial status of the application's navLink. Defaulting to visible if status is accessible and hidden if status is inaccessible See [AppNavLinkStatus](./kibana-plugin-public.appnavlinkstatus.md) | -| [order](./kibana-plugin-public.appbase.order.md) | number | An ordinal used to sort nav links relative to one another for display. | -| [status](./kibana-plugin-public.appbase.status.md) | AppStatus | The initial status of the application. Defaulting to accessible | -| [title](./kibana-plugin-public.appbase.title.md) | string | The title of the application. | -| [tooltip](./kibana-plugin-public.appbase.tooltip.md) | string | A tooltip shown when hovering over app link. | -| [updater\$](./kibana-plugin-public.appbase.updater_.md) | Observable<AppUpdater> | An [AppUpdater](./kibana-plugin-public.appupdater.md) observable that can be used to update the application [AppUpdatableFields](./kibana-plugin-public.appupdatablefields.md) at runtime. | +| Property | Type | Description | +| --- | --- | --- | +| [capabilities](./kibana-plugin-public.appbase.capabilities.md) | Partial<Capabilities> | Custom capabilities defined by the app. | +| [category](./kibana-plugin-public.appbase.category.md) | AppCategory | The category the app lives in | +| [chromeless](./kibana-plugin-public.appbase.chromeless.md) | boolean | Hide the UI chrome when the application is mounted. Defaults to false. Takes precedence over chrome service visibility settings. | +| [euiIconType](./kibana-plugin-public.appbase.euiicontype.md) | string | A EUI iconType that will be used for the app's icon. This icon takes precendence over the icon property. | +| [icon](./kibana-plugin-public.appbase.icon.md) | string | A URL to an image file used as an icon. Used as a fallback if euiIconType is not provided. | +| [id](./kibana-plugin-public.appbase.id.md) | string | The unique identifier of the application | +| [navLinkStatus](./kibana-plugin-public.appbase.navlinkstatus.md) | AppNavLinkStatus | The initial status of the application's navLink. Defaulting to visible if status is accessible and hidden if status is inaccessible See [AppNavLinkStatus](./kibana-plugin-public.appnavlinkstatus.md) | +| [order](./kibana-plugin-public.appbase.order.md) | number | An ordinal used to sort nav links relative to one another for display. | +| [status](./kibana-plugin-public.appbase.status.md) | AppStatus | The initial status of the application. Defaulting to accessible | +| [title](./kibana-plugin-public.appbase.title.md) | string | The title of the application. | +| [tooltip](./kibana-plugin-public.appbase.tooltip.md) | string | A tooltip shown when hovering over app link. | +| [updater$](./kibana-plugin-public.appbase.updater_.md) | Observable<AppUpdater> | An [AppUpdater](./kibana-plugin-public.appupdater.md) observable that can be used to update the application [AppUpdatableFields](./kibana-plugin-public.appupdatablefields.md) at runtime. | + diff --git a/docs/development/core/public/kibana-plugin-public.appcategory.md b/docs/development/core/public/kibana-plugin-public.appcategory.md new file mode 100644 index 0000000000000..ab068db595a0a --- /dev/null +++ b/docs/development/core/public/kibana-plugin-public.appcategory.md @@ -0,0 +1,22 @@ + + +[Home](./index.md) > [kibana-plugin-public](./kibana-plugin-public.md) > [AppCategory](./kibana-plugin-public.appcategory.md) + +## AppCategory enum + + +Signature: + +```typescript +export declare enum AppCategory +``` + +## Enumeration Members + +| Member | Value | Description | +| --- | --- | --- | +| analyze | 0 | | +| management | 3 | | +| observability | 1 | | +| security | 2 | | + diff --git a/docs/development/core/public/kibana-plugin-public.md b/docs/development/core/public/kibana-plugin-public.md index 64cbdd880fed1..ecf03c500fdbb 100644 --- a/docs/development/core/public/kibana-plugin-public.md +++ b/docs/development/core/public/kibana-plugin-public.md @@ -1,151 +1,152 @@ - - -[Home](./index.md) > [kibana-plugin-public](./kibana-plugin-public.md) - -## kibana-plugin-public package - -The Kibana Core APIs for client-side plugins. - -A plugin's `public/index` file must contain a named import, `plugin`, that implements [PluginInitializer](./kibana-plugin-public.plugininitializer.md) which returns an object that implements [Plugin](./kibana-plugin-public.plugin.md). - -The plugin integrates with the core system via lifecycle events: `setup`, `start`, and `stop`. In each lifecycle method, the plugin will receive the corresponding core services available (either [CoreSetup](./kibana-plugin-public.coresetup.md) or [CoreStart](./kibana-plugin-public.corestart.md)) and any interfaces returned by dependency plugins' lifecycle method. Anything returned by the plugin's lifecycle method will be exposed to downstream dependencies when their corresponding lifecycle methods are invoked. - -## Classes - -| Class | Description | -| --- | --- | -| [SavedObjectsClient](./kibana-plugin-public.savedobjectsclient.md) | Saved Objects is Kibana's data persisentence mechanism allowing plugins to use Elasticsearch for storing plugin state. The client-side SavedObjectsClient is a thin convenience library around the SavedObjects HTTP API for interacting with Saved Objects. | -| [SimpleSavedObject](./kibana-plugin-public.simplesavedobject.md) | This class is a very simple wrapper for SavedObjects loaded from the server with the [SavedObjectsClient](./kibana-plugin-public.savedobjectsclient.md).It provides basic functionality for creating/saving/deleting saved objects, but doesn't include any type-specific implementations. | -| [ToastsApi](./kibana-plugin-public.toastsapi.md) | Methods for adding and removing global toast messages. | - -## Enumerations - -| Enumeration | Description | -| --- | --- | -| [AppLeaveActionType](./kibana-plugin-public.appleaveactiontype.md) | Possible type of actions on application leave. | -| [AppNavLinkStatus](./kibana-plugin-public.appnavlinkstatus.md) | Status of the application's navLink. | -| [AppStatus](./kibana-plugin-public.appstatus.md) | Accessibility status of an application. | - -## Interfaces - -| Interface | Description | -| --- | --- | -| [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) | | -| [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) | | -| [ApplicationStart](./kibana-plugin-public.applicationstart.md) | | -| [AppMountContext](./kibana-plugin-public.appmountcontext.md) | The context object received when applications are mounted to the DOM. Deprecated, use [CoreSetup.getStartServices()](./kibana-plugin-public.coresetup.getstartservices.md). | -| [AppMountParameters](./kibana-plugin-public.appmountparameters.md) | | -| [Capabilities](./kibana-plugin-public.capabilities.md) | The read-only set of capabilities available for the current UI session. Capabilities are simple key-value pairs of (string, boolean), where the string denotes the capability ID, and the boolean is a flag indicating if the capability is enabled or disabled. | -| [ChromeBadge](./kibana-plugin-public.chromebadge.md) | | -| [ChromeBrand](./kibana-plugin-public.chromebrand.md) | | -| [ChromeDocTitle](./kibana-plugin-public.chromedoctitle.md) | APIs for accessing and updating the document title. | -| [ChromeHelpExtension](./kibana-plugin-public.chromehelpextension.md) | | -| [ChromeNavControl](./kibana-plugin-public.chromenavcontrol.md) | | -| [ChromeNavControls](./kibana-plugin-public.chromenavcontrols.md) | [APIs](./kibana-plugin-public.chromenavcontrols.md) for registering new controls to be displayed in the navigation bar. | -| [ChromeNavLink](./kibana-plugin-public.chromenavlink.md) | | -| [ChromeNavLinks](./kibana-plugin-public.chromenavlinks.md) | [APIs](./kibana-plugin-public.chromenavlinks.md) for manipulating nav links. | -| [ChromeRecentlyAccessed](./kibana-plugin-public.chromerecentlyaccessed.md) | [APIs](./kibana-plugin-public.chromerecentlyaccessed.md) for recently accessed history. | -| [ChromeRecentlyAccessedHistoryItem](./kibana-plugin-public.chromerecentlyaccessedhistoryitem.md) | | -| [ChromeStart](./kibana-plugin-public.chromestart.md) | ChromeStart allows plugins to customize the global chrome header UI and enrich the UX with additional information about the current location of the browser. | -| [ContextSetup](./kibana-plugin-public.contextsetup.md) | An object that handles registration of context providers and configuring handlers with context. | -| [CoreSetup](./kibana-plugin-public.coresetup.md) | Core services exposed to the Plugin setup lifecycle | -| [CoreStart](./kibana-plugin-public.corestart.md) | Core services exposed to the Plugin start lifecycle | -| [DocLinksStart](./kibana-plugin-public.doclinksstart.md) | | -| [EnvironmentMode](./kibana-plugin-public.environmentmode.md) | | -| [ErrorToastOptions](./kibana-plugin-public.errortoastoptions.md) | Options available for [IToasts](./kibana-plugin-public.itoasts.md) APIs. | -| [FatalErrorInfo](./kibana-plugin-public.fatalerrorinfo.md) | Represents the message and stack of a fatal Error | -| [FatalErrorsSetup](./kibana-plugin-public.fatalerrorssetup.md) | FatalErrors stop the Kibana Public Core and displays a fatal error screen with details about the Kibana build and the error. | -| [HttpErrorRequest](./kibana-plugin-public.httperrorrequest.md) | | -| [HttpErrorResponse](./kibana-plugin-public.httperrorresponse.md) | | -| [HttpFetchOptions](./kibana-plugin-public.httpfetchoptions.md) | All options that may be used with a [HttpHandler](./kibana-plugin-public.httphandler.md). | -| [HttpFetchQuery](./kibana-plugin-public.httpfetchquery.md) | | -| [HttpHandler](./kibana-plugin-public.httphandler.md) | A function for making an HTTP requests to Kibana's backend. See [HttpFetchOptions](./kibana-plugin-public.httpfetchoptions.md) for options and [IHttpResponse](./kibana-plugin-public.ihttpresponse.md) for the response. | -| [HttpHeadersInit](./kibana-plugin-public.httpheadersinit.md) | | -| [HttpInterceptor](./kibana-plugin-public.httpinterceptor.md) | An object that may define global interceptor functions for different parts of the request and response lifecycle. See [IHttpInterceptController](./kibana-plugin-public.ihttpinterceptcontroller.md). | -| [HttpRequestInit](./kibana-plugin-public.httprequestinit.md) | Fetch API options available to [HttpHandler](./kibana-plugin-public.httphandler.md)s. | -| [HttpSetup](./kibana-plugin-public.httpsetup.md) | | -| [I18nStart](./kibana-plugin-public.i18nstart.md) | I18nStart.Context is required by any localizable React component from @kbn/i18n and @elastic/eui packages and is supposed to be used as the topmost component for any i18n-compatible React tree. | -| [IAnonymousPaths](./kibana-plugin-public.ianonymouspaths.md) | APIs for denoting paths as not requiring authentication | -| [IBasePath](./kibana-plugin-public.ibasepath.md) | APIs for manipulating the basePath on URL segments. | -| [IContextContainer](./kibana-plugin-public.icontextcontainer.md) | An object that handles registration of context providers and configuring handlers with context. | -| [IHttpFetchError](./kibana-plugin-public.ihttpfetcherror.md) | | -| [IHttpInterceptController](./kibana-plugin-public.ihttpinterceptcontroller.md) | Used to halt a request Promise chain in a [HttpInterceptor](./kibana-plugin-public.httpinterceptor.md). | -| [IHttpResponse](./kibana-plugin-public.ihttpresponse.md) | | -| [IHttpResponseInterceptorOverrides](./kibana-plugin-public.ihttpresponseinterceptoroverrides.md) | Properties that can be returned by HttpInterceptor.request to override the response. | -| [IUiSettingsClient](./kibana-plugin-public.iuisettingsclient.md) | Client-side client that provides access to the advanced settings stored in elasticsearch. The settings provide control over the behavior of the Kibana application. For example, a user can specify how to display numeric or date fields. Users can adjust the settings via Management UI. [IUiSettingsClient](./kibana-plugin-public.iuisettingsclient.md) | -| [LegacyCoreSetup](./kibana-plugin-public.legacycoresetup.md) | Setup interface exposed to the legacy platform via the ui/new_platform module. | -| [LegacyCoreStart](./kibana-plugin-public.legacycorestart.md) | Start interface exposed to the legacy platform via the ui/new_platform module. | -| [LegacyNavLink](./kibana-plugin-public.legacynavlink.md) | | -| [NotificationsSetup](./kibana-plugin-public.notificationssetup.md) | | -| [NotificationsStart](./kibana-plugin-public.notificationsstart.md) | | -| [OverlayBannersStart](./kibana-plugin-public.overlaybannersstart.md) | | -| [OverlayRef](./kibana-plugin-public.overlayref.md) | Returned by [OverlayStart](./kibana-plugin-public.overlaystart.md) methods for closing a mounted overlay. | -| [OverlayStart](./kibana-plugin-public.overlaystart.md) | | -| [PackageInfo](./kibana-plugin-public.packageinfo.md) | | -| [Plugin](./kibana-plugin-public.plugin.md) | The interface that should be returned by a PluginInitializer. | -| [PluginInitializerContext](./kibana-plugin-public.plugininitializercontext.md) | The available core services passed to a PluginInitializer | -| [SavedObject](./kibana-plugin-public.savedobject.md) | | -| [SavedObjectAttributes](./kibana-plugin-public.savedobjectattributes.md) | The data for a Saved Object is stored as an object in the attributes property. | -| [SavedObjectReference](./kibana-plugin-public.savedobjectreference.md) | A reference to another saved object. | -| [SavedObjectsBaseOptions](./kibana-plugin-public.savedobjectsbaseoptions.md) | | -| [SavedObjectsBatchResponse](./kibana-plugin-public.savedobjectsbatchresponse.md) | | -| [SavedObjectsBulkCreateObject](./kibana-plugin-public.savedobjectsbulkcreateobject.md) | | -| [SavedObjectsBulkCreateOptions](./kibana-plugin-public.savedobjectsbulkcreateoptions.md) | | -| [SavedObjectsBulkUpdateObject](./kibana-plugin-public.savedobjectsbulkupdateobject.md) | | -| [SavedObjectsBulkUpdateOptions](./kibana-plugin-public.savedobjectsbulkupdateoptions.md) | | -| [SavedObjectsCreateOptions](./kibana-plugin-public.savedobjectscreateoptions.md) | | -| [SavedObjectsFindOptions](./kibana-plugin-public.savedobjectsfindoptions.md) | | -| [SavedObjectsFindResponsePublic](./kibana-plugin-public.savedobjectsfindresponsepublic.md) | Return type of the Saved Objects find() method.\*Note\*: this type is different between the Public and Server Saved Objects clients. | -| [SavedObjectsImportConflictError](./kibana-plugin-public.savedobjectsimportconflicterror.md) | Represents a failure to import due to a conflict. | -| [SavedObjectsImportError](./kibana-plugin-public.savedobjectsimporterror.md) | Represents a failure to import. | -| [SavedObjectsImportMissingReferencesError](./kibana-plugin-public.savedobjectsimportmissingreferenceserror.md) | Represents a failure to import due to missing references. | -| [SavedObjectsImportResponse](./kibana-plugin-public.savedobjectsimportresponse.md) | The response describing the result of an import. | -| [SavedObjectsImportRetry](./kibana-plugin-public.savedobjectsimportretry.md) | Describes a retry operation for importing a saved object. | -| [SavedObjectsImportUnknownError](./kibana-plugin-public.savedobjectsimportunknownerror.md) | Represents a failure to import due to an unknown reason. | -| [SavedObjectsImportUnsupportedTypeError](./kibana-plugin-public.savedobjectsimportunsupportedtypeerror.md) | Represents a failure to import due to having an unsupported saved object type. | -| [SavedObjectsMigrationVersion](./kibana-plugin-public.savedobjectsmigrationversion.md) | Information about the migrations that have been applied to this SavedObject. When Kibana starts up, KibanaMigrator detects outdated documents and migrates them based on this value. For each migration that has been applied, the plugin's name is used as a key and the latest migration version as the value. | -| [SavedObjectsStart](./kibana-plugin-public.savedobjectsstart.md) | | -| [SavedObjectsUpdateOptions](./kibana-plugin-public.savedobjectsupdateoptions.md) | | -| [UiSettingsState](./kibana-plugin-public.uisettingsstate.md) | | - -## Type Aliases - -| Type Alias | Description | -| --- | --- | -| [AppLeaveAction](./kibana-plugin-public.appleaveaction.md) | Possible actions to return from a [AppLeaveHandler](./kibana-plugin-public.appleavehandler.md)See [AppLeaveConfirmAction](./kibana-plugin-public.appleaveconfirmaction.md) and [AppLeaveDefaultAction](./kibana-plugin-public.appleavedefaultaction.md) | -| [AppLeaveHandler](./kibana-plugin-public.appleavehandler.md) | A handler that will be executed before leaving the application, either when going to another application or when closing the browser tab or manually changing the url. Should return confirm to to prompt a message to the user before leaving the page, or default to keep the default behavior (doing nothing).See [AppMountParameters](./kibana-plugin-public.appmountparameters.md) for detailed usage examples. | -| [AppMount](./kibana-plugin-public.appmount.md) | A mount function called when the user navigates to this app's route. | -| [AppMountDeprecated](./kibana-plugin-public.appmountdeprecated.md) | A mount function called when the user navigates to this app's route. | -| [AppUnmount](./kibana-plugin-public.appunmount.md) | A function called when an application should be unmounted from the page. This function should be synchronous. | -| [AppUpdatableFields](./kibana-plugin-public.appupdatablefields.md) | Defines the list of fields that can be updated via an [AppUpdater](./kibana-plugin-public.appupdater.md). | -| [AppUpdater](./kibana-plugin-public.appupdater.md) | Updater for applications. see [ApplicationSetup](./kibana-plugin-public.applicationsetup.md) | -| [ChromeBreadcrumb](./kibana-plugin-public.chromebreadcrumb.md) | | -| [ChromeHelpExtensionMenuCustomLink](./kibana-plugin-public.chromehelpextensionmenucustomlink.md) | | -| [ChromeHelpExtensionMenuDiscussLink](./kibana-plugin-public.chromehelpextensionmenudiscusslink.md) | | -| [ChromeHelpExtensionMenuDocumentationLink](./kibana-plugin-public.chromehelpextensionmenudocumentationlink.md) | | -| [ChromeHelpExtensionMenuGitHubLink](./kibana-plugin-public.chromehelpextensionmenugithublink.md) | | -| [ChromeHelpExtensionMenuLink](./kibana-plugin-public.chromehelpextensionmenulink.md) | | -| [ChromeNavLinkUpdateableFields](./kibana-plugin-public.chromenavlinkupdateablefields.md) | | -| [HandlerContextType](./kibana-plugin-public.handlercontexttype.md) | Extracts the type of the first argument of a [HandlerFunction](./kibana-plugin-public.handlerfunction.md) to represent the type of the context. | -| [HandlerFunction](./kibana-plugin-public.handlerfunction.md) | A function that accepts a context object and an optional number of additional arguments. Used for the generic types in [IContextContainer](./kibana-plugin-public.icontextcontainer.md) | -| [HandlerParameters](./kibana-plugin-public.handlerparameters.md) | Extracts the types of the additional arguments of a [HandlerFunction](./kibana-plugin-public.handlerfunction.md), excluding the [HandlerContextType](./kibana-plugin-public.handlercontexttype.md). | -| [HttpStart](./kibana-plugin-public.httpstart.md) | See [HttpSetup](./kibana-plugin-public.httpsetup.md) | -| [IContextProvider](./kibana-plugin-public.icontextprovider.md) | A function that returns a context value for a specific key of given context type. | -| [IToasts](./kibana-plugin-public.itoasts.md) | Methods for adding and removing global toast messages. See [ToastsApi](./kibana-plugin-public.toastsapi.md). | -| [MountPoint](./kibana-plugin-public.mountpoint.md) | A function that should mount DOM content inside the provided container element and return a handler to unmount it. | -| [PluginInitializer](./kibana-plugin-public.plugininitializer.md) | The plugin export at the root of a plugin's public directory should conform to this interface. | -| [PluginOpaqueId](./kibana-plugin-public.pluginopaqueid.md) | | -| [RecursiveReadonly](./kibana-plugin-public.recursivereadonly.md) | | -| [SavedObjectAttribute](./kibana-plugin-public.savedobjectattribute.md) | Type definition for a Saved Object attribute value | -| [SavedObjectAttributeSingle](./kibana-plugin-public.savedobjectattributesingle.md) | Don't use this type, it's simply a helper type for [SavedObjectAttribute](./kibana-plugin-public.savedobjectattribute.md) | -| [SavedObjectsClientContract](./kibana-plugin-public.savedobjectsclientcontract.md) | SavedObjectsClientContract as implemented by the [SavedObjectsClient](./kibana-plugin-public.savedobjectsclient.md) | -| [Toast](./kibana-plugin-public.toast.md) | | -| [ToastInput](./kibana-plugin-public.toastinput.md) | Inputs for [IToasts](./kibana-plugin-public.itoasts.md) APIs. | -| [ToastInputFields](./kibana-plugin-public.toastinputfields.md) | Allowed fields for [ToastInput](./kibana-plugin-public.toastinput.md). | -| [ToastsSetup](./kibana-plugin-public.toastssetup.md) | [IToasts](./kibana-plugin-public.itoasts.md) | -| [ToastsStart](./kibana-plugin-public.toastsstart.md) | [IToasts](./kibana-plugin-public.itoasts.md) | -| [UnmountCallback](./kibana-plugin-public.unmountcallback.md) | A function that will unmount the element previously mounted by the associated [MountPoint](./kibana-plugin-public.mountpoint.md) | - + + +[Home](./index.md) > [kibana-plugin-public](./kibana-plugin-public.md) + +## kibana-plugin-public package + +The Kibana Core APIs for client-side plugins. + +A plugin's `public/index` file must contain a named import, `plugin`, that implements [PluginInitializer](./kibana-plugin-public.plugininitializer.md) which returns an object that implements [Plugin](./kibana-plugin-public.plugin.md). + +The plugin integrates with the core system via lifecycle events: `setup`, `start`, and `stop`. In each lifecycle method, the plugin will receive the corresponding core services available (either [CoreSetup](./kibana-plugin-public.coresetup.md) or [CoreStart](./kibana-plugin-public.corestart.md)) and any interfaces returned by dependency plugins' lifecycle method. Anything returned by the plugin's lifecycle method will be exposed to downstream dependencies when their corresponding lifecycle methods are invoked. + +## Classes + +| Class | Description | +| --- | --- | +| [SavedObjectsClient](./kibana-plugin-public.savedobjectsclient.md) | Saved Objects is Kibana's data persisentence mechanism allowing plugins to use Elasticsearch for storing plugin state. The client-side SavedObjectsClient is a thin convenience library around the SavedObjects HTTP API for interacting with Saved Objects. | +| [SimpleSavedObject](./kibana-plugin-public.simplesavedobject.md) | This class is a very simple wrapper for SavedObjects loaded from the server with the [SavedObjectsClient](./kibana-plugin-public.savedobjectsclient.md).It provides basic functionality for creating/saving/deleting saved objects, but doesn't include any type-specific implementations. | +| [ToastsApi](./kibana-plugin-public.toastsapi.md) | Methods for adding and removing global toast messages. | + +## Enumerations + +| Enumeration | Description | +| --- | --- | +| [AppCategory](./kibana-plugin-public.appcategory.md) | | +| [AppLeaveActionType](./kibana-plugin-public.appleaveactiontype.md) | Possible type of actions on application leave. | +| [AppNavLinkStatus](./kibana-plugin-public.appnavlinkstatus.md) | Status of the application's navLink. | +| [AppStatus](./kibana-plugin-public.appstatus.md) | Accessibility status of an application. | + +## Interfaces + +| Interface | Description | +| --- | --- | +| [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) | | +| [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) | | +| [ApplicationStart](./kibana-plugin-public.applicationstart.md) | | +| [AppMountContext](./kibana-plugin-public.appmountcontext.md) | The context object received when applications are mounted to the DOM. Deprecated, use [CoreSetup.getStartServices()](./kibana-plugin-public.coresetup.getstartservices.md). | +| [AppMountParameters](./kibana-plugin-public.appmountparameters.md) | | +| [Capabilities](./kibana-plugin-public.capabilities.md) | The read-only set of capabilities available for the current UI session. Capabilities are simple key-value pairs of (string, boolean), where the string denotes the capability ID, and the boolean is a flag indicating if the capability is enabled or disabled. | +| [ChromeBadge](./kibana-plugin-public.chromebadge.md) | | +| [ChromeBrand](./kibana-plugin-public.chromebrand.md) | | +| [ChromeDocTitle](./kibana-plugin-public.chromedoctitle.md) | APIs for accessing and updating the document title. | +| [ChromeHelpExtension](./kibana-plugin-public.chromehelpextension.md) | | +| [ChromeNavControl](./kibana-plugin-public.chromenavcontrol.md) | | +| [ChromeNavControls](./kibana-plugin-public.chromenavcontrols.md) | [APIs](./kibana-plugin-public.chromenavcontrols.md) for registering new controls to be displayed in the navigation bar. | +| [ChromeNavLink](./kibana-plugin-public.chromenavlink.md) | | +| [ChromeNavLinks](./kibana-plugin-public.chromenavlinks.md) | [APIs](./kibana-plugin-public.chromenavlinks.md) for manipulating nav links. | +| [ChromeRecentlyAccessed](./kibana-plugin-public.chromerecentlyaccessed.md) | [APIs](./kibana-plugin-public.chromerecentlyaccessed.md) for recently accessed history. | +| [ChromeRecentlyAccessedHistoryItem](./kibana-plugin-public.chromerecentlyaccessedhistoryitem.md) | | +| [ChromeStart](./kibana-plugin-public.chromestart.md) | ChromeStart allows plugins to customize the global chrome header UI and enrich the UX with additional information about the current location of the browser. | +| [ContextSetup](./kibana-plugin-public.contextsetup.md) | An object that handles registration of context providers and configuring handlers with context. | +| [CoreSetup](./kibana-plugin-public.coresetup.md) | Core services exposed to the Plugin setup lifecycle | +| [CoreStart](./kibana-plugin-public.corestart.md) | Core services exposed to the Plugin start lifecycle | +| [DocLinksStart](./kibana-plugin-public.doclinksstart.md) | | +| [EnvironmentMode](./kibana-plugin-public.environmentmode.md) | | +| [ErrorToastOptions](./kibana-plugin-public.errortoastoptions.md) | Options available for [IToasts](./kibana-plugin-public.itoasts.md) APIs. | +| [FatalErrorInfo](./kibana-plugin-public.fatalerrorinfo.md) | Represents the message and stack of a fatal Error | +| [FatalErrorsSetup](./kibana-plugin-public.fatalerrorssetup.md) | FatalErrors stop the Kibana Public Core and displays a fatal error screen with details about the Kibana build and the error. | +| [HttpErrorRequest](./kibana-plugin-public.httperrorrequest.md) | | +| [HttpErrorResponse](./kibana-plugin-public.httperrorresponse.md) | | +| [HttpFetchOptions](./kibana-plugin-public.httpfetchoptions.md) | All options that may be used with a [HttpHandler](./kibana-plugin-public.httphandler.md). | +| [HttpFetchQuery](./kibana-plugin-public.httpfetchquery.md) | | +| [HttpHandler](./kibana-plugin-public.httphandler.md) | A function for making an HTTP requests to Kibana's backend. See [HttpFetchOptions](./kibana-plugin-public.httpfetchoptions.md) for options and [IHttpResponse](./kibana-plugin-public.ihttpresponse.md) for the response. | +| [HttpHeadersInit](./kibana-plugin-public.httpheadersinit.md) | | +| [HttpInterceptor](./kibana-plugin-public.httpinterceptor.md) | An object that may define global interceptor functions for different parts of the request and response lifecycle. See [IHttpInterceptController](./kibana-plugin-public.ihttpinterceptcontroller.md). | +| [HttpRequestInit](./kibana-plugin-public.httprequestinit.md) | Fetch API options available to [HttpHandler](./kibana-plugin-public.httphandler.md)s. | +| [HttpSetup](./kibana-plugin-public.httpsetup.md) | | +| [I18nStart](./kibana-plugin-public.i18nstart.md) | I18nStart.Context is required by any localizable React component from @kbn/i18n and @elastic/eui packages and is supposed to be used as the topmost component for any i18n-compatible React tree. | +| [IAnonymousPaths](./kibana-plugin-public.ianonymouspaths.md) | APIs for denoting paths as not requiring authentication | +| [IBasePath](./kibana-plugin-public.ibasepath.md) | APIs for manipulating the basePath on URL segments. | +| [IContextContainer](./kibana-plugin-public.icontextcontainer.md) | An object that handles registration of context providers and configuring handlers with context. | +| [IHttpFetchError](./kibana-plugin-public.ihttpfetcherror.md) | | +| [IHttpInterceptController](./kibana-plugin-public.ihttpinterceptcontroller.md) | Used to halt a request Promise chain in a [HttpInterceptor](./kibana-plugin-public.httpinterceptor.md). | +| [IHttpResponse](./kibana-plugin-public.ihttpresponse.md) | | +| [IHttpResponseInterceptorOverrides](./kibana-plugin-public.ihttpresponseinterceptoroverrides.md) | Properties that can be returned by HttpInterceptor.request to override the response. | +| [IUiSettingsClient](./kibana-plugin-public.iuisettingsclient.md) | Client-side client that provides access to the advanced settings stored in elasticsearch. The settings provide control over the behavior of the Kibana application. For example, a user can specify how to display numeric or date fields. Users can adjust the settings via Management UI. [IUiSettingsClient](./kibana-plugin-public.iuisettingsclient.md) | +| [LegacyCoreSetup](./kibana-plugin-public.legacycoresetup.md) | Setup interface exposed to the legacy platform via the ui/new_platform module. | +| [LegacyCoreStart](./kibana-plugin-public.legacycorestart.md) | Start interface exposed to the legacy platform via the ui/new_platform module. | +| [LegacyNavLink](./kibana-plugin-public.legacynavlink.md) | | +| [NotificationsSetup](./kibana-plugin-public.notificationssetup.md) | | +| [NotificationsStart](./kibana-plugin-public.notificationsstart.md) | | +| [OverlayBannersStart](./kibana-plugin-public.overlaybannersstart.md) | | +| [OverlayRef](./kibana-plugin-public.overlayref.md) | Returned by [OverlayStart](./kibana-plugin-public.overlaystart.md) methods for closing a mounted overlay. | +| [OverlayStart](./kibana-plugin-public.overlaystart.md) | | +| [PackageInfo](./kibana-plugin-public.packageinfo.md) | | +| [Plugin](./kibana-plugin-public.plugin.md) | The interface that should be returned by a PluginInitializer. | +| [PluginInitializerContext](./kibana-plugin-public.plugininitializercontext.md) | The available core services passed to a PluginInitializer | +| [SavedObject](./kibana-plugin-public.savedobject.md) | | +| [SavedObjectAttributes](./kibana-plugin-public.savedobjectattributes.md) | The data for a Saved Object is stored as an object in the attributes property. | +| [SavedObjectReference](./kibana-plugin-public.savedobjectreference.md) | A reference to another saved object. | +| [SavedObjectsBaseOptions](./kibana-plugin-public.savedobjectsbaseoptions.md) | | +| [SavedObjectsBatchResponse](./kibana-plugin-public.savedobjectsbatchresponse.md) | | +| [SavedObjectsBulkCreateObject](./kibana-plugin-public.savedobjectsbulkcreateobject.md) | | +| [SavedObjectsBulkCreateOptions](./kibana-plugin-public.savedobjectsbulkcreateoptions.md) | | +| [SavedObjectsBulkUpdateObject](./kibana-plugin-public.savedobjectsbulkupdateobject.md) | | +| [SavedObjectsBulkUpdateOptions](./kibana-plugin-public.savedobjectsbulkupdateoptions.md) | | +| [SavedObjectsCreateOptions](./kibana-plugin-public.savedobjectscreateoptions.md) | | +| [SavedObjectsFindOptions](./kibana-plugin-public.savedobjectsfindoptions.md) | | +| [SavedObjectsFindResponsePublic](./kibana-plugin-public.savedobjectsfindresponsepublic.md) | Return type of the Saved Objects find() method.\*Note\*: this type is different between the Public and Server Saved Objects clients. | +| [SavedObjectsImportConflictError](./kibana-plugin-public.savedobjectsimportconflicterror.md) | Represents a failure to import due to a conflict. | +| [SavedObjectsImportError](./kibana-plugin-public.savedobjectsimporterror.md) | Represents a failure to import. | +| [SavedObjectsImportMissingReferencesError](./kibana-plugin-public.savedobjectsimportmissingreferenceserror.md) | Represents a failure to import due to missing references. | +| [SavedObjectsImportResponse](./kibana-plugin-public.savedobjectsimportresponse.md) | The response describing the result of an import. | +| [SavedObjectsImportRetry](./kibana-plugin-public.savedobjectsimportretry.md) | Describes a retry operation for importing a saved object. | +| [SavedObjectsImportUnknownError](./kibana-plugin-public.savedobjectsimportunknownerror.md) | Represents a failure to import due to an unknown reason. | +| [SavedObjectsImportUnsupportedTypeError](./kibana-plugin-public.savedobjectsimportunsupportedtypeerror.md) | Represents a failure to import due to having an unsupported saved object type. | +| [SavedObjectsMigrationVersion](./kibana-plugin-public.savedobjectsmigrationversion.md) | Information about the migrations that have been applied to this SavedObject. When Kibana starts up, KibanaMigrator detects outdated documents and migrates them based on this value. For each migration that has been applied, the plugin's name is used as a key and the latest migration version as the value. | +| [SavedObjectsStart](./kibana-plugin-public.savedobjectsstart.md) | | +| [SavedObjectsUpdateOptions](./kibana-plugin-public.savedobjectsupdateoptions.md) | | +| [UiSettingsState](./kibana-plugin-public.uisettingsstate.md) | | + +## Type Aliases + +| Type Alias | Description | +| --- | --- | +| [AppLeaveAction](./kibana-plugin-public.appleaveaction.md) | Possible actions to return from a [AppLeaveHandler](./kibana-plugin-public.appleavehandler.md)See [AppLeaveConfirmAction](./kibana-plugin-public.appleaveconfirmaction.md) and [AppLeaveDefaultAction](./kibana-plugin-public.appleavedefaultaction.md) | +| [AppLeaveHandler](./kibana-plugin-public.appleavehandler.md) | A handler that will be executed before leaving the application, either when going to another application or when closing the browser tab or manually changing the url. Should return confirm to to prompt a message to the user before leaving the page, or default to keep the default behavior (doing nothing).See [AppMountParameters](./kibana-plugin-public.appmountparameters.md) for detailed usage examples. | +| [AppMount](./kibana-plugin-public.appmount.md) | A mount function called when the user navigates to this app's route. | +| [AppMountDeprecated](./kibana-plugin-public.appmountdeprecated.md) | A mount function called when the user navigates to this app's route. | +| [AppUnmount](./kibana-plugin-public.appunmount.md) | A function called when an application should be unmounted from the page. This function should be synchronous. | +| [AppUpdatableFields](./kibana-plugin-public.appupdatablefields.md) | Defines the list of fields that can be updated via an [AppUpdater](./kibana-plugin-public.appupdater.md). | +| [AppUpdater](./kibana-plugin-public.appupdater.md) | Updater for applications. see [ApplicationSetup](./kibana-plugin-public.applicationsetup.md) | +| [ChromeBreadcrumb](./kibana-plugin-public.chromebreadcrumb.md) | | +| [ChromeHelpExtensionMenuCustomLink](./kibana-plugin-public.chromehelpextensionmenucustomlink.md) | | +| [ChromeHelpExtensionMenuDiscussLink](./kibana-plugin-public.chromehelpextensionmenudiscusslink.md) | | +| [ChromeHelpExtensionMenuDocumentationLink](./kibana-plugin-public.chromehelpextensionmenudocumentationlink.md) | | +| [ChromeHelpExtensionMenuGitHubLink](./kibana-plugin-public.chromehelpextensionmenugithublink.md) | | +| [ChromeHelpExtensionMenuLink](./kibana-plugin-public.chromehelpextensionmenulink.md) | | +| [ChromeNavLinkUpdateableFields](./kibana-plugin-public.chromenavlinkupdateablefields.md) | | +| [HandlerContextType](./kibana-plugin-public.handlercontexttype.md) | Extracts the type of the first argument of a [HandlerFunction](./kibana-plugin-public.handlerfunction.md) to represent the type of the context. | +| [HandlerFunction](./kibana-plugin-public.handlerfunction.md) | A function that accepts a context object and an optional number of additional arguments. Used for the generic types in [IContextContainer](./kibana-plugin-public.icontextcontainer.md) | +| [HandlerParameters](./kibana-plugin-public.handlerparameters.md) | Extracts the types of the additional arguments of a [HandlerFunction](./kibana-plugin-public.handlerfunction.md), excluding the [HandlerContextType](./kibana-plugin-public.handlercontexttype.md). | +| [HttpStart](./kibana-plugin-public.httpstart.md) | See [HttpSetup](./kibana-plugin-public.httpsetup.md) | +| [IContextProvider](./kibana-plugin-public.icontextprovider.md) | A function that returns a context value for a specific key of given context type. | +| [IToasts](./kibana-plugin-public.itoasts.md) | Methods for adding and removing global toast messages. See [ToastsApi](./kibana-plugin-public.toastsapi.md). | +| [MountPoint](./kibana-plugin-public.mountpoint.md) | A function that should mount DOM content inside the provided container element and return a handler to unmount it. | +| [PluginInitializer](./kibana-plugin-public.plugininitializer.md) | The plugin export at the root of a plugin's public directory should conform to this interface. | +| [PluginOpaqueId](./kibana-plugin-public.pluginopaqueid.md) | | +| [RecursiveReadonly](./kibana-plugin-public.recursivereadonly.md) | | +| [SavedObjectAttribute](./kibana-plugin-public.savedobjectattribute.md) | Type definition for a Saved Object attribute value | +| [SavedObjectAttributeSingle](./kibana-plugin-public.savedobjectattributesingle.md) | Don't use this type, it's simply a helper type for [SavedObjectAttribute](./kibana-plugin-public.savedobjectattribute.md) | +| [SavedObjectsClientContract](./kibana-plugin-public.savedobjectsclientcontract.md) | SavedObjectsClientContract as implemented by the [SavedObjectsClient](./kibana-plugin-public.savedobjectsclient.md) | +| [Toast](./kibana-plugin-public.toast.md) | | +| [ToastInput](./kibana-plugin-public.toastinput.md) | Inputs for [IToasts](./kibana-plugin-public.itoasts.md) APIs. | +| [ToastInputFields](./kibana-plugin-public.toastinputfields.md) | Allowed fields for [ToastInput](./kibana-plugin-public.toastinput.md). | +| [ToastsSetup](./kibana-plugin-public.toastssetup.md) | [IToasts](./kibana-plugin-public.itoasts.md) | +| [ToastsStart](./kibana-plugin-public.toastsstart.md) | [IToasts](./kibana-plugin-public.itoasts.md) | +| [UnmountCallback](./kibana-plugin-public.unmountcallback.md) | A function that will unmount the element previously mounted by the associated [MountPoint](./kibana-plugin-public.mountpoint.md) | + diff --git a/src/core/public/application/types.ts b/src/core/public/application/types.ts index 92f15ac402a44..61710fb069dd2 100644 --- a/src/core/public/application/types.ts +++ b/src/core/public/application/types.ts @@ -31,7 +31,7 @@ import { PluginOpaqueId } from '../plugins'; import { IUiSettingsClient } from '../ui_settings'; import { RecursiveReadonly } from '../../utils'; import { SavedObjectsStart } from '../saved_objects'; -import { AppCategory } from '../../types'; +import { AppCategory } from '../'; /** @public */ export interface AppBase { diff --git a/src/core/public/chrome/nav_links/nav_link.ts b/src/core/public/chrome/nav_links/nav_link.ts index 4ac71aa278c70..4d3a1e9ecd199 100644 --- a/src/core/public/chrome/nav_links/nav_link.ts +++ b/src/core/public/chrome/nav_links/nav_link.ts @@ -18,7 +18,7 @@ */ import { pick } from '../../../utils'; -import { AppCategory } from '../../../types'; +import { AppCategory } from '../../'; /** * @public diff --git a/src/core/public/chrome/ui/header/header.tsx b/src/core/public/chrome/ui/header/header.tsx index 99137614a9f46..470812258b938 100644 --- a/src/core/public/chrome/ui/header/header.tsx +++ b/src/core/public/chrome/ui/header/header.tsx @@ -59,7 +59,7 @@ import { import { HttpStart } from '../../../http'; import { ChromeHelpExtension } from '../../chrome_service'; import { ApplicationStart, InternalApplicationStart } from '../../../application/types'; -import { AppCategory } from '../../../../types'; +import { AppCategory } from '../../../'; // Providing a buffer between the limit and the cut off index // protects from truncating just the last couple (6) characters diff --git a/src/core/public/index.ts b/src/core/public/index.ts index 5b17eccc37f8b..6575395ab30fe 100644 --- a/src/core/public/index.ts +++ b/src/core/public/index.ts @@ -78,6 +78,7 @@ import { export { CoreContext, CoreSystem } from './core_system'; export { RecursiveReadonly } from '../utils'; +export { AppCategory } from '../types'; export { ApplicationSetup, diff --git a/src/core/public/injected_metadata/injected_metadata_service.ts b/src/core/public/injected_metadata/injected_metadata_service.ts index e214bae995fd2..bf6093375eac6 100644 --- a/src/core/public/injected_metadata/injected_metadata_service.ts +++ b/src/core/public/injected_metadata/injected_metadata_service.ts @@ -26,7 +26,7 @@ import { UserProvidedValues, } from '../../server/types'; import { deepFreeze } from '../../utils/'; -import { AppCategory } from '../../types'; +import { AppCategory } from '../'; /** @public */ export interface LegacyNavLink { @@ -112,10 +112,6 @@ export class InjectedMetadataService { return this.state.basePath; }, - getCategory: () => { - return this.state.category; - }, - getKibanaVersion: () => { return this.state.version; }, @@ -162,7 +158,6 @@ export class InjectedMetadataService { */ export interface InjectedMetadataSetup { getBasePath: () => string; - getCategory: () => AppCategory | undefined; getKibanaBuildNumber: () => number; getKibanaBranch: () => string; getKibanaVersion: () => string; diff --git a/src/core/public/public.api.md b/src/core/public/public.api.md index a08e488a58c15..cddacb90d27ff 100644 --- a/src/core/public/public.api.md +++ b/src/core/public/public.api.md @@ -3,6 +3,7 @@ > Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). ```ts + import { Breadcrumb } from '@elastic/eui'; import { EuiButtonEmptyProps } from '@elastic/eui'; import { EuiGlobalToastListToast } from '@elastic/eui'; @@ -17,28 +18,39 @@ import { UserProvidedValues as UserProvidedValues_2 } from 'src/core/server/type // @public export interface App extends AppBase { - appRoute?: string; - chromeless?: boolean; - mount: AppMount | AppMountDeprecated; + appRoute?: string; + chromeless?: boolean; + mount: AppMount | AppMountDeprecated; } // @public (undocumented) export interface AppBase { - capabilities?: Partial; - // Warning: (ae-forgotten-export) The symbol "AppCategory" needs to be exported by the entry point index.d.ts - category?: AppCategory; - chromeless?: boolean; - euiIconType?: string; - icon?: string; - id: string; - // @internal - legacy?: boolean; - navLinkStatus?: AppNavLinkStatus; - order?: number; - status?: AppStatus; - title: string; - tooltip?: string; - updater$?: Observable; + capabilities?: Partial; + category?: AppCategory; + chromeless?: boolean; + euiIconType?: string; + icon?: string; + id: string; + // @internal + legacy?: boolean; + navLinkStatus?: AppNavLinkStatus; + order?: number; + status?: AppStatus; + title: string; + tooltip?: string; + updater$?: Observable; +} + +// @public (undocumented) +export enum AppCategory { + // (undocumented) + analyze = 0, + // (undocumented) + management = 3, + // (undocumented) + observability = 1, + // (undocumented) + security = 2 } // @public @@ -46,30 +58,30 @@ export type AppLeaveAction = AppLeaveDefaultAction | AppLeaveConfirmAction; // @public export enum AppLeaveActionType { - // (undocumented) - confirm = 'confirm', - // (undocumented) - default = 'default', + // (undocumented) + confirm = "confirm", + // (undocumented) + default = "default" } // Warning: (ae-unresolved-link) The @link reference could not be resolved: The package "kibana" does not have an export "AppLeaveActionFactory" // // @public export interface AppLeaveConfirmAction { - // (undocumented) - text: string; - // (undocumented) - title?: string; - // (undocumented) - type: AppLeaveActionType.confirm; + // (undocumented) + text: string; + // (undocumented) + title?: string; + // (undocumented) + type: AppLeaveActionType.confirm; } // Warning: (ae-unresolved-link) The @link reference could not be resolved: The package "kibana" does not have an export "AppLeaveActionFactory" // // @public export interface AppLeaveDefaultAction { - // (undocumented) - type: AppLeaveActionType.default; + // (undocumented) + type: AppLeaveActionType.default; } // Warning: (ae-forgotten-export) The symbol "AppLeaveActionFactory" needs to be exported by the entry point index.d.ts @@ -79,36 +91,24 @@ export type AppLeaveHandler = (factory: AppLeaveActionFactory) => AppLeaveAction // @public (undocumented) export interface ApplicationSetup { - register(app: App): void; - registerAppUpdater(appUpdater$: Observable): void; - // @deprecated - registerMountContext( - contextName: T, - provider: IContextProvider - ): void; + register(app: App): void; + registerAppUpdater(appUpdater$: Observable): void; + // @deprecated + registerMountContext(contextName: T, provider: IContextProvider): void; } // @public (undocumented) export interface ApplicationStart { - capabilities: RecursiveReadonly; - getUrlForApp( - appId: string, - options?: { - path?: string; - } - ): string; - navigateToApp( - appId: string, - options?: { - path?: string; - state?: any; - } - ): Promise; - // @deprecated - registerMountContext( - contextName: T, - provider: IContextProvider - ): void; + capabilities: RecursiveReadonly; + getUrlForApp(appId: string, options?: { + path?: string; + }): string; + navigateToApp(appId: string, options?: { + path?: string; + state?: any; + }): Promise; + // @deprecated + registerMountContext(contextName: T, provider: IContextProvider): void; } // @public @@ -116,47 +116,44 @@ export type AppMount = (params: AppMountParameters) => AppUnmount | Promise; - chrome: ChromeStart; - docLinks: DocLinksStart; - http: HttpStart; - i18n: I18nStart; - notifications: NotificationsStart; - overlays: OverlayStart; - savedObjects: SavedObjectsStart; - uiSettings: IUiSettingsClient; - injectedMetadata: { - getInjectedVar: (name: string, defaultValue?: any) => unknown; + core: { + application: Pick; + chrome: ChromeStart; + docLinks: DocLinksStart; + http: HttpStart; + i18n: I18nStart; + notifications: NotificationsStart; + overlays: OverlayStart; + savedObjects: SavedObjectsStart; + uiSettings: IUiSettingsClient; + injectedMetadata: { + getInjectedVar: (name: string, defaultValue?: any) => unknown; + }; }; - }; } // @public @deprecated -export type AppMountDeprecated = ( - context: AppMountContext, - params: AppMountParameters -) => AppUnmount | Promise; +export type AppMountDeprecated = (context: AppMountContext, params: AppMountParameters) => AppUnmount | Promise; // @public (undocumented) export interface AppMountParameters { - appBasePath: string; - element: HTMLElement; - onAppLeave: (handler: AppLeaveHandler) => void; + appBasePath: string; + element: HTMLElement; + onAppLeave: (handler: AppLeaveHandler) => void; } // @public export enum AppNavLinkStatus { - default = 0, - disabled = 2, - hidden = 3, - visible = 1, + default = 0, + disabled = 2, + hidden = 3, + visible = 1 } // @public export enum AppStatus { - accessible = 0, - inaccessible = 1, + accessible = 0, + inaccessible = 1 } // @public @@ -170,30 +167,30 @@ export type AppUpdater = (app: AppBase) => Partial | undefin // @public export interface Capabilities { - [key: string]: Record>; - catalogue: Record; - management: { - [sectionId: string]: Record; - }; - navLinks: Record; + [key: string]: Record>; + catalogue: Record; + management: { + [sectionId: string]: Record; + }; + navLinks: Record; } // @public (undocumented) export interface ChromeBadge { - // (undocumented) - iconType?: IconType; - // (undocumented) - text: string; - // (undocumented) - tooltip: string; + // (undocumented) + iconType?: IconType; + // (undocumented) + text: string; + // (undocumented) + tooltip: string; } // @public (undocumented) export interface ChromeBrand { - // (undocumented) - logo?: string; - // (undocumented) - smallLogo?: string; + // (undocumented) + logo?: string; + // (undocumented) + smallLogo?: string; } // @public (undocumented) @@ -201,477 +198,444 @@ export type ChromeBreadcrumb = Breadcrumb; // @public export interface ChromeDocTitle { - // @internal (undocumented) - __legacy: { - setBaseTitle(baseTitle: string): void; - }; - change(newTitle: string | string[]): void; - reset(): void; + // @internal (undocumented) + __legacy: { + setBaseTitle(baseTitle: string): void; + }; + change(newTitle: string | string[]): void; + reset(): void; } // @public (undocumented) export interface ChromeHelpExtension { - appName: string; - content?: (element: HTMLDivElement) => () => void; - links?: ChromeHelpExtensionMenuLink[]; + appName: string; + content?: (element: HTMLDivElement) => () => void; + links?: ChromeHelpExtensionMenuLink[]; } // @public (undocumented) export type ChromeHelpExtensionMenuCustomLink = EuiButtonEmptyProps & { - linkType: 'custom'; - content: React.ReactNode; + linkType: 'custom'; + content: React.ReactNode; }; // @public (undocumented) export type ChromeHelpExtensionMenuDiscussLink = EuiButtonEmptyProps & { - linkType: 'discuss'; - href: string; + linkType: 'discuss'; + href: string; }; // @public (undocumented) export type ChromeHelpExtensionMenuDocumentationLink = EuiButtonEmptyProps & { - linkType: 'documentation'; - href: string; + linkType: 'documentation'; + href: string; }; // @public (undocumented) export type ChromeHelpExtensionMenuGitHubLink = EuiButtonEmptyProps & { - linkType: 'github'; - labels: string[]; - title?: string; + linkType: 'github'; + labels: string[]; + title?: string; }; // @public (undocumented) -export type ChromeHelpExtensionMenuLink = ExclusiveUnion< - ChromeHelpExtensionMenuGitHubLink, - ExclusiveUnion< - ChromeHelpExtensionMenuDiscussLink, - ExclusiveUnion - > ->; +export type ChromeHelpExtensionMenuLink = ExclusiveUnion>>; // @public (undocumented) export interface ChromeNavControl { - // (undocumented) - mount: MountPoint; - // (undocumented) - order?: number; + // (undocumented) + mount: MountPoint; + // (undocumented) + order?: number; } // @public export interface ChromeNavControls { - // @internal (undocumented) - getLeft$(): Observable; - // @internal (undocumented) - getRight$(): Observable; - registerLeft(navControl: ChromeNavControl): void; - registerRight(navControl: ChromeNavControl): void; + // @internal (undocumented) + getLeft$(): Observable; + // @internal (undocumented) + getRight$(): Observable; + registerLeft(navControl: ChromeNavControl): void; + registerRight(navControl: ChromeNavControl): void; } // @public (undocumented) export interface ChromeNavLink { - // @deprecated - readonly active?: boolean; - readonly baseUrl: string; - readonly category?: AppCategory; - // @deprecated - readonly disabled?: boolean; - readonly euiIconType?: string; - readonly hidden?: boolean; - readonly icon?: string; - readonly id: string; - // @internal - readonly legacy: boolean; - // @deprecated - readonly linkToLastSubUrl?: boolean; - readonly order?: number; - // @deprecated - readonly subUrlBase?: string; - readonly title: string; - readonly tooltip?: string; - // @deprecated - readonly url?: string; + // @deprecated + readonly active?: boolean; + readonly baseUrl: string; + readonly category?: AppCategory; + // @deprecated + readonly disabled?: boolean; + readonly euiIconType?: string; + readonly hidden?: boolean; + readonly icon?: string; + readonly id: string; + // @internal + readonly legacy: boolean; + // @deprecated + readonly linkToLastSubUrl?: boolean; + readonly order?: number; + // @deprecated + readonly subUrlBase?: string; + readonly title: string; + readonly tooltip?: string; + // @deprecated + readonly url?: string; } // @public export interface ChromeNavLinks { - enableForcedAppSwitcherNavigation(): void; - get(id: string): ChromeNavLink | undefined; - getAll(): Array>; - getForceAppSwitcherNavigation$(): Observable; - getNavLinks$(): Observable>>; - has(id: string): boolean; - showOnly(id: string): void; - update(id: string, values: ChromeNavLinkUpdateableFields): ChromeNavLink | undefined; + enableForcedAppSwitcherNavigation(): void; + get(id: string): ChromeNavLink | undefined; + getAll(): Array>; + getForceAppSwitcherNavigation$(): Observable; + getNavLinks$(): Observable>>; + has(id: string): boolean; + showOnly(id: string): void; + update(id: string, values: ChromeNavLinkUpdateableFields): ChromeNavLink | undefined; } // @public (undocumented) -export type ChromeNavLinkUpdateableFields = Partial< - Pick ->; +export type ChromeNavLinkUpdateableFields = Partial>; // @public export interface ChromeRecentlyAccessed { - // Warning: (ae-unresolved-link) The @link reference could not be resolved: No member was found with name "basePath" - add(link: string, label: string, id: string): void; - get$(): Observable; - get(): ChromeRecentlyAccessedHistoryItem[]; + // Warning: (ae-unresolved-link) The @link reference could not be resolved: No member was found with name "basePath" + add(link: string, label: string, id: string): void; + get$(): Observable; + get(): ChromeRecentlyAccessedHistoryItem[]; } // @public (undocumented) export interface ChromeRecentlyAccessedHistoryItem { - // (undocumented) - id: string; - // (undocumented) - label: string; - // (undocumented) - link: string; + // (undocumented) + id: string; + // (undocumented) + label: string; + // (undocumented) + link: string; } // @public export interface ChromeStart { - addApplicationClass(className: string): void; - docTitle: ChromeDocTitle; - getApplicationClasses$(): Observable; - getBadge$(): Observable; - getBrand$(): Observable; - getBreadcrumbs$(): Observable; - getHelpExtension$(): Observable; - getIsCollapsed$(): Observable; - getIsVisible$(): Observable; - navControls: ChromeNavControls; - navLinks: ChromeNavLinks; - recentlyAccessed: ChromeRecentlyAccessed; - removeApplicationClass(className: string): void; - setAppTitle(appTitle: string): void; - setBadge(badge?: ChromeBadge): void; - setBrand(brand: ChromeBrand): void; - setBreadcrumbs(newBreadcrumbs: ChromeBreadcrumb[]): void; - setHelpExtension(helpExtension?: ChromeHelpExtension): void; - setHelpSupportUrl(url: string): void; - setIsCollapsed(isCollapsed: boolean): void; - setIsVisible(isVisible: boolean): void; + addApplicationClass(className: string): void; + docTitle: ChromeDocTitle; + getApplicationClasses$(): Observable; + getBadge$(): Observable; + getBrand$(): Observable; + getBreadcrumbs$(): Observable; + getHelpExtension$(): Observable; + getIsCollapsed$(): Observable; + getIsVisible$(): Observable; + navControls: ChromeNavControls; + navLinks: ChromeNavLinks; + recentlyAccessed: ChromeRecentlyAccessed; + removeApplicationClass(className: string): void; + setAppTitle(appTitle: string): void; + setBadge(badge?: ChromeBadge): void; + setBrand(brand: ChromeBrand): void; + setBreadcrumbs(newBreadcrumbs: ChromeBreadcrumb[]): void; + setHelpExtension(helpExtension?: ChromeHelpExtension): void; + setHelpSupportUrl(url: string): void; + setIsCollapsed(isCollapsed: boolean): void; + setIsVisible(isVisible: boolean): void; } // @public export interface ContextSetup { - createContextContainer>(): IContextContainer; + createContextContainer>(): IContextContainer; } // @internal (undocumented) export interface CoreContext { - // Warning: (ae-forgotten-export) The symbol "CoreId" needs to be exported by the entry point index.d.ts - // - // (undocumented) - coreId: CoreId; - // (undocumented) - env: { - mode: Readonly; - packageInfo: Readonly; - }; + // Warning: (ae-forgotten-export) The symbol "CoreId" needs to be exported by the entry point index.d.ts + // + // (undocumented) + coreId: CoreId; + // (undocumented) + env: { + mode: Readonly; + packageInfo: Readonly; + }; } // @public export interface CoreSetup { - // (undocumented) - application: ApplicationSetup; - // @deprecated (undocumented) - context: ContextSetup; - // (undocumented) - fatalErrors: FatalErrorsSetup; - getStartServices(): Promise<[CoreStart, TPluginsStart]>; - // (undocumented) - http: HttpSetup; - // @deprecated - injectedMetadata: { - getInjectedVar: (name: string, defaultValue?: any) => unknown; - }; - // (undocumented) - notifications: NotificationsSetup; - // (undocumented) - uiSettings: IUiSettingsClient; + // (undocumented) + application: ApplicationSetup; + // @deprecated (undocumented) + context: ContextSetup; + // (undocumented) + fatalErrors: FatalErrorsSetup; + getStartServices(): Promise<[CoreStart, TPluginsStart]>; + // (undocumented) + http: HttpSetup; + // @deprecated + injectedMetadata: { + getInjectedVar: (name: string, defaultValue?: any) => unknown; + }; + // (undocumented) + notifications: NotificationsSetup; + // (undocumented) + uiSettings: IUiSettingsClient; } // @public export interface CoreStart { - // (undocumented) - application: ApplicationStart; - // (undocumented) - chrome: ChromeStart; - // (undocumented) - docLinks: DocLinksStart; - // (undocumented) - http: HttpStart; - // (undocumented) - i18n: I18nStart; - // @deprecated - injectedMetadata: { - getInjectedVar: (name: string, defaultValue?: any) => unknown; - }; - // (undocumented) - notifications: NotificationsStart; - // (undocumented) - overlays: OverlayStart; - // (undocumented) - savedObjects: SavedObjectsStart; - // (undocumented) - uiSettings: IUiSettingsClient; + // (undocumented) + application: ApplicationStart; + // (undocumented) + chrome: ChromeStart; + // (undocumented) + docLinks: DocLinksStart; + // (undocumented) + http: HttpStart; + // (undocumented) + i18n: I18nStart; + // @deprecated + injectedMetadata: { + getInjectedVar: (name: string, defaultValue?: any) => unknown; + }; + // (undocumented) + notifications: NotificationsStart; + // (undocumented) + overlays: OverlayStart; + // (undocumented) + savedObjects: SavedObjectsStart; + // (undocumented) + uiSettings: IUiSettingsClient; } // @internal export class CoreSystem { - // Warning: (ae-forgotten-export) The symbol "Params" needs to be exported by the entry point index.d.ts - constructor(params: Params); - // (undocumented) - setup(): Promise< - | { + // Warning: (ae-forgotten-export) The symbol "Params" needs to be exported by the entry point index.d.ts + constructor(params: Params); + // (undocumented) + setup(): Promise<{ fatalErrors: FatalErrorsSetup; - } - | undefined - >; - // (undocumented) - start(): Promise; - // (undocumented) - stop(): void; -} + } | undefined>; + // (undocumented) + start(): Promise; + // (undocumented) + stop(): void; + } // @public (undocumented) export interface DocLinksStart { - // (undocumented) - readonly DOC_LINK_VERSION: string; - // (undocumented) - readonly ELASTIC_WEBSITE_URL: string; - // (undocumented) - readonly links: { - readonly filebeat: { - readonly base: string; - readonly installation: string; - readonly configuration: string; - readonly elasticsearchOutput: string; - readonly startup: string; - readonly exportedFields: string; - }; - readonly auditbeat: { - readonly base: string; - }; - readonly metricbeat: { - readonly base: string; - }; - readonly heartbeat: { - readonly base: string; - }; - readonly logstash: { - readonly base: string; - }; - readonly functionbeat: { - readonly base: string; - }; - readonly winlogbeat: { - readonly base: string; - }; - readonly aggs: { - readonly date_histogram: string; - readonly date_range: string; - readonly filter: string; - readonly filters: string; - readonly geohash_grid: string; - readonly histogram: string; - readonly ip_range: string; - readonly range: string; - readonly significant_terms: string; - readonly terms: string; - readonly avg: string; - readonly avg_bucket: string; - readonly max_bucket: string; - readonly min_bucket: string; - readonly sum_bucket: string; - readonly cardinality: string; - readonly count: string; - readonly cumulative_sum: string; - readonly derivative: string; - readonly geo_bounds: string; - readonly geo_centroid: string; - readonly max: string; - readonly median: string; - readonly min: string; - readonly moving_avg: string; - readonly percentile_ranks: string; - readonly serial_diff: string; - readonly std_dev: string; - readonly sum: string; - readonly top_hits: string; - }; - readonly scriptedFields: { - readonly scriptFields: string; - readonly scriptAggs: string; - readonly painless: string; - readonly painlessApi: string; - readonly painlessSyntax: string; - readonly luceneExpressions: string; - }; - readonly indexPatterns: { - readonly loadingData: string; - readonly introduction: string; - }; - readonly kibana: string; - readonly siem: string; - readonly query: { - readonly luceneQuerySyntax: string; - readonly queryDsl: string; - readonly kueryQuerySyntax: string; + // (undocumented) + readonly DOC_LINK_VERSION: string; + // (undocumented) + readonly ELASTIC_WEBSITE_URL: string; + // (undocumented) + readonly links: { + readonly filebeat: { + readonly base: string; + readonly installation: string; + readonly configuration: string; + readonly elasticsearchOutput: string; + readonly startup: string; + readonly exportedFields: string; + }; + readonly auditbeat: { + readonly base: string; + }; + readonly metricbeat: { + readonly base: string; + }; + readonly heartbeat: { + readonly base: string; + }; + readonly logstash: { + readonly base: string; + }; + readonly functionbeat: { + readonly base: string; + }; + readonly winlogbeat: { + readonly base: string; + }; + readonly aggs: { + readonly date_histogram: string; + readonly date_range: string; + readonly filter: string; + readonly filters: string; + readonly geohash_grid: string; + readonly histogram: string; + readonly ip_range: string; + readonly range: string; + readonly significant_terms: string; + readonly terms: string; + readonly avg: string; + readonly avg_bucket: string; + readonly max_bucket: string; + readonly min_bucket: string; + readonly sum_bucket: string; + readonly cardinality: string; + readonly count: string; + readonly cumulative_sum: string; + readonly derivative: string; + readonly geo_bounds: string; + readonly geo_centroid: string; + readonly max: string; + readonly median: string; + readonly min: string; + readonly moving_avg: string; + readonly percentile_ranks: string; + readonly serial_diff: string; + readonly std_dev: string; + readonly sum: string; + readonly top_hits: string; + }; + readonly scriptedFields: { + readonly scriptFields: string; + readonly scriptAggs: string; + readonly painless: string; + readonly painlessApi: string; + readonly painlessSyntax: string; + readonly luceneExpressions: string; + }; + readonly indexPatterns: { + readonly loadingData: string; + readonly introduction: string; + }; + readonly kibana: string; + readonly siem: string; + readonly query: { + readonly luceneQuerySyntax: string; + readonly queryDsl: string; + readonly kueryQuerySyntax: string; + }; + readonly date: { + readonly dateMath: string; + }; }; - readonly date: { - readonly dateMath: string; - }; - }; } // @public (undocumented) export interface EnvironmentMode { - // (undocumented) - dev: boolean; - // (undocumented) - name: 'development' | 'production'; - // (undocumented) - prod: boolean; + // (undocumented) + dev: boolean; + // (undocumented) + name: 'development' | 'production'; + // (undocumented) + prod: boolean; } // @public export interface ErrorToastOptions { - title: string; - toastMessage?: string; + title: string; + toastMessage?: string; } // @public export interface FatalErrorInfo { - // (undocumented) - message: string; - // (undocumented) - stack: string | undefined; + // (undocumented) + message: string; + // (undocumented) + stack: string | undefined; } // @public export interface FatalErrorsSetup { - add: (error: string | Error, source?: string) => never; - get$: () => Rx.Observable; + add: (error: string | Error, source?: string) => never; + get$: () => Rx.Observable; } // @public -export type HandlerContextType> = T extends HandlerFunction - ? U - : never; +export type HandlerContextType> = T extends HandlerFunction ? U : never; // @public export type HandlerFunction = (context: T, ...args: any[]) => any; // @public -export type HandlerParameters> = T extends ( - context: any, - ...args: infer U -) => any - ? U - : never; +export type HandlerParameters> = T extends (context: any, ...args: infer U) => any ? U : never; // @public (undocumented) export interface HttpErrorRequest { - // (undocumented) - error: Error; - // (undocumented) - request: Request; + // (undocumented) + error: Error; + // (undocumented) + request: Request; } // @public (undocumented) export interface HttpErrorResponse extends IHttpResponse { - // (undocumented) - error: Error | IHttpFetchError; + // (undocumented) + error: Error | IHttpFetchError; } // @public export interface HttpFetchOptions extends HttpRequestInit { - asResponse?: boolean; - headers?: HttpHeadersInit; - prependBasePath?: boolean; - query?: HttpFetchQuery; + asResponse?: boolean; + headers?: HttpHeadersInit; + prependBasePath?: boolean; + query?: HttpFetchQuery; } // @public (undocumented) export interface HttpFetchQuery { - // (undocumented) - [key: string]: string | number | boolean | undefined; + // (undocumented) + [key: string]: string | number | boolean | undefined; } // @public export interface HttpHandler { - // (undocumented) - ( - path: string, - options: HttpFetchOptions & { - asResponse: true; - } - ): Promise>; - // (undocumented) - (path: string, options?: HttpFetchOptions): Promise; + // (undocumented) + (path: string, options: HttpFetchOptions & { + asResponse: true; + }): Promise>; + // (undocumented) + (path: string, options?: HttpFetchOptions): Promise; } // @public (undocumented) export interface HttpHeadersInit { - // (undocumented) - [name: string]: any; + // (undocumented) + [name: string]: any; } // @public export interface HttpInterceptor { - request?( - request: Request, - controller: IHttpInterceptController - ): Promise | Request | void; - requestError?( - httpErrorRequest: HttpErrorRequest, - controller: IHttpInterceptController - ): Promise | Request | void; - response?( - httpResponse: IHttpResponse, - controller: IHttpInterceptController - ): Promise | IHttpResponseInterceptorOverrides | void; - responseError?( - httpErrorResponse: HttpErrorResponse, - controller: IHttpInterceptController - ): Promise | IHttpResponseInterceptorOverrides | void; + request?(request: Request, controller: IHttpInterceptController): Promise | Request | void; + requestError?(httpErrorRequest: HttpErrorRequest, controller: IHttpInterceptController): Promise | Request | void; + response?(httpResponse: IHttpResponse, controller: IHttpInterceptController): Promise | IHttpResponseInterceptorOverrides | void; + responseError?(httpErrorResponse: HttpErrorResponse, controller: IHttpInterceptController): Promise | IHttpResponseInterceptorOverrides | void; } // @public export interface HttpRequestInit { - body?: BodyInit | null; - cache?: RequestCache; - credentials?: RequestCredentials; - // (undocumented) - headers?: HttpHeadersInit; - integrity?: string; - keepalive?: boolean; - method?: string; - mode?: RequestMode; - redirect?: RequestRedirect; - referrer?: string; - referrerPolicy?: ReferrerPolicy; - signal?: AbortSignal | null; - window?: null; + body?: BodyInit | null; + cache?: RequestCache; + credentials?: RequestCredentials; + // (undocumented) + headers?: HttpHeadersInit; + integrity?: string; + keepalive?: boolean; + method?: string; + mode?: RequestMode; + redirect?: RequestRedirect; + referrer?: string; + referrerPolicy?: ReferrerPolicy; + signal?: AbortSignal | null; + window?: null; } // @public (undocumented) export interface HttpSetup { - addLoadingCountSource(countSource$: Observable): void; - anonymousPaths: IAnonymousPaths; - basePath: IBasePath; - delete: HttpHandler; - fetch: HttpHandler; - get: HttpHandler; - getLoadingCount$(): Observable; - head: HttpHandler; - intercept(interceptor: HttpInterceptor): () => void; - options: HttpHandler; - patch: HttpHandler; - post: HttpHandler; - put: HttpHandler; + addLoadingCountSource(countSource$: Observable): void; + anonymousPaths: IAnonymousPaths; + basePath: IBasePath; + delete: HttpHandler; + fetch: HttpHandler; + get: HttpHandler; + getLoadingCount$(): Observable; + head: HttpHandler; + intercept(interceptor: HttpInterceptor): () => void; + options: HttpHandler; + patch: HttpHandler; + post: HttpHandler; + put: HttpHandler; } // @public @@ -679,144 +643,128 @@ export type HttpStart = HttpSetup; // @public export interface I18nStart { - Context: ({ children }: { children: React.ReactNode }) => JSX.Element; + Context: ({ children }: { + children: React.ReactNode; + }) => JSX.Element; } // Warning: (ae-missing-release-tag) "IAnonymousPaths" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public export interface IAnonymousPaths { - isAnonymous(path: string): boolean; - register(path: string): void; + isAnonymous(path: string): boolean; + register(path: string): void; } // @public export interface IBasePath { - get: () => string; - prepend: (url: string) => string; - remove: (url: string) => string; + get: () => string; + prepend: (url: string) => string; + remove: (url: string) => string; } // @public export interface IContextContainer> { - createHandler( - pluginOpaqueId: PluginOpaqueId, - handler: THandler - ): (...rest: HandlerParameters) => ShallowPromise>; - registerContext>( - pluginOpaqueId: PluginOpaqueId, - contextName: TContextName, - provider: IContextProvider - ): this; -} - -// @public -export type IContextProvider< - THandler extends HandlerFunction, - TContextName extends keyof HandlerContextType -> = ( - context: Partial>, - ...rest: HandlerParameters -) => - | Promise[TContextName]> - | HandlerContextType[TContextName]; + createHandler(pluginOpaqueId: PluginOpaqueId, handler: THandler): (...rest: HandlerParameters) => ShallowPromise>; + registerContext>(pluginOpaqueId: PluginOpaqueId, contextName: TContextName, provider: IContextProvider): this; +} + +// @public +export type IContextProvider, TContextName extends keyof HandlerContextType> = (context: Partial>, ...rest: HandlerParameters) => Promise[TContextName]> | HandlerContextType[TContextName]; // @public (undocumented) export interface IHttpFetchError extends Error { - // (undocumented) - readonly body?: any; - // @deprecated (undocumented) - readonly req: Request; - // (undocumented) - readonly request: Request; - // @deprecated (undocumented) - readonly res?: Response; - // (undocumented) - readonly response?: Response; + // (undocumented) + readonly body?: any; + // @deprecated (undocumented) + readonly req: Request; + // (undocumented) + readonly request: Request; + // @deprecated (undocumented) + readonly res?: Response; + // (undocumented) + readonly response?: Response; } // @public export interface IHttpInterceptController { - halt(): void; - halted: boolean; + halt(): void; + halted: boolean; } // @public (undocumented) export interface IHttpResponse { - readonly body?: TResponseBody; - readonly request: Readonly; - readonly response?: Readonly; + readonly body?: TResponseBody; + readonly request: Readonly; + readonly response?: Readonly; } // @public export interface IHttpResponseInterceptorOverrides { - readonly body?: TResponseBody; - readonly response?: Readonly; + readonly body?: TResponseBody; + readonly response?: Readonly; } // @public -export type IToasts = Pick< - ToastsApi, - 'get$' | 'add' | 'remove' | 'addSuccess' | 'addWarning' | 'addDanger' | 'addError' ->; +export type IToasts = Pick; // @public export interface IUiSettingsClient { - get$: (key: string, defaultOverride?: T) => Observable; - get: (key: string, defaultOverride?: T) => T; - getAll: () => Readonly>; - getSaved$: () => Observable<{ - key: string; - newValue: T; - oldValue: T; - }>; - getUpdate$: () => Observable<{ - key: string; - newValue: T; - oldValue: T; - }>; - getUpdateErrors$: () => Observable; - isCustom: (key: string) => boolean; - isDeclared: (key: string) => boolean; - isDefault: (key: string) => boolean; - isOverridden: (key: string) => boolean; - overrideLocalDefault: (key: string, newDefault: any) => void; - remove: (key: string) => Promise; - set: (key: string, value: any) => Promise; + get$: (key: string, defaultOverride?: T) => Observable; + get: (key: string, defaultOverride?: T) => T; + getAll: () => Readonly>; + getSaved$: () => Observable<{ + key: string; + newValue: T; + oldValue: T; + }>; + getUpdate$: () => Observable<{ + key: string; + newValue: T; + oldValue: T; + }>; + getUpdateErrors$: () => Observable; + isCustom: (key: string) => boolean; + isDeclared: (key: string) => boolean; + isDefault: (key: string) => boolean; + isOverridden: (key: string) => boolean; + overrideLocalDefault: (key: string, newDefault: any) => void; + remove: (key: string) => Promise; + set: (key: string, value: any) => Promise; } // @public @deprecated export interface LegacyCoreSetup extends CoreSetup { - // Warning: (ae-forgotten-export) The symbol "InjectedMetadataSetup" needs to be exported by the entry point index.d.ts - // - // @deprecated (undocumented) - injectedMetadata: InjectedMetadataSetup; + // Warning: (ae-forgotten-export) The symbol "InjectedMetadataSetup" needs to be exported by the entry point index.d.ts + // + // @deprecated (undocumented) + injectedMetadata: InjectedMetadataSetup; } // @public @deprecated export interface LegacyCoreStart extends CoreStart { - // Warning: (ae-forgotten-export) The symbol "InjectedMetadataStart" needs to be exported by the entry point index.d.ts - // - // @deprecated (undocumented) - injectedMetadata: InjectedMetadataStart; + // Warning: (ae-forgotten-export) The symbol "InjectedMetadataStart" needs to be exported by the entry point index.d.ts + // + // @deprecated (undocumented) + injectedMetadata: InjectedMetadataStart; } // @public (undocumented) export interface LegacyNavLink { - // (undocumented) - category?: AppCategory; - // (undocumented) - euiIconType?: string; - // (undocumented) - icon?: string; - // (undocumented) - id: string; - // (undocumented) - order: number; - // (undocumented) - title: string; - // (undocumented) - url: string; + // (undocumented) + category?: AppCategory; + // (undocumented) + euiIconType?: string; + // (undocumented) + icon?: string; + // (undocumented) + id: string; + // (undocumented) + order: number; + // (undocumented) + title: string; + // (undocumented) + url: string; } // @public @@ -824,100 +772,90 @@ export type MountPoint = (element: T) => Un // @public (undocumented) export interface NotificationsSetup { - // (undocumented) - toasts: ToastsSetup; + // (undocumented) + toasts: ToastsSetup; } // @public (undocumented) export interface NotificationsStart { - // (undocumented) - toasts: ToastsStart; + // (undocumented) + toasts: ToastsStart; } // @public (undocumented) export interface OverlayBannersStart { - add(mount: MountPoint, priority?: number): string; - // Warning: (ae-forgotten-export) The symbol "OverlayBanner" needs to be exported by the entry point index.d.ts - // - // @internal (undocumented) - get$(): Observable; - // (undocumented) - getComponent(): JSX.Element; - remove(id: string): boolean; - replace(id: string | undefined, mount: MountPoint, priority?: number): string; + add(mount: MountPoint, priority?: number): string; + // Warning: (ae-forgotten-export) The symbol "OverlayBanner" needs to be exported by the entry point index.d.ts + // + // @internal (undocumented) + get$(): Observable; + // (undocumented) + getComponent(): JSX.Element; + remove(id: string): boolean; + replace(id: string | undefined, mount: MountPoint, priority?: number): string; } // @public export interface OverlayRef { - close(): Promise; - onClose: Promise; + close(): Promise; + onClose: Promise; } // @public (undocumented) export interface OverlayStart { - // (undocumented) - banners: OverlayBannersStart; - // (undocumented) - openConfirm: OverlayModalStart['openConfirm']; - // Warning: (ae-forgotten-export) The symbol "OverlayFlyoutStart" needs to be exported by the entry point index.d.ts - // - // (undocumented) - openFlyout: OverlayFlyoutStart['open']; - // Warning: (ae-forgotten-export) The symbol "OverlayModalStart" needs to be exported by the entry point index.d.ts - // - // (undocumented) - openModal: OverlayModalStart['open']; + // (undocumented) + banners: OverlayBannersStart; + // (undocumented) + openConfirm: OverlayModalStart['openConfirm']; + // Warning: (ae-forgotten-export) The symbol "OverlayFlyoutStart" needs to be exported by the entry point index.d.ts + // + // (undocumented) + openFlyout: OverlayFlyoutStart['open']; + // Warning: (ae-forgotten-export) The symbol "OverlayModalStart" needs to be exported by the entry point index.d.ts + // + // (undocumented) + openModal: OverlayModalStart['open']; } // @public (undocumented) export interface PackageInfo { - // (undocumented) - branch: string; - // (undocumented) - buildNum: number; - // (undocumented) - buildSha: string; - // (undocumented) - dist: boolean; - // (undocumented) - version: string; -} - -// @public -export interface Plugin< - TSetup = void, - TStart = void, - TPluginsSetup extends object = object, - TPluginsStart extends object = object -> { - // (undocumented) - setup(core: CoreSetup, plugins: TPluginsSetup): TSetup | Promise; - // (undocumented) - start(core: CoreStart, plugins: TPluginsStart): TStart | Promise; - // (undocumented) - stop?(): void; -} - -// @public -export type PluginInitializer< - TSetup, - TStart, - TPluginsSetup extends object = object, - TPluginsStart extends object = object -> = (core: PluginInitializerContext) => Plugin; + // (undocumented) + branch: string; + // (undocumented) + buildNum: number; + // (undocumented) + buildSha: string; + // (undocumented) + dist: boolean; + // (undocumented) + version: string; +} + +// @public +export interface Plugin { + // (undocumented) + setup(core: CoreSetup, plugins: TPluginsSetup): TSetup | Promise; + // (undocumented) + start(core: CoreStart, plugins: TPluginsStart): TStart | Promise; + // (undocumented) + stop?(): void; +} + +// @public +export type PluginInitializer = (core: PluginInitializerContext) => Plugin; // @public export interface PluginInitializerContext { - // (undocumented) - readonly config: { - get: () => T; - }; - // (undocumented) - readonly env: { - mode: Readonly; - packageInfo: Readonly; - }; - readonly opaqueId: PluginOpaqueId; + // (undocumented) + readonly config: { + get: () => T; + }; + // (undocumented) + readonly env: { + mode: Readonly; + packageInfo: Readonly; + }; + readonly opaqueId: PluginOpaqueId; } // @public (undocumented) @@ -926,32 +864,24 @@ export type PluginOpaqueId = symbol; // Warning: (ae-forgotten-export) The symbol "RecursiveReadonlyArray" needs to be exported by the entry point index.d.ts // // @public (undocumented) -export type RecursiveReadonly = T extends (...args: any[]) => any - ? T - : T extends any[] - ? RecursiveReadonlyArray - : T extends object - ? Readonly< - { - [K in keyof T]: RecursiveReadonly; - } - > - : T; +export type RecursiveReadonly = T extends (...args: any[]) => any ? T : T extends any[] ? RecursiveReadonlyArray : T extends object ? Readonly<{ + [K in keyof T]: RecursiveReadonly; +}> : T; // @public (undocumented) export interface SavedObject { - attributes: T; - // (undocumented) - error?: { - message: string; - statusCode: number; - }; - id: string; - migrationVersion?: SavedObjectsMigrationVersion; - references: SavedObjectReference[]; - type: string; - updated_at?: string; - version?: string; + attributes: T; + // (undocumented) + error?: { + message: string; + statusCode: number; + }; + id: string; + migrationVersion?: SavedObjectsMigrationVersion; + references: SavedObjectReference[]; + type: string; + updated_at?: string; + version?: string; } // @public @@ -959,124 +889,82 @@ export type SavedObjectAttribute = SavedObjectAttributeSingle | SavedObjectAttri // @public export interface SavedObjectAttributes { - // (undocumented) - [key: string]: SavedObjectAttribute; + // (undocumented) + [key: string]: SavedObjectAttribute; } // @public -export type SavedObjectAttributeSingle = - | string - | number - | boolean - | null - | undefined - | SavedObjectAttributes; +export type SavedObjectAttributeSingle = string | number | boolean | null | undefined | SavedObjectAttributes; // @public export interface SavedObjectReference { - // (undocumented) - id: string; - // (undocumented) - name: string; - // (undocumented) - type: string; + // (undocumented) + id: string; + // (undocumented) + name: string; + // (undocumented) + type: string; } // @public (undocumented) export interface SavedObjectsBaseOptions { - namespace?: string; + namespace?: string; } // @public (undocumented) -export interface SavedObjectsBatchResponse< - T extends SavedObjectAttributes = SavedObjectAttributes -> { - // (undocumented) - savedObjects: Array>; +export interface SavedObjectsBatchResponse { + // (undocumented) + savedObjects: Array>; } // @public (undocumented) -export interface SavedObjectsBulkCreateObject< - T extends SavedObjectAttributes = SavedObjectAttributes -> extends SavedObjectsCreateOptions { - // (undocumented) - attributes: T; - // (undocumented) - type: string; +export interface SavedObjectsBulkCreateObject extends SavedObjectsCreateOptions { + // (undocumented) + attributes: T; + // (undocumented) + type: string; } // @public (undocumented) export interface SavedObjectsBulkCreateOptions { - overwrite?: boolean; + overwrite?: boolean; } // @public (undocumented) -export interface SavedObjectsBulkUpdateObject< - T extends SavedObjectAttributes = SavedObjectAttributes -> { - // (undocumented) - attributes: T; - // (undocumented) - id: string; - // (undocumented) - references?: SavedObjectReference[]; - // (undocumented) - type: string; - // (undocumented) - version?: string; +export interface SavedObjectsBulkUpdateObject { + // (undocumented) + attributes: T; + // (undocumented) + id: string; + // (undocumented) + references?: SavedObjectReference[]; + // (undocumented) + type: string; + // (undocumented) + version?: string; } // @public (undocumented) export interface SavedObjectsBulkUpdateOptions { - // (undocumented) - namespace?: string; + // (undocumented) + namespace?: string; } // @public export class SavedObjectsClient { - // @internal - constructor(http: HttpSetup); - bulkCreate: ( - objects?: SavedObjectsBulkCreateObject[], - options?: SavedObjectsBulkCreateOptions - ) => Promise>; - bulkGet: ( - objects?: { - id: string; - type: string; - }[] - ) => Promise>; - bulkUpdate( - objects?: SavedObjectsBulkUpdateObject[] - ): Promise>; - create: ( - type: string, - attributes: T, - options?: SavedObjectsCreateOptions - ) => Promise>; - delete: (type: string, id: string) => Promise<{}>; - find: ( - options: Pick< - SavedObjectsFindOptions, - | 'search' - | 'filter' - | 'type' - | 'page' - | 'perPage' - | 'sortField' - | 'fields' - | 'searchFields' - | 'hasReference' - | 'defaultSearchOperator' - > - ) => Promise>; - get: (type: string, id: string) => Promise>; - update( - type: string, - id: string, - attributes: T, - { version, migrationVersion, references }?: SavedObjectsUpdateOptions - ): Promise>; + // @internal + constructor(http: HttpSetup); + bulkCreate: (objects?: SavedObjectsBulkCreateObject[], options?: SavedObjectsBulkCreateOptions) => Promise>; + bulkGet: (objects?: { + id: string; + type: string; + }[]) => Promise>; + bulkUpdate(objects?: SavedObjectsBulkUpdateObject[]): Promise>; + create: (type: string, attributes: T, options?: SavedObjectsCreateOptions) => Promise>; + delete: (type: string, id: string) => Promise<{}>; + find: (options: Pick) => Promise>; + get: (type: string, id: string) => Promise>; + update(type: string, id: string, attributes: T, { version, migrationVersion, references }?: SavedObjectsUpdateOptions): Promise>; } // @public @@ -1084,216 +972,209 @@ export type SavedObjectsClientContract = PublicMethodsOf; // @public (undocumented) export interface SavedObjectsCreateOptions { - id?: string; - migrationVersion?: SavedObjectsMigrationVersion; - overwrite?: boolean; - // (undocumented) - references?: SavedObjectReference[]; + id?: string; + migrationVersion?: SavedObjectsMigrationVersion; + overwrite?: boolean; + // (undocumented) + references?: SavedObjectReference[]; } // @public (undocumented) export interface SavedObjectsFindOptions extends SavedObjectsBaseOptions { - // (undocumented) - defaultSearchOperator?: 'AND' | 'OR'; - fields?: string[]; - // (undocumented) - filter?: string; - // (undocumented) - hasReference?: { - type: string; - id: string; - }; - // (undocumented) - page?: number; - // (undocumented) - perPage?: number; - search?: string; - searchFields?: string[]; - // (undocumented) - sortField?: string; - // (undocumented) - sortOrder?: string; - // (undocumented) - type: string | string[]; -} - -// @public -export interface SavedObjectsFindResponsePublic< - T extends SavedObjectAttributes = SavedObjectAttributes -> extends SavedObjectsBatchResponse { - // (undocumented) - page: number; - // (undocumented) - perPage: number; - // (undocumented) - total: number; + // (undocumented) + defaultSearchOperator?: 'AND' | 'OR'; + fields?: string[]; + // (undocumented) + filter?: string; + // (undocumented) + hasReference?: { + type: string; + id: string; + }; + // (undocumented) + page?: number; + // (undocumented) + perPage?: number; + search?: string; + searchFields?: string[]; + // (undocumented) + sortField?: string; + // (undocumented) + sortOrder?: string; + // (undocumented) + type: string | string[]; +} + +// @public +export interface SavedObjectsFindResponsePublic extends SavedObjectsBatchResponse { + // (undocumented) + page: number; + // (undocumented) + perPage: number; + // (undocumented) + total: number; } // @public export interface SavedObjectsImportConflictError { - // (undocumented) - type: 'conflict'; + // (undocumented) + type: 'conflict'; } // @public export interface SavedObjectsImportError { - // (undocumented) - error: - | SavedObjectsImportConflictError - | SavedObjectsImportUnsupportedTypeError - | SavedObjectsImportMissingReferencesError - | SavedObjectsImportUnknownError; - // (undocumented) - id: string; - // (undocumented) - title?: string; - // (undocumented) - type: string; + // (undocumented) + error: SavedObjectsImportConflictError | SavedObjectsImportUnsupportedTypeError | SavedObjectsImportMissingReferencesError | SavedObjectsImportUnknownError; + // (undocumented) + id: string; + // (undocumented) + title?: string; + // (undocumented) + type: string; } // @public export interface SavedObjectsImportMissingReferencesError { - // (undocumented) - blocking: Array<{ - type: string; - id: string; - }>; - // (undocumented) - references: Array<{ - type: string; - id: string; - }>; - // (undocumented) - type: 'missing_references'; + // (undocumented) + blocking: Array<{ + type: string; + id: string; + }>; + // (undocumented) + references: Array<{ + type: string; + id: string; + }>; + // (undocumented) + type: 'missing_references'; } // @public export interface SavedObjectsImportResponse { - // (undocumented) - errors?: SavedObjectsImportError[]; - // (undocumented) - success: boolean; - // (undocumented) - successCount: number; + // (undocumented) + errors?: SavedObjectsImportError[]; + // (undocumented) + success: boolean; + // (undocumented) + successCount: number; } // @public export interface SavedObjectsImportRetry { - // (undocumented) - id: string; - // (undocumented) - overwrite: boolean; - // (undocumented) - replaceReferences: Array<{ + // (undocumented) + id: string; + // (undocumented) + overwrite: boolean; + // (undocumented) + replaceReferences: Array<{ + type: string; + from: string; + to: string; + }>; + // (undocumented) type: string; - from: string; - to: string; - }>; - // (undocumented) - type: string; } // @public export interface SavedObjectsImportUnknownError { - // (undocumented) - message: string; - // (undocumented) - statusCode: number; - // (undocumented) - type: 'unknown'; + // (undocumented) + message: string; + // (undocumented) + statusCode: number; + // (undocumented) + type: 'unknown'; } // @public export interface SavedObjectsImportUnsupportedTypeError { - // (undocumented) - type: 'unsupported_type'; + // (undocumented) + type: 'unsupported_type'; } // @public export interface SavedObjectsMigrationVersion { - // (undocumented) - [pluginName: string]: string; + // (undocumented) + [pluginName: string]: string; } // @public (undocumented) export interface SavedObjectsStart { - // (undocumented) - client: SavedObjectsClientContract; + // (undocumented) + client: SavedObjectsClientContract; } // @public (undocumented) export interface SavedObjectsUpdateOptions { - migrationVersion?: SavedObjectsMigrationVersion; - // (undocumented) - references?: SavedObjectReference[]; - // (undocumented) - version?: string; + migrationVersion?: SavedObjectsMigrationVersion; + // (undocumented) + references?: SavedObjectReference[]; + // (undocumented) + version?: string; } // @public export class SimpleSavedObject { - constructor( - client: SavedObjectsClient, - { id, type, version, attributes, error, references, migrationVersion }: SavedObject - ); - // (undocumented) - attributes: T; - // (undocumented) - delete(): Promise<{}>; - // (undocumented) - error: SavedObject['error']; - // (undocumented) - get(key: string): any; - // (undocumented) - has(key: string): boolean; - // (undocumented) - id: SavedObject['id']; - // (undocumented) - migrationVersion: SavedObject['migrationVersion']; - // (undocumented) - references: SavedObject['references']; - // (undocumented) - save(): Promise>; - // (undocumented) - set(key: string, value: any): T; - // (undocumented) - type: SavedObject['type']; - // (undocumented) - _version?: SavedObject['version']; + constructor(client: SavedObjectsClient, { id, type, version, attributes, error, references, migrationVersion }: SavedObject); + // (undocumented) + attributes: T; + // (undocumented) + delete(): Promise<{}>; + // (undocumented) + error: SavedObject['error']; + // (undocumented) + get(key: string): any; + // (undocumented) + has(key: string): boolean; + // (undocumented) + id: SavedObject['id']; + // (undocumented) + migrationVersion: SavedObject['migrationVersion']; + // (undocumented) + references: SavedObject['references']; + // (undocumented) + save(): Promise>; + // (undocumented) + set(key: string, value: any): T; + // (undocumented) + type: SavedObject['type']; + // (undocumented) + _version?: SavedObject['version']; } // Warning: (ae-missing-release-tag) "Toast" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) export type Toast = ToastInputFields & { - id: string; + id: string; }; // @public export type ToastInput = string | ToastInputFields; // @public -export type ToastInputFields = Pick< - EuiGlobalToastListToast, - Exclude -> & { - title?: string | MountPoint; - text?: string | MountPoint; +export type ToastInputFields = Pick> & { + title?: string | MountPoint; + text?: string | MountPoint; }; // @public export class ToastsApi implements IToasts { - constructor(deps: { uiSettings: IUiSettingsClient }); - add(toastOrTitle: ToastInput): Toast; - addDanger(toastOrTitle: ToastInput): Toast; - addError(error: Error, options: ErrorToastOptions): Toast; - addSuccess(toastOrTitle: ToastInput): Toast; - addWarning(toastOrTitle: ToastInput): Toast; - get$(): Rx.Observable; - remove(toastOrId: Toast | string): void; - // @internal (undocumented) - start({ overlays, i18n }: { overlays: OverlayStart; i18n: I18nStart }): void; -} + constructor(deps: { + uiSettings: IUiSettingsClient; + }); + add(toastOrTitle: ToastInput): Toast; + addDanger(toastOrTitle: ToastInput): Toast; + addError(error: Error, options: ErrorToastOptions): Toast; + addSuccess(toastOrTitle: ToastInput): Toast; + addWarning(toastOrTitle: ToastInput): Toast; + get$(): Rx.Observable; + remove(toastOrId: Toast | string): void; + // @internal (undocumented) + start({ overlays, i18n }: { + overlays: OverlayStart; + i18n: I18nStart; + }): void; + } // @public (undocumented) export type ToastsSetup = IToasts; @@ -1303,10 +1184,12 @@ export type ToastsStart = IToasts; // @public (undocumented) export interface UiSettingsState { - // (undocumented) - [key: string]: UiSettingsParams_2 & UserProvidedValues_2; + // (undocumented) + [key: string]: UiSettingsParams_2 & UserProvidedValues_2; } // @public export type UnmountCallback = () => void; + + ``` diff --git a/src/core/types/app_categories.ts b/src/core/types/app_categories.ts index 4b5e0f27ef8ac..6e46a778c3625 100644 --- a/src/core/types/app_categories.ts +++ b/src/core/types/app_categories.ts @@ -17,6 +17,7 @@ * under the License. */ +/** @public */ export enum AppCategory { analyze, observability, diff --git a/src/legacy/core_plugins/kibana/public/management/index.js b/src/legacy/core_plugins/kibana/public/management/index.js index d62770956b88e..664bbe55ef17b 100644 --- a/src/legacy/core_plugins/kibana/public/management/index.js +++ b/src/legacy/core_plugins/kibana/public/management/index.js @@ -175,7 +175,7 @@ FeatureCatalogueRegistryProvider.register(() => { return { id: 'management', title: i18n.translate('kbn.management.managementLabel', { - defaultMessage: 'Management', + defaultMessage: 'Stack Management', }), description: i18n.translate('kbn.management.managementDescription', { defaultMessage: 'Your center console for managing the Elastic Stack.', diff --git a/src/legacy/ui/public/management/breadcrumbs.ts b/src/legacy/ui/public/management/breadcrumbs.ts index fe53bcfde9e1f..f0fac3dfdfd14 100644 --- a/src/legacy/ui/public/management/breadcrumbs.ts +++ b/src/legacy/ui/public/management/breadcrumbs.ts @@ -21,7 +21,7 @@ import { i18n } from '@kbn/i18n'; export const MANAGEMENT_BREADCRUMB = Object.freeze({ text: i18n.translate('common.ui.management.breadcrumb', { - defaultMessage: 'Management', + defaultMessage: 'Stack Management', }), href: '#/management', }); diff --git a/src/plugins/management/public/components/management_sidebar_nav/management_sidebar_nav.tsx b/src/plugins/management/public/components/management_sidebar_nav/management_sidebar_nav.tsx index cb0b82d0f0bde..15b7a4fa4ccbf 100644 --- a/src/plugins/management/public/components/management_sidebar_nav/management_sidebar_nav.tsx +++ b/src/plugins/management/public/components/management_sidebar_nav/management_sidebar_nav.tsx @@ -168,7 +168,7 @@ export class ManagementSidebarNav extends React.Component<

{i18n.translate('management.nav.label', { - defaultMessage: 'Management', + defaultMessage: 'Stack Management', })}

diff --git a/src/plugins/management/public/legacy/sections_register.js b/src/plugins/management/public/legacy/sections_register.js index 63d919377f89e..aae58ba3e4651 100644 --- a/src/plugins/management/public/legacy/sections_register.js +++ b/src/plugins/management/public/legacy/sections_register.js @@ -27,7 +27,7 @@ export class LegacyManagementAdapter { 'management', { display: i18n.translate('management.displayName', { - defaultMessage: 'Management', + defaultMessage: 'Stack Management', }), }, capabilities diff --git a/src/plugins/management/public/management_app.tsx b/src/plugins/management/public/management_app.tsx index f7e8dba4f8210..5cffb48aa545b 100644 --- a/src/plugins/management/public/management_app.tsx +++ b/src/plugins/management/public/management_app.tsx @@ -59,7 +59,7 @@ export class ManagementApp { coreStart.chrome.setBreadcrumbs([ { text: i18n.translate('management.breadcrumb', { - defaultMessage: 'Management', + defaultMessage: 'Stack Management', }), href: '#/management', }, diff --git a/test/plugin_functional/test_suites/core_plugins/application_status.ts b/test/plugin_functional/test_suites/core_plugins/application_status.ts index 703ae30533bae..daee8e3df396e 100644 --- a/test/plugin_functional/test_suites/core_plugins/application_status.ts +++ b/test/plugin_functional/test_suites/core_plugins/application_status.ts @@ -32,6 +32,7 @@ export default function({ getService, getPageObjects }: PluginFunctionalProvider const PageObjects = getPageObjects(['common']); const browser = getService('browser'); const appsMenu = getService('appsMenu'); + const kibanaServer = getService('kibanaServer'); const setAppStatus = async (s: Partial) => { await browser.executeAsync(async (status: Partial, cb: Function) => { @@ -66,6 +67,10 @@ export default function({ getService, getPageObjects }: PluginFunctionalProvider }; describe('application status management', () => { + before(async function() { + await kibanaServer.uiSettings.replace({ pageNavigation: 'individual' }); + }); + beforeEach(async () => { await PageObjects.common.navigateToApp('settings'); }); diff --git a/test/plugin_functional/test_suites/core_plugins/applications.ts b/test/plugin_functional/test_suites/core_plugins/applications.ts index a3c9d9d63e353..73c7ddd0518b8 100644 --- a/test/plugin_functional/test_suites/core_plugins/applications.ts +++ b/test/plugin_functional/test_suites/core_plugins/applications.ts @@ -108,7 +108,7 @@ export default function({ getService, getPageObjects }: PluginFunctionalProvider }); it.skip('can navigate from NP apps to legacy apps', async () => { - await appsMenu.clickLink('Management'); + await appsMenu.clickLink('Stack Management'); await loadingScreenShown(); await testSubjects.existOrFail('managementNav'); }); diff --git a/x-pack/legacy/plugins/lens/index.ts b/x-pack/legacy/plugins/lens/index.ts index 8d3eaf60c7f7b..c4a684381b17c 100644 --- a/x-pack/legacy/plugins/lens/index.ts +++ b/x-pack/legacy/plugins/lens/index.ts @@ -4,8 +4,6 @@ * you may not use this file except in compliance with the Elastic License. */ -// TODO@myasonik Lens needs a category probably - import * as Joi from 'joi'; import { resolve } from 'path'; import { LegacyPluginInitializer } from 'src/legacy/types'; diff --git a/x-pack/test/functional/apps/advanced_settings/feature_controls/advanced_settings_security.ts b/x-pack/test/functional/apps/advanced_settings/feature_controls/advanced_settings_security.ts index 43488de9b36fa..2649c5d26309d 100644 --- a/x-pack/test/functional/apps/advanced_settings/feature_controls/advanced_settings_security.ts +++ b/x-pack/test/functional/apps/advanced_settings/feature_controls/advanced_settings_security.ts @@ -68,7 +68,7 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { it('shows management navlink', async () => { const navLinks = (await appsMenu.readLinks()).map(link => link.text); - expect(navLinks).to.eql(['Management']); + expect(navLinks).to.eql(['Stack Management']); }); it(`allows settings to be changed`, async () => { @@ -124,7 +124,7 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { it('shows Management navlink', async () => { const navLinks = (await appsMenu.readLinks()).map(link => link.text); - expect(navLinks).to.eql(['Management']); + expect(navLinks).to.eql(['Stack Management']); }); it(`does not allow settings to be changed`, async () => { @@ -175,7 +175,7 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { it('shows Management navlink', async () => { const navLinks = (await appsMenu.readLinks()).map(link => link.text); - expect(navLinks).to.eql(['Discover', 'Management']); + expect(navLinks).to.eql(['Discover', 'Stack Management']); }); it(`does not allow navigation to advanced settings; redirects to Kibana home`, async () => { diff --git a/x-pack/test/functional/apps/advanced_settings/feature_controls/advanced_settings_spaces.ts b/x-pack/test/functional/apps/advanced_settings/feature_controls/advanced_settings_spaces.ts index ee58be76928b3..60dbc18d10cc5 100644 --- a/x-pack/test/functional/apps/advanced_settings/feature_controls/advanced_settings_spaces.ts +++ b/x-pack/test/functional/apps/advanced_settings/feature_controls/advanced_settings_spaces.ts @@ -41,7 +41,7 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { basePath: '/s/custom_space', }); const navLinks = (await appsMenu.readLinks()).map(link => link.text); - expect(navLinks).to.contain('Management'); + expect(navLinks).to.contain('Stack Management'); }); it(`allows settings to be changed`, async () => { diff --git a/x-pack/test/functional/apps/dashboard_mode/dashboard_view_mode.js b/x-pack/test/functional/apps/dashboard_mode/dashboard_view_mode.js index 7fab4143e0497..ddd65bf4c651e 100644 --- a/x-pack/test/functional/apps/dashboard_mode/dashboard_view_mode.js +++ b/x-pack/test/functional/apps/dashboard_mode/dashboard_view_mode.js @@ -200,7 +200,7 @@ export default function({ getService, getPageObjects }) { await PageObjects.security.forceLogout(); await PageObjects.security.login('mixeduser', '123456'); - if (await appsMenu.linkExists('Management')) { + if (await appsMenu.linkExists('Stack Management')) { throw new Error('Expected management nav link to not be shown'); } }); @@ -209,7 +209,7 @@ export default function({ getService, getPageObjects }) { await PageObjects.security.forceLogout(); await PageObjects.security.login('mysuperuser', '123456'); - if (!(await appsMenu.linkExists('Management'))) { + if (!(await appsMenu.linkExists('Stack Management'))) { throw new Error('Expected management nav link to be shown'); } }); diff --git a/x-pack/test/functional/apps/graph/feature_controls/graph_security.ts b/x-pack/test/functional/apps/graph/feature_controls/graph_security.ts index a2b062e6ef84f..37de93a0a7e91 100644 --- a/x-pack/test/functional/apps/graph/feature_controls/graph_security.ts +++ b/x-pack/test/functional/apps/graph/feature_controls/graph_security.ts @@ -64,7 +64,7 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { it('shows graph navlink', async () => { const navLinks = await appsMenu.readLinks(); - expect(navLinks.map(link => link.text)).to.eql(['Graph', 'Management']); + expect(navLinks.map(link => link.text)).to.eql(['Graph', 'Stack Management']); }); it('landing page shows "Create new graph" button', async () => { @@ -127,7 +127,7 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { it('shows graph navlink', async () => { const navLinks = (await appsMenu.readLinks()).map(link => link.text); - expect(navLinks).to.eql(['Graph', 'Management']); + expect(navLinks).to.eql(['Graph', 'Stack Management']); }); it('does not show a "Create new Workspace" button', async () => { diff --git a/x-pack/test/functional/apps/index_patterns/feature_controls/index_patterns_security.ts b/x-pack/test/functional/apps/index_patterns/feature_controls/index_patterns_security.ts index f84a085ba694f..ed25816e68712 100644 --- a/x-pack/test/functional/apps/index_patterns/feature_controls/index_patterns_security.ts +++ b/x-pack/test/functional/apps/index_patterns/feature_controls/index_patterns_security.ts @@ -70,7 +70,7 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { it('shows management navlink', async () => { const navLinks = (await appsMenu.readLinks()).map(link => link.text); - expect(navLinks).to.eql(['Management']); + expect(navLinks).to.eql(['Stack Management']); }); it(`index pattern listing shows create button`, async () => { @@ -124,7 +124,7 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { it('shows management navlink', async () => { const navLinks = (await appsMenu.readLinks()).map(link => link.text); - expect(navLinks).to.eql(['Management']); + expect(navLinks).to.eql(['Stack Management']); }); it(`index pattern listing doesn't show create button`, async () => { @@ -176,7 +176,7 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { it('shows Management navlink', async () => { const navLinks = (await appsMenu.readLinks()).map(link => link.text); - expect(navLinks).to.eql(['Discover', 'Management']); + expect(navLinks).to.eql(['Discover', 'Stack Management']); }); it(`doesn't show Index Patterns in management side-nav`, async () => { diff --git a/x-pack/test/functional/apps/index_patterns/feature_controls/index_patterns_spaces.ts b/x-pack/test/functional/apps/index_patterns/feature_controls/index_patterns_spaces.ts index 6a2b77de17f45..7fb2ce710d729 100644 --- a/x-pack/test/functional/apps/index_patterns/feature_controls/index_patterns_spaces.ts +++ b/x-pack/test/functional/apps/index_patterns/feature_controls/index_patterns_spaces.ts @@ -41,7 +41,7 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { basePath: '/s/custom_space', }); const navLinks = (await appsMenu.readLinks()).map(link => link.text); - expect(navLinks).to.contain('Management'); + expect(navLinks).to.contain('Stack Management'); }); it(`index pattern listing shows create button`, async () => { diff --git a/x-pack/test/functional/apps/spaces/feature_controls/spaces_security.ts b/x-pack/test/functional/apps/spaces/feature_controls/spaces_security.ts index 1e79c76bf83e5..bddad412e15b7 100644 --- a/x-pack/test/functional/apps/spaces/feature_controls/spaces_security.ts +++ b/x-pack/test/functional/apps/spaces/feature_controls/spaces_security.ts @@ -56,7 +56,7 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { it('shows management navlink', async () => { const navLinks = (await appsMenu.readLinks()).map(link => link.text); - expect(navLinks).to.contain('Management'); + expect(navLinks).to.contain('Stack Management'); }); it(`displays Spaces management section`, async () => { @@ -130,7 +130,7 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { it('shows management navlink', async () => { const navLinks = (await appsMenu.readLinks()).map(link => link.text); - expect(navLinks).to.contain('Management'); + expect(navLinks).to.contain('Stack Management'); }); it(`doesn't display Spaces management section`, async () => { From bed36509dfab40ae45fea00ea4829eb1d8017694 Mon Sep 17 00:00:00 2001 From: Michail Yasonik Date: Mon, 13 Jan 2020 12:52:03 -0500 Subject: [PATCH 16/31] undoing stack management rename in favor of group rename --- src/core/public/chrome/ui/header/header.tsx | 2 +- src/legacy/core_plugins/kibana/index.js | 2 +- src/legacy/core_plugins/kibana/public/management/index.js | 2 +- src/legacy/ui/public/management/breadcrumbs.ts | 2 +- .../management_sidebar_nav/management_sidebar_nav.tsx | 2 +- src/plugins/management/public/legacy/sections_register.js | 2 +- src/plugins/management/public/management_app.tsx | 2 +- test/functional/page_objects/header_page.js | 2 +- .../test_suites/core_plugins/applications.ts | 2 +- .../feature_controls/advanced_settings_security.ts | 6 +++--- .../feature_controls/advanced_settings_spaces.ts | 2 +- .../functional/apps/dashboard_mode/dashboard_view_mode.js | 4 ++-- .../apps/graph/feature_controls/graph_security.ts | 4 ++-- .../feature_controls/index_patterns_security.ts | 6 +++--- .../feature_controls/index_patterns_spaces.ts | 2 +- .../apps/spaces/feature_controls/spaces_security.ts | 4 ++-- 16 files changed, 23 insertions(+), 23 deletions(-) diff --git a/src/core/public/chrome/ui/header/header.tsx b/src/core/public/chrome/ui/header/header.tsx index 470812258b938..7c53e915f5733 100644 --- a/src/core/public/chrome/ui/header/header.tsx +++ b/src/core/public/chrome/ui/header/header.tsx @@ -208,7 +208,7 @@ function getGroupLabel(groupName: AppCategory) { }); case AppCategory.management: return i18n.translate('core.ui.managementNavList.label', { - defaultMessage: 'Management', + defaultMessage: 'Admin', }); default: return groupName; diff --git a/src/legacy/core_plugins/kibana/index.js b/src/legacy/core_plugins/kibana/index.js index eab9dda76857e..a3b91eb410f53 100644 --- a/src/legacy/core_plugins/kibana/index.js +++ b/src/legacy/core_plugins/kibana/index.js @@ -123,7 +123,7 @@ export default function(kibana) { { id: 'kibana:management', title: i18n.translate('kbn.managementTitle', { - defaultMessage: 'Stack Management', + defaultMessage: 'Management', }), order: 9003, url: `${kbnBaseUrl}#/management`, diff --git a/src/legacy/core_plugins/kibana/public/management/index.js b/src/legacy/core_plugins/kibana/public/management/index.js index 664bbe55ef17b..d62770956b88e 100644 --- a/src/legacy/core_plugins/kibana/public/management/index.js +++ b/src/legacy/core_plugins/kibana/public/management/index.js @@ -175,7 +175,7 @@ FeatureCatalogueRegistryProvider.register(() => { return { id: 'management', title: i18n.translate('kbn.management.managementLabel', { - defaultMessage: 'Stack Management', + defaultMessage: 'Management', }), description: i18n.translate('kbn.management.managementDescription', { defaultMessage: 'Your center console for managing the Elastic Stack.', diff --git a/src/legacy/ui/public/management/breadcrumbs.ts b/src/legacy/ui/public/management/breadcrumbs.ts index f0fac3dfdfd14..fe53bcfde9e1f 100644 --- a/src/legacy/ui/public/management/breadcrumbs.ts +++ b/src/legacy/ui/public/management/breadcrumbs.ts @@ -21,7 +21,7 @@ import { i18n } from '@kbn/i18n'; export const MANAGEMENT_BREADCRUMB = Object.freeze({ text: i18n.translate('common.ui.management.breadcrumb', { - defaultMessage: 'Stack Management', + defaultMessage: 'Management', }), href: '#/management', }); diff --git a/src/plugins/management/public/components/management_sidebar_nav/management_sidebar_nav.tsx b/src/plugins/management/public/components/management_sidebar_nav/management_sidebar_nav.tsx index 15b7a4fa4ccbf..cb0b82d0f0bde 100644 --- a/src/plugins/management/public/components/management_sidebar_nav/management_sidebar_nav.tsx +++ b/src/plugins/management/public/components/management_sidebar_nav/management_sidebar_nav.tsx @@ -168,7 +168,7 @@ export class ManagementSidebarNav extends React.Component<

{i18n.translate('management.nav.label', { - defaultMessage: 'Stack Management', + defaultMessage: 'Management', })}

diff --git a/src/plugins/management/public/legacy/sections_register.js b/src/plugins/management/public/legacy/sections_register.js index aae58ba3e4651..63d919377f89e 100644 --- a/src/plugins/management/public/legacy/sections_register.js +++ b/src/plugins/management/public/legacy/sections_register.js @@ -27,7 +27,7 @@ export class LegacyManagementAdapter { 'management', { display: i18n.translate('management.displayName', { - defaultMessage: 'Stack Management', + defaultMessage: 'Management', }), }, capabilities diff --git a/src/plugins/management/public/management_app.tsx b/src/plugins/management/public/management_app.tsx index 5cffb48aa545b..f7e8dba4f8210 100644 --- a/src/plugins/management/public/management_app.tsx +++ b/src/plugins/management/public/management_app.tsx @@ -59,7 +59,7 @@ export class ManagementApp { coreStart.chrome.setBreadcrumbs([ { text: i18n.translate('management.breadcrumb', { - defaultMessage: 'Stack Management', + defaultMessage: 'Management', }), href: '#/management', }, diff --git a/test/functional/page_objects/header_page.js b/test/functional/page_objects/header_page.js index 05edd64545a56..d0a237e8f42d0 100644 --- a/test/functional/page_objects/header_page.js +++ b/test/functional/page_objects/header_page.js @@ -60,7 +60,7 @@ export function HeaderPageProvider({ getService, getPageObjects }) { } async clickStackManagement() { - await appsMenu.clickLink('Stack Management'); + await appsMenu.clickLink('Management'); await this.awaitGlobalLoadingIndicatorHidden(); } diff --git a/test/plugin_functional/test_suites/core_plugins/applications.ts b/test/plugin_functional/test_suites/core_plugins/applications.ts index 73c7ddd0518b8..a3c9d9d63e353 100644 --- a/test/plugin_functional/test_suites/core_plugins/applications.ts +++ b/test/plugin_functional/test_suites/core_plugins/applications.ts @@ -108,7 +108,7 @@ export default function({ getService, getPageObjects }: PluginFunctionalProvider }); it.skip('can navigate from NP apps to legacy apps', async () => { - await appsMenu.clickLink('Stack Management'); + await appsMenu.clickLink('Management'); await loadingScreenShown(); await testSubjects.existOrFail('managementNav'); }); diff --git a/x-pack/test/functional/apps/advanced_settings/feature_controls/advanced_settings_security.ts b/x-pack/test/functional/apps/advanced_settings/feature_controls/advanced_settings_security.ts index 2649c5d26309d..43488de9b36fa 100644 --- a/x-pack/test/functional/apps/advanced_settings/feature_controls/advanced_settings_security.ts +++ b/x-pack/test/functional/apps/advanced_settings/feature_controls/advanced_settings_security.ts @@ -68,7 +68,7 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { it('shows management navlink', async () => { const navLinks = (await appsMenu.readLinks()).map(link => link.text); - expect(navLinks).to.eql(['Stack Management']); + expect(navLinks).to.eql(['Management']); }); it(`allows settings to be changed`, async () => { @@ -124,7 +124,7 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { it('shows Management navlink', async () => { const navLinks = (await appsMenu.readLinks()).map(link => link.text); - expect(navLinks).to.eql(['Stack Management']); + expect(navLinks).to.eql(['Management']); }); it(`does not allow settings to be changed`, async () => { @@ -175,7 +175,7 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { it('shows Management navlink', async () => { const navLinks = (await appsMenu.readLinks()).map(link => link.text); - expect(navLinks).to.eql(['Discover', 'Stack Management']); + expect(navLinks).to.eql(['Discover', 'Management']); }); it(`does not allow navigation to advanced settings; redirects to Kibana home`, async () => { diff --git a/x-pack/test/functional/apps/advanced_settings/feature_controls/advanced_settings_spaces.ts b/x-pack/test/functional/apps/advanced_settings/feature_controls/advanced_settings_spaces.ts index 60dbc18d10cc5..ee58be76928b3 100644 --- a/x-pack/test/functional/apps/advanced_settings/feature_controls/advanced_settings_spaces.ts +++ b/x-pack/test/functional/apps/advanced_settings/feature_controls/advanced_settings_spaces.ts @@ -41,7 +41,7 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { basePath: '/s/custom_space', }); const navLinks = (await appsMenu.readLinks()).map(link => link.text); - expect(navLinks).to.contain('Stack Management'); + expect(navLinks).to.contain('Management'); }); it(`allows settings to be changed`, async () => { diff --git a/x-pack/test/functional/apps/dashboard_mode/dashboard_view_mode.js b/x-pack/test/functional/apps/dashboard_mode/dashboard_view_mode.js index ddd65bf4c651e..7fab4143e0497 100644 --- a/x-pack/test/functional/apps/dashboard_mode/dashboard_view_mode.js +++ b/x-pack/test/functional/apps/dashboard_mode/dashboard_view_mode.js @@ -200,7 +200,7 @@ export default function({ getService, getPageObjects }) { await PageObjects.security.forceLogout(); await PageObjects.security.login('mixeduser', '123456'); - if (await appsMenu.linkExists('Stack Management')) { + if (await appsMenu.linkExists('Management')) { throw new Error('Expected management nav link to not be shown'); } }); @@ -209,7 +209,7 @@ export default function({ getService, getPageObjects }) { await PageObjects.security.forceLogout(); await PageObjects.security.login('mysuperuser', '123456'); - if (!(await appsMenu.linkExists('Stack Management'))) { + if (!(await appsMenu.linkExists('Management'))) { throw new Error('Expected management nav link to be shown'); } }); diff --git a/x-pack/test/functional/apps/graph/feature_controls/graph_security.ts b/x-pack/test/functional/apps/graph/feature_controls/graph_security.ts index 37de93a0a7e91..a2b062e6ef84f 100644 --- a/x-pack/test/functional/apps/graph/feature_controls/graph_security.ts +++ b/x-pack/test/functional/apps/graph/feature_controls/graph_security.ts @@ -64,7 +64,7 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { it('shows graph navlink', async () => { const navLinks = await appsMenu.readLinks(); - expect(navLinks.map(link => link.text)).to.eql(['Graph', 'Stack Management']); + expect(navLinks.map(link => link.text)).to.eql(['Graph', 'Management']); }); it('landing page shows "Create new graph" button', async () => { @@ -127,7 +127,7 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { it('shows graph navlink', async () => { const navLinks = (await appsMenu.readLinks()).map(link => link.text); - expect(navLinks).to.eql(['Graph', 'Stack Management']); + expect(navLinks).to.eql(['Graph', 'Management']); }); it('does not show a "Create new Workspace" button', async () => { diff --git a/x-pack/test/functional/apps/index_patterns/feature_controls/index_patterns_security.ts b/x-pack/test/functional/apps/index_patterns/feature_controls/index_patterns_security.ts index ed25816e68712..f84a085ba694f 100644 --- a/x-pack/test/functional/apps/index_patterns/feature_controls/index_patterns_security.ts +++ b/x-pack/test/functional/apps/index_patterns/feature_controls/index_patterns_security.ts @@ -70,7 +70,7 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { it('shows management navlink', async () => { const navLinks = (await appsMenu.readLinks()).map(link => link.text); - expect(navLinks).to.eql(['Stack Management']); + expect(navLinks).to.eql(['Management']); }); it(`index pattern listing shows create button`, async () => { @@ -124,7 +124,7 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { it('shows management navlink', async () => { const navLinks = (await appsMenu.readLinks()).map(link => link.text); - expect(navLinks).to.eql(['Stack Management']); + expect(navLinks).to.eql(['Management']); }); it(`index pattern listing doesn't show create button`, async () => { @@ -176,7 +176,7 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { it('shows Management navlink', async () => { const navLinks = (await appsMenu.readLinks()).map(link => link.text); - expect(navLinks).to.eql(['Discover', 'Stack Management']); + expect(navLinks).to.eql(['Discover', 'Management']); }); it(`doesn't show Index Patterns in management side-nav`, async () => { diff --git a/x-pack/test/functional/apps/index_patterns/feature_controls/index_patterns_spaces.ts b/x-pack/test/functional/apps/index_patterns/feature_controls/index_patterns_spaces.ts index 7fb2ce710d729..6a2b77de17f45 100644 --- a/x-pack/test/functional/apps/index_patterns/feature_controls/index_patterns_spaces.ts +++ b/x-pack/test/functional/apps/index_patterns/feature_controls/index_patterns_spaces.ts @@ -41,7 +41,7 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { basePath: '/s/custom_space', }); const navLinks = (await appsMenu.readLinks()).map(link => link.text); - expect(navLinks).to.contain('Stack Management'); + expect(navLinks).to.contain('Management'); }); it(`index pattern listing shows create button`, async () => { diff --git a/x-pack/test/functional/apps/spaces/feature_controls/spaces_security.ts b/x-pack/test/functional/apps/spaces/feature_controls/spaces_security.ts index bddad412e15b7..1e79c76bf83e5 100644 --- a/x-pack/test/functional/apps/spaces/feature_controls/spaces_security.ts +++ b/x-pack/test/functional/apps/spaces/feature_controls/spaces_security.ts @@ -56,7 +56,7 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { it('shows management navlink', async () => { const navLinks = (await appsMenu.readLinks()).map(link => link.text); - expect(navLinks).to.contain('Stack Management'); + expect(navLinks).to.contain('Management'); }); it(`displays Spaces management section`, async () => { @@ -130,7 +130,7 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { it('shows management navlink', async () => { const navLinks = (await appsMenu.readLinks()).map(link => link.text); - expect(navLinks).to.contain('Stack Management'); + expect(navLinks).to.contain('Management'); }); it(`doesn't display Spaces management section`, async () => { From 356c5b0a9a9c018b2b9385eeb63f33433b871e60 Mon Sep 17 00:00:00 2001 From: Michail Yasonik Date: Mon, 13 Jan 2020 13:13:51 -0500 Subject: [PATCH 17/31] fixing ML nav placement --- x-pack/legacy/plugins/ml/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x-pack/legacy/plugins/ml/index.ts b/x-pack/legacy/plugins/ml/index.ts index 144ffdc2d74ea..fe8ebe024e3c7 100755 --- a/x-pack/legacy/plugins/ml/index.ts +++ b/x-pack/legacy/plugins/ml/index.ts @@ -42,7 +42,7 @@ export const ml = (kibana: any) => { icon: 'plugins/ml/application/ml.svg', euiIconType: 'machineLearningApp', main: 'plugins/ml/legacy', - category: AppCategory.management, + category: AppCategory.analyze, }, styleSheetPaths: resolve(__dirname, 'public/application/index.scss'), hacks: ['plugins/ml/application/hacks/toggle_app_link_in_nav'], From 7ebb397d443b2121b7a9512803f77e8c889d7b77 Mon Sep 17 00:00:00 2001 From: Michail Yasonik Date: Mon, 13 Jan 2020 23:03:04 -0500 Subject: [PATCH 18/31] pr revisions and test fixes --- src/core/public/application/types.ts | 3 +- src/core/public/chrome/chrome_service.tsx | 5 - src/core/public/chrome/ui/header/header.tsx | 113 +++++++++--------- src/core/public/index.ts | 1 + .../{app_categories.ts => app_category.ts} | 10 +- src/core/types/index.ts | 2 +- src/core/utils/default_app_categories.ts | 47 ++++++++ src/core/utils/index.ts | 1 + src/legacy/core_plugins/kibana/index.js | 12 +- .../kibana/ui_setting_defaults.js | 1 + src/legacy/core_plugins/timelion/index.ts | 4 +- .../ui/ui_nav_links/__tests__/ui_nav_link.js | 1 + .../core_plugins/application_status.ts | 9 +- x-pack/legacy/plugins/apm/index.ts | 4 +- x-pack/legacy/plugins/canvas/index.js | 4 +- x-pack/legacy/plugins/dashboard_mode/index.js | 4 +- x-pack/legacy/plugins/graph/index.ts | 4 +- x-pack/legacy/plugins/infra/index.ts | 6 +- x-pack/legacy/plugins/maps/index.js | 4 +- x-pack/legacy/plugins/ml/index.ts | 4 +- .../legacy/plugins/monitoring/ui_exports.js | 4 +- x-pack/legacy/plugins/siem/index.ts | 4 +- x-pack/legacy/plugins/uptime/index.ts | 4 +- .../advanced_settings_spaces.ts | 5 + .../feature_controls/dashboard_spaces.ts | 14 ++- .../graph/feature_controls/graph_spaces.ts | 7 +- .../feature_controls/infrastructure_spaces.ts | 13 +- .../feature_controls/spaces_security.ts | 4 + .../uptime/feature_controls/uptime_spaces.ts | 7 +- 29 files changed, 196 insertions(+), 105 deletions(-) rename src/core/types/{app_categories.ts => app_category.ts} (87%) create mode 100644 src/core/utils/default_app_categories.ts diff --git a/src/core/public/application/types.ts b/src/core/public/application/types.ts index 61710fb069dd2..48db51e061f56 100644 --- a/src/core/public/application/types.ts +++ b/src/core/public/application/types.ts @@ -31,7 +31,7 @@ import { PluginOpaqueId } from '../plugins'; import { IUiSettingsClient } from '../ui_settings'; import { RecursiveReadonly } from '../../utils'; import { SavedObjectsStart } from '../saved_objects'; -import { AppCategory } from '../'; +import { AppCategory } from '../../types'; /** @public */ export interface AppBase { @@ -47,6 +47,7 @@ export interface AppBase { /** * The category the app lives in + * Default categories defined in {@link DEFAULT_APP_CATEGORIES} */ category?: AppCategory; diff --git a/src/core/public/chrome/chrome_service.tsx b/src/core/public/chrome/chrome_service.tsx index 731af3329ba06..870db92da4845 100644 --- a/src/core/public/chrome/chrome_service.tsx +++ b/src/core/public/chrome/chrome_service.tsx @@ -169,10 +169,6 @@ export class ChromeService { const navSetting = settings?.user?.pageNavigation?.userValue || settings.defaults.pageNavigation.value; - const license = (injectedMetadata.getInjectedVars()?.xpackInitialInfo as { - license: { type: string }; - })?.license?.type; - return { navControls, navLinks, @@ -201,7 +197,6 @@ export class ChromeService { navControlsLeft$={navControls.getLeft$()} navControlsRight$={navControls.getRight$()} navSetting={navSetting} - license={license} /> ), diff --git a/src/core/public/chrome/ui/header/header.tsx b/src/core/public/chrome/ui/header/header.tsx index 7c53e915f5733..231827755fc41 100644 --- a/src/core/public/chrome/ui/header/header.tsx +++ b/src/core/public/chrome/ui/header/header.tsx @@ -48,6 +48,7 @@ import { HeaderBadge } from './header_badge'; import { HeaderBreadcrumbs } from './header_breadcrumbs'; import { HeaderHelpMenu } from './header_help_menu'; import { HeaderNavControls } from './header_nav_controls'; +import { AppCategory } from '../../../../types'; import { ChromeBadge, @@ -59,7 +60,6 @@ import { import { HttpStart } from '../../../http'; import { ChromeHelpExtension } from '../../chrome_service'; import { ApplicationStart, InternalApplicationStart } from '../../../application/types'; -import { AppCategory } from '../../../'; // Providing a buffer between the limit and the cut off index // protects from truncating just the last couple (6) characters @@ -185,36 +185,6 @@ function findClosestAnchor(element: HTMLElement): HTMLAnchorElement | void { } } -function getGroupIcon(groupName: AppCategory) { - switch (groupName) { - case AppCategory.management: - return 'managementApp'; - } -} - -function getGroupLabel(groupName: AppCategory) { - switch (groupName) { - case AppCategory.analyze: - return i18n.translate('core.ui.analyzeNavList.label', { - defaultMessage: 'Analyze', - }); - case AppCategory.observability: - return i18n.translate('core.ui.observabilityNavList.label', { - defaultMessage: 'Observability', - }); - case AppCategory.security: - return i18n.translate('core.ui.securityNavList.label', { - defaultMessage: 'Security', - }); - case AppCategory.management: - return i18n.translate('core.ui.managementNavList.label', { - defaultMessage: 'Admin', - }); - default: - return groupName; - } -} - function truncateRecentItemLabel(label: string): string { if (label.length > TRUNCATE_LIMIT) { label = `${label.substring(0, TRUNCATE_AT)}…`; @@ -246,22 +216,42 @@ interface Props { basePath: HttpStart['basePath']; isLocked?: boolean; navSetting: 'individual' | 'grouped'; - license: string; onIsLockedUpdate?: (isLocked: boolean) => void; } type ExtendedRecentlyAccessedHistoryItem = ReturnType; +type NavLink = ReturnType; interface State { appTitle: string; isVisible: boolean; - navLinks: ReadonlyArray>; + navLinks: NavLink[]; recentlyAccessed: ExtendedRecentlyAccessedHistoryItem[]; forceNavigation: boolean; navControlsLeft: readonly ChromeNavControl[]; navControlsRight: readonly ChromeNavControl[]; } +function getAllCategories(allCategorizedLinks: Record) { + const allCategories = {} as Record; + + for (const [key, value] of Object.entries(allCategorizedLinks)) { + allCategories[key] = value[0].category; + } + + return allCategories; +} + +function getOrderedCategories( + mainCategories: Record, + categoryDictionary: ReturnType +) { + return sortBy( + Object.keys(mainCategories), + categoryName => categoryDictionary[categoryName]?.order + ); +} + class HeaderUI extends Component { private subscription?: Rx.Subscription; private navDrawerRef = createRef(); @@ -394,9 +384,16 @@ class HeaderUI extends Component { } public renderNavLinks() { - const isOSS = this.props.license === 'oss'; const disableGroupedNavSetting = this.props.navSetting === 'individual'; - const showUngroupedNav = isOSS || disableGroupedNavSetting || this.state.navLinks.length < 7; + const groupedNavLinks = groupBy(this.state.navLinks, link => link?.category?.label); + const { undefined: unknowns, ...allCategorizedLinks } = groupedNavLinks; + const { Administration: admin, ...mainCategories } = allCategorizedLinks; + const categoryDictionary = getAllCategories(allCategorizedLinks); + const orderedCategories = getOrderedCategories(mainCategories, categoryDictionary); + const showUngroupedNav = + disableGroupedNavSetting || + this.state.navLinks.length < 7 || + Object.keys(mainCategories).length === 1; if (showUngroupedNav) { return ( @@ -422,11 +419,6 @@ class HeaderUI extends Component { ); } - const { undefined: unknowns, [AppCategory.management]: management, ...mainNav } = groupBy( - this.state.navLinks, - 'category' - ); - return ( { defaultMessage: 'Primary navigation links', })} listItems={[ - ...Object.keys(mainNav).map(categoryName => { - const category = parseInt(categoryName, 10); - const childLinks = mainNav[categoryName]; - if (childLinks.length === 1) { + ...orderedCategories.map(categoryName => { + const category = categoryDictionary[categoryName]!; + const links = mainCategories[categoryName]; + + if (links.length === 1) { return { - ...childLinks[0], - label: getGroupLabel(category), - iconType: getGroupIcon(category), + ...links[0], + label: category.label, + iconType: category.euiIconType || links[0].iconType, }; } return { - label: getGroupLabel(category), - iconType: getGroupIcon(category), + 'data-test-subj': 'navDrawerCategory', + iconType: category.euiIconType, + label: category.label, flyoutMenu: { - title: getGroupLabel(category), - listItems: sortBy(childLinks, 'order'), + title: category.label, + listItems: sortBy(links, 'order').map(link => { + link['data-test-subj'] = 'navDrawerFlyoutLink'; + return link; + }), }, }; }), @@ -472,15 +469,19 @@ class HeaderUI extends Component { { + link['data-test-subj'] = 'navDrawerFlyoutLink'; + return link; + }), }, }, ]} diff --git a/src/core/public/index.ts b/src/core/public/index.ts index 6575395ab30fe..9b006072cffcf 100644 --- a/src/core/public/index.ts +++ b/src/core/public/index.ts @@ -99,6 +99,7 @@ export { AppNavLinkStatus, AppUpdatableFields, AppUpdater, + DEFAULT_APP_CATEGORIES, } from './application'; export { diff --git a/src/core/types/app_categories.ts b/src/core/types/app_category.ts similarity index 87% rename from src/core/types/app_categories.ts rename to src/core/types/app_category.ts index 6e46a778c3625..b6030da811328 100644 --- a/src/core/types/app_categories.ts +++ b/src/core/types/app_category.ts @@ -18,9 +18,9 @@ */ /** @public */ -export enum AppCategory { - analyze, - observability, - security, - management, +export interface AppCategory { + label: string; + ariaLabel?: string; + order?: number; + euiIconType?: string; } diff --git a/src/core/types/index.ts b/src/core/types/index.ts index 8c47e6601cce7..7ddb6b0d8dfbb 100644 --- a/src/core/types/index.ts +++ b/src/core/types/index.ts @@ -23,4 +23,4 @@ */ export * from './core_service'; export * from './capabilities'; -export * from './app_categories'; +export * from './app_category'; diff --git a/src/core/utils/default_app_categories.ts b/src/core/utils/default_app_categories.ts new file mode 100644 index 0000000000000..ca738e297c771 --- /dev/null +++ b/src/core/utils/default_app_categories.ts @@ -0,0 +1,47 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import { i18n } from '@kbn/i18n'; + +export const DEFAULT_APP_CATEGORIES = Object.freeze({ + analyze: { + label: i18n.translate('core.ui.analyzeNavList.label', { + defaultMessage: 'Analyze', + }), + order: 1000, + }, + observability: { + label: i18n.translate('core.ui.observabilityNavList.label', { + defaultMessage: 'Observability', + }), + order: 2000, + }, + security: { + label: i18n.translate('core.ui.securityNavList.label', { + defaultMessage: 'Security', + }), + order: 3000, + }, + administration: { + label: i18n.translate('core.ui.managementNavList.label', { + defaultMessage: 'Administration', + }), + euiIconType: 'managementApp', + }, +}); diff --git a/src/core/utils/index.ts b/src/core/utils/index.ts index 7c8ed481c0a7d..7317c222d3bc3 100644 --- a/src/core/utils/index.ts +++ b/src/core/utils/index.ts @@ -28,3 +28,4 @@ export * from './pick'; export * from './promise'; export * from './url'; export * from './unset'; +export * from './default_app_categories'; diff --git a/src/legacy/core_plugins/kibana/index.js b/src/legacy/core_plugins/kibana/index.js index a3b91eb410f53..87aa20f86878d 100644 --- a/src/legacy/core_plugins/kibana/index.js +++ b/src/legacy/core_plugins/kibana/index.js @@ -34,7 +34,7 @@ import { getUiSettingDefaults } from './ui_setting_defaults'; import { registerCspCollector } from './server/lib/csp_usage_collector'; import { injectVars } from './inject_vars'; import { i18n } from '@kbn/i18n'; -import { AppCategory } from '../../../core/types'; +import { DEFAULT_APP_CATEGORIES } from '../../../../src/core/utils'; const mkdirAsync = promisify(Fs.mkdir); @@ -82,7 +82,7 @@ export default function(kibana) { order: -1003, url: `${kbnBaseUrl}#/discover`, euiIconType: 'discoverApp', - category: AppCategory.analyze, + category: DEFAULT_APP_CATEGORIES.analyze, }, { id: 'kibana:visualize', @@ -92,7 +92,7 @@ export default function(kibana) { order: -1002, url: `${kbnBaseUrl}#/visualize`, euiIconType: 'visualizeApp', - category: AppCategory.analyze, + category: DEFAULT_APP_CATEGORIES.analyze, }, { id: 'kibana:dashboard', @@ -108,7 +108,7 @@ export default function(kibana) { // to determine what url to use for the app link. subUrlBase: `${kbnBaseUrl}#/dashboard`, euiIconType: 'dashboardApp', - category: AppCategory.analyze, + category: DEFAULT_APP_CATEGORIES.analyze, }, { id: 'kibana:dev_tools', @@ -118,7 +118,7 @@ export default function(kibana) { order: 9001, url: '/app/kibana#/dev_tools', euiIconType: 'devToolsApp', - category: AppCategory.management, + category: DEFAULT_APP_CATEGORIES.administration, }, { id: 'kibana:management', @@ -129,7 +129,7 @@ export default function(kibana) { url: `${kbnBaseUrl}#/management`, euiIconType: 'managementApp', linkToLastSubUrl: false, - category: AppCategory.management, + category: DEFAULT_APP_CATEGORIES.administration, }, ], diff --git a/src/legacy/core_plugins/kibana/ui_setting_defaults.js b/src/legacy/core_plugins/kibana/ui_setting_defaults.js index 6df01fc0ac22f..410c2f25c7939 100644 --- a/src/legacy/core_plugins/kibana/ui_setting_defaults.js +++ b/src/legacy/core_plugins/kibana/ui_setting_defaults.js @@ -1182,6 +1182,7 @@ export function getUiSettingDefaults() { defaultMessage: 'Individual', }), }, + requiresPageReload: true, }, }; } diff --git a/src/legacy/core_plugins/timelion/index.ts b/src/legacy/core_plugins/timelion/index.ts index 1bb860ee3f791..d725327e2365b 100644 --- a/src/legacy/core_plugins/timelion/index.ts +++ b/src/legacy/core_plugins/timelion/index.ts @@ -22,9 +22,9 @@ import { i18n } from '@kbn/i18n'; import { Legacy } from 'kibana'; import { LegacyPluginApi, LegacyPluginInitializer } from 'src/legacy/plugin_discovery/types'; import { CoreSetup, PluginInitializerContext } from 'src/core/server'; +import { DEFAULT_APP_CATEGORIES } from '../../../core/utils'; import { plugin } from './server'; import { CustomCoreSetup } from './server/plugin'; -import { AppCategory } from '../../../core/types'; const experimentalLabel = i18n.translate('timelion.uiSettings.experimentalLabel', { defaultMessage: 'experimental', @@ -61,7 +61,7 @@ const timelionPluginInitializer: LegacyPluginInitializer = ({ Plugin }: LegacyPl icon: 'plugins/timelion/icon.svg', euiIconType: 'timelionApp', main: 'plugins/timelion/app', - category: AppCategory.analyze, + category: DEFAULT_APP_CATEGORIES.analyze, }, styleSheetPaths: resolve(__dirname, 'public/index.scss'), hacks: [resolve(__dirname, 'public/legacy')], diff --git a/src/legacy/ui/ui_nav_links/__tests__/ui_nav_link.js b/src/legacy/ui/ui_nav_links/__tests__/ui_nav_link.js index 37e023127ed41..543fe05b13e43 100644 --- a/src/legacy/ui/ui_nav_links/__tests__/ui_nav_link.js +++ b/src/legacy/ui/ui_nav_links/__tests__/ui_nav_link.js @@ -45,6 +45,7 @@ describe('UiNavLink', () => { euiIconType: spec.euiIconType, hidden: spec.hidden, disabled: spec.disabled, + category: undefined, // defaults linkToLastSubUrl: true, diff --git a/test/plugin_functional/test_suites/core_plugins/application_status.ts b/test/plugin_functional/test_suites/core_plugins/application_status.ts index daee8e3df396e..8c4044501d13d 100644 --- a/test/plugin_functional/test_suites/core_plugins/application_status.ts +++ b/test/plugin_functional/test_suites/core_plugins/application_status.ts @@ -29,10 +29,9 @@ import '../../plugins/core_provider_plugin/types'; // eslint-disable-next-line import/no-default-export export default function({ getService, getPageObjects }: PluginFunctionalProviderContext) { - const PageObjects = getPageObjects(['common']); + const PageObjects = getPageObjects(['common', 'settings']); const browser = getService('browser'); const appsMenu = getService('appsMenu'); - const kibanaServer = getService('kibanaServer'); const setAppStatus = async (s: Partial) => { await browser.executeAsync(async (status: Partial, cb: Function) => { @@ -67,8 +66,10 @@ export default function({ getService, getPageObjects }: PluginFunctionalProvider }; describe('application status management', () => { - before(async function() { - await kibanaServer.uiSettings.replace({ pageNavigation: 'individual' }); + before(async () => { + await PageObjects.common.navigateToApp('settings'); + await PageObjects.settings.setAdvancedSettingsSelect('pageNavigation', 'individual'); + await browser.refresh(); }); beforeEach(async () => { diff --git a/x-pack/legacy/plugins/apm/index.ts b/x-pack/legacy/plugins/apm/index.ts index b97ddf9ac4e87..fa22dca58a08b 100644 --- a/x-pack/legacy/plugins/apm/index.ts +++ b/x-pack/legacy/plugins/apm/index.ts @@ -9,7 +9,7 @@ import { Server } from 'hapi'; import { resolve } from 'path'; import { APMPluginContract } from '../../../plugins/apm/server'; import { LegacyPluginInitializer } from '../../../../src/legacy/types'; -import { AppCategory } from '../../../../src/core/types'; +import { DEFAULT_APP_CATEGORIES } from '../../../../src/core/utils'; import mappings from './mappings.json'; import { makeApmUsageCollector } from './server/lib/apm_telemetry'; @@ -29,7 +29,7 @@ export const apm: LegacyPluginInitializer = kibana => { icon: 'plugins/apm/icon.svg', euiIconType: 'apmApp', order: 8100, - category: AppCategory.observability + category: DEFAULT_APP_CATEGORIES.observability }, styleSheetPaths: resolve(__dirname, 'public/index.scss'), home: ['plugins/apm/legacy_register_feature'], diff --git a/x-pack/legacy/plugins/canvas/index.js b/x-pack/legacy/plugins/canvas/index.js index 684570c6f547c..ebd4f35db8175 100644 --- a/x-pack/legacy/plugins/canvas/index.js +++ b/x-pack/legacy/plugins/canvas/index.js @@ -5,7 +5,7 @@ */ import { resolve } from 'path'; -import { AppCategory } from '../../../../src/core/types'; +import { DEFAULT_APP_CATEGORIES } from '../../../../src/core/utils'; import { init } from './init'; import { mappings } from './server/mappings'; import { CANVAS_APP, CANVAS_TYPE, CUSTOM_ELEMENT_TYPE } from './common/lib'; @@ -24,7 +24,7 @@ export function canvas(kibana) { icon: 'plugins/canvas/icon.svg', euiIconType: 'canvasApp', main: 'plugins/canvas/legacy_start', - category: AppCategory.analyze, + category: DEFAULT_APP_CATEGORIES.analyze, }, interpreter: [ 'plugins/canvas/browser_functions', diff --git a/x-pack/legacy/plugins/dashboard_mode/index.js b/x-pack/legacy/plugins/dashboard_mode/index.js index 72a2aab24ee98..94655adf981b4 100644 --- a/x-pack/legacy/plugins/dashboard_mode/index.js +++ b/x-pack/legacy/plugins/dashboard_mode/index.js @@ -6,7 +6,7 @@ import { resolve } from 'path'; import { i18n } from '@kbn/i18n'; -import { AppCategory } from '../../../../src/core/types'; +import { DEFAULT_APP_CATEGORIES } from '../../../../src/core/utils'; import { CONFIG_DASHBOARD_ONLY_MODE_ROLES } from './common'; import { createDashboardModeRequestInterceptor } from './server'; @@ -62,7 +62,7 @@ export function dashboardMode(kibana) { } ), icon: 'plugins/kibana/dashboard/assets/dashboard.svg', - category: AppCategory.analyze, + category: DEFAULT_APP_CATEGORIES.analyze, }, ], }, diff --git a/x-pack/legacy/plugins/graph/index.ts b/x-pack/legacy/plugins/graph/index.ts index c827a70a930c6..f798fa5e9f39d 100644 --- a/x-pack/legacy/plugins/graph/index.ts +++ b/x-pack/legacy/plugins/graph/index.ts @@ -11,7 +11,7 @@ import { i18n } from '@kbn/i18n'; import migrations from './migrations'; import mappings from './mappings.json'; import { LegacyPluginInitializer } from '../../../../src/legacy/plugin_discovery/types'; -import { AppCategory } from '../../../../src/core/types'; +import { DEFAULT_APP_CATEGORIES } from '../../../../src/core/utils'; export const graph: LegacyPluginInitializer = kibana => { return new kibana.Plugin({ @@ -26,7 +26,7 @@ export const graph: LegacyPluginInitializer = kibana => { icon: 'plugins/graph/icon.png', euiIconType: 'graphApp', main: 'plugins/graph/index', - category: AppCategory.analyze, + category: DEFAULT_APP_CATEGORIES.analyze, }, styleSheetPaths: resolve(__dirname, 'public/index.scss'), mappings, diff --git a/x-pack/legacy/plugins/infra/index.ts b/x-pack/legacy/plugins/infra/index.ts index 4021c73e6026d..d9abadcb5125c 100644 --- a/x-pack/legacy/plugins/infra/index.ts +++ b/x-pack/legacy/plugins/infra/index.ts @@ -18,7 +18,7 @@ import { PluginSetupContract as FeaturesPluginSetup } from '../../../plugins/fea import { SpacesPluginSetup } from '../../../plugins/spaces/server'; import { VisTypeTimeseriesSetup } from '../../../../src/plugins/vis_type_timeseries/server'; import { APMPluginContract } from '../../../plugins/apm/server'; -import { AppCategory } from '../../../../src/core/types'; +import { DEFAULT_APP_CATEGORIES } from '../../../../src/core/utils'; export const APP_ID = 'infra'; @@ -56,7 +56,7 @@ export function infra(kibana: any) { defaultMessage: 'Metrics', }), url: `/app/${APP_ID}#/infrastructure`, - category: AppCategory.observability, + category: DEFAULT_APP_CATEGORIES.observability, }, { description: i18n.translate('xpack.infra.linkLogsDescription', { @@ -70,7 +70,7 @@ export function infra(kibana: any) { defaultMessage: 'Logs', }), url: `/app/${APP_ID}#/logs`, - category: AppCategory.observability, + category: DEFAULT_APP_CATEGORIES.observability, }, ], mappings: savedObjectMappings, diff --git a/x-pack/legacy/plugins/maps/index.js b/x-pack/legacy/plugins/maps/index.js index 599fccc3f7f42..f88be46f73f89 100644 --- a/x-pack/legacy/plugins/maps/index.js +++ b/x-pack/legacy/plugins/maps/index.js @@ -13,7 +13,7 @@ import { initTelemetryCollection } from './server/maps_telemetry'; import { getAppTitle } from './common/i18n_getters'; import { MapPlugin } from './server/plugin'; import { APP_ID, APP_ICON, createMapPath, MAP_SAVED_OBJECT_TYPE } from './common/constants'; -import { AppCategory } from '../../../../src/core/types'; +import { DEFAULT_APP_CATEGORIES } from '../../../../src/core/utils'; export function maps(kibana) { return new kibana.Plugin({ @@ -31,7 +31,7 @@ export function maps(kibana) { main: 'plugins/maps/legacy', icon: 'plugins/maps/icon.svg', euiIconType: APP_ICON, - category: AppCategory.analyze, + category: DEFAULT_APP_CATEGORIES.analyze, }, injectDefaultVars(server) { const serverConfig = server.config(); diff --git a/x-pack/legacy/plugins/ml/index.ts b/x-pack/legacy/plugins/ml/index.ts index fe8ebe024e3c7..fc1cec7c16208 100755 --- a/x-pack/legacy/plugins/ml/index.ts +++ b/x-pack/legacy/plugins/ml/index.ts @@ -10,7 +10,7 @@ import KbnServer, { Server } from 'src/legacy/server/kbn_server'; import { UsageCollectionSetup } from 'src/plugins/usage_collection/server'; import { plugin } from './server/new_platform'; import { CloudSetup } from '../../../plugins/cloud/server'; -import { AppCategory } from '../../../../src/core/types'; +import { DEFAULT_APP_CATEGORIES } from '../../../../src/core/utils'; import { MlInitializerContext, MlCoreSetup, @@ -42,7 +42,7 @@ export const ml = (kibana: any) => { icon: 'plugins/ml/application/ml.svg', euiIconType: 'machineLearningApp', main: 'plugins/ml/legacy', - category: AppCategory.analyze, + category: DEFAULT_APP_CATEGORIES.analyze, }, styleSheetPaths: resolve(__dirname, 'public/application/index.scss'), hacks: ['plugins/ml/application/hacks/toggle_app_link_in_nav'], diff --git a/x-pack/legacy/plugins/monitoring/ui_exports.js b/x-pack/legacy/plugins/monitoring/ui_exports.js index 4c1739b5ec56a..d722e7c13fbeb 100644 --- a/x-pack/legacy/plugins/monitoring/ui_exports.js +++ b/x-pack/legacy/plugins/monitoring/ui_exports.js @@ -6,7 +6,7 @@ import { i18n } from '@kbn/i18n'; import { resolve } from 'path'; -import { AppCategory } from '../../../../src/core/types'; +import { DEFAULT_APP_CATEGORIES } from '../../../../src/core/utils'; /** * Configuration of dependency objects for the UI, which are needed for the @@ -27,7 +27,7 @@ export const getUiExports = () => ({ euiIconType: 'monitoringApp', linkToLastSubUrl: false, main: 'plugins/monitoring/monitoring', - category: AppCategory.management, + category: DEFAULT_APP_CATEGORIES.administration, }, injectDefaultVars(server) { const config = server.config(); diff --git a/x-pack/legacy/plugins/siem/index.ts b/x-pack/legacy/plugins/siem/index.ts index f337a8e51fa40..385563f5130e8 100644 --- a/x-pack/legacy/plugins/siem/index.ts +++ b/x-pack/legacy/plugins/siem/index.ts @@ -30,7 +30,7 @@ import { } from './common/constants'; import { defaultIndexPattern } from './default_index_pattern'; import { initServerWithKibana } from './server/kibana.index'; -import { AppCategory } from '../../../../src/core/types'; +import { DEFAULT_APP_CATEGORIES } from '../../../../src/core/utils'; // eslint-disable-next-line @typescript-eslint/no-explicit-any export const siem = (kibana: any) => { @@ -61,7 +61,7 @@ export const siem = (kibana: any) => { order: 9000, title: APP_NAME, url: `/app/${APP_ID}`, - category: AppCategory.security, + category: DEFAULT_APP_CATEGORIES.security, }, ], uiSettingDefaults: { diff --git a/x-pack/legacy/plugins/uptime/index.ts b/x-pack/legacy/plugins/uptime/index.ts index 084f3fe8a2a50..cf7332f97d466 100644 --- a/x-pack/legacy/plugins/uptime/index.ts +++ b/x-pack/legacy/plugins/uptime/index.ts @@ -9,7 +9,7 @@ import { resolve } from 'path'; import { PluginInitializerContext } from 'src/core/server'; import { PLUGIN } from './common/constants'; import { KibanaServer, plugin } from './server'; -import { AppCategory } from '../../../../src/core/types'; +import { DEFAULT_APP_CATEGORIES } from '../../../../src/core/utils'; export const uptime = (kibana: any) => new kibana.Plugin({ @@ -31,7 +31,7 @@ export const uptime = (kibana: any) => main: 'plugins/uptime/app', order: 8900, url: '/app/uptime#/', - category: AppCategory.observability, + category: DEFAULT_APP_CATEGORIES.observability, }, home: ['plugins/uptime/register_feature'], }, diff --git a/x-pack/test/functional/apps/advanced_settings/feature_controls/advanced_settings_spaces.ts b/x-pack/test/functional/apps/advanced_settings/feature_controls/advanced_settings_spaces.ts index ee58be76928b3..76a35b7d0479d 100644 --- a/x-pack/test/functional/apps/advanced_settings/feature_controls/advanced_settings_spaces.ts +++ b/x-pack/test/functional/apps/advanced_settings/feature_controls/advanced_settings_spaces.ts @@ -37,6 +37,11 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { }); it('shows Management navlink', async () => { + await PageObjects.common.navigateToActualUrl('kibana', 'management/kibana/settings', { + basePath: `/s/custom_space`, + ensureCurrentUrl: false, + }); + await PageObjects.settings.setAdvancedSettingsSelect('pageNavigation', 'individual'); await PageObjects.common.navigateToApp('home', { basePath: '/s/custom_space', }); diff --git a/x-pack/test/functional/apps/dashboard/feature_controls/dashboard_spaces.ts b/x-pack/test/functional/apps/dashboard/feature_controls/dashboard_spaces.ts index ebe08a60c2563..b0c07294d6b57 100644 --- a/x-pack/test/functional/apps/dashboard/feature_controls/dashboard_spaces.ts +++ b/x-pack/test/functional/apps/dashboard/feature_controls/dashboard_spaces.ts @@ -13,9 +13,16 @@ import { FtrProviderContext } from '../../../ftr_provider_context'; export default function({ getPageObjects, getService }: FtrProviderContext) { const esArchiver = getService('esArchiver'); const spacesService = getService('spaces'); - const PageObjects = getPageObjects(['common', 'dashboard', 'security', 'spaceSelector']); + const PageObjects = getPageObjects([ + 'common', + 'dashboard', + 'security', + 'spaceSelector', + 'settings', + ]); const appsMenu = getService('appsMenu'); const testSubjects = getService('testSubjects'); + const browser = getService('browser'); describe('spaces', () => { before(async () => { @@ -32,6 +39,11 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { name: 'custom_space', disabledFeatures: [], }); + await PageObjects.common.navigateToActualUrl('kibana', 'management/kibana/settings', { + basePath: `/s/custom_space`, + ensureCurrentUrl: false, + }); + await browser.refresh(); }); after(async () => { diff --git a/x-pack/test/functional/apps/graph/feature_controls/graph_spaces.ts b/x-pack/test/functional/apps/graph/feature_controls/graph_spaces.ts index a0b0d5bef9668..a170a84cc6118 100644 --- a/x-pack/test/functional/apps/graph/feature_controls/graph_spaces.ts +++ b/x-pack/test/functional/apps/graph/feature_controls/graph_spaces.ts @@ -9,7 +9,7 @@ import { FtrProviderContext } from '../../../ftr_provider_context'; export default function({ getPageObjects, getService }: FtrProviderContext) { const esArchiver = getService('esArchiver'); const spacesService = getService('spaces'); - const PageObjects = getPageObjects(['common', 'graph', 'security', 'error']); + const PageObjects = getPageObjects(['common', 'graph', 'security', 'error', 'settings']); const testSubjects = getService('testSubjects'); const appsMenu = getService('appsMenu'); @@ -24,6 +24,11 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { name: 'custom_space', disabledFeatures: [], }); + await PageObjects.common.navigateToActualUrl('kibana', 'management/kibana/settings', { + basePath: `/s/custom_space`, + ensureCurrentUrl: false, + }); + await PageObjects.settings.setAdvancedSettingsSelect('pageNavigation', 'individual'); }); after(async () => { diff --git a/x-pack/test/functional/apps/infra/feature_controls/infrastructure_spaces.ts b/x-pack/test/functional/apps/infra/feature_controls/infrastructure_spaces.ts index 7c2a11a542d66..12a2375dfbc2b 100644 --- a/x-pack/test/functional/apps/infra/feature_controls/infrastructure_spaces.ts +++ b/x-pack/test/functional/apps/infra/feature_controls/infrastructure_spaces.ts @@ -12,7 +12,13 @@ const DATE_WITH_DATA = DATES.metricsAndLogs.hosts.withData; export default function({ getPageObjects, getService }: FtrProviderContext) { const esArchiver = getService('esArchiver'); const spacesService = getService('spaces'); - const PageObjects = getPageObjects(['common', 'infraHome', 'security', 'spaceSelector']); + const PageObjects = getPageObjects([ + 'common', + 'infraHome', + 'security', + 'spaceSelector', + 'settings', + ]); const testSubjects = getService('testSubjects'); const appsMenu = getService('appsMenu'); const retry = getService('retry'); @@ -37,6 +43,11 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { name: 'custom_space', disabledFeatures: [], }); + await PageObjects.common.navigateToActualUrl('kibana', 'management/kibana/settings', { + basePath: `/s/custom_space`, + ensureCurrentUrl: false, + }); + await PageObjects.settings.setAdvancedSettingsSelect('pageNavigation', 'individual'); }); after(async () => { diff --git a/x-pack/test/functional/apps/spaces/feature_controls/spaces_security.ts b/x-pack/test/functional/apps/spaces/feature_controls/spaces_security.ts index 1e79c76bf83e5..1e0ff7c61a466 100644 --- a/x-pack/test/functional/apps/spaces/feature_controls/spaces_security.ts +++ b/x-pack/test/functional/apps/spaces/feature_controls/spaces_security.ts @@ -16,6 +16,10 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { describe('security feature controls', () => { before(async () => { await esArchiver.load('empty_kibana'); + await PageObjects.common.navigateToActualUrl('kibana', 'management/kibana/settings', { + ensureCurrentUrl: false, + }); + await PageObjects.settings.setAdvancedSettingsSelect('pageNavigation', 'individual'); }); after(async () => { diff --git a/x-pack/test/functional/apps/uptime/feature_controls/uptime_spaces.ts b/x-pack/test/functional/apps/uptime/feature_controls/uptime_spaces.ts index 77c5b323340bf..ccf4d65078aa2 100644 --- a/x-pack/test/functional/apps/uptime/feature_controls/uptime_spaces.ts +++ b/x-pack/test/functional/apps/uptime/feature_controls/uptime_spaces.ts @@ -8,7 +8,7 @@ import { FtrProviderContext } from '../../../ftr_provider_context'; export default function({ getPageObjects, getService }: FtrProviderContext) { const spacesService = getService('spaces'); - const PageObjects = getPageObjects(['common', 'error', 'timePicker', 'security']); + const PageObjects = getPageObjects(['common', 'error', 'timePicker', 'security', 'settings']); const testSubjects = getService('testSubjects'); const appsMenu = getService('appsMenu'); @@ -20,6 +20,11 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { name: 'custom_space', disabledFeatures: [], }); + await PageObjects.common.navigateToActualUrl('kibana', 'management/kibana/settings', { + basePath: `/s/custom_space`, + ensureCurrentUrl: false, + }); + await PageObjects.settings.setAdvancedSettingsSelect('pageNavigation', 'individual'); }); after(async () => { From f6664374729c5600321656d90005b1295b0679dc Mon Sep 17 00:00:00 2001 From: Michail Yasonik Date: Tue, 14 Jan 2020 00:14:27 -0500 Subject: [PATCH 19/31] updating types and api docs --- .../kibana-plugin-public.appbase.category.md | 2 +- .../public/kibana-plugin-public.appbase.md | 2 +- ...ana-plugin-public.appcategory.arialabel.md | 11 +++++++ ...a-plugin-public.appcategory.euiicontype.md | 11 +++++++ .../kibana-plugin-public.appcategory.label.md | 11 +++++++ .../kibana-plugin-public.appcategory.md | 16 +++++----- .../kibana-plugin-public.appcategory.order.md | 11 +++++++ .../core/public/kibana-plugin-public.md | 2 +- src/core/public/index.ts | 3 +- src/core/public/public.api.md | 30 +++++++++++++++---- src/core/utils/default_app_categories.ts | 1 + 11 files changed, 82 insertions(+), 18 deletions(-) create mode 100644 docs/development/core/public/kibana-plugin-public.appcategory.arialabel.md create mode 100644 docs/development/core/public/kibana-plugin-public.appcategory.euiicontype.md create mode 100644 docs/development/core/public/kibana-plugin-public.appcategory.label.md create mode 100644 docs/development/core/public/kibana-plugin-public.appcategory.order.md diff --git a/docs/development/core/public/kibana-plugin-public.appbase.category.md b/docs/development/core/public/kibana-plugin-public.appbase.category.md index 36a583693674b..e139ac25d7a1c 100644 --- a/docs/development/core/public/kibana-plugin-public.appbase.category.md +++ b/docs/development/core/public/kibana-plugin-public.appbase.category.md @@ -4,7 +4,7 @@ ## AppBase.category property -The category the app lives in +The category the app lives in Default categories defined in Signature: diff --git a/docs/development/core/public/kibana-plugin-public.appbase.md b/docs/development/core/public/kibana-plugin-public.appbase.md index 388414f167aeb..d162620ccea1e 100644 --- a/docs/development/core/public/kibana-plugin-public.appbase.md +++ b/docs/development/core/public/kibana-plugin-public.appbase.md @@ -16,7 +16,7 @@ export interface AppBase | Property | Type | Description | | --- | --- | --- | | [capabilities](./kibana-plugin-public.appbase.capabilities.md) | Partial<Capabilities> | Custom capabilities defined by the app. | -| [category](./kibana-plugin-public.appbase.category.md) | AppCategory | The category the app lives in | +| [category](./kibana-plugin-public.appbase.category.md) | AppCategory | The category the app lives in Default categories defined in | | [chromeless](./kibana-plugin-public.appbase.chromeless.md) | boolean | Hide the UI chrome when the application is mounted. Defaults to false. Takes precedence over chrome service visibility settings. | | [euiIconType](./kibana-plugin-public.appbase.euiicontype.md) | string | A EUI iconType that will be used for the app's icon. This icon takes precendence over the icon property. | | [icon](./kibana-plugin-public.appbase.icon.md) | string | A URL to an image file used as an icon. Used as a fallback if euiIconType is not provided. | diff --git a/docs/development/core/public/kibana-plugin-public.appcategory.arialabel.md b/docs/development/core/public/kibana-plugin-public.appcategory.arialabel.md new file mode 100644 index 0000000000000..f539bbe54714d --- /dev/null +++ b/docs/development/core/public/kibana-plugin-public.appcategory.arialabel.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-public](./kibana-plugin-public.md) > [AppCategory](./kibana-plugin-public.appcategory.md) > [ariaLabel](./kibana-plugin-public.appcategory.arialabel.md) + +## AppCategory.ariaLabel property + +Signature: + +```typescript +ariaLabel?: string; +``` diff --git a/docs/development/core/public/kibana-plugin-public.appcategory.euiicontype.md b/docs/development/core/public/kibana-plugin-public.appcategory.euiicontype.md new file mode 100644 index 0000000000000..41ade296a8dc3 --- /dev/null +++ b/docs/development/core/public/kibana-plugin-public.appcategory.euiicontype.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-public](./kibana-plugin-public.md) > [AppCategory](./kibana-plugin-public.appcategory.md) > [euiIconType](./kibana-plugin-public.appcategory.euiicontype.md) + +## AppCategory.euiIconType property + +Signature: + +```typescript +euiIconType?: string; +``` diff --git a/docs/development/core/public/kibana-plugin-public.appcategory.label.md b/docs/development/core/public/kibana-plugin-public.appcategory.label.md new file mode 100644 index 0000000000000..af58b6f992085 --- /dev/null +++ b/docs/development/core/public/kibana-plugin-public.appcategory.label.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-public](./kibana-plugin-public.md) > [AppCategory](./kibana-plugin-public.appcategory.md) > [label](./kibana-plugin-public.appcategory.label.md) + +## AppCategory.label property + +Signature: + +```typescript +label: string; +``` diff --git a/docs/development/core/public/kibana-plugin-public.appcategory.md b/docs/development/core/public/kibana-plugin-public.appcategory.md index ab068db595a0a..fa8110f3e880c 100644 --- a/docs/development/core/public/kibana-plugin-public.appcategory.md +++ b/docs/development/core/public/kibana-plugin-public.appcategory.md @@ -2,21 +2,21 @@ [Home](./index.md) > [kibana-plugin-public](./kibana-plugin-public.md) > [AppCategory](./kibana-plugin-public.appcategory.md) -## AppCategory enum +## AppCategory interface Signature: ```typescript -export declare enum AppCategory +export interface AppCategory ``` -## Enumeration Members +## Properties -| Member | Value | Description | +| Property | Type | Description | | --- | --- | --- | -| analyze | 0 | | -| management | 3 | | -| observability | 1 | | -| security | 2 | | +| [ariaLabel](./kibana-plugin-public.appcategory.arialabel.md) | string | | +| [euiIconType](./kibana-plugin-public.appcategory.euiicontype.md) | string | | +| [label](./kibana-plugin-public.appcategory.label.md) | string | | +| [order](./kibana-plugin-public.appcategory.order.md) | number | | diff --git a/docs/development/core/public/kibana-plugin-public.appcategory.order.md b/docs/development/core/public/kibana-plugin-public.appcategory.order.md new file mode 100644 index 0000000000000..fe63d95156b99 --- /dev/null +++ b/docs/development/core/public/kibana-plugin-public.appcategory.order.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-public](./kibana-plugin-public.md) > [AppCategory](./kibana-plugin-public.appcategory.md) > [order](./kibana-plugin-public.appcategory.order.md) + +## AppCategory.order property + +Signature: + +```typescript +order?: number; +``` diff --git a/docs/development/core/public/kibana-plugin-public.md b/docs/development/core/public/kibana-plugin-public.md index ecf03c500fdbb..b59bb3ca948a3 100644 --- a/docs/development/core/public/kibana-plugin-public.md +++ b/docs/development/core/public/kibana-plugin-public.md @@ -22,7 +22,6 @@ The plugin integrates with the core system via lifecycle events: `setup` | Enumeration | Description | | --- | --- | -| [AppCategory](./kibana-plugin-public.appcategory.md) | | | [AppLeaveActionType](./kibana-plugin-public.appleaveactiontype.md) | Possible type of actions on application leave. | | [AppNavLinkStatus](./kibana-plugin-public.appnavlinkstatus.md) | Status of the application's navLink. | | [AppStatus](./kibana-plugin-public.appstatus.md) | Accessibility status of an application. | @@ -33,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) | | | [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) | | diff --git a/src/core/public/index.ts b/src/core/public/index.ts index 9b006072cffcf..4f7485571c758 100644 --- a/src/core/public/index.ts +++ b/src/core/public/index.ts @@ -77,7 +77,7 @@ import { } from './context'; export { CoreContext, CoreSystem } from './core_system'; -export { RecursiveReadonly } from '../utils'; +export { RecursiveReadonly, DEFAULT_APP_CATEGORIES } from '../utils'; export { AppCategory } from '../types'; export { @@ -99,7 +99,6 @@ export { AppNavLinkStatus, AppUpdatableFields, AppUpdater, - DEFAULT_APP_CATEGORIES, } from './application'; export { diff --git a/src/core/public/public.api.md b/src/core/public/public.api.md index cddacb90d27ff..06f1aa7658b9f 100644 --- a/src/core/public/public.api.md +++ b/src/core/public/public.api.md @@ -42,15 +42,15 @@ export interface AppBase { } // @public (undocumented) -export enum AppCategory { +export interface AppCategory { // (undocumented) - analyze = 0, + ariaLabel?: string; // (undocumented) - management = 3, + euiIconType?: string; // (undocumented) - observability = 1, + label: string; // (undocumented) - security = 2 + order?: number; } // @public @@ -421,6 +421,26 @@ export class CoreSystem { stop(): void; } +// @internal (undocumented) +export const DEFAULT_APP_CATEGORIES: Readonly<{ + analyze: { + label: string; + order: number; + }; + observability: { + label: string; + order: number; + }; + security: { + label: string; + order: number; + }; + administration: { + label: string; + euiIconType: string; + }; +}>; + // @public (undocumented) export interface DocLinksStart { // (undocumented) diff --git a/src/core/utils/default_app_categories.ts b/src/core/utils/default_app_categories.ts index ca738e297c771..62799c398cedc 100644 --- a/src/core/utils/default_app_categories.ts +++ b/src/core/utils/default_app_categories.ts @@ -19,6 +19,7 @@ import { i18n } from '@kbn/i18n'; +/** @internal */ export const DEFAULT_APP_CATEGORIES = Object.freeze({ analyze: { label: i18n.translate('core.ui.analyzeNavList.label', { From efbb04e09b47f1773f2664ffe4c7543fe09f311a Mon Sep 17 00:00:00 2001 From: Michail Yasonik Date: Tue, 14 Jan 2020 02:41:10 -0500 Subject: [PATCH 20/31] fixing tests --- .../test_suites/core_plugins/application_status.ts | 1 + .../apps/apm/feature_controls/apm_spaces.ts | 7 ++++++- .../apps/canvas/feature_controls/canvas_spaces.ts | 7 ++++++- .../dashboard/feature_controls/dashboard_spaces.ts | 9 ++++----- .../apps/infra/feature_controls/logs_spaces.ts | 13 ++++++++++++- .../feature_controls/monitoring_spaces.ts | 9 +++++++-- .../apps/spaces/feature_controls/spaces_security.ts | 7 ++++--- 7 files changed, 40 insertions(+), 13 deletions(-) diff --git a/test/plugin_functional/test_suites/core_plugins/application_status.ts b/test/plugin_functional/test_suites/core_plugins/application_status.ts index 8c4044501d13d..d86836feb8859 100644 --- a/test/plugin_functional/test_suites/core_plugins/application_status.ts +++ b/test/plugin_functional/test_suites/core_plugins/application_status.ts @@ -68,6 +68,7 @@ export default function({ getService, getPageObjects }: PluginFunctionalProvider describe('application status management', () => { before(async () => { await PageObjects.common.navigateToApp('settings'); + await PageObjects.settings.clickKibanaSettings(); await PageObjects.settings.setAdvancedSettingsSelect('pageNavigation', 'individual'); await browser.refresh(); }); diff --git a/x-pack/test/functional/apps/apm/feature_controls/apm_spaces.ts b/x-pack/test/functional/apps/apm/feature_controls/apm_spaces.ts index 1ac1784e0e05d..e5b15743d3faa 100644 --- a/x-pack/test/functional/apps/apm/feature_controls/apm_spaces.ts +++ b/x-pack/test/functional/apps/apm/feature_controls/apm_spaces.ts @@ -8,9 +8,10 @@ import { FtrProviderContext } from '../../../ftr_provider_context'; export default function({ getPageObjects, getService }: FtrProviderContext) { const spacesService = getService('spaces'); - const PageObjects = getPageObjects(['common', 'error', 'timePicker', 'security']); + const PageObjects = getPageObjects(['common', 'error', 'timePicker', 'security', 'settings']); const testSubjects = getService('testSubjects'); const appsMenu = getService('appsMenu'); + const browser = getService('browser'); describe('spaces', () => { describe('space with no features disabled', () => { @@ -30,6 +31,10 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { await PageObjects.common.navigateToApp('home', { basePath: '/s/custom_space', }); + await PageObjects.common.navigateToApp('settings'); + await PageObjects.settings.clickKibanaSettings(); + await PageObjects.settings.setAdvancedSettingsSelect('pageNavigation', 'individual'); + await browser.refresh(); const navLinks = (await appsMenu.readLinks()).map(link => link.text); expect(navLinks).to.contain('APM'); }); diff --git a/x-pack/test/functional/apps/canvas/feature_controls/canvas_spaces.ts b/x-pack/test/functional/apps/canvas/feature_controls/canvas_spaces.ts index 28b572401892b..c54f27e976fb2 100644 --- a/x-pack/test/functional/apps/canvas/feature_controls/canvas_spaces.ts +++ b/x-pack/test/functional/apps/canvas/feature_controls/canvas_spaces.ts @@ -9,8 +9,9 @@ import { FtrProviderContext } from '../../../ftr_provider_context'; export default function({ getPageObjects, getService }: FtrProviderContext) { const esArchiver = getService('esArchiver'); const spacesService = getService('spaces'); - const PageObjects = getPageObjects(['common', 'canvas', 'security', 'spaceSelector']); + const PageObjects = getPageObjects(['common', 'canvas', 'security', 'spaceSelector', 'settings']); const appsMenu = getService('appsMenu'); + const browser = getService('browser'); describe('spaces feature controls', function() { this.tags(['skipFirefox']); @@ -40,6 +41,10 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { await PageObjects.common.navigateToApp('home', { basePath: '/s/custom_space', }); + await PageObjects.common.navigateToApp('settings'); + await PageObjects.settings.clickKibanaSettings(); + await PageObjects.settings.setAdvancedSettingsSelect('pageNavigation', 'individual'); + await browser.refresh(); const navLinks = (await appsMenu.readLinks()).map(link => link.text); expect(navLinks).to.contain('Canvas'); }); diff --git a/x-pack/test/functional/apps/dashboard/feature_controls/dashboard_spaces.ts b/x-pack/test/functional/apps/dashboard/feature_controls/dashboard_spaces.ts index b0c07294d6b57..dc894dd8f8e0b 100644 --- a/x-pack/test/functional/apps/dashboard/feature_controls/dashboard_spaces.ts +++ b/x-pack/test/functional/apps/dashboard/feature_controls/dashboard_spaces.ts @@ -39,11 +39,6 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { name: 'custom_space', disabledFeatures: [], }); - await PageObjects.common.navigateToActualUrl('kibana', 'management/kibana/settings', { - basePath: `/s/custom_space`, - ensureCurrentUrl: false, - }); - await browser.refresh(); }); after(async () => { @@ -55,6 +50,10 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { await PageObjects.common.navigateToApp('home', { basePath: '/s/custom_space', }); + await PageObjects.common.navigateToApp('settings'); + await PageObjects.settings.clickKibanaSettings(); + await PageObjects.settings.setAdvancedSettingsSelect('pageNavigation', 'individual'); + await browser.refresh(); const navLinks = (await appsMenu.readLinks()).map(link => link.text); expect(navLinks).to.contain('Dashboard'); }); diff --git a/x-pack/test/functional/apps/infra/feature_controls/logs_spaces.ts b/x-pack/test/functional/apps/infra/feature_controls/logs_spaces.ts index 6b078d2cfa71a..b474c1239543c 100644 --- a/x-pack/test/functional/apps/infra/feature_controls/logs_spaces.ts +++ b/x-pack/test/functional/apps/infra/feature_controls/logs_spaces.ts @@ -9,9 +9,16 @@ import { FtrProviderContext } from '../../../ftr_provider_context'; export default function({ getPageObjects, getService }: FtrProviderContext) { const esArchiver = getService('esArchiver'); const spacesService = getService('spaces'); - const PageObjects = getPageObjects(['common', 'infraHome', 'security', 'spaceSelector']); + const PageObjects = getPageObjects([ + 'common', + 'infraHome', + 'security', + 'spaceSelector', + 'settings', + ]); const testSubjects = getService('testSubjects'); const appsMenu = getService('appsMenu'); + const browser = getService('browser'); describe('logs spaces', () => { describe('space with no features disabled', () => { @@ -36,6 +43,10 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { await PageObjects.common.navigateToApp('home', { basePath: '/s/custom_space', }); + await PageObjects.common.navigateToApp('settings'); + await PageObjects.settings.clickKibanaSettings(); + await PageObjects.settings.setAdvancedSettingsSelect('pageNavigation', 'individual'); + await browser.refresh(); const navLinks = (await appsMenu.readLinks()).map(link => link.text); expect(navLinks).to.contain('Logs'); }); diff --git a/x-pack/test/functional/apps/monitoring/feature_controls/monitoring_spaces.ts b/x-pack/test/functional/apps/monitoring/feature_controls/monitoring_spaces.ts index 7459b53ca4a32..bf58b94c17662 100644 --- a/x-pack/test/functional/apps/monitoring/feature_controls/monitoring_spaces.ts +++ b/x-pack/test/functional/apps/monitoring/feature_controls/monitoring_spaces.ts @@ -9,9 +9,10 @@ import { FtrProviderContext } from '../../../ftr_provider_context'; export default function({ getPageObjects, getService }: FtrProviderContext) { const esArchiver = getService('esArchiver'); const spacesService = getService('spaces'); - const PageObjects = getPageObjects(['common', 'dashboard', 'security', 'error']); + const PageObjects = getPageObjects(['common', 'dashboard', 'security', 'error', 'settings']); const appsMenu = getService('appsMenu'); const find = getService('find'); + const browser = getService('browser'); describe('spaces', () => { before(async () => { @@ -37,10 +38,14 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { await spacesService.delete('custom_space'); }); - it('shows Stack Monitoring navlink', async () => { + it('shows Stack Monitoring navlink fail', async () => { await PageObjects.common.navigateToApp('home', { basePath: '/s/custom_space', }); + await PageObjects.common.navigateToApp('settings'); + await PageObjects.settings.clickKibanaSettings(); + await PageObjects.settings.setAdvancedSettingsSelect('pageNavigation', 'individual'); + await browser.refresh(); const navLinks = (await appsMenu.readLinks()).map(link => link.text); expect(navLinks).to.contain('Stack Monitoring'); }); diff --git a/x-pack/test/functional/apps/spaces/feature_controls/spaces_security.ts b/x-pack/test/functional/apps/spaces/feature_controls/spaces_security.ts index 1e0ff7c61a466..e7cdcac72a358 100644 --- a/x-pack/test/functional/apps/spaces/feature_controls/spaces_security.ts +++ b/x-pack/test/functional/apps/spaces/feature_controls/spaces_security.ts @@ -12,14 +12,15 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { const PageObjects = getPageObjects(['common', 'settings', 'security']); const appsMenu = getService('appsMenu'); const testSubjects = getService('testSubjects'); + const browser = getService('browser'); describe('security feature controls', () => { before(async () => { await esArchiver.load('empty_kibana'); - await PageObjects.common.navigateToActualUrl('kibana', 'management/kibana/settings', { - ensureCurrentUrl: false, - }); + await PageObjects.common.navigateToApp('settings'); + await PageObjects.settings.clickKibanaSettings(); await PageObjects.settings.setAdvancedSettingsSelect('pageNavigation', 'individual'); + await browser.refresh(); }); after(async () => { From 7f3576d1bc770add8d5cc8a38dd396d316d354be Mon Sep 17 00:00:00 2001 From: Michail Yasonik Date: Tue, 14 Jan 2020 04:08:47 -0500 Subject: [PATCH 21/31] fixing more tests --- src/core/public/chrome/chrome_service.tsx | 2 +- .../feature_controls/advanced_settings_spaces.ts | 10 +++++----- .../discover/feature_controls/discover_spaces.ts | 6 ++++++ .../feature_controls/monitoring_security.ts | 8 +++++++- .../timelion/feature_controls/timelion_spaces.ts | 13 ++++++++++++- 5 files changed, 31 insertions(+), 8 deletions(-) diff --git a/src/core/public/chrome/chrome_service.tsx b/src/core/public/chrome/chrome_service.tsx index 870db92da4845..98745272bbf29 100644 --- a/src/core/public/chrome/chrome_service.tsx +++ b/src/core/public/chrome/chrome_service.tsx @@ -167,7 +167,7 @@ export class ChromeService { const settings = injectedMetadata.getLegacyMetadata().uiSettings; const navSetting = - settings?.user?.pageNavigation?.userValue || settings.defaults.pageNavigation.value; + settings?.user?.pageNavigation?.userValue || settings.defaults.pageNavigation?.value; return { navControls, diff --git a/x-pack/test/functional/apps/advanced_settings/feature_controls/advanced_settings_spaces.ts b/x-pack/test/functional/apps/advanced_settings/feature_controls/advanced_settings_spaces.ts index 76a35b7d0479d..60b4918af6348 100644 --- a/x-pack/test/functional/apps/advanced_settings/feature_controls/advanced_settings_spaces.ts +++ b/x-pack/test/functional/apps/advanced_settings/feature_controls/advanced_settings_spaces.ts @@ -12,6 +12,7 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { const PageObjects = getPageObjects(['common', 'settings', 'security', 'spaceSelector']); const testSubjects = getService('testSubjects'); const appsMenu = getService('appsMenu'); + const browser = getService('browser'); describe('spaces feature controls', () => { before(async () => { @@ -37,14 +38,13 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { }); it('shows Management navlink', async () => { - await PageObjects.common.navigateToActualUrl('kibana', 'management/kibana/settings', { - basePath: `/s/custom_space`, - ensureCurrentUrl: false, - }); - await PageObjects.settings.setAdvancedSettingsSelect('pageNavigation', 'individual'); await PageObjects.common.navigateToApp('home', { basePath: '/s/custom_space', }); + await PageObjects.common.navigateToApp('settings'); + await PageObjects.settings.clickKibanaSettings(); + await PageObjects.settings.setAdvancedSettingsSelect('pageNavigation', 'individual'); + await browser.refresh(); const navLinks = (await appsMenu.readLinks()).map(link => link.text); expect(navLinks).to.contain('Management'); }); diff --git a/x-pack/test/functional/apps/discover/feature_controls/discover_spaces.ts b/x-pack/test/functional/apps/discover/feature_controls/discover_spaces.ts index e6b6f28f8b92f..ef724872b264f 100644 --- a/x-pack/test/functional/apps/discover/feature_controls/discover_spaces.ts +++ b/x-pack/test/functional/apps/discover/feature_controls/discover_spaces.ts @@ -15,9 +15,11 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { 'timePicker', 'security', 'spaceSelector', + 'settings', ]); const testSubjects = getService('testSubjects'); const appsMenu = getService('appsMenu'); + const browser = getService('browser'); async function setDiscoverTimeRange() { await PageObjects.timePicker.setDefaultAbsoluteRange(); @@ -49,6 +51,10 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { await PageObjects.common.navigateToApp('home', { basePath: '/s/custom_space', }); + await PageObjects.common.navigateToApp('settings'); + await PageObjects.settings.clickKibanaSettings(); + await PageObjects.settings.setAdvancedSettingsSelect('pageNavigation', 'individual'); + await browser.refresh(); const navLinks = (await appsMenu.readLinks()).map(link => link.text); expect(navLinks).to.contain('Discover'); }); diff --git a/x-pack/test/functional/apps/monitoring/feature_controls/monitoring_security.ts b/x-pack/test/functional/apps/monitoring/feature_controls/monitoring_security.ts index d985da42ab5ed..4826d009771fb 100644 --- a/x-pack/test/functional/apps/monitoring/feature_controls/monitoring_security.ts +++ b/x-pack/test/functional/apps/monitoring/feature_controls/monitoring_security.ts @@ -10,7 +10,8 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { const esArchiver = getService('esArchiver'); const security = getService('security'); const appsMenu = getService('appsMenu'); - const PageObjects = getPageObjects(['common', 'security']); + const PageObjects = getPageObjects(['common', 'security', 'settings']); + const browser = getService('browser'); describe('security', () => { before(async () => { @@ -97,6 +98,11 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { }); it('shows monitoring navlink', async () => { + await PageObjects.common.navigateToApp('settings'); + await PageObjects.settings.clickKibanaSettings(); + await PageObjects.settings.setAdvancedSettingsSelect('pageNavigation', 'individual'); + await browser.refresh(); + const navLinks = (await appsMenu.readLinks()).map(link => link.text); expect(navLinks).to.contain('Stack Monitoring'); }); diff --git a/x-pack/test/functional/apps/timelion/feature_controls/timelion_spaces.ts b/x-pack/test/functional/apps/timelion/feature_controls/timelion_spaces.ts index fb203a23359bd..b04062e9dd6b7 100644 --- a/x-pack/test/functional/apps/timelion/feature_controls/timelion_spaces.ts +++ b/x-pack/test/functional/apps/timelion/feature_controls/timelion_spaces.ts @@ -9,8 +9,15 @@ import { FtrProviderContext } from '../../../ftr_provider_context'; export default function({ getPageObjects, getService }: FtrProviderContext) { const esArchiver = getService('esArchiver'); const spacesService = getService('spaces'); - const PageObjects = getPageObjects(['common', 'timelion', 'security', 'spaceSelector']); + const PageObjects = getPageObjects([ + 'common', + 'timelion', + 'security', + 'spaceSelector', + 'settings', + ]); const appsMenu = getService('appsMenu'); + const browser = getService('browser'); describe('timelion', () => { before(async () => { @@ -38,6 +45,10 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { await PageObjects.common.navigateToApp('home', { basePath: '/s/custom_space', }); + await PageObjects.common.navigateToApp('settings'); + await PageObjects.settings.clickKibanaSettings(); + await PageObjects.settings.setAdvancedSettingsSelect('pageNavigation', 'individual'); + await browser.refresh(); const navLinks = (await appsMenu.readLinks()).map(link => link.text); expect(navLinks).to.contain('Timelion'); }); From cb3b947f4de4f4d04a3e4662cc49e0d8da7a592a Mon Sep 17 00:00:00 2001 From: Michail Yasonik Date: Tue, 14 Jan 2020 06:58:40 -0500 Subject: [PATCH 22/31] fixing more tests --- packages/kbn-i18n/src/loader.ts | 7 +++---- src/core/public/chrome/ui/header/header.tsx | 3 ++- .../feature_controls/index_patterns_spaces.ts | 5 +++++ .../feature_controls/ml_security.ts | 7 ++++++- .../visualize/feature_controls/visualize_spaces.ts | 13 ++++++++++++- 5 files changed, 28 insertions(+), 7 deletions(-) diff --git a/packages/kbn-i18n/src/loader.ts b/packages/kbn-i18n/src/loader.ts index 2d68079735c03..21f540f588f46 100644 --- a/packages/kbn-i18n/src/loader.ts +++ b/packages/kbn-i18n/src/loader.ts @@ -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'; /** @@ -69,7 +67,8 @@ function getLocaleFromFileName(fullFileName: string) { * @returns */ async function loadFile(pathToFile: string): Promise { - 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')); } /** diff --git a/src/core/public/chrome/ui/header/header.tsx b/src/core/public/chrome/ui/header/header.tsx index 231827755fc41..a2de802b34249 100644 --- a/src/core/public/chrome/ui/header/header.tsx +++ b/src/core/public/chrome/ui/header/header.tsx @@ -128,6 +128,7 @@ function euiNavLink( icon, category, order, + tooltip, } = navLink; let href = urlForApp(id); @@ -138,7 +139,7 @@ function euiNavLink( return { category, key: id, - label: title, + label: tooltip ?? title, href, // Use href and onClick to support "open in new tab" and SPA navigation in the same link onClick(event: MouseEvent) { if ( diff --git a/x-pack/test/functional/apps/index_patterns/feature_controls/index_patterns_spaces.ts b/x-pack/test/functional/apps/index_patterns/feature_controls/index_patterns_spaces.ts index 6a2b77de17f45..93b17cf0cefb3 100644 --- a/x-pack/test/functional/apps/index_patterns/feature_controls/index_patterns_spaces.ts +++ b/x-pack/test/functional/apps/index_patterns/feature_controls/index_patterns_spaces.ts @@ -12,6 +12,7 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { const PageObjects = getPageObjects(['common', 'settings', 'security']); const testSubjects = getService('testSubjects'); const appsMenu = getService('appsMenu'); + const browser = getService('browser'); describe('spaces', () => { before(async () => { @@ -40,6 +41,10 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { await PageObjects.common.navigateToApp('home', { basePath: '/s/custom_space', }); + await PageObjects.common.navigateToApp('settings'); + await PageObjects.settings.clickKibanaSettings(); + await PageObjects.settings.setAdvancedSettingsSelect('pageNavigation', 'individual'); + await browser.refresh(); const navLinks = (await appsMenu.readLinks()).map(link => link.text); expect(navLinks).to.contain('Management'); }); diff --git a/x-pack/test/functional/apps/machine_learning/feature_controls/ml_security.ts b/x-pack/test/functional/apps/machine_learning/feature_controls/ml_security.ts index 8fb6f21c778d3..facefd6863137 100644 --- a/x-pack/test/functional/apps/machine_learning/feature_controls/ml_security.ts +++ b/x-pack/test/functional/apps/machine_learning/feature_controls/ml_security.ts @@ -10,7 +10,8 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { const esArchiver = getService('esArchiver'); const security = getService('security'); const appsMenu = getService('appsMenu'); - const PageObjects = getPageObjects(['common', 'security']); + const browser = getService('browser'); + const PageObjects = getPageObjects(['common', 'security', 'settings']); describe('security', () => { before(async () => { @@ -94,6 +95,10 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { }); await PageObjects.security.login('machine_learning_user', 'machine_learning_user-password'); + await PageObjects.common.navigateToApp('settings'); + await PageObjects.settings.clickKibanaSettings(); + await PageObjects.settings.setAdvancedSettingsSelect('pageNavigation', 'individual'); + await browser.refresh(); }); after(async () => { diff --git a/x-pack/test/functional/apps/visualize/feature_controls/visualize_spaces.ts b/x-pack/test/functional/apps/visualize/feature_controls/visualize_spaces.ts index 9193862d2ba9e..111f005410579 100644 --- a/x-pack/test/functional/apps/visualize/feature_controls/visualize_spaces.ts +++ b/x-pack/test/functional/apps/visualize/feature_controls/visualize_spaces.ts @@ -10,9 +10,16 @@ import { FtrProviderContext } from '../../../ftr_provider_context'; export default function({ getPageObjects, getService }: FtrProviderContext) { const esArchiver = getService('esArchiver'); const spacesService = getService('spaces'); - const PageObjects = getPageObjects(['common', 'visualize', 'security', 'spaceSelector']); + const PageObjects = getPageObjects([ + 'common', + 'visualize', + 'security', + 'spaceSelector', + 'settings', + ]); const testSubjects = getService('testSubjects'); const appsMenu = getService('appsMenu'); + const browser = getService('browser'); describe('visualize', () => { before(async () => { @@ -40,6 +47,10 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { await PageObjects.common.navigateToApp('home', { basePath: '/s/custom_space', }); + await PageObjects.common.navigateToApp('settings'); + await PageObjects.settings.clickKibanaSettings(); + await PageObjects.settings.setAdvancedSettingsSelect('pageNavigation', 'individual'); + await browser.refresh(); const navLinks = (await appsMenu.readLinks()).map(link => link.text); expect(navLinks).to.contain('Visualize'); }); From b35266d2ab1b94700f55fee5feaa410fdb92dd16 Mon Sep 17 00:00:00 2001 From: Michail Yasonik Date: Tue, 14 Jan 2020 08:11:48 -0500 Subject: [PATCH 23/31] fixing the last, I hope, test --- .../apps/machine_learning/feature_controls/ml_spaces.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/x-pack/test/functional/apps/machine_learning/feature_controls/ml_spaces.ts b/x-pack/test/functional/apps/machine_learning/feature_controls/ml_spaces.ts index fc94688e98811..139eb9d7e73fd 100644 --- a/x-pack/test/functional/apps/machine_learning/feature_controls/ml_spaces.ts +++ b/x-pack/test/functional/apps/machine_learning/feature_controls/ml_spaces.ts @@ -9,8 +9,9 @@ import { FtrProviderContext } from '../../../ftr_provider_context'; export default function({ getPageObjects, getService }: FtrProviderContext) { const esArchiver = getService('esArchiver'); const spacesService = getService('spaces'); - const PageObjects = getPageObjects(['common', 'dashboard', 'security', 'error']); + const PageObjects = getPageObjects(['common', 'dashboard', 'security', 'error', 'settings']); const appsMenu = getService('appsMenu'); + const browser = getService('browser'); const testSubjects = getService('testSubjects'); describe('spaces', () => { @@ -39,6 +40,10 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { await PageObjects.common.navigateToApp('home', { basePath: '/s/custom_space', }); + await PageObjects.common.navigateToApp('settings'); + await PageObjects.settings.clickKibanaSettings(); + await PageObjects.settings.setAdvancedSettingsSelect('pageNavigation', 'individual'); + await browser.refresh(); const navLinks = (await appsMenu.readLinks()).map(link => link.text); expect(navLinks).to.contain('Machine Learning'); }); From e18acbbd0f637a061689487ca9abec31489819b6 Mon Sep 17 00:00:00 2001 From: Michail Yasonik Date: Tue, 14 Jan 2020 09:22:40 -0500 Subject: [PATCH 24/31] fixing the last test, I hope --- .../dev_tools/feature_controls/dev_tools_spaces.ts | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/x-pack/test/functional/apps/dev_tools/feature_controls/dev_tools_spaces.ts b/x-pack/test/functional/apps/dev_tools/feature_controls/dev_tools_spaces.ts index 4184d223a9686..8d5f455742bab 100644 --- a/x-pack/test/functional/apps/dev_tools/feature_controls/dev_tools_spaces.ts +++ b/x-pack/test/functional/apps/dev_tools/feature_controls/dev_tools_spaces.ts @@ -9,10 +9,17 @@ import { FtrProviderContext } from '../../../ftr_provider_context'; export default function({ getPageObjects, getService }: FtrProviderContext) { const esArchiver = getService('esArchiver'); const spacesService = getService('spaces'); - const PageObjects = getPageObjects(['common', 'dashboard', 'security', 'spaceSelector']); + const PageObjects = getPageObjects([ + 'common', + 'dashboard', + 'security', + 'spaceSelector', + 'settings', + ]); const appsMenu = getService('appsMenu'); const testSubjects = getService('testSubjects'); const grokDebugger = getService('grokDebugger'); + const browser = getService('browser'); describe('spaces', () => { before(async () => { @@ -40,6 +47,10 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { await PageObjects.common.navigateToApp('home', { basePath: '/s/custom_space', }); + await PageObjects.common.navigateToApp('settings'); + await PageObjects.settings.clickKibanaSettings(); + await PageObjects.settings.setAdvancedSettingsSelect('pageNavigation', 'individual'); + await browser.refresh(); const navLinks = (await appsMenu.readLinks()).map(link => link.text); expect(navLinks).to.contain('Dev Tools'); }); From c951a970996fece510c403da1fcbc465d5842d5c Mon Sep 17 00:00:00 2001 From: Michail Yasonik Date: Tue, 14 Jan 2020 10:45:07 -0500 Subject: [PATCH 25/31] improving advanced setting --- src/core/public/chrome/chrome_service.tsx | 11 ++++------- src/core/public/chrome/ui/header/header.tsx | 13 +++++++++---- src/core/public/core_system.ts | 1 + .../core_plugins/kibana/ui_setting_defaults.js | 1 - 4 files changed, 14 insertions(+), 12 deletions(-) diff --git a/src/core/public/chrome/chrome_service.tsx b/src/core/public/chrome/chrome_service.tsx index 72c912bcef511..6ab9fe158742a 100644 --- a/src/core/public/chrome/chrome_service.tsx +++ b/src/core/public/chrome/chrome_service.tsx @@ -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'; @@ -85,6 +85,7 @@ interface StartDeps { http: HttpStart; injectedMetadata: InjectedMetadataStart; notifications: NotificationsStart; + uiSettings: IUiSettingsClient; } /** @internal */ @@ -139,6 +140,7 @@ export class ChromeService { http, injectedMetadata, notifications, + uiSettings, }: StartDeps): Promise { this.initVisibility(application); @@ -164,11 +166,6 @@ export class ChromeService { ); } - const settings = injectedMetadata.getLegacyMetadata().uiSettings; - - const navSetting = - settings?.user?.pageNavigation?.userValue || settings.defaults.pageNavigation?.value; - return { navControls, navLinks, @@ -196,7 +193,7 @@ export class ChromeService { recentlyAccessed$={recentlyAccessed.get$()} navControlsLeft$={navControls.getLeft$()} navControlsRight$={navControls.getRight$()} - navSetting={navSetting} + navSetting$={uiSettings.get$('pageNavigation')} /> ), diff --git a/src/core/public/chrome/ui/header/header.tsx b/src/core/public/chrome/ui/header/header.tsx index 4933ec15d924c..ab8ca21e95e8d 100644 --- a/src/core/public/chrome/ui/header/header.tsx +++ b/src/core/public/chrome/ui/header/header.tsx @@ -195,6 +195,7 @@ function truncateRecentItemLabel(label: string): string { } export type HeaderProps = Pick>; +type navSetting = 'grouped' | 'individual'; interface Props { kibanaVersion: string; @@ -216,7 +217,7 @@ interface Props { intl: InjectedIntl; basePath: HttpStart['basePath']; isLocked?: boolean; - navSetting: 'individual' | 'grouped'; + navSetting$: Rx.Observable; onIsLockedUpdate?: (isLocked: boolean) => void; } @@ -231,6 +232,7 @@ interface State { forceNavigation: boolean; navControlsLeft: readonly ChromeNavControl[]; navControlsRight: readonly ChromeNavControl[]; + navSetting: navSetting; } function getAllCategories(allCategorizedLinks: Record) { @@ -268,6 +270,7 @@ class HeaderUI extends Component { forceNavigation: false, navControlsLeft: [], navControlsRight: [], + navSetting: 'grouped', }; } @@ -282,7 +285,8 @@ class HeaderUI extends Component { Rx.combineLatest( this.props.navControlsLeft$, this.props.navControlsRight$, - this.props.application.currentAppId$ + this.props.application.currentAppId$, + this.props.navSetting$ ) ).subscribe({ next: ([ @@ -291,7 +295,7 @@ class HeaderUI extends Component { forceNavigation, navLinks, recentlyAccessed, - [navControlsLeft, navControlsRight, currentAppId], + [navControlsLeft, navControlsRight, currentAppId, navSetting], ]) => { this.setState({ appTitle, @@ -313,6 +317,7 @@ class HeaderUI extends Component { ), navControlsLeft, navControlsRight, + navSetting, }); }, }); @@ -384,7 +389,7 @@ class HeaderUI extends Component { } public renderNavLinks() { - const disableGroupedNavSetting = this.props.navSetting === 'individual'; + const disableGroupedNavSetting = this.state.navSetting === 'individual'; const groupedNavLinks = groupBy(this.state.navLinks, link => link?.category?.label); const { undefined: unknowns, ...allCategorizedLinks } = groupedNavLinks; const { Administration: admin, ...mainCategories } = allCategorizedLinks; diff --git a/src/core/public/core_system.ts b/src/core/public/core_system.ts index 5b31c740518e4..aabf83ec18468 100644 --- a/src/core/public/core_system.ts +++ b/src/core/public/core_system.ts @@ -245,6 +245,7 @@ export class CoreSystem { http, injectedMetadata, notifications, + uiSettings, }); application.registerMountContext(this.coreContext.coreId, 'core', () => ({ diff --git a/src/legacy/core_plugins/kibana/ui_setting_defaults.js b/src/legacy/core_plugins/kibana/ui_setting_defaults.js index 432c9869f3419..9b848666541ce 100644 --- a/src/legacy/core_plugins/kibana/ui_setting_defaults.js +++ b/src/legacy/core_plugins/kibana/ui_setting_defaults.js @@ -1188,7 +1188,6 @@ export function getUiSettingDefaults() { defaultMessage: 'Individual', }), }, - requiresPageReload: true, }, }; } From e542a0325fb5e567f43cdb21ac4603696a0f1bd2 Mon Sep 17 00:00:00 2001 From: Michail Yasonik Date: Tue, 14 Jan 2020 18:00:18 -0500 Subject: [PATCH 26/31] PR feedback and first attempt at renaming management -> stack management --- src/core/public/application/types.ts | 5 +- src/core/public/chrome/chrome_service.test.ts | 2 + src/core/public/chrome/ui/header/header.tsx | 18 ++-- .../injected_metadata_service.ts | 1 - src/core/types/app_category.ts | 21 +++++ src/core/utils/default_app_categories.ts | 4 +- src/legacy/core_plugins/kibana/index.js | 8 +- .../components/fetch_error/fetch_error.tsx | 2 +- .../home/np_ready/components/home.test.js | 4 +- .../kibana/public/management/index.js | 8 +- src/legacy/core_plugins/management/index.ts | 2 +- .../telemetry/common/constants.ts | 2 +- .../telemetry_management_collector.ts | 4 +- src/legacy/plugin_discovery/types.ts | 2 +- .../ui/public/management/breadcrumbs.ts | 4 +- .../management_sidebar_nav.tsx | 6 +- .../public/legacy/sections_register.js | 4 +- .../management/public/management_app.tsx | 4 +- test/functional/page_objects/header_page.js | 2 +- .../{settings_page.js => settings_page.ts} | 93 +++++++++++-------- .../core_plugins/application_status.ts | 5 +- .../test_suites/core_plugins/applications.ts | 2 +- .../guidance_panel/guidance_panel.tsx | 2 +- .../legacy/plugins/monitoring/ui_exports.js | 2 +- .../advanced_settings_security.ts | 6 +- .../advanced_settings_spaces.ts | 8 +- .../apps/apm/feature_controls/apm_security.ts | 4 +- .../apps/apm/feature_controls/apm_spaces.ts | 6 +- .../feature_controls/canvas_security.ts | 4 +- .../canvas/feature_controls/canvas_spaces.ts | 6 +- .../feature_controls/dashboard_security.ts | 4 +- .../feature_controls/dashboard_spaces.ts | 6 +- .../dashboard_mode/dashboard_view_mode.js | 4 +- .../feature_controls/dev_tools_security.ts | 4 +- .../feature_controls/dev_tools_spaces.ts | 6 +- .../feature_controls/discover_security.ts | 4 +- .../feature_controls/discover_spaces.ts | 6 +- .../graph/feature_controls/graph_security.ts | 4 +- .../graph/feature_controls/graph_spaces.ts | 6 +- .../index_patterns_security.ts | 6 +- .../feature_controls/index_patterns_spaces.ts | 8 +- .../infrastructure_security.ts | 4 +- .../feature_controls/infrastructure_spaces.ts | 7 +- .../infra/feature_controls/logs_security.ts | 4 +- .../infra/feature_controls/logs_spaces.ts | 6 +- .../feature_controls/ml_security.ts | 6 +- .../feature_controls/ml_spaces.ts | 6 +- .../maps/feature_controls/maps_security.ts | 6 +- .../feature_controls/monitoring_security.ts | 7 +- .../feature_controls/monitoring_spaces.ts | 6 +- .../feature_controls/spaces_security.ts | 10 +- .../feature_controls/timelion_security.ts | 4 +- .../feature_controls/timelion_spaces.ts | 6 +- .../feature_controls/uptime_security.ts | 4 +- .../uptime/feature_controls/uptime_spaces.ts | 6 +- .../feature_controls/visualize_security.ts | 4 +- .../feature_controls/visualize_spaces.ts | 6 +- .../common/nav_links_builder.ts | 2 +- .../common/services/ui_capabilities.ts | 2 +- 59 files changed, 179 insertions(+), 216 deletions(-) rename test/functional/page_objects/{settings_page.js => settings_page.ts} (90%) diff --git a/src/core/public/application/types.ts b/src/core/public/application/types.ts index 48db51e061f56..63e542b0127ed 100644 --- a/src/core/public/application/types.ts +++ b/src/core/public/application/types.ts @@ -46,8 +46,9 @@ export interface AppBase { title: string; /** - * The category the app lives in - * Default categories defined in {@link DEFAULT_APP_CATEGORIES} + * The category definition of the product + * See {@link AppCategory} + * See DEFAULT_APP_CATEGORIES for more reference */ category?: AppCategory; diff --git a/src/core/public/chrome/chrome_service.test.ts b/src/core/public/chrome/chrome_service.test.ts index abd04722a49f2..9018b21973634 100644 --- a/src/core/public/chrome/chrome_service.test.ts +++ b/src/core/public/chrome/chrome_service.test.ts @@ -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`; @@ -51,6 +52,7 @@ function defaultStartDeps(availableApps?: App[]) { http: httpServiceMock.createStartContract(), injectedMetadata: injectedMetadataServiceMock.createStartContract(), notifications: notificationServiceMock.createStartContract(), + uiSettings: uiSettingsServiceMock.createStartContract(), }; if (availableApps) { diff --git a/src/core/public/chrome/ui/header/header.tsx b/src/core/public/chrome/ui/header/header.tsx index ab8ca21e95e8d..d2e1734aee7a7 100644 --- a/src/core/public/chrome/ui/header/header.tsx +++ b/src/core/public/chrome/ui/header/header.tsx @@ -195,7 +195,7 @@ function truncateRecentItemLabel(label: string): string { } export type HeaderProps = Pick>; -type navSetting = 'grouped' | 'individual'; +export type NavSetting = 'grouped' | 'individual'; interface Props { kibanaVersion: string; @@ -217,7 +217,7 @@ interface Props { intl: InjectedIntl; basePath: HttpStart['basePath']; isLocked?: boolean; - navSetting$: Rx.Observable; + navSetting$: Rx.Observable; onIsLockedUpdate?: (isLocked: boolean) => void; } @@ -232,7 +232,7 @@ interface State { forceNavigation: boolean; navControlsLeft: readonly ChromeNavControl[]; navControlsRight: readonly ChromeNavControl[]; - navSetting: navSetting; + navSetting: NavSetting; } function getAllCategories(allCategorizedLinks: Record) { @@ -392,7 +392,7 @@ class HeaderUI extends Component { const disableGroupedNavSetting = this.state.navSetting === 'individual'; const groupedNavLinks = groupBy(this.state.navLinks, link => link?.category?.label); const { undefined: unknowns, ...allCategorizedLinks } = groupedNavLinks; - const { Administration: admin, ...mainCategories } = allCategorizedLinks; + const { Management: management, ...mainCategories } = allCategorizedLinks; const categoryDictionary = getAllCategories(allCategorizedLinks); const orderedCategories = getOrderedCategories(mainCategories, categoryDictionary); const showUngroupedNav = @@ -474,16 +474,16 @@ class HeaderUI extends Component { { + title: categoryDictionary.Management!.label, + listItems: sortBy(management, 'order').map(link => { link['data-test-subj'] = 'navDrawerFlyoutLink'; return link; }), diff --git a/src/core/public/injected_metadata/injected_metadata_service.ts b/src/core/public/injected_metadata/injected_metadata_service.ts index bf6093375eac6..1075a7741ee32 100644 --- a/src/core/public/injected_metadata/injected_metadata_service.ts +++ b/src/core/public/injected_metadata/injected_metadata_service.ts @@ -172,7 +172,6 @@ export interface InjectedMetadataSetup { getLegacyMode: () => boolean; getLegacyMetadata: () => { app: unknown; - category?: AppCategory; bundleId: string; nav: LegacyNavLink[]; version: string; diff --git a/src/core/types/app_category.ts b/src/core/types/app_category.ts index b6030da811328..0891fba918ee2 100644 --- a/src/core/types/app_category.ts +++ b/src/core/types/app_category.ts @@ -19,8 +19,29 @@ /** @public */ export interface AppCategory { + /** + * Label used for cateogry name. + * Also used as aria-label if one isn't set. + */ label: string; + + /** + * If the visual label isn't appropriate for screen readers, + * can override it here + */ ariaLabel?: string; + + /** + * 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) + */ order?: number; + + /** + * 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 + */ euiIconType?: string; } diff --git a/src/core/utils/default_app_categories.ts b/src/core/utils/default_app_categories.ts index 62799c398cedc..3e3cc2fef2a22 100644 --- a/src/core/utils/default_app_categories.ts +++ b/src/core/utils/default_app_categories.ts @@ -39,9 +39,9 @@ export const DEFAULT_APP_CATEGORIES = Object.freeze({ }), order: 3000, }, - administration: { + management: { label: i18n.translate('core.ui.managementNavList.label', { - defaultMessage: 'Administration', + defaultMessage: 'Management', }), euiIconType: 'managementApp', }, diff --git a/src/legacy/core_plugins/kibana/index.js b/src/legacy/core_plugins/kibana/index.js index 87aa20f86878d..6c7dbda3c26e1 100644 --- a/src/legacy/core_plugins/kibana/index.js +++ b/src/legacy/core_plugins/kibana/index.js @@ -118,18 +118,18 @@ export default function(kibana) { order: 9001, url: '/app/kibana#/dev_tools', euiIconType: 'devToolsApp', - category: DEFAULT_APP_CATEGORIES.administration, + category: DEFAULT_APP_CATEGORIES.management, }, { - id: 'kibana:management', + id: 'kibana:stack_management', title: i18n.translate('kbn.managementTitle', { - defaultMessage: 'Management', + defaultMessage: 'Stack Management', }), order: 9003, url: `${kbnBaseUrl}#/management`, euiIconType: 'managementApp', linkToLastSubUrl: false, - category: DEFAULT_APP_CATEGORIES.administration, + category: DEFAULT_APP_CATEGORIES.management, }, ], diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/components/fetch_error/fetch_error.tsx b/src/legacy/core_plugins/kibana/public/discover/np_ready/components/fetch_error/fetch_error.tsx index d2dda32f318fe..1aad7e953b8de 100644 --- a/src/legacy/core_plugins/kibana/public/discover/np_ready/components/fetch_error/fetch_error.tsx +++ b/src/legacy/core_plugins/kibana/public/discover/np_ready/components/fetch_error/fetch_error.tsx @@ -39,7 +39,7 @@ const DiscoverFetchError = ({ fetchError }: Props) => { if (fetchError.lang === 'painless') { const { chrome } = getServices(); - const mangagementUrlObj = chrome.navLinks.get('kibana:management'); + const mangagementUrlObj = chrome.navLinks.get('kibana:stack_management'); const managementUrl = mangagementUrlObj ? mangagementUrlObj.url : ''; const url = `${managementUrl}/kibana/index_patterns`; diff --git a/src/legacy/core_plugins/kibana/public/home/np_ready/components/home.test.js b/src/legacy/core_plugins/kibana/public/home/np_ready/components/home.test.js index be2ceb66f69d0..27d4f1a8b1c1f 100644 --- a/src/legacy/core_plugins/kibana/public/home/np_ready/components/home.test.js +++ b/src/legacy/core_plugins/kibana/public/home/np_ready/components/home.test.js @@ -129,8 +129,8 @@ describe('home', () => { test('should not render directory entry when showOnHomePage is false', async () => { const directoryEntry = { - id: 'management', - title: 'Management', + id: 'stack-management', + title: 'Stack Management', description: 'Your center console for managing the Elastic Stack.', icon: 'managementApp', path: 'management_landing_page', diff --git a/src/legacy/core_plugins/kibana/public/management/index.js b/src/legacy/core_plugins/kibana/public/management/index.js index d62770956b88e..17d698e94ad3c 100644 --- a/src/legacy/core_plugins/kibana/public/management/index.js +++ b/src/legacy/core_plugins/kibana/public/management/index.js @@ -173,11 +173,11 @@ uiModules.get('apps/management').directive('kbnManagementLanding', function(kbnV FeatureCatalogueRegistryProvider.register(() => { return { - id: 'management', - title: i18n.translate('kbn.management.managementLabel', { - defaultMessage: 'Management', + id: 'stack-management', + title: i18n.translate('kbn.stackManagement.managementLabel', { + defaultMessage: 'Stack Management', }), - description: i18n.translate('kbn.management.managementDescription', { + description: i18n.translate('kbn.stackManagement.managementDescription', { defaultMessage: 'Your center console for managing the Elastic Stack.', }), icon: 'managementApp', diff --git a/src/legacy/core_plugins/management/index.ts b/src/legacy/core_plugins/management/index.ts index 65601b5371815..4962c948f842f 100644 --- a/src/legacy/core_plugins/management/index.ts +++ b/src/legacy/core_plugins/management/index.ts @@ -23,7 +23,7 @@ import { Legacy } from '../../../../kibana'; // eslint-disable-next-line import/no-default-export export default function ManagementPlugin(kibana: any) { const config: Legacy.PluginSpecOptions = { - id: 'management', + id: 'stack-management', publicDir: resolve(__dirname, 'public'), config: (Joi: any) => { return Joi.object({ diff --git a/src/legacy/core_plugins/telemetry/common/constants.ts b/src/legacy/core_plugins/telemetry/common/constants.ts index cb4ff79969a32..cf2c9c883871b 100644 --- a/src/legacy/core_plugins/telemetry/common/constants.ts +++ b/src/legacy/core_plugins/telemetry/common/constants.ts @@ -80,4 +80,4 @@ export const PATH_TO_ADVANCED_SETTINGS = 'kibana#/management/kibana/settings'; * The type name used within the Monitoring index to publish management stats. * @type {string} */ -export const KIBANA_MANAGEMENT_STATS_TYPE = 'management'; +export const KIBANA_STACK_MANAGEMENT_STATS_TYPE = 'stack_management'; diff --git a/src/legacy/core_plugins/telemetry/server/collectors/management/telemetry_management_collector.ts b/src/legacy/core_plugins/telemetry/server/collectors/management/telemetry_management_collector.ts index f45cf7fc6bb33..44926b644ced5 100644 --- a/src/legacy/core_plugins/telemetry/server/collectors/management/telemetry_management_collector.ts +++ b/src/legacy/core_plugins/telemetry/server/collectors/management/telemetry_management_collector.ts @@ -19,7 +19,7 @@ import { Server } from 'hapi'; import { size } from 'lodash'; -import { KIBANA_MANAGEMENT_STATS_TYPE } from '../../../common/constants'; +import { KIBANA_STACK_MANAGEMENT_STATS_TYPE } from '../../../common/constants'; import { UsageCollectionSetup } from '../../../../../../plugins/usage_collection/server'; import { SavedObjectsClient } from '../../../../../../core/server'; @@ -54,7 +54,7 @@ export function registerManagementUsageCollector( server: any ) { const collector = usageCollection.makeUsageCollector({ - type: KIBANA_MANAGEMENT_STATS_TYPE, + type: KIBANA_STACK_MANAGEMENT_STATS_TYPE, isReady: () => true, fetch: createCollectorFetch(server), }); diff --git a/src/legacy/plugin_discovery/types.ts b/src/legacy/plugin_discovery/types.ts index a5d716ad958f2..9425003eae874 100644 --- a/src/legacy/plugin_discovery/types.ts +++ b/src/legacy/plugin_discovery/types.ts @@ -54,13 +54,13 @@ export interface LegacyPluginOptions { uiExports: Partial<{ app: Partial<{ title: string; + category?: AppCategory; description: string; main: string; icon: string; euiIconType: string; order: number; listed: boolean; - category?: AppCategory; }>; apps: any; hacks: string[]; diff --git a/src/legacy/ui/public/management/breadcrumbs.ts b/src/legacy/ui/public/management/breadcrumbs.ts index fe53bcfde9e1f..936e99caff565 100644 --- a/src/legacy/ui/public/management/breadcrumbs.ts +++ b/src/legacy/ui/public/management/breadcrumbs.ts @@ -20,8 +20,8 @@ import { i18n } from '@kbn/i18n'; export const MANAGEMENT_BREADCRUMB = Object.freeze({ - text: i18n.translate('common.ui.management.breadcrumb', { - defaultMessage: 'Management', + text: i18n.translate('common.ui.stackManagement.breadcrumb', { + defaultMessage: 'Stack Management', }), href: '#/management', }); diff --git a/src/plugins/management/public/components/management_sidebar_nav/management_sidebar_nav.tsx b/src/plugins/management/public/components/management_sidebar_nav/management_sidebar_nav.tsx index cb0b82d0f0bde..7783cd6a417cd 100644 --- a/src/plugins/management/public/components/management_sidebar_nav/management_sidebar_nav.tsx +++ b/src/plugins/management/public/components/management_sidebar_nav/management_sidebar_nav.tsx @@ -161,14 +161,14 @@ export class ManagementSidebarNav extends React.Component< } public render() { - const HEADER_ID = 'management-nav-header'; + const HEADER_ID = 'stack-management-nav-header'; return ( <>

- {i18n.translate('management.nav.label', { - defaultMessage: 'Management', + {i18n.translate('stackManagement.nav.label', { + defaultMessage: 'Stack Management', })}

diff --git a/src/plugins/management/public/legacy/sections_register.js b/src/plugins/management/public/legacy/sections_register.js index 63d919377f89e..2b989c15272f4 100644 --- a/src/plugins/management/public/legacy/sections_register.js +++ b/src/plugins/management/public/legacy/sections_register.js @@ -24,10 +24,10 @@ export class LegacyManagementAdapter { main = undefined; init = capabilities => { this.main = new LegacyManagementSection( - 'management', + 'management', // @myasonik ?? { display: i18n.translate('management.displayName', { - defaultMessage: 'Management', + defaultMessage: 'Stack Management', }), }, capabilities diff --git a/src/plugins/management/public/management_app.tsx b/src/plugins/management/public/management_app.tsx index f7e8dba4f8210..d95e3e6d31296 100644 --- a/src/plugins/management/public/management_app.tsx +++ b/src/plugins/management/public/management_app.tsx @@ -58,8 +58,8 @@ export class ManagementApp { const [coreStart] = await getStartServices(); coreStart.chrome.setBreadcrumbs([ { - text: i18n.translate('management.breadcrumb', { - defaultMessage: 'Management', + text: i18n.translate('stackManagement.breadcrumb', { + defaultMessage: 'Stack Management', }), href: '#/management', }, diff --git a/test/functional/page_objects/header_page.js b/test/functional/page_objects/header_page.js index d0a237e8f42d0..05edd64545a56 100644 --- a/test/functional/page_objects/header_page.js +++ b/test/functional/page_objects/header_page.js @@ -60,7 +60,7 @@ export function HeaderPageProvider({ getService, getPageObjects }) { } async clickStackManagement() { - await appsMenu.clickLink('Management'); + await appsMenu.clickLink('Stack Management'); await this.awaitGlobalLoadingIndicatorHidden(); } diff --git a/test/functional/page_objects/settings_page.js b/test/functional/page_objects/settings_page.ts similarity index 90% rename from test/functional/page_objects/settings_page.js rename to test/functional/page_objects/settings_page.ts index a4ae361b12ed8..8e96fff7e7d66 100644 --- a/test/functional/page_objects/settings_page.js +++ b/test/functional/page_objects/settings_page.ts @@ -19,8 +19,10 @@ import { map as mapAsync } from 'bluebird'; import expect from '@kbn/expect'; +import { NavSetting } from '../../../src/core/public/chrome/ui/header/header'; +import { FtrProviderContext } from '../ftr_provider_context'; -export function SettingsPageProvider({ getService, getPageObjects }) { +export function SettingsPageProvider({ getService, getPageObjects }: FtrProviderContext) { const log = getService('log'); const retry = getService('retry'); const browser = getService('browser'); @@ -34,7 +36,8 @@ export function SettingsPageProvider({ getService, getPageObjects }) { async clickNavigation() { find.clickDisplayedByCssSelector('.app-link:nth-child(5) a'); } - async clickLinkText(text) { + + async clickLinkText(text: string) { await find.clickByDisplayedLinkText(text); } async clickKibanaSettings() { @@ -55,6 +58,7 @@ export function SettingsPageProvider({ getService, getPageObjects }) { // check for the index pattern info flyout that covers the // create index pattern button on smaller screens + // @ts-ignore await retry.waitFor('index pattern info flyout', async () => { if (await testSubjects.exists('CreateIndexPatternPrompt')) { await testSubjects.click('CreateIndexPatternPrompt > euiFlyoutCloseButton'); @@ -62,18 +66,18 @@ export function SettingsPageProvider({ getService, getPageObjects }) { }); } - async getAdvancedSettings(propertyName) { + async getAdvancedSettings(propertyName: string) { log.debug('in getAdvancedSettings'); const setting = await testSubjects.find(`advancedSetting-editField-${propertyName}`); return await setting.getAttribute('value'); } - async expectDisabledAdvancedSetting(propertyName) { + async expectDisabledAdvancedSetting(propertyName: string) { const setting = await testSubjects.find(`advancedSetting-editField-${propertyName}`); expect(setting.getAttribute('disabled')).to.eql(''); } - async getAdvancedSettingCheckbox(propertyName) { + async getAdvancedSettingCheckbox(propertyName: string) { log.debug('in getAdvancedSettingCheckbox'); return await testSubjects.getAttribute( `advancedSetting-editField-${propertyName}`, @@ -81,12 +85,12 @@ export function SettingsPageProvider({ getService, getPageObjects }) { ); } - async clearAdvancedSettings(propertyName) { + async clearAdvancedSettings(propertyName: string) { await testSubjects.click(`advancedSetting-resetField-${propertyName}`); await PageObjects.header.waitUntilLoadingHasFinished(); } - async setAdvancedSettingsSelect(propertyName, propertyValue) { + async setAdvancedSettingsSelect(propertyName: string, propertyValue: string) { await find.clickByCssSelector( `[data-test-subj="advancedSetting-editField-${propertyName}"] option[value="${propertyValue}"]` ); @@ -95,7 +99,7 @@ export function SettingsPageProvider({ getService, getPageObjects }) { await PageObjects.header.waitUntilLoadingHasFinished(); } - async setAdvancedSettingsInput(propertyName, propertyValue) { + async setAdvancedSettingsInput(propertyName: string, propertyValue: string) { const input = await testSubjects.find(`advancedSetting-editField-${propertyName}`); await input.clearValue(); await input.type(propertyValue); @@ -103,7 +107,7 @@ export function SettingsPageProvider({ getService, getPageObjects }) { await PageObjects.header.waitUntilLoadingHasFinished(); } - async toggleAdvancedSettingCheckbox(propertyName) { + async toggleAdvancedSettingCheckbox(propertyName: string) { testSubjects.click(`advancedSetting-editField-${propertyName}`); await PageObjects.header.waitUntilLoadingHasFinished(); await testSubjects.click(`advancedSetting-saveEditField-${propertyName}`); @@ -126,7 +130,7 @@ export function SettingsPageProvider({ getService, getPageObjects }) { return await testSubjects.find('createIndexPatternTimeFieldSelect'); } - async selectTimeFieldOption(selection) { + async selectTimeFieldOption(selection: string) { // open dropdown await this.clickTimeFieldNameField(); // close dropdown, keep focus @@ -141,7 +145,7 @@ export function SettingsPageProvider({ getService, getPageObjects }) { }); } - async getTimeFieldOption(selection) { + async getTimeFieldOption(selection: string) { return await find.displayedByCssSelector('option[value="' + selection + '"]'); } @@ -174,9 +178,9 @@ export function SettingsPageProvider({ getService, getPageObjects }) { return await find.allByCssSelector('table.euiTable thead tr th'); } - async sortBy(columnName) { + async sortBy(columnName: string) { const chartTypes = await find.allByCssSelector('table.euiTable thead tr th button'); - async function getChartType(chart) { + async function getChartType(chart: Record) { const chartString = await chart.getVisibleText(); if (chartString === columnName) { await chart.click(); @@ -187,7 +191,7 @@ export function SettingsPageProvider({ getService, getPageObjects }) { return Promise.all(getChartTypesPromises); } - async getTableRow(rowNumber, colNumber) { + async getTableRow(rowNumber: number, colNumber: number) { // passing in zero-based index, but adding 1 for css 1-based indexes return await find.byCssSelector( 'table.euiTable tbody tr:nth-child(' + @@ -234,13 +238,13 @@ export function SettingsPageProvider({ getService, getPageObjects }) { }); } - async setFieldTypeFilter(type) { + async setFieldTypeFilter(type: string) { await find.clickByCssSelector( 'select[data-test-subj="indexedFieldTypeFilterDropdown"] > option[label="' + type + '"]' ); } - async setScriptedFieldLanguageFilter(language) { + async setScriptedFieldLanguageFilter(language: string) { await find.clickByCssSelector( 'select[data-test-subj="scriptedFieldLanguageFilterDropdown"] > option[label="' + language + @@ -248,13 +252,13 @@ export function SettingsPageProvider({ getService, getPageObjects }) { ); } - async filterField(name) { + async filterField(name: string) { const input = await testSubjects.find('indexPatternFieldFilter'); await input.clearValue(); await input.type(name); } - async openControlsByName(name) { + async openControlsByName(name: string) { await this.filterField(name); const tableFields = await ( await find.byCssSelector( @@ -312,7 +316,7 @@ export function SettingsPageProvider({ getService, getPageObjects }) { } async createIndexPattern( - indexPatternName, + indexPatternName: string, timefield = '@timestamp', isStandardIndexPattern = true ) { @@ -364,7 +368,7 @@ export function SettingsPageProvider({ getService, getPageObjects }) { async getIndexPatternIdFromUrl() { const currentUrl = await browser.getCurrentUrl(); - const indexPatternId = currentUrl.match(/.*\/(.*)/)[1]; + const indexPatternId = currentUrl.match(/.*\/(.*)/)![1]; log.debug('index pattern ID: ', indexPatternId); @@ -423,12 +427,19 @@ export function SettingsPageProvider({ getService, getPageObjects }) { await testSubjects.click('tab-sourceFilters'); } - async editScriptedField(name) { + async editScriptedField(name: string) { await this.filterField(name); await find.clickByCssSelector('.euiTableRowCell--hasActions button:first-child'); } - async addScriptedField(name, language, type, format, popularity, script) { + async addScriptedField( + name: string, + language: string, + type: string, + format: Record, + popularity: string, + script: string + ) { await this.clickAddScriptedField(); await this.setScriptedFieldName(name); if (language) await this.setScriptedFieldLanguage(language); @@ -469,42 +480,42 @@ export function SettingsPageProvider({ getService, getPageObjects }) { await PageObjects.header.waitUntilLoadingHasFinished(); } - async setScriptedFieldName(name) { + async setScriptedFieldName(name: string) { log.debug('set scripted field name = ' + name); const field = await testSubjects.find('editorFieldName'); await field.clearValue(); await field.type(name); } - async setScriptedFieldLanguage(language) { + async setScriptedFieldLanguage(language: string) { log.debug('set scripted field language = ' + language); await find.clickByCssSelector( 'select[data-test-subj="editorFieldLang"] > option[value="' + language + '"]' ); } - async setScriptedFieldType(type) { + async setScriptedFieldType(type: string) { log.debug('set scripted field type = ' + type); await find.clickByCssSelector( 'select[data-test-subj="editorFieldType"] > option[value="' + type + '"]' ); } - async setFieldFormat(format) { + async setFieldFormat(format: string) { log.debug('set scripted field format = ' + format); await find.clickByCssSelector( 'select[data-test-subj="editorSelectedFormatId"] > option[value="' + format + '"]' ); } - async setScriptedFieldUrlType(type) { + async setScriptedFieldUrlType(type: string) { log.debug('set scripted field Url type = ' + type); await find.clickByCssSelector( 'select[data-test-subj="urlEditorType"] > option[value="' + type + '"]' ); } - async setScriptedFieldUrlTemplate(template) { + async setScriptedFieldUrlTemplate(template: string) { log.debug('set scripted field Url Template = ' + template); const urlTemplateField = await find.byCssSelector( 'input[data-test-subj="urlEditorUrlTemplate"]' @@ -512,7 +523,7 @@ export function SettingsPageProvider({ getService, getPageObjects }) { await urlTemplateField.type(template); } - async setScriptedFieldUrlLabelTemplate(labelTemplate) { + async setScriptedFieldUrlLabelTemplate(labelTemplate: string) { log.debug('set scripted field Url Label Template = ' + labelTemplate); const urlEditorLabelTemplate = await find.byCssSelector( 'input[data-test-subj="urlEditorLabelTemplate"]' @@ -520,7 +531,7 @@ export function SettingsPageProvider({ getService, getPageObjects }) { await urlEditorLabelTemplate.type(labelTemplate); } - async setScriptedFieldDatePattern(datePattern) { + async setScriptedFieldDatePattern(datePattern: string) { log.debug('set scripted field Date Pattern = ' + datePattern); const datePatternField = await find.byCssSelector( 'input[data-test-subj="dateEditorPattern"]' @@ -531,21 +542,21 @@ export function SettingsPageProvider({ getService, getPageObjects }) { await datePatternField.type(datePattern); } - async setScriptedFieldStringTransform(stringTransform) { + async setScriptedFieldStringTransform(stringTransform: string) { log.debug('set scripted field string Transform = ' + stringTransform); await find.clickByCssSelector( 'select[data-test-subj="stringEditorTransform"] > option[value="' + stringTransform + '"]' ); } - async setScriptedFieldPopularity(popularity) { + async setScriptedFieldPopularity(popularity: string) { log.debug('set scripted field popularity = ' + popularity); const field = await testSubjects.find('editorFieldCount'); await field.clearValue(); await field.type(popularity); } - async setScriptedFieldScript(script) { + async setScriptedFieldScript(script: string) { log.debug('set scripted field script = ' + script); const aceEditorCssSelector = '[data-test-subj="editorFieldScript"] .ace_editor'; await find.clickByCssSelector(aceEditorCssSelector); @@ -555,7 +566,7 @@ export function SettingsPageProvider({ getService, getPageObjects }) { await browser.pressKeys(...script.split('')); } - async openScriptedFieldHelp(activeTab) { + async openScriptedFieldHelp(activeTab: string) { log.debug('open Scripted Fields help'); let isOpen = await testSubjects.exists('scriptedFieldsHelpFlyout'); if (!isOpen) { @@ -577,7 +588,7 @@ export function SettingsPageProvider({ getService, getPageObjects }) { await flyout.ensureClosed('scriptedFieldsHelpFlyout'); } - async executeScriptedField(script, additionalField) { + async executeScriptedField(script: string, additionalField: string) { log.debug('execute Scripted Fields help'); await this.closeScriptedFieldHelp(); // ensure script help is closed so script input is not blocked await this.setScriptedFieldScript(script); @@ -595,7 +606,7 @@ export function SettingsPageProvider({ getService, getPageObjects }) { return scriptResults; } - async importFile(path, overwriteAll = true) { + async importFile(path: string, overwriteAll = true) { log.debug(`importFile(${path})`); log.debug(`Clicking importObjects`); @@ -645,7 +656,7 @@ export function SettingsPageProvider({ getService, getPageObjects }) { await testSubjects.click('importSavedObjectsConfirmBtn'); } - async associateIndexPattern(oldIndexPatternId, newIndexPatternTitle) { + async associateIndexPattern(oldIndexPatternId: string, newIndexPatternTitle: string) { await find.clickByCssSelector( `select[data-test-subj="managementChangeIndexSelection-${oldIndexPatternId}"] > [data-test-subj="indexPatternOption-${newIndexPatternTitle}"]` @@ -710,7 +721,7 @@ export function SettingsPageProvider({ getService, getPageObjects }) { return await deleteButton.isEnabled(); } - async canSavedObjectBeDeleted(id) { + async canSavedObjectBeDeleted(id: string) { const allCheckBoxes = await testSubjects.findAll('checkboxSelectRow*'); for (const checkBox of allCheckBoxes) { if (await checkBox.isSelected()) { @@ -722,6 +733,12 @@ export function SettingsPageProvider({ getService, getPageObjects }) { await checkBox.click(); return await this.canSavedObjectsBeDeleted(); } + + async setNavType(navType: NavSetting) { + await PageObjects.common.navigateToApp('settings'); + await this.clickKibanaSettings(); + await this.setAdvancedSettingsSelect('pageNavigation', navType); + } } return new SettingsPage(); diff --git a/test/plugin_functional/test_suites/core_plugins/application_status.ts b/test/plugin_functional/test_suites/core_plugins/application_status.ts index d86836feb8859..753ee6fa40ac5 100644 --- a/test/plugin_functional/test_suites/core_plugins/application_status.ts +++ b/test/plugin_functional/test_suites/core_plugins/application_status.ts @@ -67,10 +67,7 @@ export default function({ getService, getPageObjects }: PluginFunctionalProvider describe('application status management', () => { before(async () => { - await PageObjects.common.navigateToApp('settings'); - await PageObjects.settings.clickKibanaSettings(); - await PageObjects.settings.setAdvancedSettingsSelect('pageNavigation', 'individual'); - await browser.refresh(); + await PageObjects.settings.setNavType('individual'); }); beforeEach(async () => { diff --git a/test/plugin_functional/test_suites/core_plugins/applications.ts b/test/plugin_functional/test_suites/core_plugins/applications.ts index 231458fad155b..36bcab10adcac 100644 --- a/test/plugin_functional/test_suites/core_plugins/applications.ts +++ b/test/plugin_functional/test_suites/core_plugins/applications.ts @@ -122,7 +122,7 @@ export default function({ getService, getPageObjects }: PluginFunctionalProvider }); it.skip('can navigate from NP apps to legacy apps', async () => { - await appsMenu.clickLink('Management'); + await appsMenu.clickLink('Stack Management'); await loadingScreenShown(); await testSubjects.existOrFail('managementNav'); }); diff --git a/x-pack/legacy/plugins/graph/public/components/guidance_panel/guidance_panel.tsx b/x-pack/legacy/plugins/graph/public/components/guidance_panel/guidance_panel.tsx index f34b82d6bb1a3..d1fcbea2ff5b7 100644 --- a/x-pack/legacy/plugins/graph/public/components/guidance_panel/guidance_panel.tsx +++ b/x-pack/legacy/plugins/graph/public/components/guidance_panel/guidance_panel.tsx @@ -146,7 +146,7 @@ function GuidancePanelComponent(props: GuidancePanelProps) { ); if (noIndexPatterns) { - const managementUrl = chrome.navLinks.get('kibana:management')!.url; + const managementUrl = chrome.navLinks.get('kibana:stack_management')!.url; const indexPatternUrl = `${managementUrl}/kibana/index_patterns`; const sampleDataUrl = `${application.getUrlForApp( 'kibana' diff --git a/x-pack/legacy/plugins/monitoring/ui_exports.js b/x-pack/legacy/plugins/monitoring/ui_exports.js index d722e7c13fbeb..2b5ea21a2bb45 100644 --- a/x-pack/legacy/plugins/monitoring/ui_exports.js +++ b/x-pack/legacy/plugins/monitoring/ui_exports.js @@ -27,7 +27,7 @@ export const getUiExports = () => ({ euiIconType: 'monitoringApp', linkToLastSubUrl: false, main: 'plugins/monitoring/monitoring', - category: DEFAULT_APP_CATEGORIES.administration, + category: DEFAULT_APP_CATEGORIES.management, }, injectDefaultVars(server) { const config = server.config(); diff --git a/x-pack/test/functional/apps/advanced_settings/feature_controls/advanced_settings_security.ts b/x-pack/test/functional/apps/advanced_settings/feature_controls/advanced_settings_security.ts index 43488de9b36fa..2649c5d26309d 100644 --- a/x-pack/test/functional/apps/advanced_settings/feature_controls/advanced_settings_security.ts +++ b/x-pack/test/functional/apps/advanced_settings/feature_controls/advanced_settings_security.ts @@ -68,7 +68,7 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { it('shows management navlink', async () => { const navLinks = (await appsMenu.readLinks()).map(link => link.text); - expect(navLinks).to.eql(['Management']); + expect(navLinks).to.eql(['Stack Management']); }); it(`allows settings to be changed`, async () => { @@ -124,7 +124,7 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { it('shows Management navlink', async () => { const navLinks = (await appsMenu.readLinks()).map(link => link.text); - expect(navLinks).to.eql(['Management']); + expect(navLinks).to.eql(['Stack Management']); }); it(`does not allow settings to be changed`, async () => { @@ -175,7 +175,7 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { it('shows Management navlink', async () => { const navLinks = (await appsMenu.readLinks()).map(link => link.text); - expect(navLinks).to.eql(['Discover', 'Management']); + expect(navLinks).to.eql(['Discover', 'Stack Management']); }); it(`does not allow navigation to advanced settings; redirects to Kibana home`, async () => { diff --git a/x-pack/test/functional/apps/advanced_settings/feature_controls/advanced_settings_spaces.ts b/x-pack/test/functional/apps/advanced_settings/feature_controls/advanced_settings_spaces.ts index 60b4918af6348..79bb10e0bded1 100644 --- a/x-pack/test/functional/apps/advanced_settings/feature_controls/advanced_settings_spaces.ts +++ b/x-pack/test/functional/apps/advanced_settings/feature_controls/advanced_settings_spaces.ts @@ -12,7 +12,6 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { const PageObjects = getPageObjects(['common', 'settings', 'security', 'spaceSelector']); const testSubjects = getService('testSubjects'); const appsMenu = getService('appsMenu'); - const browser = getService('browser'); describe('spaces feature controls', () => { before(async () => { @@ -41,12 +40,9 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { await PageObjects.common.navigateToApp('home', { basePath: '/s/custom_space', }); - await PageObjects.common.navigateToApp('settings'); - await PageObjects.settings.clickKibanaSettings(); - await PageObjects.settings.setAdvancedSettingsSelect('pageNavigation', 'individual'); - await browser.refresh(); + await PageObjects.settings.setNavType('individual'); const navLinks = (await appsMenu.readLinks()).map(link => link.text); - expect(navLinks).to.contain('Management'); + expect(navLinks).to.contain('Stack Management'); }); it(`allows settings to be changed`, async () => { diff --git a/x-pack/test/functional/apps/apm/feature_controls/apm_security.ts b/x-pack/test/functional/apps/apm/feature_controls/apm_security.ts index e2d5efac4644c..7c9c9f9c8c155 100644 --- a/x-pack/test/functional/apps/apm/feature_controls/apm_security.ts +++ b/x-pack/test/functional/apps/apm/feature_controls/apm_security.ts @@ -60,7 +60,7 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { it('shows apm navlink', async () => { const navLinks = await appsMenu.readLinks(); - expect(navLinks.map(link => link.text)).to.eql(['APM', 'Management']); + expect(navLinks.map(link => link.text)).to.eql(['APM', 'Stack Management']); }); it('can navigate to APM app', async () => { @@ -109,7 +109,7 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { it('shows apm navlink', async () => { const navLinks = (await appsMenu.readLinks()).map(link => link.text); - expect(navLinks).to.eql(['APM', 'Management']); + expect(navLinks).to.eql(['APM', 'Stack Management']); }); it('can navigate to APM app', async () => { diff --git a/x-pack/test/functional/apps/apm/feature_controls/apm_spaces.ts b/x-pack/test/functional/apps/apm/feature_controls/apm_spaces.ts index e5b15743d3faa..474240b201fac 100644 --- a/x-pack/test/functional/apps/apm/feature_controls/apm_spaces.ts +++ b/x-pack/test/functional/apps/apm/feature_controls/apm_spaces.ts @@ -11,7 +11,6 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { const PageObjects = getPageObjects(['common', 'error', 'timePicker', 'security', 'settings']); const testSubjects = getService('testSubjects'); const appsMenu = getService('appsMenu'); - const browser = getService('browser'); describe('spaces', () => { describe('space with no features disabled', () => { @@ -31,10 +30,7 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { await PageObjects.common.navigateToApp('home', { basePath: '/s/custom_space', }); - await PageObjects.common.navigateToApp('settings'); - await PageObjects.settings.clickKibanaSettings(); - await PageObjects.settings.setAdvancedSettingsSelect('pageNavigation', 'individual'); - await browser.refresh(); + await PageObjects.settings.setNavType('individual'); const navLinks = (await appsMenu.readLinks()).map(link => link.text); expect(navLinks).to.contain('APM'); }); diff --git a/x-pack/test/functional/apps/canvas/feature_controls/canvas_security.ts b/x-pack/test/functional/apps/canvas/feature_controls/canvas_security.ts index d0e37ec8e3f35..71c10bd8248be 100644 --- a/x-pack/test/functional/apps/canvas/feature_controls/canvas_security.ts +++ b/x-pack/test/functional/apps/canvas/feature_controls/canvas_security.ts @@ -66,7 +66,7 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { it('shows canvas navlink', async () => { const navLinks = (await appsMenu.readLinks()).map(link => link.text); - expect(navLinks).to.eql(['Canvas', 'Management']); + expect(navLinks).to.eql(['Canvas', 'Stack Management']); }); it(`landing page shows "Create new workpad" button`, async () => { @@ -142,7 +142,7 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { it('shows canvas navlink', async () => { const navLinks = (await appsMenu.readLinks()).map(link => link.text); - expect(navLinks).to.eql(['Canvas', 'Management']); + expect(navLinks).to.eql(['Canvas', 'Stack Management']); }); it(`landing page shows disabled "Create new workpad" button`, async () => { diff --git a/x-pack/test/functional/apps/canvas/feature_controls/canvas_spaces.ts b/x-pack/test/functional/apps/canvas/feature_controls/canvas_spaces.ts index c54f27e976fb2..5395f125bbd22 100644 --- a/x-pack/test/functional/apps/canvas/feature_controls/canvas_spaces.ts +++ b/x-pack/test/functional/apps/canvas/feature_controls/canvas_spaces.ts @@ -11,7 +11,6 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { const spacesService = getService('spaces'); const PageObjects = getPageObjects(['common', 'canvas', 'security', 'spaceSelector', 'settings']); const appsMenu = getService('appsMenu'); - const browser = getService('browser'); describe('spaces feature controls', function() { this.tags(['skipFirefox']); @@ -41,10 +40,7 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { await PageObjects.common.navigateToApp('home', { basePath: '/s/custom_space', }); - await PageObjects.common.navigateToApp('settings'); - await PageObjects.settings.clickKibanaSettings(); - await PageObjects.settings.setAdvancedSettingsSelect('pageNavigation', 'individual'); - await browser.refresh(); + await PageObjects.settings.setNavType('individual'); const navLinks = (await appsMenu.readLinks()).map(link => link.text); expect(navLinks).to.contain('Canvas'); }); diff --git a/x-pack/test/functional/apps/dashboard/feature_controls/dashboard_security.ts b/x-pack/test/functional/apps/dashboard/feature_controls/dashboard_security.ts index d25fae3c4894c..6a6e2f23785e3 100644 --- a/x-pack/test/functional/apps/dashboard/feature_controls/dashboard_security.ts +++ b/x-pack/test/functional/apps/dashboard/feature_controls/dashboard_security.ts @@ -75,7 +75,7 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { it('shows dashboard navlink', async () => { const navLinks = await appsMenu.readLinks(); - expect(navLinks.map(link => link.text)).to.eql(['Dashboard', 'Management']); + expect(navLinks.map(link => link.text)).to.eql(['Dashboard', 'Stack Management']); }); it(`landing page shows "Create new Dashboard" button`, async () => { @@ -253,7 +253,7 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { it('shows dashboard navlink', async () => { const navLinks = (await appsMenu.readLinks()).map(link => link.text); - expect(navLinks).to.eql(['Dashboard', 'Management']); + expect(navLinks).to.eql(['Dashboard', 'Stack Management']); }); it(`landing page doesn't show "Create new Dashboard" button`, async () => { diff --git a/x-pack/test/functional/apps/dashboard/feature_controls/dashboard_spaces.ts b/x-pack/test/functional/apps/dashboard/feature_controls/dashboard_spaces.ts index dc894dd8f8e0b..002ae627c488d 100644 --- a/x-pack/test/functional/apps/dashboard/feature_controls/dashboard_spaces.ts +++ b/x-pack/test/functional/apps/dashboard/feature_controls/dashboard_spaces.ts @@ -22,7 +22,6 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { ]); const appsMenu = getService('appsMenu'); const testSubjects = getService('testSubjects'); - const browser = getService('browser'); describe('spaces', () => { before(async () => { @@ -50,10 +49,7 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { await PageObjects.common.navigateToApp('home', { basePath: '/s/custom_space', }); - await PageObjects.common.navigateToApp('settings'); - await PageObjects.settings.clickKibanaSettings(); - await PageObjects.settings.setAdvancedSettingsSelect('pageNavigation', 'individual'); - await browser.refresh(); + await PageObjects.settings.setNavType('individual'); const navLinks = (await appsMenu.readLinks()).map(link => link.text); expect(navLinks).to.contain('Dashboard'); }); diff --git a/x-pack/test/functional/apps/dashboard_mode/dashboard_view_mode.js b/x-pack/test/functional/apps/dashboard_mode/dashboard_view_mode.js index 7fab4143e0497..ddd65bf4c651e 100644 --- a/x-pack/test/functional/apps/dashboard_mode/dashboard_view_mode.js +++ b/x-pack/test/functional/apps/dashboard_mode/dashboard_view_mode.js @@ -200,7 +200,7 @@ export default function({ getService, getPageObjects }) { await PageObjects.security.forceLogout(); await PageObjects.security.login('mixeduser', '123456'); - if (await appsMenu.linkExists('Management')) { + if (await appsMenu.linkExists('Stack Management')) { throw new Error('Expected management nav link to not be shown'); } }); @@ -209,7 +209,7 @@ export default function({ getService, getPageObjects }) { await PageObjects.security.forceLogout(); await PageObjects.security.login('mysuperuser', '123456'); - if (!(await appsMenu.linkExists('Management'))) { + if (!(await appsMenu.linkExists('Stack Management'))) { throw new Error('Expected management nav link to be shown'); } }); diff --git a/x-pack/test/functional/apps/dev_tools/feature_controls/dev_tools_security.ts b/x-pack/test/functional/apps/dev_tools/feature_controls/dev_tools_security.ts index 494fd71ea6f34..9db9a913e9a4b 100644 --- a/x-pack/test/functional/apps/dev_tools/feature_controls/dev_tools_security.ts +++ b/x-pack/test/functional/apps/dev_tools/feature_controls/dev_tools_security.ts @@ -63,7 +63,7 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { it('shows Dev Tools navlink', async () => { const navLinks = await appsMenu.readLinks(); - expect(navLinks.map(link => link.text)).to.eql(['Dev Tools', 'Management']); + expect(navLinks.map(link => link.text)).to.eql(['Dev Tools', 'Stack Management']); }); describe('console', () => { @@ -144,7 +144,7 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { it(`shows 'Dev Tools' navlink`, async () => { const navLinks = (await appsMenu.readLinks()).map(link => link.text); - expect(navLinks).to.eql(['Dev Tools', 'Management']); + expect(navLinks).to.eql(['Dev Tools', 'Stack Management']); }); describe('console', () => { diff --git a/x-pack/test/functional/apps/dev_tools/feature_controls/dev_tools_spaces.ts b/x-pack/test/functional/apps/dev_tools/feature_controls/dev_tools_spaces.ts index 8d5f455742bab..f917792eea027 100644 --- a/x-pack/test/functional/apps/dev_tools/feature_controls/dev_tools_spaces.ts +++ b/x-pack/test/functional/apps/dev_tools/feature_controls/dev_tools_spaces.ts @@ -19,7 +19,6 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { const appsMenu = getService('appsMenu'); const testSubjects = getService('testSubjects'); const grokDebugger = getService('grokDebugger'); - const browser = getService('browser'); describe('spaces', () => { before(async () => { @@ -47,10 +46,7 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { await PageObjects.common.navigateToApp('home', { basePath: '/s/custom_space', }); - await PageObjects.common.navigateToApp('settings'); - await PageObjects.settings.clickKibanaSettings(); - await PageObjects.settings.setAdvancedSettingsSelect('pageNavigation', 'individual'); - await browser.refresh(); + await PageObjects.settings.setNavType('individual'); const navLinks = (await appsMenu.readLinks()).map(link => link.text); expect(navLinks).to.contain('Dev Tools'); }); diff --git a/x-pack/test/functional/apps/discover/feature_controls/discover_security.ts b/x-pack/test/functional/apps/discover/feature_controls/discover_security.ts index 1912b16d96f36..1796858165a2b 100644 --- a/x-pack/test/functional/apps/discover/feature_controls/discover_security.ts +++ b/x-pack/test/functional/apps/discover/feature_controls/discover_security.ts @@ -81,7 +81,7 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { it('shows discover navlink', async () => { const navLinks = await appsMenu.readLinks(); - expect(navLinks.map(link => link.text)).to.eql(['Discover', 'Management']); + expect(navLinks.map(link => link.text)).to.eql(['Discover', 'Stack Management']); }); it('shows save button', async () => { @@ -168,7 +168,7 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { it('shows discover navlink', async () => { const navLinks = (await appsMenu.readLinks()).map(link => link.text); - expect(navLinks).to.eql(['Discover', 'Management']); + expect(navLinks).to.eql(['Discover', 'Stack Management']); }); it(`doesn't show save button`, async () => { diff --git a/x-pack/test/functional/apps/discover/feature_controls/discover_spaces.ts b/x-pack/test/functional/apps/discover/feature_controls/discover_spaces.ts index ef724872b264f..c38dda536f253 100644 --- a/x-pack/test/functional/apps/discover/feature_controls/discover_spaces.ts +++ b/x-pack/test/functional/apps/discover/feature_controls/discover_spaces.ts @@ -19,7 +19,6 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { ]); const testSubjects = getService('testSubjects'); const appsMenu = getService('appsMenu'); - const browser = getService('browser'); async function setDiscoverTimeRange() { await PageObjects.timePicker.setDefaultAbsoluteRange(); @@ -51,10 +50,7 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { await PageObjects.common.navigateToApp('home', { basePath: '/s/custom_space', }); - await PageObjects.common.navigateToApp('settings'); - await PageObjects.settings.clickKibanaSettings(); - await PageObjects.settings.setAdvancedSettingsSelect('pageNavigation', 'individual'); - await browser.refresh(); + await PageObjects.settings.setNavType('individual'); const navLinks = (await appsMenu.readLinks()).map(link => link.text); expect(navLinks).to.contain('Discover'); }); diff --git a/x-pack/test/functional/apps/graph/feature_controls/graph_security.ts b/x-pack/test/functional/apps/graph/feature_controls/graph_security.ts index a2b062e6ef84f..37de93a0a7e91 100644 --- a/x-pack/test/functional/apps/graph/feature_controls/graph_security.ts +++ b/x-pack/test/functional/apps/graph/feature_controls/graph_security.ts @@ -64,7 +64,7 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { it('shows graph navlink', async () => { const navLinks = await appsMenu.readLinks(); - expect(navLinks.map(link => link.text)).to.eql(['Graph', 'Management']); + expect(navLinks.map(link => link.text)).to.eql(['Graph', 'Stack Management']); }); it('landing page shows "Create new graph" button', async () => { @@ -127,7 +127,7 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { it('shows graph navlink', async () => { const navLinks = (await appsMenu.readLinks()).map(link => link.text); - expect(navLinks).to.eql(['Graph', 'Management']); + expect(navLinks).to.eql(['Graph', 'Stack Management']); }); it('does not show a "Create new Workspace" button', async () => { diff --git a/x-pack/test/functional/apps/graph/feature_controls/graph_spaces.ts b/x-pack/test/functional/apps/graph/feature_controls/graph_spaces.ts index a170a84cc6118..c38e928b62517 100644 --- a/x-pack/test/functional/apps/graph/feature_controls/graph_spaces.ts +++ b/x-pack/test/functional/apps/graph/feature_controls/graph_spaces.ts @@ -24,11 +24,7 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { name: 'custom_space', disabledFeatures: [], }); - await PageObjects.common.navigateToActualUrl('kibana', 'management/kibana/settings', { - basePath: `/s/custom_space`, - ensureCurrentUrl: false, - }); - await PageObjects.settings.setAdvancedSettingsSelect('pageNavigation', 'individual'); + await PageObjects.settings.setNavType('individual'); }); after(async () => { diff --git a/x-pack/test/functional/apps/index_patterns/feature_controls/index_patterns_security.ts b/x-pack/test/functional/apps/index_patterns/feature_controls/index_patterns_security.ts index f84a085ba694f..ed25816e68712 100644 --- a/x-pack/test/functional/apps/index_patterns/feature_controls/index_patterns_security.ts +++ b/x-pack/test/functional/apps/index_patterns/feature_controls/index_patterns_security.ts @@ -70,7 +70,7 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { it('shows management navlink', async () => { const navLinks = (await appsMenu.readLinks()).map(link => link.text); - expect(navLinks).to.eql(['Management']); + expect(navLinks).to.eql(['Stack Management']); }); it(`index pattern listing shows create button`, async () => { @@ -124,7 +124,7 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { it('shows management navlink', async () => { const navLinks = (await appsMenu.readLinks()).map(link => link.text); - expect(navLinks).to.eql(['Management']); + expect(navLinks).to.eql(['Stack Management']); }); it(`index pattern listing doesn't show create button`, async () => { @@ -176,7 +176,7 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { it('shows Management navlink', async () => { const navLinks = (await appsMenu.readLinks()).map(link => link.text); - expect(navLinks).to.eql(['Discover', 'Management']); + expect(navLinks).to.eql(['Discover', 'Stack Management']); }); it(`doesn't show Index Patterns in management side-nav`, async () => { diff --git a/x-pack/test/functional/apps/index_patterns/feature_controls/index_patterns_spaces.ts b/x-pack/test/functional/apps/index_patterns/feature_controls/index_patterns_spaces.ts index 93b17cf0cefb3..75020d6eab7e4 100644 --- a/x-pack/test/functional/apps/index_patterns/feature_controls/index_patterns_spaces.ts +++ b/x-pack/test/functional/apps/index_patterns/feature_controls/index_patterns_spaces.ts @@ -12,7 +12,6 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { const PageObjects = getPageObjects(['common', 'settings', 'security']); const testSubjects = getService('testSubjects'); const appsMenu = getService('appsMenu'); - const browser = getService('browser'); describe('spaces', () => { before(async () => { @@ -41,12 +40,9 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { await PageObjects.common.navigateToApp('home', { basePath: '/s/custom_space', }); - await PageObjects.common.navigateToApp('settings'); - await PageObjects.settings.clickKibanaSettings(); - await PageObjects.settings.setAdvancedSettingsSelect('pageNavigation', 'individual'); - await browser.refresh(); + await PageObjects.settings.setNavType('individual'); const navLinks = (await appsMenu.readLinks()).map(link => link.text); - expect(navLinks).to.contain('Management'); + expect(navLinks).to.contain('Stack Management'); }); it(`index pattern listing shows create button`, async () => { diff --git a/x-pack/test/functional/apps/infra/feature_controls/infrastructure_security.ts b/x-pack/test/functional/apps/infra/feature_controls/infrastructure_security.ts index 5062f094061c0..b7c5667a57506 100644 --- a/x-pack/test/functional/apps/infra/feature_controls/infrastructure_security.ts +++ b/x-pack/test/functional/apps/infra/feature_controls/infrastructure_security.ts @@ -61,7 +61,7 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { it('shows metrics navlink', async () => { const navLinks = (await appsMenu.readLinks()).map(link => link.text); - expect(navLinks).to.eql(['Metrics', 'Management']); + expect(navLinks).to.eql(['Metrics', 'Stack Management']); }); describe('infrastructure landing page without data', () => { @@ -174,7 +174,7 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { it('shows metrics navlink', async () => { const navLinks = (await appsMenu.readLinks()).map(link => link.text); - expect(navLinks).to.eql(['Metrics', 'Management']); + expect(navLinks).to.eql(['Metrics', 'Stack Management']); }); describe('infrastructure landing page without data', () => { diff --git a/x-pack/test/functional/apps/infra/feature_controls/infrastructure_spaces.ts b/x-pack/test/functional/apps/infra/feature_controls/infrastructure_spaces.ts index 12a2375dfbc2b..953bad1e78baa 100644 --- a/x-pack/test/functional/apps/infra/feature_controls/infrastructure_spaces.ts +++ b/x-pack/test/functional/apps/infra/feature_controls/infrastructure_spaces.ts @@ -37,17 +37,12 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { // we need to load the following in every situation as deleting // a space deletes all of the associated saved objects await esArchiver.load('empty_kibana'); - await spacesService.create({ id: 'custom_space', name: 'custom_space', disabledFeatures: [], }); - await PageObjects.common.navigateToActualUrl('kibana', 'management/kibana/settings', { - basePath: `/s/custom_space`, - ensureCurrentUrl: false, - }); - await PageObjects.settings.setAdvancedSettingsSelect('pageNavigation', 'individual'); + await PageObjects.settings.setNavType('individual'); }); after(async () => { diff --git a/x-pack/test/functional/apps/infra/feature_controls/logs_security.ts b/x-pack/test/functional/apps/infra/feature_controls/logs_security.ts index b9634c29dac1c..5008f93feeb01 100644 --- a/x-pack/test/functional/apps/infra/feature_controls/logs_security.ts +++ b/x-pack/test/functional/apps/infra/feature_controls/logs_security.ts @@ -58,7 +58,7 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { it('shows logs navlink', async () => { const navLinks = (await appsMenu.readLinks()).map(link => link.text); - expect(navLinks).to.eql(['Logs', 'Management']); + expect(navLinks).to.eql(['Logs', 'Stack Management']); }); describe('logs landing page without data', () => { @@ -121,7 +121,7 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { it('shows logs navlink', async () => { const navLinks = (await appsMenu.readLinks()).map(link => link.text); - expect(navLinks).to.eql(['Logs', 'Management']); + expect(navLinks).to.eql(['Logs', 'Stack Management']); }); describe('logs landing page without data', () => { diff --git a/x-pack/test/functional/apps/infra/feature_controls/logs_spaces.ts b/x-pack/test/functional/apps/infra/feature_controls/logs_spaces.ts index b474c1239543c..61a57e09f96c5 100644 --- a/x-pack/test/functional/apps/infra/feature_controls/logs_spaces.ts +++ b/x-pack/test/functional/apps/infra/feature_controls/logs_spaces.ts @@ -18,7 +18,6 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { ]); const testSubjects = getService('testSubjects'); const appsMenu = getService('appsMenu'); - const browser = getService('browser'); describe('logs spaces', () => { describe('space with no features disabled', () => { @@ -43,10 +42,7 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { await PageObjects.common.navigateToApp('home', { basePath: '/s/custom_space', }); - await PageObjects.common.navigateToApp('settings'); - await PageObjects.settings.clickKibanaSettings(); - await PageObjects.settings.setAdvancedSettingsSelect('pageNavigation', 'individual'); - await browser.refresh(); + await PageObjects.settings.setNavType('individual'); const navLinks = (await appsMenu.readLinks()).map(link => link.text); expect(navLinks).to.contain('Logs'); }); diff --git a/x-pack/test/functional/apps/machine_learning/feature_controls/ml_security.ts b/x-pack/test/functional/apps/machine_learning/feature_controls/ml_security.ts index facefd6863137..c25c1bfe4b731 100644 --- a/x-pack/test/functional/apps/machine_learning/feature_controls/ml_security.ts +++ b/x-pack/test/functional/apps/machine_learning/feature_controls/ml_security.ts @@ -10,7 +10,6 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { const esArchiver = getService('esArchiver'); const security = getService('security'); const appsMenu = getService('appsMenu'); - const browser = getService('browser'); const PageObjects = getPageObjects(['common', 'security', 'settings']); describe('security', () => { @@ -95,10 +94,7 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { }); await PageObjects.security.login('machine_learning_user', 'machine_learning_user-password'); - await PageObjects.common.navigateToApp('settings'); - await PageObjects.settings.clickKibanaSettings(); - await PageObjects.settings.setAdvancedSettingsSelect('pageNavigation', 'individual'); - await browser.refresh(); + await PageObjects.settings.setNavType('individual'); }); after(async () => { diff --git a/x-pack/test/functional/apps/machine_learning/feature_controls/ml_spaces.ts b/x-pack/test/functional/apps/machine_learning/feature_controls/ml_spaces.ts index 139eb9d7e73fd..c633852a2da0a 100644 --- a/x-pack/test/functional/apps/machine_learning/feature_controls/ml_spaces.ts +++ b/x-pack/test/functional/apps/machine_learning/feature_controls/ml_spaces.ts @@ -11,7 +11,6 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { const spacesService = getService('spaces'); const PageObjects = getPageObjects(['common', 'dashboard', 'security', 'error', 'settings']); const appsMenu = getService('appsMenu'); - const browser = getService('browser'); const testSubjects = getService('testSubjects'); describe('spaces', () => { @@ -40,10 +39,7 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { await PageObjects.common.navigateToApp('home', { basePath: '/s/custom_space', }); - await PageObjects.common.navigateToApp('settings'); - await PageObjects.settings.clickKibanaSettings(); - await PageObjects.settings.setAdvancedSettingsSelect('pageNavigation', 'individual'); - await browser.refresh(); + await PageObjects.settings.setNavType('individual'); const navLinks = (await appsMenu.readLinks()).map(link => link.text); expect(navLinks).to.contain('Machine Learning'); }); diff --git a/x-pack/test/functional/apps/maps/feature_controls/maps_security.ts b/x-pack/test/functional/apps/maps/feature_controls/maps_security.ts index 804ad5725edfd..ece162cbd96cc 100644 --- a/x-pack/test/functional/apps/maps/feature_controls/maps_security.ts +++ b/x-pack/test/functional/apps/maps/feature_controls/maps_security.ts @@ -66,7 +66,7 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { it('shows maps navlink', async () => { const navLinks = (await appsMenu.readLinks()).map(link => link.text); - expect(navLinks).to.eql(['Maps', 'Management']); + expect(navLinks).to.eql(['Maps', 'Stack Management']); }); it(`allows a map to be created`, async () => { @@ -153,7 +153,7 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { it('shows Maps navlink', async () => { const navLinks = (await appsMenu.readLinks()).map(link => link.text); - expect(navLinks).to.eql(['Maps', 'Management']); + expect(navLinks).to.eql(['Maps', 'Stack Management']); }); it(`does not show create new button`, async () => { @@ -248,7 +248,7 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { it('does not show Maps navlink', async () => { const navLinks = (await appsMenu.readLinks()).map(link => link.text); - expect(navLinks).to.eql(['Discover', 'Management']); + expect(navLinks).to.eql(['Discover', 'Stack Management']); }); it(`returns a 404`, async () => { diff --git a/x-pack/test/functional/apps/monitoring/feature_controls/monitoring_security.ts b/x-pack/test/functional/apps/monitoring/feature_controls/monitoring_security.ts index 4826d009771fb..130aefb3cae2a 100644 --- a/x-pack/test/functional/apps/monitoring/feature_controls/monitoring_security.ts +++ b/x-pack/test/functional/apps/monitoring/feature_controls/monitoring_security.ts @@ -11,7 +11,6 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { const security = getService('security'); const appsMenu = getService('appsMenu'); const PageObjects = getPageObjects(['common', 'security', 'settings']); - const browser = getService('browser'); describe('security', () => { before(async () => { @@ -98,11 +97,7 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { }); it('shows monitoring navlink', async () => { - await PageObjects.common.navigateToApp('settings'); - await PageObjects.settings.clickKibanaSettings(); - await PageObjects.settings.setAdvancedSettingsSelect('pageNavigation', 'individual'); - await browser.refresh(); - + await PageObjects.settings.setNavType('individual'); const navLinks = (await appsMenu.readLinks()).map(link => link.text); expect(navLinks).to.contain('Stack Monitoring'); }); diff --git a/x-pack/test/functional/apps/monitoring/feature_controls/monitoring_spaces.ts b/x-pack/test/functional/apps/monitoring/feature_controls/monitoring_spaces.ts index bf58b94c17662..0465cbcf54541 100644 --- a/x-pack/test/functional/apps/monitoring/feature_controls/monitoring_spaces.ts +++ b/x-pack/test/functional/apps/monitoring/feature_controls/monitoring_spaces.ts @@ -12,7 +12,6 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { const PageObjects = getPageObjects(['common', 'dashboard', 'security', 'error', 'settings']); const appsMenu = getService('appsMenu'); const find = getService('find'); - const browser = getService('browser'); describe('spaces', () => { before(async () => { @@ -42,10 +41,7 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { await PageObjects.common.navigateToApp('home', { basePath: '/s/custom_space', }); - await PageObjects.common.navigateToApp('settings'); - await PageObjects.settings.clickKibanaSettings(); - await PageObjects.settings.setAdvancedSettingsSelect('pageNavigation', 'individual'); - await browser.refresh(); + await PageObjects.settings.setNavType('individual'); const navLinks = (await appsMenu.readLinks()).map(link => link.text); expect(navLinks).to.contain('Stack Monitoring'); }); diff --git a/x-pack/test/functional/apps/spaces/feature_controls/spaces_security.ts b/x-pack/test/functional/apps/spaces/feature_controls/spaces_security.ts index e7cdcac72a358..d71d197a6ea19 100644 --- a/x-pack/test/functional/apps/spaces/feature_controls/spaces_security.ts +++ b/x-pack/test/functional/apps/spaces/feature_controls/spaces_security.ts @@ -12,15 +12,11 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { const PageObjects = getPageObjects(['common', 'settings', 'security']); const appsMenu = getService('appsMenu'); const testSubjects = getService('testSubjects'); - const browser = getService('browser'); describe('security feature controls', () => { before(async () => { await esArchiver.load('empty_kibana'); - await PageObjects.common.navigateToApp('settings'); - await PageObjects.settings.clickKibanaSettings(); - await PageObjects.settings.setAdvancedSettingsSelect('pageNavigation', 'individual'); - await browser.refresh(); + await PageObjects.settings.setNavType('individual'); }); after(async () => { @@ -61,7 +57,7 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { it('shows management navlink', async () => { const navLinks = (await appsMenu.readLinks()).map(link => link.text); - expect(navLinks).to.contain('Management'); + expect(navLinks).to.contain('Stack Management'); }); it(`displays Spaces management section`, async () => { @@ -135,7 +131,7 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { it('shows management navlink', async () => { const navLinks = (await appsMenu.readLinks()).map(link => link.text); - expect(navLinks).to.contain('Management'); + expect(navLinks).to.contain('Stack Management'); }); it(`doesn't display Spaces management section`, async () => { diff --git a/x-pack/test/functional/apps/timelion/feature_controls/timelion_security.ts b/x-pack/test/functional/apps/timelion/feature_controls/timelion_security.ts index dea45f161e451..62483a10552e3 100644 --- a/x-pack/test/functional/apps/timelion/feature_controls/timelion_security.ts +++ b/x-pack/test/functional/apps/timelion/feature_controls/timelion_security.ts @@ -60,7 +60,7 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { it('shows timelion navlink', async () => { const navLinks = (await appsMenu.readLinks()).map(link => link.text); - expect(navLinks).to.eql(['Timelion', 'Management']); + expect(navLinks).to.eql(['Timelion', 'Stack Management']); }); it(`allows a timelion sheet to be created`, async () => { @@ -112,7 +112,7 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { it('shows timelion navlink', async () => { const navLinks = (await appsMenu.readLinks()).map(link => link.text); - expect(navLinks).to.eql(['Timelion', 'Management']); + expect(navLinks).to.eql(['Timelion', 'Stack Management']); }); it(`does not allow a timelion sheet to be created`, async () => { diff --git a/x-pack/test/functional/apps/timelion/feature_controls/timelion_spaces.ts b/x-pack/test/functional/apps/timelion/feature_controls/timelion_spaces.ts index b04062e9dd6b7..7e0fe731301a6 100644 --- a/x-pack/test/functional/apps/timelion/feature_controls/timelion_spaces.ts +++ b/x-pack/test/functional/apps/timelion/feature_controls/timelion_spaces.ts @@ -17,7 +17,6 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { 'settings', ]); const appsMenu = getService('appsMenu'); - const browser = getService('browser'); describe('timelion', () => { before(async () => { @@ -45,10 +44,7 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { await PageObjects.common.navigateToApp('home', { basePath: '/s/custom_space', }); - await PageObjects.common.navigateToApp('settings'); - await PageObjects.settings.clickKibanaSettings(); - await PageObjects.settings.setAdvancedSettingsSelect('pageNavigation', 'individual'); - await browser.refresh(); + await PageObjects.settings.setNavType('individual'); const navLinks = (await appsMenu.readLinks()).map(link => link.text); expect(navLinks).to.contain('Timelion'); }); diff --git a/x-pack/test/functional/apps/uptime/feature_controls/uptime_security.ts b/x-pack/test/functional/apps/uptime/feature_controls/uptime_security.ts index a004f8db66823..4ff82484db91c 100644 --- a/x-pack/test/functional/apps/uptime/feature_controls/uptime_security.ts +++ b/x-pack/test/functional/apps/uptime/feature_controls/uptime_security.ts @@ -64,7 +64,7 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { it('shows uptime navlink', async () => { const navLinks = await appsMenu.readLinks(); - expect(navLinks.map(link => link.text)).to.eql(['Uptime', 'Management']); + expect(navLinks.map(link => link.text)).to.eql(['Uptime', 'Stack Management']); }); it('can navigate to Uptime app', async () => { @@ -115,7 +115,7 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { it('shows uptime navlink', async () => { const navLinks = (await appsMenu.readLinks()).map(link => link.text); - expect(navLinks).to.eql(['Uptime', 'Management']); + expect(navLinks).to.eql(['Uptime', 'Stack Management']); }); it('can navigate to Uptime app', async () => { diff --git a/x-pack/test/functional/apps/uptime/feature_controls/uptime_spaces.ts b/x-pack/test/functional/apps/uptime/feature_controls/uptime_spaces.ts index ccf4d65078aa2..b78a5b350ad48 100644 --- a/x-pack/test/functional/apps/uptime/feature_controls/uptime_spaces.ts +++ b/x-pack/test/functional/apps/uptime/feature_controls/uptime_spaces.ts @@ -20,11 +20,7 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { name: 'custom_space', disabledFeatures: [], }); - await PageObjects.common.navigateToActualUrl('kibana', 'management/kibana/settings', { - basePath: `/s/custom_space`, - ensureCurrentUrl: false, - }); - await PageObjects.settings.setAdvancedSettingsSelect('pageNavigation', 'individual'); + await PageObjects.settings.setNavType('individual'); }); after(async () => { diff --git a/x-pack/test/functional/apps/visualize/feature_controls/visualize_security.ts b/x-pack/test/functional/apps/visualize/feature_controls/visualize_security.ts index d55076cb0ab43..767dbd7165567 100644 --- a/x-pack/test/functional/apps/visualize/feature_controls/visualize_security.ts +++ b/x-pack/test/functional/apps/visualize/feature_controls/visualize_security.ts @@ -75,7 +75,7 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { it('shows visualize navlink', async () => { const navLinks = (await appsMenu.readLinks()).map(link => link.text); - expect(navLinks).to.eql(['Visualize', 'Management']); + expect(navLinks).to.eql(['Visualize', 'Stack Management']); }); it(`landing page shows "Create new Visualization" button`, async () => { @@ -189,7 +189,7 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { it('shows visualize navlink', async () => { const navLinks = (await appsMenu.readLinks()).map(link => link.text); - expect(navLinks).to.eql(['Visualize', 'Management']); + expect(navLinks).to.eql(['Visualize', 'Stack Management']); }); it(`landing page shows "Create new Visualization" button`, async () => { diff --git a/x-pack/test/functional/apps/visualize/feature_controls/visualize_spaces.ts b/x-pack/test/functional/apps/visualize/feature_controls/visualize_spaces.ts index 111f005410579..066042896c122 100644 --- a/x-pack/test/functional/apps/visualize/feature_controls/visualize_spaces.ts +++ b/x-pack/test/functional/apps/visualize/feature_controls/visualize_spaces.ts @@ -19,7 +19,6 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { ]); const testSubjects = getService('testSubjects'); const appsMenu = getService('appsMenu'); - const browser = getService('browser'); describe('visualize', () => { before(async () => { @@ -47,10 +46,7 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { await PageObjects.common.navigateToApp('home', { basePath: '/s/custom_space', }); - await PageObjects.common.navigateToApp('settings'); - await PageObjects.settings.clickKibanaSettings(); - await PageObjects.settings.setAdvancedSettingsSelect('pageNavigation', 'individual'); - await browser.refresh(); + await PageObjects.settings.setNavType('individual'); const navLinks = (await appsMenu.readLinks()).map(link => link.text); expect(navLinks).to.contain('Visualize'); }); diff --git a/x-pack/test/ui_capabilities/common/nav_links_builder.ts b/x-pack/test/ui_capabilities/common/nav_links_builder.ts index 8b7741469362e..aaeb22852bcc0 100644 --- a/x-pack/test/ui_capabilities/common/nav_links_builder.ts +++ b/x-pack/test/ui_capabilities/common/nav_links_builder.ts @@ -13,7 +13,7 @@ export class NavLinksBuilder { ...features, // management isn't a first-class "feature", but it makes our life easier here to pretend like it is management: { - navLinkId: 'kibana:management', + navLinkId: 'kibana:stack_management', }, }; } diff --git a/x-pack/test/ui_capabilities/common/services/ui_capabilities.ts b/x-pack/test/ui_capabilities/common/services/ui_capabilities.ts index 4af7d81e5a7b4..5c13e6b0eb51e 100644 --- a/x-pack/test/ui_capabilities/common/services/ui_capabilities.ts +++ b/x-pack/test/ui_capabilities/common/services/ui_capabilities.ts @@ -68,7 +68,7 @@ export class UICapabilitiesService { : {}; const response = await this.axios.post( `${spaceUrlPrefix}/api/core/capabilities`, - { applications: [...applications, 'kibana:management'] }, + { applications: [...applications, 'kibana:stack_management'] }, { headers: requestHeaders, } From 3d80243d22b77ca9731f6ac9eaa7395177b9d07f Mon Sep 17 00:00:00 2001 From: Michail Yasonik Date: Wed, 15 Jan 2020 13:34:09 -0500 Subject: [PATCH 27/31] fixing tests --- .../core/public/kibana-plugin-public.appbase.category.md | 2 +- .../core/public/kibana-plugin-public.appbase.md | 2 +- .../public/kibana-plugin-public.appcategory.arialabel.md | 2 ++ .../kibana-plugin-public.appcategory.euiicontype.md | 2 ++ .../public/kibana-plugin-public.appcategory.label.md | 2 ++ .../core/public/kibana-plugin-public.appcategory.md | 9 +++++---- .../public/kibana-plugin-public.appcategory.order.md | 2 ++ docs/development/core/public/kibana-plugin-public.md | 2 +- src/core/public/public.api.md | 8 ++------ src/core/types/app_category.ts | 5 +++++ .../core_plugins/kibana/public/management/index.js | 4 ++-- .../apps/graph/feature_controls/graph_spaces.ts | 2 +- .../apps/infra/feature_controls/infrastructure_spaces.ts | 2 +- .../apps/uptime/feature_controls/uptime_spaces.ts | 2 +- 14 files changed, 28 insertions(+), 18 deletions(-) diff --git a/docs/development/core/public/kibana-plugin-public.appbase.category.md b/docs/development/core/public/kibana-plugin-public.appbase.category.md index e139ac25d7a1c..215ebbbd0e186 100644 --- a/docs/development/core/public/kibana-plugin-public.appbase.category.md +++ b/docs/development/core/public/kibana-plugin-public.appbase.category.md @@ -4,7 +4,7 @@ ## AppBase.category property -The category the app lives in Default categories defined in +The category definition of the product See [AppCategory](./kibana-plugin-public.appcategory.md) See DEFAULT\_APP\_CATEGORIES for more reference Signature: diff --git a/docs/development/core/public/kibana-plugin-public.appbase.md b/docs/development/core/public/kibana-plugin-public.appbase.md index d162620ccea1e..6f547450b6a12 100644 --- a/docs/development/core/public/kibana-plugin-public.appbase.md +++ b/docs/development/core/public/kibana-plugin-public.appbase.md @@ -16,7 +16,7 @@ export interface AppBase | Property | Type | Description | | --- | --- | --- | | [capabilities](./kibana-plugin-public.appbase.capabilities.md) | Partial<Capabilities> | Custom capabilities defined by the app. | -| [category](./kibana-plugin-public.appbase.category.md) | AppCategory | The category the app lives in Default categories defined in | +| [category](./kibana-plugin-public.appbase.category.md) | AppCategory | 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) | boolean | Hide the UI chrome when the application is mounted. Defaults to false. Takes precedence over chrome service visibility settings. | | [euiIconType](./kibana-plugin-public.appbase.euiicontype.md) | string | A EUI iconType that will be used for the app's icon. This icon takes precendence over the icon property. | | [icon](./kibana-plugin-public.appbase.icon.md) | string | A URL to an image file used as an icon. Used as a fallback if euiIconType is not provided. | diff --git a/docs/development/core/public/kibana-plugin-public.appcategory.arialabel.md b/docs/development/core/public/kibana-plugin-public.appcategory.arialabel.md index f539bbe54714d..0245b548ae74f 100644 --- a/docs/development/core/public/kibana-plugin-public.appcategory.arialabel.md +++ b/docs/development/core/public/kibana-plugin-public.appcategory.arialabel.md @@ -4,6 +4,8 @@ ## AppCategory.ariaLabel property +If the visual label isn't appropriate for screen readers, can override it here + Signature: ```typescript diff --git a/docs/development/core/public/kibana-plugin-public.appcategory.euiicontype.md b/docs/development/core/public/kibana-plugin-public.appcategory.euiicontype.md index 41ade296a8dc3..90133735a0082 100644 --- a/docs/development/core/public/kibana-plugin-public.appcategory.euiicontype.md +++ b/docs/development/core/public/kibana-plugin-public.appcategory.euiicontype.md @@ -4,6 +4,8 @@ ## 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 + Signature: ```typescript diff --git a/docs/development/core/public/kibana-plugin-public.appcategory.label.md b/docs/development/core/public/kibana-plugin-public.appcategory.label.md index af58b6f992085..171b1627f9ef8 100644 --- a/docs/development/core/public/kibana-plugin-public.appcategory.label.md +++ b/docs/development/core/public/kibana-plugin-public.appcategory.label.md @@ -4,6 +4,8 @@ ## AppCategory.label property +Label used for cateogry name. Also used as aria-label if one isn't set. + Signature: ```typescript diff --git a/docs/development/core/public/kibana-plugin-public.appcategory.md b/docs/development/core/public/kibana-plugin-public.appcategory.md index fa8110f3e880c..f1085e7325272 100644 --- a/docs/development/core/public/kibana-plugin-public.appcategory.md +++ b/docs/development/core/public/kibana-plugin-public.appcategory.md @@ -4,6 +4,7 @@ ## AppCategory interface +A category definition for nav links to know where to sort them in the left hand nav Signature: @@ -15,8 +16,8 @@ export interface AppCategory | Property | Type | Description | | --- | --- | --- | -| [ariaLabel](./kibana-plugin-public.appcategory.arialabel.md) | string | | -| [euiIconType](./kibana-plugin-public.appcategory.euiicontype.md) | string | | -| [label](./kibana-plugin-public.appcategory.label.md) | string | | -| [order](./kibana-plugin-public.appcategory.order.md) | number | | +| [ariaLabel](./kibana-plugin-public.appcategory.arialabel.md) | string | If the visual label isn't appropriate for screen readers, can override it here | +| [euiIconType](./kibana-plugin-public.appcategory.euiicontype.md) | string | 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) | string | Label used for cateogry name. Also used as aria-label if one isn't set. | +| [order](./kibana-plugin-public.appcategory.order.md) | number | 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) | diff --git a/docs/development/core/public/kibana-plugin-public.appcategory.order.md b/docs/development/core/public/kibana-plugin-public.appcategory.order.md index fe63d95156b99..ef17ac04b78d6 100644 --- a/docs/development/core/public/kibana-plugin-public.appcategory.order.md +++ b/docs/development/core/public/kibana-plugin-public.appcategory.order.md @@ -4,6 +4,8 @@ ## 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) + Signature: ```typescript diff --git a/docs/development/core/public/kibana-plugin-public.md b/docs/development/core/public/kibana-plugin-public.md index b59bb3ca948a3..0d26042020511 100644 --- a/docs/development/core/public/kibana-plugin-public.md +++ b/docs/development/core/public/kibana-plugin-public.md @@ -32,7 +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) | | +| [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) | | diff --git a/src/core/public/public.api.md b/src/core/public/public.api.md index 06f1aa7658b9f..77db38398e85b 100644 --- a/src/core/public/public.api.md +++ b/src/core/public/public.api.md @@ -41,15 +41,11 @@ export interface AppBase { updater$?: Observable; } -// @public (undocumented) +// @public export interface AppCategory { - // (undocumented) ariaLabel?: string; - // (undocumented) euiIconType?: string; - // (undocumented) label: string; - // (undocumented) order?: number; } @@ -435,7 +431,7 @@ export const DEFAULT_APP_CATEGORIES: Readonly<{ label: string; order: number; }; - administration: { + management: { label: string; euiIconType: string; }; diff --git a/src/core/types/app_category.ts b/src/core/types/app_category.ts index 0891fba918ee2..83a3693f009b6 100644 --- a/src/core/types/app_category.ts +++ b/src/core/types/app_category.ts @@ -18,6 +18,11 @@ */ /** @public */ + +/** + * A category definition for nav links to know where to sort them in the left hand nav + * @public + */ export interface AppCategory { /** * Label used for cateogry name. diff --git a/src/legacy/core_plugins/kibana/public/management/index.js b/src/legacy/core_plugins/kibana/public/management/index.js index 17d698e94ad3c..1305310b6f615 100644 --- a/src/legacy/core_plugins/kibana/public/management/index.js +++ b/src/legacy/core_plugins/kibana/public/management/index.js @@ -74,7 +74,7 @@ export function updateLandingPage(version) {

@@ -93,7 +93,7 @@ export function updateLandingPage(version) {

diff --git a/x-pack/test/functional/apps/graph/feature_controls/graph_spaces.ts b/x-pack/test/functional/apps/graph/feature_controls/graph_spaces.ts index c38e928b62517..d0d0232b5a8b1 100644 --- a/x-pack/test/functional/apps/graph/feature_controls/graph_spaces.ts +++ b/x-pack/test/functional/apps/graph/feature_controls/graph_spaces.ts @@ -24,7 +24,6 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { name: 'custom_space', disabledFeatures: [], }); - await PageObjects.settings.setNavType('individual'); }); after(async () => { @@ -35,6 +34,7 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { await PageObjects.common.navigateToApp('home', { basePath: '/s/custom_space', }); + await PageObjects.settings.setNavType('individual'); const navLinks = (await appsMenu.readLinks()).map(link => link.text); expect(navLinks).to.contain('Graph'); }); diff --git a/x-pack/test/functional/apps/infra/feature_controls/infrastructure_spaces.ts b/x-pack/test/functional/apps/infra/feature_controls/infrastructure_spaces.ts index 953bad1e78baa..90458ef53dfc2 100644 --- a/x-pack/test/functional/apps/infra/feature_controls/infrastructure_spaces.ts +++ b/x-pack/test/functional/apps/infra/feature_controls/infrastructure_spaces.ts @@ -42,7 +42,6 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { name: 'custom_space', disabledFeatures: [], }); - await PageObjects.settings.setNavType('individual'); }); after(async () => { @@ -54,6 +53,7 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { await PageObjects.common.navigateToApp('home', { basePath: '/s/custom_space', }); + await PageObjects.settings.setNavType('individual'); const navLinks = (await appsMenu.readLinks()).map(link => link.text); expect(navLinks).to.contain('Metrics'); }); diff --git a/x-pack/test/functional/apps/uptime/feature_controls/uptime_spaces.ts b/x-pack/test/functional/apps/uptime/feature_controls/uptime_spaces.ts index b78a5b350ad48..c3dcb1b27771f 100644 --- a/x-pack/test/functional/apps/uptime/feature_controls/uptime_spaces.ts +++ b/x-pack/test/functional/apps/uptime/feature_controls/uptime_spaces.ts @@ -20,7 +20,6 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { name: 'custom_space', disabledFeatures: [], }); - await PageObjects.settings.setNavType('individual'); }); after(async () => { @@ -31,6 +30,7 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { await PageObjects.common.navigateToApp('home', { basePath: '/s/custom_space', }); + await PageObjects.settings.setNavType('individual'); const navLinks = (await appsMenu.readLinks()).map(link => link.text); expect(navLinks).to.contain('Uptime'); }); From 06a2663cdf15275263265cb6c27436bfdf694e2f Mon Sep 17 00:00:00 2001 From: Michail Yasonik Date: Thu, 16 Jan 2020 15:01:10 -0500 Subject: [PATCH 28/31] refactoring header component to prep for writing tests --- src/core/public/chrome/ui/header/header.tsx | 461 +++++------------- .../ui/header/header_bits/header_logo.tsx | 104 ++++ .../chrome/ui/header/header_bits/index.tsx | 88 ++++ .../ui/header/header_bits/recent_links.tsx | 113 +++++ 4 files changed, 416 insertions(+), 350 deletions(-) create mode 100644 src/core/public/chrome/ui/header/header_bits/header_logo.tsx create mode 100644 src/core/public/chrome/ui/header/header_bits/index.tsx create mode 100644 src/core/public/chrome/ui/header/header_bits/recent_links.tsx diff --git a/src/core/public/chrome/ui/header/header.tsx b/src/core/public/chrome/ui/header/header.tsx index d2e1734aee7a7..27d111660f9c9 100644 --- a/src/core/public/chrome/ui/header/header.tsx +++ b/src/core/public/chrome/ui/header/header.tsx @@ -17,21 +17,14 @@ * under the License. */ -import Url from 'url'; - -import React, { Component, createRef } from 'react'; -import * as Rx from 'rxjs'; - import { // TODO: add type annotations EuiHeader, - EuiHeaderLogo, EuiHeaderSection, EuiHeaderSectionItem, EuiHeaderSectionItemButton, EuiHorizontalRule, EuiIcon, - EuiImage, // @ts-ignore EuiNavDrawer, // @ts-ignore @@ -39,165 +32,30 @@ import { // @ts-ignore EuiShowFor, } from '@elastic/eui'; - import { i18n } from '@kbn/i18n'; -import { InjectedIntl, injectI18n } from '@kbn/i18n/react'; - import { groupBy, sortBy } from 'lodash'; -import { HeaderBadge } from './header_badge'; -import { HeaderBreadcrumbs } from './header_breadcrumbs'; -import { HeaderHelpMenu } from './header_help_menu'; -import { HeaderNavControls } from './header_nav_controls'; -import { AppCategory } from '../../../../types'; - +import React, { Component, createRef } from 'react'; +import * as Rx from 'rxjs'; import { ChromeBadge, ChromeBreadcrumb, + ChromeNavControl, ChromeNavLink, ChromeRecentlyAccessedHistoryItem, - ChromeNavControl, } from '../..'; +import { AppCategory } from '../../../../types'; +import { InternalApplicationStart } from '../../../application/types'; import { HttpStart } from '../../../http'; import { ChromeHelpExtension } from '../../chrome_service'; -import { InternalApplicationStart } from '../../../application/types'; -import { CoreStart } from '../../../'; - -// Providing a buffer between the limit and the cut off index -// protects from truncating just the last couple (6) characters -const TRUNCATE_LIMIT: number = 64; -const TRUNCATE_AT: number = 58; - -/** - * @param {string} url - a relative or root relative url. If a relative path is given then the - * absolute url returned will depend on the current page where this function is called from. For example - * if you are on page "http://www.mysite.com/shopping/kids" and you pass this function "adults", you would get - * back "http://www.mysite.com/shopping/adults". If you passed this function a root relative path, or one that - * starts with a "/", for example "/account/cart", you would get back "http://www.mysite.com/account/cart". - * @return {string} the relative url transformed into an absolute url - */ -function relativeToAbsolute(url: string) { - const a = document.createElement('a'); - a.setAttribute('href', url); - return a.href; -} - -function euiRecentItem( - navLinks: ChromeNavLink[], - recentlyAccessed: ChromeRecentlyAccessedHistoryItem, - basePath: HttpStart['basePath'] -) { - const href = relativeToAbsolute(basePath.prepend(recentlyAccessed.link)); - const navLink = navLinks.find(nl => href.startsWith(nl.subUrlBase || nl.baseUrl)); - let titleAndAriaLabel = recentlyAccessed.label; - - if (navLink) { - titleAndAriaLabel = i18n.translate('core.ui.recentLinks.linkItem.screenReaderLabel', { - defaultMessage: '{recentlyAccessedItemLinklabel}, type: {pageType}', - values: { - recentlyAccessedItemLinklabel: recentlyAccessed.label, - pageType: navLink.title, - }, - }); - } - - return { - href, - label: truncateRecentItemLabel(recentlyAccessed.label), - title: titleAndAriaLabel, - 'aria-label': titleAndAriaLabel, - euiIconType: navLink?.euiIconType, - }; -} - -function euiNavLink( - navLink: ChromeNavLink, - legacyMode: boolean, - currentAppId: string | undefined, - basePath: HttpStart['basePath'], - navigateToApp: CoreStart['application']['navigateToApp'] -) { - const { - legacy, - url, - active, - baseUrl, - id, - title, - disabled, - euiIconType, - icon, - category, - order, - tooltip, - } = navLink; - let href = navLink.baseUrl; - - if (legacy) { - href = url && !active ? url : baseUrl; - } - - return { - category, - key: id, - label: tooltip ?? title, - href, // Use href and onClick to support "open in new tab" and SPA navigation in the same link - onClick(event: MouseEvent) { - if ( - !legacyMode && // ignore when in legacy mode - !legacy && // ignore links to legacy apps - !event.defaultPrevented && // onClick prevented default - event.button === 0 && // ignore everything but left clicks - !isModifiedEvent(event) // ignore clicks with modifier keys - ) { - event.preventDefault(); - navigateToApp(navLink.id); - } - }, - // Legacy apps use `active` property, NP apps should match the current app - isActive: active || currentAppId === id, - isDisabled: disabled, - iconType: euiIconType, - icon: !euiIconType && icon ? renderLinkIcon(basePath.prepend(`/${icon}`)) : undefined, - order, - 'data-test-subj': 'navDrawerAppsMenuLink', - }; -} - -function renderLinkIcon(url: string) { - return ; -} - -function isModifiedEvent(event: MouseEvent) { - return !!(event.metaKey || event.altKey || event.ctrlKey || event.shiftKey); -} - -function findClosestAnchor(element: HTMLElement): HTMLAnchorElement | void { - let current = element; - while (current) { - if (current.tagName === 'A') { - return current as HTMLAnchorElement; - } - - if (!current.parentElement || current.parentElement === document.body) { - return undefined; - } - - current = current.parentElement; - } -} - -function truncateRecentItemLabel(label: string): string { - if (label.length > TRUNCATE_LIMIT) { - label = `${label.substring(0, TRUNCATE_AT)}…`; - } - - return label; -} +import { HeaderBadge } from './header_badge'; +import { HeaderBreadcrumbs } from './header_breadcrumbs'; +import { HeaderHelpMenu } from './header_help_menu'; +import { HeaderNavControls } from './header_nav_controls'; +import { RecentLinks, NavLink, HeaderLogo, euiNavLink } from './header_bits'; -export type HeaderProps = Pick>; export type NavSetting = 'grouped' | 'individual'; -interface Props { +interface HeaderProps { kibanaVersion: string; application: InternalApplicationStart; appTitle$: Rx.Observable; @@ -214,25 +72,22 @@ interface Props { legacyMode: boolean; navControlsLeft$: Rx.Observable; navControlsRight$: Rx.Observable; - intl: InjectedIntl; basePath: HttpStart['basePath']; isLocked?: boolean; navSetting$: Rx.Observable; onIsLockedUpdate?: (isLocked: boolean) => void; } -type ExtendedRecentlyAccessedHistoryItem = ReturnType; -type NavLink = ReturnType; - interface State { appTitle: string; isVisible: boolean; - navLinks: NavLink[]; - recentlyAccessed: ExtendedRecentlyAccessedHistoryItem[]; + navLinks: ChromeNavLink[]; + recentlyAccessed: ChromeRecentlyAccessedHistoryItem[]; forceNavigation: boolean; navControlsLeft: readonly ChromeNavControl[]; navControlsRight: readonly ChromeNavControl[]; navSetting: NavSetting; + currentAppId: string | undefined; } function getAllCategories(allCategorizedLinks: Record) { @@ -255,11 +110,11 @@ function getOrderedCategories( ); } -class HeaderUI extends Component { +export class Header extends Component { private subscription?: Rx.Subscription; private navDrawerRef = createRef(); - constructor(props: Props) { + constructor(props: HeaderProps) { super(props); this.state = { @@ -271,6 +126,7 @@ class HeaderUI extends Component { navControlsLeft: [], navControlsRight: [], navSetting: 'grouped', + currentAppId: '', }; } @@ -301,23 +157,12 @@ class HeaderUI extends Component { appTitle, isVisible, forceNavigation, - navLinks: navLinks - .filter(navLink => !navLink.hidden) - .map(navLink => - euiNavLink( - navLink, - this.props.legacyMode, - currentAppId, - this.props.basePath, - this.props.application.navigateToApp - ) - ), - recentlyAccessed: recentlyAccessed.map(ra => - euiRecentItem(navLinks, ra, this.props.basePath) - ), + navLinks: navLinks.filter(navLink => !navLink.hidden), + recentlyAccessed, navControlsLeft, navControlsRight, navSetting, + currentAppId, }); }, }); @@ -329,21 +174,6 @@ class HeaderUI extends Component { } } - public renderLogo() { - const { homeHref } = this.props; - return ( - - ); - } - public renderMenuTrigger() { return ( { ); } - public renderRecentLinks() { - return ( - 0), - flyoutMenu: { - title: i18n.translate('core.ui.chrome.sideGlobalNav.viewRecentItemsFlyoutTitle', { - defaultMessage: 'Recent items', - }), - listItems: this.state.recentlyAccessed.map(item => ({ - label: truncateRecentItemLabel(item.label), - title: item.title, - 'aria-label': item.title, - href: item.href, - iconType: item.euiIconType, - })), - }, - }, - ]} - aria-label={i18n.translate('core.ui.recentLinks.screenReaderLabel', { - defaultMessage: 'Recently viewed links, navigation', - })} - /> - ); - } - - public renderNavLinks() { + public renderNavLinks(navLinks: NavLink[]) { const disableGroupedNavSetting = this.state.navSetting === 'individual'; - const groupedNavLinks = groupBy(this.state.navLinks, link => link?.category?.label); + const groupedNavLinks = groupBy(navLinks, link => link?.category?.label); const { undefined: unknowns, ...allCategorizedLinks } = groupedNavLinks; const { Management: management, ...mainCategories } = allCategorizedLinks; const categoryDictionary = getAllCategories(allCategorizedLinks); const orderedCategories = getOrderedCategories(mainCategories, categoryDictionary); const showUngroupedNav = - disableGroupedNavSetting || - this.state.navLinks.length < 7 || - Object.keys(mainCategories).length === 1; - - if (showUngroupedNav) { - return ( - - {this.renderRecentLinks()} - - - - ); - } + disableGroupedNavSetting || navLinks.length < 7 || Object.keys(mainCategories).length === 1; return ( { defaultMessage: 'Primary', })} > - {this.renderRecentLinks()} - - { - const category = categoryDictionary[categoryName]!; - const links = mainCategories[categoryName]; - - if (links.length === 1) { - return { - ...links[0], - label: category.label, - iconType: category.euiIconType || links[0].iconType, - }; - } - - return { - 'data-test-subj': 'navDrawerCategory', - iconType: category.euiIconType, - label: category.label, - flyoutMenu: { - title: category.label, - listItems: sortBy(links, 'order').map(link => { - link['data-test-subj'] = 'navDrawerFlyoutLink'; - return link; - }), - }, - }; - }), - ...sortBy(unknowns, 'order'), - ]} - /> + {RecentLinks({ + recentlyAccessedItems: this.state.recentlyAccessed, + navLinks: this.state.navLinks, + basePath: this.props.basePath, + })} - { - link['data-test-subj'] = 'navDrawerFlyoutLink'; - return link; + {showUngroupedNav ? ( + + ) : ( + <> + { + const category = categoryDictionary[categoryName]!; + const links = mainCategories[categoryName]; + + if (links.length === 1) { + return { + ...links[0], + label: category.label, + iconType: category.euiIconType || links[0].iconType, + }; + } + + return { + 'data-test-subj': 'navDrawerCategory', + iconType: category.euiIconType, + label: category.label, + flyoutMenu: { + title: category.label, + listItems: sortBy(links, 'order').map(link => { + link['data-test-subj'] = 'navDrawerFlyoutLink'; + return link; + }), + }, + }; }), - }, - }, - ]} - /> + ...sortBy(unknowns, 'order'), + ]} + /> + + { + link['data-test-subj'] = 'navDrawerFlyoutLink'; + return link; + }), + }, + }, + ]} + /> + + )} ); } @@ -505,6 +294,15 @@ class HeaderUI extends Component { kibanaDocLink, kibanaVersion, } = this.props; + const navLinks = this.state.navLinks.map(link => + euiNavLink( + link, + this.props.legacyMode, + this.state.currentAppId, + this.props.basePath, + this.props.application.navigateToApp + ) + ); if (!isVisible) { return null; @@ -518,7 +316,13 @@ class HeaderUI extends Component { {this.renderMenuTrigger()} - {this.renderLogo()} + + + @@ -543,51 +347,8 @@ class HeaderUI extends Component {
- {this.renderNavLinks()} + {this.renderNavLinks(navLinks)}
); } - - private onNavClick = (event: React.MouseEvent) => { - const anchor = findClosestAnchor((event as any).nativeEvent.target); - if (!anchor) { - return; - } - - const navLink = this.state.navLinks.find(item => item.href === anchor.href); - if (navLink && navLink.isDisabled) { - event.preventDefault(); - return; - } - - if ( - !this.state.forceNavigation || - event.isDefaultPrevented() || - event.altKey || - event.metaKey || - event.ctrlKey - ) { - return; - } - - const toParsed = Url.parse(anchor.href); - const fromParsed = Url.parse(document.location.href); - const sameProto = toParsed.protocol === fromParsed.protocol; - const sameHost = toParsed.host === fromParsed.host; - const samePath = toParsed.path === fromParsed.path; - - if (sameProto && sameHost && samePath) { - if (toParsed.hash) { - document.location.reload(); - } - - // event.preventDefault() keeps the browser from seeing the new url as an update - // and even setting window.location does not mimic that behavior, so instead - // we use stopPropagation() to prevent angular from seeing the click and - // starting a digest cycle/attempting to handle it in the router. - event.stopPropagation(); - } - }; } - -export const Header = injectI18n(HeaderUI); diff --git a/src/core/public/chrome/ui/header/header_bits/header_logo.tsx b/src/core/public/chrome/ui/header/header_bits/header_logo.tsx new file mode 100644 index 0000000000000..4e11a41f5ec65 --- /dev/null +++ b/src/core/public/chrome/ui/header/header_bits/header_logo.tsx @@ -0,0 +1,104 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import Url from 'url'; +import React from 'react'; +import { i18n } from '@kbn/i18n'; +import { EuiHeaderLogo } from '@elastic/eui'; +import { NavLink } from './'; + +function findClosestAnchor(element: HTMLElement): HTMLAnchorElement | void { + let current = element; + while (current) { + if (current.tagName === 'A') { + return current as HTMLAnchorElement; + } + + if (!current.parentElement || current.parentElement === document.body) { + return undefined; + } + + current = current.parentElement; + } +} + +function onClick( + event: React.MouseEvent, + forceNavigation: boolean, + navLinks: NavLink[] +) { + const anchor = findClosestAnchor((event as any).nativeEvent.target); + if (!anchor) { + return; + } + + const navLink = navLinks.find(item => item.href === anchor.href); + if (navLink && navLink.isDisabled) { + event.preventDefault(); + return; + } + + if ( + !forceNavigation || + event.isDefaultPrevented() || + event.altKey || + event.metaKey || + event.ctrlKey + ) { + return; + } + + const toParsed = Url.parse(anchor.href); + const fromParsed = Url.parse(document.location.href); + const sameProto = toParsed.protocol === fromParsed.protocol; + const sameHost = toParsed.host === fromParsed.host; + const samePath = toParsed.path === fromParsed.path; + + if (sameProto && sameHost && samePath) { + if (toParsed.hash) { + document.location.reload(); + } + + // event.preventDefault() keeps the browser from seeing the new url as an update + // and even setting window.location does not mimic that behavior, so instead + // we use stopPropagation() to prevent angular from seeing the click and + // starting a digest cycle/attempting to handle it in the router. + event.stopPropagation(); + } +} + +interface Props { + href: string; + navLinks: NavLink[]; + forceNavigation: boolean; +} + +export function HeaderLogo({ href, forceNavigation, navLinks }: Props) { + return ( + onClick(e, forceNavigation, navLinks)} + href={href} + aria-label={i18n.translate('core.ui.chrome.headerGlobalNav.goHomePageIconAriaLabel', { + defaultMessage: 'Go to home page', + })} + /> + ); +} diff --git a/src/core/public/chrome/ui/header/header_bits/index.tsx b/src/core/public/chrome/ui/header/header_bits/index.tsx new file mode 100644 index 0000000000000..cdcc65a2b3d9e --- /dev/null +++ b/src/core/public/chrome/ui/header/header_bits/index.tsx @@ -0,0 +1,88 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import React from 'react'; +import { EuiImage } from '@elastic/eui'; +import { ChromeNavLink, CoreStart } from '../../../../'; +import { HttpStart } from '../../../../http'; + +function isModifiedEvent(event: MouseEvent) { + return !!(event.metaKey || event.altKey || event.ctrlKey || event.shiftKey); +} + +export function LinkIcon({ url }: { url: string }) { + return ; +} + +export { HeaderLogo } from './header_logo'; +export { RecentLinks } from './recent_links'; +export type NavLink = ReturnType; +export function euiNavLink( + navLink: ChromeNavLink, + legacyMode: boolean, + currentAppId: string | undefined, + basePath: HttpStart['basePath'], + navigateToApp: CoreStart['application']['navigateToApp'] +) { + const { + legacy, + url, + active, + baseUrl, + id, + title, + disabled, + euiIconType, + icon, + category, + order, + tooltip, + } = navLink; + let href = navLink.baseUrl; + + if (legacy) { + href = url && !active ? url : baseUrl; + } + + return { + category, + key: id, + label: tooltip ?? title, + href, // Use href and onClick to support "open in new tab" and SPA navigation in the same link + onClick(event: MouseEvent) { + if ( + !legacyMode && // ignore when in legacy mode + !legacy && // ignore links to legacy apps + !event.defaultPrevented && // onClick prevented default + event.button === 0 && // ignore everything but left clicks + !isModifiedEvent(event) // ignore clicks with modifier keys + ) { + event.preventDefault(); + navigateToApp(navLink.id); + } + }, + // Legacy apps use `active` property, NP apps should match the current app + isActive: active || currentAppId === id, + isDisabled: disabled, + iconType: euiIconType, + icon: !euiIconType && icon ? : undefined, + order, + 'data-test-subj': 'navDrawerAppsMenuLink', + }; +} diff --git a/src/core/public/chrome/ui/header/header_bits/recent_links.tsx b/src/core/public/chrome/ui/header/header_bits/recent_links.tsx new file mode 100644 index 0000000000000..b5e5709959048 --- /dev/null +++ b/src/core/public/chrome/ui/header/header_bits/recent_links.tsx @@ -0,0 +1,113 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import React from 'react'; +import { i18n } from '@kbn/i18n'; +// @ts-ignore +import { EuiNavDrawerGroup } from '@elastic/eui'; +import { ChromeNavLink, ChromeRecentlyAccessedHistoryItem } from '../../..'; +import { HttpStart } from '../../../../http'; + +// Providing a buffer between the limit and the cut off index +// protects from truncating just the last couple (6) characters +const TRUNCATE_LIMIT: number = 64; +const TRUNCATE_AT: number = 58; + +export function truncateRecentItemLabel(label: string): string { + if (label.length > TRUNCATE_LIMIT) { + label = `${label.substring(0, TRUNCATE_AT)}…`; + } + + return label; +} + +/** + * @param {string} url - a relative or root relative url. If a relative path is given then the + * absolute url returned will depend on the current page where this function is called from. For example + * if you are on page "http://www.mysite.com/shopping/kids" and you pass this function "adults", you would get + * back "http://www.mysite.com/shopping/adults". If you passed this function a root relative path, or one that + * starts with a "/", for example "/account/cart", you would get back "http://www.mysite.com/account/cart". + * @return {string} the relative url transformed into an absolute url + */ +function relativeToAbsolute(url: string) { + const a = document.createElement('a'); + a.setAttribute('href', url); + return a.href; +} + +function prepareForEUI( + recentlyAccessed: ChromeRecentlyAccessedHistoryItem[], + navLinks: ChromeNavLink[], + basePath: HttpStart['basePath'] +) { + return recentlyAccessed.map(({ link, label }) => { + const href = relativeToAbsolute(basePath.prepend(link)); + const navLink = navLinks.find(nl => href.startsWith(nl.baseUrl ?? nl.subUrlBase)); + let titleAndAriaLabel = label; + + if (navLink) { + titleAndAriaLabel = i18n.translate('core.ui.recentLinks.linkItem.screenReaderLabel', { + defaultMessage: '{recentlyAccessedItemLinklabel}, type: {pageType}', + values: { + recentlyAccessedItemLinklabel: label, + pageType: navLink.title, + }, + }); + } + + return { + href, + label: truncateRecentItemLabel(label), + title: titleAndAriaLabel, + 'aria-label': titleAndAriaLabel, + iconType: navLink?.euiIconType, + }; + }); +} + +interface Props { + recentlyAccessedItems: ChromeRecentlyAccessedHistoryItem[]; + navLinks: ChromeNavLink[]; + basePath: HttpStart['basePath']; +} + +export function RecentLinks({ recentlyAccessedItems, navLinks, basePath }: Props) { + return ( + + ); +} From 7cd30ee0a1f9b4a158898cea7d3e238d56190b34 Mon Sep 17 00:00:00 2001 From: Michail Yasonik Date: Thu, 16 Jan 2020 16:39:27 -0500 Subject: [PATCH 29/31] i18n fix --- .../management_sidebar_nav/management_sidebar_nav.tsx | 3 ++- src/plugins/management/public/legacy/sections_register.js | 4 +++- src/plugins/management/public/management_app.tsx | 3 ++- x-pack/plugins/translations/translations/ja-JP.json | 5 +---- x-pack/plugins/translations/translations/zh-CN.json | 5 +---- 5 files changed, 9 insertions(+), 11 deletions(-) diff --git a/src/plugins/management/public/components/management_sidebar_nav/management_sidebar_nav.tsx b/src/plugins/management/public/components/management_sidebar_nav/management_sidebar_nav.tsx index 7783cd6a417cd..69ba813d2347e 100644 --- a/src/plugins/management/public/components/management_sidebar_nav/management_sidebar_nav.tsx +++ b/src/plugins/management/public/components/management_sidebar_nav/management_sidebar_nav.tsx @@ -167,7 +167,8 @@ export class ManagementSidebarNav extends React.Component< <>

- {i18n.translate('stackManagement.nav.label', { + {i18n.translate('management.nav.label', { + // todo defaultMessage: 'Stack Management', })}

diff --git a/src/plugins/management/public/legacy/sections_register.js b/src/plugins/management/public/legacy/sections_register.js index 2b989c15272f4..ca35db56c340b 100644 --- a/src/plugins/management/public/legacy/sections_register.js +++ b/src/plugins/management/public/legacy/sections_register.js @@ -24,9 +24,10 @@ export class LegacyManagementAdapter { main = undefined; init = capabilities => { this.main = new LegacyManagementSection( - 'management', // @myasonik ?? + 'management', { display: i18n.translate('management.displayName', { + // todo defaultMessage: 'Stack Management', }), }, @@ -35,6 +36,7 @@ export class LegacyManagementAdapter { this.main.register('data', { display: i18n.translate('management.connectDataDisplayName', { + // todo defaultMessage: 'Connect Data', }), order: 0, diff --git a/src/plugins/management/public/management_app.tsx b/src/plugins/management/public/management_app.tsx index d95e3e6d31296..30e00ba7df525 100644 --- a/src/plugins/management/public/management_app.tsx +++ b/src/plugins/management/public/management_app.tsx @@ -58,7 +58,8 @@ export class ManagementApp { const [coreStart] = await getStartServices(); coreStart.chrome.setBreadcrumbs([ { - text: i18n.translate('stackManagement.breadcrumb', { + text: i18n.translate('management.breadcrumb', { + // todo defaultMessage: 'Stack Management', }), href: '#/management', diff --git a/x-pack/plugins/translations/translations/ja-JP.json b/x-pack/plugins/translations/translations/ja-JP.json index b1aabe44433c4..5222781898862 100644 --- a/x-pack/plugins/translations/translations/ja-JP.json +++ b/x-pack/plugins/translations/translations/ja-JP.json @@ -452,7 +452,6 @@ "common.ui.flotCharts.thuLabel": "木", "common.ui.flotCharts.tueLabel": "火", "common.ui.flotCharts.wedLabel": "水", - "common.ui.management.breadcrumb": "管理", "common.ui.modals.cancelButtonLabel": "キャンセル", "common.ui.notify.fatalError.errorStatusMessage": "エラー {errStatus} {errStatusText}: {errMessage}", "common.ui.notify.fatalError.unavailableServerErrorMessage": "HTTP リクエストが接続に失敗しました。Kibana サーバーが実行されていて、ご使用のブラウザの接続が正常に動作していることを確認するか、システム管理者にお問い合わせください。", @@ -1905,8 +1904,6 @@ "kbn.management.landing.header": "Kibana {version} 管理", "kbn.management.landing.subhead": "インデックス、インデックスパターン、保存されたオブジェクト、Kibana の設定、その他を管理します。", "kbn.management.landing.text": "すべてのツールの一覧は、左のメニューにあります。", - "kbn.management.managementDescription": "Elastic Stack の管理を行うセンターコンソールです。", - "kbn.management.managementLabel": "管理", "kbn.management.objects.confirmModalOptions.deleteButtonLabel": "削除", "kbn.management.objects.confirmModalOptions.modalDescription": "削除されたオブジェクトは復元できません", "kbn.management.objects.confirmModalOptions.modalTitle": "保存された Kibana オブジェクトを削除しますか?", @@ -13243,4 +13240,4 @@ "xpack.watcher.watchEdit.thresholdWatchExpression.aggType.fieldIsRequiredValidationMessage": "フィールドを選択してください。", "xpack.watcher.watcherDescription": "アラートの作成、管理、監視によりデータへの変更を検知します。" } -} +} \ No newline at end of file diff --git a/x-pack/plugins/translations/translations/zh-CN.json b/x-pack/plugins/translations/translations/zh-CN.json index 5521e414c4270..6374e9d1eef1c 100644 --- a/x-pack/plugins/translations/translations/zh-CN.json +++ b/x-pack/plugins/translations/translations/zh-CN.json @@ -452,7 +452,6 @@ "common.ui.flotCharts.thuLabel": "周四", "common.ui.flotCharts.tueLabel": "周二", "common.ui.flotCharts.wedLabel": "周三", - "common.ui.management.breadcrumb": "管理", "common.ui.modals.cancelButtonLabel": "取消", "common.ui.notify.fatalError.errorStatusMessage": "错误 {errStatus} {errStatusText}:{errMessage}", "common.ui.notify.fatalError.unavailableServerErrorMessage": "HTTP 请求无法连接。请检查 Kibana 服务器是否正在运行以及您的浏览器是否具有有效的连接,或请联系您的系统管理员。", @@ -1905,8 +1904,6 @@ "kbn.management.landing.header": "Kibana {version} 管理", "kbn.management.landing.subhead": "管理您的索引、索引模式、已保存对象、Kibana 设置等等。", "kbn.management.landing.text": "在左侧菜单中可找到完整工具列表", - "kbn.management.managementDescription": "您用于管理 Elastic Stack 的中心控制台。", - "kbn.management.managementLabel": "管理", "kbn.management.objects.confirmModalOptions.deleteButtonLabel": "删除", "kbn.management.objects.confirmModalOptions.modalDescription": "您无法恢复删除的对象", "kbn.management.objects.confirmModalOptions.modalTitle": "删除已保存 Kibana 对象?", @@ -13242,4 +13239,4 @@ "xpack.watcher.watchEdit.thresholdWatchExpression.aggType.fieldIsRequiredValidationMessage": "此字段必填。", "xpack.watcher.watcherDescription": "通过创建、管理和监测警报来检测数据中的更改。" } -} +} \ No newline at end of file From 3110e0af534c6328abeca528dccfda646fb6b5fb Mon Sep 17 00:00:00 2001 From: Michail Yasonik Date: Fri, 17 Jan 2020 18:40:37 -0500 Subject: [PATCH 30/31] adding tests to header component --- .../__snapshots__/nav_drawer.test.tsx.snap | 5224 +++++++++++++++++ src/core/public/chrome/ui/header/header.tsx | 146 +- .../header/{header_bits => }/header_logo.tsx | 2 +- src/core/public/chrome/ui/header/index.ts | 2 + .../chrome/ui/header/nav_drawer.test.tsx | 103 + .../public/chrome/ui/header/nav_drawer.tsx | 170 + .../{header_bits/index.tsx => nav_link.tsx} | 9 +- .../header/{header_bits => }/recent_links.tsx | 2 +- 8 files changed, 5521 insertions(+), 137 deletions(-) create mode 100644 src/core/public/chrome/ui/header/__snapshots__/nav_drawer.test.tsx.snap rename src/core/public/chrome/ui/header/{header_bits => }/header_logo.tsx (98%) create mode 100644 src/core/public/chrome/ui/header/nav_drawer.test.tsx create mode 100644 src/core/public/chrome/ui/header/nav_drawer.tsx rename src/core/public/chrome/ui/header/{header_bits/index.tsx => nav_link.tsx} (91%) rename src/core/public/chrome/ui/header/{header_bits => }/recent_links.tsx (98%) diff --git a/src/core/public/chrome/ui/header/__snapshots__/nav_drawer.test.tsx.snap b/src/core/public/chrome/ui/header/__snapshots__/nav_drawer.test.tsx.snap new file mode 100644 index 0000000000000..0ebc44ba67862 --- /dev/null +++ b/src/core/public/chrome/ui/header/__snapshots__/nav_drawer.test.tsx.snap @@ -0,0 +1,5224 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`NavDrawer Advanced setting set to grouped renders grouped items 1`] = ` + + + + + + + +`; + +exports[`NavDrawer Advanced setting set to grouped renders individual items if there are less than 7 1`] = ` + + + + + + + +`; + +exports[`NavDrawer Advanced setting set to grouped renders individual items if there is only 1 category 1`] = ` + + + + + + + +`; + +exports[`NavDrawer Advanced setting set to individual renders individual items 1`] = ` + + + + + + + +`; diff --git a/src/core/public/chrome/ui/header/header.tsx b/src/core/public/chrome/ui/header/header.tsx index 27d111660f9c9..c3cefd180b16f 100644 --- a/src/core/public/chrome/ui/header/header.tsx +++ b/src/core/public/chrome/ui/header/header.tsx @@ -18,22 +18,17 @@ */ import { - // TODO: add type annotations EuiHeader, EuiHeaderSection, EuiHeaderSectionItem, EuiHeaderSectionItemButton, - EuiHorizontalRule, EuiIcon, // @ts-ignore EuiNavDrawer, // @ts-ignore - EuiNavDrawerGroup, - // @ts-ignore EuiShowFor, } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; -import { groupBy, sortBy } from 'lodash'; import React, { Component, createRef } from 'react'; import * as Rx from 'rxjs'; import { @@ -43,19 +38,19 @@ import { ChromeNavLink, ChromeRecentlyAccessedHistoryItem, } from '../..'; -import { AppCategory } from '../../../../types'; import { InternalApplicationStart } from '../../../application/types'; import { HttpStart } from '../../../http'; import { ChromeHelpExtension } from '../../chrome_service'; import { HeaderBadge } from './header_badge'; +import { NavSetting, OnIsLockedUpdate } from './'; import { HeaderBreadcrumbs } from './header_breadcrumbs'; import { HeaderHelpMenu } from './header_help_menu'; import { HeaderNavControls } from './header_nav_controls'; -import { RecentLinks, NavLink, HeaderLogo, euiNavLink } from './header_bits'; - -export type NavSetting = 'grouped' | 'individual'; +import { euiNavLink } from './nav_link'; +import { HeaderLogo } from './header_logo'; +import { NavDrawer } from './nav_drawer'; -interface HeaderProps { +export interface HeaderProps { kibanaVersion: string; application: InternalApplicationStart; appTitle$: Rx.Observable; @@ -75,7 +70,7 @@ interface HeaderProps { basePath: HttpStart['basePath']; isLocked?: boolean; navSetting$: Rx.Observable; - onIsLockedUpdate?: (isLocked: boolean) => void; + onIsLockedUpdate?: OnIsLockedUpdate; } interface State { @@ -90,26 +85,6 @@ interface State { currentAppId: string | undefined; } -function getAllCategories(allCategorizedLinks: Record) { - const allCategories = {} as Record; - - for (const [key, value] of Object.entries(allCategorizedLinks)) { - allCategories[key] = value[0].category; - } - - return allCategories; -} - -function getOrderedCategories( - mainCategories: Record, - categoryDictionary: ReturnType -) { - return sortBy( - Object.keys(mainCategories), - categoryName => categoryDictionary[categoryName]?.order - ); -} - export class Header extends Component { private subscription?: Rx.Subscription; private navDrawerRef = createRef(); @@ -187,103 +162,6 @@ export class Header extends Component { ); } - public renderNavLinks(navLinks: NavLink[]) { - const disableGroupedNavSetting = this.state.navSetting === 'individual'; - const groupedNavLinks = groupBy(navLinks, link => link?.category?.label); - const { undefined: unknowns, ...allCategorizedLinks } = groupedNavLinks; - const { Management: management, ...mainCategories } = allCategorizedLinks; - const categoryDictionary = getAllCategories(allCategorizedLinks); - const orderedCategories = getOrderedCategories(mainCategories, categoryDictionary); - const showUngroupedNav = - disableGroupedNavSetting || navLinks.length < 7 || Object.keys(mainCategories).length === 1; - - return ( - - {RecentLinks({ - recentlyAccessedItems: this.state.recentlyAccessed, - navLinks: this.state.navLinks, - basePath: this.props.basePath, - })} - - {showUngroupedNav ? ( - - ) : ( - <> - { - const category = categoryDictionary[categoryName]!; - const links = mainCategories[categoryName]; - - if (links.length === 1) { - return { - ...links[0], - label: category.label, - iconType: category.euiIconType || links[0].iconType, - }; - } - - return { - 'data-test-subj': 'navDrawerCategory', - iconType: category.euiIconType, - label: category.label, - flyoutMenu: { - title: category.label, - listItems: sortBy(links, 'order').map(link => { - link['data-test-subj'] = 'navDrawerFlyoutLink'; - return link; - }), - }, - }; - }), - ...sortBy(unknowns, 'order'), - ]} - /> - - { - link['data-test-subj'] = 'navDrawerFlyoutLink'; - return link; - }), - }, - }, - ]} - /> - - )} - - ); - } - public render() { const { appTitle, isVisible, navControlsLeft, navControlsRight } = this.state; const { @@ -346,8 +224,16 @@ export class Header extends Component {
- - {this.renderNavLinks(navLinks)} +
); } diff --git a/src/core/public/chrome/ui/header/header_bits/header_logo.tsx b/src/core/public/chrome/ui/header/header_logo.tsx similarity index 98% rename from src/core/public/chrome/ui/header/header_bits/header_logo.tsx rename to src/core/public/chrome/ui/header/header_logo.tsx index 4e11a41f5ec65..793b8646dabf7 100644 --- a/src/core/public/chrome/ui/header/header_bits/header_logo.tsx +++ b/src/core/public/chrome/ui/header/header_logo.tsx @@ -21,7 +21,7 @@ import Url from 'url'; import React from 'react'; import { i18n } from '@kbn/i18n'; import { EuiHeaderLogo } from '@elastic/eui'; -import { NavLink } from './'; +import { NavLink } from './nav_link'; function findClosestAnchor(element: HTMLElement): HTMLAnchorElement | void { let current = element; diff --git a/src/core/public/chrome/ui/header/index.ts b/src/core/public/chrome/ui/header/index.ts index 6d59fc6d9433b..b396c94b3f2a3 100644 --- a/src/core/public/chrome/ui/header/index.ts +++ b/src/core/public/chrome/ui/header/index.ts @@ -26,3 +26,5 @@ export { ChromeHelpExtensionMenuDocumentationLink, ChromeHelpExtensionMenuGitHubLink, } from './header_help_menu'; +export type NavSetting = 'grouped' | 'individual'; +export type OnIsLockedUpdate = (isLocked: boolean) => void; diff --git a/src/core/public/chrome/ui/header/nav_drawer.test.tsx b/src/core/public/chrome/ui/header/nav_drawer.test.tsx new file mode 100644 index 0000000000000..7272935b93a52 --- /dev/null +++ b/src/core/public/chrome/ui/header/nav_drawer.test.tsx @@ -0,0 +1,103 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import { cloneDeep } from 'lodash'; +import { mount } from 'enzyme'; +import React from 'react'; +import { NavSetting } from './'; +import { ChromeNavLink } from '../../../'; +import { AppCategory } from 'src/core/types'; +import { DEFAULT_APP_CATEGORIES } from '../../../../utils'; +import { NavDrawer } from './nav_drawer'; +import { euiNavLink } from './nav_link'; + +const { analyze, management, observability, security } = DEFAULT_APP_CATEGORIES; +const mockIBasePath = { + get: () => '/app', + prepend: () => '/app', + remove: () => '/app', +}; + +const getMockProps = (chromeNavLinks: ChromeNavLink[], navSetting: NavSetting = 'grouped') => ({ + navSetting, + navLinks: chromeNavLinks.map(link => + euiNavLink(link, true, undefined, mockIBasePath, () => Promise.resolve()) + ), + chromeNavLinks, + recentlyAccessedItems: [], + basePath: mockIBasePath, +}); + +const makeLink = (id: string, order: number, category?: AppCategory) => ({ + id, + category, + order, + title: id, + baseUrl: `http://localhost:5601/app/${id}`, + legacy: true, +}); + +const getMockChromeNavLink = () => + cloneDeep([ + makeLink('discover', 100, analyze), + makeLink('siem', 500, security), + makeLink('metrics', 600, observability), + makeLink('monitoring', 800, management), + makeLink('visualize', 200, analyze), + makeLink('dashboard', 300, analyze), + makeLink('canvas', 400, { label: 'customCategory' }), + makeLink('logs', 700, observability), + ]); + +describe('NavDrawer', () => { + describe('Advanced setting set to individual', () => { + it('renders individual items', () => { + const component = mount( + + ); + expect(component).toMatchSnapshot(); + }); + }); + describe('Advanced setting set to grouped', () => { + it('renders individual items if there are less than 7', () => { + const links = getMockChromeNavLink().slice(0, 5); + const component = mount(); + expect(component).toMatchSnapshot(); + }); + it('renders individual items if there is only 1 category', () => { + // management doesn't count as a category + const navLinks = [ + makeLink('discover', 100, analyze), + makeLink('siem', 500, analyze), + makeLink('metrics', 600, analyze), + makeLink('monitoring', 800, analyze), + makeLink('visualize', 200, analyze), + makeLink('dashboard', 300, management), + makeLink('canvas', 400, management), + makeLink('logs', 700, management), + ]; + const component = mount(); + expect(component).toMatchSnapshot(); + }); + it('renders grouped items', () => { + const component = mount(); + expect(component).toMatchSnapshot(); + }); + }); +}); diff --git a/src/core/public/chrome/ui/header/nav_drawer.tsx b/src/core/public/chrome/ui/header/nav_drawer.tsx new file mode 100644 index 0000000000000..dbb68d5dd3901 --- /dev/null +++ b/src/core/public/chrome/ui/header/nav_drawer.tsx @@ -0,0 +1,170 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import React from 'react'; +import { groupBy, sortBy } from 'lodash'; +import { i18n } from '@kbn/i18n'; +// @ts-ignore +import { EuiNavDrawer, EuiHorizontalRule, EuiNavDrawerGroup } from '@elastic/eui'; +import { NavSetting, OnIsLockedUpdate } from './'; +import { ChromeNavLink, ChromeRecentlyAccessedHistoryItem } from '../../..'; +import { AppCategory } from '../../../../types'; +import { HttpStart } from '../../../http'; +import { NavLink } from './nav_link'; +import { RecentLinks } from './recent_links'; + +function getAllCategories(allCategorizedLinks: Record) { + const allCategories = {} as Record; + + for (const [key, value] of Object.entries(allCategorizedLinks)) { + allCategories[key] = value[0].category; + } + + return allCategories; +} + +function getOrderedCategories( + mainCategories: Record, + categoryDictionary: ReturnType +) { + return sortBy( + Object.keys(mainCategories), + categoryName => categoryDictionary[categoryName]?.order + ); +} + +export interface Props { + navSetting: NavSetting; + isLocked?: boolean; + onIsLockedUpdate?: OnIsLockedUpdate; + navLinks: NavLink[]; + chromeNavLinks: ChromeNavLink[]; + recentlyAccessedItems: ChromeRecentlyAccessedHistoryItem[]; + basePath: HttpStart['basePath']; +} + +function navDrawerRenderer( + { + navSetting, + isLocked, + onIsLockedUpdate, + navLinks, + chromeNavLinks, + recentlyAccessedItems, + basePath, + }: Props, + ref: React.Ref +) { + const disableGroupedNavSetting = navSetting === 'individual'; + const groupedNavLinks = groupBy(navLinks, link => link?.category?.label); + const { undefined: unknowns, ...allCategorizedLinks } = groupedNavLinks; + const { Management: management, ...mainCategories } = allCategorizedLinks; + const categoryDictionary = getAllCategories(allCategorizedLinks); + const orderedCategories = getOrderedCategories(mainCategories, categoryDictionary); + const showUngroupedNav = + disableGroupedNavSetting || navLinks.length < 7 || Object.keys(mainCategories).length === 1; + + return ( + + {RecentLinks({ + recentlyAccessedItems, + navLinks: chromeNavLinks, + basePath, + })} + + {showUngroupedNav ? ( + + ) : ( + <> + { + const category = categoryDictionary[categoryName]!; + const links = mainCategories[categoryName]; + + if (links.length === 1) { + return { + ...links[0], + label: category.label, + iconType: category.euiIconType || links[0].iconType, + }; + } + + return { + 'data-test-subj': 'navDrawerCategory', + iconType: category.euiIconType, + label: category.label, + flyoutMenu: { + title: category.label, + listItems: sortBy(links, 'order').map(link => { + link['data-test-subj'] = 'navDrawerFlyoutLink'; + return link; + }), + }, + }; + }), + ...sortBy(unknowns, 'order'), + ]} + /> + + { + link['data-test-subj'] = 'navDrawerFlyoutLink'; + return link; + }), + }, + }, + ]} + /> + + )} + + ); +} + +export const NavDrawer = React.forwardRef(navDrawerRenderer); diff --git a/src/core/public/chrome/ui/header/header_bits/index.tsx b/src/core/public/chrome/ui/header/nav_link.tsx similarity index 91% rename from src/core/public/chrome/ui/header/header_bits/index.tsx rename to src/core/public/chrome/ui/header/nav_link.tsx index cdcc65a2b3d9e..52b59c53b658c 100644 --- a/src/core/public/chrome/ui/header/header_bits/index.tsx +++ b/src/core/public/chrome/ui/header/nav_link.tsx @@ -19,20 +19,19 @@ import React from 'react'; import { EuiImage } from '@elastic/eui'; -import { ChromeNavLink, CoreStart } from '../../../../'; -import { HttpStart } from '../../../../http'; +import { ChromeNavLink, CoreStart } from '../../../'; +import { HttpStart } from '../../../http'; function isModifiedEvent(event: MouseEvent) { return !!(event.metaKey || event.altKey || event.ctrlKey || event.shiftKey); } -export function LinkIcon({ url }: { url: string }) { +function LinkIcon({ url }: { url: string }) { return ; } -export { HeaderLogo } from './header_logo'; -export { RecentLinks } from './recent_links'; export type NavLink = ReturnType; + export function euiNavLink( navLink: ChromeNavLink, legacyMode: boolean, diff --git a/src/core/public/chrome/ui/header/header_bits/recent_links.tsx b/src/core/public/chrome/ui/header/recent_links.tsx similarity index 98% rename from src/core/public/chrome/ui/header/header_bits/recent_links.tsx rename to src/core/public/chrome/ui/header/recent_links.tsx index b5e5709959048..a947ab1c45056 100644 --- a/src/core/public/chrome/ui/header/header_bits/recent_links.tsx +++ b/src/core/public/chrome/ui/header/recent_links.tsx @@ -22,7 +22,7 @@ import { i18n } from '@kbn/i18n'; // @ts-ignore import { EuiNavDrawerGroup } from '@elastic/eui'; import { ChromeNavLink, ChromeRecentlyAccessedHistoryItem } from '../../..'; -import { HttpStart } from '../../../../http'; +import { HttpStart } from '../../../http'; // Providing a buffer between the limit and the cut off index // protects from truncating just the last couple (6) characters From fe9f10d4e543851b5a5f59bfd6107f1a1a9e114b Mon Sep 17 00:00:00 2001 From: Michail Yasonik Date: Fri, 17 Jan 2020 22:55:27 -0500 Subject: [PATCH 31/31] fixing type error --- test/functional/page_objects/settings_page.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/functional/page_objects/settings_page.ts b/test/functional/page_objects/settings_page.ts index 8e96fff7e7d66..e92780143f09a 100644 --- a/test/functional/page_objects/settings_page.ts +++ b/test/functional/page_objects/settings_page.ts @@ -19,7 +19,7 @@ import { map as mapAsync } from 'bluebird'; import expect from '@kbn/expect'; -import { NavSetting } from '../../../src/core/public/chrome/ui/header/header'; +import { NavSetting } from '../../../src/core/public/chrome/ui/header/'; import { FtrProviderContext } from '../ftr_provider_context'; export function SettingsPageProvider({ getService, getPageObjects }: FtrProviderContext) {