mirror of
https://github.com/grafana/grafana.git
synced 2025-02-11 16:15:42 -06:00
34 lines
681 B
JavaScript
34 lines
681 B
JavaScript
|
define([
|
||
|
'angular',
|
||
|
'config',
|
||
|
],
|
||
|
function (angular, config) {
|
||
|
'use strict';
|
||
|
|
||
|
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();
|
||
|
|
||
|
});
|
||
|
});
|