adminListOrgsCtrl.js 894 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. define([
  2. 'angular',
  3. ],
  4. function (angular) {
  5. 'use strict';
  6. var module = angular.module('grafana.controllers');
  7. module.controller('AdminListOrgsCtrl', function($scope, backendSrv) {
  8. $scope.init = function() {
  9. $scope.getOrgs();
  10. };
  11. $scope.getOrgs = function() {
  12. backendSrv.get('/api/orgs').then(function(orgs) {
  13. $scope.orgs = orgs;
  14. });
  15. };
  16. $scope.deleteOrg = function(org) {
  17. $scope.appEvent('confirm-modal', {
  18. title: 'Delete',
  19. text: 'Do you want to delete organization ' + org.name + '?',
  20. text2: 'All dashboards for this organization will be removed!',
  21. icon: 'fa-trash',
  22. yesText: 'Delete',
  23. onConfirm: function() {
  24. backendSrv.delete('/api/orgs/' + org.id).then(function() {
  25. $scope.getOrgs();
  26. });
  27. }
  28. });
  29. };
  30. $scope.init();
  31. });
  32. });