luci-app-dockerman: merge upstream source

This commit is contained in:
CN_SZTL 2020-01-15 01:26:36 +08:00
parent 522cad4e36
commit 2ab038ee32
No known key found for this signature in database
GPG Key ID: 6850B6345C862176
4 changed files with 311 additions and 50 deletions

View File

@ -1,7 +1,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-dockerman
PKG_VERSION:=v0.1.7
PKG_VERSION:=v0.1.8
PKG_RELEASE:=beta
PKG_MAINTAINER:=lisaac <https://github.com/lisaac/luci-app-dockerman>
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
@ -38,6 +38,8 @@ define Package/$(PKG_NAME)/install
cp -pR ./luasrc/* $(1)/usr/lib/lua/luci
$(INSTALL_DIR) $(1)/
cp -pR ./root/* $(1)/
$(INSTALL_DIR) $(1)/usr/lib/lua/luci/i18n
po2lmo ./po/zh-cn/dockerman.po $(1)/usr/lib/lua/luci/i18n/dockerman.zh-cn.lmo
endef
$(eval $(call BuildPackage,$(PKG_NAME)))

View File

@ -365,7 +365,7 @@ elseif action == "edit" then
d.datatype="ufloat"
d.default = container_info.HostConfig.NanoCpus / (10^9)
d = editsection:option(Value, "cpushares", translate("CPU Shares Weight"), translate("CPU shares (relative weight, if 0 is set, the system will ignore the value and use the default of 1024."))
d = editsection:option(Value, "cpushares", translate("CPU Shares Weight"), translate("CPU shares relative weight, if 0 is set, the system will ignore the value and use the default of 1024."))
d.placeholder = "1024"
d.rmempty = true
d.datatype="uinteger"

View File

@ -1,62 +1,60 @@
<script type="text/javascript">//<![CDATA[
function progressbar(v, m, pc, np)
{
function progressbar(v, m, pc, np) {
m = m || 100
return String.format(
'<div style="width:100%%; max-width:500px; position:relative; border:1px solid #999999">' +
'<div style="background-color:#CCCCCC; width:%d%%; height:15px">' +
'<div style="position:absolute; left:0; top:0; text-align:center; width:100%%; color:#000000">' +
'<small>%s / %s '+ (np == true ? "" :'(%d%%)')+'</small>' +
'</div>' +
'</div>' +
'<div style="background-color:#CCCCCC; width:%d%%; height:15px">' +
'<div style="position:absolute; left:0; top:0; text-align:center; width:100%%; color:#000000">' +
'<small>%s / %s ' + (np == true ? "" : '(%d%%)') + '</small>' +
'</div>' +
'</div>' +
'</div>', pc, v, m, pc
);
}
function niceBytes(bytes,decimals) {
if(bytes == 0) return '0 Bytes';
var k = 1000,
dm = decimals + 1 || 3,
sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'],
i = Math.floor(Math.log(bytes) / Math.log(k));
return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + ' ' + sizes[i];
}
function niceBytes(bytes, decimals) {
if (bytes == 0) return '0 Bytes';
var k = 1000,
dm = decimals + 1 || 3,
sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'],
i = Math.floor(Math.log(bytes) / Math.log(k));
return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + ' ' + sizes[i];
}
XHR.poll(5, '/cgi-bin/luci/admin/docker/container_stats/<%=self.container_id%>', { status: 1 },
function(x, info){
var e;
function (x, info) {
var e;
if (e = document.getElementById('cbi-table-cpu-value'))
e.innerHTML = progressbar(
(info.cpu_percent), 100, (info.cpu_percent?info.cpu_percent:0));
if (e = document.getElementById('cbi-table-memory-value'))
e.innerHTML = progressbar(
niceBytes(info.memory.mem_useage),
niceBytes(info.memory.mem_limit),
((100 / (info.memory.mem_limit?info.memory.mem_limit:100)) * (info.memory.mem_useage?info.memory.mem_useage:0))
);
let num = 1
for (var key in info.bw_rxtx){
if (! document.getElementById("cbi-table-network_"+key+"-value")){
let tab = document.getElementById("cbi-table-cpu").parentNode
num ++
let div=document.getElementById('cbi-table-cpu').cloneNode(true);
div.id = "cbi-table-network_"+key;
div.children[0].innerHTML = "<%:Network TX/RX%>: " +key
div.children[1].id="cbi-table-network_"+key+"-value"
tab.appendChild(div)
}
e=document.getElementById("cbi-table-network_"+key+"-value")
e.innerHTML = progressbar(
niceBytes(info.bw_rxtx[key].bw_tx),
niceBytes(info.bw_rxtx[key].bw_rx),
((100 / (info.bw_rxtx[key].bw_rx?info.bw_rxtx[key].bw_rx:100)) * (info.bw_rxtx[key].bw_tx?info.bw_rxtx[key].bw_tx:0))>100 ? 100 :Math.floor((100 / (info.bw_rxtx[key].bw_rx?info.bw_rxtx[key].bw_rx:100)) * (info.bw_rxtx[key].bw_tx?info.bw_rxtx[key].bw_tx:0)) ,
true
if (e = document.getElementById('cbi-table-cpu-value'))
e.innerHTML = progressbar(
(info.cpu_percent), 100, (info.cpu_percent ? info.cpu_percent : 0));
if (e = document.getElementById('cbi-table-memory-value'))
e.innerHTML = progressbar(
niceBytes(info.memory.mem_useage),
niceBytes(info.memory.mem_limit),
((100 / (info.memory.mem_limit ? info.memory.mem_limit : 100)) * (info.memory.mem_useage ? info.memory.mem_useage : 0))
);
}
});
let num = 1
for (var key in info.bw_rxtx) {
if (!document.getElementById("cbi-table-network_" + key + "-value")) {
let tab = document.getElementById("cbi-table-cpu").parentNode
num++
let div = document.getElementById('cbi-table-cpu').cloneNode(true);
div.id = "cbi-table-network_" + key;
div.children[0].innerHTML = "<%:Network TX/RX%>: " + key
div.children[1].id = "cbi-table-network_" + key + "-value"
tab.appendChild(div)
}
e = document.getElementById("cbi-table-network_" + key + "-value")
e.innerHTML = progressbar(
niceBytes(info.bw_rxtx[key].bw_tx),
niceBytes(info.bw_rxtx[key].bw_rx),
((100 / (info.bw_rxtx[key].bw_rx ? info.bw_rxtx[key].bw_rx : 100)) * (info.bw_rxtx[key].bw_tx ? info.bw_rxtx[key].bw_tx : 0)) > 100 ? 100 : Math.floor((100 / (info.bw_rxtx[key].bw_rx ? info.bw_rxtx[key].bw_rx : 100)) * (info.bw_rxtx[key].bw_tx ? info.bw_rxtx[key].bw_tx : 0)),
true
);
}
});
//]]></script>

View File

@ -0,0 +1,261 @@
msgid "Containers"
msgstr "容器"
msgid "Images"
msgstr "镜像"
msgid "Networks"
msgstr "网络"
msgid "Volumes"
msgstr "存储卷"
msgid "Events"
msgstr "活动"
msgid "Docker Contaienr"
msgstr "Docker 容器"
msgid "Start"
msgstr "启动"
msgid "Restart"
msgstr "重启"
msgid "Stop"
msgstr "关闭"
msgid "Upgrade"
msgstr "升级容器"
msgid "Duplicate"
msgstr "复制容器"
msgid "Remove"
msgstr "移除"
msgid "Name"
msgstr "名称"
msgid "Image"
msgstr "镜像"
msgid "Status"
msgstr "状态"
msgid "Created"
msgstr "已创建"
msgid "Start Time"
msgstr "启动时间"
msgid "Healthy"
msgstr "健康"
msgid "Restart Policy"
msgstr "重启策略"
msgid "Update"
msgstr "更新"
msgid "Device"
msgstr "设备"
msgid "Mount/Volume"
msgstr "挂载/存储卷"
msgid "Command"
msgstr "启动命令"
msgid "Setting"
msgstr "设置"
msgid "Driver"
msgstr "驱动"
msgid "Env"
msgstr "环境变量"
msgid "Ports"
msgstr "端口"
msgid "Links"
msgstr "链接"
msgid "Disconnect"
msgstr "断开"
msgid "Connect Network"
msgstr "连接网络"
msgid "Connect"
msgstr "连接"
msgid "Info"
msgstr "信息"
msgid "CPUs"
msgstr "CPU数量"
msgid "Number of CPUs. Number is a fractional number. 0.000 means no limit."
msgstr "CPU数量数字是小数0.000表示没有限制。"
msgid "CPU Shares Weight"
msgstr "CPU份额权重"
msgid ""
"CPU shares relative weight, if 0 is set, the system will ignore the value and use the default of 1024."
msgstr ""
"CPU份额相对权重如果设置为0则系统将忽略该值并使用默认值1024。"
msgid "Memory"
msgstr "内存"
msgid ""
"Memory limit (format: <number>[<unit>]). Number is a positive integer. Unit can be one of b, k, m, or g. Minimum is 4M."
msgstr ""
"内存限制 (格式: <容量>[<单位>]). 数字是一个正整数。单位可以是bkm或g之一。最小为4M。"
msgid "Block IO Weight"
msgstr "IO 权重"
msgid ""
"Block IO weight (relative weight) accepts a weight value between 10 and 1000."
msgstr ""
"IO 权重相对权重接受10到1000之间的权重值。"
msgid "Container Logs"
msgstr "容器日志"
msgid "RepoTags"
msgstr "标签"
msgid "Size"
msgstr "大小"
msgid "Force Remove"
msgstr "强制移除"
msgid "Subnet"
msgstr "子网络"
msgid "Gateway"
msgstr "网关"
msgid "New"
msgstr "新建"
msgid "New Container"
msgstr "新容器"
msgid "Container Name"
msgstr "容器名称"
msgid "Interactive (-i)"
msgstr "互动式 (-i)"
msgid "Always pull image first"
msgstr "始终先拉取镜像"
msgid "Privileged"
msgstr "特权模式"
msgid "IPv4 Address"
msgstr "IPv4 地址"
msgid "Links with other containers"
msgstr "与其他容器的链接"
msgid "Environmental Variable"
msgstr "环境变量"
msgid "Bind Mount"
msgstr "绑定坐骑"
msgid "Exposed Ports"
msgstr "暴露端口"
msgid "Run command"
msgstr "运行命令"
msgid "Advance"
msgstr "高级"
msgid "Mount tmpfs filesystems"
msgstr "挂载tmpfs文件系统"
msgid "New Network"
msgstr "新网络"
msgid "Network Name"
msgstr "网络名称"
msgid "Parent Interface"
msgstr "父接口"
msgid "Macvlan Mode"
msgstr "Macvlan模式"
msgid "Ipvlan Mode"
msgstr "Ipvlan模式"
msgid "Ingress network is the network which provides the routing-mesh in swarm mode."
msgstr "Ingress网络是在群集模式下提供路由网的网络。"
msgid "Options"
msgstr "选项"
msgid "Restrict external access to the network"
msgstr "限制外部访问网络"
msgid "IP range"
msgstr "IP范围"
msgid "Exclude IPs"
msgstr "排除IP"
msgid "Enable IPv6"
msgstr "启用IPv6"
msgid "IPv6 Subnet"
msgstr "IPv6子网"
msgid "IPv6 Gateway"
msgstr "IPv6网关"
msgid "Docker Version"
msgstr "Docker版本"
msgid "Api Version"
msgstr "API版本"
msgid "Total Memory"
msgstr "总内存"
msgid "Docker Root Dir"
msgstr "Docker根目录"
msgid "Index Server Address"
msgstr "默认服务器地址"
msgid "Socket Path"
msgstr "Socket路径"
msgid "Action Status Tempfile Path"
msgstr "docker 动作状态的临时文件路径"
msgid "Where you want to save the docker status file"
msgstr "保存docker status文件的位置"
msgid "Enable Debug"
msgstr "启用调试"
msgid "For debug, It shows all docker API actions of luci-app-docker in Debug Tempfile Path"
msgstr "用于调试它在调试临时文件路径中显示luci-app-docker的所有docker API操作"
msgid "Debug Tempfile Path"
msgstr "调试临时文件路径"
msgid "Where you want to save the debug tempfile"
msgstr "保存调试临时文件的位置"