adminListOrgsCtrl.js 798 B

1234567891011121314151617181920212223242526272829303132333435363738
  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. icon: 'fa-trash',
  20. yesText: 'Delete',
  21. onConfirm: function() {
  22. backendSrv.delete('/api/orgs/' + org.id).then(function() {
  23. $scope.getOrgs();
  24. });
  25. }
  26. });
  27. };
  28. $scope.init();
  29. });
  30. });