mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
feat(invite): small progress
This commit is contained in:
@@ -44,10 +44,15 @@ function (angular) {
|
||||
};
|
||||
|
||||
$scope.openInviteModal = function() {
|
||||
var modalScope = $scope.$new();
|
||||
modalScope.invitesSent = function() {
|
||||
$scope.get();
|
||||
};
|
||||
|
||||
$scope.appEvent('show-modal', {
|
||||
src: './app/features/org/partials/invite.html',
|
||||
modalClass: 'modal-no-header invite-modal',
|
||||
scope: $scope.$new()
|
||||
scope: modalScope
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@@ -45,15 +45,15 @@
|
||||
<th>Email</th>
|
||||
<th>Name</th>
|
||||
<th>Role</th>
|
||||
<th>Created on</th>
|
||||
<th>Invited by</th>
|
||||
<th>Invited on</th>
|
||||
<th>By</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
<tr ng-repeat="invite in pendingInvites">
|
||||
<td>{{invite.email}}</td>
|
||||
<td>{{invite.name}}</td>
|
||||
<td>{{invite.role}}</td>
|
||||
<td>{{invite.createdOn | date:'medium'}}</td>
|
||||
<td>{{invite.createdOn | date:'shortDate'}}</td>
|
||||
<td>{{invite.invitedBy}}</td>
|
||||
<td style="width: 1%">
|
||||
<a ng-click="removeInvite(invite)" class="btn btn-danger btn-mini">
|
||||
|
||||
@@ -7,7 +7,7 @@ function (angular, _) {
|
||||
|
||||
var module = angular.module('grafana.controllers');
|
||||
|
||||
module.controller('UserInviteCtrl', function($scope, backendSrv) {
|
||||
module.controller('UserInviteCtrl', function($scope, backendSrv, $q) {
|
||||
|
||||
$scope.invites = [
|
||||
{name: '', email: '', role: 'Editor'},
|
||||
@@ -27,8 +27,12 @@ function (angular, _) {
|
||||
$scope.sendInvites = function() {
|
||||
if (!$scope.inviteForm.$valid) { return; }
|
||||
|
||||
_.each($scope.invites, function(invite) {
|
||||
backendSrv.post('/api/org/invites', invite);
|
||||
var promises = _.map($scope.invites, function(invite) {
|
||||
return backendSrv.post('/api/org/invites', invite);
|
||||
});
|
||||
|
||||
$q.all(promises).then(function() {
|
||||
$scope.invitesSent();
|
||||
});
|
||||
|
||||
$scope.dismiss();
|
||||
|
||||
Reference in New Issue
Block a user