mirror of
https://github.com/apache/superset.git
synced 2026-05-12 11:25:56 +00:00
fix(Dashboard): Retain colors when color scheme not set (#30646)
This commit is contained in:
@@ -39,6 +39,7 @@ const propTypes = {
|
||||
canOverwrite: PropTypes.bool.isRequired,
|
||||
canDownload: PropTypes.bool.isRequired,
|
||||
dashboardId: PropTypes.number,
|
||||
colorScheme: PropTypes.string,
|
||||
isStarred: PropTypes.bool.isRequired,
|
||||
slice: PropTypes.object,
|
||||
sliceName: PropTypes.string,
|
||||
@@ -68,6 +69,7 @@ const additionalItemsStyles = theme => css`
|
||||
|
||||
export const ExploreChartHeader = ({
|
||||
dashboardId,
|
||||
colorScheme: dashboardColorScheme,
|
||||
slice,
|
||||
actions,
|
||||
formData,
|
||||
@@ -84,17 +86,15 @@ export const ExploreChartHeader = ({
|
||||
const dispatch = useDispatch();
|
||||
const { latestQueryFormData, sliceFormData } = chart;
|
||||
const [isPropertiesModalOpen, setIsPropertiesModalOpen] = useState(false);
|
||||
|
||||
const updateCategoricalNamespace = async () => {
|
||||
const { dashboards } = metadata || {};
|
||||
const dashboard =
|
||||
dashboardId && dashboards && dashboards.find(d => d.id === dashboardId);
|
||||
|
||||
if (!dashboard) {
|
||||
if (!dashboard || !dashboardColorScheme) {
|
||||
// clean up color namespace and shared color maps
|
||||
// to avoid colors spill outside of dashboard context
|
||||
resetColors(metadata?.color_namespace);
|
||||
return;
|
||||
}
|
||||
|
||||
if (dashboard) {
|
||||
@@ -108,6 +108,7 @@ export const ExploreChartHeader = ({
|
||||
|
||||
// setting the chart to use the dashboard custom label colors if any
|
||||
const dashboardMetadata = JSON.parse(result.json_metadata);
|
||||
// ensure consistency with the dashboard
|
||||
applyColors(dashboardMetadata);
|
||||
} catch (error) {
|
||||
logging.info(t('Unable to retrieve dashboard colors'));
|
||||
|
||||
Reference in New Issue
Block a user