mirror of
https://github.com/ansible/awx.git
synced 2026-02-26 23:46:05 -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:
@@ -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-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>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-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>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -7,6 +7,8 @@ export default
|
|||||||
// modal title. We want this toggle to be on by default
|
// modal title. We want this toggle to be on by default
|
||||||
scope.survey_enabled = true;
|
scope.survey_enabled = true;
|
||||||
|
|
||||||
|
scope.isEditSurvey = false;
|
||||||
|
|
||||||
if (scope.removeDialogReady) {
|
if (scope.removeDialogReady) {
|
||||||
scope.removeDialogReady();
|
scope.removeDialogReady();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ export default
|
|||||||
scope.survey_name = data.name;
|
scope.survey_name = data.name;
|
||||||
scope.survey_description = data.description;
|
scope.survey_description = data.description;
|
||||||
scope.survey_questions = data.spec;
|
scope.survey_questions = data.spec;
|
||||||
|
scope.isEditSurvey = true;
|
||||||
Wait('stop');
|
Wait('stop');
|
||||||
} else {
|
} else {
|
||||||
AddSurvey({
|
AddSurvey({
|
||||||
|
|||||||
@@ -109,15 +109,18 @@ export default
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
updateSurveyQuestions()
|
if (!scope.survey_questions || scope.survey_questions.length === 0) {
|
||||||
.then(function() {
|
scope.deleteSurvey();
|
||||||
return updateSurveyEnabled();
|
} else {
|
||||||
})
|
updateSurveyQuestions()
|
||||||
.then(function() {
|
.then(function() {
|
||||||
scope.closeSurvey('survey-modal-dialog');
|
return updateSurveyEnabled();
|
||||||
scope.$emit('SurveySaved');
|
})
|
||||||
});
|
.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.
|
// Gets called when the user clicks the on/off toggle beside the survey modal title.
|
||||||
|
|||||||
Reference in New Issue
Block a user