fix: 调整进度条的步幅

This commit is contained in:
SikongJueluo 2025-08-17 14:23:35 +08:00
parent caa26c729e
commit 8e69c96891
No known key found for this signature in database
5 changed files with 5 additions and 5 deletions

View File

@ -183,7 +183,7 @@ public class JtagController : ControllerBase
logger.Info($"User {username} processing bitstream file of size: {fileBytes.Length} bytes"); logger.Info($"User {username} processing bitstream file of size: {fileBytes.Length} bytes");
// 定义进度跟踪 // 定义进度跟踪
var taskId = _tracker.CreateTask(1000); var taskId = _tracker.CreateTask(10000);
_tracker.AdvanceProgress(taskId, 10); _tracker.AdvanceProgress(taskId, 10);
_ = Task.Run(async () => _ = Task.Run(async () =>

View File

@ -37,7 +37,7 @@ public class ProgressInfo
{ {
public required string TaskId { get; set; } public required string TaskId { get; set; }
public required ProgressStatus Status { get; set; } public required ProgressStatus Status { get; set; }
public required int ProgressPercent { get; set; } public required double ProgressPercent { get; set; }
public required string ErrorMessage { get; set; } public required string ErrorMessage { get; set; }
}; };

View File

@ -50,7 +50,7 @@ public readonly struct TaskProgress
TaskState.Cancelled => ProgressStatus.Canceled, TaskState.Cancelled => ProgressStatus.Canceled,
_ => ProgressStatus.Failed _ => ProgressStatus.Failed
}, },
ProgressPercent = Total > 0 ? (Current * 100) / Total : 0, ProgressPercent = Total > 0 ? ((double)Current * 100) / (double)Total : 0,
ErrorMessage = Error ?? string.Empty ErrorMessage = Error ?? string.Empty
}; };
} }

View File

@ -677,7 +677,7 @@ public sealed class UDPClientPool
if (!udpWriteAck.Value.IsSuccessful) if (!udpWriteAck.Value.IsSuccessful)
return false; return false;
_progressTracker.AdvanceProgress(progressId, 5); _progressTracker.AdvanceProgress(progressId, 1);
} }
return true; return true;

View File

@ -24,7 +24,7 @@ export type ProgressInfo = {
taskId: string; taskId: string;
/** Transpiled from server.Hubs.ProgressStatus */ /** Transpiled from server.Hubs.ProgressStatus */
status: ProgressStatus; status: ProgressStatus;
/** Transpiled from int */ /** Transpiled from double */
progressPercent: number; progressPercent: number;
/** Transpiled from string */ /** Transpiled from string */
errorMessage: string; errorMessage: string;