Commit 3f917b0a by Torkel Ödegaard

Updated org creation view, after creating new org user is switched to that org…

Updated org creation view, after creating new org user is switched to that org and redirect to org details view, Closes #2198
parent d3c6db1b
...@@ -6,6 +6,7 @@ import ( ...@@ -6,6 +6,7 @@ import (
"github.com/grafana/grafana/pkg/middleware" "github.com/grafana/grafana/pkg/middleware"
m "github.com/grafana/grafana/pkg/models" m "github.com/grafana/grafana/pkg/models"
"github.com/grafana/grafana/pkg/setting" "github.com/grafana/grafana/pkg/setting"
"github.com/grafana/grafana/pkg/util"
) )
// GET /api/org // GET /api/org
...@@ -50,7 +51,10 @@ func CreateOrg(c *middleware.Context, cmd m.CreateOrgCommand) Response { ...@@ -50,7 +51,10 @@ func CreateOrg(c *middleware.Context, cmd m.CreateOrgCommand) Response {
metrics.M_Api_Org_Create.Inc(1) metrics.M_Api_Org_Create.Inc(1)
return ApiSuccess("Organization created") return Json(200, &util.DynMap{
"orgId": cmd.Result.Id,
"message": "Organization created",
})
} }
// PUT /api/org // PUT /api/org
......
define([ define([
'angular', 'angular',
'config',
], ],
function (angular) { function (angular, config) {
'use strict'; 'use strict';
var module = angular.module('grafana.controllers'); var module = angular.module('grafana.controllers');
...@@ -11,7 +12,11 @@ function (angular) { ...@@ -11,7 +12,11 @@ function (angular) {
$scope.newOrg = {name: ''}; $scope.newOrg = {name: ''};
$scope.createOrg = function() { $scope.createOrg = function() {
backendSrv.post('/api/orgs/', $scope.newOrg).then($scope.getUserOrgs); backendSrv.post('/api/orgs/', $scope.newOrg).then(function(result) {
backendSrv.post('/api/user/using/' + result.orgId).then(function() {
window.location.href = config.appSubUrl + '/org';
});
});
}; };
}); });
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment