Pārlūkot izejas kodu

Merge branch 'master' into develop

Torkel Ödegaard 8 gadi atpakaļ
vecāks
revīzija
68562a2077

+ 0 - 13
public/app/core/config.js

@@ -1,13 +0,0 @@
-define([
-  'app/core/settings',
-],
-function (Settings) {
-  "use strict";
-
-  var bootData = window.grafanaBootData || { settings: {} };
-  var options = bootData.settings;
-  options.bootData = bootData;
-
-  return new Settings(options);
-
-});

+ 38 - 0
public/app/core/config.ts

@@ -0,0 +1,38 @@
+import _ from 'lodash';
+
+class Settings {
+    datasources: any;
+    panels: any;
+    appSubUrl: string;
+    window_title_prefix: string;
+    buildInfo: any;
+    new_panel_title: string;
+    bootData: any;
+    externalUserMngLinkUrl: string;
+    externalUserMngLinkName: string;
+    externalUserMngInfo: string;
+    allowOrgCreate: boolean;
+    disableLoginForm: boolean;
+    defaultDatasource: string;
+    alertingEnabled: boolean;
+
+    constructor(options) {
+        var defaults = {
+            datasources: {},
+            window_title_prefix: 'Grafana - ',
+            panels: {},
+            new_panel_title: 'Panel Title',
+            playlist_timespan: "1m",
+            unsaved_changes_warning: true,
+            appSubUrl: ""
+        };
+         _.extend(this, defaults, options);
+    }
+}
+
+var bootData = (<any>window).grafanaBootData || { settings: {} };
+var options = bootData.settings;
+options.bootData = bootData;
+
+const config = new Settings(options);
+export default config;

+ 2 - 0
public/app/core/controllers/invited_ctrl.js

@@ -6,6 +6,8 @@ define([
 function (angular, coreModule, config) {
 function (angular, coreModule, config) {
   'use strict';
   'use strict';
 
 
+  config = config.default;
+
   coreModule.default.controller('InvitedCtrl', function($scope, $routeParams, contextSrv, backendSrv) {
   coreModule.default.controller('InvitedCtrl', function($scope, $routeParams, contextSrv, backendSrv) {
     contextSrv.sidemenu = false;
     contextSrv.sidemenu = false;
     $scope.formModel = {};
     $scope.formModel = {};

+ 2 - 0
public/app/core/controllers/login_ctrl.js

@@ -7,6 +7,8 @@ define([
 function (angular, _, coreModule, config) {
 function (angular, _, coreModule, config) {
   'use strict';
   'use strict';
 
 
+  config = config.default;
+
   coreModule.default.controller('LoginCtrl', function($scope, backendSrv, contextSrv, $location) {
   coreModule.default.controller('LoginCtrl', function($scope, backendSrv, contextSrv, $location) {
     $scope.formModel = {
     $scope.formModel = {
       user: '',
       user: '',

+ 2 - 2
public/app/core/directives/dash_class.js

@@ -31,8 +31,8 @@ function (_, $, coreModule) {
           }
           }
         });
         });
 
 
-        $scope.$watch('ctrl.playlistSrv', function(newValue) {
-          elem.toggleClass('playlist-active', _.isObject(newValue));
+        $scope.$watch('ctrl.playlistSrv.isPlaying', function(newValue) {
+          elem.toggleClass('playlist-active', newValue === true);
         });
         });
       }
       }
     };
     };

+ 2 - 0
public/app/core/services/analytics.js

@@ -7,6 +7,8 @@ define([
 function(angular, $, coreModule, config) {
 function(angular, $, coreModule, config) {
   'use strict';
   'use strict';
 
 
+  config = config.default;
+
   coreModule.default.service('googleAnalyticsSrv', function($rootScope, $location) {
   coreModule.default.service('googleAnalyticsSrv', function($rootScope, $location) {
 
 
     function gaInit() {
     function gaInit() {

+ 0 - 20
public/app/core/settings.js

@@ -1,20 +0,0 @@
-define([
-  'lodash',
-],
-function (_) {
-  "use strict";
-
-  return function Settings (options) {
-    var defaults = {
-      datasources                   : {},
-      window_title_prefix           : 'Grafana - ',
-      panels                        : {},
-      new_panel_title: 'Panel Title',
-      playlist_timespan: "1m",
-      unsaved_changes_warning: true,
-      appSubUrl: ""
-    };
-
-    return _.extend({}, defaults, options);
-  };
-});

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

@@ -5,8 +5,7 @@ define([
   'jquery',
   'jquery',
   'app/core/utils/kbn',
   'app/core/utils/kbn',
   'app/core/utils/datemath',
   'app/core/utils/datemath',
-  './impression_store',
-  'app/core/config',
+  './impression_store'
 ],
 ],
 function (angular, moment, _, $, kbn, dateMath, impressionStore) {
 function (angular, moment, _, $, kbn, dateMath, impressionStore) {
   'use strict';
   'use strict';

+ 1 - 0
public/app/features/dashboard/dashboard_ctrl.ts

@@ -21,6 +21,7 @@ export class DashboardCtrl implements PanelContainer {
     private dashboardSrv,
     private dashboardSrv,
     private unsavedChangesSrv,
     private unsavedChangesSrv,
     private dashboardViewStateSrv,
     private dashboardViewStateSrv,
+    public  playlistSrv,
     private panelLoader) {
     private panelLoader) {
       // temp hack due to way dashboards are loaded
       // temp hack due to way dashboards are loaded
       // can't use controllerAs on route yet
       // can't use controllerAs on route yet

+ 1 - 0
public/app/features/dashboard/dashnav/dashnav.ts

@@ -19,6 +19,7 @@ export class DashNavCtrl {
     private $location,
     private $location,
     private backendSrv,
     private backendSrv,
     private contextSrv,
     private contextSrv,
+    public playlistSrv,
     navModelSrv) {
     navModelSrv) {
       this.navModel = navModelSrv.getDashboardNav(this.dashboard, this);
       this.navModel = navModelSrv.getDashboardNav(this.dashboard, this);
 
 

+ 2 - 0
public/app/features/dashboard/shareModalCtrl.js

@@ -7,6 +7,8 @@ define(['angular',
 function (angular, _, $, moment, config) {
 function (angular, _, $, moment, config) {
   'use strict';
   'use strict';
 
 
+  config = config.default;
+
   var module = angular.module('grafana.controllers');
   var module = angular.module('grafana.controllers');
 
 
   module.controller('ShareModalCtrl', function($scope, $rootScope, $location, $timeout, timeSrv, templateSrv, linkSrv) {
   module.controller('ShareModalCtrl', function($scope, $rootScope, $location, $timeout, timeSrv, templateSrv, linkSrv) {

+ 1 - 0
public/app/features/dashboard/viewStateSrv.js

@@ -7,6 +7,7 @@ define([
 function (angular, _, $, config) {
 function (angular, _, $, config) {
   'use strict';
   'use strict';
 
 
+  config = config.default;
   var module = angular.module('grafana.services');
   var module = angular.module('grafana.services');
 
 
   module.factory('dashboardViewStateSrv', function($location, $timeout, $rootScope) {
   module.factory('dashboardViewStateSrv', function($location, $timeout, $rootScope) {

+ 2 - 0
public/app/features/org/change_password_ctrl.js

@@ -5,6 +5,8 @@ define([
 function (angular, config) {
 function (angular, config) {
   'use strict';
   'use strict';
 
 
+  config = config.default;
+
   var module = angular.module('grafana.controllers');
   var module = angular.module('grafana.controllers');
 
 
   module.controller('ChangePasswordCtrl', function($scope, backendSrv, $location, navModelSrv) {
   module.controller('ChangePasswordCtrl', function($scope, backendSrv, $location, navModelSrv) {

+ 2 - 0
public/app/features/org/newOrgCtrl.js

@@ -5,6 +5,8 @@ define([
 function (angular, config) {
 function (angular, config) {
   'use strict';
   'use strict';
 
 
+  config = config.default;
+
   var module = angular.module('grafana.controllers');
   var module = angular.module('grafana.controllers');
 
 
   module.controller('NewOrgCtrl', function($scope, $http, backendSrv, navModelSrv) {
   module.controller('NewOrgCtrl', function($scope, $http, backendSrv, navModelSrv) {

+ 2 - 0
public/app/features/org/select_org_ctrl.js

@@ -5,6 +5,8 @@ define([
 function (angular, config) {
 function (angular, config) {
   'use strict';
   'use strict';
 
 
+  config = config.default;
+
   var module = angular.module('grafana.controllers');
   var module = angular.module('grafana.controllers');
 
 
   module.controller('SelectOrgCtrl', function($scope, backendSrv, contextSrv) {
   module.controller('SelectOrgCtrl', function($scope, backendSrv, contextSrv) {

+ 0 - 1
public/app/features/playlist/playlist_routes.js

@@ -1,6 +1,5 @@
 define([
 define([
   'angular',
   'angular',
-  'app/core/config',
   'lodash'
   'lodash'
 ],
 ],
 function (angular) {
 function (angular) {

+ 2 - 0
public/app/features/plugins/datasource_srv.js

@@ -8,6 +8,8 @@ define([
 function (angular, _, coreModule, config, pluginLoader) {
 function (angular, _, coreModule, config, pluginLoader) {
   'use strict';
   'use strict';
 
 
+  config = config.default;
+
   coreModule.default.service('datasourceSrv', function($q, $injector, $rootScope, templateSrv) {
   coreModule.default.service('datasourceSrv', function($q, $injector, $rootScope, templateSrv) {
     var self = this;
     var self = this;
 
 

+ 8 - 8
public/app/plugins/panel/singlestat/editor.html

@@ -42,14 +42,14 @@
         <select class="input-small gf-form-input" ng-model="ctrl.panel.postfixFontSize" ng-options="f for f in ctrl.fontSizes" ng-change="ctrl.render()"></select>
         <select class="input-small gf-form-input" ng-model="ctrl.panel.postfixFontSize" ng-options="f for f in ctrl.fontSizes" ng-change="ctrl.render()"></select>
       </div>
       </div>
     </div>
     </div>
-		<div class="gf-form">
-			<label class="gf-form-label width-6">Unit</label>
-			<div class="gf-form-dropdown-typeahead width-18" ng-model="ctrl.panel.format" dropdown-typeahead2="ctrl.unitFormats" dropdown-typeahead-on-select="ctrl.setUnitFormat($subItem)"></div>
-		</div>
-		<div class="gf-form">
-			<label class="gf-form-label width-6">Decimals</label>
-			<input type="number" class="gf-form-input width-18" placeholder="auto" data-placement="right" bs-tooltip="'Override automatic decimal precision for legend and tooltips'" ng-model="ctrl.panel.decimals" ng-change="ctrl.refresh()" ng-model-onblur>
-		</div>
+    <div class="gf-form">
+      <label class="gf-form-label width-6">Unit</label>
+      <div class="gf-form-dropdown-typeahead width-18" ng-model="ctrl.panel.format" dropdown-typeahead2="ctrl.unitFormats" dropdown-typeahead-on-select="ctrl.setUnitFormat($subItem)"></div>
+    </div>
+    <div class="gf-form">
+      <label class="gf-form-label width-6">Decimals</label>
+      <input type="number" class="gf-form-input width-18" placeholder="auto" data-placement="right" bs-tooltip="'Override automatic decimal precision for legend and tooltips'" ng-model="ctrl.panel.decimals" ng-change="ctrl.refresh()" ng-model-onblur>
+    </div>
   </div>
   </div>
 
 
   <div class="section gf-form-group">
   <div class="section gf-form-group">

+ 1 - 1
public/app/plugins/panel/singlestat/module.ts

@@ -130,7 +130,7 @@ class SingleStatCtrl extends MetricsPanelCtrl {
 
 
   seriesHandler(seriesData) {
   seriesHandler(seriesData) {
     var series = new TimeSeries({
     var series = new TimeSeries({
-      datapoints: seriesData.datapoints,
+      datapoints: seriesData.datapoints || [],
       alias: seriesData.target,
       alias: seriesData.target,
     });
     });