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

Bug 2018264: Delete Export button doesn't work in topology sidebar (general issue with unknown CSV?) #10457

Merged

Conversation

yozaam
Copy link
Contributor

@yozaam yozaam commented Nov 15, 2021

Fixes:

https://bugzilla.redhat.com/show_bug.cgi?id=2018264
https://issues.redhat.com/browse/OCPBUGSM-36630

Analysis / Root cause:

kind was undefined as it was passed in the props as kindObj

Solution Description:

If kind is undefined, then search for kindObj and also double check if kind is not undefined when accessing its property label

Screen shots / Gifs for design review:

deleteModalExport

Unit test coverage report:

Test setup:

Steps to Reproduce:

  1. Open Operator Hub and install the "Primer" GitOps Operator
  2. Switch to developer perspective
  3. Import at least one Application to enable the Export button in topology
  4. If not opened yet, open the topology, and click the "Export Application" button
  5. Wait until the export finishs and a new Deployment "primer-export-primer" was shown
  6. Click on surrounding CSV Export "Primer" to open the sidebar
  7. Click in the topology sidebar on Actions > Delete Export

Browser conformance:

  • Chrome
  • Firefox
  • Safari
  • Edge

@openshift-ci openshift-ci bot added the bugzilla/severity-medium Referenced Bugzilla bug's severity is medium for the branch this PR is targeting. label Nov 15, 2021
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Nov 15, 2021

@yozaam: This pull request references Bugzilla bug 2018264, 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
  • bug is open, matching expected state (open)
  • bug target release (4.10.0) matches configured target release for branch (4.10.0)
  • bug is in the state NEW, which is one of the valid states (NEW, ASSIGNED, ON_DEV, POST, POST)

Requesting review from QA contact:
/cc @sanketpathak

In response to this:

Bug 2018264: Delete Export button doesn't work in topology sidebar (general issue with unknown CSV?)

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.

@openshift-ci openshift-ci bot added the bugzilla/valid-bug Indicates that a referenced Bugzilla bug is valid for the branch this PR is targeting. label Nov 15, 2021
@openshift-ci openshift-ci bot added the component/core Related to console core functionality label Nov 15, 2021
@yozaam
Copy link
Contributor Author

yozaam commented Nov 15, 2021

/retest-required

Copy link
Member

@jerolimov jerolimov left a comment

Choose a reason for hiding this comment

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

First of all, your PR works fine. 😄 But the new prop type confuses me.

This is not what the DeleteModalProps "allows". kind is not optional, it should be defined. And if I search for deleteModal({ to get all code areas that want to open the delete modal, there is the only one that doesn't align with the other one.

(I believe) You can also fix this issue by changing csv-actions.ts to

        deleteModal({
          kind: kindObj,
          resource,
          // ...

Similar to the other deleteModal({ calls.

Can you please check if the other changes here are then required if this caller aka the root cause is fixed? Maybe an additional null check is still worth it!


After this fix, I have still a general concern with the old code. This issue is introduced because the deleteModal AND ALL OTHER functions exported in public/components/modals/index.ts don't define an argument type.

It would be cool if you can check if build, tests, etc. works fine if you define the deleteModal like this:

export const deleteModal = (props: DeleteModalProps) =>
  import('./delete-modal' /* webpackChunkName: "delete-modal" */).then((m) => m.deleteModal(props));

I have just quick checked this and notice multiple errors after adding DeleteModalProps

  • csv-actions.ts doesn't set the kind prop as mentioned above.
  • Some callers (csv-actions.ts and packages/operator-lifecycle-manager/src/components/operand/index.tsx) submits a namespace prop to the deleteModal function which is completely ignored! I think we can drop it from the caller code.
  • DeleteModalProps message prop is optional, only one caller submits this prop.
  • Some arguments are still missing, that happen because DeleteModalProps includes also & ModalComponentProps & HandlePromiseProps. For this, I would recommend just defining the DeleteModalProps with its own custom props.
export type DeleteModalProps = {
  kind: K8sKind;
  kindObj?: K8sKind;
  resource: any;
  close?: () => void;
  redirectTo?: any;
  message?: JSX.Element;
  cancel?: () => void;
  btnText?: string;
};

And then using these props in the function call as union type, like this:

const DeleteModal = withHandlePromise((props: DeleteModalProps & HandlePromiseProps) => {

ModalComponentProps is not used in this function, so I believe we can remove the import and ignore it as well.


Sorry, much longer than expected for an already working PR 👍 But I really think we should fix this without a new prop (which uses just another name) and I also would like to improve our TS strongly-type check quality here. Wdyt? :)

I also would like to create a tech dept story for the other missing modal props if this works fine for the delete modal.

@openshift-ci openshift-ci bot added the component/olm Related to OLM label Nov 17, 2021
@yozaam
Copy link
Contributor Author

yozaam commented Nov 17, 2021

Thank you @jerolimov
made the changes

Copy link
Member

@jerolimov jerolimov left a comment

Choose a reason for hiding this comment

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

Tested this locally and the code works fine for the broken as well as other known resources.

/lgtm
/approve

@jerolimov
Copy link
Member

/retest

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Nov 17, 2021
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Nov 17, 2021

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: jerolimov, yozaam

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 openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 17, 2021
@openshift-bot
Copy link
Contributor

/retest-required

Please review the full test history for this PR and help us cut down flakes.

10 similar comments
@openshift-bot
Copy link
Contributor

/retest-required

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest-required

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest-required

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest-required

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest-required

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest-required

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest-required

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest-required

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest-required

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest-required

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest-required

Please review the full test history for this PR and help us cut down flakes.

5 similar comments
@openshift-bot
Copy link
Contributor

/retest-required

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest-required

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest-required

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest-required

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest-required

Please review the full test history for this PR and help us cut down flakes.

@openshift-merge-robot openshift-merge-robot merged commit bec15d9 into openshift:master Nov 19, 2021
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Nov 19, 2021

@yozaam: All pull requests linked via external trackers have merged:

Bugzilla bug 2018264 has been moved to the MODIFIED state.

In response to this:

Bug 2018264: Delete Export button doesn't work in topology sidebar (general issue with unknown CSV?)

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.

@spadgett spadgett added this to the v4.10 milestone Dec 8, 2021
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. bugzilla/severity-medium Referenced Bugzilla bug's severity is medium for the branch this PR is targeting. bugzilla/valid-bug Indicates that a referenced Bugzilla bug is valid for the branch this PR is targeting. component/core Related to console core functionality component/olm Related to OLM lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants