消息发送任务队列可以删除单个任务

This commit is contained in:
GoEdgeLab
2021-08-24 16:36:47 +08:00
parent 7a9f6486a7
commit 942f20e078
7 changed files with 64 additions and 0 deletions

View File

@@ -0,0 +1,26 @@
// Copyright 2021 Liuxiangchao iwind.liu@gmail.com. All rights reserved.
package tasks
import (
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
)
type DeleteAction struct {
actionutils.ParentAction
}
func (this *DeleteAction) RunPost(params struct {
TaskId int64
}) {
defer this.CreateLogInfo("删除消息发送任务 %d", params.TaskId)
_, err := this.RPC().MessageTaskRPC().DeleteMessageTask(this.AdminContext(), &pb.DeleteMessageTaskRequest{MessageTaskId: params.TaskId})
if err != nil {
this.ErrorPage(err)
return
}
this.Success()
}

View File

@@ -15,6 +15,7 @@ func init() {
Prefix("/admins/recipients/tasks").
Get("", new(IndexAction)).
Post("/taskInfo", new(TaskInfoAction)).
Post("/delete", new(DeleteAction)).
EndAll()
})
}

View File

@@ -0,0 +1,9 @@
td {
position: relative;
}
td a.op {
position: absolute;
right: 1em;
top: 0.5em;
}
/*# sourceMappingURL=index.css.map */

View File

@@ -0,0 +1 @@
{"version":3,"sources":["index.less"],"names":[],"mappings":"AAAA;EACC,kBAAA;;AAGD,EAAG,EAAC;EACH,kBAAA;EACA,UAAA;EACA,UAAA","file":"index.css"}

View File

@@ -17,6 +17,8 @@
<td>
{{task.user}} <span class="disabled">&nbsp; | &nbsp;</span> <span v-if="task.instance != null">媒介:{{task.instance.name}}<link-icon :href="'/admins/recipients/instances/instance?instanceId=' + task.instance.id"></link-icon></span>
<span class="disabled">&nbsp; | &nbsp;</span> 时间:{{task.createdTime}}
<a href="" title="删除" class="op" @click.prevent="deleteTask(task.id)"><i class="icon remove small"></i></a>
</td>
</tr>
<tr v-if="task.subject.length > 0">

View File

@@ -0,0 +1,16 @@
Tea.context(function () {
this.deleteTask = function (taskId) {
let that = this
teaweb.confirm("确定要删除这个发送任务吗?", function () {
that.$post(".delete")
.params({
taskId: taskId
})
.success(function () {
teaweb.successToast("删除成功", null, function () {
teaweb.reload()
})
})
})
}
})

View File

@@ -0,0 +1,9 @@
td {
position: relative;
}
td a.op {
position: absolute;
right: 1em;
top: 0.5em;
}