Skip to content

Commit 5afe911

Browse files
authored
Merge pull request #4447 from pallava-joshi/feat-types-for-custom-variables
frontend: themes: Add missing properties to HeadlampTables interface
2 parents ebcd40a + e54a74b commit 5afe911

File tree

2 files changed

+243
-11
lines changed

2 files changed

+243
-11
lines changed

frontend/src/lib/themes.ts

Lines changed: 114 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,25 +19,128 @@ import { createTheme, getContrastRatio, useTheme } from '@mui/material/styles';
1919
import React from 'react';
2020
import type { AppTheme } from './AppTheme';
2121

22+
export interface HeadlampChartStyles {
23+
defaultFillColor: string;
24+
fillColor?: string;
25+
labelColor: string;
26+
}
27+
28+
export interface HeadlampHeaderStyle {
29+
normal: {
30+
fontSize: string;
31+
fontWeight: string;
32+
};
33+
main: {
34+
fontSize: string;
35+
fontWeight: string;
36+
};
37+
subsection: {
38+
fontSize: string;
39+
fontWeight: string;
40+
};
41+
label: {
42+
fontSize: string;
43+
paddingTop: string;
44+
};
45+
}
46+
47+
export interface HeadlampTables {
48+
head: {
49+
background: string;
50+
color: string;
51+
borderColor: string;
52+
text?: string;
53+
};
54+
body: {
55+
background: string;
56+
};
57+
headerText?: string;
58+
}
59+
60+
export interface HeadlampHome {
61+
status: {
62+
error: string;
63+
success: string;
64+
warning: string;
65+
unknown: string;
66+
};
67+
}
68+
69+
export interface HeadlampClusterChooser {
70+
button: {
71+
color: string;
72+
background: string;
73+
hover: {
74+
background: string;
75+
};
76+
};
77+
}
78+
79+
export interface HeadlampSidebarButtonInLinkArea {
80+
color: string;
81+
primary: {
82+
background: string;
83+
};
84+
hover: {
85+
background: string;
86+
};
87+
}
88+
89+
export interface HeadlampSquareButton {
90+
background: string;
91+
}
92+
93+
export interface HeadlampResourceToolTip {
94+
color: string;
95+
}
96+
97+
export interface HeadlampSidebar {
98+
background: string;
99+
color: string;
100+
selectedBackground: string;
101+
selectedColor: string;
102+
actionBackground: string;
103+
}
104+
105+
export interface HeadlampNavbar {
106+
background: string;
107+
color: string;
108+
}
109+
22110
declare module '@mui/material/styles/createPalette.d' {
23111
interface Palette {
24112
success: PaletteColor;
25113
background: TypeBackground;
26-
sidebar: {
27-
background: string;
28-
color: string;
29-
selectedBackground: string;
30-
selectedColor: string;
31-
actionBackground: string;
32-
};
33-
navbar: {
34-
background: string;
35-
color: string;
36-
};
114+
sidebar: HeadlampSidebar;
115+
navbar: HeadlampNavbar;
116+
chartStyles: HeadlampChartStyles;
117+
headerStyle: HeadlampHeaderStyle;
118+
tables: HeadlampTables;
119+
home: HeadlampHome;
120+
clusterChooser: HeadlampClusterChooser;
121+
sidebarButtonInLinkArea: HeadlampSidebarButtonInLinkArea;
122+
squareButton: HeadlampSquareButton;
123+
resourceToolTip: HeadlampResourceToolTip;
124+
normalEventBg: string;
125+
metadataBgColor: string;
126+
notificationBorderColor: string;
37127
[propName: string]: any;
38128
}
39129
interface PaletteOptions {
40130
success?: PaletteColorOptions;
131+
sidebar?: Partial<HeadlampSidebar>;
132+
navbar?: Partial<HeadlampNavbar>;
133+
chartStyles?: Partial<HeadlampChartStyles>;
134+
headerStyle?: Partial<HeadlampHeaderStyle>;
135+
tables?: Partial<HeadlampTables>;
136+
home?: Partial<HeadlampHome>;
137+
clusterChooser?: Partial<HeadlampClusterChooser>;
138+
sidebarButtonInLinkArea?: Partial<HeadlampSidebarButtonInLinkArea>;
139+
squareButton?: Partial<HeadlampSquareButton>;
140+
resourceToolTip?: Partial<HeadlampResourceToolTip>;
141+
normalEventBg?: string;
142+
metadataBgColor?: string;
143+
notificationBorderColor?: string;
41144
[propName: string]: any;
42145
}
43146

plugins/headlamp-plugin/src/additional.d.ts

Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,135 @@
1818
/// <reference types="react" />
1919
/// <reference types="react-dom" />
2020

21+
export interface HeadlampChartStyles {
22+
defaultFillColor: string;
23+
fillColor?: string;
24+
labelColor: string;
25+
}
26+
27+
export interface HeadlampHeaderStyle {
28+
normal: {
29+
fontSize: string;
30+
fontWeight: string;
31+
};
32+
main: {
33+
fontSize: string;
34+
fontWeight: string;
35+
};
36+
subsection: {
37+
fontSize: string;
38+
fontWeight: string;
39+
};
40+
label: {
41+
fontSize: string;
42+
paddingTop: string;
43+
};
44+
}
45+
46+
export interface HeadlampTables {
47+
head: {
48+
background: string;
49+
color: string;
50+
borderColor: string;
51+
text?: string;
52+
};
53+
body: {
54+
background: string;
55+
};
56+
headerText?: string;
57+
}
58+
59+
export interface HeadlampHome {
60+
status: {
61+
error: string;
62+
success: string;
63+
warning: string;
64+
unknown: string;
65+
};
66+
}
67+
68+
export interface HeadlampClusterChooser {
69+
button: {
70+
color: string;
71+
background: string;
72+
hover: {
73+
background: string;
74+
};
75+
};
76+
}
77+
78+
export interface HeadlampSidebarButtonInLinkArea {
79+
color: string;
80+
primary: {
81+
background: string;
82+
};
83+
hover: {
84+
background: string;
85+
};
86+
}
87+
88+
export interface HeadlampSquareButton {
89+
background: string;
90+
}
91+
92+
export interface HeadlampResourceToolTip {
93+
color: string;
94+
}
95+
96+
export interface HeadlampSidebar {
97+
background: string;
98+
color: string;
99+
selectedBackground: string;
100+
selectedColor: string;
101+
actionBackground: string;
102+
}
103+
104+
export interface HeadlampNavbar {
105+
background: string;
106+
color: string;
107+
}
108+
109+
declare module '@mui/material/styles' {
110+
interface Palette {
111+
sidebar: HeadlampSidebar;
112+
navbar: HeadlampNavbar;
113+
chartStyles: HeadlampChartStyles;
114+
headerStyle: HeadlampHeaderStyle;
115+
tables: HeadlampTables;
116+
home: HeadlampHome;
117+
clusterChooser: HeadlampClusterChooser;
118+
sidebarButtonInLinkArea: HeadlampSidebarButtonInLinkArea;
119+
squareButton: HeadlampSquareButton;
120+
resourceToolTip: HeadlampResourceToolTip;
121+
normalEventBg: string;
122+
metadataBgColor: string;
123+
notificationBorderColor: string;
124+
[propName: string]: any;
125+
}
126+
interface PaletteOptions {
127+
sidebar?: Partial<HeadlampSidebar>;
128+
navbar?: Partial<HeadlampNavbar>;
129+
chartStyles?: Partial<HeadlampChartStyles>;
130+
headerStyle?: Partial<HeadlampHeaderStyle>;
131+
tables?: Partial<HeadlampTables>;
132+
home?: Partial<HeadlampHome>;
133+
clusterChooser?: Partial<HeadlampClusterChooser>;
134+
sidebarButtonInLinkArea?: Partial<HeadlampSidebarButtonInLinkArea>;
135+
squareButton?: Partial<HeadlampSquareButton>;
136+
resourceToolTip?: Partial<HeadlampResourceToolTip>;
137+
normalEventBg?: string;
138+
metadataBgColor?: string;
139+
notificationBorderColor?: string;
140+
[propName: string]: any;
141+
}
142+
143+
interface TypeBackground {
144+
default: string;
145+
paper: string;
146+
muted: string;
147+
}
148+
}
149+
21150
declare namespace NodeJS {
22151
interface ProcessEnv {
23152
readonly NODE_ENV: 'development' | 'production' | 'test';

0 commit comments

Comments
 (0)