newOrgCtrl.js 630 B

1234567891011121314151617181920212223242526
  1. define([
  2. 'angular',
  3. 'app/core/config',
  4. ],
  5. function (angular, config) {
  6. 'use strict';
  7. config = config.default;
  8. var module = angular.module('grafana.controllers');
  9. module.controller('NewOrgCtrl', function($scope, $http, backendSrv, navModelSrv) {
  10. $scope.navModel = navModelSrv.getOrgNav(0);
  11. $scope.newOrg = {name: ''};
  12. $scope.createOrg = function() {
  13. backendSrv.post('/api/orgs/', $scope.newOrg).then(function(result) {
  14. backendSrv.post('/api/user/using/' + result.orgId).then(function() {
  15. window.location.href = config.appSubUrl + '/org';
  16. });
  17. });
  18. };
  19. });
  20. });