-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
Dashboard grid React migration #1 #3722
Conversation
@gabrieldutra widget drag tests fail cause the placeholder now animates and also doesn't react as expected. Fiddling with it I realized there are 2 better ways to go about determining widget position delta:
// original
it('moves one column when dragged over snap threshold', () => {
dragBy(cy.get('@textboxEl'), 110).then((delta) => {
expect(delta.left).to.eq(200);
});
});
// suggested
it('moves one column when dragged over snap threshold', () => {
const drag = () => cy.get('@textboxEl').dragBy(110);
const getLeft = () => cy.get('@textboxEl').invoke('offset').its('left');
cy.get('@textboxEl').should(($el) => {
expect(drag).to.increase(getLeft).by(200);
});
}); But, it's not possible cause for some reason Cypress doesn't expect What am I doing wrong? |
Isn't this
Kind of, I wanted before to use Chai with elements directly (it doesn't work at all), this is a bit different 🙂. |
10x @gabrieldutra, that's a grid feature I don't care for either. It's possible we'll have to have our own fork, since the original repo is not very responsive. |
379041d
to
15246d3
Compare
15246d3
to
9ec2999
Compare
9ec2999
to
c3bdcb6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks really cool 👍 (and I'm so happy that we removed that ugly old grid code). I still need to try it, but right now there are some notes about the code.
822d210
to
cf14ce2
Compare
cf14ce2
to
1bd12f8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I played around a bit with the migrated features, didn't find any new issues 🙂.
+367 −727 LOC? 😮
BTW, Why dashboard-grid.jsx
and not DashboardGrid.jsx
?
10x!
There's still 2 upcoming PRs so don't believe it yet!
Right - I started work on this PR quite long ago before we had definitive standards. |
While trying it with the deploy preview Viz demo dashboard I noticed there is considerable lag when going into edit mode and when exiting edit mode (even when not doing any changes). Any idea why is this? |
@arikfr when clicking "Edit", all grid item's Tested these props with persistent One way is to introduce lazy loaded grid items according to viewport (using the Intersection Observer API). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since now I'm,responsible of merging this - it looks good for me. @arikfr, @ranbena, @gabrieldutra - if you have any notices/suggestions - please leave your comments. If everyone is happy with this code - I'll merge it.
I just opened the last version on Netlify, and:
(2 is NTH, but 1 is a blocker of course) |
Also the performance on huge dashboards isn't great, but I guess there isn't much we can do aside from pushing forward with converting widgets and visualizations to React? |
Few more things:
|
@arikfr I tested it on our React migration dashboard (which I think is pretty large): it is a bit slower when moving/resizing widgets comparing to For "X" button - yeah, don't know how did I miss that. Will fix now. |
Ignore 2 in my last comment -- it's actually fixed in this PR :) |
…x widget actions menu
@kravets-levko can you rebase with master? |
@ranbena Done |
@kravets-levko I thought it wasn't cause it's missing the grid markings #3656 but it's actually a bug. |
@kravets-levko I pushed the fix. Tested on Chrome/FF/Safari on Mac. Tested public dashboard. |
Merged 🚀 |
* Dashboard grid React migration * Updated tests * Fixes comments * One col layout * Tests unskipped * Test fixes * Test fix * AutoHeight feature * Kebab-cased * Get rid of lazyInjector * Replace react-grid-layout with patched fork to fix performance issues * Fix issue with initial layout when page has a scrollbar * Decrease polling interval (500ms is too slow) * Rename file to match it's contents * Added some notes and very minor fixes * Fix Remove widget button (should be visible only in editing mode); fix widget actions menu * Fixed missing grid markings * Enhanced resize handle * Updated placeholder color * Render DashboardGrid only when dashboard is loaded
Description
Since
gridstack
has no React implementation, migrated toreact-grid-layout
.Closes #3285.
Included
Not included (tests skipped)
Changed
allows opening menu after removal
now unskipped)Known Issues
Removing widget in preview mode, generates js error.Dragging/Resizing but no change - still a saving indication is triggered