justinpark commented on code in PR #27717: URL: https://github.com/apache/superset/pull/27717#discussion_r1543317759
########## superset-frontend/src/explore/components/DatasourcePanel/index.tsx: ########## @@ -122,18 +127,48 @@ const StyledInfoboxWrapper = styled.div` const BORDER_WIDTH = 2; +const sortCertifiedFirst = (slice: DataSourcePanelColumn[]) => + slice.sort((a, b) => (b?.is_certified ?? 0) - (a?.is_certified ?? 0)); + export default function DataSourcePanel({ datasource, formData, controls: { datasource: datasourceControl }, actions, width, }: Props) { + const [dropzones] = useContext(DropzoneContext); const { columns: _columns, metrics } = datasource; + const extra = useMemo<{ disallow_adhoc_metrics?: boolean }>(() => { + let extra = {}; + if (datasource?.extra) { + try { + extra = JSON.parse(datasource.extra); + } catch {} // eslint-disable-line no-empty + } + return extra; + }, [datasource.extra]); + const allowlistOnly = extra.disallow_adhoc_metrics; + + const allowedColumns = useMemo(() => { + const validators = Object.values(dropzones); + if (!isArray(_columns)) return []; + return allowlistOnly Review Comment: > In other words, could we always validate the items with the default implementation being that all items are allowed? @michael-s-molina As mentioned earlier, in the adhoc query, all columns and metrics are accepted. Therefore, applying additional filtering in cases where non-`disallowed-adhoc` case can be considered unnecessary. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org For additional commands, e-mail: notifications-h...@superset.apache.org