grafana/public/app/features/org/user_invite_ctrl.ts

32 lines
652 B
TypeScript
Raw Normal View History

import coreModule from 'app/core/core_module';
export class UserInviteCtrl {
2017-12-13 06:16:44 -06:00
navModel: any;
invite: any;
inviteForm: any;
/** @ngInject **/
2017-12-13 06:16:44 -06:00
constructor(private backendSrv, navModelSrv, private $location) {
this.navModel = navModelSrv.getNav('cfg', 'users', 0);
this.invite = {
name: '',
email: '',
role: 'Editor',
sendEmail: true,
};
2017-12-13 06:16:44 -06:00
}
2017-12-13 06:16:44 -06:00
sendInvite() {
if (!this.inviteForm.$valid) {
return;
}
2017-12-13 06:16:44 -06:00
return this.backendSrv.post('/api/org/invites', this.invite).then(() => {
this.$location.path('org/users/');
});
}
}
coreModule.controller('UserInviteCtrl', UserInviteCtrl);