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
adds support for creation of eventSources and form for CronJobSource #4748
adds support for creation of eventSources and form for CronJobSource #4748
Conversation
e54036f
to
0f93dcd
Compare
frontend/packages/knative-plugin/src/components/add/EventSource.tsx
Outdated
Show resolved
Hide resolved
frontend/packages/knative-plugin/src/components/add/EventSourceForm.tsx
Outdated
Show resolved
Hide resolved
frontend/packages/knative-plugin/src/components/add/EventSourceForm.tsx
Outdated
Show resolved
Hide resolved
frontend/packages/knative-plugin/src/components/add/EventSourceForm.tsx
Outdated
Show resolved
Hide resolved
frontend/packages/knative-plugin/src/components/add/EventSourceForm.tsx
Outdated
Show resolved
Hide resolved
frontend/packages/knative-plugin/src/components/add/event-sources/EventSourcesSelector.tsx
Outdated
Show resolved
Hide resolved
frontend/packages/knative-plugin/src/components/add/event-sources/EventSourcesSelector.tsx
Outdated
Show resolved
Hide resolved
frontend/packages/knative-plugin/src/components/add/event-sources/EventSourcesSelector.tsx
Outdated
Show resolved
Hide resolved
helperText="Select an Service to sink to." | ||
isRequired | ||
> | ||
<Dropdown |
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 not use the ResourceDropdown
component here? That way the component handles its own fetch logic and we do not need to fetch the resource in firehose in parent.
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.
Enhance the component to include the badges then?
Right now you have copied code from resource-dropdown
frontend/packages/knative-plugin/src/components/add/EventSourceForm.tsx
Outdated
Show resolved
Hide resolved
b40a742
to
79e7d80
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.
hey @invincibleJai this is looking great, any chance you can include a non animated gif of the form. I'd like to review the text it's a bit fuzzy for me to see!
I think we can add a temporary icon for the Add page, and we can have a follow up PR to put that in.
I did notice that there don't seem to have Adv Options available. We are supposed to, right?
@serenamarie125 here is screenshot and yes advance options will be there with resource limit and resource request. I'll be adding it as subsequent PRs (NOTE: CronJobSrc will be changed to Ping Source which isn't available in operstorHub but their spec are same). |
I was curious about the help text! I'll add a design story for us to clarify these details, and we can follow up later. This looks great ! Thanks for info on the Adv Options |
/kind feature |
navigateTo(e, `/event-source?preselected-ns=${activeNamespace}`) | ||
} | ||
href={`/event-source?preselected-ns=${activeNamespace}`} |
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.
Does preselected-ns
even do anything? I see it being used for the deploy image route as well.
@rohitkrai03 thoughts?
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.
not much which i saw, i added as was there for deploy image
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.
If it's not required, please remove here and for the other link.
frontend/packages/dev-console/src/components/import/builder/SelectorCard.scss
Outdated
Show resolved
Hide resolved
); | ||
return ( | ||
<FormSection title="Type" fullWidth> | ||
<div id="event-source-selector-field" className="odc-event-source-selector"> |
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.
This should be a reusable component so we don't duplicate styles.
Maybe even a reusable formik field?
frontend/packages/knative-plugin/src/components/add/event-sources/SinkSection.tsx
Outdated
Show resolved
Hide resolved
onChange: (name: string) => void; | ||
} | ||
|
||
const BuilderImageCard: React.FC<BuilderImageCardProps> = ({ | ||
const SelectorCard: React.FC<SelectorCardProps> = ({ |
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.
Would be useful as a reusable component along with the parent container. Maybe even a formik field.
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.
yeah, parent has lot of code which are coupled as it's used in git import and catalog
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.
Yeah, I like the idea of having a ImageSelectorField
that wraps all the logic and gives a clean API to use. It was not a shared component as there was no other use case for it till now. I had a discussion with Jai around this today and we came to a solution that works for both use cases.
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.
yeah , have updated the code PTAL :)
frontend/packages/knative-plugin/src/components/add/event-sources/SinkSection.tsx
Outdated
Show resolved
Hide resolved
frontend/packages/knative-plugin/src/components/add/event-sources/SinkSection.tsx
Outdated
Show resolved
Hide resolved
frontend/packages/knative-plugin/src/components/add/event-sources/SinkSection.tsx
Outdated
Show resolved
Hide resolved
frontend/packages/knative-plugin/src/components/add/event-sources/SinkSection.tsx
Outdated
Show resolved
Hide resolved
frontend/packages/knative-plugin/src/components/add/event-sources/SinkSection.tsx
Outdated
Show resolved
Hide resolved
79e7d80
to
4cb764f
Compare
frontend/packages/knative-plugin/src/components/add/EventSource.tsx
Outdated
Show resolved
Hide resolved
57b35e7
to
0add520
Compare
title: string; | ||
displayName: string; | ||
iconUrl?: string; | ||
[x: string]: any; |
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.
You shouldn't need this.
<img className="odc-selector-card__icon" src={iconUrl} alt={displayName} /> | ||
</CardHeader> | ||
<CardBody> | ||
<span className="odc-selector-card__title">{title}</span> |
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 know this is old code, but it's extremely odd that the display name is used as an image alt.
Perhaps rename to fullName
.
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.
While updating i came across this as i think it's referenced from annotations
const displayName = _.get(imageTag, ['annotations', 'openshift.io/display-name'], defaultName);
i need to change across let me know as it may be confusing based on annotations name
...nd/packages/console-shared/src/components/formik-fields/item-selector-field/SelectorCard.tsx
Outdated
Show resolved
Hide resolved
title: string; | ||
iconUrl: string; | ||
name: string; | ||
displayName: 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.
displayName: string; | |
fullName?: string; |
...nd/packages/console-shared/src/components/formik-fields/item-selector-field/SelectorCard.tsx
Outdated
Show resolved
Hide resolved
...ckages/console-shared/src/components/formik-fields/item-selector-field/ItemSelectorField.tsx
Outdated
Show resolved
Hide resolved
...ckages/console-shared/src/components/formik-fields/item-selector-field/ItemSelectorField.tsx
Outdated
Show resolved
Hide resolved
navigateTo(e, `/event-source?preselected-ns=${activeNamespace}`) | ||
} | ||
href={`/event-source?preselected-ns=${activeNamespace}`} |
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.
If it's not required, please remove here and for the other link.
frontend/packages/knative-plugin/src/components/add/event-sources/CronJobSection.tsx
Outdated
Show resolved
Hide resolved
helperText="Select an Service to sink to." | ||
isRequired | ||
> | ||
<Dropdown |
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.
Enhance the component to include the badges then?
Right now you have copied code from resource-dropdown
2452ab7
to
532f1ea
Compare
const DropdownItem: React.FC<DropdownItemProps> = ({ model, name }) => ( | ||
<span className="co-resource-item"> | ||
<span className="co-resource-icon--fixed-width"> | ||
<ResourceIcon kind={referenceForModel(model)} /> | ||
</span> | ||
<span className="co-resource-item__resource-name"> | ||
<span className="co-resource-item__resource-api co-truncate show co-nowrap small"> | ||
{name} | ||
</span> | ||
</span> | ||
</span> | ||
); |
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.
All these classes are part of resource-dropdown
.
We should not be reusing classes like this because that component could change and will break this component.
If we keep this here we need a tech debt item, and a comment, to cover fixing this issue.
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.
Have updated the classes, just used classes on PF i.e co-resource-item
and common styles
<br /> | ||
</> | ||
)} | ||
<FormGroup fieldId={fieldId} helperTextInvalid={errorMessage} isValid={isValid} isRequired> |
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.
Missing optional label
prop.
You may not use it now but as a re-usable field, it should be present.
label="Knative Service" | ||
resources={knativeServingResourcesServices(namespace)} | ||
dataSelector={['metadata', 'name']} | ||
key={namespace} |
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.
Do you specifically need a key
to force unmounting here? Otherwise remove the key.
532f1ea
to
f90c19d
Compare
f90c19d
to
3112220
Compare
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: christianvogt, invincibleJai 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 |
Fixes:
https://issues.redhat.com/browse/ODC-2521
Analysis / Root cause:
User can't create EventSources via webConsole
Solution Description:
Enable support to create Event Sources via Add Flow and added form for CronJobSource
Screen shots / Gifs for design review:
Unit test coverage report:
Browser conformance:
cc @openshift/team-devconsole-ux @serenamarie125