mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Fix issue with graph legend color picker disapearing on color selection
This commit is contained in:
parent
6b1390b972
commit
7eb2558fc5
@ -21,8 +21,7 @@ export const ThemeProvider = ({ children }: { children: React.ReactNode }) => {
|
||||
return (
|
||||
<ConfigConsumer>
|
||||
{config => {
|
||||
const currentTheme = getCurrentThemeName();
|
||||
return <ThemeContext.Provider value={getTheme(currentTheme)}>{children}</ThemeContext.Provider>;
|
||||
return <ThemeContext.Provider value={getCurrentTheme()}>{children}</ThemeContext.Provider>;
|
||||
}}
|
||||
</ConfigConsumer>
|
||||
);
|
||||
|
@ -28,6 +28,8 @@ import { GraphCtrl } from './module';
|
||||
import { GrafanaThemeType, getValueFormat } from '@grafana/ui';
|
||||
import { provideTheme } from 'app/core/utils/ConfigProvider';
|
||||
|
||||
const LegendWithThemeProvider = provideTheme(Legend);
|
||||
|
||||
class GraphElement {
|
||||
ctrl: GraphCtrl;
|
||||
tooltip: any;
|
||||
@ -44,6 +46,7 @@ class GraphElement {
|
||||
legendElem: HTMLElement;
|
||||
|
||||
constructor(private scope, private elem, private timeSrv) {
|
||||
|
||||
this.ctrl = scope.ctrl;
|
||||
this.dashboard = this.ctrl.dashboard;
|
||||
this.panel = this.ctrl.panel;
|
||||
@ -110,7 +113,7 @@ class GraphElement {
|
||||
onToggleAxis: this.ctrl.onToggleAxis,
|
||||
};
|
||||
|
||||
const legendReactElem = React.createElement(provideTheme(Legend), legendProps);
|
||||
const legendReactElem = React.createElement(LegendWithThemeProvider, legendProps);
|
||||
ReactDOM.render(legendReactElem, this.legendElem, () => this.renderPanel());
|
||||
}
|
||||
|
||||
|
@ -29,7 +29,7 @@ function getThemeVariable(variablePath, themeName) {
|
||||
const variable = get(theme, variablePath.getValue());
|
||||
|
||||
if (!variable) {
|
||||
throw new Error(`${variablePath} is not defined fo ${themeName}`);
|
||||
throw new Error(`${variablePath.getValue()} is not defined for ${themeName.getValue()} theme`);
|
||||
}
|
||||
|
||||
if (isHex(variable)) {
|
||||
|
Loading…
Reference in New Issue
Block a user