@@ -27,6 +27,7 @@ import {
2727 useInitialRefreshInterval ,
2828 useInitialTimeRange ,
2929 usePluginBuiltinVariableDefinitions ,
30+ ValidationProvider ,
3031} from '@perses-dev/plugin-system' ;
3132import React , { useMemo } from 'react' ;
3233import { usePatternFlyTheme } from '../../hooks/usePatternflyTheme' ;
@@ -35,8 +36,9 @@ import { PERSES_PROXY_BASE_PATH, useFetchPersesDashboard } from './perses-client
3536import { CachedDatasourceAPI } from './perses/datasource-api' ;
3637import {
3738 chart_color_blue_100 ,
38- chart_color_blue_200 ,
3939 chart_color_blue_300 ,
40+ chart_color_blue_400 ,
41+ chart_color_blue_500 ,
4042 t_color_gray_95 ,
4143 t_color_white ,
4244} from '@patternfly/react-tokens' ;
@@ -47,10 +49,11 @@ import { LoadingBox } from '../../../components/console/console-shared/src/compo
4749import { pluginLoader } from './persesPluginsLoader' ;
4850
4951// Override eChart defaults with PatternFly colors.
50- const patternflyBlue300 = '#2b9af3' ;
51- const patternflyBlue400 = '#0066cc' ;
52- const patternflyBlue500 = '#004080' ;
53- const patternflyBlue600 = '#002952' ;
52+ const patternflyBlue100 = chart_color_blue_100 . value ;
53+ const patternflyBlue300 = chart_color_blue_300 . value ;
54+ const patternflyBlue400 = chart_color_blue_400 . value ;
55+ const patternflyBlue500 = chart_color_blue_500 . value ;
56+ const patternflyBlue600 = chart_color_blue_100 . value ;
5457const defaultPaletteColors = [ patternflyBlue400 , patternflyBlue500 , patternflyBlue600 ] ;
5558
5659const chartColorScale = getThemeColors ( ChartThemeColor . multiUnordered ) . chart . colorScale ;
@@ -92,11 +95,12 @@ const mapPatterflyThemeToMUI = (theme: 'light' | 'dark'): ThemeOptions => {
9295 } ,
9396 } ,
9497 palette : {
98+ mode : isDark ? 'dark' : 'light' , // Help CodeMirror detect theme mode
9599 primary : {
96100 light : chart_color_blue_100 . value ,
97- main : chart_color_blue_200 . value ,
98- dark : chart_color_blue_300 . value ,
99- contrastText : primaryTextColor ,
101+ main : patternflyBlue300 ,
102+ dark : patternflyBlue500 ,
103+ contrastText : t_color_white . value ,
100104 } ,
101105 secondary : {
102106 main : primaryTextColor ,
@@ -133,13 +137,6 @@ const mapPatterflyThemeToMUI = (theme: 'light' | 'dark'): ThemeOptions => {
133137 } ,
134138 } ,
135139 } ,
136- MuiSvgIcon : {
137- styleOverrides : {
138- root : {
139- color : theme === 'dark' ? t_color_white . value : t_color_gray_95 . value ,
140- } ,
141- } ,
142- } ,
143140 MuiCard : {
144141 styleOverrides : {
145142 root : {
@@ -154,9 +151,9 @@ const mapPatterflyThemeToMUI = (theme: 'light' | 'dark'): ThemeOptions => {
154151 '&.MuiCardHeader-root' : {
155152 borderBottom : 'none' ,
156153 paddingBlockEnd : 'var(--pf-t--global--spacer--md)' ,
157- paddingBlockStart : 'var(--pf-t--global--spacer--lg )' ,
158- paddingLeft : 'var(--pf-t--global--spacer--lg )' ,
159- paddingRight : 'var(--pf-t--global--spacer--lg )' ,
154+ paddingBlockStart : 'var(--pf-t--global--spacer--md )' ,
155+ paddingLeft : 'var(--pf-t--global--spacer--md )' ,
156+ paddingRight : 'var(--pf-t--global--spacer--md )' ,
160157 } ,
161158 } ,
162159 } ,
@@ -167,9 +164,9 @@ const mapPatterflyThemeToMUI = (theme: 'light' | 'dark'): ThemeOptions => {
167164 '&.MuiCardContent-root' : {
168165 borderTop : 'none' ,
169166 '&:last-child' : {
170- paddingBottom : 'var(--pf-t--global--spacer--lg )' ,
171- paddingLeft : 'var(--pf-t--global--spacer--lg )' ,
172- paddingRight : 'var(--pf-t--global--spacer--lg )' ,
167+ paddingBottom : 'var(--pf-t--global--spacer--md )' ,
168+ paddingLeft : 'var(--pf-t--global--spacer--sm )' ,
169+ paddingRight : 'var(--pf-t--global--spacer--md )' ,
173170 } ,
174171 } ,
175172 } ,
@@ -201,6 +198,52 @@ const mapPatterflyThemeToMUI = (theme: 'light' | 'dark'): ThemeOptions => {
201198 } ,
202199 } ,
203200 } ,
201+ MuiButton : {
202+ styleOverrides : {
203+ root : {
204+ '&.MuiButton-colorPrimary' : {
205+ borderRadius : 'var(--pf-t--global--border--radius--pill)' ,
206+ borderColor : 'var(--pf-t--global--border--color--default)' ,
207+ color : isDark ? patternflyBlue100 : patternflyBlue300 ,
208+ } ,
209+ // Buttons with colored backgrounds should have white text
210+ '&.MuiButton-contained.MuiButton-colorPrimary' : {
211+ color : t_color_white . value ,
212+ } ,
213+ } ,
214+ } ,
215+ } ,
216+ MuiFormLabel : {
217+ styleOverrides : {
218+ root : {
219+ // Align placeholder text in Editing Panel
220+ '&.MuiFormLabel-root.MuiInputLabel-root.MuiInputLabel-formControl.MuiInputLabel-animated.MuiInputLabel-sizeMedium.MuiInputLabel-outlined.MuiFormLabel-colorPrimary[data-shrink="false"]' :
221+ {
222+ top : '-7px' ,
223+ } ,
224+ } ,
225+ } ,
226+ } ,
227+ MuiTab : {
228+ styleOverrides : {
229+ root : {
230+ // Selected tab color
231+ '&.MuiButtonBase-root.MuiTab-root.Mui-selected' : {
232+ color : isDark ? patternflyBlue100 : patternflyBlue300 ,
233+ } ,
234+ } ,
235+ } ,
236+ } ,
237+ MuiTabs : {
238+ styleOverrides : {
239+ indicator : {
240+ // Tab indicator should match color of selected MuiTab
241+ '&.MuiTabs-indicator' : {
242+ backgroundColor : isDark ? patternflyBlue100 : patternflyBlue300 ,
243+ } ,
244+ } ,
245+ } ,
246+ } ,
204247 } ,
205248 } ;
206249} ;
@@ -331,7 +374,7 @@ function InnerWrapper({ children, project, dashboardName }) {
331374 dashboardResource : clearedDashboardResource ,
332375 } }
333376 >
334- { children }
377+ < ValidationProvider > { children } </ ValidationProvider >
335378 </ DashboardProvider >
336379 ) : (
337380 < > { children } </ >
0 commit comments