render editor toolbar buttons

pull/14707/head
Peter Holmberg 7 years ago
parent 2046309de5
commit f3ba3b4df0
  1. 22
      public/app/features/dashboard/dashgrid/AlertTab.tsx
  2. 2
      public/app/features/dashboard/dashgrid/PanelEditor.tsx

@ -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…
Cancel
Save