mirror of
https://github.com/sirpdboy/sirpdboy-package.git
synced 2025-01-08 11:57:57 +08:00
up v0.5.25
This commit is contained in:
parent
d8e584f32b
commit
ae5182ed31
@ -14,7 +14,7 @@ PKG_LICENSE:=AGPL-3.0
|
||||
PKG_MAINTAINER:=lisaac <lisaac.cn@gmail.com> \
|
||||
Florian Eckert <fe@dev.tdt.de>
|
||||
|
||||
PKG_VERSION:=v0.5.23-3
|
||||
PKG_VERSION:=v0.5.25
|
||||
|
||||
include $(TOPDIR)/feeds/luci/luci.mk
|
||||
|
||||
|
@ -14,7 +14,7 @@ function index()
|
||||
_("Docker"),
|
||||
40).acl_depends = { "luci-app-dockerman" }
|
||||
|
||||
entry({"admin", "services", "docker", "config"}, cbi("dockerman/configuration"), _("Configuration"), 2).leaf=true
|
||||
entry({"admin", "services", "docker", "config"}, cbi("dockerman/configuration"), _("Configuration"), 8).leaf=true
|
||||
|
||||
-- local uci = (require "luci.model.uci").cursor()
|
||||
-- if uci:get_bool("dockerd", "dockerman", "remote_endpoint") then
|
||||
@ -45,8 +45,10 @@ function index()
|
||||
entry({"admin", "services","docker", "newnetwork"}, form("dockerman/newnetwork")).leaf=true
|
||||
entry({"admin", "services","docker", "container"}, form("dockerman/container")).leaf=true
|
||||
|
||||
entry({"admin", "services", "container_stats"}, call("action_get_container_stats")).leaf=true
|
||||
entry({"admin", "services","docker", "call"}, call("action_call_docker")).leaf=true
|
||||
entry({"admin", "services","docker", "container_stats"}, call("action_get_container_stats")).leaf=true
|
||||
entry({"admin", "services","docker", "containers_stats"}, call("action_get_containers_stats")).leaf=true
|
||||
entry({"admin", "services", "docker", "get_system_df"}, call("action_get_system_df")).leaf=true
|
||||
entry({"admin", "services","docker", "container_get_archive"}, call("download_archive")).leaf=true
|
||||
entry({"admin", "services","docker", "container_put_archive"}, call("upload_archive")).leaf=true
|
||||
entry({"admin", "services","docker","container_list_file"},call("list_file")).leaf=true
|
||||
@ -62,6 +64,17 @@ function index()
|
||||
entry({"admin", "services","docker", "confirm"}, call("action_confirm")).leaf=true
|
||||
end
|
||||
|
||||
function action_call_docker()
|
||||
|
||||
end
|
||||
|
||||
function action_get_system_df()
|
||||
local res = docker.new():df()
|
||||
luci.http.status(res.code, res.message)
|
||||
luci.http.prepare_content("application/json")
|
||||
luci.http.write_json(res.body)
|
||||
end
|
||||
|
||||
function scandir(id, directory)
|
||||
local cmd_docker = luci.util.exec("command -v docker"):match("^.+docker") or nil
|
||||
if not cmd_docker or cmd_docker:match("^%s+$") then
|
||||
|
@ -489,4 +489,16 @@ _docker.remove_macvlan_interface = function(name)
|
||||
os.execute("ip link del " .. if_name)
|
||||
end
|
||||
|
||||
_docker.byte_format = function (byte)
|
||||
if not byte then return 'NaN' end
|
||||
local suff = {"B", "KB", "MB", "GB", "TB"}
|
||||
for i=1, 5 do
|
||||
if byte > 1024 and i < 5 then
|
||||
byte = byte / 1024
|
||||
else
|
||||
return string.format("%.2f %s", byte, suff[i])
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return _docker
|
||||
|
@ -9,10 +9,18 @@
|
||||
}
|
||||
|
||||
fnWindowLoad = function () {
|
||||
XHR.get('<%=luci.dispatcher.build_url("admin/services/docker/get_system_df")%>/', null, (x, info)=>{
|
||||
if(!info || !info.Containers || !info.Containers.forEach) return
|
||||
info.Containers.forEach(item=>{
|
||||
const size_c = document.getElementsByClassName("container_size_" + item.Id)
|
||||
size_c[0].title = "RW Size: " + niceBytes(item.SizeRw) + " / RootFS Size(Include Image): " + niceBytes(item.SizeRootFs)
|
||||
size_c[0].innerText = "Size: " + niceBytes(item.SizeRw) + "/" + niceBytes(item.SizeRootFs)
|
||||
})
|
||||
})
|
||||
let lines = document.querySelectorAll('[id^=cbi-containers-]')
|
||||
let last_bw_tx = {}
|
||||
let last_bw_rx = {}
|
||||
let interval = 5
|
||||
let interval = 30
|
||||
let containers = []
|
||||
lines.forEach((item) => {
|
||||
let containerId = item.id.match(/cbi-containers-.+_id_(.*)/)
|
||||
|
@ -83,7 +83,7 @@
|
||||
}
|
||||
|
||||
function show_reslov_dialog() {
|
||||
document.getElementById('dialog_reslov') || document.body.insertAdjacentHTML("beforeend", '<div id="dialog_reslov"><div class="dialog_box"><div class="dialog_line"></div><div class="dialog_line"><span><%:Plese input <docker create/run> command line:%></span><br><span id="cmd-line-status"></span></div><div class="dialog_line"><textarea class="cbi-input-textarea" id="dialog_reslov_text" style="width: 100%; height:100%;" rows="15" onkeyup="clear_text()"></textarea></div><div class="dialog_line" style="text-align: right;"><input type="button" class="btn cbi-button cbi-button-apply" type="submit" value="<%:Submit%>" onclick="reslov_container()" /> <input type="button" class="btn cbi-button cbi-button-reset" type="reset" value="<%:Cancel%>" onclick="close_reslov_dialog()" /></div><div class="dialog_line"></div></div></div>')
|
||||
document.getElementById('dialog_reslov') || document.body.insertAdjacentHTML("beforeend", '<div id="dialog_reslov"><div class="dialog_box"><div class="dialog_line"></div><div class="dialog_line"><span><%:Plese input <docker create/run> command line:%></span><br><span id="cmd-line-status"></span></div><div class="dialog_line"><textarea class="cbi-input-textarea" id="dialog_reslov_text" style="width: 100%; height:100%;" rows="15" onkeyup="clear_text()" placeholder="docker run -d alpine sh"></textarea></div><div class="dialog_line" style="text-align: right;"><input type="button" class="btn cbi-button cbi-button-apply" type="submit" value="<%:Submit%>" onclick="reslov_container()"/> <input type="button" class="btn cbi-button cbi-button-reset" type="reset" value="<%:Cancel%>" onclick="close_reslov_dialog()" /></div><div class="dialog_line"></div></div></div>')
|
||||
document.body.classList.add('dialog-reslov-active')
|
||||
let s = document.getElementById('cmd-line-status')
|
||||
s.innerHTML = ""
|
||||
|
21
luci-app-dockerman/luasrc/view/dockerman/volume_size.htm
Normal file
21
luci-app-dockerman/luasrc/view/dockerman/volume_size.htm
Normal file
@ -0,0 +1,21 @@
|
||||
<script type="text/javascript">
|
||||
const units = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
|
||||
function niceBytes(x) {
|
||||
let l = 0, n = parseInt(x, 10) || 0;
|
||||
while (n >= 1024 && ++l) {
|
||||
n = n / 1024;
|
||||
}
|
||||
return (n.toFixed(n < 10 && l > 0 ? 1 : 0) + ' ' + units[l]);
|
||||
}
|
||||
|
||||
fnWindowLoad = function () {
|
||||
XHR.get('<%=luci.dispatcher.build_url("admin/services/docker/get_system_df")%>/', null, (x, info)=>{
|
||||
if(!info || !info.Volumes || !info.Volumes.forEach) return
|
||||
info.Volumes.forEach(item=>{
|
||||
console.log(info)
|
||||
const size_c = document.getElementsByClassName("volume_size_" + item.Name)
|
||||
size_c[0].innerText = item.UsageData ? niceBytes(item.UsageData.Size) : '-'
|
||||
})
|
||||
})
|
||||
}
|
||||
</script>
|
1002
luci-app-dockerman/po/templates/dockerman.pot
Normal file
1002
luci-app-dockerman/po/templates/dockerman.pot
Normal file
File diff suppressed because it is too large
Load Diff
1
luci-app-dockerman/po/zh_Hans
Normal file
1
luci-app-dockerman/po/zh_Hans
Normal file
@ -0,0 +1 @@
|
||||
zh-cn
|
@ -1,15 +1,17 @@
|
||||
#!/bin/sh
|
||||
|
||||
. $IPKG_INSTROOT/lib/functions.sh
|
||||
|
||||
[ -x "$(command -v dockerd)" ] && chmod +x /etc/init.d/dockerman && /etc/init.d/dockerman enable >/dev/null 2>&1
|
||||
sed -i 's/self:cfgvalue(section) or {}/self:cfgvalue(section) or self.default or {}/' /usr/lib/lua/luci/view/cbi/dynlist.htm
|
||||
/etc/init.d/uhttpd restart >/dev/null 2>&1
|
||||
rm -fr /tmp/luci-indexcache /tmp/luci-modulecache >/dev/null 2>&1
|
||||
touch /etc/config/dockerd
|
||||
ls /etc/rc.d/*dockerd &> /dev/null && uci set dockerd.globals.auto_start="1" || uci set dockerd.globals.auto_start="0"
|
||||
uci set dockerd.dockerman=dockerman &> /dev/null
|
||||
ls /etc/rc.d/*dockerd &> /dev/null && uci -q set dockerd.globals.auto_start="1" || uci -q set dockerd.globals.auto_start="0"
|
||||
uci -q batch <<-EOF >/dev/null
|
||||
set uhttpd.main.script_timeout="3600"
|
||||
commit uhttpd
|
||||
set dockerd.dockerman=dockerman
|
||||
set dockerd.dockerman.socket_path='/var/run/docker.sock'
|
||||
set dockerd.dockerman.status_path='/tmp/.docker_action_status'
|
||||
set dockerd.dockerman.debug='false'
|
||||
@ -20,5 +22,15 @@ uci -q batch <<-EOF >/dev/null
|
||||
add_list dockerd.dockerman.ac_allowed_interface='br-lan'
|
||||
|
||||
commit dockerd
|
||||
EOF
|
||||
EOF
|
||||
# remove dockerd firewall
|
||||
config_load dockerd
|
||||
remove_firewall(){
|
||||
cfg=${1}
|
||||
uci_remove dockerd ${1}
|
||||
}
|
||||
config_foreach remove_firewall firewall
|
||||
# Convert ac_allowed_container to ac_allowed_ports
|
||||
(sleep 30s && /etc/init.d/dockerman convert;/etc/init.d/dockerman restart) &
|
||||
|
||||
exit 0
|
||||
|
Loading…
Reference in New Issue
Block a user