Skip to content

Commit

Permalink
Merge branch 'master' into pr-67452-safer
Browse files Browse the repository at this point in the history
  • Loading branch information
azasypkin committed Jul 14, 2020
2 parents 41c6acf + b48162b commit daf8eb0
Show file tree
Hide file tree
Showing 368 changed files with 8,642 additions and 1,918 deletions.
2 changes: 1 addition & 1 deletion docs/api/saved-objects/bulk_get.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ experimental[] Retrieve multiple {kib} saved objects by ID.
(Required, string) ID of the retrieved object. The ID includes the {kib} unique identifier or a custom identifier.

`fields`::
(Optional, array) The fields returned in the object response.
(Optional, array) The fields to return in the `attributes` key of the object response.

[[saved-objects-api-bulk-get-response-body]]
==== Response body
Expand Down
2 changes: 1 addition & 1 deletion docs/api/saved-objects/find.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ experimental[] Retrieve a paginated set of {kib} saved objects by various condit
(Optional, array|string) The fields to perform the `simple_query_string` parsed query against.

`fields`::
(Optional, array|string) The fields to return in the response.
(Optional, array|string) The fields to return in the `attributes` key of the response.

`sort_field`::
(Optional, string) The field that sorts the response.
Expand Down
2 changes: 1 addition & 1 deletion docs/management/advanced-options.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ retrieved.
`timelion:es.timefield`:: The default field containing a timestamp when using the `.es()` query.
`timelion:graphite.url`:: [experimental] Used with graphite queries, this is the URL of your graphite host
in the form https://www.hostedgraphite.com/UID/ACCESS_KEY/graphite. This URL can be
selected from a whitelist configured in the `kibana.yml` under `timelion.graphiteUrls`.
selected from an allow-list configured in the `kibana.yml` under `timelion.graphiteUrls`.
`timelion:max_buckets`:: The maximum number of buckets a single data source can return.
This value is used for calculating automatic intervals in visualizations.
`timelion:min_interval`:: The smallest interval to calculate when using "auto".
Expand Down
2 changes: 1 addition & 1 deletion src/core/MIGRATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -942,7 +942,7 @@ export class MyPlugin implements Plugin<MyPluginSetup> {
return mountApp(await core.getStartServices(), params);
},
});
plugins.management.sections.getSection('another').registerApp({
plugins.management.sections.section.kibana.registerApp({
id: 'app',
title: 'My app',
order: 1,
Expand Down
3 changes: 1 addition & 2 deletions src/plugins/advanced_settings/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
*/
import { i18n } from '@kbn/i18n';
import { CoreSetup, Plugin } from 'kibana/public';
import { ManagementSectionId } from '../../management/public';
import { ComponentRegistry } from './component_registry';
import { AdvancedSettingsSetup, AdvancedSettingsStart, AdvancedSettingsPluginSetup } from './types';

Expand All @@ -31,7 +30,7 @@ const title = i18n.translate('advancedSettings.advancedSettingsLabel', {
export class AdvancedSettingsPlugin
implements Plugin<AdvancedSettingsSetup, AdvancedSettingsStart, AdvancedSettingsPluginSetup> {
public setup(core: CoreSetup, { management }: AdvancedSettingsPluginSetup) {
const kibanaSection = management.sections.getSection(ManagementSectionId.Kibana);
const kibanaSection = management.sections.section.kibana;

kibanaSection.registerApp({
id: 'settings',
Expand Down
4 changes: 2 additions & 2 deletions src/plugins/index_pattern_management/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import {
IndexPatternManagementServiceStart,
} from './service';

import { ManagementSetup, ManagementSectionId } from '../../management/public';
import { ManagementSetup } from '../../management/public';

export interface IndexPatternManagementSetupDependencies {
management: ManagementSetup;
Expand Down Expand Up @@ -64,7 +64,7 @@ export class IndexPatternManagementPlugin
core: CoreSetup<IndexPatternManagementStartDependencies, IndexPatternManagementStart>,
{ management, kibanaLegacy }: IndexPatternManagementSetupDependencies
) {
const kibanaSection = management.sections.getSection(ManagementSectionId.Kibana);
const kibanaSection = management.sections.section.kibana;

if (!kibanaSection) {
throw new Error('`kibana` management section not found.');
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/management/kibana.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
"server": true,
"ui": true,
"requiredPlugins": ["kibanaLegacy", "home"],
"requiredBundles": ["kibanaReact"]
"requiredBundles": ["kibanaReact", "kibanaUtils"]
}
10 changes: 2 additions & 8 deletions src/plugins/management/public/application.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,15 @@
import React from 'react';
import ReactDOM from 'react-dom';

import { AppMountContext, AppMountParameters } from 'kibana/public';
import { AppMountParameters } from 'kibana/public';
import { ManagementApp, ManagementAppDependencies } from './components/management_app';

export const renderApp = async (
context: AppMountContext,
{ history, appBasePath, element }: AppMountParameters,
dependencies: ManagementAppDependencies
) => {
ReactDOM.render(
<ManagementApp
context={context}
dependencies={dependencies}
appBasePath={appBasePath}
history={history}
/>,
<ManagementApp dependencies={dependencies} appBasePath={appBasePath} history={history} />,
element
);

Expand Down
1 change: 0 additions & 1 deletion src/plugins/management/public/components/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,3 @@
*/

export { ManagementApp } from './management_app';
export { managementSections } from './management_sections';
Original file line number Diff line number Diff line change
Expand Up @@ -17,36 +17,32 @@
* under the License.
*/
import React, { useState, useEffect, useCallback } from 'react';
import {
AppMountContext,
AppMountParameters,
ChromeBreadcrumb,
ScopedHistory,
} from 'kibana/public';
import { AppMountParameters, ChromeBreadcrumb, ScopedHistory } from 'kibana/public';
import { I18nProvider } from '@kbn/i18n/react';
import { EuiPage } from '@elastic/eui';
import { ManagementStart } from '../../types';
import { ManagementSection, MANAGEMENT_BREADCRUMB } from '../../utils';

import { ManagementRouter } from './management_router';
import { ManagementSidebarNav } from '../management_sidebar_nav';
import { reactRouterNavigate } from '../../../../kibana_react/public';
import { SectionsServiceStart } from '../../types';

import './management_app.scss';

interface ManagementAppProps {
appBasePath: string;
context: AppMountContext;
history: AppMountParameters['history'];
dependencies: ManagementAppDependencies;
}

export interface ManagementAppDependencies {
management: ManagementStart;
sections: SectionsServiceStart;
kibanaVersion: string;
setBreadcrumbs: (newBreadcrumbs: ChromeBreadcrumb[]) => void;
}

export const ManagementApp = ({ context, dependencies, history }: ManagementAppProps) => {
export const ManagementApp = ({ dependencies, history }: ManagementAppProps) => {
const { setBreadcrumbs } = dependencies;
const [selectedId, setSelectedId] = useState<string>('');
const [sections, setSections] = useState<ManagementSection[]>();

Expand All @@ -55,24 +51,24 @@ export const ManagementApp = ({ context, dependencies, history }: ManagementAppP
window.scrollTo(0, 0);
}, []);

const setBreadcrumbs = useCallback(
const setBreadcrumbsScoped = useCallback(
(crumbs: ChromeBreadcrumb[] = [], appHistory?: ScopedHistory) => {
const wrapBreadcrumb = (item: ChromeBreadcrumb, scopedHistory: ScopedHistory) => ({
...item,
...(item.href ? reactRouterNavigate(scopedHistory, item.href) : {}),
});

context.core.chrome.setBreadcrumbs([
setBreadcrumbs([
wrapBreadcrumb(MANAGEMENT_BREADCRUMB, history),
...crumbs.map((item) => wrapBreadcrumb(item, appHistory || history)),
]);
},
[context.core.chrome, history]
[setBreadcrumbs, history]
);

useEffect(() => {
setSections(dependencies.management.sections.getSectionsEnabled());
}, [dependencies.management.sections]);
setSections(dependencies.sections.getSectionsEnabled());
}, [dependencies.sections]);

if (!sections) {
return null;
Expand All @@ -84,7 +80,7 @@ export const ManagementApp = ({ context, dependencies, history }: ManagementAppP
<ManagementSidebarNav selectedId={selectedId} sections={sections} history={history} />
<ManagementRouter
history={history}
setBreadcrumbs={setBreadcrumbs}
setBreadcrumbs={setBreadcrumbsScoped}
onAppMounted={onAppMounted}
sections={sections}
dependencies={dependencies}
Expand Down
145 changes: 94 additions & 51 deletions src/plugins/management/public/components/management_sections.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,61 +17,104 @@
* under the License.
*/

import React from 'react';
import { EuiFlexGroup, EuiFlexItem, EuiToolTip, EuiIcon } from '@elastic/eui';

import { i18n } from '@kbn/i18n';
import { ManagementSectionId } from '../types';

interface ManagementSectionTitleProps {
text: string;
tip: string;
}
const ingestTitle = i18n.translate('management.sections.ingestTitle', {
defaultMessage: 'Ingest',
});

const ingestTip = i18n.translate('management.sections.ingestTip', {
defaultMessage: 'Manage how to transform data and load it into the cluster',
});

const dataTitle = i18n.translate('management.sections.dataTitle', {
defaultMessage: 'Data',
});

const dataTip = i18n.translate('management.sections.dataTip', {
defaultMessage: 'Manage your cluster data and backups',
});

const insightsAndAlertingTitle = i18n.translate('management.sections.insightsAndAlertingTitle', {
defaultMessage: 'Alerts and Insights',
});

const insightsAndAlertingTip = i18n.translate('management.sections.insightsAndAlertingTip', {
defaultMessage: 'Manage how to detect changes in your data',
});

const sectionTitle = i18n.translate('management.sections.section.title', {
defaultMessage: 'Security',
});

const sectionTip = i18n.translate('management.sections.section.tip', {
defaultMessage: 'Control access to features and data',
});

const kibanaTitle = i18n.translate('management.sections.kibanaTitle', {
defaultMessage: 'Kibana',
});

const kibanaTip = i18n.translate('management.sections.kibanaTip', {
defaultMessage: 'Customize Kibana and manage saved objects',
});

const stackTitle = i18n.translate('management.sections.stackTitle', {
defaultMessage: 'Stack',
});

const stackTip = i18n.translate('management.sections.stackTip', {
defaultMessage: 'Manage your license and upgrade the Stack',
});

export const IngestSection = {
id: ManagementSectionId.Ingest,
title: ingestTitle,
tip: ingestTip,
order: 0,
};

export const DataSection = {
id: ManagementSectionId.Data,
title: dataTitle,
tip: dataTip,
order: 1,
};

export const InsightsAndAlertingSection = {
id: ManagementSectionId.InsightsAndAlerting,
title: insightsAndAlertingTitle,
tip: insightsAndAlertingTip,
order: 2,
};

export const SecuritySection = {
id: 'security',
title: sectionTitle,
tip: sectionTip,
order: 3,
};

const ManagementSectionTitle = ({ text, tip }: ManagementSectionTitleProps) => (
<EuiToolTip content={tip} position="right">
<EuiFlexGroup alignItems="center" gutterSize="s" responsive={false}>
<EuiFlexItem grow={false}>{text}</EuiFlexItem>
export const KibanaSection = {
id: ManagementSectionId.Kibana,
title: kibanaTitle,
tip: kibanaTip,
order: 4,
};

<EuiFlexItem grow={false}>
<EuiIcon type="questionInCircle" />
</EuiFlexItem>
</EuiFlexGroup>
</EuiToolTip>
);
export const StackSection = {
id: ManagementSectionId.Stack,
title: stackTitle,
tip: stackTip,
order: 4,
};

export const managementSections = [
{
id: ManagementSectionId.Ingest,
title: (
<ManagementSectionTitle
text="Ingest"
tip="Manage how to transform data and load it into the cluster."
/>
),
},
{
id: ManagementSectionId.Data,
title: <ManagementSectionTitle text="Data" tip="Manage your cluster data and backups" />,
},
{
id: ManagementSectionId.InsightsAndAlerting,
title: (
<ManagementSectionTitle
text="Alerts and Insights"
tip="Manage how to detect changes in your data"
/>
),
},
{
id: ManagementSectionId.Security,
title: <ManagementSectionTitle text="Security" tip="Control access to features and data" />,
},
{
id: ManagementSectionId.Kibana,
title: <ManagementSectionTitle text="Kibana" tip="Customize Kibana and manage saved objects" />,
},
{
id: ManagementSectionId.Stack,
title: <ManagementSectionTitle text="Stack" tip="Manage your license and upgrade the Stack" />,
},
IngestSection,
DataSection,
InsightsAndAlertingSection,
SecuritySection,
KibanaSection,
StackSection,
];
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,15 @@ import React, { useState } from 'react';
import { i18n } from '@kbn/i18n';
import { sortBy } from 'lodash';

import { EuiIcon, EuiSideNav, EuiScreenReaderOnly, EuiSideNavItemType } from '@elastic/eui';
import {
EuiIcon,
EuiSideNav,
EuiScreenReaderOnly,
EuiSideNavItemType,
EuiFlexGroup,
EuiFlexItem,
EuiToolTip,
} from '@elastic/eui';
import { AppMountParameters } from 'kibana/public';
import { ManagementApp, ManagementSection } from '../../utils';

Expand Down Expand Up @@ -79,6 +87,23 @@ export const ManagementSidebarNav = ({
}),
}));

interface TooltipWrapperProps {
text: string;
tip?: string;
}

const TooltipWrapper = ({ text, tip }: TooltipWrapperProps) => (
<EuiToolTip content={tip} position="right">
<EuiFlexGroup alignItems="center" gutterSize="s" responsive={false}>
<EuiFlexItem grow={false}>{text}</EuiFlexItem>

<EuiFlexItem grow={false}>
<EuiIcon type="questionInCircle" />
</EuiFlexItem>
</EuiFlexGroup>
</EuiToolTip>
);

const createNavItem = <T extends ManagementItem>(
item: T,
customParams: Partial<EuiSideNavItemType<any>> = {}
Expand All @@ -87,7 +112,7 @@ export const ManagementSidebarNav = ({

return {
id: item.id,
name: item.title,
name: item.tip ? <TooltipWrapper text={item.title} tip={item.tip} /> : item.title,
isSelected: item.id === selectedId,
icon: iconType ? <EuiIcon type={iconType} size="m" /> : undefined,
'data-test-subj': item.id,
Expand Down
Loading

0 comments on commit daf8eb0

Please sign in to comment.