19
19
20
20
< link Content-Type ="text/css " href ="/iotstyle.css " rel ="stylesheet " />
21
21
< script src ="/micro.js "> </ script >
22
+ < script src ="/sfc/loader.js "> </ script >
23
+ < script >
24
+ var allComponentsLoaded = window . loadComponent ( 'u-piechart' , '/sfc' ) ;
25
+ </ script >
22
26
</ head >
23
27
24
28
< body >
@@ -70,9 +74,10 @@ <h3>File System Memory</h3>
70
74
</ div >
71
75
72
76
< div class ="block ">
73
- < object id ="meminfo " data ="chartpie.svg " type ="image/svg+xml " style ="float:left;width:120px;height:120px;margin-right: 1rem; "> </ object >
77
+ < u-piechart id ="meminfo " style ="float:left;width:220px;margin-right: 1rem; "> </ u-piechart >
78
+
74
79
< p > < span id ="memTotal "> </ span > bytes available.</ p >
75
- < p > < span id ="memUsed "> </ span > bytes ( < span id =" memPart " > </ span > %) in use</ p >
80
+ < p > < span id ="memUsed "> </ span > bytes in use</ p >
76
81
</ div >
77
82
</ div >
78
83
@@ -109,9 +114,10 @@ <h3>Dev-Links</h3>
109
114
< p > < a href ="portal.htm "> portal.htm</ a > </ p >
110
115
< p > < a href ="portalconfig.htm "> portalConfig.htm</ a > </ p >
111
116
< p > < a href ="monitor.htm "> monitor.htm</ a > </ p >
112
- < p > < a href ="iotstylecheck.htm "> iotStyleCheck</ a > </ p >
117
+ < p > < a href ="test-iotstyle.htm "> test-iotstyle</ a > </ p >
118
+ < p > < a href ="test-piechart.htm "> test-piechart</ a > </ p >
119
+
113
120
< p > < a href ="chartline-test.htm "> chartLine-test</ a > </ p >
114
- < p > < a href ="chartpie-test.htm "> chartPie-test</ a > </ p >
115
121
< p > < a href ="chartgauge-test.htm "> gauge-test</ a > </ p >
116
122
< p > < a href ="elementcheck.htm "> elementcheck</ a > </ p >
117
123
</ div >
@@ -129,7 +135,7 @@ <h3>Diag</h3>
129
135
</ div >
130
136
131
137
< script >
132
- window . onerror = function ( msg , url , lineNo , columnNo , error ) {
138
+ window . onerror = function ( msg , url , lineNo , columnNo , error ) {
133
139
var string = msg . toLowerCase ( ) ;
134
140
var substring = 'script error' ;
135
141
if ( string . indexOf ( substring ) > - 1 ) {
@@ -151,13 +157,10 @@ <h3>Diag</h3>
151
157
</ script >
152
158
153
159
< script >
154
- var memObj = document . getElementById ( 'meminfo' ) ;
155
- var memAPI ;
156
-
157
- window . addEventListener ( 'load' , function ( ) {
158
- memAPI = memObj . getSVGDocument ( ) . api ;
160
+ var memObj = document . querySelector ( '#meminfo' ) ;
161
+ window . addEventListener ( 'load' , function ( ) {
159
162
fetchJSON ( '/api/sysinfo' )
160
- . then ( function ( d ) {
163
+ . then ( async ( d ) => {
161
164
var o = document . getElementById ( 'sysinfo' ) ;
162
165
o . innerText = JSON . stringify ( d , null , 1 )
163
166
. replace ( '{\n' , '' )
@@ -166,24 +169,26 @@ <h3>Diag</h3>
166
169
167
170
document . getElementById ( 'memTotal' ) . textContent = d . fsTotalBytes ;
168
171
document . getElementById ( 'memUsed' ) . textContent = d . fsUsedBytes ;
169
- document . getElementById ( 'memPart' ) . textContent = Math . round ( ( Number ( d . fsUsedBytes ) * 100 ) / Number ( d . fsTotalBytes ) ) ;
170
172
171
- memAPI . draw ( [
173
+ await allComponentsLoaded ;
174
+
175
+ memObj . setOptions ( { showPercentage : true } ) ;
176
+ memObj . draw ( [
172
177
{
173
- color : '#304878 ' ,
178
+ color : '#223355 ' ,
174
179
title : "Used" ,
175
180
value : Number ( d [ 'fsUsedBytes' ] )
176
181
} ,
177
182
{
178
- color : '#cfc ' ,
183
+ color : 'silver ' ,
179
184
title : "Available" ,
180
185
value : Number ( d . fsTotalBytes ) - Number ( d . fsUsedBytes )
181
186
}
182
187
] ) ;
183
188
} ) ;
184
189
185
190
fetchJSON ( '/api/state' )
186
- . then ( function ( d ) {
191
+ . then ( function ( d ) {
187
192
var o = document . querySelector ( '#stateInfo' ) ;
188
193
o . innerText = JSON . stringify ( d , null , 1 )
189
194
. replace ( '{\n' , '' )
@@ -193,7 +198,7 @@ <h3>Diag</h3>
193
198
} ) ;
194
199
195
200
fetchJSON ( '/api/elements' )
196
- . then ( function ( d ) {
201
+ . then ( function ( d ) {
197
202
var o = document . querySelector ( '#elementsInfo' ) ;
198
203
o . innerText = d . join ( ', ' ) ;
199
204
} ) ;
0 commit comments