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

Add QuickStarts cta to create ProjectHelmChartRepository in the helm catalog description text #10904

Merged
merged 2 commits into from
Jan 28, 2022

Conversation

debsmita1
Copy link
Contributor

@debsmita1 debsmita1 commented Jan 21, 2022

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:

  • Modified the catalogDescription property of CatalogItemType extension to also accept JSX Element
  • showing the quick start link only if the namespaced-hcr quickstart is available

Screenshot:
qs-cta

Test coverage:
test
newtests

TODO:

@openshift-ci openshift-ci bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jan 21, 2022
@openshift-ci openshift-ci bot added component/helm Related to helm-plugin component/sdk Related to console-plugin-sdk component/shared Related to console-shared kind/i18n Indicates issue or PR relates to internationalization or has content that needs to be translated labels Jan 21, 2022
@debsmita1
Copy link
Contributor Author

/kind feature
/assign @rohitkrai03
/cc @serenamarie125

@openshift-ci openshift-ci bot added the kind/feature Categorizes issue or PR as related to a new feature. label Jan 21, 2022
@debsmita1
Copy link
Contributor Author

/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()}
Copy link
Member

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?

Copy link
Contributor Author

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' &&
Copy link
Member

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 😄 🤷

Suggested change
typeof typeExtension?.properties?.catalogDescription !== 'string' &&

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed it

@jerolimov
Copy link
Member

/assign

Copy link
Member

@jerolimov jerolimov left a 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:

  1. Should we open the quick start instead of linking the catalog. Def. a PM question, but makes sense for me.
  2. 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.
  3. Recommend convert helmCatalogTypeDescription to a function compontent.

const title = typeExtension?.properties.title ?? defaultTitle;
const description = typeExtension?.properties.catalogDescription ?? defaultDescription;
const title = typeExtension?.properties?.title ?? defaultTitle;

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit nit nit 😏

Suggested change

Comment on lines 183 to 191

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>
);
Copy link
Member

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?

Copy link
Contributor Author

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
Copy link
Member

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?

Copy link
Contributor Author

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

Copy link
Member

@jerolimov jerolimov Jan 24, 2022

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.


const handleOnClick = (event: React.MouseEvent<HTMLElement>) => {
if (isModifiedEvent(event)) {
event.preventDefault();
Copy link
Member

@jerolimov jerolimov Jan 25, 2022

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.

Suggested change
event.preventDefault();
return;

Copy link
Member

@jerolimov jerolimov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the latest update. Works now fine also with the edge case if the user navigates to a sub item, search for something or open the quick start with ctrl+click. :+1;

Peek 2022-01-25 13-19

/approve
/lgtm

@openshift-ci openshift-ci bot added lgtm Indicates that a PR is ready to be merged. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Jan 25, 2022
Copy link
Contributor

@serenamarie125 serenamarie125 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@openshift-ci openshift-ci bot removed the lgtm Indicates that a PR is ready to be merged. label Jan 25, 2022
@debsmita1
Copy link
Contributor Author

updated the helm-plugin.json file

@jerolimov
Copy link
Member

Serena says lgtm, lets :shipit:
/unhold
/lgtm

@openshift-ci openshift-ci bot added lgtm Indicates that a PR is ready to be merged. and removed do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. labels Jan 25, 2022
@jerolimov
Copy link
Member

Propagate from epic:
/label docs-approved
/label px-approved

@openshift-ci openshift-ci bot added docs-approved Signifies that Docs has signed off on this PR px-approved Signifies that Product Support has signed off on this PR labels Jan 25, 2022
@jerolimov
Copy link
Member

Tested on a cluster and works fine when adding the Quick start from openshift/console-operator#631 manually.

@jerolimov
Copy link
Member

Wait for openshift/console-operator#631
/hold
/label qe-approved

@openshift-ci openshift-ci bot added do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. qe-approved Signifies that QE has signed off on this PR labels Jan 26, 2022
@openshift-ci openshift-ci bot removed the lgtm Indicates that a PR is ready to be merged. label Jan 27, 2022
@debsmita1
Copy link
Contributor Author

we can now safely merge this before openshift/console-operator#631
/unhold

@openshift-ci openshift-ci bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jan 27, 2022
Copy link
Member

@jerolimov jerolimov left a 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

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Jan 27, 2022
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jan 27, 2022

[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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-bot
Copy link
Contributor

/retest-required

Please review the full test history for this PR and help us cut down flakes.

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jan 28, 2022

@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.

@openshift-merge-robot openshift-merge-robot merged commit 60e2307 into openshift:master Jan 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. component/helm Related to helm-plugin component/sdk Related to console-plugin-sdk component/shared Related to console-shared docs-approved Signifies that Docs has signed off on this PR kind/feature Categorizes issue or PR as related to a new feature. kind/i18n Indicates issue or PR relates to internationalization or has content that needs to be translated lgtm Indicates that a PR is ready to be merged. px-approved Signifies that Product Support has signed off on this PR qe-approved Signifies that QE has signed off on this PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants