🌴 Sync 2026-03-05 23:51:42

This commit is contained in:
github-actions[bot] committed 2026-03-05 23:51:42 +08:00
1 parent 97c049ed0a
commit 0acff03804
14253 files changed
+3893239

No files matched your search

+18
View File
@@ -0,0 +1,18 @@
#
# Copyright (C) 2022 jjm2473 <jjm2473@gmail.com>
#
# This is free software, licensed under the MIT License.
#
include $(TOPDIR)/rules.mk
LUCI_TITLE:=luci for taskd
LUCI_DEPENDS:=+luci-lib-taskd
PKG_VERSION:=1.0.0
PKG_RELEASE:=1
PKG_MAINTAINER:=jjm2473 <jjm2473@gmail.com>
include $(TOPDIR)/feeds/luci/luci.mk
# call BuildPackage - OpenWrt buildroot signature
+9
View File
@@ -0,0 +1,9 @@
module("luci.controller.tasks-app", package.seeall)
function index()
entry({"admin", "system", "tasks"}, alias("admin", "system", "tasks", "all"), _("Tasks"), 56)
--entry({"admin", "system", "tasks", "user"}, cbi("tasks/user"), _("User Tasks"), 1)
entry({"admin", "system", "tasks", "all"}, form("tasks/all"))
end
@@ -0,0 +1,59 @@
--[[
LuCI - Lua Configuration Interface
]]--
local taskd = require "luci.model.tasks"
local tasks = taskd.status()
local show_log_taskid
local m, s, o
local t=Template("tasks/all")
m = SimpleForm("taskd",
translate("All Tasks"),
translate("All submitted tasks, including system defined tasks"))
m.submit=false
m.reset=false
s = m:section(Table, tasks)
s.config = "tasks"
o = s:option(DummyValue, "_id", translate("ID"))
o.width="10%"
o.cfgvalue = function(self, section)
return section
end
o = s:option(DummyValue, "_status", translate("Status"))
o.width="15%"
o.cfgvalue = function(self, section)
local task = tasks[section]
return task.running and translate("Running") or (translate("Stopped:") .. " " .. task.exit_code)
end
o = s:option(DummyValue, "_start", translate("Start Time"))
o.width="15%"
o.cfgvalue = function(self, section)
local task = tasks[section]
return os.date("%Y/%m/%d %H:%M:%S", task.start)
end
-- os.date("%Y/%m/%d %H:%M:%S", 1657163212)
local btn_log = s:option(Button, "_log", translate("Log"))
btn_log.inputstyle = "find"
btn_log.write = function(self, section, value)
t.show_log_taskid = section
end
local btn_remove = s:option(Button, "_remove", translate("Remove"))
btn_remove.inputstyle = "remove"
btn_remove.forcewrite = true
btn_remove.write = function(self, section, value)
local task_id = section
os.execute("/etc/init.d/tasks task_del "..task_id.." >/dev/null 2>&1")
tasks[task_id] = nil
end
m:append(t)
return m
+28
View File
@@ -0,0 +1,28 @@
<%+tasks/embed%>
<script>
window.addEventListener("load", function(){
const taskd = window.taskd;
const logfunc = function(e) {
taskd.show_log(this);
return false;
};
const delfunc = function(e) {
taskd.remove(this).then(()=>{
location.reload();
});
return false;
};
const rows = document.querySelectorAll('#cbi-tasks-table tr.cbi-section-table-row');
rows.forEach(row => {
if (row.id) {
const task_id = row.id.match(/cbi-tasks-(.*)/)[1];
row.querySelector('td[data-name=_log] .cbi-button').onclick = logfunc.bind(task_id);
row.querySelector('td[data-name=_remove] .cbi-button').onclick = delfunc.bind(task_id);
}
});
<% if self.show_log_taskid then -%>
taskd.show_log("<%=self.show_log_taskid%>");
<%- end %>
});
</script>
+29
View File
@@ -0,0 +1,29 @@
msgid ""
msgstr "Content-Type: text/plain; charset=UTF-8"
msgid "Tasks"
msgstr "后台任务"
msgid "All Tasks"
msgstr "所有任务"
msgid "All submitted tasks, including system defined tasks"
msgstr "所有已提交的任务,包括系统定义的任务"
msgid "Status"
msgstr "状态"
msgid "Running"
msgstr "运行中"
msgid "Stopped:"
msgstr "已停止:"
msgid "Start Time"
msgstr "开始时间"
msgid "Log"
msgstr "日志"
msgid "Remove"
msgstr "移除"
+1
View File
@@ -0,0 +1 @@
zh-cn