-
Notifications
You must be signed in to change notification settings - Fork 605
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
Add QuickStarts cta to create ProjectHelmChartRepository in the helm catalog description text #10904
Add QuickStarts cta to create ProjectHelmChartRepository in the helm catalog description text #10904
Conversation
/kind feature |
/assign @invincibleJai |
@@ -174,7 +190,7 @@ const CatalogController: React.FC<CatalogControllerProps> = ({ | |||
<div className="co-m-page__body"> | |||
<div className="co-catalog"> | |||
<PageHeading title={title} breadcrumbs={type ? breadcrumbs : null} /> | |||
<p className="co-catalog-page__description">{description}</p> | |||
{getCatalogDescription()} |
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.
@debsmita1 Just read the code, and all three cases adds <p className="co-catalog-page__description">
around the component they render. Two times in getCatalogDescription
and the last time in helmCatalogTypeDescription
.
Is there any reason to not keep it here and make the return statements of getCatalogDescription
and helmCatalogTypeDescription
easier?
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.
Fixed it
); | ||
} | ||
if ( | ||
typeof typeExtension?.properties?.catalogDescription !== 'string' && |
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.
Mini nit: If it's a string above, we can skip this check. If typescript needs this I'm also fine with this. This is btw the reason I'm a big fan of else if statements. But our prettier prefers if statements 😄 🤷
typeof typeExtension?.properties?.catalogDescription !== 'string' && |
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.
Fixed it
/assign |
c1f751f
to
fd6b516
Compare
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.
General this PR looks fine. And thanks for this great new tests 👍 🥳
As mentioned in slack and in the code areas below, I have currently 3 concerns:
- Should we open the quick start instead of linking the catalog. Def. a PM question, but makes sense for me.
- Should we check if the quick start doesn't exist. What should we show then? Can we do all this in
helmCatalogTypeDescription
? Also a question for PM, but I think we should do this. - Recommend convert
helmCatalogTypeDescription
to afunctioncompontent.
const title = typeExtension?.properties.title ?? defaultTitle; | ||
const description = typeExtension?.properties.catalogDescription ?? defaultDescription; | ||
const title = typeExtension?.properties?.title ?? defaultTitle; | ||
|
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.
nit nit nit 😏
|
||
export const helmCatalogTypeDescription = ( // add the new QS name in the link | ||
<Trans ns="helm-plugin"> | ||
Browse for charts that help manage complex installations and upgrades. Cluster administrators | ||
can customize the content made available in the catalog. Alternatively, developers can try{' '} | ||
<Link to={'/quickstart?quickstart='}>this quick start</Link> to configure their own custom Helm | ||
Chart repository. | ||
</Trans> | ||
); |
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.
I have some suggestions and a question for this function:
a) I would suggest converting this to a component. Regardless that the component doesn't have a prop, it "feels" more like a small component.
I tested this also with pseudolocalization
and it looks like it was not translated. I don't know if this static field would work if the user switches the language. I think all these cases should just work when converting to a component.
b) After that would suggest moving this out of the utils
package into the components
package. As said, it feels more like a component than a utils function as you need this render context in your test.
Maybe into its own super small file. Would also suggest exporting it then via helmCatalog
in packages/helm-plugin/src/catalog/index.ts
. Wdyt?
c) Also mentioned in slack: What happens when the quick start was not found or is disabled? Should we check for the quick start first? 🤯 Is it over-engineered if we do this here?
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.
moved it out of catalog-utils and created a functional component under components folder
<Trans ns="helm-plugin"> | ||
Browse for charts that help manage complex installations and upgrades. Cluster administrators | ||
can customize the content made available in the catalog. Alternatively, developers can try{' '} | ||
<Link to={'/quickstart?quickstart='}>this quick start</Link> to configure their own custom Helm |
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.
Asked this in slack already. Do we really want to open the quick start catalog or should we open the quick start?
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.
@jerolimov the quick start name will be added here , which is why I have put the PR on hold
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.
Yes, I added a test quickstart ID. It opens the quick start but is also redirects the user from the "Helm Charts" catalog to the "Quick Starts" catalog. Serena needs to decide if that's okay or not. I would expect that the user stays on the current page and that this link (aka button) just opens the quick start in the sidebar.
fd6b516
to
f1c65e9
Compare
f1c65e9
to
4430754
Compare
|
||
const handleOnClick = (event: React.MouseEvent<HTMLElement>) => { | ||
if (isModifiedEvent(event)) { | ||
event.preventDefault(); |
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.
When detecting a ctrl+click we should not prevent the link from working. We want that the default browser behavior but we should not handle the click ourself, so that the quickstart is not opened in the current tab.
event.preventDefault(); | |
return; |
4430754
to
5ee4ca2
Compare
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.
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.
LGTM
5ee4ca2
to
f94bfc2
Compare
updated the helm-plugin.json file |
Serena says lgtm, lets |
Propagate from epic: |
Tested on a cluster and works fine when adding the Quick start from openshift/console-operator#631 manually. |
Wait for openshift/console-operator#631 |
f94bfc2
to
87d08f4
Compare
we can now safely merge this before openshift/console-operator#631 |
87d08f4
to
263a8fa
Compare
263a8fa
to
406e2ad
Compare
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.
The space before Alternatively and the order of the both strings could make the translation more difficult. But I'm fine here for the moment to get this in and improve this if needed.
Thanks a lot for all the extra rounds, also the small details works great now. "Details matters" 👍
/lgtm
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: debsmita1, jerolimov, serenamarie125 The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/retest-required Please review the full test history for this PR and help us cut down flakes. |
@debsmita1: all tests passed! Full PR test history. Your PR dashboard. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
JIRA story:
https://issues.redhat.com/browse/ODC-6466
Root analysis:
As a user, I want to see the QuickStart which will guide me through the process of adding my HelmChartRepo to the desired project.
Solution description:
catalogDescription
property ofCatalogItemType
extension to also accept JSX ElementScreenshot:
Test coverage:
TODO: