Skip to content

Move the dashboard's component library from antd to material-ui#1776

Merged
rmars merged 67 commits intomasterfrom
rmars/materialize
Oct 19, 2018
Merged

Move the dashboard's component library from antd to material-ui#1776
rmars merged 67 commits intomasterfrom
rmars/materialize

Conversation

@rmars
Copy link

@rmars rmars commented Oct 18, 2018

Switch the component library from antd to material-ui.

This branch changes all uses of antd components to their closest equivalent in material. There is still a lot of polish that needs to go into the look of individual components, but since the major component rewrites are done, I think it's time to put tis up for review and get it in so that further work can be done in smaller branches.

Changes in this branch

  • replace all uses of antd with material-ui components
  • slight modifications of eslint rules
  • restructuring of app components to be rendered under the Navigation component
  • deleted most of our css (replaced with material's inline styles)
  • pinned package versions in package.json (mostly removing ^)

Follow-up work

Here is a list of known UI polish in the current branch (I will ticket each one, as well as the results of code-review of this branch, to be done in follow up branches):

Fixes #1408

rmars added 30 commits October 17, 2018 14:04
run yarn add @material/core

run yarn add @material-ui/icons

Add the Roboto font
Make success rate mini chart into a dot
Move MetricsTable to use BaseTable
Pass props down to get breadcrumb rendering
Add authority

Add path
Fix icons in Nav

Add fixed width to navbar and content so that we don't get odd hanging navbar at end
Get rid of all uses of antd Spin
Add Accordion module so that we can have expandable page sections

Remove the ant collapse, replace with added Accordion module

Move tooltip and icon over to materialUI versions
Use it to implement error banner for ErrorModal
Add a rowKey function to BaseTable
Add material type metric table to the cards
Add a Stepper component for the CTA
Small import and table sort tweaks
@rmars rmars added the area/web label Oct 18, 2018
@rmars rmars self-assigned this Oct 18, 2018
Copy link
Member

@siggy siggy left a comment

Choose a reason for hiding this comment

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

This all looks super awesome! Most of my comments are nits and polish and can be deferred for subsequent PRs, some of these also may be existing issues prior to this PR.

Headers don't quite match

header

Bottom of sidebar does not go to bottom of page

sidebar

Tables on Overview extend beyond right side of page

table

Tooltip on ServiceMesh page sometimes snaps to upper left corner

tooltip

Hard reload on Namespaces page render unexpanded sidebar

hard reload

Octopus arm alignment

octo

Tap filter alignment

tap

Tap tooltips not clickable, they disappear once you move your mouse

tap tooltip

Incorrect URLs in Tap table

tap link

{
steps.map((step, i) => {
const props = {};
props.completed = i < steps.length - 1; // select the last step as the currently active one
Copy link
Member

Choose a reason for hiding this comment

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

nit:

const lastStep = _.size(steps) - 1; // hardcode the last step as the active step
...
activeStep={lastStep}
...
props.completed = i < lastStep; // select the last step as the currently active one

</React.Fragment>

);
})}
Copy link
Member

Choose a reason for hiding this comment

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

nit: indent

Copy link
Contributor

@klingerf klingerf left a comment

Choose a reason for hiding this comment

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

⭐️ 🎈 Awesome work! I agree that the small style stuff can be fixed in follow up branches, and I didn't see anything else that needs immediate attention.

Copy link
Contributor

@dadjeibaah dadjeibaah left a comment

Choose a reason for hiding this comment

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

Thanks for doing this @rmars, it looks amazing! 😻 I left a couple of comments.

<div className={classes.root}>
<AppBar
position="absolute"
className={classNames(classes.appBar, this.state.drawerOpen && classes.appBarShift)}>
Copy link
Contributor

Choose a reason for hiding this comment

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

More of a readability nit: I am not entirely sure how classNames interprets statements like this.state.drawerOpen && classes.appBarShift but I found it a little difficult to comprehend. I tried rewriting the statement like so:

className={classNames(classes.appBar, {[`${classes.appBarShift}`]: this.state.drawerOpen})}>

And that seemed to work the same way.

Copy link
Author

@rmars rmars Oct 19, 2018

Choose a reason for hiding this comment

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

Hahahah, what that line is actually doing is a combination of cool es6 tricks:

First, it's using the && operand to return the string name of the class if drawerOpen is true (docs).
(The js && operand will return the latter of the provided values if the first expression is truthy). Example:

>> false && "foo"
>> false

>> true && "foo"
>> "foo"

Then, it's using the fancy object assignment to assign appBarShift's className to the object if provided:

>> let a = "a_string";
>> let obj = { a }

>> obj
{a: "a_string"}

So this is equivalent to providing an object whose key is classes.appBarShift and value is this.state.drawerOpen as you've written. I'll rewrite it to be less trick-y!

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh my gosh! so much sorcery! That is pretty cool. it's a TIOLI so feel free to do whatever you think is best.

Copy link
Author

Choose a reason for hiding this comment

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

Hahaha, yeah I think readable > cool, so I'll change them to more traditional args.
It's a pattern I see popping up a lot in the material examples, so maybe we can change later.

@rmars rmars merged commit e69da1b into master Oct 19, 2018
siggy added a commit that referenced this pull request Oct 30, 2018
This replaces a couple of the MaterialUI icons introduced in #1776 with
their original counterparts in Font Awesome, but wrapped in a MaterialUI
`Icon` tag. Also fix Linkerd logo padding in sidebar.

Part of #1781.

Signed-off-by: Andrew Seigner <[email protected]>
siggy added a commit that referenced this pull request Oct 31, 2018
This replaces a couple of the MaterialUI icons introduced in #1776 with
their original counterparts in Font Awesome, but wrapped in a MaterialUI
`Icon` tag. Also fix Linkerd logo padding in sidebar.

Part of #1781.

Signed-off-by: Andrew Seigner <[email protected]>
@rmars rmars deleted the rmars/materialize branch December 13, 2019 18:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Switch web component library from Ant to Material-UI

4 participants