Skip to content

Commit

Permalink
ui: keep timewindow with fixed range after Now button click
Browse files Browse the repository at this point in the history
This change fixes behavior of Now button in TimeScale component.
Before, when user selected some custom time range then clicked
Now button - it would not update charts because there was inconsistency.
Custom time range cannot be with "moving" attribute, it cannot be updated
every time to reflect most recent data as custom range has fixed end time.

This change checks if current preset is custom and doesn't set "moving"
attribute in this case.

Epic: None

Release note (ui change): proper handling of "Now" button on Time range
selector when custom time period was selected before.
  • Loading branch information
koorosh committed Nov 23, 2023
1 parent db3bcce commit 3bd3219
Showing 1 changed file with 6 additions and 1 deletion.
Expand Up @@ -183,7 +183,12 @@ export const TimeScaleDropdown: React.FC<TimeScaleDropdownProps> = ({
case ArrowDirection.CENTER:
// CENTER is used to set the time window to the current time.
endTime = now;
isMoving = true;
// Only predefined time ranges are considered to be moving window (ie Past Hour, Past 3 days, etc).
// Custom time window has specific start/end time and constant duration, and in this case we
// move time window with the same duration with end time = now() and keep it fixed as before.
if (key !== "Custom") {
isMoving = true;
}
break;
default:
getLogger().error("Unknown direction: ", direction);
Expand Down

0 comments on commit 3bd3219

Please sign in to comment.