mirror of
https://github.com/ansible/awx.git
synced 2026-03-26 05:15:02 -02:30
adding add/edit survey
This commit is contained in:
@@ -240,19 +240,51 @@ angular.module('JobTemplateFormDefinition', ['SchedulesListDefinition', 'Complet
|
||||
dataTitle: 'Prompt for Extra Variables',
|
||||
dataContainer: "body"
|
||||
},
|
||||
enable_survey: {
|
||||
// survey_enabled: {
|
||||
// type: 'custom',
|
||||
// column: 2,
|
||||
// control: '<div class="form-group">'+
|
||||
// '<div class="checkbox">'+
|
||||
// '<label><input type="checkbox" ng-model="survey_enabled" name="survey_enabled" id="job_templates_survey_enabled_chbox" class="ng-valid ng-valid-api-error ng-dirty" ng-true-value="true" ng-false-value="false">'+
|
||||
// '<span class="label-text">Enable Survey</span><a id="awp-survey_enabled" href="" aw-pop-over="<p>If checked, user will be prompted at job launch with a survey of questions related to the job.</p>'+
|
||||
// '<div class="popover-footer"><span class="key">esc</span> or click to close</div>" data-placement="right" data-container="body" data-title="Enable Survey" class="help-link" data-original-title="" title="" tabindex="-1">'+
|
||||
// '<i class="fa fa-question-circle"></i></a> </label>'+
|
||||
// '<div class="error api-error ng-binding" id="job_templates-survey_enabled-api-error" ng-bind="survey_enabled_api_error"></div>'+
|
||||
// '<button type="button" class="btn btn-sm btn-default" id="job_templates_edit_survey_btn" ng-click="navigateToSurvey()"><i class="fa fa-pencil"></i> Create Survey</button>'+
|
||||
// '</div>'+
|
||||
// '</div>'
|
||||
// },
|
||||
survey_enabled: {
|
||||
label: 'Enable Survey',
|
||||
type: 'checkbox',
|
||||
addRequired: false,
|
||||
editRequird: false,
|
||||
trueValue: 'true',
|
||||
falseValue: 'false',
|
||||
column: 2,
|
||||
awPopOver: "<p>If checked, user will be prompted at job launch with a series of questions related to the job.</p>",
|
||||
dataPlacement: 'right',
|
||||
dataTitle: 'Enable Survey',
|
||||
dataContainer: "body"
|
||||
},
|
||||
create_survey: {
|
||||
type: 'custom',
|
||||
column: 2,
|
||||
control: '<div class="form-group">'+
|
||||
'<div class="checkbox">'+
|
||||
'<label><input type="checkbox" ng-model="enable_survey" name="enable_survey" id="job_templates_enable_survey_chbox" class="ng-valid ng-valid-api-error ng-dirty" ng-true-value="true" ng-false-value="false">'+
|
||||
'<span class="label-text">Enable Survey</span><a id="awp-enable_survey" href="" aw-pop-over="<p>If checked, user will be prompted at job launch with a survey of questions related to the job.</p>'+
|
||||
'<div class="popover-footer"><span class="key">esc</span> or click to close</div>" data-placement="right" data-container="body" data-title="Enable Survey" class="help-link" data-original-title="" title="" tabindex="-1">'+
|
||||
'<i class="fa fa-question-circle"></i></a> </label>'+
|
||||
'<div class="error api-error ng-binding" id="job_templates-enable_survey-api-error" ng-bind="enable_survey_api_error"></div>'+
|
||||
'<button type="button" class="btn btn-sm btn-default" id="job_templates_edit_survey_btn" ng-click="navigateToSurvey()"><i class="fa fa-pencil"></i> Edit Survey</button>'+
|
||||
'</div>'+
|
||||
'</div>'
|
||||
control: '<button type="button" class="btn btn-sm btn-primary" id="job_templates_create_survey_btn" ng-show="survey_enabled" ng-click="addSurvey()"><i class="fa fa-pencil"></i> Create Survey</button>'+
|
||||
'<button style="display:none;" type="button" class="btn btn-sm btn-primary" id="job_templates_edit_survey_btn" ng-show="survey_enabled" ng-click="editSurvey()"><i class="fa fa-pencil"></i> Edit Survey</button>'+
|
||||
'<button style="display:none;margin-left:5px" type="button" class="btn btn-sm btn-primary" id="job_templates_delete_survey_btn" ng-show="survey_enabled" ng-click="deleteSurvey()"><i class="fa fa-trash-o"></i> Delete Survey</button>'
|
||||
// label: 'Create Survey',
|
||||
// type: 'text',
|
||||
// addRequired: false,
|
||||
// editRequired: false,
|
||||
// // readonly: true,
|
||||
// // ngShow: "survey_enabled",
|
||||
// column: 2,
|
||||
// awPopOver: "survey_help",
|
||||
// awPopOverWatch: "survey_help",
|
||||
// dataPlacement: 'right',
|
||||
// dataTitle: 'Provisioning Callback URL',
|
||||
// dataContainer: "body"
|
||||
},
|
||||
allow_callbacks: {
|
||||
label: 'Allow Provisioning Callbacks',
|
||||
|
||||
@@ -18,32 +18,33 @@ angular.module('SurveyMakerFormDefinition', [])
|
||||
editTitle: 'Edit Survey', //Title in edit mode
|
||||
name: 'survey_maker', //entity or model name in singular form
|
||||
well: true,
|
||||
collapse: true,
|
||||
collapseTitle: "Properties",
|
||||
collapseMode: 'edit',
|
||||
collapseOpen: true,
|
||||
//breadCrumbs:true,
|
||||
// collapse: true,
|
||||
// collapseTitle: "Properties",
|
||||
// collapseMode: 'edit',
|
||||
// collapseOpen: true,
|
||||
|
||||
actions: {
|
||||
stream: {
|
||||
'class': "btn-primary btn-xs activity-btn",
|
||||
ngClick: "showActivity()",
|
||||
awToolTip: "View Activity Stream",
|
||||
dataPlacement: "top",
|
||||
icon: "icon-comments-alt",
|
||||
mode: 'edit',
|
||||
iconSize: 'large'
|
||||
}
|
||||
},
|
||||
// actions: {
|
||||
// stream: {
|
||||
// 'class': "btn-primary btn-xs activity-btn",
|
||||
// ngClick: "showActivity()",
|
||||
// awToolTip: "View Activity Stream",
|
||||
// dataPlacement: "top",
|
||||
// icon: "icon-comments-alt",
|
||||
// mode: 'edit',
|
||||
// iconSize: 'large'
|
||||
// }
|
||||
// },
|
||||
|
||||
fields: {
|
||||
name: {
|
||||
survey_name: {
|
||||
label: 'Survey Name',
|
||||
type: 'text',
|
||||
addRequired: true,
|
||||
editRequired: true,
|
||||
capitalize: false
|
||||
},
|
||||
description: {
|
||||
survey_description: {
|
||||
label: 'Survey Description',
|
||||
type: 'text',
|
||||
addRequired: false,
|
||||
|
||||
@@ -15,7 +15,7 @@ angular.module('SurveyQuestionFormDefinition', [])
|
||||
.value('SurveyQuestionForm', {
|
||||
|
||||
addTitle: 'Add Question',
|
||||
editTitle: '{{ inventory_name }}',
|
||||
editTitle: '{{ survey_name }}',
|
||||
name: 'question_unique',
|
||||
well: true,
|
||||
twoColumns: true,
|
||||
@@ -33,13 +33,13 @@ angular.module('SurveyQuestionFormDefinition', [])
|
||||
// },
|
||||
|
||||
fields: {
|
||||
question_text: {
|
||||
question_name: {
|
||||
realName: 'question_text',
|
||||
label: 'Question Text',
|
||||
type: 'text',
|
||||
addRequired: true,
|
||||
editRequired: true,
|
||||
capitalize: true,
|
||||
capitalize: false,
|
||||
column: 1
|
||||
},
|
||||
question_description: {
|
||||
@@ -51,7 +51,7 @@ angular.module('SurveyQuestionFormDefinition', [])
|
||||
editRequired: false,
|
||||
column: 2
|
||||
},
|
||||
response_variable_name: {
|
||||
variable: {
|
||||
label: 'Answer Variable Name',
|
||||
type: 'text',
|
||||
addRequired: true,
|
||||
@@ -65,7 +65,7 @@ angular.module('SurveyQuestionFormDefinition', [])
|
||||
// init: "true"
|
||||
// }
|
||||
},
|
||||
answer_type: {
|
||||
type: {
|
||||
realName: 'answer_type',
|
||||
label: 'Answer Type',
|
||||
type: 'select',
|
||||
@@ -75,23 +75,23 @@ angular.module('SurveyQuestionFormDefinition', [])
|
||||
column: 1
|
||||
|
||||
},
|
||||
answer_options_text: {
|
||||
realName: 'answer_options',
|
||||
label: 'Answer Options',
|
||||
type: 'text',
|
||||
addRequired: true,
|
||||
editRequired: true,
|
||||
ngHide: 'answer_type.type!=="text" ',
|
||||
column: 1
|
||||
},
|
||||
answer_options_multiple_choice: {
|
||||
// answer_options_text: {
|
||||
// realName: 'answer_options',
|
||||
// label: 'Answer Options',
|
||||
// type: 'text',
|
||||
// addRequired: true,
|
||||
// editRequired: true,
|
||||
// ngHide: 'answer_type.type!=="text" ',
|
||||
// column: 1
|
||||
// },
|
||||
choices: {
|
||||
realName: 'answer_options',
|
||||
label: 'Multiple Choice Options',
|
||||
type: 'textarea',
|
||||
rows: 3,
|
||||
addRequired: true,
|
||||
editRequired: true,
|
||||
ngShow: 'answer_type.type==="mc" ',
|
||||
ngShow: 'type.type==="multipleselect" || type.type==="multiplechoice" ',
|
||||
awPopOver: '<p>Type an option on each line.</p>'+
|
||||
'<p>For example the following input:<br><br>Apple<br>\n Banana<br>\n Cherry<br><br>would be displayed as:</p>\n'+
|
||||
'<ol><li>Apple</li><li>Banana</li><li>Cherry</li><ol>',
|
||||
@@ -107,26 +107,26 @@ angular.module('SurveyQuestionFormDefinition', [])
|
||||
control: '<div class="row">'+
|
||||
'<div class="col-xs-6"><label for="minimum"><span class="label-text">Minimum</span></label><input id="answer_min" type="number" class="form-control"></div>'+
|
||||
'<div class="col-xs-6"><label for="minimum"><span class="label-text">Maximum</span></label><input id="answer_max" type="number" class="form-control"></div></div>',
|
||||
ngShow: 'answer_type.type==="number" ',
|
||||
ngShow: 'type.type==="integer" || type.type==="float" ',
|
||||
addRequired: true,
|
||||
editRequired: true,
|
||||
column: 1
|
||||
},
|
||||
answer_options_json: {
|
||||
realName: 'answer_options',
|
||||
label: 'Answer Options',
|
||||
type: 'textarea',
|
||||
rows: 3,
|
||||
ngShow: 'answer_type.type==="json" ',
|
||||
addRequired: true,
|
||||
editRequired: true,
|
||||
awPopOver: '<p>Insert some good JSON!</p>',
|
||||
dataTitle: 'Answer Options',
|
||||
dataPlacement: 'right',
|
||||
dataContainer: "body",
|
||||
column: 1
|
||||
},
|
||||
default_answer: {
|
||||
// answer_options_json: {
|
||||
// realName: 'answer_options',
|
||||
// label: 'Answer Options',
|
||||
// type: 'textarea',
|
||||
// rows: 3,
|
||||
// ngShow: 'type.type==="json" ',
|
||||
// addRequired: true,
|
||||
// editRequired: true,
|
||||
// awPopOver: '<p>Insert some good JSON!</p>',
|
||||
// dataTitle: 'Answer Options',
|
||||
// dataPlacement: 'right',
|
||||
// dataContainer: "body",
|
||||
// column: 1
|
||||
// },
|
||||
default: {
|
||||
realName: 'default_answer',
|
||||
label: 'Default Answer',
|
||||
type: 'text',
|
||||
@@ -134,12 +134,19 @@ angular.module('SurveyQuestionFormDefinition', [])
|
||||
editRequired: false,
|
||||
column: 1
|
||||
},
|
||||
is_required: {
|
||||
label: 'Answer required or optional',
|
||||
type: 'custom',
|
||||
column: 2,
|
||||
control: '<div><label for="required"><span class="label-text">Required</span></label><input id="answer_required" type="radio" checked=true></div>'+
|
||||
'<div><label for="optional"><span class="label-text">Optional</span></label><input id="answer_optional" type="radio"></div>',
|
||||
required: {
|
||||
realName: 'default_answer',
|
||||
label: 'Required',
|
||||
type: 'checkbox',
|
||||
// checked: true,
|
||||
addRequired: false,
|
||||
editRequired: false,
|
||||
column: 2
|
||||
// label: 'Answer required or optional',
|
||||
// type: 'custom',
|
||||
// column: 2,
|
||||
// control: '<div><label for="required"><span class="label-text">Required</span></label><input id="answer_required" type="radio" checked=true></div>'+
|
||||
// '<div><label for="optional"><span class="label-text">Optional</span></label><input id="answer_optional" type="radio"></div>',
|
||||
|
||||
}
|
||||
// answer_options: {
|
||||
|
||||
Reference in New Issue
Block a user