Reimplement editable for PerspectiveWidget in JupyterLab to take into account the latest changes#1850
Reimplement editable for PerspectiveWidget in JupyterLab to take into account the latest changes#1850
editable for PerspectiveWidget in JupyterLab to take into account the latest changes#1850Conversation
5b540e5 to
bc29607
Compare
texodus
left a comment
There was a problem hiding this comment.
Thanks for the PR! Great tests coverage and thorough explanation of the issue is much appreciated.
I have a minor gripe, which is that tests that rely on arbitrary timeouts are doomed to fail over enough time. I understand that these are tiny, few and arguably inconsequential here, but #1823 corrects another set of seemingly-innocuous timeouts which caused hundreds of hours of wasted CI time by only failing ~5% of the runs (but after 45m of build).
Basically, if shrinking these timeouts causes consistent failures, we need to remove them and use discrete await conditions instead. I'm willing to take your word that these have been tested and/or are well understood, but I'm going to hold off on merging completely until I've verified that the tests are stable in CI through several build cycles.
|
I've updated the tests but I dont really expect them to pass, I expect there to be random |
|
welp nevermind, this is testing pretty stable for me locally but I thought it would've had issues on CI. we can bump the ci a few times to test if we want |
…table because the click handler does not check whether the perspective datagrid plugin is editable (fixes #1833)
…rid plugin's editability is toggled (partial fix for #1832)
running in JupyterLab. This commit removes the `editable` attribute from PerspectiveWidget and PerspectiveTraitlets, bringing it inline with the changes made to the PerspectiveViewer. The Perspective JupyterLab extension is reimplemented to leverage `plugin_config` for editability instead of `editable`, and tests are greatly extended to test the various js<->python synchronizeable attributes.
This PR does 2 things: Fixes some small bugs with boolean values in the perspective datagrid extension (smaller part), and reimplements the
editableattribute to account for the latest changes inperspective-viewer.Editability of boolean values in the
datagridpluginCC: #1833
Due to a small bug, boolean columns were always shown as editable.
Hover behavior:

Click behavior:

This behavior is fixed to not toggle booleans and not trigger
cursor:pointerunless the data grid is marked as editableHover behavior:

Click behavior:

Editable in PerspectiveWidget
editablewas added to thePerspectiveWidgetandPerspectiveTraitletsfor legacy reasons. Even though the client/server interface existed, thePerspectiveWidgetplays a dual role as a wrapper for both tables and views, but also the frontendperspective-viewer. However, theperspective-viewerhas no formal client/server interface.Previously, it was written in pure JS, and a 1-1 wrapper was written in Python in the form of the
PerspectiveTraitletsclass. However, no end-to-end tests were ever written to assert this functionality. As changes were made, most notably the shift to current rust-basedperspective-viewer, various parts regressed, and any problems had to be manually discovered and fixed.One of the major regressions was the removal of
editableas an attribute ofperspective-viewer, and the inclusion of it in theplugin_configfor the perspective datagrid. This PR brings the python code in line with the latest rust/JS state by removingeditablecompletely from thePerspectiveTraitletsandPerspectiveWidgetclass, and reimplementing the required bidirectional syncing to allow for theplugin_configbased editable flag. This is technically a breaking change as theeditableattribute is now removed from the various python classes, however this behavior was already non-functional.Old Behavior
Construction (non-functional):

Toggling from JS (non-functional):

Toggling from Python (non-functional):

New Behavior
Construction:

Toggling from JS:

Toggling from Python:

Working end-to-end:

Tests
Almost more important than these bug fixes, the JupyterLab tests are greatly expanded. Previous tests only checked the load-time behavior of the Perspective Widget:
Tableinstancesettings=FalseThese existing tests are expanded with additional tests, including tests which dynamically execute additional python cells, or manipulate the frontend components and assert the syncing of state back to python:
columns,filter,plugin,group_by,split_by,sort, andthemefrom Python (syncs to JS)columns,filter,plugin,group_by,split_by,sort, andthemefrom JS (syncs to Python)Helper functions are added to run Python code in a cell after initial notebook run, and to run Python assertions in a cell and track if Python exceptions were raised. This should aid in future extension of these tests.