mirror of
https://github.com/grafana/grafana.git
synced 2025-02-11 16:15:42 -06:00
40 lines
869 B
JavaScript
40 lines
869 B
JavaScript
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();
|
|
|
|
});
|
|
|
|
});
|