diff --git a/internal/web/actions/default/clusters/tasks/deleteBatch.go b/internal/web/actions/default/clusters/tasks/deleteBatch.go
new file mode 100644
index 00000000..db72e2c1
--- /dev/null
+++ b/internal/web/actions/default/clusters/tasks/deleteBatch.go
@@ -0,0 +1,24 @@
+package tasks
+
+import (
+ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
+ "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
+)
+
+type DeleteBatchAction struct {
+ actionutils.ParentAction
+}
+
+func (this *DeleteBatchAction) RunPost(params struct {
+ TaskIds []int64
+}) {
+ defer this.CreateLogInfo("批量删除节点同步任务")
+
+ _, err := this.RPC().NodeTaskRPC().DeleteNodeTasks(this.AdminContext(), &pb.DeleteNodeTasksRequest{NodeTaskIds: params.TaskIds})
+ if err != nil {
+ this.ErrorPage(err)
+ return
+ }
+
+ this.Success()
+}
diff --git a/internal/web/actions/default/clusters/tasks/init.go b/internal/web/actions/default/clusters/tasks/init.go
index bc9a45e8..e20acb31 100644
--- a/internal/web/actions/default/clusters/tasks/init.go
+++ b/internal/web/actions/default/clusters/tasks/init.go
@@ -16,6 +16,7 @@ func init() {
GetPost("/listPopup", new(ListPopupAction)).
Post("/check", new(CheckAction)).
Post("/delete", new(DeleteAction)).
+ Post("/deleteBatch", new(DeleteBatchAction)).
EndAll()
})
diff --git a/web/views/@default/clusters/tasks/listPopup.html b/web/views/@default/clusters/tasks/listPopup.html
index 8abd1106..72f84d51 100644
--- a/web/views/@default/clusters/tasks/listPopup.html
+++ b/web/views/@default/clusters/tasks/listPopup.html
@@ -1,11 +1,14 @@
{$layout "layout_popup"}
-
正在同步的节点任务(共{{countTasks}}个)
+
-
+
+ |
集群 |
节点 |
任务 |
@@ -16,6 +19,9 @@
+ |
+
+ |
{{cluster.name}} |
{{task.node.name}}
diff --git a/web/views/@default/clusters/tasks/listPopup.js b/web/views/@default/clusters/tasks/listPopup.js
index 2b6db9f9..fe5fe642 100644
--- a/web/views/@default/clusters/tasks/listPopup.js
+++ b/web/views/@default/clusters/tasks/listPopup.js
@@ -1,8 +1,40 @@
Tea.context(function () {
+ let checkedAll = false
+
this.$delay(function () {
this.reload()
})
+ this.checkAll = function (b) {
+ checkedAll = b
+ let that = this
+ this.clusters.forEach(function (cluster, index) {
+ cluster.tasks.forEach(function (task) {
+ task.isChecked = checkedAll
+ })
+ Vue.set(that.clusters, index, cluster)
+ })
+ }
+
+ this.checkTask = function (b) {
+ this.clusters.forEach(function (cluster, index) {
+ Vue.set(that.clusters, index, cluster)
+ })
+ }
+
+ let that = this
+ this.countCheckedTasks = function () {
+ let count = 0
+ that.clusters.forEach(function (cluster) {
+ cluster.tasks.forEach(function (task) {
+ if (task.isChecked) {
+ count++
+ }
+ })
+ })
+ return count
+ }
+
this.reload = function () {
this.$post("$")
.success(function (resp) {
@@ -11,7 +43,10 @@ Tea.context(function () {
})
.done(function () {
this.$delay(function () {
- this.reload()
+ // 没有选中任务的时候才重新刷新
+ if (this.countCheckedTasks() == 0) {
+ this.reload()
+ }
}, 3000)
})
}
@@ -28,4 +63,26 @@ Tea.context(function () {
})
})
}
+
+ this.deleteBatch = function () {
+ var taskIds = []
+ this.clusters.forEach(function (cluster) {
+ cluster.tasks.forEach(function (task) {
+ if (task.isChecked) {
+ taskIds.push(task.id)
+ }
+ })
+ })
+
+ let that = this
+ teaweb.confirm("确定要批量删除选中的任务吗?", function () {
+ that.$post(".deleteBatch")
+ .params({
+ taskIds: taskIds
+ })
+ .success(function () {
+ teaweb.reload()
+ })
+ })
+ }
})
\ No newline at end of file
diff --git a/web/views/@default/dns/tasks/listPopup.html b/web/views/@default/dns/tasks/listPopup.html
index 030f7375..bebb939e 100644
--- a/web/views/@default/dns/tasks/listPopup.html
+++ b/web/views/@default/dns/tasks/listPopup.html
@@ -3,7 +3,7 @@
正在同步的DNS任务(共{{tasks.length}}个)
|