Display loading and save progress bars#2973
Conversation
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>
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" |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
please move this variable initialisation inside the reportProgress
| width: 8em; | ||
| } | ||
|
|
||
| .with-progress-bar .agent-logo { |
There was a problem hiding this comment.
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> |
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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) |
| } | ||
|
|
||
| case Device.ActionTypes.SaveConfigurationProgressChanged: { | ||
| if (state.saveToKeyboard.text !== 'Saving') { |
There was a problem hiding this comment.
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
Summary
Closes #2355
Test plan
Made with Cursor