mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
render editor toolbar buttons
This commit is contained in:
parent
2046309de5
commit
f3ba3b4df0
@ -3,9 +3,11 @@ import React, { PureComponent } from 'react';
|
|||||||
import { getAngularLoader, AngularComponent } from 'app/core/services/AngularLoader';
|
import { getAngularLoader, AngularComponent } from 'app/core/services/AngularLoader';
|
||||||
import { EditorTabBody } from './EditorTabBody';
|
import { EditorTabBody } from './EditorTabBody';
|
||||||
import 'app/features/alerting/AlertTabCtrl';
|
import 'app/features/alerting/AlertTabCtrl';
|
||||||
|
import { PanelModel } from '../panel_model';
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
angularPanel?: AngularComponent;
|
angularPanel?: AngularComponent;
|
||||||
|
panel: PanelModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class AlertTab extends PureComponent<Props> {
|
export class AlertTab extends PureComponent<Props> {
|
||||||
@ -63,8 +65,26 @@ export class AlertTab extends PureComponent<Props> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
const { alert } = this.props.panel;
|
||||||
|
|
||||||
|
const stateHistory = {
|
||||||
|
title: 'State history',
|
||||||
|
render: () => {
|
||||||
|
return <div>State history</div>;
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
const deleteAlert = {
|
||||||
|
title: 'Delete button',
|
||||||
|
render: () => {
|
||||||
|
return <div>Hello</div>;
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
const toolbarItems = alert ? [deleteAlert, stateHistory] : [];
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<EditorTabBody heading="Alert" toolbarItems={[]}>
|
<EditorTabBody heading="Alert" toolbarItems={toolbarItems}>
|
||||||
<div ref={element => (this.element = element)} />
|
<div ref={element => (this.element = element)} />
|
||||||
</EditorTabBody>
|
</EditorTabBody>
|
||||||
);
|
);
|
||||||
|
@ -54,7 +54,7 @@ export class PanelEditor extends PureComponent<PanelEditorProps> {
|
|||||||
case 'queries':
|
case 'queries':
|
||||||
return <QueriesTab panel={panel} dashboard={dashboard} />;
|
return <QueriesTab panel={panel} dashboard={dashboard} />;
|
||||||
case 'alert':
|
case 'alert':
|
||||||
return <AlertTab angularPanel={angularPanel} />;
|
return <AlertTab angularPanel={angularPanel} panel={panel} />;
|
||||||
case 'visualization':
|
case 'visualization':
|
||||||
return (
|
return (
|
||||||
<VisualizationTab
|
<VisualizationTab
|
||||||
|
Loading…
Reference in New Issue
Block a user