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

fix: Pass context to resource tree (#5468) #9401

Merged

Conversation

keithchong
Copy link
Contributor

@keithchong keithchong commented May 13, 2022

Signed-off-by: Keith Chong kykchong@redhat.com

For the PR #8996, the details page is supposed to pass the context to the resource tree. This is needed otherwise the menu actions on the pod will not work. (It's missing perhaps when I rebased (?) or for some other reason. It's already defined in the ApplicationResourceTreeProps properties for this very purpose.) This fix also includes the change to fix the sonarcloud issue where the map is empty.

This is a bug fix with no open issue. It (the context) should have been part of the above PR to fix issue #5468.

Note on DCO:

If the DCO action in the integration test fails, one or more of your commits are not signed off. Please click on the Details link next to the DCO action for instructions on how to resolve this.

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).
  • I've included "Closes [ISSUE #]" or "Fixes [ISSUE #]" in the description to automatically close the associated issue.
  • I've updated both the CLI and UI to expose my feature, or I plan to submit a second PR with them.
  • Does this PR require documentation updates?
  • I've updated documentation as required by this PR.
  • Optional. My organization is added to USERS.md.
  • I have signed off all my commits as required by DCO
  • 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).

@keithchong keithchong requested a review from rbreeze May 13, 2022 14:13
@keithchong
Copy link
Contributor Author

keithchong commented May 13, 2022

Hi @rbreeze, please review this. Two of the menu actions on the pod within the pod group do not work because of it. I also included the fix for the sonarcloud warning.

While fixing this, I noticed the pod's menu is not consistent. The new Exec shell action is not everywhere, and the Logs action doesn't appear in all instances. I've added a comment here to take care of this: #9338 (comment)

@codecov
Copy link

codecov bot commented May 13, 2022

Codecov Report

Merging #9401 (8be597d) into master (68a0a83) will decrease coverage by 0.44%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##           master    #9401      +/-   ##
==========================================
- Coverage   46.22%   45.78%   -0.45%     
==========================================
  Files         218      220       +2     
  Lines       25914    26170     +256     
==========================================
+ Hits        11978    11981       +3     
- Misses      12278    12531     +253     
  Partials     1658     1658              
Impacted Files Coverage Δ
util/settings/settings.go 48.16% <0.00%> (ø)
pkg/apiclient/grpcproxy.go 0.00% <0.00%> (ø)
pkg/apiclient/apiclient.go 0.68% <0.00%> (ø)
server/server.go 54.28% <0.00%> (+0.15%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 68a0a83...8be597d. Read the comment docs.

@keithchong keithchong force-pushed the 5468-bugPassContextToResourceTree branch from d055096 to 007df3e Compare May 13, 2022 18:49
@@ -327,6 +327,7 @@ export const describeNode = (node: ResourceTreeNode) => {

function processPodGroup(targetPodGroup: ResourceTreeNode, child: ResourceTreeNode, props: ApplicationResourceTreeProps) {
const statusByKey = new Map<string, models.ResourceStatus>();
props.app.status?.resources?.forEach(res => statusByKey.set(nodeKey(res), res));
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is it possible to construct the map more expressively in a single line, rather than creating and then populating the dictionary?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi @crenshaw-dev , I cleaned this up some more. So a bit of context first. This pod group is different than the pod group in the Pods view. I have a part two issue, #9338, to make the pod group a common component. The pod group in the tree/network view is different currently, because the layout makes the animation a lot nicer, and the placement of the various statuses are consistent with the other tree nodes. (See videos in the original PR #8996)

The resourceStatus and status in question are actually not used here when I render the pod group. I used the 'existing' way to render the status, here:

{healthState != null && <HealthStatusIcon state={healthState} />}

Compare it to the pods view, where it uses this resourceStatus property:

this.props.app.status?.resources?.forEach(res => statusByKey.set(nodeKey(res), res));

and

So to finally answer your question, for now, we can just get rid of that map. I've updated the PR. We'll have to refactor this when we do: #9338

Signed-off-by: Keith Chong <kykchong@redhat.com>
@keithchong keithchong force-pushed the 5468-bugPassContextToResourceTree branch from 007df3e to 8be597d Compare May 13, 2022 19:12
Copy link
Member

@rbreeze rbreeze left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Collaborator

@alexmt alexmt left a comment

Choose a reason for hiding this comment

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

Thank you!

@alexmt alexmt merged commit 1186fee into argoproj:master May 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants