themes: eliminate uses of luci.sys.loadavg()
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
This commit is contained in:
parent
64d0031233
commit
bfbc7f4bdf
4 changed files with 23 additions and 16 deletions
|
@ -13,10 +13,11 @@ You may obtain a copy of the License at
|
|||
-%>
|
||||
<%
|
||||
local sys = require "luci.sys"
|
||||
local util = require "luci.util"
|
||||
local http = require "luci.http"
|
||||
local disp = require "luci.dispatcher"
|
||||
|
||||
local hostname = sys.hostname()
|
||||
local boardinfo = util.ubus("system", "board")
|
||||
|
||||
local request = disp.context.path
|
||||
local request2 = disp.context.request
|
||||
|
@ -100,7 +101,7 @@ You may obtain a copy of the License at
|
|||
<html lang="<%=luci.i18n.context.lang%>">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title><%=striptags( hostname .. ( (node and node.title) and ' - ' .. translate(node.title) or '')) %> - LuCI</title>
|
||||
<title><%=striptags( (boardinfo.hostname or "?") .. ( (node and node.title) and ' - ' .. translate(node.title) or '')) %> - LuCI</title>
|
||||
<!--[if lt IE 9]><script src="<%=media%>/html5.js"></script><![endif]-->
|
||||
<meta name="viewport" content="initial-scale=1.0">
|
||||
<link rel="stylesheet" href="<%=media%>/cascade.css">
|
||||
|
@ -119,7 +120,7 @@ You may obtain a copy of the License at
|
|||
<header>
|
||||
<div class="fill">
|
||||
<div class="container">
|
||||
<a class="brand" href="#"><%=hostname%></a>
|
||||
<a class="brand" href="#"><%=boardinfo.hostname or "?"%></a>
|
||||
<ul class="nav">
|
||||
<%-
|
||||
local function submenu(prefix, node)
|
||||
|
|
|
@ -14,13 +14,15 @@ $Id$
|
|||
-%>
|
||||
<%
|
||||
require("luci.sys")
|
||||
local load1, load5, load15 = luci.sys.loadavg()
|
||||
require("luci.util")
|
||||
|
||||
local boardinfo = luci.util.ubus("system", "board")
|
||||
|
||||
local request = require("luci.dispatcher").context.path
|
||||
local category = request[1]
|
||||
local tree = luci.dispatcher.node()
|
||||
local cattree = category and luci.dispatcher.node(category)
|
||||
local node = luci.dispatcher.context.dispatched
|
||||
local hostname = luci.sys.hostname()
|
||||
|
||||
local c = tree
|
||||
for i,r in ipairs(request) do
|
||||
|
@ -48,7 +50,7 @@ require("luci.http").prepare_content("text/html")
|
|||
<meta http-equiv="content-type" content="application/xhtml+xml; charset=utf-8" />
|
||||
<meta http-equiv="content-script-type" content="text/javascript" />
|
||||
<script type="text/javascript" src="<%=resource%>/xhr.js"></script>
|
||||
<title><%=striptags( hostname .. ( (node and node.title) and ' - ' .. translate(node.title) or '')) %> - LuCI</title>
|
||||
<title><%=striptags( (boardinfo.hostname or "?") .. ( (node and node.title) and ' - ' .. translate(node.title) or '')) %> - LuCI</title>
|
||||
|
||||
<!--[if lt IE 7]>
|
||||
<script type="text/javascript">
|
||||
|
|
|
@ -13,11 +13,13 @@ You may obtain a copy of the License at
|
|||
<%
|
||||
local fs = require "luci.fs"
|
||||
local sys = require "luci.sys"
|
||||
local util = require "luci.util"
|
||||
local http = require "luci.http"
|
||||
local disp = require "luci.dispatcher"
|
||||
|
||||
local hostname = sys.hostname()
|
||||
local load1, load5, load15 = sys.loadavg()
|
||||
local sysinfo = util.ubus("system", "info") or { }
|
||||
local loadinfo = sysinfo.load or { 0, 0, 0 }
|
||||
local boardinfo = util.ubus("system", "board") or { }
|
||||
|
||||
local request = disp.context.path
|
||||
local category = request[1]
|
||||
|
@ -87,7 +89,7 @@ You may obtain a copy of the License at
|
|||
<meta name="viewport" content="initial-scale=1.0" />
|
||||
<script type="text/javascript" src="<%=resource%>/xhr.js"></script>
|
||||
|
||||
<title><%=striptags( hostname .. ( (node and node.title) and ' - ' .. translate(tostring(node.title)) or '')) %> - LuCI</title>
|
||||
<title><%=striptags( (boardinfo.hostname or "?") .. ( (node and node.title) and ' - ' .. translate(tostring(node.title)) or '')) %> - LuCI</title>
|
||||
</head>
|
||||
|
||||
<body class="lang_<%=luci.i18n.context.lang%>">
|
||||
|
@ -127,8 +129,8 @@ You may obtain a copy of the License at
|
|||
</div>
|
||||
<div class="header_right">
|
||||
<%=luci.version.distversion%><br />
|
||||
<%:Load%>: <%="%.2f" % load1%> <%="%.2f" % load5%> <%="%.2f" % load15%><br />
|
||||
<%:Hostname%>: <%=hostname%><br />
|
||||
<%:Load%>: <%="%.2f" % loadinfo[1] / 65535.0%> <%="%.2f" % loadinfo[2] / 65535.0%> <%="%.2f" % loadinfo[3] / 65535.0%><br />
|
||||
<%:Hostname%>: <%=boardinfo.hostname or "?"%><br />
|
||||
<span id="xhr_poll_status" style="display:none" onclick="XHR.running() ? XHR.halt() : XHR.run()">
|
||||
<%:Auto Refresh%>:
|
||||
<span id="xhr_poll_status_on"><%:on%></span>
|
||||
|
|
|
@ -14,11 +14,13 @@ $Id$
|
|||
-%>
|
||||
<%
|
||||
local sys = require "luci.sys"
|
||||
local util = require "luci.util"
|
||||
local http = require "luci.http"
|
||||
local disp = require "luci.dispatcher"
|
||||
|
||||
local hostname = sys.hostname()
|
||||
local load1, load5, load15 = sys.loadavg()
|
||||
local sysinfo = util.ubus("system", "info") or { }
|
||||
local loadinfo = sysinfo.load or { 0, 0, 0 }
|
||||
local boardinfo = util.ubus("system", "board") or { }
|
||||
|
||||
local request = disp.context.path
|
||||
local request2 = disp.context.request
|
||||
|
@ -112,7 +114,7 @@ $Id$
|
|||
</style>
|
||||
<% end -%>
|
||||
<script type="text/javascript" src="<%=resource%>/xhr.js"></script>
|
||||
<title><%=striptags( hostname .. ( (node and node.title) and ' - ' .. translate(node.title) or '')) %> - LuCI</title>
|
||||
<title><%=striptags( (boardinfo.hostname or "?") .. ( (node and node.title) and ' - ' .. translate(node.title) or '')) %> - LuCI</title>
|
||||
</head>
|
||||
<body class="lang_<%=luci.i18n.context.lang%>">
|
||||
|
||||
|
@ -125,8 +127,8 @@ $Id$
|
|||
<h2 class="navigation"><a id="navigation" name="navigation"><%:Navigation%></a></h2>
|
||||
|
||||
<div class="hostinfo">
|
||||
<%=hostname%> | <%=luci.version.distversion%> |
|
||||
<%:Load%>: <%="%.2f" % load1%> <%="%.2f" % load5%> <%="%.2f" % load15%>
|
||||
<%=(boardinfo.hostname or "?")%> | <%=luci.version.distversion%> |
|
||||
<%:Load%>: <%="%.2f" % loadinfo[1] / 65535.0%> <%="%.2f" % loadinfo[2] / 65535.0%> <%="%.2f" % loadinfo[3] / 65535.0%>
|
||||
<span id="xhr_poll_status" style="display:none" onclick="XHR.running() ? XHR.halt() : XHR.run()">
|
||||
| <%:Auto Refresh%>:
|
||||
<span id="xhr_poll_status_on"><%:on%></span>
|
||||
|
|
Loading…
Reference in a new issue