* VRFS-3071 - progress indicator for download
This commit is contained in:
parent
7d5e92baaa
commit
13e4e816d9
|
|
@ -190,7 +190,10 @@ context.JK.DownloadJamTrack = class DownloadJamTrack
|
|||
showDownloading: () =>
|
||||
@logger.debug("showing #{@state.name}")
|
||||
# while downloading, we don't run the transition timer, because the download API is guaranteed to call success, or failure, eventually
|
||||
context.jamClient.JamTrackDownload(@jamTrack.id, context.JK.currentUserId, this.makeDownloadSuccessCallback(), this.makeDownloadFailureCallback())
|
||||
context.jamClient.JamTrackDownload(@jamTrack.id, context.JK.currentUserId,
|
||||
this.makeDownloadProgressCallback(),
|
||||
this.makeDownloadSuccessCallback(),
|
||||
this.makeDownloadFailureCallback())
|
||||
|
||||
showKeying: () =>
|
||||
@logger.debug("showing #{@state.name}")
|
||||
|
|
@ -384,7 +387,7 @@ context.JK.DownloadJamTrack = class DownloadJamTrack
|
|||
else
|
||||
progress = '...'
|
||||
|
||||
@root.find('.progress').text(progress)
|
||||
@root.find('.state-packaging .progress').text(progress)
|
||||
|
||||
processSigningState: (jamTrackRight) =>
|
||||
signingState = jamTrackRight.signing_state
|
||||
|
|
@ -481,12 +484,22 @@ context.JK.DownloadJamTrack = class DownloadJamTrack
|
|||
this.expectTransition()
|
||||
this.processSigningState(data.body)
|
||||
|
||||
downloadProgressCallback: (bytesReceived, bytesTotal, downloadSpeedMegSec, timeRemaining) =>
|
||||
bytesReceived = Number(bytesReceived)
|
||||
bytesTotal = Number(bytesTotal)
|
||||
# bytesTotal from Qt is not trust worthy; trust server's answer instead
|
||||
#progressWidth = ((bytesReceived / updateSize) * 100).toString() + "%";
|
||||
# $('#progress-bar').width(progressWidth)
|
||||
updateDownloadProgress: () =>
|
||||
|
||||
if @bytesReceived? and @bytesTotal?
|
||||
progress = "#{Math.round(@bytesReceived/@bytesTotal * 100)}%"
|
||||
else
|
||||
progress = '0%'
|
||||
|
||||
@root.find('.state-downloading .progress').text(progress)
|
||||
|
||||
downloadProgressCallback: (bytesReceived, bytesTotal) =>
|
||||
@logger.debug("download #{bytesReceived}/#{bytesTotal}")
|
||||
|
||||
@bytesReceived = Number(bytesReceived)
|
||||
@bytesTotal = Number(bytesTotal)
|
||||
|
||||
setTimeout(this.updateDownloadProgress, 100)
|
||||
|
||||
downloadSuccessCallback: (updateLocation) =>
|
||||
# is the package loadable yet?
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@
|
|||
font-size: 12px;
|
||||
padding-top:5px;
|
||||
z-index:0;
|
||||
margin-top:-18px;
|
||||
|
||||
a {
|
||||
margin:0 10px;
|
||||
|
|
|
|||
|
|
@ -39,11 +39,15 @@ script type="text/template" id="template-download-jamtrack-state-downloading"
|
|||
.state-downloading
|
||||
.large.hidden
|
||||
.msg
|
||||
| Your JamTrack is currently being downloaded.
|
||||
| Your JamTrack is currently being downloaded. (
|
||||
span.progress 0%
|
||||
| )
|
||||
.spinner-large
|
||||
.small.hidden
|
||||
.msg
|
||||
| {{data.name}} (downloading)
|
||||
| {{data.name}} (downloading -
|
||||
span.progress 0%
|
||||
| )
|
||||
.spinner-small
|
||||
|
||||
script type="text/template" id="template-download-jamtrack-state-keying"
|
||||
|
|
|
|||
Loading…
Reference in New Issue