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

chore(deps): upgrade argo-ui, including breaking changes #19655

Merged

Conversation

agilgur5
Copy link

@agilgur5 agilgur5 commented Aug 22, 2024

Motivation

As requested in argoproj/argo-ui#535 (review)
Upgrade to the latest version of argo-ui, resolve breakage, and fix a bug in CD via the upgrade

Modifications

Fixes #16745 via argoproj/argo-ui#546, which is included in this upgrade

Checklist:

  • Either (a) I've created an enhancement proposal and discussed it with the community, (b) this is a bug fix, or (c) this does not need to be in the release notes.
  • The title of the PR states what changed and the related issues number (used for the release note).
  • The title of the PR conforms to the Toolchain Guide
  • I've included "Closes [ISSUE #]" or "Fixes [ISSUE #]" in the description to automatically close the associated issue.
  • [n/a] I've updated both the CLI and UI to expose my feature, or I plan to submit a second PR with them.
  • [no] Does this PR require documentation updates?
  • [n/a] I've updated documentation as required by this PR.
  • I have signed off all my commits as required by DCO
  • [n/a] I have written unit and/or e2e tests for my change. PRs without these are unlikely to be merged.
  • My build is green (troubleshooting builds).
  • [n/a] My new feature complies with the feature status guidelines.
  • I have added a brief description of why this PR is necessary and/or what this PR solves.
  • [n/a] Optional. My organization is added to USERS.md.
  • Optional. For bug fixes, I've indicated what older releases this fix should be cherry-picked into (this may or may not happen depending on risk/complexity).

@agilgur5 agilgur5 requested a review from a team as a code owner August 22, 2024 22:54
Copy link

bunnyshell bot commented Aug 22, 2024

❌ Preview Environment deleted from Bunnyshell

Available commands (reply to this comment):

  • 🚀 /bns:deploy to deploy the environment

Copy link

bunnyshell bot commented Aug 22, 2024

❌ Preview Environment deleted from Bunnyshell

Available commands (reply to this comment):

  • 🚀 /bns:deploy to deploy the environment

- upgrade to https://github.com/argoproj/argo-ui/tree/a7b01f9f009aa9161da21f450b5aab2f0732eb74

- `moment` is no longer used internally by `argo-ui`, so change `Ticker` usage to account for this
  - CD should also remove the deprecated `moment` library for the same reasons as downstream and Workflows

Signed-off-by: Anton Gilgur <agilgur5@gmail.com>
@agilgur5 agilgur5 force-pushed the refactor-deps-argo-ui-ticker-moment branch from 370a5ac to 8f44ca8 Compare August 22, 2024 22:55
@agilgur5 agilgur5 requested a review from crenshaw-dev August 22, 2024 22:57
@agilgur5 agilgur5 added dependencies Pull requests that update a dependency file component:ui User interfaces bugs and enhancements javascript Pull requests that update Javascript code labels Aug 22, 2024
Signed-off-by: Anton Gilgur <agilgur5@gmail.com>
@agilgur5
Copy link
Author

agilgur5 commented Aug 22, 2024

Ah type-checking failed as I appear to have forgotten to make durationS / durationMs optional in the types upstream (c.f. argoproj/argo-ui#535 (comment)), woops:

yarn run v1.22.22
$ tsc --noEmit --project ./src/app && eslint
Error: src/app/applications/components/application-deployment-history/application-deployment-history.tsx(43,56): error TS2[7](https://github.com/argoproj/argo-cd/actions/runs/10516846738/job/29139870127?pr=19655#step:7:8)41: Property 'durationS' is missing in type '{ durationMs: number; }' but required in type '{ durationMs: number; durationS: number; }'.
Error: src/app/applications/components/application-deployment-history/application-deployment-history.tsx(55,30): error TS2741: Property 'durationS' is missing in type '{ durationMs: number; }' but required in type '{ durationMs: number; durationS: number; }'.
Error: src/app/applications/components/application-operation-state/application-operation-state.tsx(63,31): error TS2741: Property 'durationS' is missing in type '{ durationMs: number; }' but required in type '{ durationMs: number; durationS: number; }'.

I'll push a workaround here (setting the other to null), but should also fix those types there. Unfortunately can't quite do "one of" in TS though. EDIT: I decided to just remove the now deprecated durationMs in argoproj/argo-ui#577

Copy link
Member

@crenshaw-dev crenshaw-dev left a comment

Choose a reason for hiding this comment

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

Everything looks good except maybe the sync operation panel. Looks like the duration is missing there.
image

lmk if you want to test in the Bunnyshell instance, I can send you the credentials.

@agilgur5
Copy link
Author

Huh since it already finished, that should've actually short-circuited the changed code here 🤔

lmk if you want to test in the Bunnyshell instance, I can send you the credentials

Yea that would be helpful!

@agilgur5
Copy link
Author

agilgur5 commented Aug 25, 2024

Everything looks good except maybe the sync operation panel. Looks like the duration is missing there.

Oh, this is an edge case: it's a 0 second duration apparently. I suppose that's a bug in my refactor; the previous logic did handle 0 on this line, although not sure if it intentionally handled that 😅

I'll throw in another fix in argo-ui then

@agilgur5
Copy link
Author

agilgur5 commented Aug 25, 2024

No wait, the new logic (or well, newly switched to logic, the logic itself is still old) handles the 0 case as well. 🤔

@agilgur5
Copy link
Author

agilgur5 commented Aug 25, 2024

Oh, I think this will be fixed by argoproj/argo-ui#577 as well; the 0 edge case causes the parameter into formatDuration to be a little wacky due to the backward-compatible ||:

❯ node
Welcome to Node.js v20.6.0.
Type ".help" for more information.
> 0 || undefined
undefined
> 0 || null
null
> 0 || 0
0

And JS doesn't error when doing operations on null or undefined (see also https://www.destroyallsoftware.com/talks/wat), so it actually just returns false for every condition in formatDuration, ending up with an '' result.

The workaround here would be to use 0 for durationMs instead of null, but I'd rather just upgrade to the version after argoproj/argo-ui#577

Anton Gilgur added 2 commits August 25, 2024 10:25
bc in JS `0 || null == null`, so the edge case of a `0` duration caused the component to render just an empty string

Signed-off-by: Anton Gilgur <agilgur5@gmail.com>
Signed-off-by: Anton Gilgur <agilgur5@gmail.com>
@agilgur5 agilgur5 changed the title chore(deps): upgrade argo-ui, including one breaking change chore(deps): upgrade argo-ui, including breaking changes Sep 14, 2024
@agilgur5
Copy link
Author

Now that argoproj/argo-ui#577 has been merged, I've updated the code here as well

@crenshaw-dev
Copy link
Member

🔴 Preview Environment stopped on Bunnyshell

See: Environment Details | Pipeline Logs

Available commands (reply to this comment):

  • 🔵 /bns:start to start the environment
  • 🚀 /bns:deploy to redeploy the environment
  • /bns:delete to remove the environment

/bns:start

@crenshaw-dev
Copy link
Member

🔴 Preview Environment stopped on Bunnyshell

See: Environment Details | Pipeline Logs

Available commands (reply to this comment):

  • 🔵 /bns:start to start the environment
  • 🚀 /bns:deploy to redeploy the environment
  • /bns:delete to remove the environment

/bns:deploy

Copy link
Member

@crenshaw-dev crenshaw-dev left a comment

Choose a reason for hiding this comment

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

Local test checks out, thanks!

@crenshaw-dev crenshaw-dev merged commit cf498f6 into argoproj:master Oct 11, 2024
25 of 26 checks passed
@agilgur5 agilgur5 deleted the refactor-deps-argo-ui-ticker-moment branch October 12, 2024 05:50
austin5219 pushed a commit to austin5219/argo-cd that referenced this pull request Oct 16, 2024
…19655)

* chore(deps): upgrade `argo-ui`, including one breaking change

- upgrade to https://github.com/argoproj/argo-ui/tree/a7b01f9f009aa9161da21f450b5aab2f0732eb74

- `moment` is no longer used internally by `argo-ui`, so change `Ticker` usage to account for this
  - CD should also remove the deprecated `moment` library for the same reasons as downstream and Workflows

Signed-off-by: Anton Gilgur <agilgur5@gmail.com>

* type-check and format fixes

Signed-off-by: Anton Gilgur <agilgur5@gmail.com>

* set `durationMs={0}` instead of `null`

bc in JS `0 || null == null`, so the edge case of a `0` duration caused the component to render just an empty string

Signed-off-by: Anton Gilgur <agilgur5@gmail.com>

* update argo-ui once more for deprecated durationMs removal

Signed-off-by: Anton Gilgur <agilgur5@gmail.com>

---------

Signed-off-by: Anton Gilgur <agilgur5@gmail.com>
Signed-off-by: austin5219 <3936059+austin5219@users.noreply.github.com>
adriananeci pushed a commit to adriananeci/argo-cd that referenced this pull request Dec 4, 2024
…19655)

* chore(deps): upgrade `argo-ui`, including one breaking change

- upgrade to https://github.com/argoproj/argo-ui/tree/a7b01f9f009aa9161da21f450b5aab2f0732eb74

- `moment` is no longer used internally by `argo-ui`, so change `Ticker` usage to account for this
  - CD should also remove the deprecated `moment` library for the same reasons as downstream and Workflows

Signed-off-by: Anton Gilgur <agilgur5@gmail.com>

* type-check and format fixes

Signed-off-by: Anton Gilgur <agilgur5@gmail.com>

* set `durationMs={0}` instead of `null`

bc in JS `0 || null == null`, so the edge case of a `0` duration caused the component to render just an empty string

Signed-off-by: Anton Gilgur <agilgur5@gmail.com>

* update argo-ui once more for deprecated durationMs removal

Signed-off-by: Anton Gilgur <agilgur5@gmail.com>

---------

Signed-off-by: Anton Gilgur <agilgur5@gmail.com>
Signed-off-by: Adrian Aneci <aneci@adobe.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component:ui User interfaces bugs and enhancements dependencies Pull requests that update a dependency file javascript Pull requests that update Javascript code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

UI error message layout issue
2 participants