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

adds support for creation of eventSources and form for CronJobSource #4748

Merged

Conversation

invincibleJai
Copy link
Member

@invincibleJai invincibleJai commented Mar 17, 2020

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:
ezgif com-video-to-gif (1)

Unit test coverage report:
Screenshot 2020-03-17 at 11 39 50 AM
Screenshot 2020-03-17 at 12 20 14 PM
Screenshot 2020-03-17 at 12 58 48 PM

Browser conformance:

  • Chrome
  • Firefox
  • Safari
  • Edge

cc @openshift/team-devconsole-ux @serenamarie125

@openshift-ci-robot openshift-ci-robot added component/dev-console Related to dev-console component/knative Related to knative-plugin approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Mar 17, 2020
@invincibleJai invincibleJai force-pushed the feat-event-src-creation branch 4 times, most recently from e54036f to 0f93dcd Compare March 17, 2020 16:19
helperText="Select an Service to sink to."
isRequired
>
<Dropdown
Copy link
Contributor

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.

Copy link
Member Author

Choose a reason for hiding this comment

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

yeah , have used it this way to show resource badge as well i.e ksvc here as later sink will not be limited to knative service , then it'll be useful. WDYT?

Screenshot 2020-03-18 at 1 01 00 PM

Copy link
Contributor

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

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.

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?

@invincibleJai
Copy link
Member Author

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

Screenshot 2020-03-19 at 8 12 23 AM

@serenamarie125
Copy link
Contributor

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

@andrewballantyne
Copy link
Contributor

/kind feature

@openshift-ci-robot openshift-ci-robot added the kind/feature Categorizes issue or PR as related to a new feature. label Mar 19, 2020
Comment on lines 128 to 130
navigateTo(e, `/event-source?preselected-ns=${activeNamespace}`)
}
href={`/event-source?preselected-ns=${activeNamespace}`}
Copy link
Contributor

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?

Copy link
Member Author

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

Copy link
Contributor

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.

);
return (
<FormSection title="Type" fullWidth>
<div id="event-source-selector-field" className="odc-event-source-selector">
Copy link
Contributor

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?

onChange: (name: string) => void;
}

const BuilderImageCard: React.FC<BuilderImageCardProps> = ({
const SelectorCard: React.FC<SelectorCardProps> = ({
Copy link
Contributor

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.

Copy link
Member Author

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

Copy link
Contributor

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.

Copy link
Member Author

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 :)

@openshift-ci-robot openshift-ci-robot added component/shared Related to console-shared and removed approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Mar 20, 2020
@invincibleJai invincibleJai force-pushed the feat-event-src-creation branch 2 times, most recently from 57b35e7 to 0add520 Compare March 20, 2020 14:55
title: string;
displayName: string;
iconUrl?: string;
[x: string]: any;
Copy link
Contributor

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.

Comment on lines 36 to 39
<img className="odc-selector-card__icon" src={iconUrl} alt={displayName} />
</CardHeader>
<CardBody>
<span className="odc-selector-card__title">{title}</span>
Copy link
Contributor

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.

Copy link
Member Author

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);

https://github.com/openshift/console/blob/master/frontend/packages/dev-console/src/utils/imagestream-utils.ts#L128

https://github.com/openshift/console/blob/master/frontend/packages/dev-console/src/utils/imagestream-utils.ts#L98-L102

i need to change across let me know as it may be confusing based on annotations name

title: string;
iconUrl: string;
name: string;
displayName: string;
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
displayName: string;
fullName?: string;

Comment on lines 128 to 130
navigateTo(e, `/event-source?preselected-ns=${activeNamespace}`)
}
href={`/event-source?preselected-ns=${activeNamespace}`}
Copy link
Contributor

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.

helperText="Select an Service to sink to."
isRequired
>
<Dropdown
Copy link
Contributor

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

@invincibleJai invincibleJai force-pushed the feat-event-src-creation branch 2 times, most recently from 2452ab7 to 532f1ea Compare March 23, 2020 15:10
Comment on lines 23 to 30
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>
);
Copy link
Contributor

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.

Copy link
Member Author

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

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}
Copy link
Contributor

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.

@christianvogt
Copy link
Contributor

/lgtm
/approve

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Mar 24, 2020
@openshift-ci-robot
Copy link
Contributor

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

@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Mar 24, 2020
@openshift-merge-robot openshift-merge-robot merged commit 8871465 into openshift:master Mar 24, 2020
@spadgett spadgett added this to the v4.5 milestone Mar 31, 2020
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/dev-console Related to dev-console component/knative Related to knative-plugin component/shared Related to console-shared kind/feature Categorizes issue or PR as related to a new feature. lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

9 participants