Survey textarea should have Form-textArea class. Fixed various extra vars bugs dealing with code mirror.

This commit is contained in:
Michael Abashian 2016-05-19 10:48:16 -04:00
parent c31f53517c
commit da7d77eb08
4 changed files with 23 additions and 11 deletions

View File

@ -32,7 +32,7 @@ export default
}
if(scope.ask_variables_on_launch){
extra_vars = ToJSON(scope.parseType, scope.variables, false);
extra_vars = ToJSON(scope.parseType, scope.jobLaunchVariables, false);
if(!Empty(extra_vars)){
$.each(extra_vars, function(key,value){
job_launch_data.extra_vars[key] = value;

View File

@ -173,7 +173,7 @@ export default
}
if($scope.ask_variables_on_launch) {
$scope.variables = (data.defaults && data.defaults.extra_vars) ? data.defaults.extra_vars : "---";
$scope.jobLaunchVariables = (data.defaults && data.defaults.extra_vars) ? data.defaults.extra_vars : "---";
$scope.other_prompt_data.parseType = 'yaml';
$scope.parseType = 'yaml';
}
@ -197,16 +197,16 @@ export default
var initiateModal = function() {
// Figure out which step the user needs to start on
if($scope.ask_inventory_on_launch) {
$scope.setStep("inventory");
$scope.setStep("inventory", true);
}
else if($scope.ask_credential_on_launch || $scope.password_needed) {
$scope.setStep("credential");
$scope.setStep("credential", true);
}
else if($scope.has_other_prompts) {
$scope.setStep("otherprompts");
$scope.setStep("otherprompts", true);
}
else if($scope.survey_enabled) {
$scope.setStep("survey");
$scope.setStep("survey", true);
}
$scope.openLaunchModal();
@ -251,7 +251,7 @@ export default
});
};
$scope.setStep = function(step) {
$scope.setStep = function(step, initialStep) {
$scope.step = step;
if(step === "credential") {
@ -259,9 +259,11 @@ export default
}
else if(step === "otherprompts") {
$scope.otherPromptsTabEnabled = true;
if($scope.ask_variables_on_launch && !$scope.extra_vars_code_mirror_loaded) {
if(!initialStep && $scope.step === 'otherprompts' && $scope.ask_variables_on_launch && !$scope.extra_vars_code_mirror_loaded) {
ParseTypeChange({
scope: $scope,
variable: 'jobLaunchVariables',
field_id: 'job_launch_variables'
});

View File

@ -6,8 +6,8 @@
import jobSubmissionController from './job-submission.controller';
export default [ 'templateUrl', 'CreateDialog', 'Wait', 'CreateSelect2',
function(templateUrl, CreateDialog, Wait, CreateSelect2) {
export default [ 'templateUrl', 'CreateDialog', 'Wait', 'CreateSelect2', 'ParseTypeChange',
function(templateUrl, CreateDialog, Wait, CreateSelect2, ParseTypeChange) {
return {
scope: {
submitJobId: '=',
@ -34,6 +34,16 @@ export default [ 'templateUrl', 'CreateDialog', 'Wait', 'CreateSelect2',
multiple: false
});
if(scope.step === 'otherprompts' && scope.ask_variables_on_launch) {
ParseTypeChange({
scope: scope,
variable: 'jobLaunchVariables',
field_id: 'job_launch_variables'
});
scope.extra_vars_code_mirror_loaded = true;
}
});
CreateDialog({

View File

@ -169,7 +169,7 @@
<div class="error survey_error" ng-show="forms.survey.survey_question_{{$index}}.$error.minlength || forms.survey.survey_question_{{$index}}.$error.maxlength">Please enter an answer between {{question.minlength}} to {{question.maxlength}} characters long.</div>
</div>
<div ng-if="question.type === 'textarea'">
<textarea id="survey_question_{{$index}}" name="survey_question_{{$index}}" ng-model="question.model" ng-minlength="question.minlength" ng-maxlength="question.maxlength" class="form-control final Form-textInput" ng-required="question.required" rows="3"></textarea>
<textarea id="survey_question_{{$index}}" name="survey_question_{{$index}}" ng-model="question.model" ng-minlength="question.minlength" ng-maxlength="question.maxlength" class="form-control final Form-textArea" ng-required="question.required" rows="3"></textarea>
<div class="error survey_error" ng-show="forms.survey.survey_question_{{$index}}.$dirty && forms.survey.survey_question_{{$index}}.$error.required">Please enter an answer.</div>
<div class="error survey_error" ng-show="forms.survey.survey_question_{{$index}}.$error.minlength || forms.survey.survey_question_{{$index}}.$error.maxlength">Please enter an answer between {{question.minlength}} to {{question.maxlength}} characters long.</div>
</div>