user_invite_ctrl.ts 651 B

12345678910111213141516171819202122232425262728293031
  1. import coreModule from 'app/core/core_module';
  2. export class UserInviteCtrl {
  3. navModel: any;
  4. invite: any;
  5. inviteForm: any;
  6. /** @ngInject */
  7. constructor(private backendSrv, navModelSrv, private $location) {
  8. this.navModel = navModelSrv.getNav('cfg', 'users', 0);
  9. this.invite = {
  10. name: '',
  11. email: '',
  12. role: 'Editor',
  13. sendEmail: true,
  14. };
  15. }
  16. sendInvite() {
  17. if (!this.inviteForm.$valid) {
  18. return;
  19. }
  20. return this.backendSrv.post('/api/org/invites', this.invite).then(() => {
  21. this.$location.path('org/users/');
  22. });
  23. }
  24. }
  25. coreModule.controller('UserInviteCtrl', UserInviteCtrl);