mirror of
https://github.com/ansible/awx.git
synced 2026-01-11 10:00:01 -03:30
Merge pull request #1783 from mabashian/1513-delete-last-survey-q
Delete the survey if the user removes all the survey questions
This commit is contained in:
commit
406d82b99c
@ -84,7 +84,7 @@
|
||||
<button id="survey-delete-button" class="btn btn-sm SurveyMaker-deleteButton" ng-show="survey_exists && (job_template_obj.summary_fields.user_capabilities.edit || workflow_job_template_obj.summary_fields.user_capabilities.edit || canAdd)" ng-click="showDeleteOverlay('survey')" translate>DELETE SURVEY</button>
|
||||
<button id="survey-close-button" class="btn btn-sm Form-buttonDefault" ng-click="closeSurvey('survey-modal-dialog')" ng-show="(job_template_obj.summary_fields.user_capabilities.edit || workflow_job_template_obj.summary_fields.user_capabilities.edit || canAdd)" translate>CANCEL</button>
|
||||
<button id="survey-close-button" class="btn btn-sm Form-buttonDefault" ng-click="closeSurvey('survey-modal-dialog')" ng-show="!(job_template_obj.summary_fields.user_capabilities.edit || workflow_job_template_obj.summary_fields.user_capabilities.edit || canAdd)" translate>CLOSE</button>
|
||||
<button id="survey-save-button" class="btn btn-sm Form-saveButton" ng-click="saveSurvey()" ng-disabled="survey_questions.length < 1 || !can_edit || editQuestionIndex !== null" ng-show="(job_template_obj.summary_fields.user_capabilities.edit || workflow_job_template_obj.summary_fields.user_capabilities.edit || canAdd)" translate>SAVE</button>
|
||||
<button id="survey-save-button" class="btn btn-sm Form-saveButton" ng-click="saveSurvey()" ng-disabled="(!isEditSurvey && survey_questions.length < 1) || !can_edit || editQuestionIndex !== null" ng-show="(job_template_obj.summary_fields.user_capabilities.edit || workflow_job_template_obj.summary_fields.user_capabilities.edit || canAdd)" translate>SAVE</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -7,6 +7,8 @@ export default
|
||||
// modal title. We want this toggle to be on by default
|
||||
scope.survey_enabled = true;
|
||||
|
||||
scope.isEditSurvey = false;
|
||||
|
||||
if (scope.removeDialogReady) {
|
||||
scope.removeDialogReady();
|
||||
}
|
||||
|
||||
@ -37,6 +37,7 @@ export default
|
||||
scope.survey_name = data.name;
|
||||
scope.survey_description = data.description;
|
||||
scope.survey_questions = data.spec;
|
||||
scope.isEditSurvey = true;
|
||||
Wait('stop');
|
||||
} else {
|
||||
AddSurvey({
|
||||
|
||||
@ -109,15 +109,18 @@ export default
|
||||
});
|
||||
};
|
||||
|
||||
updateSurveyQuestions()
|
||||
.then(function() {
|
||||
return updateSurveyEnabled();
|
||||
})
|
||||
.then(function() {
|
||||
scope.closeSurvey('survey-modal-dialog');
|
||||
scope.$emit('SurveySaved');
|
||||
});
|
||||
|
||||
if (!scope.survey_questions || scope.survey_questions.length === 0) {
|
||||
scope.deleteSurvey();
|
||||
} else {
|
||||
updateSurveyQuestions()
|
||||
.then(function() {
|
||||
return updateSurveyEnabled();
|
||||
})
|
||||
.then(function() {
|
||||
scope.closeSurvey('survey-modal-dialog');
|
||||
scope.$emit('SurveySaved');
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
// Gets called when the user clicks the on/off toggle beside the survey modal title.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user