mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-29 02:10:08 +00:00
added remaining time to progress (experimental)...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
9878b72a1e
commit
5acd8d2afc
@ -2766,10 +2766,10 @@ function(title, func){
|
|||||||
// NOTE: we are also adding a ref to args here to keep things consistent...
|
// NOTE: we are also adding a ref to args here to keep things consistent...
|
||||||
args.length > 0
|
args.length > 0
|
||||||
&& (args = [args])
|
&& (args = [args])
|
||||||
q.push(...(items instanceof Array ?
|
q.add(items instanceof Array ?
|
||||||
items.map(function(e){
|
items.map(function(e){
|
||||||
return [e, ...args] })
|
return [e, ...args] })
|
||||||
: [items, ...args]))
|
: [items, ...args])
|
||||||
return q.promise() } }
|
return q.promise() } }
|
||||||
|
|
||||||
// run...
|
// run...
|
||||||
|
|||||||
@ -94,7 +94,9 @@ var ProgressActions = actions.Actions({
|
|||||||
// XXX multiple containers...
|
// XXX multiple containers...
|
||||||
// XXX shorten the nested css class names...
|
// XXX shorten the nested css class names...
|
||||||
// XXX revise styles...
|
// XXX revise styles...
|
||||||
// XXX make the "X" bigger -- finger usable...
|
// XXX make the "X" finger usable...
|
||||||
|
// XXX add time estimation...
|
||||||
|
// ....based on last 10 tasks...
|
||||||
__progress_cache: null,
|
__progress_cache: null,
|
||||||
showProgress: ['- Interface/Show progress bar...',
|
showProgress: ['- Interface/Show progress bar...',
|
||||||
core.doc`Progress bar widget...
|
core.doc`Progress bar widget...
|
||||||
@ -168,9 +170,26 @@ var ProgressActions = actions.Actions({
|
|||||||
: parseInt(value))
|
: parseInt(value))
|
||||||
: v) }
|
: v) }
|
||||||
|
|
||||||
value = updateValue('value', value)
|
// XXX REMAINING_TIME
|
||||||
|
var prev = cache.prev || 0
|
||||||
|
value = cache.prev = updateValue('value', value)
|
||||||
max = updateValue('max', max)
|
max = updateValue('max', max)
|
||||||
|
|
||||||
|
// XXX REMAINING_TIME
|
||||||
|
// estimate time to completion...
|
||||||
|
var t0 = cache.timestamp || Date.now()
|
||||||
|
var t = (cache.timestamp = Date.now()) - t0
|
||||||
|
var avg = cache.avg_time =
|
||||||
|
// rolling average -- feels a bit too smooth...
|
||||||
|
(((cache.avg_time || 0) * prev + t) / value) || 0
|
||||||
|
var remaining = new Date(0)
|
||||||
|
avg > 0
|
||||||
|
&& remaining.setMilliseconds(
|
||||||
|
avg
|
||||||
|
* (max-value)
|
||||||
|
// make the estimate a bit pessimistic...
|
||||||
|
* 1.3)
|
||||||
|
|
||||||
// update not due yet...
|
// update not due yet...
|
||||||
if('timeout' in cache){
|
if('timeout' in cache){
|
||||||
cache.update = true
|
cache.update = true
|
||||||
@ -258,13 +277,21 @@ var ProgressActions = actions.Actions({
|
|||||||
timeout
|
timeout
|
||||||
&& clearTimeout(JSON.parse(timeout))
|
&& clearTimeout(JSON.parse(timeout))
|
||||||
|
|
||||||
|
//* XXX REMAINING_TIME
|
||||||
|
// time remaining...
|
||||||
|
var t = remaining ?
|
||||||
|
` t:-${
|
||||||
|
remaining.toISOString()
|
||||||
|
.substr(11, 8)
|
||||||
|
.replace(/^00:/, '') }s`
|
||||||
|
: ''
|
||||||
// format the message...
|
// format the message...
|
||||||
msg = msg ? ': '+msg : ''
|
msg = msg ? ': '+msg : ''
|
||||||
msg = ' '+ msg
|
msg = ' '+ msg
|
||||||
+ (value && value >= (max || 0) ?
|
+ (value && value >= (max || 0) ?
|
||||||
' (done)'
|
' (done)'
|
||||||
: max && value != max ?
|
: max && value != max ?
|
||||||
' ('+ (value || 0) +' of '+ max +')'
|
` (${value || 0} of ${max}${t})`
|
||||||
: '...')
|
: '...')
|
||||||
|
|
||||||
// update widget...
|
// update widget...
|
||||||
|
|||||||
6
Viewer/package-lock.json
generated
6
Viewer/package-lock.json
generated
@ -1211,9 +1211,9 @@
|
|||||||
"integrity": "sha512-7gSU0Qg4E0rnCPuITu6nJzgr4N73tFN57CISVrQjB+EglixfDI5SwOVRgPtG0EBOgtE8IL4O7fmq/UV87OUYyA=="
|
"integrity": "sha512-7gSU0Qg4E0rnCPuITu6nJzgr4N73tFN57CISVrQjB+EglixfDI5SwOVRgPtG0EBOgtE8IL4O7fmq/UV87OUYyA=="
|
||||||
},
|
},
|
||||||
"ig-types": {
|
"ig-types": {
|
||||||
"version": "6.0.6",
|
"version": "6.0.7",
|
||||||
"resolved": "https://registry.npmjs.org/ig-types/-/ig-types-6.0.6.tgz",
|
"resolved": "https://registry.npmjs.org/ig-types/-/ig-types-6.0.7.tgz",
|
||||||
"integrity": "sha512-TOW58/yBQ7YqFukFT5K2Qd7u9k1CYgoQXXreS6u7pw9ttcWJLC3hJUTcLWsHTPKm3vNbFJ0NVI1o1U3SQlUu5w==",
|
"integrity": "sha512-9pm+Hdq71v58B6NhLwsMqzHOpL5duAEHCX2UtGYG5iwGKZBxAr2DEl/tOn6Ui5xxq9mq1X6lW7PzXLrjXvuEgQ==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"ig-object": "^5.4.12",
|
"ig-object": "^5.4.12",
|
||||||
"object-run": "^1.0.1"
|
"object-run": "^1.0.1"
|
||||||
|
|||||||
@ -34,7 +34,7 @@
|
|||||||
"ig-argv": "^2.16.3",
|
"ig-argv": "^2.16.3",
|
||||||
"ig-features": "^3.4.5",
|
"ig-features": "^3.4.5",
|
||||||
"ig-object": "^5.4.14",
|
"ig-object": "^5.4.14",
|
||||||
"ig-types": "^6.0.6",
|
"ig-types": "^6.0.7",
|
||||||
"json5": "^2.1.3",
|
"json5": "^2.1.3",
|
||||||
"object-run": "^1.0.1",
|
"object-run": "^1.0.1",
|
||||||
"requirejs": "^2.3.6",
|
"requirejs": "^2.3.6",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user