geido commented on code in PR #20589:
URL: https://github.com/apache/superset/pull/20589#discussion_r913769064
##########
superset-frontend/src/dashboard/components/DashboardBuilder/DashboardContainer.tsx:
##########
@@ -122,6 +132,65 @@ const DashboardContainer: FC<DashboardContainerProps> = ({
topLevelTabs }) => {
dispatch(setInScopeStatusOfFilters(scopes));
}, [nativeFilterScopes, dashboardLayout, dispatch]);
+ useEffect(() => {
+ const currentMetadata =
+ dashboardInfo.json_metadata?.length &&
JSON.parse(dashboardInfo.json_metadata);
+ if (currentMetadata?.color_scheme) {
+ const metadata = {...currentMetadata};
+ const colorScheme = metadata?.color_scheme;
+ const colorSchemeDomain = metadata?.color_scheme_domain || [];
+ const colorNamespace = metadata?.color_namespace || '';
+ const categoricalSchemes = getCategoricalSchemeRegistry();
+ const registryColorSchemeDomain =
categoricalSchemes.get(colorScheme)?.colors || [];
+ const defaultColorScheme = categoricalSchemes.defaultKey;
+ const isColorSchemeExisting = !!categoricalSchemes.get(colorScheme);
+ const updateDashboard = () => {
+ SupersetClient.put({
+ endpoint: `/api/v1/dashboard/${dashboardInfo.id}`,
+ headers: { 'Content-Type': 'application/json' },
+ body: JSON.stringify({
+ json_metadata: jsonStringify(metadata),
+ }),
+ }).then(() => {
+ dispatch(dashboardInfoChanged({
+ metadata,
+ }));
+ dispatch(setColorScheme(defaultColorScheme))
+ })
+ }
+ const genColorMap = (scheme: string, update = false) => {
+ // TODO: to check why colorMap is always empty
+ const colorMap = getSharedLabelColor().getColorMap(
Review Comment:
@stephenLYZ it looks like shared_label_colors are only generated for
rendered charts
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]