Skip to content
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

Status Bar Component #1314

Merged
merged 1 commit into from
Feb 15, 2021
Merged

Status Bar Component #1314

merged 1 commit into from
Feb 15, 2021

Conversation

texodus
Copy link
Member

@texodus texodus commented Feb 3, 2021

Adds a new UI panel, the Status Bar, which replaces current contextmenu menu. <perspective-statusbar>, the Custom Element which implements this feature, is written in Rust and lives in the confusingly-named @finos/perspective-vieux package, which will someday replace @finos/perspective-viewer. For now though, it is inlined similarly so @finos/perspective-cpp package, so as not to pollute the project's NPM module namespace. Structurally, this package is very similar to the other Custom Elements packages in Perspective; there is a static HTML template which is render to the Shadow DOM at element instantiation, and small JavaScript API:

  • set_table() takes the Perspective Table() object for this viewer.
  • set_view() takes the associated View(), must be called after set_table() but can be called multiple times.
  • The element dispatches the perspective-statusbar-reset non-bubbling event when the reset button is clicked.

In order to bind to the customElements.register() method, a short shim of the JavaScript-accessible methods and class structure lives in src/js/boostrap.js; this is possible to do in Rust also, but wasm-bindgen does not (seem to?) have native ES6 class binders, which makes this a bit hacky. Within Rust is

  • The StatusBarElement struct and methods, from which the JavaScript API dispatches.
  • The download and copy modules, which re-create and replace this functionality from @finos/perspective-viewer.
  • Simple binders for Perspective's JavaScript API into Rust (which mirrors what a hypothetical native Rust API would look like fairly closely).
  • Some utility methods to wrap the typed-html package a renderer and extractor.
  • Simple utility methods to turn various flavors of Rust async/fn types into JavaScript Closure types that do not leak.
  • Unit and integraiton tests using wasm-bindgen's headless support.

status_bar_2

@texodus texodus changed the title <perspective-statusbar> component Status Bar Component Feb 3, 2021
@texodus texodus added enhancement Feature requests or improvements and removed 0.7.0 labels Feb 3, 2021
@texodus texodus added this to the 0.7.0 milestone Feb 3, 2021
@texodus texodus force-pushed the rust-status-bar branch 10 times, most recently from e1fcf45 to 1f3b452 Compare February 11, 2021 21:09
@texodus texodus marked this pull request as ready for review February 12, 2021 00:09
@texodus texodus force-pushed the rust-status-bar branch 4 times, most recently from 8a4df41 to 1a71ba2 Compare February 14, 2021 22:28
@texodus texodus merged commit 9f50aa6 into master Feb 15, 2021
@texodus texodus deleted the rust-status-bar branch February 15, 2021 01:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Feature requests or improvements Rust
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant