switch to using featureEnabled for enterprise features (#41559)
* switch to using featureEnabled for enterprise features
This commit is contained in:
@@ -13,12 +13,6 @@ import { MapLayerOptions } from '../geo/layer';
|
||||
export interface BuildInfo {
|
||||
version: string;
|
||||
commit: string;
|
||||
/**
|
||||
* Is set to true when running Grafana Enterprise edition.
|
||||
*
|
||||
* @deprecated use `licenseInfo.hasLicense` instead
|
||||
*/
|
||||
isEnterprise: boolean;
|
||||
env: string;
|
||||
edition: GrafanaEdition;
|
||||
latestVersion: string;
|
||||
@@ -62,12 +56,11 @@ export interface FeatureToggles {
|
||||
* @public
|
||||
*/
|
||||
export interface LicenseInfo {
|
||||
hasLicense: boolean;
|
||||
expiry: number;
|
||||
licenseUrl: string;
|
||||
stateInfo: string;
|
||||
hasValidLicense: boolean;
|
||||
edition: GrafanaEdition;
|
||||
enabledFeatures: { [key: string]: boolean };
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -124,7 +124,6 @@ export class GrafanaBootConfig implements GrafanaConfig {
|
||||
version: 'v1.0',
|
||||
commit: '1',
|
||||
env: 'production',
|
||||
isEnterprise: false,
|
||||
},
|
||||
viewersCanEdit: false,
|
||||
editorsCanAdmin: false,
|
||||
|
||||
@@ -8,6 +8,7 @@ export * from './config';
|
||||
export * from './types';
|
||||
export { loadPluginCss, SystemJS, PluginCssOptions } from './utils/plugin';
|
||||
export { reportMetaAnalytics, reportInteraction, reportPageview } from './utils/analytics';
|
||||
export { featureEnabled } from './utils/licensing';
|
||||
export { logInfo, logDebug, logWarning, logError } from './utils/logging';
|
||||
export {
|
||||
DataSourceWithBackend,
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
import { config } from '../config';
|
||||
|
||||
export const featureEnabled = (feature: string): boolean => {
|
||||
const { enabledFeatures } = config.licenseInfo;
|
||||
return enabledFeatures && enabledFeatures[feature];
|
||||
};
|
||||
Reference in New Issue
Block a user