diff --git a/awx/ui/client/src/shared/form-generator.js b/awx/ui/client/src/shared/form-generator.js index e2aa526257..63146ce890 100644 --- a/awx/ui/client/src/shared/form-generator.js +++ b/awx/ui/client/src/shared/form-generator.js @@ -1328,7 +1328,7 @@ angular.module('FormGenerator', [GeneratorHelpers.name, 'Utilities', listGenerat //lookup type fields if (field.type === 'lookup') { - let defaultLookupNgClick = `$state.go($state.current.name + '.${field.sourceModel}')`; + let defaultLookupNgClick = `$state.go($state.current.name + '.${field.sourceModel}', {selected: ${field.sourceModel}})`; html += label(); html += "
`; + innerTable += ` `; } else { // its assumed that options.input_type = checkbox innerTable += "
diff --git a/awx/ui/client/src/shared/stateDefinitions.factory.js b/awx/ui/client/src/shared/stateDefinitions.factory.js index 0c7117e5de..65cd07d475 100644 --- a/awx/ui/client/src/shared/stateDefinitions.factory.js +++ b/awx/ui/client/src/shared/stateDefinitions.factory.js @@ -628,7 +628,7 @@ export default ['$injector', '$stateExtender', '$log', function($injector, $stat searchPrefix: field.sourceModel, //squashSearchUrl: true, @issue enable name: `${formStateDefinition.name}.${field.sourceModel}`, - url: `/${field.sourceModel}`, + url: `/${field.sourceModel}?selected`, // a lookup field's basePath takes precedence over generic list definition's basePath, if supplied data: { basePath: field.basePath || null, @@ -639,6 +639,9 @@ export default ['$injector', '$stateExtender', '$log', function($injector, $stat value: { page_size: '5' } } }, + ncyBreadcrumb: { + skip: true + }, views: { 'modal': { templateProvider: function(ListDefinition, generateList) { diff --git a/awx/ui/client/src/templates/main.js b/awx/ui/client/src/templates/main.js index 03b380bd58..e925b2e9f6 100644 --- a/awx/ui/client/src/templates/main.js +++ b/awx/ui/client/src/templates/main.js @@ -133,9 +133,22 @@ angular.module('templates', [surveyMaker.name, templatesList.name, jobTemplatesA $scope.list = list; $scope[`${list.iterator}_dataset`] = Dataset.data; $scope[list.name] = $scope[`${list.iterator}_dataset`].results; + + $scope.$watch('job_templates', function(){ + if($scope.selectedTemplate){ + $scope.job_templates.forEach(function(row, i) { + if(row.id === $scope.selectedTemplate.id) { + $scope.job_templates[i].checked = 1; + } + else { + $scope.job_templates[i].checked = 0; + } + }); + } + }); } - $scope.toggle_job_template = function(id) { + $scope.toggle_row = function(id) { $scope.job_templates.forEach(function(row, i) { if (row.id === id) { @@ -153,7 +166,21 @@ angular.module('templates', [surveyMaker.name, templatesList.name, jobTemplatesA $scope.$on('templateSelected', function(e, options) { if(options.activeTab !== 'jobs') { - // Clear out any selected job + $scope.job_templates.forEach(function(row, i) { + $scope.job_templates[i].checked = 0; + }); + } + else { + if($scope.selectedTemplate){ + $scope.job_templates.forEach(function(row, i) { + if(row.id === $scope.selectedTemplate.id) { + $scope.job_templates[i].checked = 1; + } + else { + $scope.job_templates[i].checked = 0; + } + }); + } } }); } @@ -181,9 +208,21 @@ angular.module('templates', [surveyMaker.name, templatesList.name, jobTemplatesA $scope[`${list.iterator}_dataset`] = Dataset.data; $scope[list.name] = $scope[`${list.iterator}_dataset`].results; + $scope.$watch('workflow_inventory_sources', function(){ + if($scope.selectedTemplate){ + $scope.workflow_inventory_sources.forEach(function(row, i) { + if(row.id === $scope.selectedTemplate.id) { + $scope.workflow_inventory_sources[i].checked = 1; + } + else { + $scope.workflow_inventory_sources[i].checked = 0; + } + }); + } + }); } - $scope.toggle_inventory_source = function(id) { + $scope.toggle_row = function(id) { $scope.workflow_inventory_sources.forEach(function(row, i) { if (row.id === id) { @@ -200,8 +239,22 @@ angular.module('templates', [surveyMaker.name, templatesList.name, jobTemplatesA }; $scope.$on('templateSelected', function(e, options) { - if(options.activeTab !== 'project_sync') { - + if(options.activeTab !== 'inventory_sync') { + $scope.workflow_inventory_sources.forEach(function(row, i) { + $scope.workflow_inventory_sources[i].checked = 0; + }); + } + else { + if($scope.selectedTemplate){ + $scope.workflow_inventory_sources.forEach(function(row, i) { + if(row.id === $scope.selectedTemplate.id) { + $scope.workflow_inventory_sources[i].checked = 1; + } + else { + $scope.workflow_inventory_sources[i].checked = 0; + } + }); + } } }); } @@ -227,9 +280,21 @@ angular.module('templates', [surveyMaker.name, templatesList.name, jobTemplatesA $scope[`${list.iterator}_dataset`] = Dataset.data; $scope[list.name] = $scope[`${list.iterator}_dataset`].results; + $scope.$watch('projects', function(){ + if($scope.selectedTemplate){ + $scope.projects.forEach(function(row, i) { + if(row.id === $scope.selectedTemplate.id) { + $scope.projects[i].checked = 1; + } + else { + $scope.projects[i].checked = 0; + } + }); + } + }); } - $scope.toggle_project = function(id) { + $scope.toggle_row = function(id) { $scope.projects.forEach(function(row, i) { if (row.id === id) { @@ -246,8 +311,22 @@ angular.module('templates', [surveyMaker.name, templatesList.name, jobTemplatesA }; $scope.$on('templateSelected', function(e, options) { - if(options.activeTab !== 'inventory_sync') { - + if(options.activeTab !== 'project_sync') { + $scope.projects.forEach(function(row, i) { + $scope.projects[i].checked = 0; + }); + } + else { + if($scope.selectedTemplate){ + $scope.projects.forEach(function(row, i) { + if(row.id === $scope.selectedTemplate.id) { + $scope.projects[i].checked = 1; + } + else { + $scope.projects[i].checked = 0; + } + }); + } } }); } @@ -294,6 +373,7 @@ angular.module('templates', [surveyMaker.name, templatesList.name, jobTemplatesA }; $scope.$on('templateSelected', function(e, options) { + resetPromptFields(); // Loop across the preset values and attach them to scope _.forOwn(options.presetValues, function(value, key) { @@ -387,6 +467,9 @@ angular.module('templates', [surveyMaker.name, templatesList.name, jobTemplatesA dynamic: true } }, + ncyBreadcrumb: { + skip: true + }, views: { 'related': { templateProvider: function(ListDefinition, generateList) { @@ -439,6 +522,9 @@ angular.module('templates', [surveyMaker.name, templatesList.name, jobTemplatesA dynamic: true } }, + ncyBreadcrumb: { + skip: true + }, views: { 'related': { templateProvider: function(ListDefinition, generateList) { 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 1e4f923a37..77f22a87af 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 @@ -560,17 +560,33 @@ export default ['$scope', 'WorkflowService', 'generateList', 'TemplateList', 'Pr $scope.selectedTemplate = $scope.nodeBeingEdited.unifiedJobTemplate; - switch ($scope.nodeBeingEdited.unifiedJobTemplate.type) { - case "job_template": - $scope.workflowMakerFormConfig.activeTab = "jobs"; - break; - case "project": - $scope.workflowMakerFormConfig.activeTab = "project_sync"; - break; - case "inventory_source": - $scope.workflowMakerFormConfig.activeTab = "inventory_sync"; - break; + if($scope.selectedTemplate.unified_job_type) { + switch ($scope.selectedTemplate.unified_job_type) { + case "job": + $scope.workflowMakerFormConfig.activeTab = "jobs"; + break; + case "project_update": + $scope.workflowMakerFormConfig.activeTab = "project_sync"; + break; + case "inventory_update": + $scope.workflowMakerFormConfig.activeTab = "inventory_sync"; + break; + } } + else if($scope.selectedTemplate.type) { + switch ($scope.selectedTemplate.type) { + case "job_template": + $scope.workflowMakerFormConfig.activeTab = "jobs"; + break; + case "project": + $scope.workflowMakerFormConfig.activeTab = "project_sync"; + break; + case "inventory_source": + $scope.workflowMakerFormConfig.activeTab = "inventory_sync"; + break; + } + } + } let siblingConnectionTypes = WorkflowService.getSiblingConnectionTypes({