@superset-ui/core
Version:
80 lines • 4.12 kB
JavaScript
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import logger from './logging';
// We can codegen the enum definition based on a list of supported flags that we
// check into source control. We're hardcoding the supported flags for now.
export var FeatureFlag;
(function (FeatureFlag) {
// PLEASE KEEP THE LIST SORTED ALPHABETICALLY
FeatureFlag["AlertsAttachReports"] = "ALERTS_ATTACH_REPORTS";
FeatureFlag["AlertReports"] = "ALERT_REPORTS";
FeatureFlag["AlertReportTabs"] = "ALERT_REPORT_TABS";
FeatureFlag["AlertReportSlackV2"] = "ALERT_REPORT_SLACK_V2";
FeatureFlag["AllowFullCsvExport"] = "ALLOW_FULL_CSV_EXPORT";
FeatureFlag["AvoidColorsCollision"] = "AVOID_COLORS_COLLISION";
FeatureFlag["ChartPluginsExperimental"] = "CHART_PLUGINS_EXPERIMENTAL";
FeatureFlag["ConfirmDashboardDiff"] = "CONFIRM_DASHBOARD_DIFF";
/** @deprecated */
FeatureFlag["DashboardCrossFilters"] = "DASHBOARD_CROSS_FILTERS";
FeatureFlag["DashboardVirtualization"] = "DASHBOARD_VIRTUALIZATION";
FeatureFlag["DashboardRbac"] = "DASHBOARD_RBAC";
FeatureFlag["DatapanelClosedByDefault"] = "DATAPANEL_CLOSED_BY_DEFAULT";
FeatureFlag["DisableLegacyDatasourceEditor"] = "DISABLE_LEGACY_DATASOURCE_EDITOR";
FeatureFlag["DrillToDetail"] = "DRILL_TO_DETAIL";
FeatureFlag["DrillBy"] = "DRILL_BY";
FeatureFlag["DynamicPlugins"] = "DYNAMIC_PLUGINS";
FeatureFlag["EmbeddableCharts"] = "EMBEDDABLE_CHARTS";
FeatureFlag["EmbeddedSuperset"] = "EMBEDDED_SUPERSET";
FeatureFlag["EnableAdvancedDataTypes"] = "ENABLE_ADVANCED_DATA_TYPES";
/** @deprecated */
FeatureFlag["EnableJavascriptControls"] = "ENABLE_JAVASCRIPT_CONTROLS";
FeatureFlag["EnableTemplateProcessing"] = "ENABLE_TEMPLATE_PROCESSING";
FeatureFlag["EscapeMarkdownHtml"] = "ESCAPE_MARKDOWN_HTML";
FeatureFlag["EstimateQueryCost"] = "ESTIMATE_QUERY_COST";
FeatureFlag["GlobalAsyncQueries"] = "GLOBAL_ASYNC_QUERIES";
FeatureFlag["HorizontalFilterBar"] = "HORIZONTAL_FILTER_BAR";
FeatureFlag["ListviewsDefaultCardView"] = "LISTVIEWS_DEFAULT_CARD_VIEW";
FeatureFlag["ScheduledQueries"] = "SCHEDULED_QUERIES";
FeatureFlag["ShareQueriesViaKvStore"] = "SHARE_QUERIES_VIA_KV_STORE";
FeatureFlag["SqllabBackendPersistence"] = "SQLLAB_BACKEND_PERSISTENCE";
FeatureFlag["SqlValidatorsByEngine"] = "SQL_VALIDATORS_BY_ENGINE";
FeatureFlag["SshTunneling"] = "SSH_TUNNELING";
FeatureFlag["TaggingSystem"] = "TAGGING_SYSTEM";
FeatureFlag["Thumbnails"] = "THUMBNAILS";
FeatureFlag["UseAnalagousColors"] = "USE_ANALAGOUS_COLORS";
FeatureFlag["ForceSqlLabRunAsync"] = "SQLLAB_FORCE_RUN_ASYNC";
FeatureFlag["SlackEnableAvatars"] = "SLACK_ENABLE_AVATARS";
FeatureFlag["EnableDashboardScreenshotEndpoints"] = "ENABLE_DASHBOARD_SCREENSHOT_ENDPOINTS";
FeatureFlag["EnableDashboardDownloadWebDriverScreenshot"] = "ENABLE_DASHBOARD_DOWNLOAD_WEBDRIVER_SCREENSHOT";
})(FeatureFlag || (FeatureFlag = {}));
export function initFeatureFlags(featureFlags) {
if (!window.featureFlags) {
window.featureFlags = featureFlags || {};
}
}
export function isFeatureEnabled(feature) {
try {
return !!window.featureFlags[feature];
}
catch (error) {
logger.error(`Failed to query feature flag ${feature}`);
}
return false;
}
//# sourceMappingURL=featureFlags.js.map