mirror of
https://github.com/apache/superset.git
synced 2026-05-12 19:35:17 +00:00
fix(viz-gallery): respect denylist in viz gallery (#22658)
This commit is contained in:
@@ -40,7 +40,7 @@ import {
|
||||
} from '@superset-ui/plugin-chart-echarts';
|
||||
import TableChartPlugin from '@superset-ui/plugin-chart-table';
|
||||
import { LineChartPlugin } from '@superset-ui/preset-chart-xy';
|
||||
import TimeTableChartPlugin from '../../../../visualizations/TimeTable';
|
||||
import TimeTableChartPlugin from 'src/visualizations/TimeTable';
|
||||
import VizTypeControl, { VIZ_TYPE_CONTROL_TEST_ID } from './index';
|
||||
|
||||
jest.useFakeTimers();
|
||||
|
||||
@@ -50,6 +50,7 @@ interface VizTypeGalleryProps {
|
||||
onDoubleClick: () => void;
|
||||
selectedViz: string | null;
|
||||
className?: string;
|
||||
denyList: string[];
|
||||
}
|
||||
|
||||
type VizEntry = {
|
||||
@@ -506,6 +507,7 @@ export default function VizTypeGallery(props: VizTypeGalleryProps) {
|
||||
const chartMetadata: VizEntry[] = useMemo(() => {
|
||||
const result = Object.entries(mountedPluginMetadata)
|
||||
.map(([key, value]) => ({ key, value }))
|
||||
.filter(({ key }) => !props.denyList.includes(key))
|
||||
.filter(
|
||||
({ value }) =>
|
||||
nativeFilterGate(value.behaviors || []) && !value.deprecated,
|
||||
|
||||
@@ -27,6 +27,7 @@ import {
|
||||
import { usePluginContext } from 'src/components/DynamicPlugins';
|
||||
import Modal from 'src/components/Modal';
|
||||
import { noOp } from 'src/utils/common';
|
||||
import getBootstrapData from 'src/utils/getBootstrapData';
|
||||
import VizTypeGallery, {
|
||||
MAX_ADVISABLE_VIZ_GALLERY_WIDTH,
|
||||
} from './VizTypeGallery';
|
||||
@@ -41,6 +42,8 @@ interface VizTypeControlProps {
|
||||
isModalOpenInit?: boolean;
|
||||
}
|
||||
|
||||
const bootstrapData = getBootstrapData();
|
||||
const denyList: string[] = bootstrapData.common.conf.VIZ_TYPE_DENYLIST || [];
|
||||
const metadataRegistry = getChartMetadataRegistry();
|
||||
|
||||
export const VIZ_TYPE_CONTROL_TEST_ID = 'viz-type-control';
|
||||
@@ -141,6 +144,7 @@ const VizTypeControl = ({
|
||||
selectedViz={selectedViz}
|
||||
onChange={setSelectedViz}
|
||||
onDoubleClick={onSubmit}
|
||||
denyList={denyList}
|
||||
/>
|
||||
</UnpaddedModal>
|
||||
</>
|
||||
|
||||
Reference in New Issue
Block a user