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(dashboard): implement embedded chart cards #856

Merged
merged 64 commits into from
Feb 10, 2023

Conversation

andrewazores
Copy link
Member

@andrewazores andrewazores commented Feb 3, 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: #847

Description of the change:

This adds a dashboard card implementation that can embed various Grafana metrics charts.

Motivation for the change:

Users do not need to use the View in Grafana... action on a specific recording to view metrics. Instead, they can simply configure a dashboard with the metrics that interest them, and select a target application. The metrics layout is as the user wishes, the source recording is started as needed, and the data is reloaded on a schedule to provide near-realtime metrics display.

image

@andrewazores andrewazores added the feat New feature or request label Feb 3, 2023
@mergify mergify bot added the safe-to-test label Feb 3, 2023
@github-actions
Copy link

github-actions bot commented Feb 3, 2023

Test image available:

CRYOSTAT_IMAGE=ghcr.io/cryostatio/cryostat-web:pr-856-8f65f9d47c5d2af12596a97aad607cb1af7861f6 sh smoketest.sh

@github-actions
Copy link

github-actions bot commented Feb 3, 2023

Test image available:

CRYOSTAT_IMAGE=ghcr.io/cryostatio/cryostat-web:pr-856-bbd5c4c098c8586d2046a37561c8fb2c6601587a sh smoketest.sh

@github-actions
Copy link

github-actions bot commented Feb 3, 2023

Test image available:

CRYOSTAT_IMAGE=ghcr.io/cryostatio/cryostat-web:pr-856-8a4531afe0b3e1f01849fc1df277e783f9a1790a sh smoketest.sh

@github-actions
Copy link

github-actions bot commented Feb 3, 2023

Test image available:

CRYOSTAT_IMAGE=ghcr.io/cryostatio/cryostat-web:pr-856-6da8c1cef1f2bff1e2bef47fbe28911d872704c6 sh smoketest.sh

@github-actions
Copy link

github-actions bot commented Feb 4, 2023

Test image available:

CRYOSTAT_IMAGE=ghcr.io/cryostatio/cryostat-web:pr-856-4c53024b10d17556dbcf4299036f80991c6b1824 sh smoketest.sh

@github-actions
Copy link

github-actions bot commented Feb 4, 2023

Test image available:

CRYOSTAT_IMAGE=ghcr.io/cryostatio/cryostat-web:pr-856-37ddb696de7314eae289eabd774fafcb5716fba8 sh smoketest.sh

@github-actions
Copy link

github-actions bot commented Feb 6, 2023

Test image available:

CRYOSTAT_IMAGE=ghcr.io/cryostatio/cryostat-web:pr-856-38e038b1edbce8423536604c6439ead6cf11c5e0 sh smoketest.sh

@github-actions
Copy link

github-actions bot commented Feb 7, 2023

Test image available:

CRYOSTAT_IMAGE=ghcr.io/cryostatio/cryostat-web:pr-856-56d211a33fa262bcd3fcacc2b435956500397a2c sh smoketest.sh

@github-actions
Copy link

github-actions bot commented Feb 7, 2023

Test image available:

CRYOSTAT_IMAGE=ghcr.io/cryostatio/cryostat-web:pr-856-08a15b4cd1ab1b512aedf0f584ba9bca368157b8 sh smoketest.sh

@github-actions
Copy link

github-actions bot commented Feb 7, 2023

Test image available:

CRYOSTAT_IMAGE=ghcr.io/cryostatio/cryostat-web:pr-856-0110a6516b2aa36dcfcc5b1fdec90d2290b1ad1d sh smoketest.sh

@github-actions
Copy link

github-actions bot commented Feb 7, 2023

Test image available:

CRYOSTAT_IMAGE=ghcr.io/cryostatio/cryostat-web:pr-856-ff79735ecf2d3058dbc538c0788286d1d6405e18 sh smoketest.sh

@github-actions
Copy link

github-actions bot commented Feb 7, 2023

Test image available:

CRYOSTAT_IMAGE=ghcr.io/cryostatio/cryostat-web:pr-856-160e02ead5496f1aa6ecadf06fa63b5e1c2ce09c sh smoketest.sh

@github-actions
Copy link

github-actions bot commented Feb 7, 2023

Test image available:

CRYOSTAT_IMAGE=ghcr.io/cryostatio/cryostat-web:pr-856-1f946bf2018def36193dab99b69b33c61d077ffc sh smoketest.sh

@github-actions
Copy link

github-actions bot commented Feb 7, 2023

Test image available:

CRYOSTAT_IMAGE=ghcr.io/cryostatio/cryostat-web:pr-856-e96a664109b00d25238cf38fa7595e94ad1ff1f1 sh smoketest.sh

@github-actions
Copy link

github-actions bot commented Feb 7, 2023

Test image available:

CRYOSTAT_IMAGE=ghcr.io/cryostatio/cryostat-web:pr-856-0b48b52c17d12ed6fff6c9bb214e2721343c61db sh smoketest.sh

@github-actions
Copy link

github-actions bot commented Feb 7, 2023

Test image available:

CRYOSTAT_IMAGE=ghcr.io/cryostatio/cryostat-web:pr-856-b354770b9b1ec4173269830440bd125d64e2320f sh smoketest.sh

@andrewazores andrewazores marked this pull request as ready for review February 8, 2023 18:48
@github-actions
Copy link

github-actions bot commented Feb 8, 2023

Test image available:

CRYOSTAT_IMAGE=ghcr.io/cryostatio/cryostat-web:pr-856-763078c67bf4232c92fab2d14db7a6f659c213c6 sh smoketest.sh

@github-actions
Copy link

github-actions bot commented Feb 8, 2023

Test image available:

CRYOSTAT_IMAGE=ghcr.io/cryostatio/cryostat-web:pr-856-ce4dc786a406706988a134819eb9107399e147e0 sh smoketest.sh

Copy link
Member

@tthvo tthvo left a comment

Choose a reason for hiding this comment

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

I am wondering how we are going to handle multiple accesses from different web console instances (2 tabs or 2 people looking at cryostat). For example, one person is looking at 9093 and another person enters dashboard and choose another target 9091. This will override datasource data.

This will make the first person dashboard outdated and rendering empty data at some point?

@andrewazores
Copy link
Member Author

I am wondering how we are going to handle multiple accesses from different web console instances (2 tabs or 2 people looking at cryostat). For example, one person is looking at 9093 and another person enters dashboard and choose another target 9091. This will override datasource data.

This will make the first person dashboard outdated and rendering empty data at some point?

Correct. This is just a limitation of the stateful jfr-datasource model we have right now. In the feature documentation we will need to call this out and explain it to the user. Maybe for this reason it also makes sense to downgrade the feature level to BETA.

In the future when we have a smarter jfr-datasource that can handle multiple source recordings and integration with Grafana panels (or custom charts) that know how to perform queries across different sources, then this problem should basically just disappear as a consequence.

@tthvo
Copy link
Member

tthvo commented Feb 9, 2023

Oh cool make sense! Do you plan to fix the drag and resize issue here too?

@andrewazores
Copy link
Member Author

Oh cool make sense! Do you plan to fix the drag and resize issue here too?

Yes, I'll do that next after I finish up with trying to genericize and refactor out the renderChartCard function.

@github-actions
Copy link

github-actions bot commented Feb 9, 2023

Test image available:

CRYOSTAT_IMAGE=ghcr.io/cryostatio/cryostat-web:pr-856-63a5ca22273d6461792930c14e155d5313f6e772 sh smoketest.sh

@github-actions
Copy link

github-actions bot commented Feb 9, 2023

Test image available:

CRYOSTAT_IMAGE=ghcr.io/cryostatio/cryostat-web:pr-856-2cc6b03af01bcd26a307f897fd7f43f681c86908 sh smoketest.sh

Copy link
Member

@tthvo tthvo left a comment

Choose a reason for hiding this comment

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

Looks very niceee to me! The resize and drag is working as expected :D

"CHART_CARD": {
"BUTTONS": {
"CREATE": {
"LABEL": "Create"
Copy link
Member

Choose a reason for hiding this comment

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

I notice these aria-labels have a different scheme from some other aria labels in the file
e.g.

  "DateTimePicker": {
    "ARIA_LABELS": {
      "DISPLAY_SELECTED_DATETIME": "Displayed selected datetime",
      "TABS": "Select a date or time tab"
    },
    "SELECTED_DATETIME": "Selected DateTime"
  },
  "MeridiemPicker": {
    "ARIA_LABELS": {
      "LISTBOX": "Select AM or PM"
    }
  },

Maybe either change this or we should change the other ones to keep consistency?

Copy link
Member

Choose a reason for hiding this comment

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

We probably need to document key format somewhere too

Copy link
Member Author

Choose a reason for hiding this comment

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

You mean just change the way that the key is split up? Or change the actual localized text?

Copy link
Member

Choose a reason for hiding this comment

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

I mean the way the key is split up. Maybe we should have

"DateTimePicker": {
    "TABS": {  
          "LABEL": "Select a date or time tab"
     }

in the same format in this PR that you have done here. If so, then that's okay to change in a separate refactor PR.

Just keeping a consistent key format.

Copy link
Member Author

Choose a reason for hiding this comment

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

Sure, I don't really mind either way. I think there probably are/will be instances where the aria-label matches some text that is visually rendered, so specifying ARIA_LABELS as part of the key maybe doesn't make the most sense.

@tthvo
Copy link
Member

tthvo commented Feb 10, 2023

In the feature documentation we will need to call this out and explain it to the user.

Not for this PR, I am thinking of something like a banner to show on web console when in BETA mode like this:

Screenshot from 2023-02-09 20-52-44

If the description is too long, we can just link to upstream docs or dev posts.

@maxcao13
Copy link
Member

Looking good! Just couple comments above.

Also, i noticed that iframeare being reinitialized when reordering. Came across this one

facebook/react#858

Not sure if we can do anything about that. I tried React.useMemo but still not really helping.

It is indeed slightly annoying, but only because the re-ordering functionality is tied in with the order that the card elements are being attached to the DOM. It doesn't have to actually be this way since Patternfly grid uses the grid-order for its ordering which is just a css attribute, however I implemented the drag drop keeping the JS list order in mind which it is just a bit more intuitive. There will just need to a bit of refactoring with how the drag and drop works, but its probably not horrible. If you guys think this is important, I will look into a patch.

@andrewazores
Copy link
Member Author

In the feature documentation we will need to call this out and explain it to the user.

Not for this PR, I am thinking of something like a banner to show on web console when in BETA mode like this:

Screenshot from 2023-02-09 20-52-44

If the description is too long, we can just link to upstream docs or dev posts.

Sounds good. That's more along the lines of how the old OSIO project did feature flagging IIRC, which is what inspired the feature flags here too.

@andrewazores
Copy link
Member Author

Looking good! Just couple comments above.
Also, i noticed that iframeare being reinitialized when reordering. Came across this one
facebook/react#858
Not sure if we can do anything about that. I tried React.useMemo but still not really helping.

It is indeed slightly annoying, but only because the re-ordering functionality is tied in with the order that the card elements are being attached to the DOM. It doesn't have to actually be this way since Patternfly grid uses the grid-order for its ordering which is just a css attribute, however I implemented the drag drop keeping the JS list order in mind which it is just a bit more intuitive. There will just need to a bit of refactoring with how the drag and drop works, but its probably not horrible. If you guys think this is important, I will look into a patch.

File an issue for it and we'll keep it as a lower priority item to tackle if there is time for this release.

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.

Everything looks good to me then! Great work.

@andrewazores
Copy link
Member Author

Will merge as soon as unblocked on cryostatio/cryostat-grafana-dashboard#20 .

@github-actions
Copy link

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
Development

Successfully merging this pull request may close these issues.

[Task] Grafana Cards
3 participants