mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-22 01:20:12 +01:00
🎨 后台任务显示当前正在执行的任务
This commit is contained in:
parent
9a7a155ac7
commit
9f491713ad
1 changed files with 7 additions and 3 deletions
|
|
@ -100,11 +100,10 @@ func Contain(action string, moreActions ...string) bool {
|
||||||
|
|
||||||
func StatusJob() {
|
func StatusJob() {
|
||||||
tasks := taskQueue
|
tasks := taskQueue
|
||||||
data := map[string]interface{}{}
|
|
||||||
var items []map[string]interface{}
|
var items []map[string]interface{}
|
||||||
count := map[string]int{}
|
count := map[string]int{}
|
||||||
|
actionLangs := util.TaskActionLangs[util.Lang]
|
||||||
for _, task := range tasks {
|
for _, task := range tasks {
|
||||||
actionLangs := util.TaskActionLangs[util.Lang]
|
|
||||||
action := task.Action
|
action := task.Action
|
||||||
if c := count[action]; 2 < c {
|
if c := count[action]; 2 < c {
|
||||||
//logging.LogWarnf("too many tasks [%s], ignore show its status", action)
|
//logging.LogWarnf("too many tasks [%s], ignore show its status", action)
|
||||||
|
|
@ -123,12 +122,17 @@ func StatusJob() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if "" != currentTaskAction {
|
if "" != currentTaskAction {
|
||||||
items = append([]map[string]interface{}{map[string]interface{}{"action": currentTaskAction}}, items...)
|
if nil != actionLangs {
|
||||||
|
if label := actionLangs[currentTaskAction]; nil != label {
|
||||||
|
items = append([]map[string]interface{}{map[string]interface{}{"action": label.(string)}}, items...)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if 1 > len(items) {
|
if 1 > len(items) {
|
||||||
items = []map[string]interface{}{}
|
items = []map[string]interface{}{}
|
||||||
}
|
}
|
||||||
|
data := map[string]interface{}{}
|
||||||
data["tasks"] = items
|
data["tasks"] = items
|
||||||
util.PushBackgroundTask(data)
|
util.PushBackgroundTask(data)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue