2015-08-31 09:37:14 +02:00
|
|
|
define([
|
|
|
|
|
'angular',
|
2015-10-30 14:19:02 +01:00
|
|
|
'app/core/config',
|
2015-08-31 09:37:14 +02:00
|
|
|
],
|
|
|
|
|
function (angular, config) {
|
|
|
|
|
'use strict';
|
|
|
|
|
|
2017-10-24 10:45:46 +02:00
|
|
|
config = config.default;
|
|
|
|
|
|
2015-08-31 09:37:14 +02:00
|
|
|
var module = angular.module('grafana.controllers');
|
|
|
|
|
|
|
|
|
|
module.controller('SelectOrgCtrl', function($scope, backendSrv, contextSrv) {
|
|
|
|
|
|
|
|
|
|
contextSrv.sidemenu = false;
|
|
|
|
|
|
|
|
|
|
$scope.init = function() {
|
|
|
|
|
$scope.getUserOrgs();
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
$scope.getUserOrgs = function() {
|
|
|
|
|
backendSrv.get('/api/user/orgs').then(function(orgs) {
|
|
|
|
|
$scope.orgs = orgs;
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
$scope.setUsingOrg = function(org) {
|
|
|
|
|
backendSrv.post('/api/user/using/' + org.orgId).then(function() {
|
|
|
|
|
window.location.href = config.appSubUrl + '/';
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
$scope.init();
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
});
|