Add uptime to settings page

This commit is contained in:
Taylor Helsper 2019-06-29 10:53:49 -05:00
parent 262c75b69c
commit 2b7d6364e9
3 changed files with 13 additions and 1 deletions

View File

@ -28,6 +28,12 @@ def get_latest_version():
return latest_version
def get_system_uptime():
uptime = subprocess.check_output('awk \'{print int($1/86400)" days "int($1%86400/3600)" hour(s) "int(($1%3600)/60)" minute(s) "int($1%60)" seconds(s)"}\' /proc/uptime', shell=True)
uptime = uptime.strip()
return uptime
def get_device_serial():
serial = subprocess.check_output("cat /proc/cpuinfo | grep Serial | cut -d ' ' -f 2", shell=True)
serial = serial.strip()

View File

@ -101,6 +101,7 @@ def page_settings():
product_key = get_product_key()
pk_skipped = skipped_product_key()
pk_error = not is_valid_product_key()
uptime = get_system_uptime()
templateData = {
"title": "myNode Settings",
@ -110,7 +111,8 @@ def page_settings():
"serial_number": serial_number,
"product_key": product_key,
"product_key_skipped": pk_skipped,
"product_key_error": pk_error
"product_key_error": pk_error,
"uptime": uptime
}
return render_template('settings.html', **templateData)

View File

@ -198,6 +198,10 @@
<td>Product Key</td>
<td style="padding-left: 20px;">{{product_key}}</td>
</tr>
<tr>
<td>Uptime</td>
<td style="padding-left: 20px;">{{uptime}}</td>
</tr>
</table>
<div class="divider"></div>