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

[@card] Realtime cards (2/N) #1551

Merged
merged 8 commits into from
Jan 11, 2024
Merged

[@card] Realtime cards (2/N) #1551

merged 8 commits into from
Jan 11, 2024

Conversation

valayDave
Copy link
Collaborator

@valayDave valayDave commented Sep 26, 2023

[card-ui] default card real-time updatable

  • cleanup the ui component code and add naive progress-bar
  • add Vega chart support in default card
  • Remove Chartjs dependency from the code.

@valayDave valayDave mentioned this pull request Sep 26, 2023
2 tasks
@valayDave valayDave marked this pull request as ready for review September 26, 2023 23:00
seethroughdev
seethroughdev previously approved these changes Sep 27, 2023
Copy link
Collaborator

@seethroughdev seethroughdev left a comment

Choose a reason for hiding this comment

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

LGTM! Changes are optional and purely cosmetic. Really nice job @valayDave .

@@ -18,6 +18,7 @@
<body>
<div class="card_app"></div>
<script>
var METAFLOW_RELOAD_TOKEN = "[METAFLOW_RELOAD_TOKEN]"
Copy link
Collaborator

Choose a reason for hiding this comment

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

total nit, but we use let/const these days to be more explicit on if the value is immutable.

);

export let componentData: types.BarChartComponent;
const { config, data, labels } = componentData;
$: ({ config, data, labels } = componentData);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Fun sidenote, svelte just announced they're changing this api for the same confusion we got caught up in here. Glad its fixed for now.

@@ -0,0 +1,14 @@
<!-- A simple text component to render a paragraph wherever needed.App
Copy link
Collaborator

Choose a reason for hiding this comment

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

This comment should be updated, totally my fault.

/**
* This function is used to update the cardData object from the window.
* It is used to update the cardData object with
* changes that have come from the parent window.
Copy link
Collaborator

Choose a reason for hiding this comment

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

If you're updating comments, probably helpful here to call out that we're intentionally assigning it to the window object as well.

@romain-intel
Copy link
Contributor

Not reviewing this one :). I'll assume it works :).

@valayDave valayDave force-pushed the valay/rtc-stack-0 branch 2 times, most recently from 21d21fb to fd1502d Compare October 18, 2023 00:44
Base automatically changed from valay/rtc-stack-0 to master December 5, 2023 09:26
@romain-intel romain-intel dismissed seethroughdev’s stale review December 5, 2023 09:26

The base branch was changed.

@valayDave valayDave force-pushed the valay/rtc-stack-1 branch 2 times, most recently from 615ffe4 to 947c2ec Compare January 8, 2024 14:47
@romain-intel
Copy link
Contributor

As mentioned -- am fine with this (didn't review). My only comment is somewhat orthogonal (I think I had mentioned before): it would be nice to remove things that are actually not packaged with Metaflow to outside the metaflow directory to be a bit cleaner.

romain-intel
romain-intel previously approved these changes Jan 9, 2024
valayDave and others added 8 commits January 11, 2024 08:13
- cleanup the ui component code and add naive progress-bar
- Chart support within tables and anywhere across the page
- Chart mutation done based on spec/data changes.
- pass down options in vega chart
- progress-bar min width for mf UI
- Fix bug when vega-chart spec changes.
- fix `embed` class CSS
* [card-components] internal MetaflowCard classes support realtime behavior
- Markdown and Artifact Component made realtime.
- default/blank cards made realtime
- default component ids to realtime-updatable UserComponents

* [default-card-python] add runtime check
- Add a variable in the HTML template to enable/disable `metaflow_card_update` function

* [card-components] progressbar / vegacharts

* [card-components] customize updates for Tables/Images
- Set options that allows disabling realtime updates for components that may have lots of data like `Image` / `Table`. This can be useful when we are calling refresh often and don't want to update data which maybe static.

* [card-components] address comments on Image class
- Image.update supports multi-type object
- remove `disable_updates` from public api

* [card-components][vega-chart][bug-fix]
- property in vega chart to show controls
- remove `data` argument from Vega Chart.
- It only takes `spec` as an argument.
- VegaChart default width set to `container`

* [@card] Realtime cards (4/N) (#1553)

* [card-server] cli command to expose a card server
- Server helps view realtime updates
- Added a card viewer html file
- Created a simple HTTP based card server that will help showcase the realtime cards from querying the server
- The API response contains the task status for the data api
- reload on run change : A background thread checks if there are new runs created via the latest_run file.
- pass down poll_interval to card viewer
- card server is also resiliant to no runs
- You can set `METAFLOW_DEBUG_CARD_SERVER` to debug card server logs, Logging is off by default
- clean url parsing for requests : needed to ensure calls to card server are resiliant to query params in requests.
- also need clean url parsing for setting `embed` query param in the card iframe
- run-info API sends task finished information which is useful when switching cards automatically when new tasks start.
- it Always logs when run-ids change

* [card-viewer-html] UI + Structure
- Cleanup HTML template
- Handles edge case where no runs are available
- Shows errors when things are not working
- leverages a configurable poll interval
- set `embed` query param in the card iframe source.
- it automatically switches to new card when tasks finish and other tasks are running.
- Fix bug when card data is not available
- checks for `final` reload token to stop polling updates

* [@card] [card-core] always call `refresh` after first `render_runtime` (5/N) (#1670)

* [card-core] always call `refresh` after first `render_runtime`
- Added a `sync` argument to the card creator

[@card][bug fixes] Address comments and squashing bugs (6/N) (#1678)

* [card-components] type-hints + doc string Fix.

* [card-core] fix function signature in tests.

* [card-server] address comments on debug mode and hygiene

* [card-components] vega charts special case inside table

---------

Co-authored-by: adam <203779+seethroughdev@users.noreply.github.com>

---------

Co-authored-by: adam <203779+seethroughdev@users.noreply.github.com>
* Setup a new card and start the watcher
*/
function handleLoadCard(name, value) {
document.getElementsByTagName("title").innerHTML = name;

Check warning

Code scanning / CodeQL

DOM text reinterpreted as HTML Medium

DOM text
is reinterpreted as HTML without escaping meta-characters.
function handleLoadCard(name, value) {
document.getElementsByTagName("title").innerHTML = name;
const iframe = document.getElementById("card-frame");
iframe.src = `/card/${value}?embed=true`;

Check warning

Code scanning / CodeQL

DOM text reinterpreted as HTML Medium

DOM text
is reinterpreted as HTML without escaping meta-characters.
@savingoyal savingoyal merged commit 08eb1e6 into master Jan 11, 2024
22 checks passed
@savingoyal savingoyal deleted the valay/rtc-stack-1 branch January 11, 2024 16:46
madhur-ob pushed a commit to madhur-ob/metaflow that referenced this pull request Jan 18, 2024
* [default-card][ui] default card realtime updatable
- cleanup the ui component code and add naive progress-bar

* [default-card][ui] Add custom progress bar

* [default-card][ui] vegachart component
- Chart support within tables and anywhere across the page
- Chart mutation done based on spec/data changes.

* [default-card][ui] remove chart.js deps.

* [default-card][ui] migrate to vite

* [default-card][ui] update progress bar styles

* [default-card][ui] Fixes to chart/css/progess bar
- pass down options in vega chart
- progress-bar min width for mf UI
- Fix bug when vega-chart spec changes.
- fix `embed` class CSS

* [@card] Realtime cards (3/N)  (Netflix#1552)

* [card-components] internal MetaflowCard classes support realtime behavior
- Markdown and Artifact Component made realtime.
- default/blank cards made realtime
- default component ids to realtime-updatable UserComponents

* [default-card-python] add runtime check
- Add a variable in the HTML template to enable/disable `metaflow_card_update` function

* [card-components] progressbar / vegacharts

* [card-components] customize updates for Tables/Images
- Set options that allows disabling realtime updates for components that may have lots of data like `Image` / `Table`. This can be useful when we are calling refresh often and don't want to update data which maybe static.

* [card-components] address comments on Image class
- Image.update supports multi-type object
- remove `disable_updates` from public api

* [card-components][vega-chart][bug-fix]
- property in vega chart to show controls
- remove `data` argument from Vega Chart.
- It only takes `spec` as an argument.
- VegaChart default width set to `container`

* [@card] Realtime cards (4/N) (Netflix#1553)

* [card-server] cli command to expose a card server
- Server helps view realtime updates
- Added a card viewer html file
- Created a simple HTTP based card server that will help showcase the realtime cards from querying the server
- The API response contains the task status for the data api
- reload on run change : A background thread checks if there are new runs created via the latest_run file.
- pass down poll_interval to card viewer
- card server is also resiliant to no runs
- You can set `METAFLOW_DEBUG_CARD_SERVER` to debug card server logs, Logging is off by default
- clean url parsing for requests : needed to ensure calls to card server are resiliant to query params in requests.
- also need clean url parsing for setting `embed` query param in the card iframe
- run-info API sends task finished information which is useful when switching cards automatically when new tasks start.
- it Always logs when run-ids change

* [card-viewer-html] UI + Structure
- Cleanup HTML template
- Handles edge case where no runs are available
- Shows errors when things are not working
- leverages a configurable poll interval
- set `embed` query param in the card iframe source.
- it automatically switches to new card when tasks finish and other tasks are running.
- Fix bug when card data is not available
- checks for `final` reload token to stop polling updates

* [@card] [card-core] always call `refresh` after first `render_runtime` (5/N) (Netflix#1670)

* [card-core] always call `refresh` after first `render_runtime`
- Added a `sync` argument to the card creator

[@card][bug fixes] Address comments and squashing bugs (6/N) (Netflix#1678)

* [card-components] type-hints + doc string Fix.

* [card-core] fix function signature in tests.

* [card-server] address comments on debug mode and hygiene

* [card-components] vega charts special case inside table

---------

Co-authored-by: adam <203779+seethroughdev@users.noreply.github.com>

---------

Co-authored-by: adam <203779+seethroughdev@users.noreply.github.com>

---------

Co-authored-by: adam <203779+seethroughdev@users.noreply.github.com>
emattia pushed a commit to emattia/metaflow that referenced this pull request Jan 23, 2024
* [default-card][ui] default card realtime updatable
- cleanup the ui component code and add naive progress-bar

* [default-card][ui] Add custom progress bar

* [default-card][ui] vegachart component
- Chart support within tables and anywhere across the page
- Chart mutation done based on spec/data changes.

* [default-card][ui] remove chart.js deps.

* [default-card][ui] migrate to vite

* [default-card][ui] update progress bar styles

* [default-card][ui] Fixes to chart/css/progess bar
- pass down options in vega chart
- progress-bar min width for mf UI
- Fix bug when vega-chart spec changes.
- fix `embed` class CSS

* [@card] Realtime cards (3/N)  (Netflix#1552)

* [card-components] internal MetaflowCard classes support realtime behavior
- Markdown and Artifact Component made realtime.
- default/blank cards made realtime
- default component ids to realtime-updatable UserComponents

* [default-card-python] add runtime check
- Add a variable in the HTML template to enable/disable `metaflow_card_update` function

* [card-components] progressbar / vegacharts

* [card-components] customize updates for Tables/Images
- Set options that allows disabling realtime updates for components that may have lots of data like `Image` / `Table`. This can be useful when we are calling refresh often and don't want to update data which maybe static.

* [card-components] address comments on Image class
- Image.update supports multi-type object
- remove `disable_updates` from public api

* [card-components][vega-chart][bug-fix]
- property in vega chart to show controls
- remove `data` argument from Vega Chart.
- It only takes `spec` as an argument.
- VegaChart default width set to `container`

* [@card] Realtime cards (4/N) (Netflix#1553)

* [card-server] cli command to expose a card server
- Server helps view realtime updates
- Added a card viewer html file
- Created a simple HTTP based card server that will help showcase the realtime cards from querying the server
- The API response contains the task status for the data api
- reload on run change : A background thread checks if there are new runs created via the latest_run file.
- pass down poll_interval to card viewer
- card server is also resiliant to no runs
- You can set `METAFLOW_DEBUG_CARD_SERVER` to debug card server logs, Logging is off by default
- clean url parsing for requests : needed to ensure calls to card server are resiliant to query params in requests.
- also need clean url parsing for setting `embed` query param in the card iframe
- run-info API sends task finished information which is useful when switching cards automatically when new tasks start.
- it Always logs when run-ids change

* [card-viewer-html] UI + Structure
- Cleanup HTML template
- Handles edge case where no runs are available
- Shows errors when things are not working
- leverages a configurable poll interval
- set `embed` query param in the card iframe source.
- it automatically switches to new card when tasks finish and other tasks are running.
- Fix bug when card data is not available
- checks for `final` reload token to stop polling updates

* [@card] [card-core] always call `refresh` after first `render_runtime` (5/N) (Netflix#1670)

* [card-core] always call `refresh` after first `render_runtime`
- Added a `sync` argument to the card creator

[@card][bug fixes] Address comments and squashing bugs (6/N) (Netflix#1678)

* [card-components] type-hints + doc string Fix.

* [card-core] fix function signature in tests.

* [card-server] address comments on debug mode and hygiene

* [card-components] vega charts special case inside table

---------

Co-authored-by: adam <203779+seethroughdev@users.noreply.github.com>

---------

Co-authored-by: adam <203779+seethroughdev@users.noreply.github.com>

---------

Co-authored-by: adam <203779+seethroughdev@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants