Skip to content

Display loading and save progress bars#2973

Open
mondalaci wants to merge 2 commits into
masterfrom
feat/loading-save-progress-bars
Open

Display loading and save progress bars#2973
mondalaci wants to merge 2 commits into
masterfrom
feat/loading-save-progress-bars

Conversation

@mondalaci

Copy link
Copy Markdown
Member

Summary

  • Add a grayscale progress bar below the spinning agent icon on the startup loading screen, driven by real config read progress over IPC.
  • Add a left-to-right progress fill on the Save to keyboard button during saves, with monotonic progress that stays full through the Saved! state.
  • Report byte-based transfer progress from the main process and rebalance phase allocation so the bars track actual work instead of jumping at the end.

Closes #2355

Test plan

  • Start Agent with a connected keyboard and confirm the loading screen bar advances smoothly to 100% before the app opens.
  • Change a setting and click Save to keyboard; confirm the button fill tracks the save and stays full until Saved! disappears.
  • Verify progress in both light and dark themes.

Made with Cursor

Report byte-accurate progress over IPC during keyboard config transfer, show a grayscale bar on the startup loading screen, and fill the Save to keyboard button while saving.

Closes #2355

Co-authored-by: Cursor <cursoragent@cursor.com>
Comment thread packages/uhk-agent/src/services/device.service.ts Outdated
Comment thread packages/uhk-web/src/app/components/uhk-message/uhk-message.component.html Outdated
Use native progress element with WebKit styling fixes, restore smooth fill animation, and remove redundant loadConfigurationsInProgress guard.

Co-authored-by: Cursor <cursoragent@cursor.com>
{{state.text}}
<span class="progress-button__fill"
role="progressbar"
[attr.aria-valuenow]="state.progressPercent ?? 0"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please set the default value in the ngrx state and don't use the nullish coalescing operator (??).

this.logService.misc('[DeviceService] load user configuration');

let response: ConfigurationReply;
let progress = 0;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please move this variable initialisation inside the sendProgress function. If I see weel we don't use it outside

try {
await this.stopPollUhkDevice();

let progress = 0;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please move this variable inside the `sendProgress. If I see well we don't use it ouside of the function

reportTransferProgress(userConfigSize, offset);
}
);
reportTransferProgress(userConfigSize, hardwareConfigSize);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need this last progress reporting?


public async saveUserConfiguration(buffer: Buffer): Promise<void> {
public async saveUserConfiguration(buffer: Buffer, onProgress?: (percent: number) => void): Promise<void> {
let lastProgress = 0;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please move this variable initialisation inside the reportProgress

width: 8em;
}

.with-progress-bar .agent-logo {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need this special behavior? Does not enough modify the .agent-logo selector

[rotateLogo]="true"></uhk-message>
[rotateLogo]="true"
[showProgressBar]="true"
[progressPercent]="(progressPercent$ | async) ?? 0"></uhk-message>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please set the default value at state or selector level. Try to avoid from ?? operator

case App.ActionTypes.ConfigurationLoadingProgressChanged: {
const progress = (action as App.ConfigurationLoadingProgressChangedAction).payload;

if (!state.configLoading) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need this check? Is it possible we get status update while the config is not loading?


return {
...state,
configurationLoadingProgress: Math.max(state.configurationLoadingProgress, progress)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same question to this Math.max

}

case Device.ActionTypes.SaveConfigurationProgressChanged: {
if (state.saveToKeyboard.text !== 'Saving') {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need this check? Is it possible we got progress update while not saving?
If yes then I think better to use the state.saveToKeyboard.showProgress instead of text comparison

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Display loading bar

2 participants