From 9917841585d9b22b946903961b5dade9961c996a Mon Sep 17 00:00:00 2001 From: Jake McDermott Date: Sun, 11 Nov 2018 20:24:08 -0500 Subject: [PATCH] open and close workflow visualizer from list --- awx/ui/client/features/templates/templates.strings.js | 1 + .../client/features/templates/templatesList.controller.js | 8 ++++++++ awx/ui/client/features/templates/templatesList.view.html | 5 +++++ awx/ui/client/src/templates/workflows.form.js | 8 -------- .../workflows/edit-workflow/workflow-edit.controller.js | 5 ----- .../workflows/workflow-maker/workflow-maker.controller.js | 7 +++++-- 6 files changed, 19 insertions(+), 15 deletions(-) diff --git a/awx/ui/client/features/templates/templates.strings.js b/awx/ui/client/features/templates/templates.strings.js index c22d1805f7..d33fcf1b81 100644 --- a/awx/ui/client/features/templates/templates.strings.js +++ b/awx/ui/client/features/templates/templates.strings.js @@ -12,6 +12,7 @@ function TemplatesStrings (BaseString) { PANEL_TITLE: t.s('TEMPLATES'), ADD_DD_JT_LABEL: t.s('Job Template'), ADD_DD_WF_LABEL: t.s('Workflow Template'), + OPEN_WORKFLOW_VISUALIZER: t.s('Click here to open the workflow visualizer'), ROW_ITEM_LABEL_ACTIVITY: t.s('Activity'), ROW_ITEM_LABEL_INVENTORY: t.s('Inventory'), ROW_ITEM_LABEL_PROJECT: t.s('Project'), diff --git a/awx/ui/client/features/templates/templatesList.controller.js b/awx/ui/client/features/templates/templatesList.controller.js index 26b477b23d..4efd534ad4 100644 --- a/awx/ui/client/features/templates/templatesList.controller.js +++ b/awx/ui/client/features/templates/templatesList.controller.js @@ -101,6 +101,14 @@ function ListTemplatesController( vm.isPortalMode = $state.includes('portalMode'); + vm.openWorkflowVisualizer = template => { + const name = 'templates.editWorkflowJobTemplate.workflowMaker'; + const params = { workflow_job_template_id: template.id }; + const options = { reload: false }; + + $state.go(name, params, options); + }; + vm.deleteTemplate = template => { if (!template) { Alert(strings.get('error.DELETE'), strings.get('alert.MISSING_PARAMETER')); diff --git a/awx/ui/client/features/templates/templatesList.view.html b/awx/ui/client/features/templates/templatesList.view.html index 255efcc3cc..e3b9317f28 100644 --- a/awx/ui/client/features/templates/templatesList.view.html +++ b/awx/ui/client/features/templates/templatesList.view.html @@ -93,6 +93,11 @@ ng-show="!vm.isPortalMode && template.summary_fields.user_capabilities.copy" tooltip="{{:: vm.strings.get('listActions.COPY', vm.getType(template)) }}"> + + diff --git a/awx/ui/client/src/templates/workflows.form.js b/awx/ui/client/src/templates/workflows.form.js index fe3f8c24e7..c1b10b4cab 100644 --- a/awx/ui/client/src/templates/workflows.form.js +++ b/awx/ui/client/src/templates/workflows.form.js @@ -237,14 +237,6 @@ export default ['NotificationsList', 'i18n', function(NotificationsList, i18n) { class: 'Form-primaryButton', awToolTip: '{{surveyTooltip}}', dataPlacement: 'top' - }, - workflow_visualizer: { - ngClick: 'openWorkflowMaker()', - ngShow: '$state.is(\'templates.addWorkflowJobTemplate\') || $state.is(\'templates.editWorkflowJobTemplate\') || $state.is(\'templates.editWorkflowJobTemplate.workflowMaker\')', - awToolTip: '{{workflowVisualizerTooltip}}', - dataPlacement: 'top', - label: i18n._('Workflow Visualizer'), - class: 'Form-primaryButton' } } }; 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 fc695c8482..0b78eba354 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 @@ -60,10 +60,6 @@ export default [ $scope.inventory_name = Inventory.name; } - $scope.openWorkflowMaker = function() { - $state.go('.workflowMaker'); - }; - $scope.formSave = function () { let fld, data = {}; $scope.invalid_survey = false; @@ -266,7 +262,6 @@ export default [ opts: opts }); - $scope.workflowVisualizerTooltip = i18n._("Click here to open the workflow visualizer."); $scope.surveyTooltip = i18n._('Surveys allow users to be prompted at job launch with a series of questions related to the job. This allows for variables to be defined that affect the playbook run at time of launch.'); $scope.workflow_job_template_obj = workflowJobTemplateData; diff --git a/awx/ui/client/src/templates/workflows/workflow-maker/workflow-maker.controller.js b/awx/ui/client/src/templates/workflows/workflow-maker/workflow-maker.controller.js index f2b68a3e8e..5643b4c86c 100644 --- a/awx/ui/client/src/templates/workflows/workflow-maker/workflow-maker.controller.js +++ b/awx/ui/client/src/templates/workflows/workflow-maker/workflow-maker.controller.js @@ -6,10 +6,10 @@ export default ['$scope', 'WorkflowService', 'TemplatesService', 'ProcessErrors', 'CreateSelect2', '$q', 'JobTemplateModel', 'WorkflowJobTemplateModel', - 'Empty', 'PromptService', 'Rest', 'TemplatesStrings', '$timeout', + 'Empty', 'PromptService', 'Rest', 'TemplatesStrings', '$timeout', '$state', function ($scope, WorkflowService, TemplatesService, ProcessErrors, CreateSelect2, $q, JobTemplate, WorkflowJobTemplate, - Empty, PromptService, Rest, TemplatesStrings, $timeout) { + Empty, PromptService, Rest, TemplatesStrings, $timeout, $state) { let promptWatcher, surveyQuestionWatcher, credentialsWatcher; @@ -360,6 +360,7 @@ export default ['$scope', 'WorkflowService', 'TemplatesService', // Revert the data to the master which was created when the dialog was opened $scope.treeData.data = angular.copy($scope.treeDataMaster); $scope.closeDialog(); + $state.transitionTo('templates'); }; $scope.saveWorkflowMaker = function () { @@ -409,6 +410,7 @@ export default ['$scope', 'WorkflowService', 'TemplatesService', return $q.all(associatePromises.concat(credentialPromises)) .then(function () { $scope.closeDialog(); + $state.transitionTo('templates'); }); }).catch(({ data, @@ -432,6 +434,7 @@ export default ['$scope', 'WorkflowService', 'TemplatesService', $q.all(deletePromises) .then(function () { $scope.closeDialog(); + $state.transitionTo('templates'); }); } };