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

Improve upgradeView, reduce API calls #3540

Merged
merged 16 commits into from
Oct 11, 2021

Conversation

antgamdia
Copy link
Contributor

@antgamdia antgamdia commented Oct 4, 2021

Description of the change

The UpgradeView has been causing some headaches recently in CI, also, we got some issues and PR related to this view. This PR is aimed at addressing some of the issues, starting from reducing the number of redundant API calls we were making.
I've simplified the objects used there and, from now on, the source of truth is the react state.

The high-level logic is:

  1. AppUpgrade: get the parameters from the URL and load the installedApp_InstalledPackageDetail and installedApp_AvailablePackageDetail.
  2. UpgradeForm:
    1. Fetch the list of versions for this installed package
    2. If first time, mark as "selected" the currently deployed version (this prevents the blinking dropdown causing our tests to fail).
    3. Subsequent times, mark as select just what the user chooses via dropdown

Benefits

I hope the CI doesn't complain anymore about the failing upgrade.

Possible drawbacks

Unnoticed or unintended changes that lead to some unexpected behavior. However, I'll try to unit-test and e2e-test it as much as possible.

Applicable issues

Additional information

Marking as a draft as test are still pending
(personal note) merge and consider also this PR: https://github.com/kubeapps/kubeapps/pull/3525/files
Due to the myriad of changes in ongoing PRs, this one is likely subject to be modified while we merge some of them, (renaming, buttons using new API, etc). Holding off in the meantime.

image

issue3536Fix.mp4

New: a comparison between the current v2.4.1 approach and the proposed one in this PR. Note the changes are not updated between package versions in the v2.4.1 (which is a bug).

refactorAppUpgrade.mp4

Now just 3 calls are required

Signed-off-by: Antonio Gamez Diaz <[email protected]>
Signed-off-by: Antonio Gamez Diaz <[email protected]>
Signed-off-by: Antonio Gamez Diaz <[email protected]>
Signed-off-by: Antonio Gamez Diaz <[email protected]>
Signed-off-by: Antonio Gamez Diaz <[email protected]>

Conflicts:
	dashboard/src/components/AppUpgrade/AppUpgrade.tsx
	dashboard/src/components/UpgradeForm/UpgradeForm.tsx
@absoludity
Copy link
Contributor

Let me know when you want a review of this one.

Signed-off-by: Antonio Gamez Diaz <[email protected]>

Conflicts:
	dashboard/src/components/AppUpgrade/AppUpgrade.tsx
	dashboard/src/components/UpgradeForm/UpgradeForm.test.tsx
	dashboard/src/components/UpgradeForm/UpgradeForm.tsx
Signed-off-by: Antonio Gamez Diaz <[email protected]>

Conflicts:
	dashboard/src/components/UpgradeForm/UpgradeForm.tsx
Signed-off-by: Antonio Gamez Diaz <[email protected]>
Signed-off-by: Antonio Gamez Diaz <[email protected]>
Signed-off-by: Antonio Gamez Diaz <[email protected]>
Signed-off-by: Antonio Gamez Diaz <[email protected]>
Signed-off-by: Antonio Gamez Diaz <[email protected]>
Signed-off-by: Antonio Gamez Diaz <[email protected]>
@antgamdia antgamdia marked this pull request as ready for review October 8, 2021 15:35
@antgamdia
Copy link
Contributor Author

Let me know when you want a review of this one.

Ready :)

releaseName: string;
repoNamespace: string;
installedAppAvailablePackageDetail: AvailablePackageDetail;
installedAppInstalledPackageDetail: InstalledPackageDetail;
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice, not only does it mean that less events are triggered, but it's simpler to reason about too. Thanks for cleaning up the props.

@absoludity
Copy link
Contributor

I'm going to land this now so it has more time in development for us to find any issues, if they arise.

@absoludity absoludity merged commit e9a6b9c into vmware-tanzu:master Oct 11, 2021
@antgamdia antgamdia deleted the reduceCalls branch October 18, 2021 09:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants