mirror of
https://github.com/grafana/grafana.git
synced 2025-07-31 17:22:09 +08:00
feat(plugins): more refactoring
This commit is contained in:
@ -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) {
|
|||||||
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) {
|
|||||||
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',
|
5
public/app/plugins/panel/dashlist/plugin.json
Normal file
5
public/app/plugins/panel/dashlist/plugin.json
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"type": "panel",
|
||||||
|
"name": "Dashboard list",
|
||||||
|
"id": "dashlist"
|
||||||
|
}
|
@ -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) {
|
|||||||
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()');
|
5
public/app/plugins/panel/graph/plugin.json
Normal file
5
public/app/plugins/panel/graph/plugin.json
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"type": "panel",
|
||||||
|
"name": "Graph",
|
||||||
|
"id": "graph"
|
||||||
|
}
|
@ -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) {
|
|||||||
|
|
||||||
$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
|
5
public/app/plugins/panel/singlestat/plugin.json
Normal file
5
public/app/plugins/panel/singlestat/plugin.json
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"type": "panel",
|
||||||
|
"name": "Singlestat",
|
||||||
|
"id": "singlestat"
|
||||||
|
}
|
@ -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;
|
5
public/app/plugins/panel/table/plugin.json
Normal file
5
public/app/plugins/panel/table/plugin.json
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"type": "panel",
|
||||||
|
"name": "Table",
|
||||||
|
"id": "table"
|
||||||
|
}
|
@ -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) {
|
|||||||
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 = {
|
5
public/app/plugins/panel/text/plugin.json
Normal file
5
public/app/plugins/panel/text/plugin.json
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"type": "panel",
|
||||||
|
"name": "Text",
|
||||||
|
"id": "text"
|
||||||
|
}
|
@ -1,7 +0,0 @@
|
|||||||
{
|
|
||||||
"type": "panel",
|
|
||||||
"name": "Dashboard list",
|
|
||||||
"id": "dashlist",
|
|
||||||
|
|
||||||
"module": "app/plugins/panels/dashlist/module"
|
|
||||||
}
|
|
@ -1,7 +0,0 @@
|
|||||||
{
|
|
||||||
"type": "panel",
|
|
||||||
"name": "Graph",
|
|
||||||
"id": "graph",
|
|
||||||
|
|
||||||
"module": "app/plugins/panels/graph/module"
|
|
||||||
}
|
|
@ -1,7 +0,0 @@
|
|||||||
{
|
|
||||||
"type": "panel",
|
|
||||||
"name": "Singlestat",
|
|
||||||
"id": "singlestat",
|
|
||||||
|
|
||||||
"module": "app/plugins/panels/singlestat/module"
|
|
||||||
}
|
|
@ -1,7 +0,0 @@
|
|||||||
{
|
|
||||||
"type": "panel",
|
|
||||||
"name": "Table",
|
|
||||||
"id": "table",
|
|
||||||
|
|
||||||
"module": "app/plugins/panels/table/module"
|
|
||||||
}
|
|
@ -1,7 +0,0 @@
|
|||||||
{
|
|
||||||
"type": "panel",
|
|
||||||
"name": "Text",
|
|
||||||
"id": "text",
|
|
||||||
|
|
||||||
"module": "app/plugins/panels/text/module"
|
|
||||||
}
|
|
@ -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([
|
|||||||
'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';
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
define([
|
define([
|
||||||
'jquery',
|
'jquery',
|
||||||
'app/plugins/panels/graph/graph.tooltip'
|
'app/plugins/panel/graph/graph.tooltip'
|
||||||
], function($, GraphTooltip) {
|
], function($, GraphTooltip) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
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([
|
|||||||
'./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) {
|
|||||||
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) {
|
|||||||
];
|
];
|
||||||
|
|
||||||
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) {
|
|||||||
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',
|
||||||
|
Reference in New Issue
Block a user