-
Notifications
You must be signed in to change notification settings - Fork 8.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Reporting] Clean Up TypeScript Definitions #76566
Changes from all commits
0b707f3
ced626f
e97574b
c72952e
cd02b16
481ec4f
945ace9
60b9048
7cf43d8
929199e
8d4a32c
759389f
cca970a
08520f9
959c215
42dc16a
9c13f38
165734a
f8b449f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,12 @@ | |
// 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/lib/layouts'; | ||
import { LayoutParams } from '../server/lib/layouts'; | ||
export { LayoutParams }; | ||
// eslint-disable-next-line @kbn/eslint/no-restricted-paths | ||
export { ReportDocument, ReportSource } from '../server/lib/store/report'; | ||
// eslint-disable-next-line @kbn/eslint/no-restricted-paths | ||
export { BaseParams } from '../server/types'; | ||
|
||
export type JobId = string; | ||
export type JobStatus = | ||
|
@@ -17,45 +22,43 @@ export type JobStatus = | |
| 'processing' | ||
| 'failed'; | ||
|
||
export interface SourceJob { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. duplicate of |
||
_id: JobId; | ||
_source: { | ||
status: JobStatus; | ||
output: { | ||
max_size_reached: boolean; | ||
csv_contains_formulas: boolean; | ||
}; | ||
payload: { | ||
type: string; | ||
title: string; | ||
}; | ||
}; | ||
} | ||
|
||
export interface JobContent { | ||
content: string; | ||
} | ||
|
||
export interface JobSummary { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. moved this public-only types to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. And renamed to |
||
id: JobId; | ||
status: JobStatus; | ||
title: string; | ||
type: string; | ||
maxSizeReached: boolean; | ||
csvContainsFormulas: boolean; | ||
} | ||
|
||
export interface JobStatusBuckets { | ||
completed: JobSummary[]; | ||
failed: JobSummary[]; | ||
export interface ReportApiJSON { | ||
id: string; | ||
index: string; | ||
kibana_name: string; | ||
kibana_id: string; | ||
browser_type: string | undefined; | ||
created_at: string; | ||
priority?: number; | ||
jobtype: string; | ||
created_by: string | false; | ||
timeout?: number; | ||
output?: { | ||
content_type: string; | ||
size: number; | ||
warnings?: string[]; | ||
}; | ||
process_expiration?: string; | ||
completed_at: string | undefined; | ||
payload: { | ||
layout?: LayoutParams; | ||
title: string; | ||
browserTimezone?: string; | ||
}; | ||
meta: { | ||
layout?: string; | ||
objectType: string; | ||
}; | ||
max_attempts: number; | ||
started_at: string | undefined; | ||
attempts: number; | ||
status: string; | ||
} | ||
|
||
type DownloadLink = string; | ||
export type DownloadReportFn = (jobId: JobId) => DownloadLink; | ||
|
||
type ManagementLink = string; | ||
export type ManagementLinkFn = () => ManagementLink; | ||
|
||
export interface PollerOptions { | ||
functionToPoll: () => Promise<any>; | ||
pollFrequencyInMillis: number; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,8 @@ | |
import { EuiButton } from '@elastic/eui'; | ||
import { FormattedMessage } from '@kbn/i18n/react'; | ||
import React from 'react'; | ||
import { JobId, JobSummary } from '../../common/types'; | ||
import { JobSummary } from '../'; | ||
import { JobId } from '../../common/types'; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Moved |
||
|
||
interface Props { | ||
getUrl: (jobId: JobId) => string; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,8 +9,8 @@ import { i18n } from '@kbn/i18n'; | |
import { FormattedMessage } from '@kbn/i18n/react'; | ||
import React, { Fragment } from 'react'; | ||
import { ToastInput } from 'src/core/public'; | ||
import { JobSummary, ManagementLinkFn } from '../'; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks like VS Code started organizing imports using different rules |
||
import { toMountPoint } from '../../../../../src/plugins/kibana_react/public'; | ||
import { JobSummary, ManagementLinkFn } from '../../common/types'; | ||
|
||
export const getFailureToast = ( | ||
errorText: string, | ||
|
@@ -22,7 +22,7 @@ export const getFailureToast = ( | |
<FormattedMessage | ||
id="xpack.reporting.publicNotifier.error.couldNotCreateReportTitle" | ||
defaultMessage="Could not create report for {reportObjectType} '{reportObjectTitle}'." | ||
values={{ reportObjectType: job.type, reportObjectTitle: job.title }} | ||
values={{ reportObjectType: job.jobtype, reportObjectTitle: job.title }} | ||
/> | ||
), | ||
text: toMountPoint( | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,8 +7,9 @@ | |
import { FormattedMessage } from '@kbn/i18n/react'; | ||
import React, { Fragment } from 'react'; | ||
import { ToastInput } from 'src/core/public'; | ||
import { JobSummary } from '../'; | ||
import { toMountPoint } from '../../../../../src/plugins/kibana_react/public'; | ||
import { JobId, JobSummary } from '../../common/types'; | ||
import { JobId } from '../../common/types'; | ||
import { DownloadButton } from './job_download_button'; | ||
import { ReportLink } from './report_link'; | ||
|
||
|
@@ -21,7 +22,7 @@ export const getWarningFormulasToast = ( | |
<FormattedMessage | ||
id="xpack.reporting.publicNotifier.csvContainsFormulas.formulaReportTitle" | ||
defaultMessage="Report may contain formulas {reportObjectType} '{reportObjectTitle}'" | ||
values={{ reportObjectType: job.type, reportObjectTitle: job.title }} | ||
values={{ reportObjectType: job.jobtype, reportObjectTitle: job.title }} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Had to rename this because it is confusing: the function that creates a |
||
/> | ||
), | ||
text: toMountPoint( | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,17 +41,17 @@ export interface Job { | |
type: string; | ||
object_type: string; | ||
object_title: string; | ||
created_by?: string; | ||
created_by?: string | false; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This one still kinda bugs me, but understand why we have it There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yeah, it would have been nice to map this differently from the beginning |
||
created_at: string; | ||
started_at?: string; | ||
completed_at?: string; | ||
status: string; | ||
statusLabel: string; | ||
max_size_reached: boolean; | ||
max_size_reached?: boolean; | ||
attempts: number; | ||
max_attempts: number; | ||
csv_contains_formulas: boolean; | ||
warnings: string[]; | ||
warnings?: string[]; | ||
} | ||
|
||
export interface Props { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,10 +7,31 @@ | |
import { PluginInitializerContext } from 'src/core/public'; | ||
import { ReportingPublicPlugin } from './plugin'; | ||
import * as jobCompletionNotifications from './lib/job_completion_notifications'; | ||
import { JobId, JobStatus } from '../common/types'; | ||
|
||
export function plugin(initializerContext: PluginInitializerContext) { | ||
return new ReportingPublicPlugin(initializerContext); | ||
} | ||
|
||
export { ReportingPublicPlugin as Plugin }; | ||
export { jobCompletionNotifications }; | ||
|
||
export interface JobSummary { | ||
id: JobId; | ||
status: JobStatus; | ||
title: string; | ||
jobtype: string; | ||
maxSizeReached?: boolean; | ||
csvContainsFormulas?: boolean; | ||
} | ||
|
||
export interface JobSummarySet { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Renamed from |
||
completed: JobSummary[]; | ||
failed: JobSummary[]; | ||
} | ||
|
||
type DownloadLink = string; | ||
export type DownloadReportFn = (jobId: JobId) => DownloadLink; | ||
|
||
type ManagementLink = string; | ||
export type ManagementLinkFn = () => ManagementLink; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These will now be used in the UI integration as types for AJAX payloads :)