mirror of
https://git.sr.ht/~phw/scotty
synced 2025-05-11 02:27:05 +02:00
Show progress bars as aborted on export / import error
This commit is contained in:
parent
15d939e150
commit
aae5123c3d
12 changed files with 35 additions and 21 deletions
|
@ -59,10 +59,12 @@ func setupProgressBar(p *mpb.Progress, name string) *mpb.Bar {
|
|||
),
|
||||
mpb.AppendDecorators(
|
||||
decor.OnComplete(
|
||||
decor.EwmaETA(decor.ET_STYLE_GO, 0, decor.WC{C: decor.DSyncWidth}),
|
||||
decor.OnAbort(
|
||||
decor.EwmaETA(decor.ET_STYLE_GO, 0, decor.WC{C: decor.DSyncWidth}),
|
||||
i18n.Tr("error"),
|
||||
),
|
||||
i18n.Tr("done"),
|
||||
),
|
||||
// decor.OnComplete(decor.Percentage(decor.WC{W: 5, C: decor.DSyncWidthR}), "done"),
|
||||
decor.Name(" "),
|
||||
),
|
||||
)
|
||||
|
@ -73,6 +75,10 @@ func updateProgressBar(bar *mpb.Bar, wg *sync.WaitGroup, progressChan chan model
|
|||
defer wg.Done()
|
||||
lastIterTime := time.Now()
|
||||
for progress := range progressChan {
|
||||
if progress.Aborted {
|
||||
bar.Abort(false)
|
||||
return
|
||||
}
|
||||
oldIterTime := lastIterTime
|
||||
lastIterTime = time.Now()
|
||||
bar.EwmaSetCurrent(progress.Elapsed, lastIterTime.Sub(oldIterTime))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue