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

feat(topology): topology view #891

Merged
merged 26 commits into from
Mar 11, 2023
Merged

feat(topology): topology view #891

merged 26 commits into from
Mar 11, 2023

Conversation

tthvo
Copy link
Member

@tthvo tthvo commented Feb 21, 2023

Welcome to Cryostat! 👋

Before contributing, make sure you have:

  • Read the contributing guidelines
  • Linked a relevant issue which this PR resolves
  • Linked any other relevant issues, PR's, or documentation, if any
  • Resolved all conflicts, if any
  • Rebased your branch PR on top of the latest upstream main branch
  • Attached at least one of the following labels to the PR: [chore, ci, docs, feat, fix, test]
  • Signed the last commit: git commit --amend --signoff

Fixes: #678, #752 (topology)
Fixes: #666, #429, #867 (targetSelect)
Fixes: #594 (test connection)
Depends on https://github.com/cryostatio/cryostat/pull/1389

Description of the change:

This PR includes the new Topology to view discovered targets along with their group/realm. Remaining tasks:

  • Search with match expressions
  • Filters
    • Name
    • Labels
    • Target Only
      • Annotations
      • JVM ID
      • Alias
      • ConnectUrl
  • Implement a simple catalog view of possible entity that can added to topology view (shown when clicked on left-most icon in the toolbar). Currently, only custom target is allowed. Maybe later we can have others, for examples, notes.
    • Listen to ctrl + space to open menu (in a modal).
    • Right click to have a "mini-version" of above menu (a floating menu)
  • Populate resource tab for target detail panel. All should have a link button to switch to that view.
    • Number of active recordings
    • Number of archives
    • Number of event templates
    • Number of enabled event types
    • Listen to corresponding events
    • Related resources (i.e. target does not "own" these resources).
      • Number of matching credentials
      • Number of matching rules
  • Add back skip-to-content with css fix. Final patch will be included after [Bug] Rendering odd whitespace at end of page #863
  • Refine error display. Only JVMID is checked now and only add-credential action is now displayed.
  • Save graph position when possible.
  • Refine model transformation
    • Should work with highly nested tree (k8s/ocp).
    • Should work with single layer of internal nodes.
    • Allow showing grouping by only top-level realm. What about namespace-only (its not top-level realm node)?
    • Mirror this behavior for listview.
  • Various chores to fix eslint errors and cleaner look.
  • Duplicate/Reuse functionalities to listview
  • Restyle group (custom hull? custom handling node layout?) to avoid odd behavior that causes re-position while lay-outing children.
  • Fix affected tests (no new tests).
  • TargetSelect should take in some pre-filled or default to current global target.
  • Automated Rule form should not listen to global target (but rather TargetSelect).

Note: intentionally left out localizations and tests to keep the PR less clustered. Will include those changes as a follow-up PR.

Motivation for the change:

See #678

How to manually test:

  • Go to Topology Tab under sidecar.
  • Go to any view to see the latest top-left target selector. Test out search and favorite features.
  • Go Dashboard Settings in /settings to see the latest local target selector. Similarly, go/create-rule and /security (credential modal).
  • To save time deploying on real cluster, you can substitute discovery tree with this json object: https://gist.github.com/tthvo/72c7a0a6cd1eb36cc8616d4adf0211f7 or its already saved under @test/resources.

@tthvo
Copy link
Member Author

tthvo commented Feb 21, 2023

Just in draft right now as filtering and tree-walk function needs closer look. This works only in local dev (exploring how it is in OCP now - nested groups are gonna be pretty clustered so need further restyling). Let me know how it looks or any functionalities that you want to add in :D

@andrewazores
Copy link
Member

Wow, this looks amazing. My mind is pretty blown :-)

When I click on the link from the Topology view to add credentials for a target:

image

it would be cool if not only were I directed to the Security view but also if the credentials adding dialog could be drawn up immediately, too. Or maybe the modal can just be drawn up on top of the Topology view without directing to Security at all.

Also, maybe this is just the design guidelines for the PF Topology view, but I find that the connection test on the new custom target creation form is not very obvious. It took me a minute to realize that logo element was clickable. Maybe something like https://rxjs.dev/api/operators/throttleTime / https://rxjs.dev/api/operators/debounceTime on the text input fed into the testing function automatically would be helpful?

image

And if the test fails, the creation button should probably be disabled (until the connection URL input is changed) since we can now predict that the action is going to fail anyway.

@tthvo
Copy link
Member Author

tthvo commented Feb 21, 2023

Also, maybe this is just the design guidelines for the PF Topology view, but I find that the connection test on the new custom target creation form is not very obvious. It took me a minute to realize that logo element was clickable. Maybe something like https://rxjs.dev/api/operators/throttleTime / https://rxjs.dev/api/operators/debounceTime on the text input fed into the testing function automatically would be helpful?

Ahhh actually I designed this layout to to replace the Test text button...Turned out not to be too obvious then. I will test out with the automatic testing here but will keep the clickable sample target node and maybe mention this in the top alert banner of the form + add a quickstart (if possible) + a blog post on this?

@andrewazores
Copy link
Member

Sounds good, though I don't think a blog post is necessary just for this aspect. A post covering the topology view as a whole would be great. Ideally the test button should look button-y and be discoverable/obvious to the user just looking at the view, without having to go look at some other documentation to figure out how to operate it.

@tthvo
Copy link
Member Author

tthvo commented Feb 21, 2023

Okayyy maybe a hint text right under the button would also help + mentioning in the top banner then :D

@tthvo
Copy link
Member Author

tthvo commented Feb 21, 2023

it would be cool if not only were I directed to the Security view but also if the credentials adding dialog could be drawn up immediately, too. Or maybe the modal can just be drawn up on top of the Topology view without directing to Security at all

On this one, could u check the latest commit to see if that is what we want?

Also, maybe this is just the design guidelines for the PF Topology view, but I find that the connection test on the new custom target creation form is not very obvious. It took me a minute to realize that logo element was clickable. Maybe something like https://rxjs.dev/api/operators/throttleTime / https://rxjs.dev/api/operators/debounceTime on the text input fed into the testing function automatically would be helpful?

Maybe I don't have a clear idea but would there be problems:

  1. What if the latest input test is throttled (the user stops typing) and the validation state is now shown by the previous one?
  2. What if one input test request is slow for some reason and comes after the newer test request. Then, its state will override the newer one? Probably can be solved in switchMap.
  3. How is this automatic testing affects the backend load? Seems like we can DoS ourselves?

Maybe adding helper text to make the button (sample target node) functionality stands out makes the most sense?

Screenshot from 2023-02-21 18-35-34

@andrewazores
Copy link
Member

What if the latest input test is throttled (the user stops typing) and the validation state is now shown by the previous one?

The idea is just to prevent too many tests from being performed on the input while it's changing, so once the input has settled for some time there would be a "final" observable emission that would go through the pipeline and end up as a connection test call.

What if one input test request is slow for some reason and comes after the newer test request. Then, its state will override the newer one? Probably can be solved in switchMap.

Possible yes, but as you say I think there's a way to solve this with the right kind of observable chaining, and by applying an appropriately slow/long debounce on the input changes.

How is this automatic testing affects the backend load? Seems like we can DoS ourselves?

Well... I hope not. This isn't a very expensive request and if it's debounced so that each individual web-client instance is only performing one request every second or so, DoSing should be unlikely.

@andrewazores
Copy link
Member

On this one, could u check the latest commit to see if that is what we want?

This is probably even better than what I was saying, I say stick with what you added here. The helper text for the test button is also probably enough, so no need to worry too much about the automatic testing thing.

@tthvo
Copy link
Member Author

tthvo commented Feb 22, 2023

@andrewazores Just wanna double check on this one. I added the resource tab for each target. Currently, it only shows the total of certain resource. Anything you think we should add in here? Each link should lead the users the corresponding view.

Screenshot from 2023-02-22 16-49-21

Screenshot from 2023-02-22 17-18-06

@andrewazores
Copy link
Member

Maybe the number of matching rules and credentials?

The links from that table to the views appear to work nicely, but navigating directly to those views from the main left side nav menu seems to be broken now.

@tthvo
Copy link
Member Author

tthvo commented Feb 23, 2023

Opps i forgot to check null XD

@tthvo
Copy link
Member Author

tthvo commented Feb 23, 2023

Rebasing causes this CACHE_CHECKSUM_MISMATCH:

@babel/template@npm:7.18.10: The remote archive doesn't match the expected checksum

Not sure what happens to this package checksum (maybe backports? updates?). So I have to clean cache and use YARN_CHECKSUM_BEHAVIOUR=update to fix (seems to fix and no visible problems at the moment)...

@tthvo tthvo added needs-triage Needs thorough attention from code reviewers and removed needs-triage Needs thorough attention from code reviewers labels Feb 27, 2023
@andrewazores
Copy link
Member

Screenshot_2023-03-10_15-50-49

This is an existing "vulnerability" from before this PR anyway, but I don't think it poses any real risk since again this is exactly equivalent to the built-in JS console in the browser.

@github-actions
Copy link

Test image available:

CRYOSTAT_IMAGE=ghcr.io/cryostatio/cryostat-web:pr-891-dc6ee80f3804bdb86900c9ee7c6a9bdfab12a156 sh smoketest.sh

@maxcao13
Copy link
Member

Gotcha, makes sense to me then. Thanks for the explanation!

@maxcao13
Copy link
Member

One last thing:
image

I think these Details fields should be selectable like text?

@tthvo
Copy link
Member Author

tthvo commented Mar 10, 2023

I think these Details fields should be selectable like text?

Unfortunately, the TreeView component seems to wrap that view in a button which causes it not to be selectable...

Screenshot from 2023-03-10 16-37-35

Warning: validateDOMNesting(...): <button> cannot appear as a descendant of <button>.

This comes up whenrendering the action dropdown in the detail view.

@github-actions
Copy link

Test image available:

CRYOSTAT_IMAGE=ghcr.io/cryostatio/cryostat-web:pr-891-7f187ac2e75dfef2791c8ae3c307d6fefcd0a599 sh smoketest.sh

@github-actions
Copy link

Test image available:

CRYOSTAT_IMAGE=ghcr.io/cryostatio/cryostat-web:pr-891-896ad082f67d83463ec7f89acdd8ece321d026e5 sh smoketest.sh

@andrewazores
Copy link
Member

image

image

Typing in the filter box doesn't seem to do anything?

@tthvo
Copy link
Member Author

tthvo commented Mar 10, 2023

A little weird that the compareTo function is given different arguments if select Option is not in a group. Fixed now thanks!

@github-actions
Copy link

Test image available:

CRYOSTAT_IMAGE=ghcr.io/cryostatio/cryostat-web:pr-891-aebdddcb11328c943ef9aecd67cee7e22ee70663 sh smoketest.sh

@github-actions
Copy link

Test image available:

CRYOSTAT_IMAGE=ghcr.io/cryostatio/cryostat-web:pr-891-c804149a57d9f060106e878445687129e7a2863f sh smoketest.sh

Copy link
Member

@maxcao13 maxcao13 left a comment

Choose a reason for hiding this comment

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

No other comments, looks great to me! Awesome job on this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat New feature or request safe-to-test
Projects
No open projects
Status: Done
3 participants