From de047c6c31139bfc681bd8e56f8f4bb44f39a764 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=CA=88=E1=B5=83=E1=B5=A2?= Date: Fri, 18 Dec 2020 23:22:47 -0800 Subject: [PATCH] fix(chart): replace viz_type with viz name from registry for list view (#12144) --- superset-frontend/src/views/CRUD/chart/ChartList.tsx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/superset-frontend/src/views/CRUD/chart/ChartList.tsx b/superset-frontend/src/views/CRUD/chart/ChartList.tsx index 018d551b5d..f262578b06 100644 --- a/superset-frontend/src/views/CRUD/chart/ChartList.tsx +++ b/superset-frontend/src/views/CRUD/chart/ChartList.tsx @@ -63,6 +63,8 @@ const CONFIRM_OVERWRITE_MESSAGE = t( 'sure you want to overwrite?', ); +const registry = getChartMetadataRegistry(); + const createFetchDatasets = (handleError: (err: Response) => void) => async ( filterValue = '', pageIndex?: number, @@ -214,7 +216,7 @@ function ChartList(props: ChartListProps) { row: { original: { viz_type: vizType }, }, - }: any) => vizType, + }: any) => registry.get(vizType)?.name || vizType, Header: t('Visualization Type'), accessor: 'viz_type', size: 'xxl', @@ -412,9 +414,9 @@ function ChartList(props: ChartListProps) { input: 'select', operator: FilterOperators.equals, unfilteredLabel: 'All', - selects: getChartMetadataRegistry() + selects: registry .keys() - .map(k => ({ label: k, value: k })) + .map(k => ({ label: registry.get(k)?.name || k, value: k })) .sort((a, b) => { if (!a.label || !b.label) { return 0;