AdminListOrgsCtrl.ts 844 B

1234567891011121314151617181920212223242526272829303132
  1. export default class AdminListOrgsCtrl {
  2. /** @ngInject */
  3. constructor($scope, backendSrv, navModelSrv) {
  4. $scope.init = () => {
  5. $scope.navModel = navModelSrv.getNav('admin', 'global-orgs', 0);
  6. $scope.getOrgs();
  7. };
  8. $scope.getOrgs = () => {
  9. backendSrv.get('/api/orgs').then(orgs => {
  10. $scope.orgs = orgs;
  11. });
  12. };
  13. $scope.deleteOrg = org => {
  14. $scope.appEvent('confirm-modal', {
  15. title: 'Delete',
  16. text: 'Do you want to delete organization ' + org.name + '?',
  17. text2: 'All dashboards for this organization will be removed!',
  18. icon: 'fa-trash',
  19. yesText: 'Delete',
  20. onConfirm: () => {
  21. backendSrv.delete('/api/orgs/' + org.id).then(() => {
  22. $scope.getOrgs();
  23. });
  24. },
  25. });
  26. };
  27. $scope.init();
  28. }
  29. }