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