mirror of https://github.com/apache/superset.git
chore: Feature flag for embedding charts (#20804)
* Add EMBEDDABLE_CHARTS feature flag * Pretty * Update test
This commit is contained in:
parent
cb9ae38361
commit
a69f016bca
|
@ -56,6 +56,7 @@ export enum FeatureFlag {
|
||||||
GENERIC_CHART_AXES = 'GENERIC_CHART_AXES',
|
GENERIC_CHART_AXES = 'GENERIC_CHART_AXES',
|
||||||
USE_ANALAGOUS_COLORS = 'USE_ANALAGOUS_COLORS',
|
USE_ANALAGOUS_COLORS = 'USE_ANALAGOUS_COLORS',
|
||||||
DASHBOARD_EDIT_CHART_IN_NEW_TAB = 'DASHBOARD_EDIT_CHART_IN_NEW_TAB',
|
DASHBOARD_EDIT_CHART_IN_NEW_TAB = 'DASHBOARD_EDIT_CHART_IN_NEW_TAB',
|
||||||
|
EMBEDDABLE_CHARTS = 'EMBEDDABLE_CHARTS',
|
||||||
}
|
}
|
||||||
export type ScheduleQueriesProps = {
|
export type ScheduleQueriesProps = {
|
||||||
JSONSCHEMA: {
|
JSONSCHEMA: {
|
||||||
|
|
|
@ -25,12 +25,17 @@ import fetchMock from 'fetch-mock';
|
||||||
import * as chartAction from 'src/components/Chart/chartAction';
|
import * as chartAction from 'src/components/Chart/chartAction';
|
||||||
import * as downloadAsImage from 'src/utils/downloadAsImage';
|
import * as downloadAsImage from 'src/utils/downloadAsImage';
|
||||||
import * as exploreUtils from 'src/explore/exploreUtils';
|
import * as exploreUtils from 'src/explore/exploreUtils';
|
||||||
|
import { FeatureFlag } from '@superset-ui/core';
|
||||||
import ExploreHeader from '.';
|
import ExploreHeader from '.';
|
||||||
|
|
||||||
const chartEndpoint = 'glob:*api/v1/chart/*';
|
const chartEndpoint = 'glob:*api/v1/chart/*';
|
||||||
|
|
||||||
fetchMock.get(chartEndpoint, { json: 'foo' });
|
fetchMock.get(chartEndpoint, { json: 'foo' });
|
||||||
|
|
||||||
|
window.featureFlags = {
|
||||||
|
[FeatureFlag.EMBEDDABLE_CHARTS]: true,
|
||||||
|
};
|
||||||
|
|
||||||
const createProps = () => ({
|
const createProps = () => ({
|
||||||
chart: {
|
chart: {
|
||||||
id: 1,
|
id: 1,
|
||||||
|
|
|
@ -29,6 +29,7 @@ import downloadAsImage from 'src/utils/downloadAsImage';
|
||||||
import { getChartPermalink } from 'src/utils/urlUtils';
|
import { getChartPermalink } from 'src/utils/urlUtils';
|
||||||
import copyTextToClipboard from 'src/utils/copy';
|
import copyTextToClipboard from 'src/utils/copy';
|
||||||
import HeaderReportDropDown from 'src/components/ReportModal/HeaderReportDropdown';
|
import HeaderReportDropDown from 'src/components/ReportModal/HeaderReportDropdown';
|
||||||
|
import { isFeatureEnabled, FeatureFlag } from 'src/featureFlags';
|
||||||
import ViewQueryModal from '../controls/ViewQueryModal';
|
import ViewQueryModal from '../controls/ViewQueryModal';
|
||||||
import EmbedCodeContent from '../EmbedCodeContent';
|
import EmbedCodeContent from '../EmbedCodeContent';
|
||||||
|
|
||||||
|
@ -297,23 +298,25 @@ export const useExploreAdditionalActionsMenu = (
|
||||||
<Menu.Item key={MENU_KEYS.SHARE_BY_EMAIL}>
|
<Menu.Item key={MENU_KEYS.SHARE_BY_EMAIL}>
|
||||||
{t('Share chart by email')}
|
{t('Share chart by email')}
|
||||||
</Menu.Item>
|
</Menu.Item>
|
||||||
<Menu.Item key={MENU_KEYS.EMBED_CODE}>
|
{isFeatureEnabled(FeatureFlag.EMBEDDABLE_CHARTS) ? (
|
||||||
<ModalTrigger
|
<Menu.Item key={MENU_KEYS.EMBED_CODE}>
|
||||||
triggerNode={
|
<ModalTrigger
|
||||||
<span data-test="embed-code-button">{t('Embed code')}</span>
|
triggerNode={
|
||||||
}
|
<span data-test="embed-code-button">{t('Embed code')}</span>
|
||||||
modalTitle={t('Embed code')}
|
}
|
||||||
modalBody={
|
modalTitle={t('Embed code')}
|
||||||
<EmbedCodeContent
|
modalBody={
|
||||||
formData={latestQueryFormData}
|
<EmbedCodeContent
|
||||||
addDangerToast={addDangerToast}
|
formData={latestQueryFormData}
|
||||||
/>
|
addDangerToast={addDangerToast}
|
||||||
}
|
/>
|
||||||
maxWidth={`${theme.gridUnit * 100}px`}
|
}
|
||||||
destroyOnClose
|
maxWidth={`${theme.gridUnit * 100}px`}
|
||||||
responsive
|
destroyOnClose
|
||||||
/>
|
responsive
|
||||||
</Menu.Item>
|
/>
|
||||||
|
</Menu.Item>
|
||||||
|
) : null}
|
||||||
</Menu.SubMenu>
|
</Menu.SubMenu>
|
||||||
<Menu.Divider />
|
<Menu.Divider />
|
||||||
{showReportSubMenu ? (
|
{showReportSubMenu ? (
|
||||||
|
|
|
@ -436,6 +436,8 @@ DEFAULT_FEATURE_FLAGS: Dict[str, bool] = {
|
||||||
# Enable caching per impersonation key (e.g username) in a datasource where user
|
# Enable caching per impersonation key (e.g username) in a datasource where user
|
||||||
# impersonation is enabled
|
# impersonation is enabled
|
||||||
"CACHE_IMPERSONATION": False,
|
"CACHE_IMPERSONATION": False,
|
||||||
|
# Enable sharing charts with embedding
|
||||||
|
"EMBEDDABLE_CHARTS": True,
|
||||||
}
|
}
|
||||||
|
|
||||||
# Feature flags may also be set via 'SUPERSET_FEATURE_' prefixed environment vars.
|
# Feature flags may also be set via 'SUPERSET_FEATURE_' prefixed environment vars.
|
||||||
|
|
Loading…
Reference in New Issue