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

Time systems plugin #1342

Merged
merged 40 commits into from
Jul 19, 2024
Merged

Time systems plugin #1342

merged 40 commits into from
Jul 19, 2024

Conversation

AaronPlave
Copy link
Contributor

@AaronPlave AaronPlave commented Jun 20, 2024

Introduces a client side plugin API for time input and display in the plans and plan pages. The UI will now look for a time-plugin.js file in the static/resources directory and the UI will load the file if available. This javascript file will supply an async getPlugin function that provides a partial set of functions and objects according to the plugin type. The plugin can load additional files from the static/resources directory if desired.

UI plugin examples repo: https://github.com/NASA-AMMOS/aerie-ui-plugin-examples

Closes #503

Follow up: #1379

Setup:

  • Clone the https://github.com/NASA-AMMOS/aerie-ui-plugin-examples repo or download the time-plugin.js file in each example folder along with any other files in the LMST build directory.
  • The UI will use the new PUBLIC_TIME_PLUGIN_ENABLED=true env variable to determine whether or not to fetch the time-plugin.js file from static/resources. Add this to your .env and/or to your aerie backend docker-compose file.
  • For local development:
    • Set PUBLIC_TIME_PLUGIN_ENABLED=true in your .env
    • Create a resources directory in the aerie-ui static directory and copy the built example files (choose the LMST plugin to start with) into resources. For LMST, the kernel files should be kept in a kernels subfolder, mirroring what exists in the plugin.
    • Run dev server as normal
  • For dockerized deployment:
    • Add the new env variable to the UI container section of the docker-compose file
    • Mount the following volumes to the UI container (change the paths to reflect where you put the plugin files):
      • ../aerie-ui-plugin-examples/examples/time/lmst/build/:/app/client/resources/
      • ../aerie-ui-plugin-examples/examples/time/lmst/build/resources/kernels/:/app/client/resources/kernels/
    • Run aerie as normal

Testing:

  • Perform the setup for both dev and dockerized environments and ensure that you can see dates being displayed and formatted with LMST on both the plans and plan pages. A "plugins loading" message should appear on each refresh of either page.
  • Remove/rename the time-plugin file to force a plugin loading failure and ensure that the UI shows a failure toast but continues to operate normally
  • Repeat the setup using another plugin example

TODO:

  • Code walkthrough
  • Support a default plan duration in MS in plugin and a formatter for plan duration (ms -> string)
  • What should this be called? A plugin? Time adaptation? Should any of this code be generic to hint at some sort of future expansion for plugins? -> Plugin
  • Error states and messages for plugin? -> Block interaction
  • Figure out if a store is the best way to house and call the plugin
  • Figure out if there should be a limit to the number of additional formats allowed
  • Figure out if we need to allow users to customize which additional formats are displayed in timeline and elsewhere in V1
  • Figure out if we need to indicate that durations are still in Earth times now that we support user supplied times -> no except for maybe plan duration
  • Figure out if there's a better way to load the plugin than on page load -> not at the moment
  • Plugin loading state design - should it block the UI while loading or should we try to make it as invisible as possible? Depends somewhat on expected load time for plugins. Current LMST plugin example loads very quickly but it's possible that other users may need to load more/larger resources over several seconds. -> block app entirely during loading
  • Figure out and test mounting static/resources in docker container
  • Rework all date picker usage to reflect plugin and/or make a plugin aware date picker component to abstract some of this
  • Figure out how to make timecraft spice not crash upon bad input or restart if crash detected
  • Use plugin time in Timeline Histogram tooltip and Simulation History
  • Bug fix simulated activity start and end times
  • Display additional times in timeline tooltip while holding shift (discuss)
  • Potentially allow the plugin to pipe errors into UI error console? Additionally, how do we want to handle exceptions/issues? Should the plugin be responsible for try/catch or should the UI?
  • Figure out how to load the plugin once on plan/plans page and not have to reload it when navigating to other pages and then back
  • Documentation Time plugin documentation aerie-docs#173
  • Make an issue for when a user zooms too far in timeline and causes invalid time range (not related to plugin work)

@AaronPlave AaronPlave requested a review from a team as a code owner June 20, 2024 20:36
@AaronPlave AaronPlave marked this pull request as draft June 20, 2024 20:36
@AaronPlave AaronPlave self-assigned this Jun 20, 2024
@AaronPlave AaronPlave marked this pull request as ready for review July 1, 2024 15:29
Copy link
Collaborator

@duranb duranb left a comment

Choose a reason for hiding this comment

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

I might have set it up wrong, but when I try to create a plan using LMST, clicking the Create button shows the following error Nevermind, I didn't set it up right.
Screenshot 2024-07-15 at 11 50 57 AM

src/sequence-adaptation.js Outdated Show resolved Hide resolved
src/routes/plans/[id]/+page.ts Outdated Show resolved Hide resolved
src/routes/plans/+page.svelte Outdated Show resolved Hide resolved
src/routes/plans/+page.svelte Outdated Show resolved Hide resolved
@AaronPlave AaronPlave merged commit ae7fd58 into develop Jul 19, 2024
5 checks passed
@AaronPlave AaronPlave deleted the prototype/lmst branch July 19, 2024 23:05
JosephVolosin pushed a commit that referenced this pull request Aug 20, 2024
* add UI plugin architecture with initial support scoped to time systems
* use time systems plugin to display and parse times throughout the plans and plan pages
* load time plugin if env var set
* hold shift to display additional time formats in timeline tooltip when hovering over activities and resources

---------

Co-authored-by: Chet Joswig <[email protected]>
JosephVolosin pushed a commit that referenced this pull request Oct 21, 2024
* add UI plugin architecture with initial support scoped to time systems
* use time systems plugin to display and parse times throughout the plans and plan pages
* load time plugin if env var set
* hold shift to display additional time formats in timeline tooltip when hovering over activities and resources

---------

Co-authored-by: Chet Joswig <[email protected]>
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.

Support LMST/LTST and other time systems
3 participants