From 6ff539e6ee2ac3264e6347c81774fc9f67a7981c Mon Sep 17 00:00:00 2001 From: Jeff Bradberry Date: Tue, 16 Apr 2019 10:14:44 -0400 Subject: [PATCH] Update the front-end Insights urls --- awx/main/tests/data/insights_hosts.json | 3 ++- awx/main/utils/insights.py | 1 + .../inventories/insights/insights.controller.js | 3 ++- .../src/inventories-hosts/inventories/insights/plan-filter.js | 4 ++-- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/awx/main/tests/data/insights_hosts.json b/awx/main/tests/data/insights_hosts.json index 2ed3f4f9f5..8228222854 100644 --- a/awx/main/tests/data/insights_hosts.json +++ b/awx/main/tests/data/insights_hosts.json @@ -5,7 +5,8 @@ "per_page": 50, "results": [ { - "insights_id": "11111111-1111-1111-1111-111111111111", + "id": "11111111-1111-1111-1111-111111111111", + "insights_id": "22222222-2222-2222-2222-222222222222", "updated": "2019-03-19T21:59:09.213151-04:00" } ] diff --git a/awx/main/utils/insights.py b/awx/main/utils/insights.py index fbb2ba43c2..67bb1e5f25 100644 --- a/awx/main/utils/insights.py +++ b/awx/main/utils/insights.py @@ -24,6 +24,7 @@ def filter_insights_api_response(platform_info, reports, remediations): } new_json = { + 'platform_id': platform_info['id'], 'last_check_in': platform_info.get('updated'), 'reports': [], } diff --git a/awx/ui/client/src/inventories-hosts/inventories/insights/insights.controller.js b/awx/ui/client/src/inventories-hosts/inventories/insights/insights.controller.js index 5022fc519d..effacb7297 100644 --- a/awx/ui/client/src/inventories-hosts/inventories/insights/insights.controller.js +++ b/awx/ui/client/src/inventories-hosts/inventories/insights/insights.controller.js @@ -26,6 +26,7 @@ function (data, $scope, moment, $state, InventoryData, InsightsService, InventoryData.summary_fields.insights_credential && InventoryData.summary_fields.insights_credential.id) ? InventoryData.summary_fields.insights_credential.id : null; $scope.canRemediate = CanRemediate; + $scope.platformId = $scope.reports_dataset.platform_id; } function filter(str){ @@ -40,7 +41,7 @@ function (data, $scope, moment, $state, InventoryData, InsightsService, }; $scope.viewDataInInsights = function(){ - window.open(`https://access.redhat.com/insights/inventory?machine=${$scope.$parent.host.insights_system_id}`, '_blank'); + window.open(`https://cloud.redhat.com/insights/inventory/${$scope.platform_id}/insights`, '_blank'); }; $scope.remediateInventory = function(inv_id, insights_credential){ diff --git a/awx/ui/client/src/inventories-hosts/inventories/insights/plan-filter.js b/awx/ui/client/src/inventories-hosts/inventories/insights/plan-filter.js index 27259feac0..df023b75aa 100644 --- a/awx/ui/client/src/inventories-hosts/inventories/insights/plan-filter.js +++ b/awx/ui/client/src/inventories-hosts/inventories/insights/plan-filter.js @@ -7,10 +7,10 @@ export default function(){ return function(plan) { if(plan === null || plan === undefined){ - return "PLAN: Not Available CREATE A NEW PLAN IN INSIGHTS"; + return "PLAN: Not Available CREATE A NEW PLAN IN INSIGHTS"; } else { let name = (plan.name === null) ? "Unnamed Plan" : plan.name; - return `${name} (${plan.id})`; + return `${name} (${plan.id})`; } }; }