Skip to content

Commit

Permalink
[7.x] [Reporting] Move code out of Legacy (#67904) (#68201)
Browse files Browse the repository at this point in the history
* [Reporting] Move code out of Legacy (#67904)

* [Reporting] Move code out of Legacy

* Elasticsearch is not a plugin dep

* add data as plugin dependo

* diff cleanup 1

* log the browser download

* Update paths in outside code for new Reporting home

* fix download test

* add numeral typing for x-pack/test

* Fix jest tests for np migration

* Shorten import paths

* remove this file, add typings to the node module

* remove local typing that has been provided by node module

* Add optional security plugin dep

* revert conflicting apm typings removal

* fix i18n

* fix snakecase whitelist

Co-authored-by: Joel Griffith <joel.griffith@elastic.co>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
# Conflicts:
#	.ci/packer_cache.sh
#	src/dev/code_coverage/ingest_coverage/__tests__/transforms.test.js
#	src/dev/code_coverage/ingest_coverage/integration_tests/mocks/jest-combined/coverage-summary-manual-mix.json
#	x-pack/plugins/reporting/server/export_types/printable_pdf/server/create_job/index.ts

* Add back in legacy bwc route

* Kill code_coverage since it's not supposed to be here...

Co-authored-by: Tim Sullivan <tsullivan@users.noreply.github.com>
  • Loading branch information
joelgriffith and tsullivan committed Jun 4, 2020
1 parent c0fabc1 commit 48001fc
Show file tree
Hide file tree
Showing 227 changed files with 527 additions and 658 deletions.
2 changes: 1 addition & 1 deletion .ci/packer_cache.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ tar -cf "$HOME/.kibana/bootstrap_cache/$branch.tar" \
packages/*/node_modules \
x-pack/node_modules \
x-pack/legacy/plugins/*/node_modules \
x-pack/legacy/plugins/reporting/.chromium \
x-pack/plugins/reporting/.chromium \
test/plugin_functional/plugins/*/node_modules \
examples/*/node_modules \
.es \
Expand Down
2 changes: 1 addition & 1 deletion src/cli/cluster/cluster_manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ export class ClusterManager {
/debug\.log$/,
...pluginInternalDirsIgnore,
fromRoot('src/legacy/server/sass/__tmp__'),
fromRoot('x-pack/legacy/plugins/reporting/.chromium'),
fromRoot('x-pack/plugins/reporting/.chromium'),
fromRoot('x-pack/plugins/siem/cypress'),
fromRoot('x-pack/plugins/apm/e2e'),
fromRoot('x-pack/plugins/apm/scripts'),
Expand Down
2 changes: 1 addition & 1 deletion src/dev/build/tasks/clean_tasks.js
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ export const CleanExtraBrowsersTask = {

async run(config, log, build) {
const getBrowserPathsForPlatform = (platform) => {
const reportingDir = 'x-pack/legacy/plugins/reporting';
const reportingDir = 'x-pack/plugins/reporting';
const chromiumDir = '.chromium';
const chromiumPath = (p) =>
build.resolvePathForPlatform(platform, reportingDir, chromiumDir, p);
Expand Down
12 changes: 6 additions & 6 deletions src/dev/precommit_hook/casing_check_config.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,12 +172,12 @@ export const TEMPORARILY_IGNORED_PATHS = [
'x-pack/plugins/monitoring/public/icons/health-green.svg',
'x-pack/plugins/monitoring/public/icons/health-red.svg',
'x-pack/plugins/monitoring/public/icons/health-yellow.svg',
'x-pack/legacy/plugins/reporting/export_types/printable_pdf/server/lib/pdf/assets/fonts/noto/NotoSansCJKtc-Medium.ttf',
'x-pack/legacy/plugins/reporting/export_types/printable_pdf/server/lib/pdf/assets/fonts/noto/NotoSansCJKtc-Regular.ttf',
'x-pack/legacy/plugins/reporting/export_types/printable_pdf/server/lib/pdf/assets/fonts/roboto/Roboto-Italic.ttf',
'x-pack/legacy/plugins/reporting/export_types/printable_pdf/server/lib/pdf/assets/fonts/roboto/Roboto-Medium.ttf',
'x-pack/legacy/plugins/reporting/export_types/printable_pdf/server/lib/pdf/assets/fonts/roboto/Roboto-Regular.ttf',
'x-pack/legacy/plugins/reporting/export_types/printable_pdf/server/lib/pdf/assets/img/logo-grey.png',
'x-pack/plugins/reporting/server/export_types/printable_pdf/server/lib/pdf/assets/fonts/noto/NotoSansCJKtc-Medium.ttf',
'x-pack/plugins/reporting/server/export_types/printable_pdf/server/lib/pdf/assets/fonts/noto/NotoSansCJKtc-Regular.ttf',
'x-pack/plugins/reporting/server/export_types/printable_pdf/server/lib/pdf/assets/fonts/roboto/Roboto-Italic.ttf',
'x-pack/plugins/reporting/server/export_types/printable_pdf/server/lib/pdf/assets/fonts/roboto/Roboto-Medium.ttf',
'x-pack/plugins/reporting/server/export_types/printable_pdf/server/lib/pdf/assets/fonts/roboto/Roboto-Regular.ttf',
'x-pack/plugins/reporting/server/export_types/printable_pdf/server/lib/pdf/assets/img/logo-grey.png',
'x-pack/test/functional/es_archives/monitoring/beats-with-restarted-instance/data.json.gz',
'x-pack/test/functional/es_archives/monitoring/beats-with-restarted-instance/mappings.json',
'x-pack/test/functional/es_archives/monitoring/logstash-pipelines/data.json.gz',
Expand Down
4 changes: 2 additions & 2 deletions x-pack/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
/test/functional/screenshots
/test/functional/apps/reporting/reports/session
/test/reporting/configs/failure_debug/
/legacy/plugins/reporting/.chromium/
/legacy/plugins/reporting/.phantom/
/plugins/reporting/.chromium/
/plugins/reporting/.phantom/
/.aws-config.json
/.env
/.kibana-plugin-helpers.dev.*
Expand Down
2 changes: 1 addition & 1 deletion x-pack/.i18nrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"xpack.monitoring": ["plugins/monitoring", "legacy/plugins/monitoring"],
"xpack.remoteClusters": "plugins/remote_clusters",
"xpack.painlessLab": "plugins/painless_lab",
"xpack.reporting": ["plugins/reporting", "legacy/plugins/reporting"],
"xpack.reporting": ["plugins/reporting"],
"xpack.rollupJobs": ["legacy/plugins/rollup", "plugins/rollup"],
"xpack.searchProfiler": "plugins/searchprofiler",
"xpack.security": ["legacy/plugins/security", "plugins/security"],
Expand Down
4 changes: 2 additions & 2 deletions x-pack/.kibana-plugin-helpers.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
"index.js",
".i18nrc.json",
"plugins/**/*",
"legacy/plugins/reporting/.phantom/*",
"legacy/plugins/reporting/.chromium/*",
"plugins/reporting/.phantom/*",
"plugins/reporting/.chromium/*",
"legacy/common/**/*",
"legacy/plugins/**/*",
"legacy/server/**/*",
Expand Down
2 changes: 1 addition & 1 deletion x-pack/build_chromium/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ To run the build, replace the sha in the following commands with the sha that yo

After the build completes, there will be a .zip file and a .md5 file in `~/chromium/chromium/src/out/headless`. These are named like so: `chromium-{first_7_of_SHA}-{platform}`, for example: `chromium-4747cc2-linux`.

The zip files need to be deployed to s3. For testing, I drop them into `headless-shell-dev`, but for production, they need to be in `headless-shell`. And the `x-pack/legacy/plugins/reporting/server/browsers/chromium/paths.js` file needs to be upated to have the correct `archiveChecksum`, `archiveFilename`, `binaryChecksum` and `baseUrl`. Below is a list of what the archive's are:
The zip files need to be deployed to s3. For testing, I drop them into `headless-shell-dev`, but for production, they need to be in `headless-shell`. And the `x-pack/plugins/reporting/server/browsers/chromium/paths.ts` file needs to be upated to have the correct `archiveChecksum`, `archiveFilename`, `binaryChecksum` and `baseUrl`. Below is a list of what the archive's are:

- `archiveChecksum`: The contents of the `.md5` file, which is the `md5` checksum of the zip file.
- `binaryChecksum`: The `md5` checksum of the `headless_shell` binary itself.
Expand Down
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.

Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export class GisMap extends Component {
// - If it's not, then reporting injects a listener into the browser for a custom "renderComplete" event.
// - When that event is fired, we snapshot the viz and move on.
// Failure to not have the dom attribute, or custom event, will timeout the job.
// See x-pack/legacy/plugins/reporting/export_types/common/lib/screenshots/wait_for_render.ts for more.
// See x-pack/plugins/reporting/export_types/common/lib/screenshots/wait_for_render.ts for more.
_onInitialLoadRenderComplete = () => {
const el = document.querySelector(`[data-dom-id="${this.state.domId}"]`);

Expand Down
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
6 changes: 3 additions & 3 deletions x-pack/plugins/reporting/kibana.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@
"version": "8.0.0",
"kibanaVersion": "kibana",
"optionalPlugins": [
"security",
"usageCollection"
],
"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';
import { LevelLogger } from '../../../lib';
import { ConditionalHeaders, ElementPosition } from '../../../types';
import { allowRequest, NetworkPolicy } from '../../network_policy';
Expand Down
Loading

0 comments on commit 48001fc

Please sign in to comment.