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-7377: Add Functions tab to the side navigation menu in Developer prespective #13138
Conversation
@lokanandaprabhu: This pull request references ODC-7377 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. |
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: lokanandaprabhu The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
2ed88e7
to
fb94b99
Compare
@lokanandaprabhu: This pull request references ODC-7377 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. |
fb94b99
to
170d42c
Compare
0bd1072
to
ab4c8ad
Compare
ab4c8ad
to
543fee4
Compare
/cc @jerolimov |
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 works already really well and the code looks almost good to me. 👍
Just some minor ideas... (see below)
@sanketpathak can you please take a look into the e2e tests?
/uncc jcaianirh divyanshiGupta
/cc @sanketpathak @vikram-raj
const [revisions, revisionLoaded, revisionErrorLoad] = useK8sWatchResource<RevisionKind[]>({ | ||
kind: referenceForModel(RevisionModel), | ||
namespace: obj.metadata.namespace, | ||
isList: true, | ||
}); | ||
|
||
const revisionsForService = | ||
revisionLoaded && | ||
!revisionErrorLoad && | ||
revisions.filter( | ||
(revision) => | ||
_.get(revision.metadata, `labels["serving.knative.dev/service"]`) === obj.metadata.name, | ||
); |
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 think you can use a labelSelector
in useK8sWatchResource
to get only the matching revisions instead of loading all Revisions
and then filter them on the client.
<div className="col-md-6"> | ||
{isServerlessFunction(obj) && ( | ||
<DetailsItem label={t('knative-plugin~Type')} obj={obj}> | ||
{t('knative-plugin~Function')} | ||
</DetailsItem> | ||
)} | ||
{obj?.status?.url && ( | ||
<DetailsItem label={t('knative-plugin~URL')} obj={obj} path="status.url"> | ||
<ExternalLink | ||
href={obj.status.url} | ||
additionalClassName="co-external-link--block" | ||
text={obj.status.url} | ||
/> | ||
</DetailsItem> | ||
)} | ||
{revisionsForService && revisionLoaded && !revisionErrorLoad && ( | ||
<DetailsItem label={t('knative-plugin~Revisions')} obj={obj} path="status.traffic"> | ||
<RevisionsOverviewList | ||
revisions={revisionsForService} | ||
service={obj} | ||
hideSectionHeading | ||
/> | ||
</DetailsItem> | ||
)} | ||
</div> |
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 DetailsItem
component renders dt
and dd
, these HTML elements must be wrapped in a dl
:
<div className="col-md-6">
<dl>
{isServerlessFunction(obj) && (
<DetailsItem label={t('knative-plugin~Type')} obj={obj}>
{t('knative-plugin~Function')}
</DetailsItem>
)}
...
export enum ServiceTypeValue { | ||
Functions = 'Functions', | ||
// eslint-disable-next-line @typescript-eslint/naming-convention | ||
'Non-functions' = 'Non-functions', | ||
} |
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's an enum that should not be related to the labels that are displayed to the user. So you should clean this up:
export enum ServiceTypeValue { | |
Functions = 'Functions', | |
// eslint-disable-next-line @typescript-eslint/naming-convention | |
'Non-functions' = 'Non-functions', | |
} | |
export enum ServiceTypeValue { | |
Function = 'Function', | |
Service = 'Service', | |
} |
If the value is what you render to the user, you should change that in that component.
} | ||
}, | ||
"flags": { | ||
"required": ["OPENSHIFT", "KNATIVE_SERVING", "KNATIVE_SERVING_SERVICE"] |
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 recently tried to remove all the OPENSHIFT flags as there is no dependency here to OPENSHIFT. It's a feature that works on all clusters with Knative.
"required": ["OPENSHIFT", "KNATIVE_SERVING", "KNATIVE_SERVING_SERVICE"] | |
"required": ["KNATIVE_SERVING", "KNATIVE_SERVING_SERVICE"] |
"component": { "$codeRef": "overviewComponent.FunctionDetailsPage" } | ||
}, | ||
"flags": { | ||
"required": ["OPENSHIFT", "KNATIVE_SERVING", "KNATIVE_SERVING_SERVICE"] |
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.
Same as above. It's a feature that works on all clusters with Knative. Please remove OPENSHIFT from the dependency list:
"required": ["OPENSHIFT", "KNATIVE_SERVING", "KNATIVE_SERVING_SERVICE"] | |
"required": ["KNATIVE_SERVING", "KNATIVE_SERVING_SERVICE"] |
/retest |
@lokanandaprabhu: The following test failed, say
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. |
Addressed all review comments in PR - #13174 |
Closing this PR since PR - #13174 handles this feature story as well. /close |
@lokanandaprabhu: Closed this PR. 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. |
Story:
https://issues.redhat.com/browse/ODC-7377
Description:
In the developer perspective, in the left side navigation menu, added Functions tab inside Resources section, which list down all the serverless functions created for the specific namepsace and on click of function it opens the Service details tab
Screenshots:
Screen.Recording.2023-09-07.at.12.41.59.PM.mov
Tests: