mirror of
https://github.com/ansible/awx.git
synced 2024-11-01 08:21:15 +03:00
Merge pull request #4041 from mabashian/wf-execute-unsaved
Fixes bug where save changes modal was shown to user with execute permissions Reviewed-by: Michael Abashian https://github.com/mabashian
This commit is contained in:
commit
612373c849
@ -498,7 +498,7 @@ angular.module('templates', [surveyMaker.name, jobTemplates.name, labels.name, p
|
||||
},
|
||||
views: {
|
||||
'modal': {
|
||||
template: `<workflow-maker ng-if="includeWorkflowMaker" workflow-job-template-obj="workflow_job_template_obj" can-add-workflow-job-template="canAddWorkflowJobTemplate"></workflow-maker>`
|
||||
template: `<workflow-maker ng-if="includeWorkflowMaker" workflow-job-template-obj="workflow_job_template_obj" can-add-or-edit="canAddOrEdit"></workflow-maker>`
|
||||
},
|
||||
'jobTemplateList@templates.editWorkflowJobTemplate.workflowMaker': {
|
||||
templateProvider: function(WorkflowMakerJobTemplateList, generateList) {
|
||||
|
@ -20,7 +20,7 @@ export default [
|
||||
|
||||
const workflowTemplate = resolvedModels[1];
|
||||
|
||||
$scope.canAddWorkflowJobTemplate = workflowTemplate.options('actions.POST');
|
||||
$scope.canAddOrEdit = workflowTemplate.options('actions.POST');
|
||||
|
||||
$scope.canEditOrg = true;
|
||||
$scope.canEditInventory = true;
|
||||
|
@ -26,12 +26,6 @@ export default [
|
||||
$scope.sufficientRoleForNotif = isNotificationAdmin || $scope.user_is_system_auditor;
|
||||
$scope.missingTemplates = _.has(workflowLaunch, 'node_templates_missing') && workflowLaunch.node_templates_missing.length > 0 ? true : false;
|
||||
|
||||
$scope.$watch('workflow_job_template_obj.summary_fields.user_capabilities.edit', function(val) {
|
||||
if (val === false) {
|
||||
$scope.canAddWorkflowJobTemplate = false;
|
||||
}
|
||||
});
|
||||
|
||||
const criteriaObj = {
|
||||
from: (state) => state.name === 'templates.editWorkflowJobTemplate.workflowMaker',
|
||||
to: (state) => state.name === 'templates.editWorkflowJobTemplate'
|
||||
@ -289,7 +283,7 @@ export default [
|
||||
|
||||
$scope.workflow_job_template_obj = workflowJobTemplateData;
|
||||
$scope.name = workflowJobTemplateData.name;
|
||||
$scope.can_edit = workflowJobTemplateData.summary_fields.user_capabilities.edit;
|
||||
$scope.can_edit = $scope.canAddOrEdit = workflowJobTemplateData.summary_fields.user_capabilities.edit;
|
||||
$scope.breadcrumb.workflow_job_template_name = $scope.name;
|
||||
let fld, i;
|
||||
for (fld in form.fields) {
|
||||
|
@ -11,7 +11,7 @@ export default ['templateUrl', 'CreateDialog', 'Wait', '$state', '$window',
|
||||
return {
|
||||
scope: {
|
||||
workflowJobTemplateObj: '=',
|
||||
canAddWorkflowJobTemplate: '='
|
||||
canAddOrEdit: '='
|
||||
},
|
||||
restrict: 'E',
|
||||
templateUrl: templateUrl('templates/workflows/workflow-maker/workflow-maker'),
|
||||
@ -63,7 +63,11 @@ export default ['templateUrl', 'CreateDialog', 'Wait', '$state', '$window',
|
||||
});
|
||||
|
||||
scope.closeDialog = function(exitWithUnsavedChanges) {
|
||||
if (exitWithUnsavedChanges || !(scope.workflowChangesUnsaved || scope.workflowChangesStarted)) {
|
||||
if (
|
||||
!scope.canAddOrEdit ||
|
||||
exitWithUnsavedChanges ||
|
||||
!(scope.workflowChangesUnsaved || scope.workflowChangesStarted)
|
||||
) {
|
||||
scope.unsavedChangesVisible = false;
|
||||
$('#workflow-modal-dialog').dialog('destroy');
|
||||
$('body').removeClass('WorkflowMaker-preventBodyScrolling');
|
||||
|
Loading…
Reference in New Issue
Block a user