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
Bug 1874901: add utm_source parameter to Red Hat Marketplace URLs for attribution #6363
Changes from 3 commits
8f8e91f
c4f1dba
4e7e110
cdb0dea
ad57af4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -421,6 +421,16 @@ export const OperatorHubTileView: React.FC<OperatorHubTileViewProps> = (props) = | |
detailsItem && | ||
`/k8s/ns/${detailsItem.subscription.metadata.namespace}/${SubscriptionModel.plural}/${detailsItem.subscription.metadata.name}?showDelete=true`; | ||
|
||
let remoteWorkflowUrl = detailsItem.marketplaceRemoteWorkflow; | ||
try { | ||
const url = new URL(remoteWorkflowUrl); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It looks like this tries to parse an undefined URL and spams the console with errors like
We should only try to parse the URL if defined. (Sorry I missed this on previous review.) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No worries, I should have caught it. Thank you for the review! |
||
url.searchParams.set('utm_source', 'openshift_console'); | ||
remoteWorkflowUrl = url.toString(); | ||
} catch (error) { | ||
// eslint-disable-next-line no-console | ||
console.error(error.message); | ||
} | ||
|
||
if (_.isEmpty(filteredItems)) { | ||
return ( | ||
<> | ||
|
@@ -468,10 +478,10 @@ export const OperatorHubTileView: React.FC<OperatorHubTileViewProps> = (props) = | |
id="catalog-item-header" | ||
/> | ||
<div className="co-catalog-page__overlay-actions"> | ||
{detailsItem.marketplaceRemoteWorkflow && ( | ||
{remoteWorkflowUrl && ( | ||
<ExternalLink | ||
additionalClassName="pf-c-button pf-m-primary co-catalog-page__overlay-action" | ||
href={detailsItem.marketplaceRemoteWorkflow} | ||
href={remoteWorkflowUrl} | ||
text={ | ||
<> | ||
<div className="co-catalog-page__overlay-action-label"> | ||
|
@@ -486,8 +496,8 @@ export const OperatorHubTileView: React.FC<OperatorHubTileViewProps> = (props) = | |
<Link | ||
className={classNames( | ||
'pf-c-button', | ||
{ 'pf-m-secondary': detailsItem.marketplaceRemoteWorkflow }, | ||
{ 'pf-m-primary': !detailsItem.marketplaceRemoteWorkflow }, | ||
{ 'pf-m-secondary': remoteWorkflowUrl }, | ||
{ 'pf-m-primary': !remoteWorkflowUrl }, | ||
'co-catalog-page__overlay-action', | ||
)} | ||
data-test-id="operator-install-btn" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like
detailsItem
is not always defined.