@@ -22,23 +22,25 @@ exports.create = function (api) {
2222 const indexProgress = computed ( indexes , calcProgress ) ;
2323 const pluginIndexes = api . progress . obs . plugins ( ) ;
2424 const peer = api . progress . obs . peer ( ) ;
25- const pluginIndexesDict = Dict ( ) ;
2625 const indexesJson = computed (
2726 [ indexes , pluginIndexes ] ,
2827 ( indexes , plugins ) => {
29- Object . keys ( plugins ) . forEach ( ( k ) => {
30- pluginIndexesDict . put (
31- k ,
32- calcProgress ( {
33- target : indexes . target ,
34- start : indexes . start ,
35- current : plugins [ k ] ,
36- } ) ,
37- ) ;
38- } ) ;
3928 return JSON . stringify ( { indexes, plugins } , null , 4 ) ;
4029 } ,
4130 ) ;
31+ const pluginProgress = computed ( [ indexes , pluginIndexes ] , ( indexes , plugins ) => {
32+ const keys = Object . keys ( plugins )
33+ const result = [ ]
34+ keys . forEach ( k => {
35+ const obj = {
36+ target : indexes . target ,
37+ start : indexes . start ,
38+ current : plugins [ k ]
39+ }
40+ result . push ( [ k , calcProgress ( obj ) ] )
41+ } )
42+ return result
43+ } )
4244 const statusObj = computed ( [ peer ] , ( peer ) => {
4345 return JSON . stringify ( peer , null , 4 ) ;
4446 } ) ;
@@ -89,23 +91,17 @@ exports.create = function (api) {
8991 } ) ,
9092 ] ) ,
9193
92- map ( dictToCollection ( pluginIndexesDict ) , ( item ) => {
93- const v = calcProgress ( {
94- target : indexes . target ,
95- start : indexes . start ,
96- current : item . value ( ) ,
97- } ) ;
98- console . log ( `${ item ?. key ( ) } : ${ v } ` )
94+ map ( pluginProgress , ( item ) => {
9995 return h ( "ReportItem" , [
100- h ( "span.info" , item . key ) ,
96+ h ( "span.info" , item [ 0 ] ) ,
10197 h ( "meter" , {
10298 style : { "margin-left" : "10px" } ,
10399 min : 0 ,
104100 max : 1 ,
105101 low : 0.5 ,
106102 high : 0.9 ,
107103 optimum : 0.97 ,
108- value : v ,
104+ value : item [ 1 ] ,
109105 } ) ,
110106 ] ) ;
111107 } ) ,
0 commit comments