| 1234567891011121314151617181920212223242526272829303132333435 |
- define([
- 'angular',
- 'app/core/config',
- ],
- function (angular, config) {
- 'use strict';
- config = config.default;
- 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();
- });
- });
|