From c08a19fff641c3701e4a771902797a39e55187b4 Mon Sep 17 00:00:00 2001 From: actions-user Date: Sat, 16 Mar 2024 23:33:58 +0800 Subject: [PATCH] update 2024-03-16 23:33:58 --- luci-app-dockerman/Makefile | 2 +- .../luasrc/model/cbi/dockerman/container.lua | 11 ++++++++++- .../luasrc/model/cbi/dockerman/containers.lua | 3 +-- .../luasrc/model/cbi/dockerman/networks.lua | 4 ++-- luci-app-dockerman/po/zh_Hans | 0 luci-app-dockerman/root/etc/init.d/dockerman | 0 .../root/etc/uci-defaults/luci-app-dockerman | 0 7 files changed, 14 insertions(+), 6 deletions(-) mode change 100644 => 120000 luci-app-dockerman/po/zh_Hans mode change 100644 => 100755 luci-app-dockerman/root/etc/init.d/dockerman mode change 100644 => 100755 luci-app-dockerman/root/etc/uci-defaults/luci-app-dockerman diff --git a/luci-app-dockerman/Makefile b/luci-app-dockerman/Makefile index f0eec139..8de474a9 100644 --- a/luci-app-dockerman/Makefile +++ b/luci-app-dockerman/Makefile @@ -6,7 +6,7 @@ LUCI_DEPENDS:=@(aarch64||arm||x86_64) \ +luci-lib-docker \ +luci-lib-ip \ +docker \ - +dockerd +cgroupfs-mount +cgroupfs-mount \ + +dockerd +cgroupfs-mount \ +ttyd LUCI_PKGARCH:=all diff --git a/luci-app-dockerman/luasrc/model/cbi/dockerman/container.lua b/luci-app-dockerman/luasrc/model/cbi/dockerman/container.lua index 20220ad8..b875811d 100644 --- a/luci-app-dockerman/luasrc/model/cbi/dockerman/container.lua +++ b/luci-app-dockerman/luasrc/model/cbi/dockerman/container.lua @@ -188,8 +188,17 @@ local start_stop_remove = function(m, cmd) end end +local c_color +if container_info.State.Status == 'running' then + c_color = 'green' +elseif container_info.State.Status == 'restarting' then + c_color = 'yellow' +else + c_color = 'red' +end + m=SimpleForm("docker", - translatef("Docker - Container (%s)", container_info.Name:sub(2)), + translatef("Docker - Container (%s)", c_color, container_info.Name:sub(2)), translate("On this page, the selected container can be managed.")) m.redirect = luci.dispatcher.build_url("admin/docker/containers") diff --git a/luci-app-dockerman/luasrc/model/cbi/dockerman/containers.lua b/luci-app-dockerman/luasrc/model/cbi/dockerman/containers.lua index 47f634f8..ca18ea17 100644 --- a/luci-app-dockerman/luasrc/model/cbi/dockerman/containers.lua +++ b/luci-app-dockerman/luasrc/model/cbi/dockerman/containers.lua @@ -83,10 +83,9 @@ function get_containers() end end end - for ii,iv in ipairs(images) do if iv.Id == v.ImageID then - data[index]["_image"] = iv.RepoTags and iv.RepoTags[1] or (iv.RepoDigests[1]:gsub("(.-)@.+", "%1") .. ":<none>") + data[index]["_image"] = iv.RepoTags and iv.RepoTags[1] or (next(iv.RepoDigests) and (iv.RepoDigests[1]:gsub("(.-)@.+", "%1") .. ":<none>")) or "" end end data[index]["_id_name"] = ''.. data[index]["_name"] .. "
ID: " .. data[index]["_id"] diff --git a/luci-app-dockerman/luasrc/model/cbi/dockerman/networks.lua b/luci-app-dockerman/luasrc/model/cbi/dockerman/networks.lua index 37702c78..8ad5690f 100644 --- a/luci-app-dockerman/luasrc/model/cbi/dockerman/networks.lua +++ b/luci-app-dockerman/luasrc/model/cbi/dockerman/networks.lua @@ -41,8 +41,8 @@ local get_networks = function () data[index]["_interface"] = v.Options.parent end - data[index]["_subnet"] = v.IPAM and v.IPAM.Config[1] and v.IPAM.Config[1].Subnet or nil - data[index]["_gateway"] = v.IPAM and v.IPAM.Config[1] and v.IPAM.Config[1].Gateway or nil + data[index]["_subnet"] = v.IPAM and v.IPAM.Config and v.IPAM.Config[1] and v.IPAM.Config[1].Subnet or nil + data[index]["_gateway"] = v.IPAM and v.IPAM.Config and v.IPAM.Config[1] and v.IPAM.Config[1].Gateway or nil end return data diff --git a/luci-app-dockerman/po/zh_Hans b/luci-app-dockerman/po/zh_Hans deleted file mode 100644 index 41451e4a..00000000 --- a/luci-app-dockerman/po/zh_Hans +++ /dev/null @@ -1 +0,0 @@ -zh-cn \ No newline at end of file diff --git a/luci-app-dockerman/po/zh_Hans b/luci-app-dockerman/po/zh_Hans new file mode 120000 index 00000000..41451e4a --- /dev/null +++ b/luci-app-dockerman/po/zh_Hans @@ -0,0 +1 @@ +zh-cn \ No newline at end of file diff --git a/luci-app-dockerman/root/etc/init.d/dockerman b/luci-app-dockerman/root/etc/init.d/dockerman old mode 100644 new mode 100755 diff --git a/luci-app-dockerman/root/etc/uci-defaults/luci-app-dockerman b/luci-app-dockerman/root/etc/uci-defaults/luci-app-dockerman old mode 100644 new mode 100755