Skip to content

Conversation

@rawagner
Copy link
Contributor

@rawagner rawagner commented May 21, 2019

This PR introduces dashboards page as designed in https://docs.google.com/document/d/1q0DIcUKgFhvNbtGt-SMl35Z2jHA_QO2r7aaBuFmwE2U/edit#heading=h.koix4vo7e16v

Dashboards page has its own redux store to be able to share resources (prometheus queries results, various url requests and in the future also k8s resources) between various dashboard cards and also dashboard tabs.

Dashboards page currently contains only one tab (Overview) - plan is to be able to contribute other tabs via static extension mechanism. Overview tab contains only one card - Health which can be extended via static plugin mechanism to show healths for other subsystems (ie KubeVirt or Storage).
Other cards will follow in separate PRs.

Dashboard page is not included in navigation yet, but can be accessed directly via /dashboards route.

Dashboards page - Overview tab
dashboard

Dashboards page - Overview tab with demo-plugin enabled
Screenshot from 2019-05-21 12-43-58

@vojtechszocs @cloudbehl

@openshift-ci-robot openshift-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label May 21, 2019
@openshift-ci-robot openshift-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label May 21, 2019
@openshift-ci-robot
Copy link
Contributor

Hi @rawagner. Thanks for your PR.

I'm waiting for a openshift member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@openshift-ci-robot openshift-ci-robot added the size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label May 21, 2019
@spadgett
Copy link
Member

/assign
/cc @alecmerdler

@spadgett
Copy link
Member

/ok-to-test

@openshift-ci-robot openshift-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels May 21, 2019
Copy link
Member

@spadgett spadgett left a comment

Choose a reason for hiding this comment

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

We should strive to build our UI by composing simple functional components instead of complicated class-based components.

Copy link
Member

Choose a reason for hiding this comment

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

Is this an HTTP method like GET, HEAD, etc. or something else? Should have a real type.

Copy link
Contributor Author

@rawagner rawagner May 29, 2019

Choose a reason for hiding this comment

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

changed this a bit and added better types to make it clear. Its not called fetchMethod, but fetch which adds possibility to specify custom function for fetching remote resources.

@rawagner
Copy link
Contributor Author

@spadgett thank you for the quick review! I will go through the comments and once done I will let you know.

@spadgett
Copy link
Member

We added this hook for polling prometheus to show area charts, and @TheRealJon is working on generalizing it so it's more generic.

https://github.com/openshift/console/blob/master/frontend/public/components/graphs/use-prometheus-poll.ts

Just wondering if it makes sense to use a similar approach for the dashboards. Then we have a consistent polling mechanism throughout console and avoid duplicate logic.

@spadgett
Copy link
Member

spadgett commented May 21, 2019

Dashboards page has its own redux store to be able to share resources (prometheus queries results, various url requests and in the future also k8s resources) between various dashboard cards and also dashboard tabs.

Do we have specific cases where prometheus query results are in fact shared across dashboard cards? I think this is where a lot of the complexity is coming in vs using a simple poll hook and a functional component.

@spadgett
Copy link
Member

#1596 adds the generic usePoll

@spadgett spadgett added this to the v4.2 milestone May 21, 2019
@rawagner
Copy link
Contributor Author

Dashboards page has its own redux store to be able to share resources (prometheus queries results, various url requests and in the future also k8s resources) between various dashboard cards and also dashboard tabs.

Do we have specific cases where prometheus query results are in fact shared across dashboard cards? I think this is where a lot of the complexity is coming in vs using a simple poll hook and a functional component.

Yes we do - we use the same queries for Capacity and Utilization card. Once Storage team contributes their Storage dashboard tab they will also want to reuse some storage queries and also Storage health query which will be the same for Health card in Overview and Storage tab. (Storage tab can seen here https://docs.google.com/presentation/d/15nDG3VuQRy6vJbMX4yq6ZvJ5G2Qawaz9glnLT8GEvX4/edit#slide=id.g4d3241551c_0_57 )
We also dont want to refetch all data once the tab changes.

Copy link
Contributor

Choose a reason for hiding this comment

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

@spadgett , isn't there a better place where to store strings all-together?

Copy link
Member

Choose a reason for hiding this comment

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

@spadgett , isn't there a better place where to store strings all-together?

We don't currently externalize any strings, so there's no good place at the moment.

@openshift-ci-robot openshift-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label May 26, 2019
@openshift-ci-robot openshift-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label May 29, 2019
@rawagner rawagner force-pushed the dashboard branch 4 times, most recently from a376426 to 5755038 Compare May 29, 2019 15:02
@openshift-ci-robot openshift-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label May 30, 2019
Copy link
Member

Choose a reason for hiding this comment

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

Do we ever intend to have dashboards with pod metrics for normal users? This function doesn't handle using the prometheus tenancy service that lets normal users fetch metrics.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is only as admin view for now. We dont have any dropdown for choosing other namespace than all for now.

Copy link
Member

Choose a reason for hiding this comment

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

We can punt for now, but I'd assume we'd eventually want to replace the current project dashboard with the same experience reusing these components.

Copy link
Member

Choose a reason for hiding this comment

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

We've been adding skeleton screens to a lot of UIs. That might be better here instead of a loading indicator. See #1569 and #1608

OK as a follow on.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nice! UXD started to mockup dashboards with these skeleton screens some time ago and we plan to implement them too.

Copy link
Member

Choose a reason for hiding this comment

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

I think this is OK, but we should be careful that this won't hot loop.

Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure this is right.

cc @rhamilto

Copy link
Member

Choose a reason for hiding this comment

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

Why is this needed? We import color-variables above

Copy link
Contributor Author

Choose a reason for hiding this comment

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

color-variables is pf3, sass-utilities/colors is pf4. Variable names are slightly different $color-pf-black-100 (pf3) vs $pf-color-black-100 (pf4)

Copy link
Member

Choose a reason for hiding this comment

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

Variable names are slightly different $color-pf-black-100 (pf3) vs $pf-color-black-100 (pf4)

I'm not sure what to recommend, but that's going to get really confusing :(

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I could use the pf3 ones but some variables have different values :/ But if want, i will use it, it shouldnt be a big change and once ready we can switch all css variables to pf4.

Copy link
Member

Choose a reason for hiding this comment

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

No, I would use the PF4 variables here. Just thinking about how to deal with this. Maybe we should create pf3- aliases for legacy colors to avoid confusion, but that's outside the scope of this PR.

Copy link
Member

Choose a reason for hiding this comment

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

Worth a comment in this file explaining, though.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

comment added

@spadgett
Copy link
Member

spadgett commented Jun 3, 2019

Thank you for changing these to functional components. This looks a lot cleaner!

Copy link
Member

Choose a reason for hiding this comment

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

We should align on how we handle this. Currently console uses this custom hook:

https://github.com/openshift/console/blob/master/frontend/public/components/utils/ref-width-hook.ts

We might look at something based on hooks like:

https://github.com/rehooks/component-size

There are also polyfills for ResizeObserver:

https://caniuse.com/#search=ResizeObserver
https://github.com/que-etc/resize-observer-polyfill

@christianvogt mentioned dev console needs it for topology view as well.

cc @TheRealJon

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I tried useRefWidth and it works fine for me. react-measure dep is gone.

@rawagner rawagner force-pushed the dashboard branch 2 times, most recently from bf5d826 to 272cb86 Compare June 4, 2019 13:36
@spadgett
Copy link
Member

spadgett commented Jun 4, 2019

Can you check the linter errors?

@rawagner
Copy link
Contributor Author

rawagner commented Jun 4, 2019

Can you check the linter errors?

prettier! Thats great.

Linting errors are fixed now.

Copy link
Member

Choose a reason for hiding this comment

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

If this is only used in one place for the header, can it just be a style on co-dashboard-header__icon instead of having a separate class?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

right, merged those two to one class co-dashboard-header__icon

Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
stopWatchURL('healtz');
stopWatchURL('healthz');

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oops, fixed

Copy link
Member

Choose a reason for hiding this comment

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

I think it's cleaner to make this an expression directly in the markup from the return value below.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sounds good to me. Its now part of return statement

Copy link
Member

Choose a reason for hiding this comment

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

You're not checking if the flag is pending, so it could flash the wrong product name briefly on initial load.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

added check for pending flag. While the flag is pending we show loading in Health card body and See All link is not shown at all

Copy link
Member

Choose a reason for hiding this comment

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

Why is this needed? We import color-variables above

@spadgett
Copy link
Member

spadgett commented Jun 5, 2019

/approve

Please squash, thanks!

@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jun 5, 2019
@rawagner
Copy link
Contributor Author

rawagner commented Jun 5, 2019

commits squashed

Copy link
Member

@spadgett spadgett left a comment

Choose a reason for hiding this comment

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

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Jun 5, 2019
@spadgett
Copy link
Member

spadgett commented Jun 5, 2019

/retest

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

1 similar comment
@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-ci-robot openshift-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jun 5, 2019
@openshift-ci-robot openshift-ci-robot removed lgtm Indicates that a PR is ready to be merged. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Jun 6, 2019
@rawagner
Copy link
Contributor Author

rawagner commented Jun 6, 2019

@spadgett Can you please approve again ? I had to rebase and it removed the label. Thank you!

@spadgett
Copy link
Member

spadgett commented Jun 6, 2019

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Jun 6, 2019
@openshift-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: rawagner, spadgett, vojtechszocs

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-merge-robot openshift-merge-robot merged commit 32e4fee into openshift:master Jun 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants