Skip to content

Commit

Permalink
[Reporting] Reorganize UI components (#103571) (#103595)
Browse files Browse the repository at this point in the history
  • Loading branch information
tsullivan authored Jun 29, 2021
1 parent c09f7de commit a3f9cf0
Show file tree
Hide file tree
Showing 39 changed files with 39 additions and 45 deletions.
2 changes: 1 addition & 1 deletion x-pack/plugins/reporting/public/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@

import { PluginInitializerContext } from 'src/core/public';
import { getDefaultLayoutSelectors } from '../common';
import { getSharedComponents } from './components';
import { ReportingAPIClient } from './lib/reporting_api_client';
import { ReportingPublicPlugin } from './plugin';
import { getSharedComponents } from './shared';

export interface ReportingSetup {
getDefaultLayoutSelectors: typeof getDefaultLayoutSelectors;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ export const mockAPIClient = {
downloadReport: jest.fn(),
};

jest.mock('../lib/reporting_api_client', () => mockAPIClient);
jest.mock('./reporting_api_client', () => mockAPIClient);
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import {
ReportDocument,
ReportSource,
} from '../../common/types';
import { add } from './job_completion_notifications';
import { add } from '../notifier/job_completion_notifications';

export interface JobQueueEntry {
_id: string;
Expand Down
2 changes: 1 addition & 1 deletion x-pack/plugins/reporting/public/lib/stream_handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
getSuccessToast,
getWarningFormulasToast,
getWarningMaxSizeToast,
} from '../components';
} from '../notifier';
import { ReportingAPIClient } from './reporting_api_client';

function updateStored(jobIds: JobId[]): void {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@
* 2.0.
*/

import { I18nProvider } from '@kbn/i18n/react';
import * as React from 'react';
import { render, unmountComponentAtNode } from 'react-dom';
import { I18nProvider } from '@kbn/i18n/react';
import { CoreSetup, CoreStart } from 'src/core/public';
import { Observable } from 'rxjs';
import { ReportListing } from './components/report_listing';
import { ManagementAppMountParams } from '../../../../src/plugins/management/public';
import { ILicense } from '../../licensing/public';
import { ClientConfigType } from './plugin';
import { ReportingAPIClient } from './lib/reporting_api_client';
import { CoreSetup, CoreStart } from 'src/core/public';
import { ManagementAppMountParams } from '../../../../../src/plugins/management/public';
import { ILicense } from '../../../licensing/public';
import { ReportingAPIClient } from '../lib/reporting_api_client';
import { ClientConfigType } from '../plugin';
import { ReportListing } from './report_listing';

export async function mountManagementSection(
coreSetup: CoreSetup,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
* 2.0.
*/

import { EuiConfirmModal, EuiButton } from '@elastic/eui';
import React, { PureComponent, Fragment } from 'react';
import { Job, Props as ListingProps } from '../report_listing';
import { EuiButton, EuiConfirmModal } from '@elastic/eui';
import React, { Fragment, PureComponent } from 'react';
import { Job, Props as ListingProps } from './report_listing';

type DeleteFn = () => Promise<void>;
type Props = { jobsToDelete: Job[]; performDelete: DeleteFn } & ListingProps;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

import { EuiButtonIcon, EuiToolTip } from '@elastic/eui';
import React, { FunctionComponent } from 'react';
import { JOB_STATUSES } from '../../../common/constants';
import { Job as ListingJob, Props as ListingProps } from '../report_listing';
import { JOB_STATUSES } from '../../common/constants';
import { Job as ListingJob, Props as ListingProps } from './report_listing';

type Props = { record: ListingJob } & ListingProps;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
import { EuiButtonIcon, EuiCallOut, EuiPopover } from '@elastic/eui';
import { InjectedIntl, injectI18n } from '@kbn/i18n/react';
import React, { Component } from 'react';
import { JOB_STATUSES } from '../../../common/constants';
import { JobContent, ReportingAPIClient } from '../../lib/reporting_api_client';
import { Job as ListingJob } from '../report_listing';
import { JOB_STATUSES } from '../../common/constants';
import { JobContent, ReportingAPIClient } from '../lib/reporting_api_client';
import { Job as ListingJob } from './report_listing';

interface Props {
intl: InjectedIntl;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import React from 'react';
import { mountWithIntl } from '@kbn/test/jest';
import { ReportInfoButton } from './report_info_button';

jest.mock('../../lib/reporting_api_client');
jest.mock('../lib/reporting_api_client');

import { ReportingAPIClient } from '../../lib/reporting_api_client';
import { ReportingAPIClient } from '../lib/reporting_api_client';

const httpSetup = {} as any;
const apiClient = new ReportingAPIClient(httpSetup);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ import {
} from '@elastic/eui';
import { get } from 'lodash';
import React, { Component, Fragment } from 'react';
import { USES_HEADLESS_JOB_TYPES } from '../../../common/constants';
import { ReportApiJSON } from '../../../common/types';
import { ReportingAPIClient } from '../../lib/reporting_api_client';
import { USES_HEADLESS_JOB_TYPES } from '../../common/constants';
import { ReportApiJSON } from '../../common/types';
import { ReportingAPIClient } from '../lib/reporting_api_client';

interface Props {
jobId: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,7 @@ import { durationToNumber } from '../../common/schema_utils';
import { checkLicense } from '../lib/license_check';
import { JobQueueEntry, ReportingAPIClient } from '../lib/reporting_api_client';
import { ClientConfigType } from '../plugin';
import {
ReportDeleteButton,
ReportDownloadButton,
ReportErrorButton,
ReportInfoButton,
} from './buttons';
import { ReportDeleteButton, ReportDownloadButton, ReportErrorButton, ReportInfoButton } from './';
import { ReportDiagnostic } from './report_diagnostic';

export interface Job {
Expand Down
2 changes: 1 addition & 1 deletion x-pack/plugins/reporting/public/mocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import { coreMock } from 'src/core/public/mocks';
import { ReportingSetup } from '.';
import { getDefaultLayoutSelectors } from '../common';
import { getSharedComponents } from './components/shared';
import { getSharedComponents } from './shared';

type Setup = jest.Mocked<ReportingSetup>;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,8 @@
* 2.0.
*/

export { getSuccessToast } from './job_success';
export { getFailureToast } from './job_failure';
export { getGeneralErrorToast } from './general_error';
export { getSuccessToast } from './job_success';
export { getWarningFormulasToast } from './job_warning_formulas';
export { getWarningMaxSizeToast } from './job_warning_max_size';
export { getGeneralErrorToast } from './general_error';
export { ScreenCapturePanelContent } from './screen_capture_panel_content';
export { getSharedComponents } from './shared';
5 changes: 3 additions & 2 deletions x-pack/plugins/reporting/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,11 @@ import { constants, getDefaultLayoutSelectors } from '../common';
import { durationToNumber } from '../common/schema_utils';
import { JobId, JobSummarySet } from '../common/types';
import { ReportingSetup, ReportingStart } from './';
import { getGeneralErrorToast, getSharedComponents } from './components';
import { ReportingAPIClient } from './lib/reporting_api_client';
import { ReportingNotifierStreamHandler as StreamHandler } from './lib/stream_handler';
import { getGeneralErrorToast } from './notifier';
import { ReportingCsvPanelAction } from './panel_actions/get_csv_panel_action';
import { getSharedComponents } from './shared';
import { ReportingCsvShareProvider } from './share_context_menu/register_csv_reporting';
import { reportingScreenshotShareProvider } from './share_context_menu/register_pdf_png_reporting';

Expand Down Expand Up @@ -150,7 +151,7 @@ export class ReportingPublicPlugin
params.setBreadcrumbs([{ text: this.breadcrumbText }]);
const [[start], { mountManagementSection }] = await Promise.all([
getStartServices(),
import('./mount_management_section'),
import('./management/mount_management_section'),
]);
return await mountManagementSection(
core,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ import type { ShareContext } from '../../../../../src/plugins/share/public';
import type { LicensingPluginSetup } from '../../../licensing/public';
import { CSV_JOB_TYPE } from '../../common/constants';
import type { JobParamsCSV } from '../../server/export_types/csv_searchsource/types';
import { ReportingPanelContent } from '../components/reporting_panel_content_lazy';
import { checkLicense } from '../lib/license_check';
import type { ReportingAPIClient } from '../lib/reporting_api_client';
import { ReportingPanelContent } from './reporting_panel_content_lazy';

export const ReportingCsvShareProvider = ({
apiClient,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ import type { LicensingPluginSetup } from '../../../licensing/public';
import type { LayoutParams } from '../../common/types';
import type { JobParamsPNG } from '../../server/export_types/png/types';
import type { JobParamsPDF } from '../../server/export_types/printable_pdf/types';
import { ScreenCapturePanelContent } from '../components/screen_capture_panel_content_lazy';
import { checkLicense } from '../lib/license_check';
import type { ReportingAPIClient } from '../lib/reporting_api_client';
import { ScreenCapturePanelContent } from './screen_capture_panel_content_lazy';

interface JobParamsProviderOptions {
shareableUrl: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

import * as React from 'react';
import { lazy, Suspense, FC } from 'react';
import { FC, lazy, Suspense } from 'react';
import { PanelSpinner } from './panel_spinner';
import type { Props } from './reporting_panel_content';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

import * as React from 'react';
import { lazy, Suspense, FC } from 'react';
import { FC, lazy, Suspense } from 'react';
import { PanelSpinner } from './panel_spinner';
import type { Props } from './screen_capture_panel_content';

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

import { CoreSetup } from 'kibana/public';
import React from 'react';
import { ReportingAPIClient } from '../..';
import { PDF_REPORT_TYPE } from '../../../common/constants';
import type { Props as PanelPropsScreenCapture } from '../screen_capture_panel_content';
import { ScreenCapturePanelContent } from '../screen_capture_panel_content_lazy';
import { ReportingAPIClient } from '../';
import { PDF_REPORT_TYPE } from '../../common/constants';
import type { Props as PanelPropsScreenCapture } from '../share_context_menu/screen_capture_panel_content';
import { ScreenCapturePanelContent } from '../share_context_menu/screen_capture_panel_content_lazy';

interface IncludeOnCloseFn {
onClose: () => void;
Expand Down

0 comments on commit a3f9cf0

Please sign in to comment.