-
Notifications
You must be signed in to change notification settings - Fork 438
Extended chart link to support from latest readings #1530
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
base: development
Are you sure you want to change the base?
Conversation
- Added "Chart Link Options:" section title - Moved "Hide Options When Using This Link" checkbox outside of button (UI only, logic unchanged) - Added "Keep Chart Current" checkbox (UI only, logic not implemented yet) - Added tooltips for both checkboxes (tooltip content for "Keep Chart Current" still pending) - Preserved original behavior for hide options feature
…box and timespan parameter
Updated UI + Checkbox Visibility
…met, aswell as the checkbox being disabled under the same conditions.
Ann rian UI
Addding backend functionality
Connected back-end to front-end
huss
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks to @w-b-d, @anntreasajojo, @rianhassett & @nickhitos for this contribution, esp. since I think it is your first one to OED. Overall, it works well. I have made a few comments within files to consider. Here are some global ones:
The box indicating everyone signed the CLA is checked but the OED records do not show that @rianhassett & @nickhitos have signed. Could they please sign or let me know if you think our records are off.
I tried using a chart link from a graphic that had the slider range set so the left side differed from the data range of the graphic. If I don't use the new option then it reproduces the slider range. If I use the new option then it does not. I also tried to test the new option by doing: const now = moment('2025-08-28 10:35:00'); in timeSpan in src/client/app/redux/slices/graphSlice.ts. This shifted the current time forward to convince the code the chart link was used in the future. It seems to do that and changes leftBound but it does not change what the graphic shows. I have not investigated the cause. I looked at the design document and it talks about two values that needed to be fixed (in the general case): 1) the data fetched from the server (server range); 2) the points displayed on the graphic (slider range). The code in src/client/app/redux/slices/graphSlice.ts only seems to adjust current.rangeSliderInterval and I think it might relate to that. I appreciate this is subtle so please ask questions or seek my help (I can do video calls) as needed.
| { | ||
| "version": "0.2.0", | ||
| "configurations": [ | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file only has new blank lines so please revert changes so none in file.
| @@ -0,0 +1,7 @@ | |||
| [31morigin/HEAD[m -> origin/development | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm unsure what this file is for. Should it be removed?
| @@ -0,0 +1,7 @@ | |||
| [31morigin/HEAD[m -> origin/development | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm unsure what this file is for. Should it be removed?
| # Visual Studio Code settings file | ||
| .vscode/settings.json | ||
|
|
||
| .vscode/launch.json |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file is used by OED to define the debugging setup, etc. I'm not sure it should be in .gitignore.
| },updateTimeCreated: state => { | ||
| state.current.timeCreated = new TimeInterval(moment(), moment()); | ||
| }, | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove blank line.
| const handleButtonClick = () => { | ||
| // First attempt to write directly to user's clipboard. | ||
| navigator.clipboard.writeText(linkText) | ||
| navigator.clipboard |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I preferred the old formatting without the extra lines to shorten the code.
| if (selectedMeters.length > 0 || selectedGroups.length > 0) { | ||
| return ( | ||
| <div> | ||
| {/* inputting new "keep chart current" feature */} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this comment should just say what the code does or be removed if you think it is not necessary.
| selectSelectedGroups, selectSelectedMeters, | ||
| selectSliderRangeInterval, selectInitialXAxisRange, | ||
| selectQueryTimeInterval, updateTimeIntervalAndSliderRange | ||
| selectQueryTimeInterval, updateTimeIntervalAndSliderRange,updateTimeCreated |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
space after comma.
| </div> | ||
| </Button> | ||
| <Button outline onClick={() => setLinkTextVisible(visible => !visible)}> | ||
| <Button |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can the original formatting please be put back since shorter and will remove these lines as having changes.
| break; | ||
| case 'timeSpan':{ | ||
| const days = parseFloat(value); | ||
| const now = moment(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a subtle point but this uses moment to get the current time (as was done in the link creation). This will use the time zone of the current system to get the time. If it differs from the time zone where the link was created then it will differ by the shift amount between the time zones. This means that if a user creates a chart link and quickly sends it to someone else in a different time zone that uses it quickly, the graph will be slightly different. I think this is a small concern but here is a proposal to fix it up:
OED tries to avoid this issue with readings by storing them all in UTC. The time help page discusses this. I propose that the time used in all the calculations be UTC for the current time. Thus, the time at a given point is the same everywhere in the world in UTC and moment() will give this value. It also means that the time sent to the server for readings will relate to the time zone used for readings.
I'm also happy to help make this happen by either working with you or doing it as an addition to this work. Having done a fair amount with time zones in moment I can say it can be a little tricky to use the right code (and why there are so many comment about it in the code). I welcome your thoughts on doing this and how it will get done.
Hey @huss! Thanks for the feedback, currently our classes just started but I do want to continue with this, I will try fixing these issues when I can. |
@rianhassett Thanks for letting me know. This work is not on a tight clock so as long as it moves forward at a reasonable pace that is fine. I understand that you have classes. Anyone else on the team is welcome to continue. Also, I have your (and all the CLAs) now. |
@w-b-d, @anntreasajojo, @rianhassett & @nickhitos I was looking at all the open PRs and wanted to touch base to verify you still want to work on this. Thanks for any information. |
Description
Extend chart link to support from latest readings. Users can now select "keep current" and the current timespan within the slider range will be saved as a parameter in the URL. If the right is bounded, the "keep current" checkbox is greyed out, as well as if the whole graph is unbounded the checkbox is greyed out. When a user changes the slider range, the graph must be refreshed for the "keep current" functionality to work for the updated slider range.
Partly Addresses #[457]
Added "Chart Link Options:" section title.
Moved "Hide Options When Using This Link" checkbox outside of the button (UI only, logic unchanged).
Added "Keep Chart Current" checkbox with full logic implementation.
Implemented tooltip content for “Keep Chart Current” checkbox.
All hard coded strings moved into data.ts file for consistency and to support multiple languages.
Updated UI so that the "Keep Chart Current" checkbox remains visible but is disabled and greyed out when requirements are not met.
Preserved original behavior for the hide options feature.
Added isKeepCurrent variable in appStateSlice.ts
Added "&timeSpan=" to URL in uiSelectors.ts if keep current checkbox is checked
added timeCreated in graphSlice.ts and is updated within PlotNavComponent.tsx
added case for timeSpan within the processGraphLink function in graphSlice.ts to handle the logic of the "keep current" functionality.
Documentation for the Chart LInk should be updated so users will be able to understand the functionality of the new "keep current" checkbox.
Type of change
Checklist
Limitations
Tests have not been created using Mocha/Chai, which is why this is labeled as a partial address.
Contributors: @w-b-d, @anntreasajojo, @rianhassett, @nickhitos