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 response = dk.containers:top({id = container_id, query = {ps_args="-aux"}})
|
||||||
local container_top
|
local container_top
|
||||||
|
|
||||||
if response.code == 200 then
|
if response.code ~= 409 then
|
||||||
container_top=response.body
|
if response.code ~= 200 then
|
||||||
else
|
|
||||||
response = dk.containers:top({id = container_id})
|
response = dk.containers:top({id = container_id})
|
||||||
if response.code == 200 then
|
|
||||||
container_top=response.body
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
if type(container_top) == "table" then
|
if response.code ~= 200 then
|
||||||
s = m:section(SimpleSection)
|
response = dk.containers:top({id = container_id, query = {ps_args="-ww"}})
|
||||||
s.container_id = container_id
|
end
|
||||||
s.template = "dockerman/container_stats"
|
|
||||||
table_stats = {
|
if response.code == 200 then
|
||||||
cpu={
|
container_top = response.body
|
||||||
key=translate("CPU Useage"),
|
end
|
||||||
|
|
||||||
|
local table_stats = {
|
||||||
|
cpu = {
|
||||||
|
key=translate("CPU Usage"),
|
||||||
value='-'
|
value='-'
|
||||||
},
|
},
|
||||||
memory={
|
memory = {
|
||||||
key=translate("Memory Useage"),
|
key=translate("Memory Usage"),
|
||||||
value='-'
|
value='-'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
container_top = response.body
|
|
||||||
s = m:section(Table, table_stats, translate("Stats"))
|
s = m:section(Table, table_stats, translate("Stats"))
|
||||||
s:option(DummyValue, "key", translate("Stats")).width="33%"
|
s:option(DummyValue, "key", translate("Stats")).width="33%"
|
||||||
s:option(DummyValue, "value")
|
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
|
for i, v in ipairs(container_top.Titles) do
|
||||||
top_section:option(DummyValue, i, translate(v))
|
top_section:option(DummyValue, i, translate(v))
|
||||||
end
|
end
|
||||||
|
@ -103,7 +103,7 @@ msgid "CPU Shares Weight"
|
|||||||
msgstr "CPU 共享权重"
|
msgstr "CPU 共享权重"
|
||||||
|
|
||||||
#: applications/luci-app-dockerman/luasrc/model/cbi/dockerman/container.lua:770
|
#: applications/luci-app-dockerman/luasrc/model/cbi/dockerman/container.lua:770
|
||||||
msgid "CPU Useage"
|
msgid "CPU Usage"
|
||||||
msgstr "CPU 使用率"
|
msgstr "CPU 使用率"
|
||||||
|
|
||||||
#: applications/luci-app-dockerman/luasrc/model/cbi/dockerman/newcontainer.lua:621
|
#: 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
|
#: applications/luci-app-dockerman/luasrc/model/cbi/dockerman/configuration.lua:54
|
||||||
msgid "Log Level"
|
msgid "Log Level"
|
||||||
msgstr "日志等级"
|
msgstr "日志级别"
|
||||||
|
|
||||||
#: applications/luci-app-dockerman/luasrc/model/cbi/dockerman/newcontainer.lua:646
|
#: applications/luci-app-dockerman/luasrc/model/cbi/dockerman/newcontainer.lua:646
|
||||||
msgid "Log driver options"
|
msgid "Log driver options"
|
||||||
@ -543,7 +543,7 @@ msgid "Memory"
|
|||||||
msgstr "内存"
|
msgstr "内存"
|
||||||
|
|
||||||
#: applications/luci-app-dockerman/luasrc/model/cbi/dockerman/container.lua:774
|
#: applications/luci-app-dockerman/luasrc/model/cbi/dockerman/container.lua:774
|
||||||
msgid "Memory Useage"
|
msgid "Memory Usage"
|
||||||
msgstr "内存使用率"
|
msgstr "内存使用率"
|
||||||
|
|
||||||
#: applications/luci-app-dockerman/luasrc/model/cbi/dockerman/newcontainer.lua:630
|
#: applications/luci-app-dockerman/luasrc/model/cbi/dockerman/newcontainer.lua:630
|
||||||
|
Loading…
x
Reference in New Issue
Block a user