From 74b48d9d26246550ea2d73fe2bc65c4217da9b25 Mon Sep 17 00:00:00 2001 From: Timothy Sullivan Date: Wed, 15 Apr 2020 11:45:44 -0700 Subject: [PATCH] feedbacks --- .../plugins/reporting/server/lib/esqueue/worker.js | 11 ++++------- x-pack/legacy/plugins/reporting/types.d.ts | 3 ++- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/x-pack/legacy/plugins/reporting/server/lib/esqueue/worker.js b/x-pack/legacy/plugins/reporting/server/lib/esqueue/worker.js index 0352c1bac1ea6..ab0bb6740f078 100644 --- a/x-pack/legacy/plugins/reporting/server/lib/esqueue/worker.js +++ b/x-pack/legacy/plugins/reporting/server/lib/esqueue/worker.js @@ -285,13 +285,10 @@ export class Worker extends events.EventEmitter { const completedTime = moment().toISOString(); const docOutput = this._formatOutput(output); - let status; - if (output && output.warnings && output.warnings.length > 0) { - status = constants.JOB_STATUS_WARNINGS; - } else { - status = constants.JOB_STATUS_COMPLETED; - } - + const status = + output && output.warnings && output.warnings.length > 0 + ? constants.JOB_STATUS_WARNINGS + : constants.JOB_STATUS_COMPLETED; const doc = { status, completed_at: completedTime, diff --git a/x-pack/legacy/plugins/reporting/types.d.ts b/x-pack/legacy/plugins/reporting/types.d.ts index eec7da7dc6733..2e7da6663ab03 100644 --- a/x-pack/legacy/plugins/reporting/types.d.ts +++ b/x-pack/legacy/plugins/reporting/types.d.ts @@ -8,6 +8,7 @@ import { EventEmitter } from 'events'; import { ResponseObject } from 'hapi'; import { Legacy } from 'kibana'; import { CallCluster } from '../../../../src/legacy/core_plugins/elasticsearch'; +import { JobStatus } from '../../../plugins/reporting'; // reporting new platform import { CancellationToken } from './common/cancellation_token'; import { ReportingCore } from './server/core'; import { LevelLogger } from './server/lib/level_logger'; @@ -150,7 +151,7 @@ export interface JobSource { jobtype: string; output: JobDocOutput; payload: JobDocPayload; - status: string; // completed, failed, etc + status: JobStatus; }; }