From 38ce6c7226a8ded4dd70a4b0f6017e849bf6c4fc Mon Sep 17 00:00:00 2001 From: Jared Tabor Date: Fri, 2 Jun 2017 10:38:53 -0700 Subject: [PATCH] Insights Cred on Project form, for insights project --- .../insights/insights.controller.js | 10 +++--- .../insights/insights.partial.html | 2 +- .../edit/inventory-edit.controller.js | 4 +-- .../inventories/standard/inventory.form.js | 2 +- .../projects/add/projects-add.controller.js | 20 +++++++++++ .../projects/edit/projects-edit.controller.js | 21 ++++++++++++ awx/ui/client/src/projects/projects.form.js | 7 ++-- .../job-template-add.controller.js | 33 ++++++++----------- awx/ui/client/src/templates/main.js | 32 +++++++++++++++++- 9 files changed, 99 insertions(+), 32 deletions(-) diff --git a/awx/ui/client/src/inventories/insights/insights.controller.js b/awx/ui/client/src/inventories/insights/insights.controller.js index 74bd1a7652..69cc50e7ed 100644 --- a/awx/ui/client/src/inventories/insights/insights.controller.js +++ b/awx/ui/client/src/inventories/insights/insights.controller.js @@ -4,8 +4,8 @@ * All Rights Reserved *************************************************/ -export default [ 'InsightsData', '$scope', 'moment', '$state', -function (data, $scope, moment, $state) { +export default [ 'InsightsData', '$scope', 'moment', '$state', 'resourceData', +function (data, $scope, moment, $state, resourceData) { function init() { @@ -20,6 +20,8 @@ function (data, $scope, moment, $state) { $scope.low_count = _.filter($scope.reports_dataset.reports, (report) => {return report.rule.severity === "INFO"; }).length; let a = moment(), b = moment($scope.reports_dataset.last_check_in); $scope.last_check_in = a.diff(b, 'hours'); + $scope.inventory = resourceData.data; + $scope.insights_credential = resourceData.data.summary_fields.insights_credential.id; } init(); @@ -75,8 +77,8 @@ function (data, $scope, moment, $state) { $scope.viewDataInInsights = function(){ window.open(`https://access.redhat.com/insights/inventory?machine=${$scope.$parent.host.insights_system_id}`, '_blank'); }; - $scope.remediateInventory = function(){ - $state.go('templates.addJobTemplate'); + $scope.remediateInventory = function(inv_id, inv_name, insights_credential){ + $state.go('templates.addJobTemplate', {inventory_id: inv_id, inventory_name:inv_name, credential_id: insights_credential}); }; $scope.formCancel = function(){ $state.go('inventories', null, {reload: true}); diff --git a/awx/ui/client/src/inventories/insights/insights.partial.html b/awx/ui/client/src/inventories/insights/insights.partial.html index 201f30171c..c161c49fea 100644 --- a/awx/ui/client/src/inventories/insights/insights.partial.html +++ b/awx/ui/client/src/inventories/insights/insights.partial.html @@ -76,6 +76,6 @@
- +
diff --git a/awx/ui/client/src/inventories/standard/edit/inventory-edit.controller.js b/awx/ui/client/src/inventories/standard/edit/inventory-edit.controller.js index 5b9d0e69bc..70500bac10 100644 --- a/awx/ui/client/src/inventories/standard/edit/inventory-edit.controller.js +++ b/awx/ui/client/src/inventories/standard/edit/inventory-edit.controller.js @@ -91,8 +91,8 @@ function InventoriesEdit($scope, $location, $state.go('inventories'); }; - $scope.remediateInventory = function(){ - $state.go('templates.addJobTemplate'); + $scope.remediateInventory = function(inv_id, inv_name, insights_credential){ + $state.go('templates.addJobTemplate', {inventory_id: inv_id, inventory_name:inv_name, credential_id: insights_credential}); }; } diff --git a/awx/ui/client/src/inventories/standard/inventory.form.js b/awx/ui/client/src/inventories/standard/inventory.form.js index ee31503dfc..468ab1112f 100644 --- a/awx/ui/client/src/inventories/standard/inventory.form.js +++ b/awx/ui/client/src/inventories/standard/inventory.form.js @@ -191,7 +191,7 @@ function(i18n, InventoryCompletedJobsList) { }, relatedButtons: { remediate_inventory: { - ngClick: 'remediateInventory()', + ngClick: 'remediateInventory(id, name, insights_credential)', ngShow: 'insights_credential!==null', label: i18n._('Remediate Inventory'), class: 'Form-primaryButton' diff --git a/awx/ui/client/src/projects/add/projects-add.controller.js b/awx/ui/client/src/projects/add/projects-add.controller.js index 2c90d6448e..7f2e4c7abc 100644 --- a/awx/ui/client/src/projects/add/projects-add.controller.js +++ b/awx/ui/client/src/projects/add/projects-add.controller.js @@ -121,6 +121,7 @@ export default ['$scope', '$location', '$stateParams', 'GenerateForm', if ($scope.scm_type.value) { switch ($scope.scm_type.value) { case 'git': + $scope.credentialLabel = "SCM Credential"; $scope.urlPopover = '

' + i18n._('Example URLs for GIT SCM include:') + '