mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-11-11 01:50:27 +08:00
增加清空节点同步任务、清空DNS同步任务功能
This commit is contained in:
25
internal/web/actions/default/clusters/tasks/deleteAll.go
Normal file
25
internal/web/actions/default/clusters/tasks/deleteAll.go
Normal file
@@ -0,0 +1,25 @@
|
||||
// Copyright 2023 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn .
|
||||
|
||||
package tasks
|
||||
|
||||
import (
|
||||
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
|
||||
"github.com/TeaOSLab/EdgeCommon/pkg/langs/codes"
|
||||
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
|
||||
)
|
||||
|
||||
type DeleteAllAction struct {
|
||||
actionutils.ParentAction
|
||||
}
|
||||
|
||||
func (this *DeleteAllAction) RunPost(params struct{}) {
|
||||
defer this.CreateLogInfo(codes.NodeTask_LogDeleteAllNodeTasks)
|
||||
|
||||
_, err := this.RPC().NodeTaskRPC().DeleteAllNodeTasks(this.AdminContext(), &pb.DeleteAllNodeTasksRequest{})
|
||||
if err != nil {
|
||||
this.ErrorPage(err)
|
||||
return
|
||||
}
|
||||
|
||||
this.Success()
|
||||
}
|
||||
@@ -17,6 +17,7 @@ func init() {
|
||||
Post("/check", new(CheckAction)).
|
||||
Post("/delete", new(DeleteAction)).
|
||||
Post("/deleteBatch", new(DeleteBatchAction)).
|
||||
Post("/deleteAll", new(DeleteAllAction)).
|
||||
|
||||
EndAll()
|
||||
})
|
||||
|
||||
25
internal/web/actions/default/dns/tasks/deleteAll.go
Normal file
25
internal/web/actions/default/dns/tasks/deleteAll.go
Normal file
@@ -0,0 +1,25 @@
|
||||
// Copyright 2023 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn .
|
||||
|
||||
package tasks
|
||||
|
||||
import (
|
||||
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
|
||||
"github.com/TeaOSLab/EdgeCommon/pkg/langs/codes"
|
||||
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
|
||||
)
|
||||
|
||||
type DeleteAllAction struct {
|
||||
actionutils.ParentAction
|
||||
}
|
||||
|
||||
func (this *DeleteAllAction) RunPost(params struct{}) {
|
||||
defer this.CreateLogInfo(codes.DNSTask_LogDeleteAllDNSTasks)
|
||||
|
||||
_, err := this.RPC().DNSTaskRPC().DeleteAllDNSTasks(this.AdminContext(), &pb.DeleteAllDNSTasksRequest{})
|
||||
if err != nil {
|
||||
this.ErrorPage(err)
|
||||
return
|
||||
}
|
||||
|
||||
this.Success()
|
||||
}
|
||||
@@ -16,7 +16,7 @@ func init() {
|
||||
GetPost("/listPopup", new(ListPopupAction)).
|
||||
Post("/check", new(CheckAction)).
|
||||
Post("/delete", new(DeleteAction)).
|
||||
|
||||
Post("/deleteAll", new(DeleteAllAction)).
|
||||
EndAll()
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
{$layout "layout_popup"}
|
||||
|
||||
<h3>正在同步的节点任务<span v-if="countTasks > 0">(共{{countTasks}}个)</span>
|
||||
<a href="" v-if="countCheckedTasks() > 0" @click.prevent="deleteBatch">批量删除{{countCheckedTasks()}}个任务</a>
|
||||
</h3>
|
||||
<p class="comment" v-if="clusters.length == 0">暂时没有同步的集群。</p>
|
||||
<h3>正在同步的节点任务<span v-if="countTasks > 0">(共{{countTasks}}个)</span></h3>
|
||||
<p class="comment" v-if="clusters.length == 0">暂时没有同步的任务。</p>
|
||||
<div v-if="clusters.length > 0">
|
||||
<button class="ui button basic tiny" @click.prevent="deleteAllTasks">清空所有任务</button>
|
||||
<button class="ui button basic tiny" v-if="countCheckedTasks() > 0" @click.prevent="deleteBatch">批量删除{{countCheckedTasks()}}个任务</button>
|
||||
|
||||
<table class="ui table selectable celled">
|
||||
<thead>
|
||||
<tr>
|
||||
|
||||
@@ -65,7 +65,7 @@ Tea.context(function () {
|
||||
}
|
||||
|
||||
this.deleteBatch = function () {
|
||||
var taskIds = []
|
||||
let taskIds = []
|
||||
this.clusters.forEach(function (cluster) {
|
||||
cluster.tasks.forEach(function (task) {
|
||||
if (task.isChecked) {
|
||||
@@ -85,4 +85,14 @@ Tea.context(function () {
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
this.deleteAllTasks = function () {
|
||||
let that = this
|
||||
teaweb.confirm("确定要清空所有的任务吗?", function () {
|
||||
that.$post(".deleteAll")
|
||||
.success(function () {
|
||||
teaweb.reload()
|
||||
})
|
||||
})
|
||||
}
|
||||
})
|
||||
@@ -1,8 +1,10 @@
|
||||
{$layout "layout_popup"}
|
||||
|
||||
<h3>正在同步的DNS任务<span v-if="tasks.length > 0">(共{{tasks.length}}个)</span></h3>
|
||||
<p class="comment" v-if="tasks.length == 0">暂时没有同步的集群。</p>
|
||||
<p class="comment" v-if="tasks.length == 0">暂时没有同步的任务。</p>
|
||||
<div v-if="tasks.length > 0">
|
||||
<button class="ui button tiny basic" @click.prevent="deleteAllTasks">清空所有任务</button>
|
||||
|
||||
<table class="ui table selectable celled">
|
||||
<thead>
|
||||
<tr>
|
||||
|
||||
@@ -27,4 +27,14 @@ Tea.context(function () {
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
this.deleteAllTasks = function () {
|
||||
let that = this
|
||||
teaweb.confirm("确定要清空所有的任务吗?", function () {
|
||||
that.$post(".deleteAll")
|
||||
.success(function () {
|
||||
teaweb.reload()
|
||||
})
|
||||
})
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user