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") | DIR=$(dirname "$0") | ||||||
| 
 | 
 | ||||||
| # install node modules | # 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 | # Copy admin-lte dist | ||||||
| mkdir -p "${DIR}/assets/dist/js" "${DIR}/assets/dist/css" && \ | mkdir -p "${DIR}/assets/dist/js" "${DIR}/assets/dist/css" && \ | ||||||
|  |  | ||||||
|  | @ -14,6 +14,20 @@ Connected Peers | ||||||
| {{end}} | {{end}} | ||||||
| 
 | 
 | ||||||
| {{define "page_content"}} | {{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"> | <section class="content"> | ||||||
|     <div class="container-fluid"> |     <div class="container-fluid"> | ||||||
|         {{ if .error }} |         {{ if .error }} | ||||||
|  | @ -41,8 +55,8 @@ Connected Peers | ||||||
|                 <td>{{ $peer.Name }}</td> |                 <td>{{ $peer.Name }}</td> | ||||||
|                 <td>{{ $peer.Email }}</td> |                 <td>{{ $peer.Email }}</td> | ||||||
|                 <td>{{ $peer.PublicKey }}</td> |                 <td>{{ $peer.PublicKey }}</td> | ||||||
|                 <td>{{ $peer.ReceivedBytes }}</td> |                 <td title="{{ $peer.ReceivedBytes }} Bytes"><script>document.write(bytesToHumanReadable({{ $peer.ReceivedBytes }}))</script></td> | ||||||
|                 <td>{{ $peer.TransmitBytes }}</td> |                 <td title="{{ $peer.TransmitBytes }} Bytes"><script>document.write(bytesToHumanReadable({{ $peer.TransmitBytes }}))</script></td> | ||||||
|                 <td>{{ $peer.Connected }}</td> |                 <td>{{ $peer.Connected }}</td> | ||||||
|                 <td>{{ $peer.LastHandshakeTime }}</td> |                 <td>{{ $peer.LastHandshakeTime }}</td> | ||||||
|                </tr> |                </tr> | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue