Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update main nav and UI for Insights on Premise #932

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from

Conversation

jeremylenz
Copy link
Collaborator

@jeremylenz jeremylenz commented Dec 16, 2024

  1. Update the main nav:
  • Rename "RH Cloud" to "Insights"
  • Rename "Insights" sub-item to "Recommendations"
  1. Introduce a new SETTING to tell RH Cloud if you're using Insights on Prem. In response to this setting,
  • hide the Inventory Upload page from the main nav
  • hide the "Sync automatically" toggle from the Recommendations page (formerly the Insights page)
  • hide the 'View in Red Hat Insights' links from various locations on the Recommendations page (formerly the Insights page)

Before

image

After

image

Testing

In your Foreman settings.yaml, include a new section

:insights:
  :use_insights_on_premise: true

@jeremylenz jeremylenz requested review from ehelms and parthaa December 16, 2024 19:43
@parthaa
Copy link
Collaborator

parthaa commented Dec 21, 2024

Can you also hide both these entries from the insights recommendations page.

image

Same for
image

Looks good otherwise.

@parthaa
Copy link
Collaborator

parthaa commented Dec 21, 2024

Also recommended patch. This redirects the remediations + certs to use localhost . May make sense in a separate PR though

diff --git a/lib/foreman_rh_cloud.rb b/lib/foreman_rh_cloud.rb
index f9e6430..406703f 100644
--- a/lib/foreman_rh_cloud.rb
+++ b/lib/foreman_rh_cloud.rb
@@ -3,17 +3,23 @@ require 'cgi'
 require 'uri'
 
 module ForemanRhCloud
+  def self.on_premise_url
+    return unless ForemanRhCloud.with_insights_on_premise?
+    port = ENV['INSIGHTS_ADVISOR_PORT'] || "8000"
+    "http://#{ForemanRhCloud.foreman_host.fqdn || 'localhost'}:#{port}"
+  end
+
   def self.base_url
     # for testing set ENV to 'https://ci.cloud.redhat.com'
-    @base_url ||= ENV['SATELLITE_RH_CLOUD_URL'] || 'https://cloud.redhat.com'
+    @base_url ||= on_premise_url || ENV['SATELLITE_RH_CLOUD_URL'] || 'https://cloud.redhat.com'
   end
 
   def self.cert_base_url
-    @cert_base_url ||= ENV['SATELLITE_CERT_RH_CLOUD_URL'] || 'https://cert.cloud.redhat.com'
+    @cert_base_url ||= on_premise_url || ENV['SATELLITE_CERT_RH_CLOUD_URL'] || 'https://cert.cloud.redhat.com'
   end
 
   def self.legacy_insights_url
-    @legacy_insights_url ||= ENV['SATELLITE_LEGACY_INSIGHTS_URL'] || 'https://cert-api.access.redhat.com'
+    @legacy_insights_url ||= on_premise_url || ENV['SATELLITE_LEGACY_INSIGHTS_URL'] || 'https://cert-api.access.redhat.com'
   end
 
   def self.verify_ssl_method

@jeremylenz
Copy link
Collaborator Author

Also recommended patch. This redirects the remediations + certs to use localhost . May make sense in a separate PR though

I agree, I think this makes more sense as a separate PR. Opened #936

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants