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
Bug 1918639: add missing trigger types and update the optional fields #7889
Bug 1918639: add missing trigger types and update the optional fields #7889
Conversation
/kind bug |
@karthikjeeyar: This pull request references Bugzilla bug 1918639, which is valid. The bug has been moved to the POST state. The bug has been updated to refer to the pull request using the external bug tracker. 3 validation(s) were run on this bug
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. |
64651a1
to
9e0d44b
Compare
This is a feature implementation. I discussed with @karthikjeeyar for us to focus on the fix here as a means not to crash the UI if they used the feature we don't support. Updating types are likely to stay as they are not user-facing and will help us not whitescreen. |
186df13
to
e69a9e3
Compare
@karthikjeeyar: This pull request references Bugzilla bug 1918639, which is valid. 3 validation(s) were run on this bug
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. |
@andrewballantyne I've updated the code to handle the UI crashes, conditional rendering of the supported resource-links in the evenlistener details page. |
e69a9e3
to
c7d5558
Compare
...packages/pipelines-plugin/src/components/pipelines/detail-page-tabs/EventListenerDetails.tsx
Outdated
Show resolved
Hide resolved
@@ -24,7 +24,7 @@ const EventListenerTriggers: React.FC<EventListenerTriggersProps> = ({ namespace | |||
<dd> | |||
{triggers.map((trigger) => { | |||
const triggerTemplateKind = referenceForModel(TriggerTemplateModel); | |||
const triggerTemplateName = trigger.template.name; | |||
const triggerTemplateName = trigger.template?.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.
If you don't have a template name, I think we need to return null
to just kill this node. No sense in trying to craft a broken block.
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.
filtering triggers based on template?.name and returning null early on in the component, so that <dt>Tiggers <dt>
is also not rendered.
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 there was a misunderstanding here.
You made this trigger.template?.name
optional, but it will fail to render properly if the triggerTemplateName
is undefined
. So we have to do something about the iterations of this map that do NOT have a triggerTemplateName
.
My recommendation is you return null
and drop this iteration from rendering a broken link. I'm open to other suggestions, but we can't just leave it.
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 made this trigger.template?.name optional, but it will fail to render properly if the triggerTemplateName is undefined. So we have to do something about the iterations of this map that do NOT have a triggerTemplateName.
I am filtering out the tirggers based on tempate.name on the top of this component now. so the map will only contain the set of triggers that consists of template.name.
...nes-plugin/src/components/pipelines/detail-page-tabs/__tests__/EventListenerDetails.spec.tsx
Outdated
Show resolved
Hide resolved
// Ref is used since Tekton Triggers 0.5 (part of OpenShift Pipeline Operator 1.1) | ||
ref: string; | ||
// Mutually exclusive with 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.
deleted my comment (see comment history if you care to read it) There was type compilation issues I didn't see before, probably not worth the hassle.
Honestly we probably won't keep this for much longer. Perhaps part of the new parity support in 4.8 we remove the legacy type.
frontend/packages/pipelines-plugin/src/components/pipelines/resource-types/triggers.ts
Show resolved
Hide resolved
frontend/packages/pipelines-plugin/src/components/pipelines/utils/triggers.ts
Outdated
Show resolved
Hide resolved
frontend/packages/pipelines-plugin/src/components/pipelines/utils/triggers.ts
Outdated
Show resolved
Hide resolved
frontend/packages/pipelines-plugin/src/components/pipelines/utils/triggers.ts
Outdated
Show resolved
Hide resolved
c7d5558
to
af682bd
Compare
@@ -24,7 +24,7 @@ const EventListenerTriggers: React.FC<EventListenerTriggersProps> = ({ namespace | |||
<dd> | |||
{triggers.map((trigger) => { | |||
const triggerTemplateKind = referenceForModel(TriggerTemplateModel); | |||
const triggerTemplateName = trigger.template.name; | |||
const triggerTemplateName = trigger.template?.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 there was a misunderstanding here.
You made this trigger.template?.name
optional, but it will fail to render properly if the triggerTemplateName
is undefined
. So we have to do something about the iterations of this map that do NOT have a triggerTemplateName
.
My recommendation is you return null
and drop this iteration from rendering a broken link. I'm open to other suggestions, but we can't just leave it.
/retest |
/cc |
af682bd
to
b861c72
Compare
@andrewballantyne I removed optional chaining as I have checks in the top of the component to early return null, if the template.name is not available in the triggers. |
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.
Thanks @karthikjeeyar Looks good 👍
/retest |
/override ci/prow/ceph-storage-plugin The ceph-storage-plugin job should only have run on PRs with changes to |
@spadgett: Overrode contexts on behalf of spadgett: ci/prow/ceph-storage-plugin 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. |
/retest |
/override ci/prow/ceph-storage-plugin |
@spadgett: Overrode contexts on behalf of spadgett: ci/prow/ceph-storage-plugin 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. |
...packages/pipelines-plugin/src/components/pipelines/detail-page-tabs/EventListenerDetails.tsx
Outdated
Show resolved
Hide resolved
b861c72
to
e923fc6
Compare
/lgtm Verified locally, works as expected |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: andrewballantyne, invincibleJai, karthikjeeyar 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 Please review the full test history for this PR and help us cut down flakes. |
1 similar comment
/retest Please review the full test history for this PR and help us cut down flakes. |
@karthikjeeyar: All pull requests linked via external trackers have merged: Bugzilla bug 1918639 has been moved to the MODIFIED state. 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. |
/cherry-pick release-4.6 |
@andrewballantyne: #7889 failed to apply on top of branch "release-4.6":
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. |
Fixes:
https://issues.redhat.com/browse/ODC-5350
Analysis / Root cause:
Event listeners has an optional
triggerRef
field which is not compatible in UI code causes the UI to crashSolution Description:
Add the missing trigger types such as
triggerRef
and update the checks for optional fields.Screen shots / Gifs for design review:
Eventlistener page:
Test setup:
Unit test cases:
EventListener Details
✓ should render eventlistener details page (25ms)
✓ should not render EventListenerTriggers section if the trigger contains binding ref (4ms)
✓ should not render EventListenerTriggers section if triggers contains triggerRef (3ms)
Browser conformance: