mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
PanelChrome: Simplify props and code a bit (#61595)
* PanelChrome: Simplify props and code a bit * Don't set a default empty array for leftItems so we can know user has set it * fix 'this' is undefined * add storybook examples of statusMessage; remove SB examples of loadingState === Error; simplify loadingState checks in PanelChrome; Co-authored-by: polinaboneva <polina.boneva@grafana.com>
This commit is contained in:
@@ -592,10 +592,11 @@ export class PanelStateWrapper extends PureComponent<Props, State> {
|
||||
e.stopPropagation();
|
||||
locationService.partial({ inspect: this.props.panel.id, inspectTab: tab });
|
||||
};
|
||||
onOpenErrorInspect(e: React.SyntheticEvent, tab: string) {
|
||||
|
||||
onOpenErrorInspect = (e: React.SyntheticEvent) => {
|
||||
e.stopPropagation();
|
||||
locationService.partial({ inspect: this.props.panel.id, inspectTab: tab });
|
||||
}
|
||||
locationService.partial({ inspect: this.props.panel.id, inspectTab: InspectTab.Error });
|
||||
};
|
||||
|
||||
render() {
|
||||
const { dashboard, panel, isViewing, isEditing, width, height, plugin } = this.props;
|
||||
@@ -648,10 +649,8 @@ export class PanelStateWrapper extends PureComponent<Props, State> {
|
||||
height={height}
|
||||
title={title}
|
||||
loadingState={data.state}
|
||||
status={{
|
||||
message: errorMessage,
|
||||
onClick: (e: React.SyntheticEvent) => this.onOpenErrorInspect(e, InspectTab.Error),
|
||||
}}
|
||||
statusMessage={errorMessage}
|
||||
statusMessageOnClick={this.onOpenErrorInspect}
|
||||
description={!!panel.description ? this.onShowPanelDescription : undefined}
|
||||
titleItems={titleItems}
|
||||
menu={menu}
|
||||
|
||||
Reference in New Issue
Block a user