michael-s-molina commented on code in PR #27717: URL: https://github.com/apache/superset/pull/27717#discussion_r1542728959
########## 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: @justinpark If we have the concept of validators where every item is checked to see if it's allowed, similar to a security check, wouldn't be the responsibility of the validator to check for `disallow_adhoc_metrics`? In other words, could we always validate the items with the default implementation being that all items are allowed? This would give us the flexibility to show/hide items depending on any type of condition. -- 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