Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Reporting] Move code out of Legacy #67904

Merged
merged 22 commits into from
Jun 3, 2020
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
5 changes: 2 additions & 3 deletions x-pack/plugins/reporting/kibana.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,13 @@
],
"configPath": ["xpack", "reporting"],
"requiredPlugins": [
"data",
"home",
"management",
"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';
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO (future PR) move export_type/common code to server/ and server/lib

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