2017-11-23 17:04:50 +01:00
|
|
|
import angular from 'angular';
|
2015-02-23 18:29:01 +01:00
|
|
|
|
2017-11-23 17:04:50 +01:00
|
|
|
export class OrgDetailsCtrl {
|
2015-02-23 18:29:01 +01:00
|
|
|
|
2017-11-23 17:04:50 +01:00
|
|
|
/** @ngInject **/
|
|
|
|
|
constructor($scope, $http, backendSrv, contextSrv, navModelSrv) {
|
2015-02-23 18:29:01 +01:00
|
|
|
$scope.init = function() {
|
|
|
|
|
$scope.getOrgInfo();
|
2017-08-15 20:53:31 +02:00
|
|
|
$scope.navModel = navModelSrv.getNav('cfg', 'org');
|
2015-02-23 18:29:01 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
$scope.getOrgInfo = function() {
|
2015-02-25 08:07:52 +01:00
|
|
|
backendSrv.get('/api/org').then(function(org) {
|
|
|
|
|
$scope.org = org;
|
2015-09-08 14:22:44 +02:00
|
|
|
$scope.address = org.address;
|
2015-02-28 09:46:37 +01:00
|
|
|
contextSrv.user.orgName = org.name;
|
2015-02-23 18:29:01 +01:00
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
$scope.update = function() {
|
|
|
|
|
if (!$scope.orgForm.$valid) { return; }
|
2015-09-08 14:22:44 +02:00
|
|
|
var data = {name: $scope.org.name};
|
|
|
|
|
backendSrv.put('/api/org', data).then($scope.getOrgInfo);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
$scope.updateAddress = function() {
|
|
|
|
|
if (!$scope.addressForm.$valid) { return; }
|
|
|
|
|
backendSrv.put('/api/org/address', $scope.address).then($scope.getOrgInfo);
|
2015-02-23 18:29:01 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
$scope.init();
|
2017-11-23 17:04:50 +01:00
|
|
|
}
|
|
|
|
|
}
|
2015-02-23 18:29:01 +01:00
|
|
|
|
2017-11-23 17:04:50 +01:00
|
|
|
angular.module('grafana.controllers').controller('OrgDetailsCtrl', OrgDetailsCtrl);
|