mirror of
https://github.com/grafana/grafana.git
synced 2025-02-13 00:55:47 -06:00
32 lines
713 B
TypeScript
32 lines
713 B
TypeScript
import angular from "angular";
|
|
import config from "app/core/config";
|
|
|
|
export class SelectOrgCtrl {
|
|
/** @ngInject **/
|
|
constructor($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();
|
|
}
|
|
}
|
|
|
|
angular
|
|
.module("grafana.controllers")
|
|
.controller("SelectOrgCtrl", SelectOrgCtrl);
|