From 6cf46b16351480452be3dc4a78e9a3a478eacfbb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Fri, 30 Oct 2015 14:44:40 +0100 Subject: [PATCH] refactoring: more moving stuff around --- public/app/components/require.config.js | 1 - public/app/core/directives/dash_upload.js | 4 ++-- public/app/core/directives/misc.js | 4 ++-- public/app/core/directives/ng_model_on_blur.js | 6 +++--- public/app/core/time_series.js | 2 +- public/app/{components => core/utils}/kbn.js | 0 public/app/features/dashboard/dashboardLoaderSrv.js | 2 +- public/app/features/dashboard/dashboardSrv.js | 3 +-- public/app/features/dashboard/graphiteImportCtrl.js | 2 +- public/app/features/dashboard/playlistSrv.js | 3 +-- public/app/features/dashboard/timeSrv.js | 4 ++-- .../app/features/dashboard/timepicker/timepicker.ts | 2 +- public/app/features/panel/panel_helper.js | 8 ++++---- public/app/features/panellinks/linkSrv.js | 4 ++-- public/app/features/templating/templateValuesSrv.js | 2 +- public/app/headers/common.d.ts | 2 +- public/app/panels/graph/graph.js | 4 ++-- public/app/panels/graph/legend.js | 3 +-- public/app/panels/graph/module.js | 13 ++++++------- public/app/panels/singlestat/module.js | 2 +- .../plugins/datasource/elasticsearch/datasource.js | 2 +- .../app/plugins/datasource/kairosdb/datasource.js | 2 +- public/app/plugins/datasource/opentsdb/queryCtrl.js | 2 +- public/app/plugins/datasource/sql/datasource.js | 2 -- public/test/specs/helpers.js | 3 +-- public/test/specs/kbn-format-specs.js | 2 +- public/test/test-main.js | 3 --- 27 files changed, 38 insertions(+), 49 deletions(-) rename public/app/{components => core/utils}/kbn.js (100%) diff --git a/public/app/components/require.config.js b/public/app/components/require.config.js index 141b7ccaf85..1af01a91710 100644 --- a/public/app/components/require.config.js +++ b/public/app/components/require.config.js @@ -3,7 +3,6 @@ require.config({ baseUrl: 'public', paths: { - kbn: 'app/components/kbn', 'extend-jquery': 'app/components/extend-jquery', lodash: 'app/components/lodash.extended', diff --git a/public/app/core/directives/dash_upload.js b/public/app/core/directives/dash_upload.js index 4a42d38eea7..ed4253c71ca 100644 --- a/public/app/core/directives/dash_upload.js +++ b/public/app/core/directives/dash_upload.js @@ -1,8 +1,8 @@ define([ - 'kbn', '../core_module', + 'app/core/utils/kbn', ], -function (kbn, coreModule) { +function (coreModule, kbn) { 'use strict'; coreModule.directive('dashUpload', function(timer, alertSrv, $location) { diff --git a/public/app/core/directives/misc.js b/public/app/core/directives/misc.js index 5733774c3bd..0fe18f922f7 100644 --- a/public/app/core/directives/misc.js +++ b/public/app/core/directives/misc.js @@ -1,9 +1,9 @@ define([ 'angular', - 'kbn', '../core_module', + 'app/core/utils/kbn', ], -function (angular, kbn, coreModule) { +function (angular, coreModule, kbn) { 'use strict'; coreModule.directive('tip', function($compile) { diff --git a/public/app/core/directives/ng_model_on_blur.js b/public/app/core/directives/ng_model_on_blur.js index 5e32a28eb94..c4a645732c5 100644 --- a/public/app/core/directives/ng_model_on_blur.js +++ b/public/app/core/directives/ng_model_on_blur.js @@ -1,9 +1,9 @@ define([ - 'kbn', - 'app/core/core_module', + '../core_module', + 'app/core/utils/kbn', 'app/core/utils/rangeutil', ], -function (kbn, coreModule, rangeUtil) { +function (coreModule, kbn, rangeUtil) { 'use strict'; coreModule.directive('ngModelOnblur', function() { diff --git a/public/app/core/time_series.js b/public/app/core/time_series.js index 74194e68ff9..9465232c200 100644 --- a/public/app/core/time_series.js +++ b/public/app/core/time_series.js @@ -1,6 +1,6 @@ define([ 'lodash', - 'kbn' + 'app/core/utils/kbn' ], function (_, kbn) { 'use strict'; diff --git a/public/app/components/kbn.js b/public/app/core/utils/kbn.js similarity index 100% rename from public/app/components/kbn.js rename to public/app/core/utils/kbn.js diff --git a/public/app/features/dashboard/dashboardLoaderSrv.js b/public/app/features/dashboard/dashboardLoaderSrv.js index 85e6374e0a3..f578a9d1075 100644 --- a/public/app/features/dashboard/dashboardLoaderSrv.js +++ b/public/app/features/dashboard/dashboardLoaderSrv.js @@ -3,7 +3,7 @@ define([ 'moment', 'lodash', 'jquery', - 'kbn', + 'app/core/utils/kbn', 'app/core/utils/datemath', ], function (angular, moment, _, $, kbn, dateMath) { diff --git a/public/app/features/dashboard/dashboardSrv.js b/public/app/features/dashboard/dashboardSrv.js index 21318ac8370..ce7cbeb11d2 100644 --- a/public/app/features/dashboard/dashboardSrv.js +++ b/public/app/features/dashboard/dashboardSrv.js @@ -1,11 +1,10 @@ define([ 'angular', 'jquery', - 'kbn', 'lodash', 'moment', ], -function (angular, $, kbn, _, moment) { +function (angular, $, _, moment) { 'use strict'; var module = angular.module('grafana.services'); diff --git a/public/app/features/dashboard/graphiteImportCtrl.js b/public/app/features/dashboard/graphiteImportCtrl.js index 2b6660c2a22..53338883274 100644 --- a/public/app/features/dashboard/graphiteImportCtrl.js +++ b/public/app/features/dashboard/graphiteImportCtrl.js @@ -1,7 +1,7 @@ define([ 'angular', 'lodash', - 'kbn' + 'app/core/utils/kbn' ], function (angular, _, kbn) { 'use strict'; diff --git a/public/app/features/dashboard/playlistSrv.js b/public/app/features/dashboard/playlistSrv.js index aee00837562..bf4587f6c48 100644 --- a/public/app/features/dashboard/playlistSrv.js +++ b/public/app/features/dashboard/playlistSrv.js @@ -1,8 +1,7 @@ define([ 'angular', 'lodash', - 'kbn', - 'app/core/store' + 'app/core/utils/kbn', ], function (angular, _, kbn) { 'use strict'; diff --git a/public/app/features/dashboard/timeSrv.js b/public/app/features/dashboard/timeSrv.js index b0e5d37b90d..e0e0ed47dab 100644 --- a/public/app/features/dashboard/timeSrv.js +++ b/public/app/features/dashboard/timeSrv.js @@ -1,11 +1,11 @@ define([ 'angular', 'lodash', - 'kbn', 'moment', 'app/core/config', + 'app/core/utils/kbn', 'app/core/utils/datemath' -], function (angular, _, kbn, moment, config, dateMath) { +], function (angular, _, moment, config, kbn, dateMath) { 'use strict'; var module = angular.module('grafana.services'); diff --git a/public/app/features/dashboard/timepicker/timepicker.ts b/public/app/features/dashboard/timepicker/timepicker.ts index bda002d59cd..c6d2680ce02 100644 --- a/public/app/features/dashboard/timepicker/timepicker.ts +++ b/public/app/features/dashboard/timepicker/timepicker.ts @@ -4,7 +4,7 @@ import angular = require('angular'); import _ = require('lodash'); import moment = require('moment'); -import kbn = require('kbn'); +import kbn = require('app/core/utils/kbn'); import dateMath = require('app/core/utils/datemath'); import rangeUtil = require('app/core/utils/rangeutil'); diff --git a/public/app/features/panel/panel_helper.js b/public/app/features/panel/panel_helper.js index c7473692a43..c3ccbfe7e09 100644 --- a/public/app/features/panel/panel_helper.js +++ b/public/app/features/panel/panel_helper.js @@ -1,12 +1,12 @@ define([ 'angular', + 'lodash', + 'jquery', + 'app/core/utils/kbn', 'app/core/utils/datemath', 'app/core/utils/rangeutil', - 'lodash', - 'kbn', - 'jquery', ], -function (angular, dateMath, rangeUtil, _, kbn, $) { +function (angular, _, $, kbn, dateMath, rangeUtil) { 'use strict'; var module = angular.module('grafana.services'); diff --git a/public/app/features/panellinks/linkSrv.js b/public/app/features/panellinks/linkSrv.js index 2e1f3e16436..c3a99bed4cb 100644 --- a/public/app/features/panellinks/linkSrv.js +++ b/public/app/features/panellinks/linkSrv.js @@ -1,9 +1,9 @@ define([ 'angular', - 'kbn', 'lodash', + 'app/core/utils/kbn', ], -function (angular, kbn, _) { +function (angular, _, kbn) { 'use strict'; angular diff --git a/public/app/features/templating/templateValuesSrv.js b/public/app/features/templating/templateValuesSrv.js index 18216fabd0f..bd3e6eb2b52 100644 --- a/public/app/features/templating/templateValuesSrv.js +++ b/public/app/features/templating/templateValuesSrv.js @@ -1,7 +1,7 @@ define([ 'angular', 'lodash', - 'kbn', + 'app/core/utils/kbn', ], function (angular, _, kbn) { 'use strict'; diff --git a/public/app/headers/common.d.ts b/public/app/headers/common.d.ts index 1e5ff821255..5f97278274f 100644 --- a/public/app/headers/common.d.ts +++ b/public/app/headers/common.d.ts @@ -9,7 +9,7 @@ declare module 'app/core/config' { export = config; } -declare module 'kbn' { +declare module 'app/core/utils/kbn' { var kbn : any; export = kbn; } diff --git a/public/app/panels/graph/graph.js b/public/app/panels/graph/graph.js index dce30643205..6e1424ae906 100755 --- a/public/app/panels/graph/graph.js +++ b/public/app/panels/graph/graph.js @@ -1,9 +1,9 @@ define([ 'angular', 'jquery', - 'kbn', 'moment', 'lodash', + 'app/core/utils/kbn', './graph.tooltip', 'jquery.flot', 'jquery.flot.events', @@ -14,7 +14,7 @@ define([ 'jquery.flot.fillbelow', 'jquery.flot.crosshair' ], -function (angular, $, kbn, moment, _, GraphTooltip) { +function (angular, $, moment, _, kbn, GraphTooltip) { 'use strict'; var module = angular.module('grafana.directives'); diff --git a/public/app/panels/graph/legend.js b/public/app/panels/graph/legend.js index c659447a704..065e74fed30 100644 --- a/public/app/panels/graph/legend.js +++ b/public/app/panels/graph/legend.js @@ -1,12 +1,11 @@ define([ 'angular', 'lodash', - 'kbn', 'jquery', 'jquery.flot', 'jquery.flot.time', ], -function (angular, _, kbn, $) { +function (angular, _, $) { 'use strict'; var module = angular.module('grafana.panels.graph'); diff --git a/public/app/panels/graph/module.js b/public/app/panels/graph/module.js index 1bf45c7c1b8..ff9633d0576 100644 --- a/public/app/panels/graph/module.js +++ b/public/app/panels/graph/module.js @@ -1,16 +1,15 @@ define([ 'angular', - 'jquery', 'lodash', - 'kbn', 'moment', + 'app/core/utils/kbn', 'app/core/time_series', 'app/features/panel/panel_meta', './seriesOverridesCtrl', './graph', './legend', ], -function (angular, $, _, kbn, moment, TimeSeries, PanelMeta) { +function (angular, _, moment, kbn, TimeSeries, PanelMeta) { 'use strict'; var module = angular.module('grafana.panels.graph'); @@ -42,9 +41,9 @@ function (angular, $, _, kbn, moment, TimeSeries, PanelMeta) { var _d = { // datasource name, null = default datasource datasource: null, - // sets client side (flot) or native graphite png renderer (png) + // sets client side (flot) or native graphite png renderer (png) renderer: 'flot', - // Show/hide the x-axis + // Show/hide the x-axis 'x-axis' : true, // Show/hide y-axis 'y-axis' : true, @@ -179,8 +178,8 @@ function (angular, $, _, kbn, moment, TimeSeries, PanelMeta) { var series = new TimeSeries({ datapoints: datapoints, - alias: alias, - color: color, + alias: alias, + color: color, }); if (datapoints && datapoints.length > 0) { diff --git a/public/app/panels/singlestat/module.js b/public/app/panels/singlestat/module.js index 6c7d88edba8..18d02e166f1 100644 --- a/public/app/panels/singlestat/module.js +++ b/public/app/panels/singlestat/module.js @@ -2,7 +2,7 @@ define([ 'angular', 'app/app', 'lodash', - 'kbn', + 'app/core/utils/kbn', 'app/core/time_series', 'app/features/panel/panel_meta', './singleStatPanel', diff --git a/public/app/plugins/datasource/elasticsearch/datasource.js b/public/app/plugins/datasource/elasticsearch/datasource.js index 6c216713368..4e27da73850 100644 --- a/public/app/plugins/datasource/elasticsearch/datasource.js +++ b/public/app/plugins/datasource/elasticsearch/datasource.js @@ -2,7 +2,7 @@ define([ 'angular', 'lodash', 'moment', - 'kbn', + 'app/core/utils/kbn', './query_builder', './index_pattern', './elastic_response', diff --git a/public/app/plugins/datasource/kairosdb/datasource.js b/public/app/plugins/datasource/kairosdb/datasource.js index 5d20adfa5f0..287b5ce7292 100644 --- a/public/app/plugins/datasource/kairosdb/datasource.js +++ b/public/app/plugins/datasource/kairosdb/datasource.js @@ -2,7 +2,7 @@ define([ 'angular', 'lodash', 'app/core/utils/datemath', - 'kbn', + 'app/core/utils/kbn', './queryCtrl', './directives', ], diff --git a/public/app/plugins/datasource/opentsdb/queryCtrl.js b/public/app/plugins/datasource/opentsdb/queryCtrl.js index d5aa3db58ae..2d796674bd5 100644 --- a/public/app/plugins/datasource/opentsdb/queryCtrl.js +++ b/public/app/plugins/datasource/opentsdb/queryCtrl.js @@ -1,7 +1,7 @@ define([ 'angular', 'lodash', - 'kbn' + 'app/core/utils/kbn' ], function (angular, _, kbn) { 'use strict'; diff --git a/public/app/plugins/datasource/sql/datasource.js b/public/app/plugins/datasource/sql/datasource.js index 591dc5a5bb4..ae6e62286ba 100644 --- a/public/app/plugins/datasource/sql/datasource.js +++ b/public/app/plugins/datasource/sql/datasource.js @@ -1,7 +1,5 @@ define([ 'angular', - 'lodash', - 'kbn', ], function (angular) { 'use strict'; diff --git a/public/test/specs/helpers.js b/public/test/specs/helpers.js index 9fa5aeee209..ded17428d8f 100644 --- a/public/test/specs/helpers.js +++ b/public/test/specs/helpers.js @@ -1,8 +1,7 @@ define([ - 'kbn', 'lodash', 'app/core/utils/datemath', -], function(kbn, _, dateMath) { +], function(_, dateMath) { 'use strict'; function ControllerTestContext() { diff --git a/public/test/specs/kbn-format-specs.js b/public/test/specs/kbn-format-specs.js index f84544fff4f..0a51312e9b1 100644 --- a/public/test/specs/kbn-format-specs.js +++ b/public/test/specs/kbn-format-specs.js @@ -1,5 +1,5 @@ define([ - 'kbn', + 'app/core/utils/kbn', 'app/core/utils/datemath' ], function(kbn, dateMath) { 'use strict'; diff --git a/public/test/test-main.js b/public/test/test-main.js index 4d6eee4048e..82197d75a19 100644 --- a/public/test/test-main.js +++ b/public/test/test-main.js @@ -2,9 +2,6 @@ require.config({ baseUrl: 'http://localhost:9876/base/', paths: { - kbn: 'app/components/kbn', - - settings: 'app/components/settings', lodash: 'app/components/lodash.extended', 'lodash-src': 'vendor/lodash',