Skip to content

Commit

Permalink
Use constants for license type keywords
Browse files Browse the repository at this point in the history
  • Loading branch information
tsullivan committed Dec 5, 2019
1 parent a50757d commit 7870e26
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 8 deletions.
6 changes: 6 additions & 0 deletions x-pack/legacy/plugins/reporting/common/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,9 @@ export const PNG_JOB_TYPE = 'PNG';
export const CSV_JOB_TYPE = 'csv';
export const CSV_FROM_SAVEDOBJECT_JOB_TYPE = 'csv_from_savedobject';
export const USES_HEADLESS_JOB_TYPES = [PDF_JOB_TYPE, PNG_JOB_TYPE];

export const LICENSE_TYPE_TRIAL = 'trial';
export const LICENSE_TYPE_BASIC = 'basic';
export const LICENSE_TYPE_STANDARD = 'standard';
export const LICENSE_TYPE_GOLD = 'gold';
export const LICENSE_TYPE_PLATINUM = 'platinum';
17 changes: 15 additions & 2 deletions x-pack/legacy/plugins/reporting/export_types/csv/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,14 @@
* you may not use this file except in compliance with the Elastic License.
*/

import { CSV_JOB_TYPE as jobType } from '../../common/constants';
import {
CSV_JOB_TYPE as jobType,
LICENSE_TYPE_TRIAL,
LICENSE_TYPE_BASIC,
LICENSE_TYPE_STANDARD,
LICENSE_TYPE_GOLD,
LICENSE_TYPE_PLATINUM,
} from '../../common/constants';
import { ExportTypeDefinition, ESQueueCreateJobFn, ESQueueWorkerExecuteFn } from '../../types';
import { metadata } from './metadata';
import { createJobFactory } from './server/create_job';
Expand All @@ -22,5 +29,11 @@ export const getExportType = (): ExportTypeDefinition<
jobContentExtension: 'csv',
createJobFactory,
executeJobFactory,
validLicenses: ['trial', 'basic', 'standard', 'gold', 'platinum'],
validLicenses: [
LICENSE_TYPE_TRIAL,
LICENSE_TYPE_BASIC,
LICENSE_TYPE_STANDARD,
LICENSE_TYPE_GOLD,
LICENSE_TYPE_PLATINUM,
],
});
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,14 @@
* you may not use this file except in compliance with the Elastic License.
*/

import { CSV_FROM_SAVEDOBJECT_JOB_TYPE } from '../../common/constants';
import {
CSV_FROM_SAVEDOBJECT_JOB_TYPE,
LICENSE_TYPE_TRIAL,
LICENSE_TYPE_BASIC,
LICENSE_TYPE_STANDARD,
LICENSE_TYPE_GOLD,
LICENSE_TYPE_PLATINUM,
} from '../../common/constants';
import { ExportTypeDefinition, ImmediateCreateJobFn, ImmediateExecuteFn } from '../../types';
import { createJobFactory } from './server/create_job';
import { executeJobFactory } from './server/execute_job';
Expand All @@ -29,5 +36,11 @@ export const getExportType = (): ExportTypeDefinition<
jobContentExtension: 'csv',
createJobFactory,
executeJobFactory,
validLicenses: ['trial', 'basic', 'standard', 'gold', 'platinum'],
validLicenses: [
LICENSE_TYPE_TRIAL,
LICENSE_TYPE_BASIC,
LICENSE_TYPE_STANDARD,
LICENSE_TYPE_GOLD,
LICENSE_TYPE_PLATINUM,
],
});
15 changes: 13 additions & 2 deletions x-pack/legacy/plugins/reporting/export_types/png/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,13 @@
* you may not use this file except in compliance with the Elastic License.
*/

import { PNG_JOB_TYPE as jobType } from '../../common/constants';
import {
PNG_JOB_TYPE as jobType,
LICENSE_TYPE_TRIAL,
LICENSE_TYPE_STANDARD,
LICENSE_TYPE_GOLD,
LICENSE_TYPE_PLATINUM,
} from '../../common/constants';
import { ExportTypeDefinition, ESQueueCreateJobFn, ESQueueWorkerExecuteFn } from '../../types';
import { createJobFactory } from './server/create_job';
import { executeJobFactory } from './server/execute_job';
Expand All @@ -23,5 +29,10 @@ export const getExportType = (): ExportTypeDefinition<
jobContentExtension: 'PNG',
createJobFactory,
executeJobFactory,
validLicenses: ['trial', 'standard', 'gold', 'platinum'],
validLicenses: [
LICENSE_TYPE_TRIAL,
LICENSE_TYPE_STANDARD,
LICENSE_TYPE_GOLD,
LICENSE_TYPE_PLATINUM,
],
});
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,13 @@
* you may not use this file except in compliance with the Elastic License.
*/

import { PDF_JOB_TYPE as jobType } from '../../common/constants';
import {
PDF_JOB_TYPE as jobType,
LICENSE_TYPE_TRIAL,
LICENSE_TYPE_STANDARD,
LICENSE_TYPE_GOLD,
LICENSE_TYPE_PLATINUM,
} from '../../common/constants';
import { ExportTypeDefinition, ESQueueCreateJobFn, ESQueueWorkerExecuteFn } from '../../types';
import { createJobFactory } from './server/create_job';
import { executeJobFactory } from './server/execute_job';
Expand All @@ -23,5 +29,10 @@ export const getExportType = (): ExportTypeDefinition<
jobContentExtension: 'pdf',
createJobFactory,
executeJobFactory,
validLicenses: ['trial', 'standard', 'gold', 'platinum'],
validLicenses: [
LICENSE_TYPE_TRIAL,
LICENSE_TYPE_STANDARD,
LICENSE_TYPE_GOLD,
LICENSE_TYPE_PLATINUM,
],
});

0 comments on commit 7870e26

Please sign in to comment.