fix: 调整进度条的步幅
This commit is contained in:
parent
caa26c729e
commit
8e69c96891
|
@ -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 () =>
|
||||||
|
|
|
@ -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; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -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
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -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;
|
||||||
|
|
Loading…
Reference in New Issue