Commit 1e97e10c01b52d7913be252f773d767c69120bcf
bring back peer sync progress
Matt McKegg committed on 6/10/2017, 12:37:08 AMParent: 78f161513725070b23d7b626a71e1ee9cea8a74d
Files changed
modules/page/html/render/public.js | changed |
modules/progress/html/peer.js | changed |
modules/page/html/render/public.js | ||
---|---|---|
@@ -202,10 +202,9 @@ | ||
202 | 202 | h('div.main', [ |
203 | 203 | h('div.name', [ api.about.obs.name(id) ]) |
204 | 204 | ]), |
205 | 205 | h('div.progress', [ |
206 | -//PROGRESS. this is where replication progress is shown? | |
207 | -// api.progress.html.peer(id) | |
206 | + api.progress.html.peer(id) | |
208 | 207 | ]) |
209 | 208 | ]) |
210 | 209 | }) |
211 | 210 | ]) |
modules/progress/html/peer.js | ||
---|---|---|
@@ -11,10 +11,20 @@ | ||
11 | 11 | |
12 | 12 | exports.create = function (api) { |
13 | 13 | return nest('progress.html.peer', function (id) { |
14 | 14 | var progress = api.progress.obs.peer(id) |
15 | - var feeds = api.progress.obs.global().feeds | |
16 | 15 | |
16 | + var max = 0 | |
17 | + var feeds = computed([api.progress.obs.global().feeds, progress], function (feeds, progress) { | |
18 | + // handle when feeds hasn't finished loading yet, take max from progress | |
19 | + if (progress) { | |
20 | + max = Math.max(max, feeds || 0, progress) | |
21 | + } else { | |
22 | + max = feeds | |
23 | + } | |
24 | + return max | |
25 | + }) | |
26 | + | |
17 | 27 | var value = computed([progress, feeds], (pending, feeds) => { |
18 | 28 | return (feeds - pending) / feeds |
19 | 29 | }) |
20 | 30 |
Built with git-ssb-web