feat: rewrite interactive table widget in Angular#17416
Conversation
# Conflicts: # packages/bigframes/bigframes/display/table_widget_angular.js # packages/bigframes/bigframes/display/table_widget_angular/README.md # packages/bigframes/bigframes/display/table_widget_angular/src/app/app.spec.ts # packages/bigframes/bigframes/display/table_widget_angular/src/app/app.ts
…' into shuowei-angular-rewrite-core
# Conflicts: # packages/bigframes/bigframes/core/events.py # packages/bigframes/bigframes/core/utils.py # packages/bigframes/bigframes/session/__init__.py # packages/bigframes/bigframes/session/_io/bigquery/__init__.py # packages/bigframes/tests/unit/display/test_anywidget.py # packages/bigframes/tests/unit/session/test_read_gbq_colab.py
There was a problem hiding this comment.
Code Review
This pull request transitions the interactive Table Widget frontend for BigQuery DataFrames to a compiled Angular hybrid bundle using anywidget, updating the Python backend to support this integration. Key feedback identifies critical issues, including a missing import of Series in html.py that will cause a runtime NameError, and a bug in the Angular component where extracting column names via textContent includes appended sort indicators, breaking sorting on subsequent clicks. Additionally, it is recommended to remove the initializeHeight logic to let CSS handle the container height dynamically, and to immediately reset the local page signal to 0 in WidgetStateService.setPageSize for UI consistency.
…app/widget-state.service.ts Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
…app/app.ts Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
…app/app.ts Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
…app/app.ts Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
|
Is this a feat or refactor? If it is only "rewriting", then refactor. |
| ) | ||
| df = df.assign(**{col: df[col]._apply_unary_op(op) for col in json_cols}) | ||
| return df | ||
| return df, [] |
There was a problem hiding this comment.
what's the purpose of returning an empty list and then drop it?
| ) | ||
|
|
||
| def _get_display_df(self) -> DataFrame: | ||
| def _process_display_df(self) -> tuple[DataFrame, list[str]]: |
There was a problem hiding this comment.
don't quite get the meaning of renaming the function.
Though the original name wasn't representative, "process" is more vague than "get".
| npm install | ||
| ``` | ||
| ```bash | ||
| ng serve |
There was a problem hiding this comment.
Does it need any setup to be able to run ng command?
This PR rewrites the frontend implementation of the interactive
TableWidgetin Angular, replacing the legacy vanilla JS version (table_widget.js). This enables more structured state management and paves the way for future UI improvements.Key Changes:
bigframes/display/table_widget_angular.WidgetStateServiceto manage the widget's internal state (pages, sorting, column visibility) and synchronize updates with the Pythonanywidgetmodel.table_widget_angular.js, which is now loaded by the Python class.DataFrame._get_display_dfto_process_display_dfand refactored it to return both the processed display DataFrame and its metadata.html.pyto standardize representation rendering pipelines, enabling native rendering support for bothDataFrameandSeriesobjects.createApplication()and manually attach each component instance to its local widget container (el). This prevents rendering conflicts and state bleeding when rendering multiple widgets on the same notebook page.tests/js/table_widget_angular.test.js) to assert that multiple Angular widgets can bootstrap and render distinct model configurations concurrently.tests/unit/display/to conform to the new_process_display_dfinterface.Verified at: go/scrcast/NTkzNjEzNzYyNDM1NDgxNnw4NTI0NjA5My1iMA
screen/4NJKSkYEjoYjpxA
Fixes #<505414691> 🦕