-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
refactor: simplify getPodName
and make consistent with back-end
#12964
Merged
isubasinghe
merged 8 commits into
argoproj:main
from
agilgur5:refactor-simplify-getPodName
Apr 23, 2024
Merged
refactor: simplify getPodName
and make consistent with back-end
#12964
isubasinghe
merged 8 commits into
argoproj:main
from
agilgur5:refactor-simplify-getPodName
Apr 23, 2024
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Signed-off-by: Anton Gilgur <agilgur5@gmail.com>
Signed-off-by: Anton Gilgur <agilgur5@gmail.com>
…ion call Signed-off-by: Anton Gilgur <agilgur5@gmail.com>
- cast the `NodeStatus` instead of filling it all out with unused fields Signed-off-by: Anton Gilgur <agilgur5@gmail.com>
these seemed to have accidentally diverged in 1e87159 Signed-off-by: Anton Gilgur <agilgur5@gmail.com>
This was referenced Apr 22, 2024
…'t been selected Signed-off-by: Anton Gilgur <agilgur5@gmail.com>
Signed-off-by: Anton Gilgur <agilgur5@gmail.com>
4 tasks
tczhao
approved these changes
Apr 23, 2024
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.
It's easier to read each commit independently than it is to read the PR as a whole, that's why I split them that way
This is gold
isubasinghe
approved these changes
Apr 23, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #6982 (comment), Fixes #9168 (comment)
Motivation
Simplify
getPodName
as it required lots of args that could be retrieved from the existing Workflow and Node. Simplify surrounding code as wellMake it more consistent to the back-end as well, particularly after #12928.
Modifications
simplify calls to
getPodName
to only require the Workflow and Node as argsworkflow-details.tsx
was particularly simplified as a result, a whole function was replaced with a one-linergetPodName
in the UI more closely matchGeneratePodName
on the back-endadjust
pod-name.test.ts
to match the modified argssimplify other parts of
pod-name.ts
simplify
getTemplateNameFromNode
to a one-liner that's easier to read and reads like the comment tooif (node.templateName)
checks forundefined
,''
, and othersnode?.
is not necessary per fix: Workflow details accessing undefined templateRef. Fixes #9167 #9168 (comment), and we can invert the conditional toif (node.templateRef?.template)
slightly optimize
ensurePodNamePrefixLength
by moving the static calculation ofmaxPrefixLength
into the module scope and outside the function scopepod_name.go
use named functions for better tracing compared to
const
variables assigned to anonymous functions, same as refactor(ui): use named functions for better tracing #12062 et alVerification
Existing tests pass
Also tested manually with the Workflow from #12895.
Screenshot:
Notes to Reviewers
It's easier to read each commit independently than it is to read the PR as a whole, that's why I split them that way
Future Work
pod-name.ts
should only beexport
inggetPodName
. the rest is not used anywhere except for the testsGeneratePodName
can similarly be simplified, but it requires a lot more refactoring of functions of up the chain