Skip to content

Commit

Permalink
Merge branch 'master' into 76380-use-epr-image-path
Browse files Browse the repository at this point in the history
  • Loading branch information
elasticmachine authored Sep 7, 2020
2 parents 028e9bb + 68a9838 commit 3258cca
Show file tree
Hide file tree
Showing 98 changed files with 66,552 additions and 2,734 deletions.
1 change: 0 additions & 1 deletion src/core/server/legacy/config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,3 @@

export { ensureValidConfiguration } from './ensure_valid_configuration';
export { LegacyObjectToConfigAdapter } from './legacy_object_to_config_adapter';
export { convertLegacyDeprecationProvider } from './legacy_deprecation_adapters';
106 changes: 0 additions & 106 deletions src/core/server/legacy/config/legacy_deprecation_adapters.test.ts

This file was deleted.

57 changes: 0 additions & 57 deletions src/core/server/legacy/config/legacy_deprecation_adapters.ts

This file was deleted.

44 changes: 2 additions & 42 deletions src/core/server/legacy/legacy_service.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@

jest.mock('../../../legacy/server/kbn_server');
jest.mock('../../../cli/cluster/cluster_manager');
jest.mock('./config/legacy_deprecation_adapters', () => ({
convertLegacyDeprecationProvider: (provider: any) => Promise.resolve(provider),
}));

import {
findLegacyPluginSpecsMock,
logLegacyThirdPartyPluginDeprecationWarningMock,
Expand Down Expand Up @@ -446,46 +444,8 @@ describe('#discoverPlugins()', () => {
expect(findLegacyPluginSpecs).toHaveBeenCalledWith(expect.any(Object), logger, env.packageInfo);
});

it(`register legacy plugin's deprecation providers`, async () => {
findLegacyPluginSpecsMock.mockImplementation(
(settings) =>
Promise.resolve({
pluginSpecs: [
{
getDeprecationsProvider: () => undefined,
},
{
getDeprecationsProvider: () => 'providerA',
},
{
getDeprecationsProvider: () => 'providerB',
},
],
pluginExtendedConfig: settings,
disabledPluginSpecs: [],
uiExports: {},
navLinks: [],
}) as any
);

const legacyService = new LegacyService({
coreId,
env,
logger,
configService: configService as any,
});

await legacyService.discoverPlugins();
expect(configService.addDeprecationProvider).toHaveBeenCalledTimes(2);
expect(configService.addDeprecationProvider).toHaveBeenCalledWith('', 'providerA');
expect(configService.addDeprecationProvider).toHaveBeenCalledWith('', 'providerB');
});

it(`logs deprecations for legacy third party plugins`, async () => {
const pluginSpecs = [
{ getId: () => 'pluginA', getDeprecationsProvider: () => undefined },
{ getId: () => 'pluginB', getDeprecationsProvider: () => undefined },
];
const pluginSpecs = [{ getId: () => 'pluginA' }, { getId: () => 'pluginB' }];
findLegacyPluginSpecsMock.mockImplementation(
(settings) =>
Promise.resolve({
Expand Down
15 changes: 1 addition & 14 deletions src/core/server/legacy/legacy_service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,14 @@ import { combineLatest, ConnectableObservable, EMPTY, Observable, Subscription }
import { first, map, publishReplay, tap } from 'rxjs/operators';

import { CoreService } from '../../types';
import { Config, ConfigDeprecationProvider } from '../config';
import { Config } from '../config';
import { CoreContext } from '../core_context';
import { CspConfigType, config as cspConfig } from '../csp';
import { DevConfig, DevConfigType, config as devConfig } from '../dev';
import { BasePathProxyServer, HttpConfig, HttpConfigType, config as httpConfig } from '../http';
import { Logger } from '../logging';
import { PathConfigType } from '../path';
import { findLegacyPluginSpecs, logLegacyThirdPartyPluginDeprecationWarning } from './plugins';
import { convertLegacyDeprecationProvider } from './config';
import {
ILegacyInternals,
LegacyServiceSetupDeps,
Expand Down Expand Up @@ -145,18 +144,6 @@ export class LegacyService implements CoreService {
navLinks,
};

const deprecationProviders = await pluginSpecs
.map((spec) => spec.getDeprecationsProvider())
.reduce(async (providers, current) => {
if (current) {
return [...(await providers), await convertLegacyDeprecationProvider(current)];
}
return providers;
}, Promise.resolve([] as ConfigDeprecationProvider[]));
deprecationProviders.forEach((provider) =>
this.coreContext.configService.addDeprecationProvider('', provider)
);

this.legacyRawConfig = pluginExtendedConfig;

// check for unknown uiExport types
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ const createPluginSpec = ({ id, path }: { id: string; path: string }): LegacyPlu
getId: () => id,
getExpectedKibanaVersion: () => 'kibana',
getConfigPrefix: () => 'plugin.config',
getDeprecationsProvider: () => undefined,
getPack: () => ({
getPath: () => path,
}),
Expand Down
31 changes: 0 additions & 31 deletions src/core/server/legacy/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,36 +51,6 @@ export interface LegacyConfig {
set(config: LegacyVars): void;
}

/**
* Representation of a legacy configuration deprecation factory used for
* legacy plugin deprecations.
*
* @internal
* @deprecated
*/
export interface LegacyConfigDeprecationFactory {
rename(oldKey: string, newKey: string): LegacyConfigDeprecation;
unused(unusedKey: string): LegacyConfigDeprecation;
}

/**
* Representation of a legacy configuration deprecation.
*
* @internal
* @deprecated
*/
export type LegacyConfigDeprecation = (settings: LegacyVars, log: (msg: string) => void) => void;

/**
* Representation of a legacy configuration deprecation provider.
*
* @internal
* @deprecated
*/
export type LegacyConfigDeprecationProvider = (
factory: LegacyConfigDeprecationFactory
) => LegacyConfigDeprecation[] | Promise<LegacyConfigDeprecation[]>;

/**
* @internal
* @deprecated
Expand All @@ -97,7 +67,6 @@ export interface LegacyPluginSpec {
getId: () => unknown;
getExpectedKibanaVersion: () => string;
getConfigPrefix: () => string;
getDeprecationsProvider: () => LegacyConfigDeprecationProvider | undefined;
getPack: () => LegacyPluginPack;
}

Expand Down
10 changes: 5 additions & 5 deletions src/core/server/server.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -2949,11 +2949,11 @@ export const validBodyOutput: readonly ["data", "stream"];
// Warnings were encountered during analysis:
//
// src/core/server/http/router/response.ts:316:3 - (ae-forgotten-export) The symbol "KibanaResponse" needs to be exported by the entry point index.d.ts
// src/core/server/legacy/types.ts:163:3 - (ae-forgotten-export) The symbol "VarsProvider" needs to be exported by the entry point index.d.ts
// src/core/server/legacy/types.ts:164:3 - (ae-forgotten-export) The symbol "VarsReplacer" needs to be exported by the entry point index.d.ts
// src/core/server/legacy/types.ts:165:3 - (ae-forgotten-export) The symbol "LegacyNavLinkSpec" needs to be exported by the entry point index.d.ts
// src/core/server/legacy/types.ts:166:3 - (ae-forgotten-export) The symbol "LegacyAppSpec" needs to be exported by the entry point index.d.ts
// src/core/server/legacy/types.ts:167:16 - (ae-forgotten-export) The symbol "LegacyPluginSpec" needs to be exported by the entry point index.d.ts
// src/core/server/legacy/types.ts:132:3 - (ae-forgotten-export) The symbol "VarsProvider" needs to be exported by the entry point index.d.ts
// src/core/server/legacy/types.ts:133:3 - (ae-forgotten-export) The symbol "VarsReplacer" needs to be exported by the entry point index.d.ts
// src/core/server/legacy/types.ts:134:3 - (ae-forgotten-export) The symbol "LegacyNavLinkSpec" needs to be exported by the entry point index.d.ts
// src/core/server/legacy/types.ts:135:3 - (ae-forgotten-export) The symbol "LegacyAppSpec" needs to be exported by the entry point index.d.ts
// src/core/server/legacy/types.ts:136:16 - (ae-forgotten-export) The symbol "LegacyPluginSpec" needs to be exported by the entry point index.d.ts
// src/core/server/plugins/types.ts:266:3 - (ae-forgotten-export) The symbol "KibanaConfigType" needs to be exported by the entry point index.d.ts
// src/core/server/plugins/types.ts:266:3 - (ae-forgotten-export) The symbol "SharedGlobalConfigKeys" needs to be exported by the entry point index.d.ts
// src/core/server/plugins/types.ts:268:3 - (ae-forgotten-export) The symbol "PathConfigType" needs to be exported by the entry point index.d.ts
Expand Down
2 changes: 1 addition & 1 deletion src/legacy/server/logging/log_format.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ export default class TransformObjStream extends Stream.Transform {
method: event.method || '',
headers: event.headers,
remoteAddress: source.remoteAddress,
userAgent: source.remoteAddress,
userAgent: source.userAgent,
referer: source.referer,
};

Expand Down
4 changes: 3 additions & 1 deletion src/legacy/server/logging/log_format_json.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,14 @@ describe('KbnLoggerJsonFormat', () => {
},
};
const result = await createPromiseFromStreams([createListStream([event]), format]);
const { type, method, statusCode, message } = JSON.parse(result);
const { type, method, statusCode, message, req } = JSON.parse(result);

expect(type).toBe('response');
expect(method).toBe('GET');
expect(statusCode).toBe(200);
expect(message).toBe('GET /path/to/resource 200 12000ms - 13.0B');
expect(req.remoteAddress).toBe('127.0.0.1');
expect(req.userAgent).toBe('Test Thing');
});

it('ops', async () => {
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/data/public/public.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -1465,7 +1465,7 @@ export interface QueryState {
// Warning: (ae-missing-release-tag) "QueryStringInput" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export const QueryStringInput: React.FC<Pick<Props_3, "query" | "prepend" | "size" | "placeholder" | "onChange" | "onBlur" | "onSubmit" | "indexPatterns" | "dataTestSubj" | "screenTitle" | "disableAutoFocus" | "persistedLog" | "bubbleSubmitEvent" | "languageSwitcherPopoverAnchorPosition" | "onChangeQueryInputFocus">>;
export const QueryStringInput: React.FC<Pick<Props_3, "query" | "prepend" | "size" | "className" | "placeholder" | "onChange" | "onBlur" | "onSubmit" | "indexPatterns" | "dataTestSubj" | "screenTitle" | "disableAutoFocus" | "persistedLog" | "bubbleSubmitEvent" | "languageSwitcherPopoverAnchorPosition" | "onChangeQueryInputFocus">>;

// @public (undocumented)
export type QuerySuggestion = QuerySuggestionBasic | QuerySuggestionField;
Expand Down
Loading

0 comments on commit 3258cca

Please sign in to comment.