luci-app-dockerman: fix stats page always blank
Signed-off-by: sbwml <admin@cooluc.com>
This commit is contained in:
parent
472103efa1
commit
70a3c24849
@ -761,35 +761,40 @@ elseif action == "stats" then
|
||||
local response = dk.containers:top({id = container_id, query = {ps_args="-aux"}})
|
||||
local container_top
|
||||
|
||||
if response.code == 200 then
|
||||
container_top=response.body
|
||||
else
|
||||
response = dk.containers:top({id = container_id})
|
||||
if response.code == 200 then
|
||||
container_top=response.body
|
||||
if response.code ~= 409 then
|
||||
if response.code ~= 200 then
|
||||
response = dk.containers:top({id = container_id})
|
||||
end
|
||||
end
|
||||
|
||||
if type(container_top) == "table" then
|
||||
s = m:section(SimpleSection)
|
||||
s.container_id = container_id
|
||||
s.template = "dockerman/container_stats"
|
||||
table_stats = {
|
||||
cpu={
|
||||
key=translate("CPU Useage"),
|
||||
if response.code ~= 200 then
|
||||
response = dk.containers:top({id = container_id, query = {ps_args="-ww"}})
|
||||
end
|
||||
|
||||
if response.code == 200 then
|
||||
container_top = response.body
|
||||
end
|
||||
|
||||
local table_stats = {
|
||||
cpu = {
|
||||
key=translate("CPU Usage"),
|
||||
value='-'
|
||||
},
|
||||
memory={
|
||||
key=translate("Memory Useage"),
|
||||
memory = {
|
||||
key=translate("Memory Usage"),
|
||||
value='-'
|
||||
}
|
||||
}
|
||||
|
||||
container_top = response.body
|
||||
s = m:section(Table, table_stats, translate("Stats"))
|
||||
s:option(DummyValue, "key", translate("Stats")).width="33%"
|
||||
s:option(DummyValue, "value")
|
||||
top_section = m:section(Table, container_top.Processes, translate("TOP"))
|
||||
|
||||
s = m:section(SimpleSection)
|
||||
s.container_id = container_id
|
||||
s.template = "dockerman/container_stats"
|
||||
end
|
||||
|
||||
if type(container_top) == "table" then
|
||||
local top_section = m:section(Table, container_top.Processes, translate("TOP"))
|
||||
for i, v in ipairs(container_top.Titles) do
|
||||
top_section:option(DummyValue, i, translate(v))
|
||||
end
|
||||
|
@ -103,7 +103,7 @@ msgid "CPU Shares Weight"
|
||||
msgstr "CPU 共享权重"
|
||||
|
||||
#: applications/luci-app-dockerman/luasrc/model/cbi/dockerman/container.lua:770
|
||||
msgid "CPU Useage"
|
||||
msgid "CPU Usage"
|
||||
msgstr "CPU 使用率"
|
||||
|
||||
#: applications/luci-app-dockerman/luasrc/model/cbi/dockerman/newcontainer.lua:621
|
||||
@ -523,7 +523,7 @@ msgstr "负载"
|
||||
|
||||
#: applications/luci-app-dockerman/luasrc/model/cbi/dockerman/configuration.lua:54
|
||||
msgid "Log Level"
|
||||
msgstr "日志等级"
|
||||
msgstr "日志级别"
|
||||
|
||||
#: applications/luci-app-dockerman/luasrc/model/cbi/dockerman/newcontainer.lua:646
|
||||
msgid "Log driver options"
|
||||
@ -543,7 +543,7 @@ msgid "Memory"
|
||||
msgstr "内存"
|
||||
|
||||
#: applications/luci-app-dockerman/luasrc/model/cbi/dockerman/container.lua:774
|
||||
msgid "Memory Useage"
|
||||
msgid "Memory Usage"
|
||||
msgstr "内存使用率"
|
||||
|
||||
#: applications/luci-app-dockerman/luasrc/model/cbi/dockerman/newcontainer.lua:630
|
||||
|
Loading…
x
Reference in New Issue
Block a user