Skip to content

Commit

Permalink
clean up imports
Browse files Browse the repository at this point in the history
  • Loading branch information
tsullivan committed Apr 2, 2020
1 parent 5bf7d13 commit 1561725
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,13 @@
* you may not use this file except in compliance with the Elastic License.
*/

import { ReportingConfigType } from '../../../server/core';
import { CaptureConfig } from '../../../server/types';
import { LayoutTypes } from '../constants';
import { Layout, LayoutParams } from './layout';
import { PreserveLayout } from './preserve_layout';
import { PrintLayout } from './print_layout';

export function createLayout(
captureConfig: ReportingConfigType['capture'],
layoutParams?: LayoutParams
): Layout {
export function createLayout(captureConfig: CaptureConfig, layoutParams?: LayoutParams): Layout {
if (layoutParams && layoutParams.id === LayoutTypes.PRESERVE_LAYOUT) {
return new PreserveLayout(layoutParams.dimensions);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,10 @@ import path from 'path';
import { EvaluateFn, SerializableOrJSHandle } from 'puppeteer';
import { HeadlessChromiumDriver } from '../../../server/browsers';
import { LevelLogger } from '../../../server/lib';
import { ReportingConfigType } from '../../../server/core';
import { CaptureConfig } from '../../../server/types';
import { LayoutTypes } from '../constants';
import { getDefaultLayoutSelectors, Layout, LayoutSelectorDictionary, Size } from './layout';

type CaptureConfig = ReportingConfigType['capture'];

export class PrintLayout extends Layout {
public readonly selectors: LayoutSelectorDictionary = {
...getDefaultLayoutSelectors(),
Expand All @@ -22,7 +20,7 @@ export class PrintLayout extends Layout {
public readonly groupCount = 2;
private captureConfig: CaptureConfig;

constructor(captureConfig: ReportingConfigType['capture']) {
constructor(captureConfig: CaptureConfig) {
super(LayoutTypes.PRINT);
this.captureConfig = captureConfig;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@

import { i18n } from '@kbn/i18n';
import { HeadlessChromiumDriver as HeadlessBrowser } from '../../../../server/browsers';
import { CaptureConfig } from '../../../../server/types';
import { LevelLogger } from '../../../../server/lib';
import { LayoutInstance } from '../../layouts/layout';
import { CONTEXT_GETNUMBEROFITEMS, CONTEXT_READMETADATA } from './constants';
import { CaptureConfig } from './types';

export const getNumberOfItems = async (
captureConfig: CaptureConfig,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,15 @@

import * as Rx from 'rxjs';
import { catchError, concatMap, first, mergeMap, take, takeUntil, toArray } from 'rxjs/operators';
import { CaptureConfig } from '../../../../server/types';
import { HeadlessChromiumDriverFactory } from '../../../../types';
import { getElementPositionAndAttributes } from './get_element_position_data';
import { getNumberOfItems } from './get_number_of_items';
import { getScreenshots } from './get_screenshots';
import { getTimeRange } from './get_time_range';
import { injectCustomCss } from './inject_css';
import { openUrl } from './open_url';
import {
CaptureConfig,
ScreenSetupData,
ScreenshotObservableOpts,
ScreenshotResults,
} from './types';
import { ScreenSetupData, ScreenshotObservableOpts, ScreenshotResults } from './types';
import { waitForRenderComplete } from './wait_for_render';
import { waitForVisualizations } from './wait_for_visualizations';

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

import { i18n } from '@kbn/i18n';
import { HeadlessChromiumDriver as HeadlessBrowser } from '../../../../server/browsers';
import { CaptureConfig } from '../../../../server/types';
import { LevelLogger } from '../../../../server/lib';
import { ConditionalHeaders } from '../../../../types';
import { PAGELOAD_SELECTOR } from '../../constants';
import { CaptureConfig } from './types';

export const openUrl = async (
captureConfig: CaptureConfig,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
*/

import { LevelLogger } from '../../../../server/lib';
import { ReportingConfigType } from '../../../../server/core';
import { ConditionalHeaders, ElementPosition } from '../../../../types';
import { LayoutInstance } from '../../layouts/layout';

Expand Down Expand Up @@ -47,5 +46,3 @@ export interface ScreenshotResults {
screenshots: Screenshot[];
error?: Error;
}

export type CaptureConfig = ReportingConfigType['capture'];
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { groupBy } from 'lodash';
import * as Rx from 'rxjs';
import { mergeMap } from 'rxjs/operators';
import { LevelLogger } from '../../../../server/lib';
import { ReportingConfigType } from '../../../../server/core';
import { CaptureConfig } from '../../../../server/types';
import { ConditionalHeaders, HeadlessChromiumDriverFactory } from '../../../../types';
import { createLayout } from '../../../common/layouts';
import { LayoutInstance, LayoutParams } from '../../../common/layouts/layout';
Expand All @@ -28,7 +28,7 @@ const getTimeRange = (urlScreenshots: ScreenshotResults[]) => {
};

export function generatePdfObservableFactory(
captureConfig: ReportingConfigType['capture'],
captureConfig: CaptureConfig,
browserDriverFactory: HeadlessChromiumDriverFactory
) {
const screenshotsObservable = screenshotsObservableFactory(captureConfig, browserDriverFactory);
Expand Down

0 comments on commit 1561725

Please sign in to comment.