Skip to content

Commit

Permalink
[Reporting] Move code out of Legacy
Browse files Browse the repository at this point in the history
  • Loading branch information
tsullivan committed Jun 2, 2020
1 parent 0dca28b commit 57bf1cc
Show file tree
Hide file tree
Showing 214 changed files with 345 additions and 518 deletions.
2 changes: 0 additions & 2 deletions x-pack/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

import { xpackMain } from './legacy/plugins/xpack_main';
import { monitoring } from './legacy/plugins/monitoring';
import { reporting } from './legacy/plugins/reporting';
import { security } from './legacy/plugins/security';
import { dashboardMode } from './legacy/plugins/dashboard_mode';
import { beats } from './legacy/plugins/beats_management';
Expand All @@ -18,7 +17,6 @@ module.exports = function (kibana) {
return [
xpackMain(kibana),
monitoring(kibana),
reporting(kibana),
spaces(kibana),
security(kibana),
dashboardMode(kibana),
Expand Down
49 changes: 0 additions & 49 deletions x-pack/legacy/plugins/reporting/index.ts

This file was deleted.

17 changes: 0 additions & 17 deletions x-pack/legacy/plugins/reporting/server/index.ts

This file was deleted.

61 changes: 0 additions & 61 deletions x-pack/legacy/plugins/reporting/server/legacy.ts

This file was deleted.

This file was deleted.

81 changes: 0 additions & 81 deletions x-pack/legacy/plugins/reporting/server/plugin.ts

This file was deleted.

1 change: 1 addition & 0 deletions x-pack/plugins/reporting/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.chromium
File renamed without changes.
1 change: 1 addition & 0 deletions x-pack/plugins/reporting/common/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@
*/

export { CancellationToken } from './cancellation_token';
export { Poller } from './poller';
2 changes: 1 addition & 1 deletion x-pack/plugins/reporting/common/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

// eslint-disable-next-line @kbn/eslint/no-restricted-paths
export { ConfigType } from '../server/config';
export { ReportingConfigType } from '../server/config';

export type JobId = string;
export type JobStatus =
Expand Down
4 changes: 1 addition & 3 deletions x-pack/plugins/reporting/kibana.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@
"licensing",
"uiActions",
"embeddable",
"share",
"kibanaLegacy",
"licensing"
"share"
],
"server": true,
"ui": true
Expand Down
4 changes: 2 additions & 2 deletions x-pack/plugins/reporting/public/plugin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import {
import { ManagementSectionId, ManagementSetup } from '../../../../src/plugins/management/public';
import { SharePluginSetup } from '../../../../src/plugins/share/public';
import { LicensingPluginSetup } from '../../licensing/public';
import { ConfigType, JobId, JobStatusBuckets } from '../common/types';
import { ReportingConfigType, JobId, JobStatusBuckets } from '../common/types';
import { JOB_COMPLETION_NOTIFICATIONS_SESSION_KEY } from '../constants';
import { getGeneralErrorToast } from './components';
import { ReportListing } from './components/report_listing';
Expand All @@ -37,7 +37,7 @@ import { csvReportingProvider } from './share_context_menu/register_csv_reportin
import { reportingPDFPNGProvider } from './share_context_menu/register_pdf_png_reporting';

export interface ClientConfigType {
poll: ConfigType['poll'];
poll: ReportingConfigType['poll'];
}

function getStored(): JobId[] {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { map, trunc } from 'lodash';
import open from 'opn';
import { ElementHandle, EvaluateFn, Page, Response, SerializableOrJSHandle } from 'puppeteer';
import { parse as parseUrl } from 'url';
import { ViewZoomWidthHeight } from '../../../../export_types/common/layouts/layout';
import { ViewZoomWidthHeight } from '../../../export_types/common/layouts/layout';
import { LevelLogger } from '../../../lib';
import { ConditionalHeaders, ElementPosition } from '../../../types';
import { allowRequest, NetworkPolicy } from '../../network_policy';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/

import { first } from 'rxjs/operators';
import { ReportingConfig } from '../';
import { LevelLogger } from '../lib';
import { HeadlessChromiumDriverFactory } from './chromium/driver_factory';
Expand All @@ -19,7 +20,7 @@ export async function createBrowserDriverFactory(
const browserConfig = captureConfig.browser.chromium;
const browserAutoDownload = captureConfig.browser.autoDownload;
const browserType = captureConfig.browser.type;
const dataDir = config.kbnConfig.get('path', 'data');
const dataDir = await config.kbnConfig.get('path', 'data').pipe(first()).toPromise();

if (browserConfig.disableSandbox) {
logger.warning(`Enabling the Chromium sandbox provides an additional layer of protection.`);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@
* you may not use this file except in compliance with the Elastic License.
*/

import { Legacy } from 'kibana';
import { Observable } from 'rxjs';
import { get } from 'lodash';
import { CoreSetup } from 'src/core/server';
import { ConfigType as ReportingConfigType } from '../../../../../plugins/reporting/server';
import { map } from 'rxjs/operators';
import { CoreSetup, PluginInitializerContext } from 'src/core/server';
import { ReportingConfigType } from './schema';

// make config.get() aware of the value type it returns
interface Config<BaseType> {
Expand Down Expand Up @@ -39,7 +40,7 @@ interface Config<BaseType> {
}

interface KbnServerConfigType {
path: { data: string };
path: { data: Observable<string> };
server: {
basePath: string;
host: string;
Expand All @@ -55,17 +56,16 @@ export interface ReportingConfig extends Config<ReportingConfigType> {
}

export const buildConfig = (
initContext: PluginInitializerContext<ReportingConfigType>,
core: CoreSetup,
server: Legacy.Server,
reportingConfig: ReportingConfigType
): ReportingConfig => {
const config = server.config();
const { http } = core;
const serverInfo = http.getServerInfo();

const kbnConfig = {
path: {
data: config.get('path.data'),
data: initContext.config.legacy.globalConfig$.pipe(map((c) => c.path.data)),
},
server: {
basePath: core.http.basePath.serverBasePath,
Expand All @@ -84,5 +84,3 @@ export const buildConfig = (
},
};
};

export { ReportingConfigType };
Loading

0 comments on commit 57bf1cc

Please sign in to comment.