Skip to content

Commit

Permalink
Merge branch 'master' into d/2021-10-18-scss-in-packages
Browse files Browse the repository at this point in the history
  • Loading branch information
kibanamachine authored Oct 19, 2021
2 parents eb5ac44 + b306f8e commit 60ae39f
Show file tree
Hide file tree
Showing 248 changed files with 5,595 additions and 1,870 deletions.
9 changes: 9 additions & 0 deletions docs/dev-tools/console/console.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -129,3 +129,12 @@ image::dev-tools/console/images/console-settings.png["Console Settings", width=6

For a list of available keyboard
shortcuts, click *Help*.

[float]
[[console-settings]]
=== Disable Console

If you don’t want to use *Console*, you can disable it by setting `console.ui.enabled`
to `false` in your `kibana.yml` configuration file. Changing this setting
causes the server to regenerate assets on the next startup,
which might cause a delay before pages start being served.
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,7 @@ readonly links: {
elasticAgent: string;
datastreams: string;
datastreamsNamingScheme: string;
installElasticAgent: string;
upgradeElasticAgent: string;
upgradeElasticAgent712lower: string;
learnMoreBlog: string;
Expand Down

Large diffs are not rendered by default.

34 changes: 34 additions & 0 deletions docs/setup/settings.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ configuration using `${MY_ENV_VAR}` syntax.
[cols="2*<"]
|===

| `console.ui.enabled:`
Toggling this causes the server to regenerate assets on the next startup,
which may cause a delay before pages start being served.
Set to `false` to disable Console. *Default: `true`*

| `csp.rules:`
| deprecated:[7.14.0,"In 8.0 and later, this setting will no longer be supported."]
A https://w3c.github.io/webappsec-csp/[Content Security Policy] template
Expand Down Expand Up @@ -681,6 +686,10 @@ out through *Advanced Settings*. *Default: `true`*
| Set this value to true to allow Vega to use any URL to access external data
sources and images. When false, Vega can only get data from {es}. *Default: `false`*

| `xpack.ccr.ui.enabled`
Set this value to false to disable the Cross-Cluster Replication UI.
*Default: `true`*

|[[settings-explore-data-in-context]] `xpack.discoverEnhanced.actions.`
`exploreDataInContextMenu.enabled`
| Enables the *Explore underlying data* option that allows you to open *Discover* from a dashboard panel and view the panel data. *Default: `false`*
Expand All @@ -689,6 +698,31 @@ sources and images. When false, Vega can only get data from {es}. *Default: `fal
`exploreDataInChart.enabled`
| Enables you to view the underlying documents in a data series from a dashboard panel. *Default: `false`*

| `xpack.ilm.ui.enabled`
Set this value to false to disable the Index Lifecycle Policies UI.
*Default: `true`*

| `xpack.index_management.ui.enabled`
Set this value to false to disable the Index Management UI.
*Default: `true`*

| `xpack.license_management.ui.enabled`
Set this value to false to disable the License Management UI.
*Default: `true`*

| `xpack.remote_clusters.ui.enabled`
Set this value to false to disable the Remote Clusters UI.
*Default: `true`*

| `xpack.rollup.ui.enabled:`
Set this value to false to disable the Rollup Jobs UI. *Default: true*

| `xpack.snapshot_restore.ui.enabled:`
Set this value to false to disable the Snapshot and Restore UI. *Default: true*

| `xpack.upgrade_assistant.ui.enabled:`
Set this value to false to disable the Upgrade Assistant UI. *Default: true*

| `i18n.locale` {ess-icon}
| Set this value to change the {kib} interface language.
Valid locales are: `en`, `zh-CN`, `ja-JP`. *Default: `en`*
Expand Down
4 changes: 3 additions & 1 deletion src/core/public/doc_links/doc_links_service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -477,9 +477,10 @@ export class DocLinksService {
settings: `${FLEET_DOCS}fleet-settings.html#fleet-server-hosts-setting`,
settingsFleetServerHostSettings: `${FLEET_DOCS}fleet-settings.html#fleet-server-hosts-setting`,
troubleshooting: `${FLEET_DOCS}fleet-troubleshooting.html`,
elasticAgent: `${FLEET_DOCS}elastic-agent-installation-configuration.html`,
elasticAgent: `${FLEET_DOCS}elastic-agent-installation.html`,
datastreams: `${FLEET_DOCS}data-streams.html`,
datastreamsNamingScheme: `${FLEET_DOCS}data-streams.html#data-streams-naming-scheme`,
installElasticAgent: `${FLEET_DOCS}install-fleet-managed-elastic-agent.html`,
upgradeElasticAgent: `${FLEET_DOCS}upgrade-elastic-agent.html`,
upgradeElasticAgent712lower: `${FLEET_DOCS}upgrade-elastic-agent.html#upgrade-7.12-lower`,
learnMoreBlog: `${ELASTIC_WEBSITE_URL}blog/elastic-agent-and-fleet-make-it-easier-to-integrate-your-systems-with-elastic`,
Expand Down Expand Up @@ -740,6 +741,7 @@ export interface DocLinksStart {
elasticAgent: string;
datastreams: string;
datastreamsNamingScheme: string;
installElasticAgent: string;
upgradeElasticAgent: string;
upgradeElasticAgent712lower: string;
learnMoreBlog: string;
Expand Down
1 change: 1 addition & 0 deletions src/core/public/public.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -706,6 +706,7 @@ export interface DocLinksStart {
elasticAgent: string;
datastreams: string;
datastreamsNamingScheme: string;
installElasticAgent: string;
upgradeElasticAgent: string;
upgradeElasticAgent712lower: string;
learnMoreBlog: string;
Expand Down
1 change: 1 addition & 0 deletions src/core/server/saved_objects/object_types/registration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ const legacyUrlAliasType: SavedObjectsType = {
properties: {
sourceId: { type: 'keyword' },
targetType: { type: 'keyword' },
targetNamespace: { type: 'keyword' },
resolveCounter: { type: 'long' },
disabled: { type: 'boolean' },
// other properties exist, but we aren't querying or aggregating on those, so we don't need to specify them (because we use `dynamic: false` above)
Expand Down
7 changes: 6 additions & 1 deletion src/core/server/saved_objects/service/lib/repository.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import { encodeHitVersion } from '../../version';
import { SavedObjectTypeRegistry } from '../../saved_objects_type_registry';
import { DocumentMigrator } from '../../migrations/core/document_migrator';
import { mockKibanaMigrator } from '../../migrations/kibana/kibana_migrator.mock';
import { LEGACY_URL_ALIAS_TYPE } from '../../object_types';
import { elasticsearchClientMock } from '../../../elasticsearch/client/mocks';
import * as esKuery from '@kbn/es-query';
import { errors as EsErrors } from '@elastic/elasticsearch';
Expand Down Expand Up @@ -2714,7 +2715,11 @@ describe('SavedObjectsRepository', () => {
const allTypes = registry.getAllTypes().map((type) => type.name);
expect(getSearchDslNS.getSearchDsl).toHaveBeenCalledWith(mappings, registry, {
namespaces: [namespace],
type: allTypes.filter((type) => !registry.isNamespaceAgnostic(type)),
type: [
...allTypes.filter((type) => !registry.isNamespaceAgnostic(type)),
LEGACY_URL_ALIAS_TYPE,
],
kueryNode: expect.anything(),
});
});
});
Expand Down
16 changes: 14 additions & 2 deletions src/core/server/saved_objects/service/lib/repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import { omit, isObject } from 'lodash';
import type { estypes } from '@elastic/elasticsearch';
import * as esKuery from '@kbn/es-query';
import type { ElasticsearchClient } from '../../../elasticsearch/';
import { isSupportedEsServer, isNotFoundFromUnsupportedServer } from '../../../elasticsearch';
import type { Logger } from '../../../logging';
Expand Down Expand Up @@ -55,6 +56,7 @@ import {
SavedObjectsBulkResolveObject,
SavedObjectsBulkResolveResponse,
} from '../saved_objects_client';
import { LEGACY_URL_ALIAS_TYPE } from '../../object_types';
import {
SavedObject,
SavedObjectsBaseOptions,
Expand Down Expand Up @@ -780,7 +782,16 @@ export class SavedObjectsRepository {
}

const allTypes = Object.keys(getRootPropertiesObjects(this._mappings));
const typesToUpdate = allTypes.filter((type) => !this._registry.isNamespaceAgnostic(type));
const typesToUpdate = [
...allTypes.filter((type) => !this._registry.isNamespaceAgnostic(type)),
LEGACY_URL_ALIAS_TYPE,
];

// Construct kueryNode to filter legacy URL aliases (these space-agnostic objects do not use root-level "namespace/s" fields)
const { buildNode } = esKuery.nodeTypes.function;
const match1 = buildNode('is', `${LEGACY_URL_ALIAS_TYPE}.targetNamespace`, namespace);
const match2 = buildNode('not', buildNode('is', 'type', LEGACY_URL_ALIAS_TYPE));
const kueryNode = buildNode('or', [match1, match2]);

const { body, statusCode, headers } = await this.client.updateByQuery(
{
Expand All @@ -803,8 +814,9 @@ export class SavedObjectsRepository {
},
conflicts: 'proceed',
...getSearchDsl(this._mappings, this._registry, {
namespaces: namespace ? [namespace] : undefined,
namespaces: [namespace],
type: typesToUpdate,
kueryNode,
}),
},
},
Expand Down
7 changes: 4 additions & 3 deletions src/plugins/console/public/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@
*/

import './index.scss';
import { PluginInitializerContext } from 'src/core/public';

import { ConsoleUIPlugin } from './plugin';

export type { ConsoleUILocatorParams } from './plugin';
export type { ConsoleUILocatorParams, ConsolePluginSetup } from './types';

export { ConsoleUIPlugin as Plugin };

export function plugin() {
return new ConsoleUIPlugin();
export function plugin(ctx: PluginInitializerContext) {
return new ConsoleUIPlugin(ctx);
}
122 changes: 66 additions & 56 deletions src/plugins/console/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,77 +7,87 @@
*/

import { i18n } from '@kbn/i18n';
import { SerializableRecord } from '@kbn/utility-types';
import { Plugin, CoreSetup } from 'src/core/public';
import { Plugin, CoreSetup, PluginInitializerContext } from 'src/core/public';

import { FeatureCatalogueCategory } from '../../home/public';
import { AppSetupUIPluginDependencies } from './types';

export interface ConsoleUILocatorParams extends SerializableRecord {
loadFrom?: string;
}
import {
AppSetupUIPluginDependencies,
ClientConfigType,
ConsolePluginSetup,
ConsoleUILocatorParams,
} from './types';

export class ConsoleUIPlugin implements Plugin<void, void, AppSetupUIPluginDependencies> {
constructor(private ctx: PluginInitializerContext) {}

public setup(
{ notifications, getStartServices, http }: CoreSetup,
{ devTools, home, share, usageCollection }: AppSetupUIPluginDependencies
) {
if (home) {
home.featureCatalogue.register({
): ConsolePluginSetup {
const {
ui: { enabled: isConsoleUiEnabled },
} = this.ctx.config.get<ClientConfigType>();

if (isConsoleUiEnabled) {
if (home) {
home.featureCatalogue.register({
id: 'console',
title: i18n.translate('console.devToolsTitle', {
defaultMessage: 'Interact with the Elasticsearch API',
}),
description: i18n.translate('console.devToolsDescription', {
defaultMessage: 'Skip cURL and use a JSON interface to work with your data in Console.',
}),
icon: 'consoleApp',
path: '/app/dev_tools#/console',
showOnHomePage: false,
category: FeatureCatalogueCategory.ADMIN,
});
}

devTools.register({
id: 'console',
title: i18n.translate('console.devToolsTitle', {
defaultMessage: 'Interact with the Elasticsearch API',
}),
description: i18n.translate('console.devToolsDescription', {
defaultMessage: 'Skip cURL and use a JSON interface to work with your data in Console.',
order: 1,
title: i18n.translate('console.consoleDisplayName', {
defaultMessage: 'Console',
}),
icon: 'consoleApp',
path: '/app/dev_tools#/console',
showOnHomePage: false,
category: FeatureCatalogueCategory.ADMIN,
});
}
enableRouting: false,
mount: async ({ element }) => {
const [core] = await getStartServices();

devTools.register({
id: 'console',
order: 1,
title: i18n.translate('console.consoleDisplayName', {
defaultMessage: 'Console',
}),
enableRouting: false,
mount: async ({ element }) => {
const [core] = await getStartServices();
const {
i18n: { Context: I18nContext },
docLinks: { DOC_LINK_VERSION },
} = core;

const {
i18n: { Context: I18nContext },
docLinks: { DOC_LINK_VERSION },
} = core;
const { renderApp } = await import('./application');

const { renderApp } = await import('./application');
return renderApp({
http,
docLinkVersion: DOC_LINK_VERSION,
I18nContext,
notifications,
usageCollection,
element,
});
},
});

return renderApp({
http,
docLinkVersion: DOC_LINK_VERSION,
I18nContext,
notifications,
usageCollection,
element,
});
},
});
const locator = share.url.locators.create<ConsoleUILocatorParams>({
id: 'CONSOLE_APP_LOCATOR',
getLocation: async ({ loadFrom }) => {
return {
app: 'dev_tools',
path: `#/console${loadFrom ? `?load_from=${loadFrom}` : ''}`,
state: { loadFrom },
};
},
});

const locator = share.url.locators.create<ConsoleUILocatorParams>({
id: 'CONSOLE_APP_LOCATOR',
getLocation: async ({ loadFrom }) => {
return {
app: 'dev_tools',
path: `#/console${loadFrom ? `?load_from=${loadFrom}` : ''}`,
state: { loadFrom },
};
},
});
return { locator };
}

return { locator };
return {};
}

public start() {}
Expand Down
13 changes: 13 additions & 0 deletions src/plugins/console/public/types/config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/

export interface ClientConfigType {
ui: {
enabled: boolean;
};
}
2 changes: 2 additions & 0 deletions src/plugins/console/public/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@ export * from './core_editor';
export * from './token';
export * from './tokens_provider';
export * from './common';
export { ClientConfigType } from './config';
export { ConsoleUILocatorParams } from './locator';
12 changes: 12 additions & 0 deletions src/plugins/console/public/types/locator.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
import { SerializableRecord } from '@kbn/utility-types';

export interface ConsoleUILocatorParams extends SerializableRecord {
loadFrom?: string;
}
8 changes: 7 additions & 1 deletion src/plugins/console/public/types/plugin_dependencies.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,17 @@
import { HomePublicPluginSetup } from '../../../home/public';
import { DevToolsSetup } from '../../../dev_tools/public';
import { UsageCollectionSetup } from '../../../usage_collection/public';
import { SharePluginSetup } from '../../../share/public';
import { SharePluginSetup, LocatorPublic } from '../../../share/public';

import { ConsoleUILocatorParams } from './locator';

export interface AppSetupUIPluginDependencies {
home?: HomePublicPluginSetup;
devTools: DevToolsSetup;
share: SharePluginSetup;
usageCollection?: UsageCollectionSetup;
}

export interface ConsolePluginSetup {
locator?: LocatorPublic<ConsoleUILocatorParams>;
}
Loading

0 comments on commit 60ae39f

Please sign in to comment.