summaryrefslogtreecommitdiffhomepage
path: root/applications
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2023-11-01 11:41:00 +0100
committerGitHub <noreply@github.com>2023-11-01 11:41:00 +0100
commit408ff05c5229d9d93a3a3bae04a2a3f3c34f2a9d (patch)
treed10f3aeb8ce7562986890c1b9b77a111dbc70ac7 /applications
parentd766731b81e00e222c9be25a70af0f252112f72e (diff)
parent0fbbed4a84fb49c968e3ad8a5b76bbf332f42f5c (diff)
Merge pull request #6652 from jjm2473/upstream/dockerman-fix-stats-tab-blank
luci-app-dockerman: fix stats page always blank
Diffstat (limited to 'applications')
-rw-r--r--applications/luci-app-dockerman/luasrc/model/cbi/dockerman/container.lua37
1 files changed, 21 insertions, 16 deletions
diff --git a/applications/luci-app-dockerman/luasrc/model/cbi/dockerman/container.lua b/applications/luci-app-dockerman/luasrc/model/cbi/dockerman/container.lua
index f8329ba703..5caad4f93f 100644
--- a/applications/luci-app-dockerman/luasrc/model/cbi/dockerman/container.lua
+++ b/applications/luci-app-dockerman/luasrc/model/cbi/dockerman/container.lua
@@ -752,35 +752,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 ~= 409 then
+ if response.code ~= 200 then
+ response = dk.containers:top({id = container_id})
+ end
+
+ 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
+ container_top = response.body
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={
+ local table_stats = {
+ cpu = {
key=translate("CPU Usage"),
value='-'
},
- memory={
+ 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