From 40fa961d53f4d1e2b0307a24796d3febfa003791 Mon Sep 17 00:00:00 2001 From: Tim Sullivan Date: Mon, 1 Mar 2021 10:41:08 -0700 Subject: [PATCH] [Reporting] Remove unused priority field (#92552) * [Reporting] Remove unused priority field * fix test Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> --- x-pack/plugins/reporting/common/types.ts | 2 -- .../public/components/buttons/report_info_button.tsx | 5 ----- x-pack/plugins/reporting/server/lib/store/report.test.ts | 6 ------ x-pack/plugins/reporting/server/lib/store/report.ts | 4 ---- x-pack/plugins/reporting/server/lib/store/store.test.ts | 4 ---- x-pack/plugins/reporting/server/routes/generation.test.ts | 3 --- .../reporting_without_security/job_apis.ts | 1 - 7 files changed, 25 deletions(-) diff --git a/x-pack/plugins/reporting/common/types.ts b/x-pack/plugins/reporting/common/types.ts index e787ccec5fae..3af329cbf030 100644 --- a/x-pack/plugins/reporting/common/types.ts +++ b/x-pack/plugins/reporting/common/types.ts @@ -76,7 +76,6 @@ export interface ReportSource { started_at?: string; completed_at?: string; created_at: string; - priority?: number; process_expiration?: string; } @@ -113,7 +112,6 @@ export interface ReportApiJSON { kibana_id: string; browser_type: string | undefined; created_at: string; - priority?: number; jobtype: string; created_by: string | false; timeout?: number; diff --git a/x-pack/plugins/reporting/public/components/buttons/report_info_button.tsx b/x-pack/plugins/reporting/public/components/buttons/report_info_button.tsx index 84e6903fd4a2..7f2d5b6adcc3 100644 --- a/x-pack/plugins/reporting/public/components/buttons/report_info_button.tsx +++ b/x-pack/plugins/reporting/public/components/buttons/report_info_button.tsx @@ -87,7 +87,6 @@ export class ReportInfoButton extends Component { const attempts = info.attempts ? info.attempts.toString() : NA; const maxAttempts = info.max_attempts ? info.max_attempts.toString() : NA; - const priority = info.priority ? info.priority.toString() : NA; const timeout = info.timeout ? info.timeout.toString() : NA; const warnings = info.output && info.output.warnings ? info.output.warnings.join(',') : null; @@ -153,10 +152,6 @@ export class ReportInfoButton extends Component { title: 'Max Attempts', description: maxAttempts, }, - { - title: 'Priority', - description: priority, - }, { title: 'Timeout', description: timeout, diff --git a/x-pack/plugins/reporting/server/lib/store/report.test.ts b/x-pack/plugins/reporting/server/lib/store/report.test.ts index 1d58b6f36f82..4c5cd755f71c 100644 --- a/x-pack/plugins/reporting/server/lib/store/report.test.ts +++ b/x-pack/plugins/reporting/server/lib/store/report.test.ts @@ -18,7 +18,6 @@ describe('Class Report', () => { payload: { headers: 'payload_test_field', objectType: 'testOt', title: 'cool report' }, meta: { objectType: 'test' }, timeout: 30000, - priority: 1, }); expect(report.toEsDocsJSON()).toMatchObject({ @@ -32,7 +31,6 @@ describe('Class Report', () => { max_attempts: 50, meta: { objectType: 'test' }, payload: { headers: 'payload_test_field', objectType: 'testOt' }, - priority: 1, started_at: undefined, status: 'pending', timeout: 30000, @@ -47,7 +45,6 @@ describe('Class Report', () => { max_attempts: 50, payload: { headers: 'payload_test_field', objectType: 'testOt' }, meta: { objectType: 'test' }, - priority: 1, status: 'pending', timeout: 30000, }); @@ -65,7 +62,6 @@ describe('Class Report', () => { payload: { headers: 'payload_test_field', objectType: 'testOt', title: 'hot report' }, meta: { objectType: 'stange' }, timeout: 30000, - priority: 1, }); const metadata = { @@ -88,7 +84,6 @@ describe('Class Report', () => { max_attempts: 50, meta: { objectType: 'stange' }, payload: { objectType: 'testOt' }, - priority: 1, started_at: undefined, status: 'pending', timeout: 30000, @@ -105,7 +100,6 @@ describe('Class Report', () => { max_attempts: 50, meta: { objectType: 'stange' }, payload: { headers: 'payload_test_field', objectType: 'testOt' }, - priority: 1, started_at: undefined, status: 'pending', timeout: 30000, diff --git a/x-pack/plugins/reporting/server/lib/store/report.ts b/x-pack/plugins/reporting/server/lib/store/report.ts index 0f18ae3b4eac..735ba274322c 100644 --- a/x-pack/plugins/reporting/server/lib/store/report.ts +++ b/x-pack/plugins/reporting/server/lib/store/report.ts @@ -36,7 +36,6 @@ export class Report implements Partial { public readonly started_at?: ReportSource['started_at']; public readonly completed_at?: ReportSource['completed_at']; public readonly process_expiration?: ReportSource['process_expiration']; - public readonly priority?: ReportSource['priority']; public readonly timeout?: ReportSource['timeout']; /* @@ -63,7 +62,6 @@ export class Report implements Partial { this.created_by = opts.created_by || false; this.meta = opts.meta || { objectType: 'unknown' }; this.browser_type = opts.browser_type; - this.priority = opts.priority; this.status = opts.status || JOB_STATUSES.PENDING; this.output = opts.output || null; @@ -98,7 +96,6 @@ export class Report implements Partial { meta: this.meta, timeout: this.timeout, max_attempts: this.max_attempts, - priority: this.priority, browser_type: this.browser_type, status: this.status, attempts: this.attempts, @@ -124,7 +121,6 @@ export class Report implements Partial { meta: this.meta, timeout: this.timeout, max_attempts: this.max_attempts, - priority: this.priority, browser_type: this.browser_type, status: this.status, attempts: this.attempts, diff --git a/x-pack/plugins/reporting/server/lib/store/store.test.ts b/x-pack/plugins/reporting/server/lib/store/store.test.ts index e86b17d4f75e..4e8e113fb069 100644 --- a/x-pack/plugins/reporting/server/lib/store/store.test.ts +++ b/x-pack/plugins/reporting/server/lib/store/store.test.ts @@ -203,7 +203,6 @@ describe('ReportingStore', () => { browserTimezone: 'ABC', }, timeout: 30000, - priority: 1, }); await store.setReportClaimed(report, { testDoc: 'test' } as any); @@ -244,7 +243,6 @@ describe('ReportingStore', () => { browserTimezone: 'BCD', }, timeout: 30000, - priority: 1, }); await store.setReportFailed(report, { errors: 'yes' } as any); @@ -285,7 +283,6 @@ describe('ReportingStore', () => { browserTimezone: 'CDE', }, timeout: 30000, - priority: 1, }); await store.setReportCompleted(report, { certainly_completed: 'yes' } as any); @@ -326,7 +323,6 @@ describe('ReportingStore', () => { browserTimezone: 'utc', }, timeout: 30000, - priority: 1, }); await store.setReportCompleted(report, { diff --git a/x-pack/plugins/reporting/server/routes/generation.test.ts b/x-pack/plugins/reporting/server/routes/generation.test.ts index 490b9b7e4566..f6966a3b28ea 100644 --- a/x-pack/plugins/reporting/server/routes/generation.test.ts +++ b/x-pack/plugins/reporting/server/routes/generation.test.ts @@ -158,7 +158,6 @@ describe('POST /api/reporting/generate', () => { it(`returns 200 if job handler doesn't error`, async () => { callClusterStub.withArgs('index').resolves({ _id: 'foo', _index: 'foo-index' }); - registerJobGenerationRoutes(core, mockLogger); await server.start(); @@ -180,9 +179,7 @@ describe('POST /api/reporting/generate', () => { test1: 'yes', }, }, - priority: 10, status: 'pending', - timeout: 10000, }, path: 'undefined/api/reporting/jobs/download/foo', }); diff --git a/x-pack/test/reporting_api_integration/reporting_without_security/job_apis.ts b/x-pack/test/reporting_api_integration/reporting_without_security/job_apis.ts index 98113ec965bf..99832e3f4b1c 100644 --- a/x-pack/test/reporting_api_integration/reporting_without_security/job_apis.ts +++ b/x-pack/test/reporting_api_integration/reporting_without_security/job_apis.ts @@ -45,7 +45,6 @@ export default function ({ getService }: FtrProviderContext) { created_by: false, jobtype: 'csv', max_attempts: 1, - priority: 10, status: 'pending', timeout: 120000, browser_type: 'chromium', // TODO: remove this field from the API response