The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:
TypeScript analyticsbibusiness-intelligencebusinessintelligenceclojuredashboarddatadata-analysisdata-visualizationdatabasemetabasemysqlpostgrespostgresqlreportingslacksql-editorvisualization
Remove duplicate in Gauge color picker (#81920)
Kevin Kelleherb7500371caf5
diff --git a/frontend/src/metabase/visualizations/components/settings/ChartSettingSegmentsEditor/ChartSettingSegmentsEditor.tsx b/frontend/src/metabase/visualizations/components/settings/ChartSettingSegmentsEditor/ChartSettingSegmentsEditor.tsxindex b77f3edede9..dd4c6d1b124 100644--- a/frontend/src/metabase/visualizations/components/settings/ChartSettingSegmentsEditor/ChartSettingSegmentsEditor.tsx+++ b/frontend/src/metabase/visualizations/components/settings/ChartSettingSegmentsEditor/ChartSettingSegmentsEditor.tsx@@ -130,13 +130,12 @@ export const ChartSettingSegmentsEditor = ({);};-function getColorPalette() {+export function getColorPalette() {return [...getAccentColors(),Color(color("feedback-negative")).hex(),Color(color("feedback-warning")).hex(),Color(color("feedback-positive")).hex(),- Color(color("background_page-tertiary")).hex(),];}diff --git a/frontend/src/metabase/visualizations/components/settings/ChartSettingSegmentsEditor/ChartSettingSegmentsEditor.unit.spec.tsx b/frontend/src/metabase/visualizations/components/settings/ChartSettingSegmentsEditor/ChartSettingSegmentsEditor.unit.spec.tsxindex 99a293d51fc..9a856018e83 100644--- a/frontend/src/metabase/visualizations/components/settings/ChartSettingSegmentsEditor/ChartSettingSegmentsEditor.unit.spec.tsx+++ b/frontend/src/metabase/visualizations/components/settings/ChartSettingSegmentsEditor/ChartSettingSegmentsEditor.unit.spec.tsx@@ -4,7 +4,10 @@ import { fireEvent, render, screen, within } from "__support__/ui";import type { ChartSettingSegmentsEditorProps } from "metabase/viz-core";import type { ScalarSegment } from "metabase-types/api";-import { ChartSettingSegmentsEditor } from "./ChartSettingSegmentsEditor";+import {+ ChartSettingSegmentsEditor,+ getColorPalette,+} from "./ChartSettingSegmentsEditor";const createMockSegment = (opts?: Partial<ScalarSegment>): ScalarSegment => {return { label: "", min: 0, max: 100, color: "red", ...opts };@@ -141,6 +144,13 @@ it("Should not call onChange when blurring without changing value", async () =>expect(onChange).not.toHaveBeenCalled();});+it("should list each palette color once", () => {+ const palette = getColorPalette();++ expect(palette.length).toBeGreaterThan(0);+ expect(palette).toEqual([...new Set(palette)]);+});+it("should show a placeholder if there are no segments", async () => {const { onChange } = setup({ value: [], canRemoveAll: true });