Skip to content

Commit 0a9942e

Browse files
authored
Add system palettes param for chart-engine processor (#2897)
1 parent d349103 commit 0a9942e

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

src/server/components/charts-engine/components/processor/index.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import type {
1111
DashWidgetConfig,
1212
EDITOR_TYPE_CONFIG_TABS,
1313
EntryPublicAuthor,
14+
Palette,
1415
StringParams,
1516
WorkbookId,
1617
} from '../../../../../shared';
@@ -184,6 +185,7 @@ export type SerializableProcessorParams = {
184185
adapterContext: AdapterContext;
185186
hooksContext: HooksContext;
186187
defaultColorPaletteId?: string;
188+
systemPalettes?: Record<string, Palette>;
187189
};
188190

189191
export class Processor {
@@ -221,6 +223,7 @@ export class Processor {
221223
sourcesConfig,
222224
secureConfig,
223225
defaultColorPaletteId,
226+
systemPalettes,
224227
}: ProcessorParams): Promise<
225228
ProcessorSuccessResponse | ProcessorErrorResponse | {error: string}
226229
> {
@@ -875,13 +878,10 @@ export class Processor {
875878
result.extra = jsTabResults.runtimeMetadata.extra || {};
876879
result.extra.chartsInsights = jsTabResults.runtimeMetadata.chartsInsights;
877880
result.extra.sideMarkdown = jsTabResults.runtimeMetadata.sideMarkdown;
878-
const getAvailablePalettesMap =
879-
registry.common.functions.get('getAvailablePalettesMap');
880-
const systemPalettes = getAvailablePalettesMap();
881881
const colors = selectServerPalette({
882882
defaultColorPaletteId: defaultColorPaletteId ?? '',
883883
customColorPalettes: tenantColorPalettes,
884-
availablePalettes: systemPalettes,
884+
availablePalettes: systemPalettes ?? {},
885885
});
886886
if (!isEmpty(colors)) {
887887
result.extra.colors = colors;

src/server/components/charts-engine/runners/common.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import {
99
DL_EMBED_TOKEN_HEADER,
1010
Feature,
1111
} from '../../../../shared';
12+
import {registry} from '../../../registry';
1213
import type {ProcessorParams, SerializableProcessorParams} from '../components/processor';
1314
import {Processor} from '../components/processor';
1415
import {ProcessorHooks} from '../components/processor/hooks';
@@ -215,6 +216,8 @@ export const getSerializableProcessorParams = ({
215216
},
216217
};
217218

219+
const getAvailablePalettesMap = registry.common.functions.get('getAvailablePalettesMap');
220+
218221
const processorParams: SerializableProcessorParams = {
219222
paramsOverride: params,
220223
actionParamsOverride: actionParams,
@@ -244,6 +247,7 @@ export const getSerializableProcessorParams = ({
244247
ctx,
245248
tenantSettings: localConfig?.tenantSettings,
246249
}),
250+
systemPalettes: getAvailablePalettesMap(),
247251
};
248252

249253
const configWorkbook = workbookId ?? localConfig?.workbookId;

0 commit comments

Comments
 (0)