Commit 97697b93 by Torkel Ödegaard

refactoring: moving and renaming things

parent 152b484e
......@@ -69,7 +69,6 @@ function (angular, $, _, appLevelRequire) {
});
var preBootRequires = [
'app/services/all',
'app/features/all',
];
......
......@@ -17,6 +17,7 @@
///<amd-dependency path="./routes/all" />
///<amd-dependency path="./controllers/all" />
///<amd-dependency path="./services/all" />
///<amd-dependency path="./jquery_extended" />
///<amd-dependency path="./partials" />
......
define([
'angular',
'lodash'
'lodash',
'../core_module',
],
function (angular, _) {
function (angular, _, coreModule) {
'use strict';
var module = angular.module('grafana.services');
module.service('alertSrv', function($timeout, $sce, $rootScope, $modal, $q) {
coreModule.service('alertSrv', function($timeout, $sce, $rootScope, $modal, $q) {
var self = this;
this.init = function() {
......
define([
'angular',
'../core_module',
],
function(angular) {
function(angular, coreModule) {
'use strict';
var module = angular.module('grafana.services');
module.service('googleAnalyticsSrv', function($rootScope, $location) {
coreModule.service('googleAnalyticsSrv', function($rootScope, $location) {
var first = true;
this.init = function() {
......
define([
'angular',
'lodash',
'../core_module',
'app/core/config',
],
function (angular, _, config) {
function (angular, _, coreModule, config) {
'use strict';
var module = angular.module('grafana.services');
module.service('backendSrv', function($http, alertSrv, $timeout) {
coreModule.service('backendSrv', function($http, alertSrv, $timeout) {
var self = this;
this.get = function(url, params) {
......
define([
'angular',
'lodash',
'../core_module',
'app/core/store',
'app/core/config',
],
function (angular, _, store, config) {
function (angular, _, coreModule, store, config) {
'use strict';
var module = angular.module('grafana.services');
module.service('contextSrv', function($rootScope, $timeout) {
coreModule.service('contextSrv', function($rootScope, $timeout) {
var self = this;
function User() {
......
define([
'angular',
'lodash',
'../core_module',
'app/core/config',
],
function (angular, _, config) {
function (angular, _, coreModule, config) {
'use strict';
var module = angular.module('grafana.services');
module.service('datasourceSrv', function($q, $injector, $rootScope) {
coreModule.service('datasourceSrv', function($q, $injector, $rootScope) {
var self = this;
this.init = function() {
......
define([
'angular',
'lodash'
'lodash',
'../core_module',
],
function (angular, _) {
function (angular, _, coreModule) {
'use strict';
var module = angular.module('grafana.services');
// This service was based on OpenJS library available in BSD License
// http://www.openjs.com/scripts/events/keyboard_shortcuts/index.php
module.factory('keyboardManager', ['$window', '$timeout', function ($window, $timeout) {
coreModule.factory('keyboardManager', ['$window', '$timeout', function ($window, $timeout) {
var keyboardManagerService = {};
var defaultOpt = {
......
......@@ -2,13 +2,12 @@ define([
'angular',
'lodash',
'jquery',
'../core_module',
],
function (angular, _, $) {
function (angular, _, $, coreModule) {
'use strict';
var module = angular.module('grafana.services');
module.service('popoverSrv', function($templateCache, $timeout, $q, $http, $compile) {
coreModule.service('popoverSrv', function($templateCache, $timeout, $q, $http, $compile) {
this.getTemplate = function(url) {
return $q.when($templateCache.get(url) || $http.get(url, {cache: true}));
......
define([
'angular',
'lodash'
'lodash',
'../core_module',
],
function (angular, _) {
function (angular, _, coreModule) {
'use strict';
var module = angular.module('grafana.services');
module.service('timer', function($timeout) {
coreModule.service('timer', function($timeout) {
// This service really just tracks a list of $timeout promises to give us a
// method for cancelling them all when we need to
......
define([
'angular',
'lodash',
'../core_module',
],
function (angular, _) {
function (angular, _, coreModule) {
'use strict';
var module = angular.module('grafana.services');
module.service('uiSegmentSrv', function($sce, templateSrv) {
coreModule.service('uiSegmentSrv', function($sce, templateSrv) {
function MetricSegment(options) {
if (options === '*' || options.value === '*') {
......
define([
'angular',
'../core_module',
],
function (angular) {
function (angular, coreModule) {
'use strict';
var module = angular.module('grafana.services');
module.service('utilSrv', function($rootScope, $modal, $q) {
coreModule.service('utilSrv', function($rootScope, $modal, $q) {
this.init = function() {
$rootScope.onAppEvent('show-modal', this.showModal, $rootScope);
......
......@@ -8,10 +8,13 @@ declare var helpers: any;
describe('CloudWatchDatasource', function() {
var ctx = new helpers.ServiceTestContext();
beforeEach(angularMocks.module('grafana.core'));
beforeEach(angularMocks.module('grafana.services'));
beforeEach(angularMocks.module('grafana.controllers'));
beforeEach(ctx.providePhase(['templateSrv', 'backendSrv']));
beforeEach(ctx.createService('CloudWatchDatasource'));
beforeEach(function() {
ctx.ds = new ctx.service({
jsonData: {
......
......@@ -10,6 +10,7 @@ declare var helpers: any;
describe('ElasticDatasource', function() {
var ctx = new helpers.ServiceTestContext();
beforeEach(angularMocks.module('grafana.core'));
beforeEach(angularMocks.module('grafana.services'));
beforeEach(ctx.providePhase(['templateSrv', 'backendSrv']));
beforeEach(ctx.createService('ElasticDatasource'));
......
///<amd-dependency path="../query_ctrl" />
///<amd-dependency path="app/services/uiSegmentSrv" />
///<amd-dependency path="app/core/services/uiSegmentSrv" />
///<amd-dependency path="test/specs/helpers" name="helpers" />
import {describe, beforeEach, it, sinon, expect, angularMocks} from 'test/lib/common';
......
......@@ -7,10 +7,12 @@ declare var helpers: any;
describe('graphiteDatasource', function() {
var ctx = new helpers.ServiceTestContext();
beforeEach(angularMocks.module('grafana.core'));
beforeEach(angularMocks.module('grafana.services'));
beforeEach(ctx.providePhase(['backendSrv']));
beforeEach(ctx.providePhase(['backendSrv']));
beforeEach(ctx.createService('GraphiteDatasource'));
beforeEach(function() {
ctx.ds = new ctx.service({ url: [''] });
});
......
///<amd-dependency path="app/plugins/datasource/graphite/gfunc" name="gfunc"/>
///<amd-dependency path="app/plugins/datasource/graphite/query_ctrl" />
///<amd-dependency path="app/services/uiSegmentSrv" />
///<amd-dependency path="app/core/services/uiSegmentSrv" />
///<amd-dependency path="test/specs/helpers" name="helpers" />
import {describe, beforeEach, it, sinon, expect, angularMocks} from 'test/lib/common';
......@@ -11,8 +11,10 @@ declare var helpers: any;
describe('GraphiteQueryCtrl', function() {
var ctx = new helpers.ControllerTestContext();
beforeEach(angularMocks.module('grafana.core'));
beforeEach(angularMocks.module('grafana.controllers'));
beforeEach(angularMocks.module('grafana.services'));
beforeEach(ctx.providePhase());
beforeEach(ctx.createControllerPhase('GraphiteQueryCtrl'));
......
///<amd-dependency path="app/plugins/datasource/influxdb/query_ctrl"/>
///<amd-dependency path="app/services/uiSegmentSrv" />
///<amd-dependency path="app/core/services/uiSegmentSrv" />
///<amd-dependency path="test/specs/helpers" name="helpers" />
import {describe, beforeEach, it, sinon, expect, angularMocks} from 'test/lib/common';
......@@ -9,6 +9,7 @@ declare var helpers: any;
describe('InfluxDBQueryCtrl', function() {
var ctx = new helpers.ControllerTestContext();
beforeEach(angularMocks.module('grafana.core'));
beforeEach(angularMocks.module('grafana.controllers'));
beforeEach(angularMocks.module('grafana.services'));
beforeEach(ctx.providePhase());
......
///<amd-dependency path="app/plugins/datasource/influxdb_08/datasource"/>
///<amd-dependency path="app/services/backendSrv"/>
///<amd-dependency path="app/services/alertSrv"/>
///<amd-dependency path="app/core/services/backendSrv"/>
///<amd-dependency path="app/core/services/alertSrv"/>
///<amd-dependency path="test/specs/helpers" name="helpers" />
import {describe, beforeEach, it, sinon, expect, angularMocks} from 'test/lib/common';
......@@ -10,6 +10,7 @@ declare var helpers: any;
describe('InfluxDatasource', function() {
var ctx = new helpers.ServiceTestContext();
beforeEach(angularMocks.module('grafana.core'));
beforeEach(angularMocks.module('grafana.services'));
beforeEach(ctx.providePhase(['templateSrv']));
beforeEach(ctx.createService('InfluxDatasource_08'));
......
......@@ -6,12 +6,15 @@ import moment = require('moment');
declare var helpers: any;
describe('PrometheusDatasource', function() {
var ctx = new helpers.ServiceTestContext();
beforeEach(angularMocks.module('grafana.core'));
beforeEach(angularMocks.module('grafana.services'));
beforeEach(ctx.createService('PrometheusDatasource'));
beforeEach(function() {
ctx.ds = new ctx.service({ url: 'proxied', directUrl: 'direct', user: 'test', password: 'mupp' });
});
describe('When querying prometheus with one target using query editor target spec', function() {
var results;
var urlExpected = 'proxied/api/v1/query_range?query=' +
......
......@@ -7,9 +7,12 @@ define([
describe('KairosDBDatasource', function() {
var ctx = new helpers.ServiceTestContext();
beforeEach(module('grafana.core'));
beforeEach(module('grafana.services'));
beforeEach(ctx.providePhase(['templateSrv']));
beforeEach(ctx.createService('KairosDBDatasource'));
beforeEach(function() {
ctx.ds = new ctx.service({ url: ''});
});
......
......@@ -7,6 +7,7 @@ define([
describe('linkSrv', function() {
var _linkSrv;
beforeEach(module('grafana.core'));
beforeEach(module('grafana.services'));
beforeEach(inject(function(linkSrv) {
......
......@@ -7,6 +7,7 @@ define([
describe('opentsdb', function() {
var ctx = new helpers.ServiceTestContext();
beforeEach(module('grafana.core'));
beforeEach(module('grafana.services'));
beforeEach(ctx.providePhase(['backendSrv']));
......
define([
'../mocks/dashboard-mock',
'./helpers',
'test/mocks/dashboard-mock',
'test/specs/helpers',
'lodash',
'moment',
'app/services/timer',
'app/core/services/timer',
'app/features/dashboard/timeSrv'
], function(dashboardMock, helpers, _, moment) {
'use strict';
......@@ -12,6 +12,7 @@ define([
var ctx = new helpers.ServiceTestContext();
var _dashboard;
beforeEach(module('grafana.core'));
beforeEach(module('grafana.services'));
beforeEach(ctx.providePhase(['$routeParams']));
beforeEach(ctx.createService('timeSrv'));
......
......@@ -51,9 +51,7 @@ module.exports = function(config,grunt) {
'angular-strap',
'angular-dragdrop',
'app/core/core',
'app/services/all',
'app/features/all',
'app/controllers/all',
// bundle the datasources
'app/plugins/datasource/grafana/datasource',
'app/plugins/datasource/graphite/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