feat: add activity warning indicators and toast notifications - #1338
feat: add activity warning indicators and toast notifications#1338thaorell wants to merge 1 commit into
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
christian-heusel
left a comment
There was a problem hiding this comment.
@thaorell I think you need to drop the conventional commit scope from the title to make the action happy 😅
-feat(frontend): add activity warning indicators and toast notifications
+feat: add activity warning indicators and toast notifications…ns (kubeflow#1203) Add warning/critical visual indicators on workspace table rows when a workspace approaches its auto-pause threshold, plus toast notifications on state transitions. Warnings clear automatically when the next data refresh shows updated activity. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Charles Thao <cthao@redhat.com>
c0afa79 to
2af876b
Compare
christian-heusel
left a comment
There was a problem hiding this comment.
This already looks quite good, I gave it a quick review 😊
| const ACTIVITY_WARNING_THRESHOLD_MS = 15 * 60 * 1000; | ||
| const ACTIVITY_CRITICAL_THRESHOLD_MS = 5 * 60 * 1000; |
There was a problem hiding this comment.
I'm not sure whether we can actually make this warning fixed given the potentially quite different horizons on the activityRules side 🤔
There was a problem hiding this comment.
is there a planned task to provide some kind of threshold in the API return data? These limits are detailed in #1203
There was a problem hiding this comment.
Then disregard the comment, I'll re-start the discussion in case this actually becomes an error.
| if (ms <= 0) { | ||
| return 'less than a minute'; | ||
| } |
There was a problem hiding this comment.
I do not understand what the logic in this code snipping is doing 😅
| if (!isFirstRenderRef.current) { | ||
| for (const ws of workspaces) { | ||
| const key = workspaceKey(ws); | ||
| const status = statusByKey.get(key)!; | ||
| const currentLevel = currentLevels.get(key) ?? ActivityWarningLevel.None; | ||
| const prevLevel = prevLevelsRef.current.get(key) ?? ActivityWarningLevel.None; | ||
|
|
||
| if (currentLevel === ActivityWarningLevel.None || currentLevel === prevLevel) { | ||
| continue; | ||
| } | ||
|
|
||
| const isEscalation = | ||
| prevLevel === ActivityWarningLevel.None || prevLevel === ActivityWarningLevel.Warning; | ||
|
|
||
| if (isEscalation) { | ||
| const timeStr = | ||
| status.timeRemainingMs != null ? formatTimeRemaining(status.timeRemainingMs) : 'soon'; | ||
| const action = status.actionMessage ?? 'paused'; | ||
| notification.warning(`Workspace "${ws.name}" will be ${action} in ${timeStr}`); | ||
| } | ||
| } | ||
| } |
There was a problem hiding this comment.
Do I understand correctly that in order for this to fire the page has to stay open? 🤔
Add warning/critical visual indicators on workspace table rows when a workspace approaches its auto-pause threshold, plus toast notifications on state transitions. Warnings clear automatically when the next data refresh shows updated activity.
closes: #1203

