|
|
|
@ -19,13 +19,6 @@ export interface DashboardRowProps { |
|
|
|
|
|
|
|
|
|
export class DashboardRow extends React.Component<DashboardRowProps, any> { |
|
|
|
|
sub?: Unsubscribable; |
|
|
|
|
constructor(props: DashboardRowProps) { |
|
|
|
|
super(props); |
|
|
|
|
|
|
|
|
|
this.state = { |
|
|
|
|
collapsed: this.props.panel.collapsed, |
|
|
|
|
}; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
componentDidMount() { |
|
|
|
|
this.sub = this.props.dashboard.events.subscribe(RefreshEvent, this.onVariableUpdated); |
|
|
|
@ -43,10 +36,6 @@ export class DashboardRow extends React.Component<DashboardRowProps, any> { |
|
|
|
|
|
|
|
|
|
onToggle = () => { |
|
|
|
|
this.props.dashboard.toggleRow(this.props.panel); |
|
|
|
|
|
|
|
|
|
this.setState((prevState: any) => { |
|
|
|
|
return { collapsed: !prevState.collapsed }; |
|
|
|
|
}); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
onUpdate = (title: string, repeat?: string | null) => { |
|
|
|
@ -77,7 +66,7 @@ export class DashboardRow extends React.Component<DashboardRowProps, any> { |
|
|
|
|
render() { |
|
|
|
|
const classes = classNames({ |
|
|
|
|
'dashboard-row': true, |
|
|
|
|
'dashboard-row--collapsed': this.state.collapsed, |
|
|
|
|
'dashboard-row--collapsed': this.props.panel.collapsed, |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
const title = getTemplateSrv().replace(this.props.panel.title, this.props.panel.scopedVars, 'text'); |
|
|
|
@ -92,7 +81,7 @@ export class DashboardRow extends React.Component<DashboardRowProps, any> { |
|
|
|
|
data-testid={selectors.components.DashboardRow.title(title)} |
|
|
|
|
onClick={this.onToggle} |
|
|
|
|
> |
|
|
|
|
<Icon name={this.state.collapsed ? 'angle-right' : 'angle-down'} /> |
|
|
|
|
<Icon name={this.props.panel.collapsed ? 'angle-right' : 'angle-down'} /> |
|
|
|
|
{title} |
|
|
|
|
<span className="dashboard-row__panel_count"> |
|
|
|
|
({count} {panels}) |
|
|
|
@ -110,7 +99,7 @@ export class DashboardRow extends React.Component<DashboardRowProps, any> { |
|
|
|
|
</a> |
|
|
|
|
</div> |
|
|
|
|
)} |
|
|
|
|
{this.state.collapsed === true && ( |
|
|
|
|
{this.props.panel.collapsed === true && ( |
|
|
|
|
<div className="dashboard-row__toggle-target" onClick={this.onToggle}> |
|
|
|
|
|
|
|
|
|
</div> |
|
|
|
|