-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
ui: cluster overview #19657
ui: cluster overview #19657
Conversation
@couchand what kind of feedback do you think would be most helpful? I'm assuming more so from the engineering team than from design and product? |
@dianasaur323 at this point mostly just answers to the questions in #19643 are what would be helpful. I think I've got my finger on the several minor deviations from the mockup, and after hooking up the real data I'll take care of those, but feel free to let me know if there's anything major that I'm missing. |
I had a couple of organization suggestions, mostly looks fine though. Review status: 0 of 7 files reviewed at latest revision, 3 unresolved discussions, some commit checks failed. pkg/ui/src/views/cluster/containers/clusterOverview/index.tsx, line 23 at r1 (raw file):
We already have a byte formatting function available under src/util/format pkg/ui/src/views/cluster/containers/clusterOverview/index.tsx, line 107 at r1 (raw file):
A few BEM notes:
pkg/ui/styl/pages/cluster.styl, line 9 at r1 (raw file):
New styles should go right alongside the code... i.e. this should be in Comments from Reviewable |
@couchand okay great! agreed that there are still some deviations from the mock ups, but i'll leave that to you for now. i'll take a look at that issue, although I don't have time today or tomorrow. |
Review status: 0 of 7 files reviewed at latest revision, 3 unresolved discussions, some commit checks failed. pkg/ui/src/views/cluster/containers/clusterOverview/index.tsx, line 23 at r1 (raw file): Previously, mrtracy (Matt Tracy) wrote…
Yep! I've just been pushing up the intermediate commits, look at the latest pls. Or not yet, since I'm about to send up some more. pkg/ui/src/views/cluster/containers/clusterOverview/index.tsx, line 107 at r1 (raw file): Previously, mrtracy (Matt Tracy) wrote…
Ugh at least BEM provides some structure, but it's still crazy trying to apply it to real components. As far as I can tell it just assumes everything is a two-level structure which, of course, oversimplifies things. As you can see below, at some point I just stopped bothering, figuring I'd go back and do a pass renaming everything at the end. pkg/ui/styl/pages/cluster.styl, line 9 at r1 (raw file): Previously, mrtracy (Matt Tracy) wrote…
Aside: what are your thoughts on using one of the React inline style libraries? Comments from Reviewable |
55eb0bd
to
a224630
Compare
Review status: 0 of 8 files reviewed at latest revision, 4 unresolved discussions. pkg/ui/src/redux/nodes.ts, line 175 at r9 (raw file):
@mrtracy can you confirm if this change is sound? it really feels wrong, but I just cargo-culted the rest... Comments from Reviewable |
Review status: 0 of 8 files reviewed at latest revision, 4 unresolved discussions, some commit checks pending. pkg/ui/src/redux/nodes.ts, line 175 at r9 (raw file): Previously, couchand (Andrew Couch) wrote…
That looks correct. pkg/ui/src/views/cluster/containers/clusterOverview/index.tsx, line 107 at r1 (raw file): Previously, couchand (Andrew Couch) wrote…
BEM wants a certain level of complexity in terms of a block; even if elements of a block are nested, each element is treated as a child of the block (and not a child of another element in the block). If you encounter a situation where the two-level naming is not adequate because of the complicated structure of the block, BEM would prefer breaking that block into multiple blocks (rather than using element-of-element). I don't think that applies in this situation, though. pkg/ui/styl/pages/cluster.styl, line 9 at r1 (raw file): Previously, couchand (Andrew Couch) wrote…
It's not high on my priority list. We've gone through two CSS refactorings already, and I don't think we've given this one a chance. Comments from Reviewable |
Review status: 0 of 8 files reviewed at latest revision, 4 unresolved discussions, all commit checks successful. pkg/ui/src/redux/nodes.ts, line 175 at r9 (raw file): Previously, mrtracy (Matt Tracy) wrote…
To clarify my concern: if multiple nodes have replicas of the same range, will this not double-count them? Comments from Reviewable |
Review status: 0 of 8 files reviewed at latest revision, 4 unresolved discussions, all commit checks successful. pkg/ui/src/redux/nodes.ts, line 175 at r9 (raw file): Previously, couchand (Andrew Couch) wrote…
For this metric, each node counts only the ranges for which it either The intent is for this to be the total count of ranges when aggregated. It is possible to double-count due to active membership changes, but this number is accurate enough for monitoring purposes. Comments from Reviewable |
Thanks for the clarification @mrtracy, that makes sense. I think this is ready to go (module squashing commits), PTAL, thanks! |
3de6c7a
to
0ab109d
Compare
Review status: 0 of 9 files reviewed at latest revision, 13 unresolved discussions, some commit checks pending. pkg/ui/src/views/cluster/containers/clusterOverview/capacity.tsx, line 48 at r25 (raw file):
You're modifying a package global here. These functions and variables should be moved into the CapacityChart class. pkg/ui/src/views/cluster/containers/clusterOverview/capacity.tsx, line 70 at r25 (raw file):
I think it would be much clearer just to forgo all this enter/exit logic and just add these elements to the JSX; there's always exactly one of each of these elements, d3 can easily select them if they are already present. pkg/ui/src/views/cluster/containers/clusterOverview/capacity.tsx, line 95 at r25 (raw file):
Should have descriptive comments on exported members. pkg/ui/src/views/cluster/containers/clusterOverview/capacity.tsx, line 104 at r25 (raw file):
Why is this being done in shouldComponentUpdate? I would expect it to be in componentDidUpdate. pkg/ui/src/views/cluster/containers/clusterOverview/cluster.styl, line 19 at r25 (raw file):
This is really kind of... odd. I'm not sure how I feel about it, but it seems to make the CSS very closely bound to exactly whats currently being displayed. Would this not have been possible with a flexbox, or without using grid-template-areas? Maybe it's fine, it just looks different than anything i've seen in CSS before and my immediate instinct is that it's too tightly coupled. pkg/ui/src/views/cluster/containers/clusterOverview/cluster.styl, line 25 at r25 (raw file):
Use That is, this currently compiles to: .cluster-summary .cluster-summary__section{
} But .cluster-summary__section Avoiding the nesting of CSS rules is one of the design goals of BEM, to keep the specificity flat. pkg/ui/src/views/cluster/containers/clusterOverview/index.tsx, line 82 at r25 (raw file):
The metric/label groups are repeated a lot, seems like a great opportunity just to replace it with a function. function clusterSummaryMetric(label: JSX.Element, value: JSX.Element) Then these groups could look more like: {clusterSummaryMetric(
<span>Live<br />Nodes</span>,
suspectNodes,
suspectNodes ? "warning" : ""
)}
{clusterSummaryMetric(
<span>Dead<br />Nodes</span>,
deadNodes,
deadNodes ? "alert" : ""
)} You could even do them as stateless components, although that's up to you: <ClusterSummaryMetric
label={<span>Dead<br />Nodes</span>}
value={deadNodes},
valueClassName={deadNodes ? "alert" : ""}
/> pkg/ui/src/views/cluster/containers/clusterOverview/index.tsx, line 89 at r25 (raw file):
I don't think the internal span is necessary, you're in the label div and the span isn't adding any additional information. Also, is there no way to express this in CS without using the pkg/ui/src/views/cluster/containers/nodesOverview/index.tsx, line 373 at r25 (raw file):
Parenthesis around Multi-line JSX Comments from Reviewable |
0ab109d
to
d4e97ec
Compare
Review status: 0 of 9 files reviewed at latest revision, 13 unresolved discussions, some commit checks pending. pkg/ui/src/views/cluster/containers/clusterOverview/capacity.tsx, line 48 at r25 (raw file): Previously, mrtracy (Matt Tracy) wrote…
Welp. pkg/ui/src/views/cluster/containers/clusterOverview/capacity.tsx, line 70 at r25 (raw file): Previously, mrtracy (Matt Tracy) wrote…
I'll respectfully disagree. I think the whole chart can be encapsulated in a D3 component without coupling together a React component and a D3 component. The React integration can be generalized further, per the thread below on pkg/ui/src/views/cluster/containers/clusterOverview/capacity.tsx, line 95 at r25 (raw file): Previously, mrtracy (Matt Tracy) wrote…
Done. pkg/ui/src/views/cluster/containers/clusterOverview/capacity.tsx, line 104 at r25 (raw file): Previously, mrtracy (Matt Tracy) wrote…
Well we'd rather that React not muck about the internals of this component after the initial render, so we want pkg/ui/src/views/cluster/containers/clusterOverview/cluster.styl, line 19 at r25 (raw file): Previously, mrtracy (Matt Tracy) wrote…
I did it with flexbox first, but it's really tough to get things to line up precisely in both dimensions. CSS grid is specifically meant for lining things up in two dimensions, whereas flexbox is intended for layout in one dimension. I agree that the CSS gets coupled tightly to the contents, that's why I asked about inline styling. There's not really any getting around it here, since getting the contents to look right demands that each be treated individually. Putting the styles inline would make that slightly less gross. pkg/ui/src/views/cluster/containers/clusterOverview/cluster.styl, line 25 at r25 (raw file): Previously, mrtracy (Matt Tracy) wrote…
Oh that's slick. Done. pkg/ui/src/views/cluster/containers/clusterOverview/index.tsx, line 107 at r1 (raw file): Previously, mrtracy (Matt Tracy) wrote…
I don't know, just using your first point as an example, pkg/ui/src/views/cluster/containers/clusterOverview/index.tsx, line 82 at r25 (raw file): Previously, mrtracy (Matt Tracy) wrote…
Good call. Can't do it as a component yet, that requires React 16. ... So I tried this, but after removing the internal span, the explicit version is clearer than trying to use a function. pkg/ui/src/views/cluster/containers/clusterOverview/index.tsx, line 89 at r25 (raw file): Previously, mrtracy (Matt Tracy) wrote…
Yeah, the internal span isn't needed, it's an artifact of some restructuring. I left it in since that's where the warning/alert class was set, but that can easily be moved up a level. Done. pkg/ui/src/views/cluster/containers/nodesOverview/index.tsx, line 373 at r25 (raw file): Previously, mrtracy (Matt Tracy) wrote…
Done. Comments from Reviewable |
1216ffb
to
88c1284
Compare
This commit adds the cluster overview as the new landing page for the admin UI. This initial pass has the cluster overview at the top (without the latest event information at the moment) and the existing node list as the main content of the page. Release note (admin ui change): Added a cluster overview page showing current capacity usage, node liveness, and replication status.
88c1284
to
8cde1b1
Compare
LGTM Review status: 0 of 10 files reviewed at latest revision, 11 unresolved discussions, all commit checks successful. pkg/ui/src/views/cluster/containers/clusterOverview/capacity.tsx, line 104 at r25 (raw file): Previously, couchand (Andrew Couch) wrote…
Okay, I understand the reasoning behind this. We can disagree on the use of D3 for now, but if we're escaping to D3, this works. pkg/ui/src/views/cluster/containers/clusterOverview/cluster.styl, line 19 at r25 (raw file): Previously, couchand (Andrew Couch) wrote…
I see the benefits of grid, but I'm less sold on the use of This is fine for now, no other components directly depend on it. However, I would like to address this before the strategy gets copy/pasted to different components. pkg/ui/src/views/cluster/containers/clusterOverview/index.tsx, line 107 at r1 (raw file): Previously, couchand (Andrew Couch) wrote…
Then the problem is that "cluster-summary" isn't the proper name for this block, because its being confused with the entire "cluster summary" section, even though it doesn't describe the entire section. However, even in the case where this did contain the entire section, the use of "title" for the section title (i.e. "Cluster Overview") and the use of "section-title" for the section titles would be appropriate. The difference between "section-title" and "section__title" is subtle, but it's an important rule that gives predictable structure. pkg/ui/src/views/cluster/containers/clusterOverview/index.tsx, line 82 at r25 (raw file): Previously, couchand (Andrew Couch) wrote…
I'll take your word for it. Comments from Reviewable |
Review status: 0 of 10 files reviewed at latest revision, 11 unresolved discussions, all commit checks successful. pkg/ui/src/views/cluster/containers/clusterOverview/cluster.styl, line 19 at r25 (raw file): Previously, mrtracy (Matt Tracy) wrote…
Roger, and generally agreed. The alternative is to use the grid lines to specify where things go, which is less clear, IMO. This all would be much better if we could list each string on a new line, as basically every grid example shows (is there any way to do that with stylus?). I'm gonna merge this, but keep thinking about it, because it's hard to imagine what the most natural way to express these constraints would be, but I want to find it. pkg/ui/src/views/cluster/containers/clusterOverview/index.tsx, line 107 at r1 (raw file): Previously, mrtracy (Matt Tracy) wrote…
Sure, my point was just that there really is more than two levels of structure here. Comments from Reviewable |
Part of the initial steps of making a homepage for the admin UI with the cluster viz as the main attraction, here is some work towards a structure for the page and the overview on the top. Clearly lots of work to do here, but I thought I'd get it up so we could get some eyes on it early.
Contributes to #19512.
See #19643 regarding naming things.