Skip to content

Commit

Permalink
fix circular graph
Browse files Browse the repository at this point in the history
  • Loading branch information
tsullivan committed Nov 13, 2023
1 parent c29baae commit 207cdee
Show file tree
Hide file tree
Showing 14 changed files with 94 additions and 84 deletions.
2 changes: 1 addition & 1 deletion packages/kbn-generate-csv/src/generate_csv.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ import {
} from '@kbn/reporting-common';
import type { TaskRunResult } from '@kbn/reporting-common/types';
import type { ReportingConfigType } from '@kbn/reporting-server';
import { JobParamsCSV } from '@kbn/reporting-export-types-csv-common';

import { CONTENT_TYPE_CSV } from './constants';
import { CsvExportSettings, getExportSettings } from './get_export_settings';
import { i18nTexts } from './i18n_texts';
import { MaxSizeStringBuilder } from './max_size_string_builder';
import { JobParamsCSV } from '../types';

interface Clients {
es: IScopedClusterClient;
Expand Down
1 change: 0 additions & 1 deletion packages/kbn-generate-csv/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
"@kbn/config-schema",
"@kbn/i18n",
"@kbn/reporting-common",
"@kbn/reporting-export-types-csv-common",
"@kbn/reporting-server",
]
}
18 changes: 18 additions & 0 deletions packages/kbn-generate-csv/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/

import type { SerializedSearchSourceFields } from '@kbn/data-plugin/public';

/**
* Duplicated from @kbn/reporting-export-types-csv-common to reduce dependencies
*/
export interface JobParamsCSV {
browserTimezone?: string;
searchSource: SerializedSearchSourceFields;
columns?: string[];
}
54 changes: 0 additions & 54 deletions packages/kbn-reporting/common/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,6 @@

export const PLUGIN_ID = 'reporting';

// Export Type Sets
import {
CSV_JOB_TYPE,
CSV_JOB_TYPE_DEPRECATED,
CSV_JOB_TYPE_V2,
CSV_REPORT_TYPE,
CSV_REPORT_TYPE_V2,
} from '@kbn/reporting-export-types-csv-common';
import {
PDF_JOB_TYPE,
PDF_JOB_TYPE_V2,
PDF_REPORT_TYPE,
PDF_REPORT_TYPE_V2,
} from '@kbn/reporting-export-types-pdf-common';
import {
PNG_JOB_TYPE,
PNG_JOB_TYPE_V2,
PNG_REPORT_TYPE,
PNG_REPORT_TYPE_V2,
} from '@kbn/reporting-export-types-png-common';

export const ALLOWED_JOB_CONTENT_TYPES = [
'application/json',
'application/pdf',
Expand All @@ -37,39 +16,6 @@ export const ALLOWED_JOB_CONTENT_TYPES = [
'text/plain',
];

export const reportTypes = [
CSV_REPORT_TYPE,
CSV_REPORT_TYPE_V2,
PDF_REPORT_TYPE,
PDF_REPORT_TYPE_V2,
PNG_REPORT_TYPE,
PNG_REPORT_TYPE_V2,
];

export const jobTypes = [
CSV_JOB_TYPE,
CSV_JOB_TYPE_V2,
PDF_JOB_TYPE,
PDF_JOB_TYPE_V2,
PNG_JOB_TYPE,
PNG_JOB_TYPE_V2,
];

type ReportTypeDeclaration = typeof reportTypes;
export type ReportTypes = ReportTypeDeclaration[keyof ReportTypeDeclaration];

type JobTypeDeclaration = typeof jobTypes;
export type JobTypes = JobTypeDeclaration[keyof JobTypeDeclaration];

export const USES_HEADLESS_JOB_TYPES = [
PDF_JOB_TYPE,
PNG_JOB_TYPE,
PDF_JOB_TYPE_V2,
PNG_JOB_TYPE_V2,
];

export const DEPRECATED_JOB_TYPES = [CSV_JOB_TYPE_DEPRECATED];

// APM
export const REPORTING_TRANSACTION_TYPE = PLUGIN_ID;

Expand Down
3 changes: 0 additions & 3 deletions packages/kbn-reporting/common/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,5 @@
"@kbn/utility-types",
"@kbn/screenshotting-plugin",
"@kbn/i18n",
"@kbn/reporting-export-types-csv-common",
"@kbn/reporting-export-types-pdf-common",
"@kbn/reporting-export-types-png-common",
]
}
54 changes: 54 additions & 0 deletions x-pack/plugins/reporting/common/constants/export_types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/

// Export Type Sets
import {
CSV_JOB_TYPE,
CSV_JOB_TYPE_DEPRECATED,
CSV_JOB_TYPE_V2,
CSV_REPORT_TYPE,
CSV_REPORT_TYPE_V2,
} from '@kbn/reporting-export-types-csv-common';
import {
PDF_JOB_TYPE,
PDF_JOB_TYPE_V2,
PDF_REPORT_TYPE,
PDF_REPORT_TYPE_V2,
} from '@kbn/reporting-export-types-pdf-common';
import {
PNG_JOB_TYPE,
PNG_JOB_TYPE_V2,
PNG_REPORT_TYPE,
PNG_REPORT_TYPE_V2,
} from '@kbn/reporting-export-types-png-common';

export const reportTypes = [
CSV_REPORT_TYPE,
CSV_REPORT_TYPE_V2,
PDF_REPORT_TYPE,
PDF_REPORT_TYPE_V2,
PNG_REPORT_TYPE,
PNG_REPORT_TYPE_V2,
];

export const jobTypes = [
CSV_JOB_TYPE,
CSV_JOB_TYPE_V2,
PDF_JOB_TYPE,
PDF_JOB_TYPE_V2,
PNG_JOB_TYPE,
PNG_JOB_TYPE_V2,
];

export const USES_HEADLESS_JOB_TYPES = [
PDF_JOB_TYPE,
PNG_JOB_TYPE,
PDF_JOB_TYPE_V2,
PNG_JOB_TYPE_V2,
];

export const DEPRECATED_JOB_TYPES = [CSV_JOB_TYPE_DEPRECATED];
1 change: 1 addition & 0 deletions x-pack/plugins/reporting/common/constants/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
*/

export * from './routes';
export * from './export_types';

// Test Subjects
export const REPORT_TABLE_ID = 'reportJobListing';
Expand Down
19 changes: 10 additions & 9 deletions x-pack/plugins/reporting/common/test/fixtures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* 2.0.
*/

import { JOB_STATUS } from '@kbn/reporting-common';
import { ReportApiJSON } from '@kbn/reporting-common/types';
import type { ReportMock } from './types';

Expand Down Expand Up @@ -43,7 +44,7 @@ export const mockJobs: ReportApiJSON[] = [
},
],
} as any,
status: 'pending',
status: JOB_STATUS.PENDING,
}),
buildMockReport({
id: 'k90e51pk1ieucbae0c3t8wo1',
Expand All @@ -56,7 +57,7 @@ export const mockJobs: ReportApiJSON[] = [
title: 'My Canvas Workpad',
},
started_at: '2020-04-14T21:01:14.526Z',
status: 'processing',
status: JOB_STATUS.PROCESSING,
}),
buildMockReport({
id: 'k90cmthd1gv8cbae0c2le8bo',
Expand All @@ -71,7 +72,7 @@ export const mockJobs: ReportApiJSON[] = [
title: 'My Canvas Workpad',
},
started_at: '2020-04-14T20:19:04.073Z',
status: 'completed',
status: JOB_STATUS.COMPLETED,
}),
buildMockReport({
id: 'k906958e1d4wcbae0c9hip1a',
Expand All @@ -92,7 +93,7 @@ export const mockJobs: ReportApiJSON[] = [
title: 'My Canvas Workpad',
},
started_at: '2020-04-14T17:20:29.444Z',
status: 'completed_with_warnings',
status: JOB_STATUS.WARNINGS,
}),
buildMockReport({
id: 'k9067y2a1d4wcbae0cad38n0',
Expand All @@ -107,7 +108,7 @@ export const mockJobs: ReportApiJSON[] = [
title: 'My Canvas Workpad',
},
started_at: '2020-04-14T17:19:39.883Z',
status: 'completed',
status: JOB_STATUS.COMPLETED,
}),
buildMockReport({
id: 'k9067s1m1d4wcbae0cdnvcms',
Expand All @@ -122,7 +123,7 @@ export const mockJobs: ReportApiJSON[] = [
title: 'My Canvas Workpad',
},
started_at: '2020-04-14T17:19:25.247Z',
status: 'completed',
status: JOB_STATUS.COMPLETED,
}),
buildMockReport({
id: 'k9065q3s1d4wcbae0c00fxlh',
Expand All @@ -137,7 +138,7 @@ export const mockJobs: ReportApiJSON[] = [
title: 'My Canvas Workpad',
},
started_at: '2020-04-14T17:17:50.379Z',
status: 'completed',
status: JOB_STATUS.COMPLETED,
}),
buildMockReport({
id: 'k905zdw11d34cbae0c3y6tzh',
Expand All @@ -153,7 +154,7 @@ export const mockJobs: ReportApiJSON[] = [
isDeprecated: true,
},
started_at: '2020-04-14T17:12:52.431Z',
status: 'completed',
status: JOB_STATUS.COMPLETED,
}),
buildMockReport({
id: 'k8t4ylcb07mi9d006214ifyg',
Expand All @@ -169,6 +170,6 @@ export const mockJobs: ReportApiJSON[] = [
isDeprecated: true,
},
started_at: '2020-04-09T19:09:54.570Z',
status: 'completed',
status: JOB_STATUS.COMPLETED,
}),
];
3 changes: 1 addition & 2 deletions x-pack/plugins/reporting/public/lib/job.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
* 2.0.
*/

import { jobTypes } from '@kbn/reporting-common';

import { jobTypes } from '../../common/constants';
import { mockJobs } from '../../common/test';
import { Job } from './job';

Expand Down
4 changes: 3 additions & 1 deletion x-pack/plugins/reporting/public/lib/job.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import React from 'react';

import { EuiText, EuiTextColor } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import { JOB_STATUS, JobTypes } from '@kbn/reporting-common';
import { JOB_STATUS } from '@kbn/reporting-common';
import type {
BaseParamsV2,
JobId,
Expand All @@ -21,6 +21,8 @@ import type {
TaskRunResult,
} from '@kbn/reporting-common/types';

import { JobTypes } from '../../common/types';

const { COMPLETED, FAILED, PENDING, PROCESSING, WARNINGS } = JOB_STATUS;

type ReportPayload = ReportSource['payload'];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ import {
EuiTitle,
} from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import { USES_HEADLESS_JOB_TYPES } from '@kbn/reporting-common';
import { VisualReportingSoftDisabledError } from '@kbn/reporting-common/errors';

import { USES_HEADLESS_JOB_TYPES } from '../../../common/constants';
import type { Job } from '../../lib/job';
import { sharedI18nTexts } from '../../shared_i18n_texts';
import { useKibana } from '../../shared_imports';
Expand Down
12 changes: 3 additions & 9 deletions x-pack/plugins/reporting/public/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,13 @@
*/

import type { CoreSetup, CoreStart } from '@kbn/core/public';

import type {
JobId,
JobStatus,
ReportOutput,
ReportSource,
TaskRunResult,
} from '@kbn/reporting-common/types';
import { JOB_STATUS } from '@kbn/reporting-common';
import type { JobId, ReportOutput, ReportSource, TaskRunResult } from '@kbn/reporting-common/types';

/* Notifier Toasts */
export interface JobSummary {
id: JobId;
status: JobStatus;
status: JOB_STATUS;
jobtype: ReportSource['jobtype'];
title: ReportSource['payload']['title'];
errorCode?: ReportOutput['error_code'];
Expand Down
3 changes: 1 addition & 2 deletions x-pack/plugins/reporting/server/lib/tasks/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
*/

import { TaskRunCreatorFunction } from '@kbn/task-manager-plugin/server';
import { BasePayload } from '@kbn/reporting-common/types';
import { ReportSource } from '../../../common/types';
import { BasePayload, ReportSource } from '@kbn/reporting-common/types';

export const REPORTING_EXECUTE_TYPE = 'report:execute';
export const REPORTING_MONITOR_TYPE = 'reports:monitor';
Expand Down
2 changes: 1 addition & 1 deletion x-pack/plugins/reporting/server/usage/get_export_stats.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* 2.0.
*/

import { DEPRECATED_JOB_TYPES } from '@kbn/reporting-common';
import { DEPRECATED_JOB_TYPES } from '../../common/constants';
import { ExportTypesHandler } from './get_export_type_handler';
import {
AvailableTotal,
Expand Down

0 comments on commit 207cdee

Please sign in to comment.