Commit 1113081a by Torkel Ödegaard

refactoring: moving components -> core

parent 39bc3cb5
...@@ -3,7 +3,6 @@ define([ ...@@ -3,7 +3,6 @@ define([
'jquery', 'jquery',
'lodash', 'lodash',
'require', 'require',
'config',
'bootstrap', 'bootstrap',
'angular-route', 'angular-route',
'angular-sanitize', 'angular-sanitize',
......
...@@ -3,10 +3,8 @@ require.config({ ...@@ -3,10 +3,8 @@ require.config({
baseUrl: 'public', baseUrl: 'public',
paths: { paths: {
config: 'app/components/config',
settings: 'app/components/settings', settings: 'app/components/settings',
kbn: 'app/components/kbn', kbn: 'app/components/kbn',
store: 'app/components/store',
'extend-jquery': 'app/components/extend-jquery', 'extend-jquery': 'app/components/extend-jquery',
lodash: 'app/components/lodash.extended', lodash: 'app/components/lodash.extended',
...@@ -61,7 +59,7 @@ require.config({ ...@@ -61,7 +59,7 @@ require.config({
}, },
angular: { angular: {
deps: ['jquery','config'], deps: ['jquery'],
exports: 'angular' exports: 'angular'
}, },
......
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;
});
});
define([ define([
'angular', 'angular',
'config',
'lodash', 'lodash',
'jquery', 'jquery',
'store', 'app/core/config',
'app/core/store',
], ],
function (angular, config, _, $, store) { function (angular, _, $, config, store) {
"use strict"; "use strict";
var module = angular.module('grafana.controllers'); var module = angular.module('grafana.controllers');
......
define([ define([
'angular', 'angular',
'config', 'app/core/config',
], ],
function (angular, config) { function (angular, config) {
'use strict'; 'use strict';
......
define([ define([
'angular', 'angular',
'config', 'app/core/config',
], ],
function (angular, config) { function (angular, config) {
'use strict'; 'use strict';
......
define([ define([
'angular', 'angular',
'lodash', 'lodash',
'config' 'app/core/config'
], ],
function (angular, _, config) { function (angular, _, config) {
'use strict'; 'use strict';
......
define([ define([
'angular', 'angular',
'lodash', 'lodash',
'config', 'app/core/config',
], ],
function (angular, _, config) { function (angular, _, config) {
'use strict'; 'use strict';
......
...@@ -2,7 +2,7 @@ define([ ...@@ -2,7 +2,7 @@ define([
'angular', 'angular',
'lodash', 'lodash',
'jquery', 'jquery',
'config', 'app/core/config',
], ],
function (angular, _, $, config) { function (angular, _, $, config) {
'use strict'; 'use strict';
......
///<reference path="../headers/common.d.ts" /> ///<reference path="../headers/common.d.ts" />
import angular = require('angular'); import angular = require('angular');
import config = require('config'); import config = require('app/core/config');
var module = angular.module('grafana.controllers'); var module = angular.module('grafana.controllers');
......
define([ define([
'angular', 'angular',
'jquery', 'jquery',
'config', 'app/core/config',
'lodash',
], ],
function (angular, $, config) { function (angular, $, config) {
"use strict"; "use strict";
......
define([ define([
'angular', 'angular',
'lodash', 'lodash',
'config', 'app/core/config',
'store',
'filesaver'
], ],
function (angular, _) { function (angular, _) {
'use strict'; 'use strict';
......
define([ define([
'angular', 'angular',
'lodash', 'lodash',
'config' 'app/core/config'
], ],
function (angular, _, config) { function (angular, _, config) {
'use strict'; 'use strict';
......
...@@ -2,7 +2,7 @@ define([ ...@@ -2,7 +2,7 @@ define([
'angular', 'angular',
'lodash', 'lodash',
'kbn', 'kbn',
'store' 'app/core/store'
], ],
function (angular, _, kbn) { function (angular, _, kbn) {
'use strict'; 'use strict';
......
define([ define([
'angular', 'angular',
'lodash', 'lodash',
'config' 'app/core/config'
], ],
function (angular, _, config) { function (angular, _, config) {
'use strict'; 'use strict';
......
...@@ -2,7 +2,7 @@ define([ ...@@ -2,7 +2,7 @@ define([
'angular', 'angular',
'lodash', 'lodash',
'require', 'require',
'config', 'app/core/config',
], ],
function (angular, _, require, config) { function (angular, _, require, config) {
'use strict'; 'use strict';
......
define([ define([
'angular', 'angular',
'lodash', 'lodash',
'config',
'kbn', 'kbn',
'moment', 'moment',
'app/core/config',
'app/core/utils/datemath' 'app/core/utils/datemath'
], function (angular, _, config, kbn, moment, dateMath) { ], function (angular, _, kbn, moment, config, dateMath) {
'use strict'; 'use strict';
var module = angular.module('grafana.services'); var module = angular.module('grafana.services');
......
define([ define([
'angular', 'angular',
'config',
'lodash', 'lodash',
'app/core/config',
], ],
function (angular, config, _) { function (angular, _, config) {
'use strict'; 'use strict';
var module = angular.module('grafana.controllers'); var module = angular.module('grafana.controllers');
......
define([ define([
'angular', 'angular',
'config', 'app/core/config',
], ],
function (angular, config) { function (angular, config) {
'use strict'; 'use strict';
......
define([ define([
'angular', 'angular',
'jquery', 'jquery',
'config', 'app/core/config',
], ],
function (angular, $, config) { function (angular, $, config) {
'use strict'; 'use strict';
......
define([ define([
'angular', 'angular',
'lodash', 'lodash',
'config', 'app/core/config',
], ],
function (angular, _, config) { function (angular, _, config) {
'use strict'; 'use strict';
......
define([ define([
'angular', 'angular',
'config', 'app/core/config',
], ],
function (angular) { function (angular) {
'use strict'; 'use strict';
......
define([ define([
'angular', 'angular',
'config', 'app/core/config',
], ],
function (angular, config) { function (angular, config) {
'use strict'; 'use strict';
......
define([ define([
'angular', 'angular',
'config', 'app/core/config',
], ],
function (angular, config) { function (angular, config) {
'use strict'; 'use strict';
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
///<reference path="moment/moment.d.ts" /> ///<reference path="moment/moment.d.ts" />
// dummy modules // dummy modules
declare module 'config' { declare module 'app/core/config' {
var config : any; var config : any;
export = config; export = config;
} }
......
...@@ -2,7 +2,7 @@ define([ ...@@ -2,7 +2,7 @@ define([
'angular', 'angular',
'app/app', 'app/app',
'lodash', 'lodash',
'config', 'app/core/config',
'app/features/panel/panel_meta', 'app/features/panel/panel_meta',
], ],
function (angular, app, _, config, PanelMeta) { function (angular, app, _, config, PanelMeta) {
......
...@@ -2,7 +2,7 @@ define([ ...@@ -2,7 +2,7 @@ define([
'angular', 'angular',
'lodash', 'lodash',
'jquery', 'jquery',
'config', 'app/core/config',
'app/core/utils/datemath', 'app/core/utils/datemath',
'./directives', './directives',
'./query_ctrl', './query_ctrl',
......
define([ define([
'angular', 'angular',
'lodash', 'lodash',
'config', 'app/core/config',
'./gfunc', './gfunc',
'./parser' './parser'
], ],
......
define([ define([
'angular', 'angular',
'lodash', 'lodash',
'config', 'app/core/config',
], ],
function (angular, _, config) { function (angular, _, config) {
'use strict'; 'use strict';
......
define([ define([
'angular', 'angular',
'lodash', 'lodash',
'store', 'app/core/store',
'config', 'app/core/config',
], ],
function (angular, _, store, config) { function (angular, _, store, config) {
'use strict'; 'use strict';
......
define([ define([
'angular', 'angular',
'lodash', 'lodash',
'config', 'app/core/config',
], ],
function (angular, _, config) { function (angular, _, config) {
'use strict'; 'use strict';
......
...@@ -2,9 +2,7 @@ require.config({ ...@@ -2,9 +2,7 @@ require.config({
baseUrl: 'http://localhost:9876/base/', baseUrl: 'http://localhost:9876/base/',
paths: { paths: {
config: 'app/components/config',
kbn: 'app/components/kbn', kbn: 'app/components/kbn',
store: 'app/components/store',
settings: 'app/components/settings', settings: 'app/components/settings',
lodash: 'app/components/lodash.extended', lodash: 'app/components/lodash.extended',
...@@ -58,7 +56,7 @@ require.config({ ...@@ -58,7 +56,7 @@ require.config({
}, },
angular: { angular: {
deps: ['jquery', 'config'], deps: ['jquery'],
exports: 'angular' exports: 'angular'
}, },
......
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