diff --git a/awx/ui/client/src/templates/main.js b/awx/ui/client/src/templates/main.js index 477ff315a6..d118e1fc33 100644 --- a/awx/ui/client/src/templates/main.js +++ b/awx/ui/client/src/templates/main.js @@ -498,7 +498,7 @@ angular.module('templates', [surveyMaker.name, jobTemplates.name, labels.name, p }, views: { 'modal': { - template: `` + template: `` }, 'jobTemplateList@templates.editWorkflowJobTemplate.workflowMaker': { templateProvider: function(WorkflowMakerJobTemplateList, generateList) { diff --git a/awx/ui/client/src/templates/workflows/add-workflow/workflow-add.controller.js b/awx/ui/client/src/templates/workflows/add-workflow/workflow-add.controller.js index ce79c40bf7..0e5344a963 100644 --- a/awx/ui/client/src/templates/workflows/add-workflow/workflow-add.controller.js +++ b/awx/ui/client/src/templates/workflows/add-workflow/workflow-add.controller.js @@ -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; diff --git a/awx/ui/client/src/templates/workflows/edit-workflow/workflow-edit.controller.js b/awx/ui/client/src/templates/workflows/edit-workflow/workflow-edit.controller.js index 5f9d48534b..efc3a49720 100644 --- a/awx/ui/client/src/templates/workflows/edit-workflow/workflow-edit.controller.js +++ b/awx/ui/client/src/templates/workflows/edit-workflow/workflow-edit.controller.js @@ -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) { diff --git a/awx/ui/client/src/templates/workflows/workflow-maker/workflow-maker.directive.js b/awx/ui/client/src/templates/workflows/workflow-maker/workflow-maker.directive.js index ffb9b354b1..79bb9f9429 100644 --- a/awx/ui/client/src/templates/workflows/workflow-maker/workflow-maker.directive.js +++ b/awx/ui/client/src/templates/workflows/workflow-maker/workflow-maker.directive.js @@ -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');