grafana/public/app/features/admin/adminListOrgsCtrl.js
2016-03-04 20:57:10 +01:00

41 lines
894 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: 'Delete',
text: 'Do you want to delete organization ' + org.name + '?',
text2: '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();
});
});