I've modify the place where I inserted code to minimize the number of files touched. (#131)
This commit is contained in:
		
							parent
							
								
									e74a3a808f
								
							
						
					
					
						commit
						1da9b8418e
					
				|  | @ -4,7 +4,9 @@ set -e | |||
| DIR=$(dirname "$0") | ||||
| 
 | ||||
| # install node modules | ||||
| yarn install --pure-lockfile --production | ||||
| YARN=yarn | ||||
| [ -x /usr/bin/lsb_release ] && [ -n "`lsb_release -i | grep Debian`" ] && YARN=yarnpkg | ||||
| $YARN install --pure-lockfile --production | ||||
| 
 | ||||
| # Copy admin-lte dist | ||||
| mkdir -p "${DIR}/assets/dist/js" "${DIR}/assets/dist/css" && \ | ||||
|  |  | |||
|  | @ -14,6 +14,20 @@ Connected Peers | |||
| {{end}} | ||||
| 
 | ||||
| {{define "page_content"}} | ||||
| <script> | ||||
|   function bytesToHumanReadable(temporal) { | ||||
|     const units = [" ", " K", " M", " G", " T", " P", " E", " Z", " Y"] | ||||
|     let pow = 0 | ||||
| 
 | ||||
|     while (temporal > 1024) { | ||||
|       temporal /= 1024 | ||||
|       pow ++ | ||||
|       if (pow == units.length-1) break | ||||
|     } | ||||
| 
 | ||||
|     return parseFloat(temporal.toFixed(3)) + units[pow]+"Bytes" | ||||
|   } | ||||
| </script> | ||||
| <section class="content"> | ||||
|     <div class="container-fluid"> | ||||
|         {{ if .error }} | ||||
|  | @ -41,8 +55,8 @@ Connected Peers | |||
|                 <td>{{ $peer.Name }}</td> | ||||
|                 <td>{{ $peer.Email }}</td> | ||||
|                 <td>{{ $peer.PublicKey }}</td> | ||||
|                 <td>{{ $peer.ReceivedBytes }}</td> | ||||
|                 <td>{{ $peer.TransmitBytes }}</td> | ||||
|                 <td title="{{ $peer.ReceivedBytes }} Bytes"><script>document.write(bytesToHumanReadable({{ $peer.ReceivedBytes }}))</script></td> | ||||
|                 <td title="{{ $peer.TransmitBytes }} Bytes"><script>document.write(bytesToHumanReadable({{ $peer.TransmitBytes }}))</script></td> | ||||
|                 <td>{{ $peer.Connected }}</td> | ||||
|                 <td>{{ $peer.LastHandshakeTime }}</td> | ||||
|                </tr> | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue