@@ -18,6 +18,7 @@ import { css } from '@patternfly/react-styles';
1818import { useTranslation } from 'react-i18next' ;
1919import { Link } from 'react-router-dom-v5-compat' ;
2020import { useK8sWatchResource } from '@console/internal/components/utils/k8s-watch-hook' ;
21+ import { resourcePathFromModel } from '@console/internal/components/utils/resource-link' ;
2122import { referenceForModel } from '@console/internal/module/k8s' ;
2223import { DismissableAlert , RH_OPERATOR_SUPPORT_POLICY_LINK } from '@console/shared' ;
2324import CatalogPageOverlay from '@console/shared/src/components/catalog/catalog-view/CatalogPageOverlay' ;
@@ -26,7 +27,7 @@ import { Timestamp } from '@console/shared/src/components/datetime/Timestamp';
2627import { ExternalLink } from '@console/shared/src/components/links/ExternalLink' ;
2728import { DefaultCatalogSource } from '../../const' ;
2829import { useCurrentCSVDescription } from '../../hooks/useCurrentCSVDescription' ;
29- import { ClusterServiceVersionModel } from '../../models' ;
30+ import { ClusterServiceVersionModel , SubscriptionModel } from '../../models' ;
3031import { ClusterServiceVersionKind , SubscriptionKind } from '../../types' ;
3132import { MarkdownView } from '../clusterserviceversion' ;
3233import { DeprecatedOperatorWarningAlert } from '../deprecated-operator-warnings/deprecated-operator-warnings' ;
@@ -96,10 +97,17 @@ const InstalledHint: React.FCC<InstalledHintProps> = ({
9697 isList : false ,
9798 namespaced : true ,
9899 } ) ;
99- const nsPath = `/k8s/ns/${ subscription . metadata . namespace } ` ;
100100 const to = installedCSV
101- ? `${ nsPath } /clusterserviceversions/${ installedCSV ?. metadata ?. name ?? '' } `
102- : `${ nsPath } /subscriptions/${ subscription . metadata . name ?? '' } ` ;
101+ ? resourcePathFromModel (
102+ ClusterServiceVersionModel ,
103+ installedCSV ?. metadata ?. name ,
104+ subscription ?. metadata ?. namespace ,
105+ )
106+ : resourcePathFromModel (
107+ SubscriptionModel ,
108+ subscription . metadata . name ,
109+ subscription . metadata . namespace ,
110+ ) ;
103111 const installedVersion = installedCSV ?. spec ?. version ;
104112 return (
105113 < Hint >
@@ -139,10 +147,17 @@ const InstallingHint: React.FCC<InstallingHintProps> = ({ subscription }) => {
139147 }
140148 : null ,
141149 ) ;
142- const nsPath = `/k8s/ns/${ subscription . metadata . namespace } ` ;
143150 const to = installedCSV
144- ? `${ nsPath } /clusterserviceversions/${ installedCSV ?. metadata ?. name } /subscription`
145- : `${ nsPath } /subscriptions/${ subscription . metadata . name ?? '' } ` ;
151+ ? `${ resourcePathFromModel (
152+ ClusterServiceVersionModel ,
153+ installedCSV ?. metadata ?. name ,
154+ subscription ?. metadata ?. namespace ,
155+ ) } /subscription`
156+ : resourcePathFromModel (
157+ SubscriptionModel ,
158+ subscription . metadata . name ,
159+ subscription . metadata . namespace ,
160+ ) ;
146161 return (
147162 < Hint >
148163 < HintTitle > { t ( 'olm~Installing Operator' ) } </ HintTitle >
0 commit comments