updated the way to calculate time window - #26
Open
ljiang-slac wants to merge 5 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adjusts how the frontend computes the x-axis time window for time-synced plotting, and adds a helper script to start the Vite dev server (intended for manual use and/or systemd).
Changes:
- Update time-window anchoring in
MultiPVPlotto use the newest buffered data timestamp instead of the browser wall clock. - Add
start-frontend.shfor starting the frontend dev server with an NVM-based Node setup.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 7 comments.
| File | Description |
|---|---|
| start-frontend.sh | Adds a startup script for the Vite frontend dev server (Node/NVM setup + exec). |
| src/components/MultiPVPlot.jsx | Changes x-axis time-window calculation to anchor to latest buffered data timestamp when time sync is enabled. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| return; | ||
| } | ||
|
|
||
Comment on lines
219
to
230
| } | ||
|
|
||
|
|
||
|
|
||
|
|
||
| //if (timeSyncEnabled) { | ||
| // const now = new Date(); | ||
| // xMax = now; | ||
| // xMin = new Date(now.getTime() - globalTimeWindow * 1000); | ||
| //} | ||
|
|
||
| const traces = pvNames.map((pvName) => { |
| let xMax = null; | ||
|
|
||
|
|
||
| // use the last point data time stamp to replace current time |
Comment on lines
+13
to
+27
| export NVM_DIR="/home/b_bluesky/.nvm" | ||
| # shellcheck disable=SC1091 | ||
| [ -s "$NVM_DIR/nvm.sh" ] && source "$NVM_DIR/nvm.sh" | ||
|
|
||
| # 使用指定的 node 版本(和你 which node 一致) | ||
| nvm use v20.11.1 >/dev/null 2>&1 || true | ||
|
|
||
| # 兜底:直接把 node bin 目录加进 PATH | ||
| export PATH="/home/b_bluesky/.nvm/versions/node/v20.11.1/bin:$PATH" | ||
|
|
||
| # ------------------------------------------------------------ | ||
| # 2. 进入项目目录 | ||
| # ------------------------------------------------------------ | ||
| cd /home/b_bluesky/Documents/epics-pv-plotter | ||
|
|
| # Can be run manually for testing, or invoked by systemd. | ||
| # | ||
|
|
||
| set -e # 出错即退出 |
Comment on lines
+3
to
+6
| # start-frontend.sh | ||
| # Starts the EPICS PV Plotter frontend (Vite dev server). | ||
| # Can be run manually for testing, or invoked by systemd. | ||
| # |
| # 4. 启动 Vite dev server | ||
| # exec 让 npm 进程替换当前 shell,便于 systemd 正确管理进程 | ||
| # ------------------------------------------------------------ | ||
| exec npm run dev -- --host 0.0.0.0 --port 5173 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.