Преглед на файлове

refactoring: moving components -> core

Torkel Ödegaard преди 10 години
родител
ревизия
1113081aab
променени са 34 файла, в които са добавени 35 реда и са изтрити 151 реда
  1. 0 1
      public/app/app.js
  2. 1 3
      public/app/components/require.config.js
  3. 0 108
      public/app/controllers/console-ctrl.js
  4. 3 3
      public/app/controllers/grafanaCtrl.js
  5. 1 1
      public/app/controllers/invitedCtrl.js
  6. 1 1
      public/app/controllers/loginCtrl.js
  7. 1 1
      public/app/controllers/metricKeys.js
  8. 1 1
      public/app/controllers/search.js
  9. 1 1
      public/app/controllers/sidemenuCtrl.js
  10. 1 1
      public/app/controllers/signupCtrl.ts
  11. 0 0
      public/app/core/config.js
  12. 0 0
      public/app/core/store.js
  13. 1 2
      public/app/features/dashboard/dashboardCtrl.js
  14. 1 3
      public/app/features/dashboard/dashboardNavCtrl.js
  15. 1 1
      public/app/features/dashboard/playlistCtrl.js
  16. 1 1
      public/app/features/dashboard/playlistSrv.js
  17. 1 1
      public/app/features/dashboard/rowCtrl.js
  18. 1 1
      public/app/features/dashboard/shareModalCtrl.js
  19. 2 2
      public/app/features/dashboard/timeSrv.js
  20. 2 2
      public/app/features/org/datasourceEditCtrl.js
  21. 1 1
      public/app/features/org/newOrgCtrl.js
  22. 1 1
      public/app/features/panel/panel_directive.js
  23. 1 1
      public/app/features/panel/panel_srv.js
  24. 1 1
      public/app/features/profile/changePasswordCtrl.js
  25. 1 1
      public/app/features/profile/profileCtrl.js
  26. 1 1
      public/app/features/profile/selectOrgCtrl.js
  27. 1 1
      public/app/headers/common.d.ts
  28. 1 1
      public/app/panels/dashlist/module.js
  29. 1 1
      public/app/plugins/datasource/graphite/datasource.js
  30. 1 1
      public/app/plugins/datasource/graphite/query_ctrl.js
  31. 1 1
      public/app/services/backendSrv.js
  32. 2 2
      public/app/services/contextSrv.js
  33. 1 1
      public/app/services/datasourceSrv.js
  34. 1 3
      public/test/test-main.js

+ 0 - 1
public/app/app.js

@@ -3,7 +3,6 @@ define([
   'jquery',
   'lodash',
   'require',
-  'config',
   'bootstrap',
   'angular-route',
   'angular-sanitize',

+ 1 - 3
public/app/components/require.config.js

@@ -3,10 +3,8 @@ require.config({
   baseUrl: 'public',
 
   paths: {
-    config:                   'app/components/config',
     settings:                 'app/components/settings',
     kbn:                      'app/components/kbn',
-    store:                    'app/components/store',
     'extend-jquery':          'app/components/extend-jquery',
     lodash:                   'app/components/lodash.extended',
 
@@ -61,7 +59,7 @@ require.config({
     },
 
     angular: {
-      deps: ['jquery','config'],
+      deps: ['jquery'],
       exports: 'angular'
     },
 

+ 0 - 108
public/app/controllers/console-ctrl.js

@@ -1,108 +0,0 @@
-define([
-  'angular',
-  'lodash',
-  'moment',
-  'store'
-],
-function (angular, _, moment, store) {
-  'use strict';
-
-  var module = angular.module('grafana.controllers');
-  var consoleEnabled = store.getBool('grafanaConsole');
-
-  if (!consoleEnabled) {
-    return;
-  }
-
-  var events = [];
-
-  function ConsoleEvent(type, title, data) {
-    this.type = type;
-    this.title = title;
-    this.data = data;
-    this.time = moment().format('hh:mm:ss');
-
-    if (data.config) {
-      this.method = data.config.method;
-      this.elapsed = (new Date().getTime() - data.config.$grafana_timestamp) + ' ms';
-      if (data.config.params && data.config.params.q) {
-        this.field2 = data.config.params.q;
-      }
-      if (_.isString(data.config.data)) {
-        this.field2 = data.config.data;
-      }
-      if (data.status !== 200) {
-        this.error = true;
-        this.field3 = data.data;
-      }
-
-      if (_.isArray(data.data)) {
-        this.extractTimeseriesInfo(data.data);
-      }
-    }
-  }
-
-  ConsoleEvent.prototype.extractTimeseriesInfo = function(series) {
-    if (series.length === 0) {
-      return;
-    }
-
-    var points = 0;
-    var ok = false;
-
-    if (series[0].datapoints) {
-      points = _.reduce(series, function(memo, val) {
-        return memo + val.datapoints.length;
-      }, 0);
-      ok = true;
-    }
-    if (series[0].columns) {
-      points = _.reduce(series, function(memo, val) {
-        return memo + val.points.length;
-      }, 0);
-      ok = true;
-    }
-
-    if (ok) {
-      this.field1 = '(' + series.length + ' series';
-      this.field1 += ', ' + points + ' points)';
-    }
-  };
-
-  module.config(function($provide, $httpProvider) {
-    $provide.factory('mupp', function($q) {
-      return {
-        'request': function(config) {
-          if (config.inspect) {
-            config.$grafana_timestamp = new Date().getTime();
-          }
-          return config;
-        },
-        'response': function(response) {
-          if (response.config.inspect) {
-            events.push(new ConsoleEvent(response.config.inspect.type, response.config.url, response));
-          }
-          return response;
-        },
-        'requestError': function(rejection) {
-          console.log('requestError', rejection);
-          return $q.reject(rejection);
-        },
-        'responseError': function (rejection) {
-          var inspect = rejection.config.inspect || { type: 'error' };
-          events.push(new ConsoleEvent(inspect.type, rejection.config.url, rejection));
-          return $q.reject(rejection);
-        }
-      };
-    });
-
-    $httpProvider.interceptors.push('mupp');
-  });
-
-  module.controller('ConsoleCtrl', function($scope) {
-
-    $scope.events = events;
-
-  });
-
-});

+ 3 - 3
public/app/controllers/grafanaCtrl.js

@@ -1,11 +1,11 @@
 define([
   'angular',
-  'config',
   'lodash',
   'jquery',
-  'store',
+  'app/core/config',
+  'app/core/store',
 ],
-function (angular, config, _, $, store) {
+function (angular, _, $, config, store) {
   "use strict";
 
   var module = angular.module('grafana.controllers');

+ 1 - 1
public/app/controllers/invitedCtrl.js

@@ -1,6 +1,6 @@
 define([
   'angular',
-  'config',
+  'app/core/config',
 ],
 function (angular, config) {
   'use strict';

+ 1 - 1
public/app/controllers/loginCtrl.js

@@ -1,6 +1,6 @@
 define([
   'angular',
-  'config',
+  'app/core/config',
 ],
 function (angular, config) {
   'use strict';

+ 1 - 1
public/app/controllers/metricKeys.js

@@ -1,7 +1,7 @@
 define([
   'angular',
   'lodash',
-  'config'
+  'app/core/config'
 ],
 function (angular, _, config) {
   'use strict';

+ 1 - 1
public/app/controllers/search.js

@@ -1,7 +1,7 @@
 define([
   'angular',
   'lodash',
-  'config',
+  'app/core/config',
 ],
 function (angular, _, config) {
   'use strict';

+ 1 - 1
public/app/controllers/sidemenuCtrl.js

@@ -2,7 +2,7 @@ define([
   'angular',
   'lodash',
   'jquery',
-  'config',
+  'app/core/config',
 ],
 function (angular, _, $, config) {
   'use strict';

+ 1 - 1
public/app/controllers/signupCtrl.ts

@@ -1,7 +1,7 @@
 ///<reference path="../headers/common.d.ts" />
 
 import angular = require('angular');
-import config = require('config');
+import config = require('app/core/config');
 
 var module = angular.module('grafana.controllers');
 

+ 0 - 0
public/app/components/config.js → public/app/core/config.js


+ 0 - 0
public/app/components/store.js → public/app/core/store.js


+ 1 - 2
public/app/features/dashboard/dashboardCtrl.js

@@ -1,8 +1,7 @@
 define([
   'angular',
   'jquery',
-  'config',
-  'lodash',
+  'app/core/config',
 ],
 function (angular, $, config) {
   "use strict";

+ 1 - 3
public/app/features/dashboard/dashboardNavCtrl.js

@@ -1,9 +1,7 @@
 define([
   'angular',
   'lodash',
-  'config',
-  'store',
-  'filesaver'
+  'app/core/config',
 ],
 function (angular, _) {
   'use strict';

+ 1 - 1
public/app/features/dashboard/playlistCtrl.js

@@ -1,7 +1,7 @@
 define([
   'angular',
   'lodash',
-  'config'
+  'app/core/config'
 ],
 function (angular, _, config) {
   'use strict';

+ 1 - 1
public/app/features/dashboard/playlistSrv.js

@@ -2,7 +2,7 @@ define([
   'angular',
   'lodash',
   'kbn',
-  'store'
+  'app/core/store'
 ],
 function (angular, _, kbn) {
   'use strict';

+ 1 - 1
public/app/features/dashboard/rowCtrl.js

@@ -1,7 +1,7 @@
 define([
   'angular',
   'lodash',
-  'config'
+  'app/core/config'
 ],
 function (angular, _, config) {
   'use strict';

+ 1 - 1
public/app/features/dashboard/shareModalCtrl.js

@@ -2,7 +2,7 @@ define([
   'angular',
   'lodash',
   'require',
-  'config',
+  'app/core/config',
 ],
 function (angular, _, require, config) {
   'use strict';

+ 2 - 2
public/app/features/dashboard/timeSrv.js

@@ -1,11 +1,11 @@
 define([
   'angular',
   'lodash',
-  'config',
   'kbn',
   'moment',
+  'app/core/config',
   'app/core/utils/datemath'
-], function (angular, _, config, kbn, moment, dateMath) {
+], function (angular, _, kbn, moment, config, dateMath) {
   'use strict';
 
   var module = angular.module('grafana.services');

+ 2 - 2
public/app/features/org/datasourceEditCtrl.js

@@ -1,9 +1,9 @@
 define([
   'angular',
-  'config',
   'lodash',
+  'app/core/config',
 ],
-function (angular, config, _) {
+function (angular, _, config) {
   'use strict';
 
   var module = angular.module('grafana.controllers');

+ 1 - 1
public/app/features/org/newOrgCtrl.js

@@ -1,6 +1,6 @@
 define([
   'angular',
-  'config',
+  'app/core/config',
 ],
 function (angular, config) {
   'use strict';

+ 1 - 1
public/app/features/panel/panel_directive.js

@@ -1,7 +1,7 @@
 define([
   'angular',
   'jquery',
-  'config',
+  'app/core/config',
 ],
 function (angular, $, config) {
   'use strict';

+ 1 - 1
public/app/features/panel/panel_srv.js

@@ -1,7 +1,7 @@
 define([
   'angular',
   'lodash',
-  'config',
+  'app/core/config',
 ],
 function (angular, _, config) {
   'use strict';

+ 1 - 1
public/app/features/profile/changePasswordCtrl.js

@@ -1,6 +1,6 @@
 define([
   'angular',
-  'config',
+  'app/core/config',
 ],
 function (angular) {
   'use strict';

+ 1 - 1
public/app/features/profile/profileCtrl.js

@@ -1,6 +1,6 @@
 define([
   'angular',
-  'config',
+  'app/core/config',
 ],
 function (angular, config) {
   'use strict';

+ 1 - 1
public/app/features/profile/selectOrgCtrl.js

@@ -1,6 +1,6 @@
 define([
   'angular',
-  'config',
+  'app/core/config',
 ],
 function (angular, config) {
   'use strict';

+ 1 - 1
public/app/headers/common.d.ts

@@ -4,7 +4,7 @@
 ///<reference path="moment/moment.d.ts" />
 
 // dummy modules
-declare module 'config' {
+declare module 'app/core/config' {
   var config : any;
   export = config;
 }

+ 1 - 1
public/app/panels/dashlist/module.js

@@ -2,7 +2,7 @@ define([
   'angular',
   'app/app',
   'lodash',
-  'config',
+  'app/core/config',
   'app/features/panel/panel_meta',
 ],
 function (angular, app, _, config, PanelMeta) {

+ 1 - 1
public/app/plugins/datasource/graphite/datasource.js

@@ -2,7 +2,7 @@ define([
   'angular',
   'lodash',
   'jquery',
-  'config',
+  'app/core/config',
   'app/core/utils/datemath',
   './directives',
   './query_ctrl',

+ 1 - 1
public/app/plugins/datasource/graphite/query_ctrl.js

@@ -1,7 +1,7 @@
 define([
   'angular',
   'lodash',
-  'config',
+  'app/core/config',
   './gfunc',
   './parser'
 ],

+ 1 - 1
public/app/services/backendSrv.js

@@ -1,7 +1,7 @@
 define([
   'angular',
   'lodash',
-  'config',
+  'app/core/config',
 ],
 function (angular, _, config) {
   'use strict';

+ 2 - 2
public/app/services/contextSrv.js

@@ -1,8 +1,8 @@
 define([
   'angular',
   'lodash',
-  'store',
-  'config',
+  'app/core/store',
+  'app/core/config',
 ],
 function (angular, _, store, config) {
   'use strict';

+ 1 - 1
public/app/services/datasourceSrv.js

@@ -1,7 +1,7 @@
 define([
   'angular',
   'lodash',
-  'config',
+  'app/core/config',
 ],
 function (angular, _, config) {
   'use strict';

+ 1 - 3
public/test/test-main.js

@@ -2,9 +2,7 @@ require.config({
   baseUrl: 'http://localhost:9876/base/',
 
   paths: {
-    config:                'app/components/config',
     kbn:                   'app/components/kbn',
-    store:                 'app/components/store',
 
     settings:              'app/components/settings',
     lodash:                'app/components/lodash.extended',
@@ -58,7 +56,7 @@ require.config({
     },
 
     angular: {
-      deps: ['jquery', 'config'],
+      deps: ['jquery'],
       exports: 'angular'
     },