kgabryje commented on code in PR #31374: URL: https://github.com/apache/superset/pull/31374#discussion_r1882426321
########## superset-frontend/src/utils/colorScheme.ts: ########## @@ -91,21 +93,40 @@ export const getSharedLabelsColorMapEntries = ( * @param customLabelsColor - the custom label colors in label_colors field * @returns all color entries except custom label colors */ -export const getLabelsColorMapEntries = ( +export const getFreshLabelsColorMapEntries = ( customLabelsColor: Record<string, string> = {}, ): Record<string, string> => { const labelsColorMapInstance = getLabelsColorMap(); const allEntries = Object.fromEntries(labelsColorMapInstance.getColorMap()); // custom label colors are applied and stored separetely via label_colors - // removing all instances of custom label colors from the entries Object.keys(customLabelsColor).forEach(label => { delete allEntries[label]; }); return allEntries; }; +/** + * Returns all dynamic labels and colors (excluding custom label colors). + * + * @param labelsColorMap - the labels color map + * @param customLabelsColor - the custom label colors in label_colors field + * @returns all color entries except custom label colors + */ +export const getDynamicLabelsColors = ( + fullLabelsColors: Record<string, string>, + customLabelsColor: Record<string, string> = {}, +): Record<string, string> => { + const labelsColors = { ...fullLabelsColors }; Review Comment: ```suggestion return omit(fullLabelsColors, Object.keys(customLabelsColor)) ``` -- 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