Skip to content

Commit

Permalink
[Reporting] Move a few server files for shorter paths (#71591)
Browse files Browse the repository at this point in the history
  • Loading branch information
tsullivan authored Jul 14, 2020
1 parent cdbe12f commit 820f9ed
Show file tree
Hide file tree
Showing 109 changed files with 213 additions and 219 deletions.
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 @@ -173,12 +173,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/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/plugins/reporting/server/export_types/printable_pdf/lib/pdf/assets/fonts/noto/NotoSansCJKtc-Medium.ttf',
'x-pack/plugins/reporting/server/export_types/printable_pdf/lib/pdf/assets/fonts/noto/NotoSansCJKtc-Regular.ttf',
'x-pack/plugins/reporting/server/export_types/printable_pdf/lib/pdf/assets/fonts/roboto/Roboto-Italic.ttf',
'x-pack/plugins/reporting/server/export_types/printable_pdf/lib/pdf/assets/fonts/roboto/Roboto-Medium.ttf',
'x-pack/plugins/reporting/server/export_types/printable_pdf/lib/pdf/assets/fonts/roboto/Roboto-Regular.ttf',
'x-pack/plugins/reporting/server/export_types/printable_pdf/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
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 @@ -7,7 +7,7 @@
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
export { ReportingConfigType } from '../server/config';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
export { LayoutInstance } from '../server/export_types/common/layouts';
export { LayoutInstance } from '../server/lib/layouts';

export type JobId = string;
export type JobStatus =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import { map, truncate } 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 { LevelLogger } from '../../../lib';
import { ViewZoomWidthHeight } from '../../../lib/layouts/layout';
import { ConditionalHeaders, ElementPosition } from '../../../types';
import { allowRequest, NetworkPolicy } from '../../network_policy';

Expand Down
2 changes: 1 addition & 1 deletion x-pack/plugins/reporting/server/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { SecurityPluginSetup } from '../../security/server';
import { ScreenshotsObservableFn } from '../server/types';
import { ReportingConfig } from './';
import { HeadlessChromiumDriverFactory } from './browsers/chromium/driver_factory';
import { screenshotsObservableFactory } from './export_types/common/lib/screenshots';
import { screenshotsObservableFactory } from './lib/screenshots';
import { checkLicense, getExportTypesRegistry } from './lib';
import { ESQueueInstance } from './lib/create_queue';
import { EnqueueJobFn } from './lib/enqueue_job';
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
* you may not use this file except in compliance with the Elastic License.
*/

import { cryptoFactory, LevelLogger } from '../../../lib';
import { decryptJobHeaders } from './decrypt_job_headers';
import { cryptoFactory, LevelLogger } from '../../lib';
import { decryptJobHeaders } from './';

const encryptHeaders = async (encryptionKey: string, headers: Record<string, string>) => {
const crypto = cryptoFactory(encryptionKey);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

import { i18n } from '@kbn/i18n';
import { cryptoFactory, LevelLogger } from '../../../lib';
import { cryptoFactory, LevelLogger } from '../../lib';

interface HasEncryptedHeaders {
headers?: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
*/

import sinon from 'sinon';
import { ReportingConfig } from '../../../';
import { ReportingCore } from '../../../core';
import { createMockReportingCore } from '../../../test_helpers';
import { ScheduledTaskParams } from '../../../types';
import { ScheduledTaskParamsPDF } from '../../printable_pdf/types';
import { getConditionalHeaders, getCustomLogo } from './index';
import { ReportingConfig } from '../../';
import { ReportingCore } from '../../core';
import { createMockReportingCore } from '../../test_helpers';
import { ScheduledTaskParams } from '../../types';
import { ScheduledTaskParamsPDF } from '../printable_pdf/types';
import { getConditionalHeaders, getCustomLogo } from './';

let mockConfig: ReportingConfig;
let mockReportingPlugin: ReportingCore;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
* you may not use this file except in compliance with the Elastic License.
*/

import { ReportingConfig } from '../../../';
import { ConditionalHeaders } from '../../../types';
import { ReportingConfig } from '../../';
import { ConditionalHeaders } from '../../types';

export const getConditionalHeaders = <ScheduledTaskParamsType>({
config,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
* you may not use this file except in compliance with the Elastic License.
*/

import { ReportingCore } from '../../../core';
import { createMockReportingCore } from '../../../test_helpers';
import { ScheduledTaskParamsPDF } from '../../printable_pdf/types';
import { getConditionalHeaders, getCustomLogo } from './index';
import { ReportingCore } from '../../core';
import { createMockReportingCore } from '../../test_helpers';
import { ScheduledTaskParamsPDF } from '../printable_pdf/types';
import { getConditionalHeaders, getCustomLogo } from './';

const mockConfigGet = jest.fn().mockImplementation((key: string) => {
return 'localhost';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
* you may not use this file except in compliance with the Elastic License.
*/

import { ReportingConfig, ReportingCore } from '../../../';
import { UI_SETTINGS_CUSTOM_PDF_LOGO } from '../../../../common/constants';
import { ConditionalHeaders } from '../../../types';
import { ScheduledTaskParamsPDF } from '../../printable_pdf/types'; // Logo is PDF only
import { ReportingConfig, ReportingCore } from '../../';
import { UI_SETTINGS_CUSTOM_PDF_LOGO } from '../../../common/constants';
import { ConditionalHeaders } from '../../types';
import { ScheduledTaskParamsPDF } from '../printable_pdf/types'; // Logo is PDF only

export const getCustomLogo = async ({
reporting,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
* you may not use this file except in compliance with the Elastic License.
*/

import { ReportingConfig } from '../../../';
import { ScheduledTaskParamsPNG } from '../../png/types';
import { ScheduledTaskParamsPDF } from '../../printable_pdf/types';
import { ReportingConfig } from '../../';
import { ScheduledTaskParamsPNG } from '../png/types';
import { ScheduledTaskParamsPDF } from '../printable_pdf/types';
import { getFullUrls } from './get_full_urls';

interface FullUrlsOpts {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ import {
UrlWithParsedQuery,
UrlWithStringQuery,
} from 'url';
import { ReportingConfig } from '../../..';
import { getAbsoluteUrlFactory } from '../../../../common/get_absolute_url';
import { validateUrls } from '../../../../common/validate_urls';
import { ScheduledTaskParamsPNG } from '../../png/types';
import { ScheduledTaskParamsPDF } from '../../printable_pdf/types';
import { ReportingConfig } from '../../';
import { ScheduledTaskParamsPNG } from '../png/types';
import { ScheduledTaskParamsPDF } from '../printable_pdf/types';
import { getAbsoluteUrlFactory } from './get_absolute_url';
import { validateUrls } from './validate_urls';

function isPngJob(
job: ScheduledTaskParamsPNG | ScheduledTaskParamsPDF
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ export { getConditionalHeaders } from './get_conditional_headers';
export { getCustomLogo } from './get_custom_logo';
export { getFullUrls } from './get_full_urls';
export { omitBlacklistedHeaders } from './omit_blacklisted_headers';
export { validateUrls } from './validate_urls';
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { omitBy } from 'lodash';
import {
KBN_SCREENSHOT_HEADER_BLACKLIST,
KBN_SCREENSHOT_HEADER_BLACKLIST_STARTS_WITH_PATTERN,
} from '../../../../common/constants';
} from '../../../common/constants';

export const omitBlacklistedHeaders = <ScheduledTaskParamsType>({
job,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
* you may not use this file except in compliance with the Elastic License.
*/

import { cryptoFactory } from '../../../lib';
import { ESQueueCreateJobFn, ScheduleTaskFnFactory } from '../../../types';
import { JobParamsDiscoverCsv } from '../types';
import { cryptoFactory } from '../../lib';
import { ESQueueCreateJobFn, ScheduleTaskFnFactory } from '../../types';
import { JobParamsDiscoverCsv } from './types';

export const scheduleTaskFnFactory: ScheduleTaskFnFactory<ESQueueCreateJobFn<
JobParamsDiscoverCsv
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,18 @@ import { IUiSettingsClient, ElasticsearchServiceSetup } from 'kibana/server';
// @ts-ignore
import Puid from 'puid';
import sinon from 'sinon';
import { ReportingConfig, ReportingCore } from '../../../';
import { fieldFormats, UI_SETTINGS } from '../../../../../../../src/plugins/data/server';
import { ReportingConfig, ReportingCore } from '../../';
import { fieldFormats, UI_SETTINGS } from '../../../../../../src/plugins/data/server';
import {
CSV_QUOTE_VALUES_SETTING,
CSV_SEPARATOR_SETTING,
} from '../../../../../../../src/plugins/share/server';
import { CancellationToken } from '../../../../common';
import { CSV_BOM_CHARS } from '../../../../common/constants';
import { LevelLogger } from '../../../lib';
import { setFieldFormats } from '../../../services';
import { createMockReportingCore } from '../../../test_helpers';
import { ScheduledTaskParamsCSV } from '../types';
} from '../../../../../../src/plugins/share/server';
import { CancellationToken } from '../../../common';
import { CSV_BOM_CHARS } from '../../../common/constants';
import { LevelLogger } from '../../lib';
import { setFieldFormats } from '../../services';
import { createMockReportingCore } from '../../test_helpers';
import { ScheduledTaskParamsCSV } from './types';
import { runTaskFnFactory } from './execute_job';

const delay = (ms: number) => new Promise((resolve) => setTimeout(() => resolve(), ms));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
import { Crypto } from '@elastic/node-crypto';
import { i18n } from '@kbn/i18n';
import Hapi from 'hapi';
import { KibanaRequest } from '../../../../../../../src/core/server';
import { CONTENT_TYPE_CSV, CSV_JOB_TYPE } from '../../../../common/constants';
import { cryptoFactory, LevelLogger } from '../../../lib';
import { ESQueueWorkerExecuteFn, RunTaskFnFactory } from '../../../types';
import { ScheduledTaskParamsCSV } from '../types';
import { KibanaRequest } from '../../../../../../src/core/server';
import { CONTENT_TYPE_CSV, CSV_JOB_TYPE } from '../../../common/constants';
import { cryptoFactory, LevelLogger } from '../../lib';
import { ESQueueWorkerExecuteFn, RunTaskFnFactory } from '../../types';
import { ScheduledTaskParamsCSV } from './types';
import { createGenerateCsv } from './generate_csv';

const getRequest = async (headers: string | undefined, crypto: Crypto, logger: LevelLogger) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

import { startsWith } from 'lodash';
import { CSV_FORMULA_CHARS } from '../../../../../common/constants';
import { CSV_FORMULA_CHARS } from '../../../../common/constants';

export const cellHasFormulas = (val: string) =>
CSV_FORMULA_CHARS.some((formulaChar) => startsWith(val, formulaChar));
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/

import { RawValue } from '../../types';
import { RawValue } from '../types';
import { cellHasFormulas } from './cell_has_formula';

const nonAlphaNumRE = /[^a-zA-Z0-9]/;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import expect from '@kbn/expect';
import { fieldFormats, FieldFormatsGetConfigFn, UI_SETTINGS } from 'src/plugins/data/server';
import { IndexPatternSavedObject } from '../../types';
import { IndexPatternSavedObject } from '../types';
import { fieldFormatMapFactory } from './field_format_map';

type ConfigValue = { number: { id: string; params: {} } } | string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import _ from 'lodash';
import { FieldFormat } from 'src/plugins/data/common';
import { FieldFormatConfig, IFieldFormatsRegistry } from 'src/plugins/data/server';
import { IndexPatternSavedObject } from '../../types';
import { IndexPatternSavedObject } from '../types';

/**
* Create a map of FieldFormat instances for index pattern fields
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import { isNull, isObject, isUndefined } from 'lodash';
import { FieldFormat } from 'src/plugins/data/common';
import { RawValue } from '../../types';
import { RawValue } from '../types';

export function createFormatCsvValues(
escapeValue: (value: RawValue, index: number, array: RawValue[]) => string,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

import { i18n } from '@kbn/i18n';
import { IUiSettingsClient } from 'kibana/server';
import { ReportingConfig } from '../../../..';
import { LevelLogger } from '../../../../lib';
import { ReportingConfig } from '../../../';
import { LevelLogger } from '../../../lib';

export const getUiSettings = async (
timezone: string | undefined,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@

import expect from '@kbn/expect';
import sinon from 'sinon';
import { CancellationToken } from '../../../../../common';
import { LevelLogger } from '../../../../lib';
import { ScrollConfig } from '../../../../types';
import { CancellationToken } from '../../../../common';
import { LevelLogger } from '../../../lib';
import { ScrollConfig } from '../../../types';
import { createHitIterator } from './hit_iterator';

const mockLogger = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@

import { i18n } from '@kbn/i18n';
import { SearchParams, SearchResponse } from 'elasticsearch';
import { CancellationToken } from '../../../../../common';
import { LevelLogger } from '../../../../lib';
import { ScrollConfig } from '../../../../types';
import { CancellationToken } from '../../../../common';
import { LevelLogger } from '../../../lib';
import { ScrollConfig } from '../../../types';

export type EndpointCaller = (method: string, params: object) => Promise<SearchResponse<any>>;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@

import { i18n } from '@kbn/i18n';
import { IUiSettingsClient } from 'src/core/server';
import { getFieldFormats } from '../../../../services';
import { ReportingConfig } from '../../../..';
import { CancellationToken } from '../../../../../../../plugins/reporting/common';
import { CSV_BOM_CHARS } from '../../../../../common/constants';
import { LevelLogger } from '../../../../lib';
import { IndexPatternSavedObject, SavedSearchGeneratorResult } from '../../types';
import { getFieldFormats } from '../../../services';
import { ReportingConfig } from '../../../';
import { CancellationToken } from '../../../../../../plugins/reporting/common';
import { CSV_BOM_CHARS } from '../../../../common/constants';
import { LevelLogger } from '../../../lib';
import { IndexPatternSavedObject, SavedSearchGeneratorResult } from '../types';
import { checkIfRowsHaveFormulas } from './check_cells_for_formulas';
import { createEscapeValue } from './escape_value';
import { fieldFormatMapFactory } from './field_format_map';
Expand Down
4 changes: 2 additions & 2 deletions x-pack/plugins/reporting/server/export_types/csv/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ import {
import { CSV_JOB_TYPE as jobType } from '../../../constants';
import { ESQueueCreateJobFn, ESQueueWorkerExecuteFn, ExportTypeDefinition } from '../../types';
import { metadata } from './metadata';
import { scheduleTaskFnFactory } from './server/create_job';
import { runTaskFnFactory } from './server/execute_job';
import { scheduleTaskFnFactory } from './create_job';
import { runTaskFnFactory } from './execute_job';
import { JobParamsDiscoverCsv, ScheduledTaskParamsCSV } from './types';

export const getExportType = (): ExportTypeDefinition<
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
import { Crypto } from '@elastic/node-crypto';
import { i18n } from '@kbn/i18n';
import Hapi from 'hapi';
import { KibanaRequest } from '../../../../../../../../src/core/server';
import { LevelLogger } from '../../../../lib';
import { KibanaRequest } from '../../../../../../../src/core/server';
import { LevelLogger } from '../../../lib';

export const getRequest = async (
headers: string | undefined,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
import { notFound, notImplemented } from 'boom';
import { get } from 'lodash';
import { KibanaRequest, RequestHandlerContext } from 'src/core/server';
import { CSV_FROM_SAVEDOBJECT_JOB_TYPE } from '../../../../common/constants';
import { cryptoFactory } from '../../../lib';
import { ScheduleTaskFnFactory, TimeRangeParams } from '../../../types';
import { CSV_FROM_SAVEDOBJECT_JOB_TYPE } from '../../../common/constants';
import { cryptoFactory } from '../../lib';
import { ScheduleTaskFnFactory, TimeRangeParams } from '../../types';
import {
JobParamsPanelCsv,
SavedObject,
Expand All @@ -18,7 +18,7 @@ import {
SavedSearchObjectAttributesJSON,
SearchPanel,
VisObjectAttributesJSON,
} from '../types';
} from './types';

export type ImmediateCreateJobFn = (
jobParams: JobParamsPanelCsv,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
*/

import { KibanaRequest, RequestHandlerContext } from 'src/core/server';
import { CancellationToken } from '../../../../common';
import { CONTENT_TYPE_CSV, CSV_FROM_SAVEDOBJECT_JOB_TYPE } from '../../../../common/constants';
import { RunTaskFnFactory, ScheduledTaskParams, TaskRunResult } from '../../../types';
import { createGenerateCsv } from '../../csv/server/generate_csv';
import { JobParamsPanelCsv, SearchPanel } from '../types';
import { CancellationToken } from '../../../common';
import { CONTENT_TYPE_CSV, CSV_FROM_SAVEDOBJECT_JOB_TYPE } from '../../../common/constants';
import { RunTaskFnFactory, ScheduledTaskParams, TaskRunResult } from '../../types';
import { createGenerateCsv } from '../csv/generate_csv';
import { JobParamsPanelCsv, SearchPanel } from './types';
import { getFakeRequest } from './lib/get_fake_request';
import { getGenerateCsvParams } from './lib/get_csv_job';

Expand Down
Loading

0 comments on commit 820f9ed

Please sign in to comment.