Launch job from job template form

added a check that there is a valid survey if survey_enabled === true on the JT form
This commit is contained in:
Jared Tabor 2014-12-02 10:06:57 -05:00
parent e14630b155
commit c96b317202

View File

@ -993,10 +993,33 @@ function JobTemplatesEdit($scope, $rootScope, $compile, $location, $log, $routeP
// Launch a job using the selected template
$scope.launch = function() {
PlaybookRun({
scope: $scope,
id: id
if ($scope.removePromptForSurvey) {
$scope.removePromptForSurvey();
}
$scope.removePromptForSurvey = $scope.$on('PromptForSurvey', function() {
var action = function () {
// $scope.$emit("GatherFormFields");
Wait('start');
$('#prompt-modal').modal('hide');
$scope.addSurvey();
};
Prompt({
hdr: 'Incomplete Survey',
body: 'Do you want to create a survey before proceeding?',
action: action
});
});
if($scope.survey_enabled === true && $scope.survey_exists!==true){
$scope.$emit("PromptForSurvey");
}
else
PlaybookRun({
scope: $scope,
id: id
});
};
// handler for 'Enable Survey' button