grafana/public/app/features/admin/adminListUsersCtrl.js

38 lines
804 B
JavaScript
Raw Normal View History

define([
'angular',
],
function (angular) {
'use strict';
var module = angular.module('grafana.controllers');
module.controller('AdminListUsersCtrl', function($scope, backendSrv) {
$scope.init = function() {
$scope.getUsers();
};
$scope.getUsers = function() {
backendSrv.get('/api/users').then(function(users) {
$scope.users = users;
});
};
2015-02-05 08:53:15 -06:00
$scope.deleteUser = function(user) {
$scope.appEvent('confirm-modal', {
title: 'Do you want to delete ' + user.login + '?',
2015-03-05 14:02:25 -06:00
icon: 'fa-trash',
yesText: 'Delete',
2015-02-05 08:53:15 -06:00
onConfirm: function() {
backendSrv.delete('/api/admin/users/' + user.id).then(function() {
$scope.getUsers();
});
2015-02-05 08:53:15 -06:00
}
});
};
$scope.init();
});
});