Commit d83e2457 by Torkel Ödegaard

feat(plugins): more refactoring

parent 1ffcea19
...@@ -106,14 +106,6 @@ function (angular, $, config, moment) { ...@@ -106,14 +106,6 @@ function (angular, $, config, moment) {
}; };
}; };
$scope.panelEditorPath = function(type) {
return 'app/' + config.panels[type].path + '/editor.html';
};
$scope.pulldownEditorPath = function(type) {
return 'app/panels/'+type+'/editor.html';
};
$scope.showJsonEditor = function(evt, options) { $scope.showJsonEditor = function(evt, options) {
var editScope = $rootScope.$new(); var editScope = $rootScope.$new();
editScope.object = options.object; editScope.object = options.object;
......
...@@ -14,7 +14,7 @@ function (angular, app, _, config, PanelMeta) { ...@@ -14,7 +14,7 @@ function (angular, app, _, config, PanelMeta) {
module.directive('grafanaPanelDashlist', function() { module.directive('grafanaPanelDashlist', function() {
return { return {
controller: 'DashListPanelCtrl', controller: 'DashListPanelCtrl',
templateUrl: 'app/plugins/panels/dashlist/module.html', templateUrl: 'app/plugins/panel/dashlist/module.html',
}; };
}); });
...@@ -26,7 +26,7 @@ function (angular, app, _, config, PanelMeta) { ...@@ -26,7 +26,7 @@ function (angular, app, _, config, PanelMeta) {
fullscreen: true, fullscreen: true,
}); });
$scope.panelMeta.addEditorTab('Options', 'app/plugins/panels/dashlist/editor.html'); $scope.panelMeta.addEditorTab('Options', 'app/plugins/panel/dashlist/editor.html');
var defaults = { var defaults = {
mode: 'starred', mode: 'starred',
......
{ {
"type": "panel", "type": "panel",
"name": "Dashboard list", "name": "Dashboard list",
"id": "dashlist", "id": "dashlist"
"module": "app/plugins/panels/dashlist/module"
} }
...@@ -17,7 +17,7 @@ function (angular, _, moment, kbn, TimeSeries, PanelMeta) { ...@@ -17,7 +17,7 @@ function (angular, _, moment, kbn, TimeSeries, PanelMeta) {
module.directive('grafanaPanelGraph', function() { module.directive('grafanaPanelGraph', function() {
return { return {
controller: 'GraphCtrl', controller: 'GraphCtrl',
templateUrl: 'app/plugins/panels/graph/module.html', templateUrl: 'app/plugins/panel/graph/module.html',
}; };
}); });
...@@ -30,8 +30,8 @@ function (angular, _, moment, kbn, TimeSeries, PanelMeta) { ...@@ -30,8 +30,8 @@ function (angular, _, moment, kbn, TimeSeries, PanelMeta) {
metricsEditor: true, metricsEditor: true,
}); });
$scope.panelMeta.addEditorTab('Axes & Grid', 'app/plugins/panels/graph/axisEditor.html'); $scope.panelMeta.addEditorTab('Axes & Grid', 'app/plugins/panel/graph/axisEditor.html');
$scope.panelMeta.addEditorTab('Display Styles', 'app/plugins/panels/graph/styleEditor.html'); $scope.panelMeta.addEditorTab('Display Styles', 'app/plugins/panel/graph/styleEditor.html');
$scope.panelMeta.addEditorTab('Time range', 'app/features/panel/partials/panelTime.html'); $scope.panelMeta.addEditorTab('Time range', 'app/features/panel/partials/panelTime.html');
$scope.panelMeta.addExtendedMenuItem('Export CSV', '', 'exportCsv()'); $scope.panelMeta.addExtendedMenuItem('Export CSV', '', 'exportCsv()');
......
{ {
"type": "panel", "type": "panel",
"name": "Graph", "name": "Graph",
"id": "graph", "id": "graph"
"module": "app/plugins/panels/graph/module"
} }
...@@ -16,7 +16,7 @@ function (angular, app, _, kbn, TimeSeries, PanelMeta) { ...@@ -16,7 +16,7 @@ function (angular, app, _, kbn, TimeSeries, PanelMeta) {
module.directive('grafanaPanelSinglestat', function() { module.directive('grafanaPanelSinglestat', function() {
return { return {
controller: 'SingleStatCtrl', controller: 'SingleStatCtrl',
templateUrl: 'app/plugins/panels/singlestat/module.html', templateUrl: 'app/plugins/panel/singlestat/module.html',
}; };
}); });
...@@ -31,7 +31,7 @@ function (angular, app, _, kbn, TimeSeries, PanelMeta) { ...@@ -31,7 +31,7 @@ function (angular, app, _, kbn, TimeSeries, PanelMeta) {
$scope.fontSizes = ['20%', '30%','50%','70%','80%','100%', '110%', '120%', '150%', '170%', '200%']; $scope.fontSizes = ['20%', '30%','50%','70%','80%','100%', '110%', '120%', '150%', '170%', '200%'];
$scope.panelMeta.addEditorTab('Options', 'app/plugins/panels/singlestat/editor.html'); $scope.panelMeta.addEditorTab('Options', 'app/plugins/panel/singlestat/editor.html');
$scope.panelMeta.addEditorTab('Time range', 'app/features/panel/partials/panelTime.html'); $scope.panelMeta.addEditorTab('Time range', 'app/features/panel/partials/panelTime.html');
// Set and populate defaults // Set and populate defaults
......
{ {
"type": "panel", "type": "panel",
"name": "Singlestat", "name": "Singlestat",
"id": "singlestat", "id": "singlestat"
"module": "app/plugins/panels/singlestat/module"
} }
...@@ -14,7 +14,7 @@ export function tablePanel() { ...@@ -14,7 +14,7 @@ export function tablePanel() {
'use strict'; 'use strict';
return { return {
restrict: 'E', restrict: 'E',
templateUrl: 'app/plugins/panels/table/module.html', templateUrl: 'app/plugins/panel/table/module.html',
controller: TablePanelCtrl, controller: TablePanelCtrl,
link: function(scope, elem) { link: function(scope, elem) {
var data; var data;
......
{ {
"type": "panel", "type": "panel",
"name": "Table", "name": "Table",
"id": "table", "id": "table"
"module": "app/plugins/panels/table/module"
} }
...@@ -16,7 +16,7 @@ function (angular, app, _, require, PanelMeta) { ...@@ -16,7 +16,7 @@ function (angular, app, _, require, PanelMeta) {
module.directive('grafanaPanelText', function() { module.directive('grafanaPanelText', function() {
return { return {
controller: 'TextPanelCtrl', controller: 'TextPanelCtrl',
templateUrl: 'app/plugins/panels/text/module.html', templateUrl: 'app/plugins/panel/text/module.html',
}; };
}); });
...@@ -28,7 +28,7 @@ function (angular, app, _, require, PanelMeta) { ...@@ -28,7 +28,7 @@ function (angular, app, _, require, PanelMeta) {
fullscreen: true, fullscreen: true,
}); });
$scope.panelMeta.addEditorTab('Edit text', 'app/plugins/panels/text/editor.html'); $scope.panelMeta.addEditorTab('Edit text', 'app/plugins/panel/text/editor.html');
// Set and populate defaults // Set and populate defaults
var _d = { var _d = {
......
{ {
"type": "panel", "type": "panel",
"name": "Text", "name": "Text",
"id": "text", "id": "text"
"module": "app/plugins/panels/text/module"
} }
...@@ -2,7 +2,7 @@ define([ ...@@ -2,7 +2,7 @@ define([
'./helpers', './helpers',
'app/features/panel/panel_srv', 'app/features/panel/panel_srv',
'app/features/panel/panel_helper', 'app/features/panel/panel_helper',
'app/plugins/panels/graph/module' 'app/plugins/panel/graph/module'
], function(helpers) { ], function(helpers) {
'use strict'; 'use strict';
......
...@@ -3,7 +3,7 @@ define([ ...@@ -3,7 +3,7 @@ define([
'angular', 'angular',
'jquery', 'jquery',
'app/core/time_series', 'app/core/time_series',
'app/plugins/panels/graph/graph' 'app/plugins/panel/graph/graph'
], function(helpers, angular, $, TimeSeries) { ], function(helpers, angular, $, TimeSeries) {
'use strict'; 'use strict';
......
define([ define([
'jquery', 'jquery',
'app/plugins/panels/graph/graph.tooltip' 'app/plugins/panel/graph/graph.tooltip'
], function($, GraphTooltip) { ], function($, GraphTooltip) {
'use strict'; 'use strict';
......
define([ define([
'./helpers', './helpers',
'app/plugins/panels/graph/seriesOverridesCtrl' 'app/plugins/panel/graph/seriesOverridesCtrl'
], function(helpers) { ], function(helpers) {
'use strict'; 'use strict';
......
...@@ -2,7 +2,7 @@ define([ ...@@ -2,7 +2,7 @@ define([
'./helpers', './helpers',
'app/features/panel/panel_srv', 'app/features/panel/panel_srv',
'app/features/panel/panel_helper', 'app/features/panel/panel_helper',
'app/plugins/panels/singlestat/module' 'app/plugins/panel/singlestat/module'
], function(helpers) { ], function(helpers) {
'use strict'; 'use strict';
......
...@@ -3,7 +3,7 @@ module.exports = function(config) { ...@@ -3,7 +3,7 @@ module.exports = function(config) {
src: [ src: [
'Gruntfile.js', 'Gruntfile.js',
'<%= srcDir %>/app/**/*.js', '<%= srcDir %>/app/**/*.js',
'<%= srcDir %>/plugins/**/*.js', '<%= srcDir %>/plugin/**/*.js',
'!<%= srcDir %>/app/dashboards/*' '!<%= srcDir %>/app/dashboards/*'
], ],
options: { options: {
......
...@@ -62,11 +62,11 @@ module.exports = function(config,grunt) { ...@@ -62,11 +62,11 @@ module.exports = function(config,grunt) {
]; ];
var fs = require('fs'); var fs = require('fs');
var panelPath = config.srcDir + '/app/plugins/panels'; var panelPath = config.srcDir + '/app/plugins/panel';
// create a module for each directory in public/app/panels/ // create a module for each directory in public/app/panel/
fs.readdirSync(panelPath).forEach(function (panelName) { fs.readdirSync(panelPath).forEach(function (panelName) {
requireModules[0].include.push('app/plugins/panels/'+panelName+'/module'); requireModules[0].include.push('app/plugins/panel/'+panelName+'/module');
}); });
return { options: options }; return { options: options };
......
...@@ -13,7 +13,7 @@ module.exports = function(grunt) { ...@@ -13,7 +13,7 @@ module.exports = function(grunt) {
var modules = [ var modules = [
'app/app', 'app/app',
'app/features/all', 'app/features/all',
'app/plugins/panels/**/module', 'app/plugins/panel/**/module',
'app/plugins/datasource/graphite/datasource', 'app/plugins/datasource/graphite/datasource',
'app/plugins/datasource/influxdb/datasource', 'app/plugins/datasource/influxdb/datasource',
'app/plugins/datasource/elasticsearch/datasource', 'app/plugins/datasource/elasticsearch/datasource',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment