Move license constants from /server to /common (#32723)

* Move license constants to /common

* Fix export

* Use constant for required license type

* Remove OSS from license types
This commit is contained in:
Jen Huang 2019-03-07 20:55:20 -08:00 committed by GitHub
parent a854a1157c
commit 7afd091ecb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 25 additions and 13 deletions

View file

@ -10,3 +10,13 @@ export {
LICENSE_STATUS_EXPIRED,
LICENSE_STATUS_VALID,
} from './license_status';
export {
LICENSE_TYPE_BASIC,
LICENSE_TYPE_STANDARD,
LICENSE_TYPE_GOLD,
LICENSE_TYPE_PLATINUM,
LICENSE_TYPE_TRIAL,
RANKED_LICENSE_TYPES,
LicenseType,
} from './license_types';

View file

@ -10,6 +10,13 @@ export const LICENSE_TYPE_GOLD = 'gold';
export const LICENSE_TYPE_PLATINUM = 'platinum';
export const LICENSE_TYPE_TRIAL = 'trial';
export type LicenseType =
| typeof LICENSE_TYPE_BASIC
| typeof LICENSE_TYPE_STANDARD
| typeof LICENSE_TYPE_GOLD
| typeof LICENSE_TYPE_PLATINUM
| typeof LICENSE_TYPE_TRIAL;
// These are ordered from least featureful to most featureful, so we can assume that someone holding
// a license at a particular index cannot access any features unlocked by the licenses that follow it.
export const RANKED_LICENSE_TYPES = [

View file

@ -5,11 +5,12 @@
*/
import { i18n } from '@kbn/i18n';
import { LICENSE_TYPE_BASIC } from '../../../../common/constants';
export const PLUGIN = {
ID: 'index_management',
NAME: i18n.translate('xpack.idxMgmt.appTitle', {
defaultMessage: 'Index Management'
}),
MINIMUM_LICENSE_REQUIRED: 'basic',
MINIMUM_LICENSE_REQUIRED: LICENSE_TYPE_BASIC,
};

View file

@ -5,11 +5,12 @@
*/
import { i18n } from '@kbn/i18n';
import { LICENSE_TYPE_BASIC } from '../../../../common/constants';
export const PLUGIN = {
ID: 'license_management',
NAME: i18n.translate('xpack.licenseMgmt.managementSectionDisplayName', {
defaultMessage: 'License Management',
}),
MINIMUM_LICENSE_REQUIRED: 'basic',
MINIMUM_LICENSE_REQUIRED: LICENSE_TYPE_BASIC,
};

View file

@ -5,12 +5,12 @@
*/
import { i18n } from '@kbn/i18n';
import { RANKED_LICENSE_TYPES } from '../constants';
import {
LICENSE_STATUS_UNAVAILABLE,
LICENSE_STATUS_INVALID,
LICENSE_STATUS_EXPIRED,
LICENSE_STATUS_VALID,
RANKED_LICENSE_TYPES,
} from '../../../common/constants';
export function checkLicense(pluginName, minimumLicenseRequired, xpackLicenseInfo) {

View file

@ -10,12 +10,13 @@ import {
LICENSE_STATUS_UNAVAILABLE,
LICENSE_STATUS_EXPIRED,
LICENSE_STATUS_VALID,
LICENSE_TYPE_BASIC,
} from '../../../common/constants';
describe('check_license', function () {
const pluginName = 'Foo';
const minimumLicenseRequired = 'basic';
const minimumLicenseRequired = LICENSE_TYPE_BASIC;
let mockLicenseInfo;
beforeEach(() => mockLicenseInfo = {});
@ -46,7 +47,7 @@ describe('check_license', function () {
describe('license information is available', () => {
beforeEach(() => {
mockLicenseInfo.isAvailable = () => true;
set(mockLicenseInfo, 'license.getType', () => 'basic');
set(mockLicenseInfo, 'license.getType', () => LICENSE_TYPE_BASIC);
});
describe('& license is trial, standard, gold, platinum', () => {

View file

@ -6,11 +6,3 @@
export { XPACK_DEFAULT_ADMIN_EMAIL_UI_SETTING } from './admin';
export { XPACK_INFO_API_DEFAULT_POLL_FREQUENCY_IN_MILLIS } from './xpack_info';
export {
LICENSE_TYPE_BASIC,
LICENSE_TYPE_STANDARD,
LICENSE_TYPE_GOLD,
LICENSE_TYPE_PLATINUM,
LICENSE_TYPE_TRIAL,
RANKED_LICENSE_TYPES,
} from './license';