2017-12-21 01:39:31 -06:00
|
|
|
import coreModule from 'app/core/core_module';
|
2017-12-20 14:20:12 -06:00
|
|
|
|
2018-11-23 06:41:45 -06:00
|
|
|
export class CreateTeamCtrl {
|
2017-12-20 14:20:12 -06:00
|
|
|
name: string;
|
|
|
|
email: string;
|
|
|
|
navModel: any;
|
|
|
|
|
2018-08-31 09:40:43 -05:00
|
|
|
/** @ngInject */
|
2017-12-20 14:20:12 -06:00
|
|
|
constructor(private backendSrv, private $location, navModelSrv) {
|
2017-12-21 01:39:31 -06:00
|
|
|
this.navModel = navModelSrv.getNav('cfg', 'teams', 0);
|
2017-12-20 14:20:12 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
create() {
|
|
|
|
const payload = {
|
|
|
|
name: this.name,
|
2017-12-21 01:39:31 -06:00
|
|
|
email: this.email,
|
2017-12-20 14:20:12 -06:00
|
|
|
};
|
2017-12-21 01:39:31 -06:00
|
|
|
this.backendSrv.post('/api/teams', payload).then(result => {
|
2017-12-20 14:20:12 -06:00
|
|
|
if (result.teamId) {
|
2017-12-21 01:39:31 -06:00
|
|
|
this.$location.path('/org/teams/edit/' + result.teamId);
|
2017-12-20 14:20:12 -06:00
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-12-21 01:39:31 -06:00
|
|
|
coreModule.controller('CreateTeamCtrl', CreateTeamCtrl);
|