adminListOrgsCtrl.js 869 B

123456789101112131415161718192021222324252627282930313233343536373839
  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: 'Do you want to delete organization ' + org.name + '?',
  19. text: 'All dashboards for this organization will be removed!',
  20. icon: 'fa-trash',
  21. yesText: 'Delete',
  22. onConfirm: function() {
  23. backendSrv.delete('/api/orgs/' + org.id).then(function() {
  24. $scope.getOrgs();
  25. });
  26. }
  27. });
  28. };
  29. $scope.init();
  30. });
  31. });