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 { EditorTabBody } from './EditorTabBody';
|
||||
import 'app/features/alerting/AlertTabCtrl';
|
||||
import { PanelModel } from '../panel_model';
|
||||
|
||||
interface Props {
|
||||
angularPanel?: AngularComponent;
|
||||
panel: PanelModel;
|
||||
}
|
||||
|
||||
export class AlertTab extends PureComponent<Props> {
|
||||
@ -63,8 +65,26 @@ export class AlertTab extends PureComponent<Props> {
|
||||
}
|
||||
|
||||
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 (
|
||||
<EditorTabBody heading="Alert" toolbarItems={[]}>
|
||||
<EditorTabBody heading="Alert" toolbarItems={toolbarItems}>
|
||||
<div ref={element => (this.element = element)} />
|
||||
</EditorTabBody>
|
||||
);
|
||||
|
@ -54,7 +54,7 @@ export class PanelEditor extends PureComponent<PanelEditorProps> {
|
||||
case 'queries':
|
||||
return <QueriesTab panel={panel} dashboard={dashboard} />;
|
||||
case 'alert':
|
||||
return <AlertTab angularPanel={angularPanel} />;
|
||||
return <AlertTab angularPanel={angularPanel} panel={panel} />;
|
||||
case 'visualization':
|
||||
return (
|
||||
<VisualizationTab
|
||||
|
Loading…
Reference in New Issue
Block a user