feat: panels v2, metrics-tab loading

This commit is contained in:
Torkel Ödegaard
2018-06-26 16:32:01 +02:00
parent 0f97d38485
commit cec70c1ed8
4 changed files with 15 additions and 15 deletions

View File

@@ -22,7 +22,7 @@ export class PanelEditor extends React.Component<PanelEditorProps, any> {
}
let loader = getAngularLoader();
var template = '<plugin-component type="query-ctrl" />';
var template = '<metrics-tab />';
let scopeProps = {
ctrl: {
panel: this.props.panel,
@@ -32,7 +32,6 @@ export class PanelEditor extends React.Component<PanelEditorProps, any> {
dashboard: this.props.dashboard,
},
},
target: {},
};
this.queryComp = loader.load(this.queryElement, scopeProps, template);

View File

@@ -32,6 +32,7 @@ export class PanelModel {
panels?: any;
soloMode?: boolean;
targets: any[];
datasource: string;
// non persisted
fullscreen: boolean;
@@ -46,13 +47,10 @@ export class PanelModel {
this[property] = model[property];
}
if (!this.gridPos) {
this.gridPos = { x: 0, y: 0, h: 3, w: 6 };
}
if (!this.targets) {
this.targets = [{}];
}
// defaults
this.gridPos = this.gridPos || { x: 0, y: 0, h: 3, w: 6 };
this.datasource = this.datasource || null;
this.targets = this.targets || [{}];
}
getSaveModel() {

View File

@@ -1,5 +1,6 @@
import { DashboardModel } from '../dashboard/dashboard_model';
import Remarkable from 'remarkable';
import coreModule from 'app/core/core_module';
export class MetricsTabCtrl {
dsName: string;
@@ -120,3 +121,5 @@ export function metricsTabDirective() {
controller: MetricsTabCtrl,
};
}
coreModule.directive('metricsTab', metricsTabDirective);