orgDetailsCtrl.js 639 B

123456789101112131415161718192021222324252627282930
  1. define([
  2. 'angular',
  3. ],
  4. function (angular) {
  5. 'use strict';
  6. var module = angular.module('grafana.controllers');
  7. module.controller('OrgDetailsCtrl', function($scope, $http, backendSrv, contextSrv) {
  8. $scope.init = function() {
  9. $scope.getOrgInfo();
  10. };
  11. $scope.getOrgInfo = function() {
  12. backendSrv.get('/api/org').then(function(org) {
  13. $scope.org = org;
  14. contextSrv.user.orgName = org.name;
  15. });
  16. };
  17. $scope.update = function() {
  18. if (!$scope.orgForm.$valid) { return; }
  19. backendSrv.put('/api/org', $scope.org).then($scope.getOrgInfo);
  20. };
  21. $scope.init();
  22. });
  23. });