newOrgCtrl.js 541 B

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