Bläddra i källkod

feat(plugins): more refactoring

Torkel Ödegaard 10 år sedan
förälder
incheckning
d83e24572a
48 ändrade filer med 45 tillägg och 63 borttagningar
  1. 0 8
      public/app/features/dashboard/dashboardCtrl.js
  2. 0 0
      public/app/plugins/panel/dashlist/editor.html
  3. 0 0
      public/app/plugins/panel/dashlist/module.html
  4. 2 2
      public/app/plugins/panel/dashlist/module.js
  5. 5 0
      public/app/plugins/panel/dashlist/plugin.json
  6. 0 0
      public/app/plugins/panel/graph/axisEditor.html
  7. 0 0
      public/app/plugins/panel/graph/graph.js
  8. 0 0
      public/app/plugins/panel/graph/graph.tooltip.js
  9. 0 0
      public/app/plugins/panel/graph/legend.js
  10. 0 0
      public/app/plugins/panel/graph/legend.popover.html
  11. 0 0
      public/app/plugins/panel/graph/module.html
  12. 3 3
      public/app/plugins/panel/graph/module.js
  13. 5 0
      public/app/plugins/panel/graph/plugin.json
  14. 0 0
      public/app/plugins/panel/graph/seriesOverridesCtrl.js
  15. 0 0
      public/app/plugins/panel/graph/styleEditor.html
  16. 0 0
      public/app/plugins/panel/singlestat/editor.html
  17. 0 0
      public/app/plugins/panel/singlestat/module.html
  18. 2 2
      public/app/plugins/panel/singlestat/module.js
  19. 5 0
      public/app/plugins/panel/singlestat/plugin.json
  20. 0 0
      public/app/plugins/panel/singlestat/singleStatPanel.js
  21. 0 0
      public/app/plugins/panel/table/controller.ts
  22. 0 0
      public/app/plugins/panel/table/editor.html
  23. 0 0
      public/app/plugins/panel/table/editor.ts
  24. 0 0
      public/app/plugins/panel/table/module.html
  25. 1 1
      public/app/plugins/panel/table/module.ts
  26. 0 0
      public/app/plugins/panel/table/options.html
  27. 5 0
      public/app/plugins/panel/table/plugin.json
  28. 0 0
      public/app/plugins/panel/table/renderer.ts
  29. 0 0
      public/app/plugins/panel/table/specs/renderer_specs.ts
  30. 0 0
      public/app/plugins/panel/table/specs/transformers_specs.ts
  31. 0 0
      public/app/plugins/panel/table/transformers.ts
  32. 0 0
      public/app/plugins/panel/text/editor.html
  33. 0 0
      public/app/plugins/panel/text/module.html
  34. 2 2
      public/app/plugins/panel/text/module.js
  35. 5 0
      public/app/plugins/panel/text/plugin.json
  36. 0 7
      public/app/plugins/panels/dashlist/plugin.json
  37. 0 7
      public/app/plugins/panels/graph/plugin.json
  38. 0 7
      public/app/plugins/panels/singlestat/plugin.json
  39. 0 7
      public/app/plugins/panels/table/plugin.json
  40. 0 7
      public/app/plugins/panels/text/plugin.json
  41. 1 1
      public/test/specs/graph-ctrl-specs.js
  42. 1 1
      public/test/specs/graph-specs.js
  43. 1 1
      public/test/specs/graph-tooltip-specs.js
  44. 1 1
      public/test/specs/seriesOverridesCtrl-specs.js
  45. 1 1
      public/test/specs/singlestat-specs.js
  46. 1 1
      tasks/options/jscs.js
  47. 3 3
      tasks/options/requirejs.js
  48. 1 1
      tasks/systemjs_task.js

+ 0 - 8
public/app/features/dashboard/dashboardCtrl.js

@@ -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) {
       var editScope = $rootScope.$new();
       editScope.object = options.object;

+ 0 - 0
public/app/plugins/panels/dashlist/editor.html → public/app/plugins/panel/dashlist/editor.html


+ 0 - 0
public/app/plugins/panels/dashlist/module.html → public/app/plugins/panel/dashlist/module.html


+ 2 - 2
public/app/plugins/panels/dashlist/module.js → public/app/plugins/panel/dashlist/module.js

@@ -14,7 +14,7 @@ function (angular, app, _, config, PanelMeta) {
   module.directive('grafanaPanelDashlist', function() {
     return {
       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,
     });
 
-    $scope.panelMeta.addEditorTab('Options', 'app/plugins/panels/dashlist/editor.html');
+    $scope.panelMeta.addEditorTab('Options', 'app/plugins/panel/dashlist/editor.html');
 
     var defaults = {
       mode: 'starred',

+ 5 - 0
public/app/plugins/panel/dashlist/plugin.json

@@ -0,0 +1,5 @@
+{
+  "type": "panel",
+  "name": "Dashboard list",
+  "id": "dashlist"
+}

+ 0 - 0
public/app/plugins/panels/graph/axisEditor.html → public/app/plugins/panel/graph/axisEditor.html


+ 0 - 0
public/app/plugins/panels/graph/graph.js → public/app/plugins/panel/graph/graph.js


+ 0 - 0
public/app/plugins/panels/graph/graph.tooltip.js → public/app/plugins/panel/graph/graph.tooltip.js


+ 0 - 0
public/app/plugins/panels/graph/legend.js → public/app/plugins/panel/graph/legend.js


+ 0 - 0
public/app/plugins/panels/graph/legend.popover.html → public/app/plugins/panel/graph/legend.popover.html


+ 0 - 0
public/app/plugins/panels/graph/module.html → public/app/plugins/panel/graph/module.html


+ 3 - 3
public/app/plugins/panels/graph/module.js → public/app/plugins/panel/graph/module.js

@@ -17,7 +17,7 @@ function (angular, _, moment, kbn, TimeSeries, PanelMeta) {
   module.directive('grafanaPanelGraph', function() {
     return {
       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,
     });
 
-    $scope.panelMeta.addEditorTab('Axes & Grid', 'app/plugins/panels/graph/axisEditor.html');
-    $scope.panelMeta.addEditorTab('Display Styles', 'app/plugins/panels/graph/styleEditor.html');
+    $scope.panelMeta.addEditorTab('Axes & Grid', 'app/plugins/panel/graph/axisEditor.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.addExtendedMenuItem('Export CSV', '', 'exportCsv()');

+ 5 - 0
public/app/plugins/panel/graph/plugin.json

@@ -0,0 +1,5 @@
+{
+  "type": "panel",
+  "name": "Graph",
+  "id": "graph"
+}

+ 0 - 0
public/app/plugins/panels/graph/seriesOverridesCtrl.js → public/app/plugins/panel/graph/seriesOverridesCtrl.js


+ 0 - 0
public/app/plugins/panels/graph/styleEditor.html → public/app/plugins/panel/graph/styleEditor.html


+ 0 - 0
public/app/plugins/panels/singlestat/editor.html → public/app/plugins/panel/singlestat/editor.html


+ 0 - 0
public/app/plugins/panels/singlestat/module.html → public/app/plugins/panel/singlestat/module.html


+ 2 - 2
public/app/plugins/panels/singlestat/module.js → public/app/plugins/panel/singlestat/module.js

@@ -16,7 +16,7 @@ function (angular, app, _, kbn, TimeSeries, PanelMeta) {
   module.directive('grafanaPanelSinglestat', function() {
     return {
       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.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');
 
     // Set and populate defaults

+ 5 - 0
public/app/plugins/panel/singlestat/plugin.json

@@ -0,0 +1,5 @@
+{
+  "type": "panel",
+  "name": "Singlestat",
+  "id": "singlestat"
+}

+ 0 - 0
public/app/plugins/panels/singlestat/singleStatPanel.js → public/app/plugins/panel/singlestat/singleStatPanel.js


+ 0 - 0
public/app/plugins/panels/table/controller.ts → public/app/plugins/panel/table/controller.ts


+ 0 - 0
public/app/plugins/panels/table/editor.html → public/app/plugins/panel/table/editor.html


+ 0 - 0
public/app/plugins/panels/table/editor.ts → public/app/plugins/panel/table/editor.ts


+ 0 - 0
public/app/plugins/panels/table/module.html → public/app/plugins/panel/table/module.html


+ 1 - 1
public/app/plugins/panels/table/module.ts → public/app/plugins/panel/table/module.ts

@@ -14,7 +14,7 @@ export function tablePanel() {
   'use strict';
   return {
     restrict: 'E',
-    templateUrl: 'app/plugins/panels/table/module.html',
+    templateUrl: 'app/plugins/panel/table/module.html',
     controller: TablePanelCtrl,
     link: function(scope, elem) {
       var data;

+ 0 - 0
public/app/plugins/panels/table/options.html → public/app/plugins/panel/table/options.html


+ 5 - 0
public/app/plugins/panel/table/plugin.json

@@ -0,0 +1,5 @@
+{
+  "type": "panel",
+  "name": "Table",
+  "id": "table"
+}

+ 0 - 0
public/app/plugins/panels/table/renderer.ts → public/app/plugins/panel/table/renderer.ts


+ 0 - 0
public/app/plugins/panels/table/specs/renderer_specs.ts → public/app/plugins/panel/table/specs/renderer_specs.ts


+ 0 - 0
public/app/plugins/panels/table/specs/transformers_specs.ts → public/app/plugins/panel/table/specs/transformers_specs.ts


+ 0 - 0
public/app/plugins/panels/table/transformers.ts → public/app/plugins/panel/table/transformers.ts


+ 0 - 0
public/app/plugins/panels/text/editor.html → public/app/plugins/panel/text/editor.html


+ 0 - 0
public/app/plugins/panels/text/module.html → public/app/plugins/panel/text/module.html


+ 2 - 2
public/app/plugins/panels/text/module.js → public/app/plugins/panel/text/module.js

@@ -16,7 +16,7 @@ function (angular, app, _, require, PanelMeta) {
   module.directive('grafanaPanelText', function() {
     return {
       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,
     });
 
-    $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
     var _d = {

+ 5 - 0
public/app/plugins/panel/text/plugin.json

@@ -0,0 +1,5 @@
+{
+  "type": "panel",
+  "name": "Text",
+  "id": "text"
+}

+ 0 - 7
public/app/plugins/panels/dashlist/plugin.json

@@ -1,7 +0,0 @@
-{
-  "type": "panel",
-  "name": "Dashboard list",
-  "id": "dashlist",
-
-  "module": "app/plugins/panels/dashlist/module"
-}

+ 0 - 7
public/app/plugins/panels/graph/plugin.json

@@ -1,7 +0,0 @@
-{
-  "type": "panel",
-  "name": "Graph",
-  "id": "graph",
-
-  "module": "app/plugins/panels/graph/module"
-}

+ 0 - 7
public/app/plugins/panels/singlestat/plugin.json

@@ -1,7 +0,0 @@
-{
-  "type": "panel",
-  "name": "Singlestat",
-  "id": "singlestat",
-
-  "module": "app/plugins/panels/singlestat/module"
-}

+ 0 - 7
public/app/plugins/panels/table/plugin.json

@@ -1,7 +0,0 @@
-{
-  "type": "panel",
-  "name": "Table",
-  "id": "table",
-
-  "module": "app/plugins/panels/table/module"
-}

+ 0 - 7
public/app/plugins/panels/text/plugin.json

@@ -1,7 +0,0 @@
-{
-  "type": "panel",
-  "name": "Text",
-  "id": "text",
-
-  "module": "app/plugins/panels/text/module"
-}

+ 1 - 1
public/test/specs/graph-ctrl-specs.js

@@ -2,7 +2,7 @@ define([
   './helpers',
   'app/features/panel/panel_srv',
   'app/features/panel/panel_helper',
-  'app/plugins/panels/graph/module'
+  'app/plugins/panel/graph/module'
 ], function(helpers) {
   'use strict';
 

+ 1 - 1
public/test/specs/graph-specs.js

@@ -3,7 +3,7 @@ define([
   'angular',
   'jquery',
   'app/core/time_series',
-  'app/plugins/panels/graph/graph'
+  'app/plugins/panel/graph/graph'
 ], function(helpers, angular, $, TimeSeries) {
   'use strict';
 

+ 1 - 1
public/test/specs/graph-tooltip-specs.js

@@ -1,6 +1,6 @@
 define([
   'jquery',
-  'app/plugins/panels/graph/graph.tooltip'
+  'app/plugins/panel/graph/graph.tooltip'
 ], function($, GraphTooltip) {
   'use strict';
 

+ 1 - 1
public/test/specs/seriesOverridesCtrl-specs.js

@@ -1,6 +1,6 @@
 define([
   './helpers',
-  'app/plugins/panels/graph/seriesOverridesCtrl'
+  'app/plugins/panel/graph/seriesOverridesCtrl'
 ], function(helpers) {
   'use strict';
 

+ 1 - 1
public/test/specs/singlestat-specs.js

@@ -2,7 +2,7 @@ define([
   './helpers',
   'app/features/panel/panel_srv',
   'app/features/panel/panel_helper',
-  'app/plugins/panels/singlestat/module'
+  'app/plugins/panel/singlestat/module'
 ], function(helpers) {
   'use strict';
 

+ 1 - 1
tasks/options/jscs.js

@@ -3,7 +3,7 @@ module.exports = function(config) {
     src: [
       'Gruntfile.js',
       '<%= srcDir %>/app/**/*.js',
-      '<%= srcDir %>/plugins/**/*.js',
+      '<%= srcDir %>/plugin/**/*.js',
       '!<%= srcDir %>/app/dashboards/*'
     ],
     options: {

+ 3 - 3
tasks/options/requirejs.js

@@ -62,11 +62,11 @@ module.exports = function(config,grunt) {
     ];
 
     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) {
-      requireModules[0].include.push('app/plugins/panels/'+panelName+'/module');
+      requireModules[0].include.push('app/plugins/panel/'+panelName+'/module');
     });
 
     return { options: options };

+ 1 - 1
tasks/systemjs_task.js

@@ -13,7 +13,7 @@ module.exports = function(grunt) {
     var modules = [
       'app/app',
       'app/features/all',
-      'app/plugins/panels/**/module',
+      'app/plugins/panel/**/module',
       'app/plugins/datasource/graphite/datasource',
       'app/plugins/datasource/influxdb/datasource',
       'app/plugins/datasource/elasticsearch/datasource',