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
ODC-7399: Create getting started content in functions list page #13289
ODC-7399: Create getting started content in functions list page #13289
Conversation
@lokanandaprabhu: This pull request references ODC-7399 which is a valid jira issue. Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.15.0" version, but no target version was set. In response to this:
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. |
462a631
to
e01892e
Compare
/retest |
e01892e
to
d2008ec
Compare
/retest |
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.
In general, fine! 👍
Some small code change requests.
Some UX topics that we should check in a call:
frontend/packages/console-shared/src/components/catalog/CatalogController.tsx
Outdated
Show resolved
Hide resolved
frontend/packages/console-shared/src/components/catalog/CatalogController.tsx
Outdated
Show resolved
Hide resolved
frontend/packages/console-shared/src/components/catalog/CatalogController.tsx
Outdated
Show resolved
Hide resolved
frontend/packages/knative-plugin/src/components/functions/GettingStartedCard.tsx
Outdated
Show resolved
Hide resolved
frontend/packages/knative-plugin/src/components/functions/GettingStartedSection.tsx
Outdated
Show resolved
Hide resolved
frontend/packages/knative-plugin/src/components/functions/SamplesGettingStartedCard.tsx
Show resolved
Hide resolved
frontend/packages/knative-plugin/src/components/functions/GettingStartedSection.tsx
Outdated
Show resolved
Hide resolved
frontend/packages/knative-plugin/src/components/services/ServiceDetailsPage.tsx
Show resolved
Hide resolved
@lokanandaprabhu: This pull request references ODC-7399 which is a valid jira issue. Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.15.0" version, but no target version was set. In response to this:
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. |
7e7a224
to
1c48434
Compare
Hi @jerolimov , I have resolved the feedback comments. PTAL. |
1c48434
to
cd16eb6
Compare
/retest |
f891c64
to
af8d987
Compare
Propage labels from the epic: /label docs-approved |
@lokanandaprabhu: This pull request references ODC-7399 which is a valid jira issue. In response to this:
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. |
/assign @Lucifergene |
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.
frontend/packages/knative-plugin/src/components/functions/GettingStartedSection.tsx
Outdated
Show resolved
Hide resolved
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.
Small recommendations. Let me know if you have any question. Thanks for the great work 👍
const sampleType = params.get('sampleType'); | ||
const labelFilter: Record<string, string> = { | ||
label: 'sample-type', | ||
value: sampleType, | ||
}; |
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.
In my previous comment, I mixed two options, a sampleType
query parameter is one option. The Record is an option for a more generic solution where the filter is something like ?labelFilter=serverless=true
So this code currently mixes both, let us focus on one solution or the other. At the moment a sampleType is fine.
const sampleType = params.get('sampleType'); | |
const labelFilter: Record<string, string> = { | |
label: 'sample-type', | |
value: sampleType, | |
}; | |
const sampleType = params.get('sampleType'); |
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.
We need both since typeLabel is translated string in other samples
let filteredLists: CatalogItem[]; | ||
if (sampleType) { | ||
filteredLists = service.items.filter((item) => { | ||
return ( | ||
item?.typeLabel === labelFilter?.value || | ||
item?.data?.metadata?.labels[labelFilter?.label] === labelFilter?.value | ||
); | ||
}); | ||
} else { | ||
filteredLists = service.items; | ||
} | ||
const catalogItems = { ...service, items: filteredLists }; |
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.
We can talk about the alternative here, but for now I would recommend to focus on sampleType
filter. A labelFilter
might have more powers, but we shouldn't mix both.
let filteredLists: CatalogItem[]; | |
if (sampleType) { | |
filteredLists = service.items.filter((item) => { | |
return ( | |
item?.typeLabel === labelFilter?.value || | |
item?.data?.metadata?.labels[labelFilter?.label] === labelFilter?.value | |
); | |
}); | |
} else { | |
filteredLists = service.items; | |
} | |
const catalogItems = { ...service, items: filteredLists }; | |
let filteredItems = service.items; | |
if (sampleType) { | |
filteredItems = filteredItems.filter((item) => item.typeLabel === sampleType); | |
} | |
const catalogItems = { ...service, items: filteredItems }; |
Maybe I miss something, but as long as the "all samples' link uses ...?sampleType=Serverless%20function
we don't need more 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.
Yes value is the value from the URL only, but typeLabel is the translated string in other samples. If we change the language, the type label will show in the respective language.
So if I look only for typeLabel, then if it is translated string, later we have to ask serverless team to add one metadata.label to indicate this is the sample wrt serverless functions
Now while creating the sample, if they add new label as sample-type : 'Serverless Function' then if typeLabel is translated string also we will not be having any issue.
const items = menuActions | ||
? Object.keys(menuActions).reduce<Record<string, string>>((acc, key) => { | ||
const menuAction: MenuAction = menuActions[key]; | ||
const label = | ||
menuAction.label || | ||
(menuAction.model?.labelKey ? t(menuAction.model.labelKey) : menuAction.model?.label); | ||
if (!label) return acc; | ||
|
||
return { | ||
...acc, | ||
[key]: label, | ||
}; | ||
}, {}) | ||
: undefined; |
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 object above have well known actions with translated label
and onSelection
callbacks. So the code to use labelKey
never runs. Also the if (!label)
statement should never be true. It looks to me that the items
object will be the same as menuActions
, or?
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.
menuActions is object with Key and Menu actions and the key is used while selecting the option from the dropdown. While opening the dropdown component also the shared component expecting key and label. I have removed code wrt labelKey.
frontend/packages/knative-plugin/src/components/functions/FunctionsList.tsx
Outdated
Show resolved
Hide resolved
frontend/packages/knative-plugin/src/components/functions/GettingStartedSection.tsx
Outdated
Show resolved
Hide resolved
if (loaded && slicedQuickStarts.length === 0) { | ||
links.push( | ||
{ | ||
id: 'ide-extensions', | ||
href: | ||
'https://marketplace.visualstudio.com/items?itemName=redhat.vscode-openshift-connector', | ||
title: t('knative-plugin~Create using IDE extension'), | ||
external: true, | ||
}, | ||
{ | ||
id: 'functions-tekton-pipelines', | ||
title: t('knative-plugin~Building Functions on Cluster with Tekton Pipelines'), | ||
href: | ||
'https://github.com/knative/func/blob/main/docs/building-functions/on_cluster_build.md', | ||
external: true, | ||
}, | ||
); |
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.
Can we add one link if we found just QS, and both if there are 0?
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 is discussed as either QS will be there or external links. One QS is there also, external link will be added to the 3rd section, which is documentation section.
bee7efd
to
3626392
Compare
/retest |
1 similar comment
/retest |
3626392
to
876798f
Compare
/retest |
Looks good to me :) |
/retest |
/test e2e-gcp-console |
/retest |
/lgtm |
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.
/approve
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: jerolimov, lokanandaprabhu, Lucifergene 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 |
/retest |
1 similar comment
/retest |
@lokanandaprabhu: 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. |
Story:
https://issues.redhat.com/browse/ODC-7399
Description:
Demo:
Screen.Recording.2023-10-27.at.10.37.42.AM.mov
Screen.Recording.2023-10-27.at.10.42.50.AM.mov
Screen.Recording.2023-10-31.at.10.13.03.AM.mov