2017-06-18 00:16:33 +02:00
|
|
|
///<reference path="../../headers/common.d.ts" />
|
|
|
|
|
|
|
|
|
|
import coreModule from 'app/core/core_module';
|
|
|
|
|
import appEvents from 'app/core/app_events';
|
|
|
|
|
|
2017-12-08 18:25:45 +03:00
|
|
|
export class CreateTeamCtrl {
|
|
|
|
|
teamName = '';
|
2017-06-18 00:16:33 +02:00
|
|
|
|
|
|
|
|
/** @ngInject */
|
2017-09-22 08:42:07 +02:00
|
|
|
constructor(private backendSrv, private $location) {
|
2017-06-18 00:16:33 +02:00
|
|
|
}
|
|
|
|
|
|
2017-12-08 18:25:45 +03:00
|
|
|
createTeam() {
|
|
|
|
|
this.backendSrv.post('/api/teams', {name: this.teamName}).then((result) => {
|
|
|
|
|
if (result.teamId) {
|
|
|
|
|
this.$location.path('/org/teams/edit/' + result.teamId);
|
2017-06-18 00:16:33 +02:00
|
|
|
}
|
|
|
|
|
this.dismiss();
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
dismiss() {
|
|
|
|
|
appEvents.emit('hide-modal');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-12-08 18:25:45 +03:00
|
|
|
export function createTeamModal() {
|
2017-06-18 00:16:33 +02:00
|
|
|
return {
|
|
|
|
|
restrict: 'E',
|
2017-12-08 18:40:31 +03:00
|
|
|
templateUrl: 'public/app/features/org/partials/create_team.html',
|
2017-12-08 18:25:45 +03:00
|
|
|
controller: CreateTeamCtrl,
|
2017-06-18 00:16:33 +02:00
|
|
|
bindToController: true,
|
|
|
|
|
controllerAs: 'ctrl',
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
2017-12-08 18:25:45 +03:00
|
|
|
coreModule.directive('createTeamModal', createTeamModal);
|