switch to using featureEnabled for enterprise features (#41559)

* switch to using featureEnabled for enterprise features
This commit is contained in:
Dan Cech
2022-01-07 15:11:23 -05:00
committed by GitHub
parent 9eb82f9fff
commit 34f757ba5a
34 changed files with 109 additions and 148 deletions
+1 -8
View File
@@ -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 };
}
/**
-1
View File
@@ -124,7 +124,6 @@ export class GrafanaBootConfig implements GrafanaConfig {
version: 'v1.0',
commit: '1',
env: 'production',
isEnterprise: false,
},
viewersCanEdit: false,
editorsCanAdmin: false,
+1
View File
@@ -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];
};