From 86f62fd5c3e6cbc268fef9eb883a6036e1a930bd Mon Sep 17 00:00:00 2001 From: Oleh Fedorenko Date: Wed, 22 May 2024 17:33:23 +0200 Subject: [PATCH] Fixes #37477 - Make host links be settings aware (#571) (cherry picked from commit 81a93e9766479e7672f33f632a79fb1d5a4fcc8c) --- .../ViewSelectedHostsLink.js | 4 ++-- .../OpenscapRemediationWizard/steps/ReviewHosts.js | 14 ++++++++++++-- .../steps/ReviewRemediation.js | 11 +++++++---- 3 files changed, 21 insertions(+), 8 deletions(-) diff --git a/webpack/components/OpenscapRemediationWizard/ViewSelectedHostsLink.js b/webpack/components/OpenscapRemediationWizard/ViewSelectedHostsLink.js index 31593d2c..ed0cfda6 100644 --- a/webpack/components/OpenscapRemediationWizard/ViewSelectedHostsLink.js +++ b/webpack/components/OpenscapRemediationWizard/ViewSelectedHostsLink.js @@ -6,7 +6,7 @@ import { Button } from '@patternfly/react-core'; import { translate as __ } from 'foremanReact/common/I18n'; import { foremanUrl } from 'foremanReact/common/helpers'; -import { getHostsPageUrl } from 'foremanReact/Root/Context/ForemanContext'; +import { useForemanHostsPageUrl } from 'foremanReact/Root/Context/ForemanContext'; const ViewSelectedHostsLink = ({ hostIdsParam, @@ -14,7 +14,7 @@ const ViewSelectedHostsLink = ({ defaultFailedHostsSearch, }) => { const search = isAllHostsSelected ? defaultFailedHostsSearch : hostIdsParam; - const url = foremanUrl(`${getHostsPageUrl(false)}?search=${search}`); + const url = foremanUrl(`${useForemanHostsPageUrl()}?search=${search}`); return ( ), isSorted: true, weight: 50, diff --git a/webpack/components/OpenscapRemediationWizard/steps/ReviewRemediation.js b/webpack/components/OpenscapRemediationWizard/steps/ReviewRemediation.js index afbda9d3..3c1c24f2 100644 --- a/webpack/components/OpenscapRemediationWizard/steps/ReviewRemediation.js +++ b/webpack/components/OpenscapRemediationWizard/steps/ReviewRemediation.js @@ -16,12 +16,15 @@ import { ExternalLinkSquareAltIcon } from '@patternfly/react-icons'; import { translate as __ } from 'foremanReact/common/I18n'; import { foremanUrl } from 'foremanReact/common/helpers'; -import { getHostsPageUrl } from 'foremanReact/Root/Context/ForemanContext'; +import { + useForemanHostsPageUrl, + useForemanHostDetailsPageUrl, +} from 'foremanReact/Root/Context/ForemanContext'; import OpenscapRemediationWizardContext from '../OpenscapRemediationWizardContext'; import WizardHeader from '../WizardHeader'; import ViewSelectedHostsLink from '../ViewSelectedHostsLink'; -import { HOSTS_PATH, FAIL_RULE_SEARCH } from '../constants'; +import { FAIL_RULE_SEARCH } from '../constants'; import { findFixBySnippet } from '../helpers'; import './ReviewRemediation.scss'; @@ -120,7 +123,7 @@ const ReviewRemediation = () => { iconPosition="right" target="_blank" component="a" - href={foremanUrl(`${getHostsPageUrl(true)}/${hostName}`)} + href={foremanUrl(`${useForemanHostDetailsPageUrl()}${hostName}`)} > {hostName} {' '} @@ -133,7 +136,7 @@ const ReviewRemediation = () => { target="_blank" component="a" href={foremanUrl( - `${HOSTS_PATH}/?search=${FAIL_RULE_SEARCH} = ${source}` + `${useForemanHostsPageUrl()}?search=${FAIL_RULE_SEARCH} = ${source}` )} > {__('Other hosts failing this rule')}