Skip to content

Commit

Permalink
[TSVB] Metrics UI crashes when it is opened from Metrics Ui
Browse files Browse the repository at this point in the history
  • Loading branch information
stratoula committed Apr 23, 2021
1 parent 4eb6c22 commit 0a05fb2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -331,8 +331,13 @@ export const TimeseriesConfig = injectI18n(function (props) {
? props.model.series_index_pattern
: props.indexPatternForQuery;

const initialPalette = {
...model.palette,
const initialPalette = model.palette ?? {
type: 'palette',
name: 'default',
};

const palette = {
...initialPalette,
name:
model.split_color_mode === 'kibana'
? 'kibana_palette'
Expand Down Expand Up @@ -430,7 +435,7 @@ export const TimeseriesConfig = injectI18n(function (props) {
>
<PalettePicker
palettes={palettesRegistry}
activePalette={initialPalette}
activePalette={palette}
setPalette={handlePaletteChange}
color={model.color}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export const getSplitByTermsColor = ({
}
: seriesPalette.params;

const outputColor = palettesRegistry?.get(paletteName).getColor(
const outputColor = palettesRegistry?.get(paletteName || 'default').getColor(
[
{
name: seriesName || emptyLabel,
Expand Down

0 comments on commit 0a05fb2

Please sign in to comment.