diff --git a/public/app/core/components/grafana_app.ts b/public/app/core/components/grafana_app.ts index 15c7f7fdb3b..e456b5025ac 100644 --- a/public/app/core/components/grafana_app.ts +++ b/public/app/core/components/grafana_app.ts @@ -5,7 +5,7 @@ import store from 'app/core/store'; import _ from 'lodash'; import angular from 'angular'; import $ from 'jquery'; -import coreModule from '../core_module'; +import coreModule from 'app/core/core_module'; export class GrafanaCtrl { diff --git a/public/app/features/panel/metrics_panel_ctrl.ts b/public/app/features/panel/metrics_panel_ctrl.ts index 1d1c53c4dc8..896babade6d 100644 --- a/public/app/features/panel/metrics_panel_ctrl.ts +++ b/public/app/features/panel/metrics_panel_ctrl.ts @@ -49,6 +49,7 @@ class MetricsPanelCtrl extends PanelCtrl { initEditMode() { this.addEditorTab('Metrics', 'public/app/partials/metrics.html'); + this.addEditorTab('Time range', 'app/features/panel/partials/panelTime.html'); this.datasources = this.datasourceSrv.getMetricSources(); } diff --git a/public/app/features/panel/panel_ctrl.ts b/public/app/features/panel/panel_ctrl.ts index 398a6f50233..70ffb0e8f4f 100644 --- a/public/app/features/panel/panel_ctrl.ts +++ b/public/app/features/panel/panel_ctrl.ts @@ -80,7 +80,7 @@ export class PanelCtrl { return; } - addEditorTab(title, directiveFn) { + addEditorTab(title, directiveFn, index?) { var editorTab = {title, directiveFn}; if (_.isString(directiveFn)) { @@ -88,8 +88,11 @@ export class PanelCtrl { return {templateUrl: directiveFn}; }; } - - this.editorTabs.push(editorTab); + if (index) { + this.editorTabs.splice(index, 0, editorTab); + } else { + this.editorTabs.push(editorTab); + } } getMenu() { diff --git a/public/app/features/panel/panel_editor_tab.ts b/public/app/features/panel/panel_editor_tab.ts index ae896d1c0ae..f6c11306678 100644 --- a/public/app/features/panel/panel_editor_tab.ts +++ b/public/app/features/panel/panel_editor_tab.ts @@ -16,7 +16,6 @@ function panelEditorTab(dynamicDirectiveSrv) { directive: scope => { var pluginId = scope.ctrl.pluginId; var tabIndex = scope.index; - console.log('tab plugnId:', pluginId); return Promise.resolve({ name: `panel-editor-tab-${pluginId}${tabIndex}`, diff --git a/public/app/plugins/panel/graph/graph_ctrl.ts b/public/app/plugins/panel/graph/graph_ctrl.ts index c552a543452..1a3c4d4edd3 100644 --- a/public/app/plugins/panel/graph/graph_ctrl.ts +++ b/public/app/plugins/panel/graph/graph_ctrl.ts @@ -104,13 +104,9 @@ class GraphCtrl extends MetricsPanelCtrl { super.initEditMode(); this.icon = "fa fa-bar-chart"; - this.addEditorTab('Axes & Grid', 'public/app/plugins/panel/graph/axisEditor.html'); - this.addEditorTab('Display Styles', 'public/app/plugins/panel/graph/styleEditor.html'); + this.addEditorTab('Axes & Grid', 'public/app/plugins/panel/graph/axisEditor.html', 2); + this.addEditorTab('Display Styles', 'public/app/plugins/panel/graph/styleEditor.html', 3); - // $scope.panelMeta.addEditorTab('Time range', 'app/features/panel/partials/panelTime.html'); - // $scope.panelMeta.addExtendedMenuItem('Export CSV', '', 'exportCsv()'); - // $scope.panelMeta.addExtendedMenuItem('Toggle legend', '', 'toggleLegend()'); - // this.logScales = { 'linear': 1, 'log (base 2)': 2, @@ -121,6 +117,13 @@ class GraphCtrl extends MetricsPanelCtrl { this.unitFormats = kbn.getUnitFormats(); } + getExtendedMenu() { + var menu = super.getExtendedMenu(); + menu.push({text: 'Export CSV', click: 'ctrl.exportCsv()'}); + menu.push({text: 'Toggle legend', click: 'ctrl.toggleLegend()'}); + return menu; + } + setUnitFormat(axis, subItem) { this.panel.y_formats[axis] = subItem.value; this.render(); diff --git a/public/app/plugins/panel/singlestat/controller.ts b/public/app/plugins/panel/singlestat/controller.ts index f47e7f12d93..6c258283f6c 100644 --- a/public/app/plugins/panel/singlestat/controller.ts +++ b/public/app/plugins/panel/singlestat/controller.ts @@ -52,12 +52,10 @@ export class SingleStatCtrl extends MetricsPanelCtrl { initEditMode() { + super.initEditMode(); this.icon = "fa fa-dashboard"; this.fontSizes = ['20%', '30%','50%','70%','80%','100%', '110%', '120%', '150%', '170%', '200%']; - - this.addEditorTab('Options', 'app/plugins/panel/singlestat/editor.html'); - this.addEditorTab('Time range', 'app/features/panel/partials/panelTime.html'); - + this.addEditorTab('Options', 'app/plugins/panel/singlestat/editor.html', 2); this.unitFormats = kbn.getUnitFormats(); } diff --git a/public/app/plugins/panel/table/controller.ts b/public/app/plugins/panel/table/controller.ts index 9b06b437db9..1fa11d83858 100644 --- a/public/app/plugins/panel/table/controller.ts +++ b/public/app/plugins/panel/table/controller.ts @@ -57,13 +57,12 @@ export class TablePanelCtrl extends MetricsPanelCtrl { initEditMode() { super.initEditMode(); - this.addEditorTab('Options', tablePanelEditor); - this.addEditorTab('Time range', 'app/features/panel/partials/panelTime.html'); + this.addEditorTab('Options', tablePanelEditor, 1); } getExtendedMenu() { var menu = super.getExtendedMenu(); - menu.push({text: 'Export CSV', click: 'exportCsv()'}); + menu.push({text: 'Export CSV', click: 'ctrl.exportCsv()'}); return menu; } diff --git a/public/app/plugins/panel/table/module.ts b/public/app/plugins/panel/table/module.ts index 0903275b802..a273b8b08d0 100644 --- a/public/app/plugins/panel/table/module.ts +++ b/public/app/plugins/panel/table/module.ts @@ -89,7 +89,9 @@ class TablePanel extends PanelDirective { scope.$on('render', function(event, renderData) { data = renderData || data; - renderPanel(); + if (data) { + renderPanel(); + } }); } } diff --git a/public/app/plugins/panel/text/module.ts b/public/app/plugins/panel/text/module.ts index 87d51fbd5fe..bdef3bb4ced 100644 --- a/public/app/plugins/panel/text/module.ts +++ b/public/app/plugins/panel/text/module.ts @@ -59,7 +59,6 @@ export class TextPanelCtrl extends PanelCtrl { this.updateContent(this.converter.makeHtml(text)); } else { System.import('vendor/showdown').then(Showdown => { - console.log(this); this.converter = new Showdown.converter(); this.$scope.$apply(() => { this.updateContent(this.converter.makeHtml(text));