Skip to content

Commit fe14daf

Browse files
HanSur94claude
andcommitted
feat(companion): show last-update time next to Live button
Adds an "Updated: HH:mm:ss" label between the Log header and the Live toggle. The orchestrator's live tick stamps it after each successful refreshLive() call, so the user can confirm at a glance that data is flowing (and see when it last did, after pausing). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 17f57ea commit fe14daf

1 file changed

Lines changed: 18 additions & 4 deletions

File tree

libs/FastSenseCompanion/FastSenseCompanion.m

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
hLogPanel_ = [] % bottom log uipanel (full-width)
5656
hLogText_ = [] % uitextarea inside hLogPanel_ (newest line first)
5757
hLiveBtn_ = [] % Live mode toggle button (in log strip header)
58+
hLastUpdateLbl_ = [] % "Updated 12:34:56" label next to live button
5859
LiveTimer_ = [] % MATLAB timer driving inspector refresh
5960
LivePeriod_ = 1.0 % seconds between live refreshes
6061
Theme_ = [] % resolved CompanionTheme struct
@@ -504,10 +505,10 @@ function buildLogStrip_(obj)
504505
g.RowSpacing = 4;
505506
g.BackgroundColor = t.WidgetBackground;
506507

507-
% Header row: label on the left, Live toggle on the right.
508-
gHdr = uigridlayout(g, [1 2]);
508+
% Header row: log label | last-update timestamp | Live toggle.
509+
gHdr = uigridlayout(g, [1 3]);
509510
gHdr.Layout.Row = 1; gHdr.Layout.Column = 1;
510-
gHdr.ColumnWidth = {'1x', 110};
511+
gHdr.ColumnWidth = {'1x', 160, 110};
511512
gHdr.RowHeight = {'1x'};
512513
gHdr.Padding = [0 0 0 0];
513514
gHdr.ColumnSpacing = 8;
@@ -519,8 +520,17 @@ function buildLogStrip_(obj)
519520
hLbl.FontColor = t.ForegroundColor;
520521
hLbl.HorizontalAlignment = 'left'; hLbl.VerticalAlignment = 'center';
521522

523+
obj.hLastUpdateLbl_ = uilabel(gHdr);
524+
obj.hLastUpdateLbl_.Layout.Row = 1; obj.hLastUpdateLbl_.Layout.Column = 2;
525+
obj.hLastUpdateLbl_.Text = 'Updated: --:--:--';
526+
obj.hLastUpdateLbl_.FontSize = 11; obj.hLastUpdateLbl_.FontName = 'Menlo';
527+
obj.hLastUpdateLbl_.FontColor = t.PlaceholderTextColor;
528+
obj.hLastUpdateLbl_.HorizontalAlignment = 'right';
529+
obj.hLastUpdateLbl_.VerticalAlignment = 'center';
530+
obj.hLastUpdateLbl_.Tooltip = 'Time of the last successful live refresh';
531+
522532
obj.hLiveBtn_ = uibutton(gHdr, 'push');
523-
obj.hLiveBtn_.Layout.Row = 1; obj.hLiveBtn_.Layout.Column = 2;
533+
obj.hLiveBtn_.Layout.Row = 1; obj.hLiveBtn_.Layout.Column = 3;
524534
obj.hLiveBtn_.Text = 'Live: OFF';
525535
obj.hLiveBtn_.FontSize = 11; obj.hLiveBtn_.FontWeight = 'bold';
526536
obj.hLiveBtn_.Tooltip = 'Toggle live refresh of the inspector';
@@ -565,6 +575,10 @@ function onLiveTick_(obj)
565575
&& ismethod(obj.InspectorPane_, 'refreshLive')
566576
obj.InspectorPane_.refreshLive();
567577
end
578+
if ~isempty(obj.hLastUpdateLbl_) && isvalid(obj.hLastUpdateLbl_)
579+
obj.hLastUpdateLbl_.Text = sprintf('Updated: %s', ...
580+
char(datetime('now', 'Format', 'HH:mm:ss')));
581+
end
568582
catch
569583
% Live ticks must never crash the timer.
570584
end

0 commit comments

Comments
 (0)