mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
migration of org files from js to ts (#9974)
* migration of org files from js to ts * more migration of org files to ts * minor fix to change_password * renamed files
This commit is contained in:
committed by
Torkel Ödegaard
parent
b7956ef499
commit
b94839574c
46
public/app/features/org/user_invite_ctrl.ts
Normal file
46
public/app/features/org/user_invite_ctrl.ts
Normal file
@@ -0,0 +1,46 @@
|
||||
import angular from 'angular';
|
||||
import _ from 'lodash';
|
||||
|
||||
export class UserInviteCtrl {
|
||||
|
||||
/** @ngInject **/
|
||||
constructor($scope, backendSrv) {
|
||||
$scope.invites = [
|
||||
{name: '', email: '', role: 'Editor'},
|
||||
];
|
||||
|
||||
$scope.options = {skipEmails: false};
|
||||
$scope.init = function() { };
|
||||
|
||||
$scope.addInvite = function() {
|
||||
$scope.invites.push({name: '', email: '', role: 'Editor'});
|
||||
};
|
||||
|
||||
$scope.removeInvite = function(invite) {
|
||||
$scope.invites = _.without($scope.invites, invite);
|
||||
};
|
||||
|
||||
$scope.sendInvites = function() {
|
||||
if (!$scope.inviteForm.$valid) { return; }
|
||||
$scope.sendSingleInvite(0);
|
||||
};
|
||||
|
||||
$scope.sendSingleInvite = function(index) {
|
||||
var invite = $scope.invites[index];
|
||||
invite.skipEmails = $scope.options.skipEmails;
|
||||
|
||||
return backendSrv.post('/api/org/invites', invite).finally(function() {
|
||||
index += 1;
|
||||
|
||||
if (index === $scope.invites.length) {
|
||||
$scope.invitesSent();
|
||||
$scope.dismiss();
|
||||
} else {
|
||||
$scope.sendSingleInvite(index);
|
||||
}
|
||||
});
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
angular.module('grafana.controllers').controller('UserInviteCtrl', UserInviteCtrl);
|
||||
Reference in New Issue
Block a user