define([ 'angular', ], function (angular) { 'use strict'; var module = angular.module('grafana.controllers'); module.controller('AdminListOrgsCtrl', function($scope, backendSrv) { $scope.init = function() { $scope.getOrgs(); }; $scope.getOrgs = function() { backendSrv.get('/api/orgs').then(function(orgs) { $scope.orgs = orgs; }); }; $scope.deleteOrg = function(org) { $scope.appEvent('confirm-modal', { title: 'Do you want to delete organization ' + org.name + '?', text: 'All dashboards for this organization will be removed!', icon: 'fa-trash', yesText: 'Delete', onConfirm: function() { backendSrv.delete('/api/orgs/' + org.id).then(function() { $scope.getOrgs(); }); } }); }; $scope.init(); }); });