2018-06-19 07:51:57 -05:00
|
|
|
import React from 'react';
|
|
|
|
import { PanelModel } from '../panel_model';
|
|
|
|
import { DashboardModel } from '../dashboard_model';
|
2018-06-19 14:25:57 -05:00
|
|
|
import { getAngularLoader, AngularComponent } from 'app/core/services/angular_loader';
|
2018-06-19 07:51:57 -05:00
|
|
|
|
|
|
|
interface PanelEditorProps {
|
|
|
|
panel: PanelModel;
|
|
|
|
dashboard: DashboardModel;
|
|
|
|
}
|
|
|
|
|
|
|
|
export class PanelEditor extends React.Component<PanelEditorProps, any> {
|
2018-06-19 14:25:57 -05:00
|
|
|
queryElement: any;
|
|
|
|
queryComp: AngularComponent;
|
2018-06-26 09:45:42 -05:00
|
|
|
tabs: any[];
|
2018-06-19 14:25:57 -05:00
|
|
|
|
|
|
|
constructor(props) {
|
|
|
|
super(props);
|
2018-06-26 09:45:42 -05:00
|
|
|
|
|
|
|
this.tabs = [
|
|
|
|
{ id: 'queries', text: 'Queries', icon: 'fa fa-database' },
|
|
|
|
{ id: 'viz', text: 'Visualization', icon: 'fa fa-line-chart' },
|
|
|
|
];
|
2018-06-19 14:25:57 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
componentDidMount() {
|
|
|
|
if (!this.queryElement) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
let loader = getAngularLoader();
|
2018-06-26 09:32:01 -05:00
|
|
|
var template = '<metrics-tab />';
|
2018-06-19 14:25:57 -05:00
|
|
|
let scopeProps = {
|
|
|
|
ctrl: {
|
|
|
|
panel: this.props.panel,
|
|
|
|
dashboard: this.props.dashboard,
|
|
|
|
panelCtrl: {
|
|
|
|
panel: this.props.panel,
|
|
|
|
dashboard: this.props.dashboard,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
this.queryComp = loader.load(this.queryElement, scopeProps, template);
|
|
|
|
}
|
|
|
|
|
2018-06-26 09:45:42 -05:00
|
|
|
onChangeTab = tabName => {};
|
|
|
|
|
2018-06-19 07:51:57 -05:00
|
|
|
render() {
|
|
|
|
return (
|
2018-06-19 14:25:57 -05:00
|
|
|
<div className="tabbed-view tabbed-view--panel-edit-new">
|
2018-06-19 07:51:57 -05:00
|
|
|
<div className="tabbed-view-header">
|
|
|
|
<ul className="gf-tabs">
|
|
|
|
<li className="gf-tabs-item">
|
|
|
|
<a className="gf-tabs-link active">Queries</a>
|
|
|
|
</li>
|
|
|
|
<li className="gf-tabs-item">
|
|
|
|
<a className="gf-tabs-link">Visualization</a>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
|
|
|
|
<button className="tabbed-view-close-btn" ng-click="ctrl.exitFullscreen();">
|
|
|
|
<i className="fa fa-remove" />
|
|
|
|
</button>
|
|
|
|
</div>
|
|
|
|
|
2018-06-19 14:25:57 -05:00
|
|
|
<div className="tabbed-view-body">
|
|
|
|
<div ref={element => (this.queryElement = element)} className="panel-height-helper" />
|
|
|
|
</div>
|
2018-06-19 07:51:57 -05:00
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|