mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-11-04 04:54:32 +08:00
域名解析任务列表中增加集群解析页面链接/在域名解析--集群详情中显示正在执行的任务
This commit is contained in:
@@ -5,6 +5,7 @@ import (
|
|||||||
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
|
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
|
||||||
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
|
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
|
||||||
"github.com/iwind/TeaGo/maps"
|
"github.com/iwind/TeaGo/maps"
|
||||||
|
timeutil "github.com/iwind/TeaGo/utils/time"
|
||||||
)
|
)
|
||||||
|
|
||||||
type ClusterAction struct {
|
type ClusterAction struct {
|
||||||
@@ -209,5 +210,60 @@ func (this *ClusterAction) RunGet(params struct {
|
|||||||
}
|
}
|
||||||
this.Data["issues"] = issueMaps
|
this.Data["issues"] = issueMaps
|
||||||
|
|
||||||
|
// 当前正在执行的任务
|
||||||
|
resp, err := this.RPC().DNSTaskRPC().FindAllDoingDNSTasks(this.AdminContext(), &pb.FindAllDoingDNSTasksRequest{
|
||||||
|
NodeClusterId: params.ClusterId,
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
this.ErrorPage(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
taskMaps := []maps.Map{}
|
||||||
|
for _, task := range resp.DnsTasks {
|
||||||
|
var clusterMap maps.Map = nil
|
||||||
|
var nodeMap maps.Map = nil
|
||||||
|
var serverMap maps.Map = nil
|
||||||
|
var domainMap maps.Map = nil
|
||||||
|
|
||||||
|
if task.NodeCluster != nil {
|
||||||
|
clusterMap = maps.Map{
|
||||||
|
"id": task.NodeCluster.Id,
|
||||||
|
"name": task.NodeCluster.Name,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if task.Node != nil {
|
||||||
|
nodeMap = maps.Map{
|
||||||
|
"id": task.Node.Id,
|
||||||
|
"name": task.Node.Name,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if task.Server != nil {
|
||||||
|
serverMap = maps.Map{
|
||||||
|
"id": task.Server.Id,
|
||||||
|
"name": task.Server.Name,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if task.DnsDomain != nil {
|
||||||
|
domainMap = maps.Map{
|
||||||
|
"id": task.DnsDomain.Id,
|
||||||
|
"name": task.DnsDomain.Name,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
taskMaps = append(taskMaps, maps.Map{
|
||||||
|
"id": task.Id,
|
||||||
|
"type": task.Type,
|
||||||
|
"isDone": task.IsDone,
|
||||||
|
"isOk": task.IsOk,
|
||||||
|
"error": task.Error,
|
||||||
|
"updatedTime": timeutil.FormatTime("Y-m-d H:i:s", task.UpdatedAt),
|
||||||
|
"cluster": clusterMap,
|
||||||
|
"node": nodeMap,
|
||||||
|
"server": serverMap,
|
||||||
|
"domain": domainMap,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
this.Data["tasks"] = taskMaps
|
||||||
|
|
||||||
this.Show()
|
this.Show()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
// 使用Icon的链接方式
|
// 使用Icon的链接方式
|
||||||
Vue.component("link-icon", {
|
Vue.component("link-icon", {
|
||||||
props: ["href", "title"],
|
props: ["href", "title", "target"],
|
||||||
data: function () {
|
data: function () {
|
||||||
return {
|
return {
|
||||||
vTitle: (this.title == null) ? "打开链接" : this.title
|
vTitle: (this.title == null) ? "打开链接" : this.title
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
template: `<span><slot></slot> <a :href="href" :title="vTitle" class="link grey"><i class="icon linkify small"></i></a></span>`
|
template: `<span><slot></slot> <a :href="href" :title="vTitle" class="link grey" :target="target"><i class="icon linkify small"></i></a></span>`
|
||||||
})
|
})
|
||||||
|
|
||||||
// 带有下划虚线的连接
|
// 带有下划虚线的连接
|
||||||
|
|||||||
@@ -52,9 +52,49 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
<!-- 当前任务 -->
|
||||||
|
<div v-if="tasks.length > 0">
|
||||||
|
<h4>正在执行的任务</h4>
|
||||||
|
<table class="ui table selectable celled">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>对象</th>
|
||||||
|
<th>任务</th>
|
||||||
|
<th>状态</th>
|
||||||
|
<th>触发时间</th>
|
||||||
|
<th></th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tr v-for="task in tasks">
|
||||||
|
<td>
|
||||||
|
<span v-if="task.type == 'clusterChange'">{{task.cluster.name}}
|
||||||
|
<link-icon :href="'/dns/clusters/cluster?clusterId=' + task.cluster.id" target="_top"></link-icon>
|
||||||
|
</span>
|
||||||
|
<span v-if="task.type == 'nodeChange'">{{task.node.name}}</span>
|
||||||
|
<span v-if="task.type == 'serverChange'">{{task.server.name}}</span>
|
||||||
|
<span v-if="task.type == 'domainChange'">{{task.domain.name}}</span>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<span v-if="task.type == 'clusterChange'">集群</span>
|
||||||
|
<span v-if="task.type == 'nodeChange'">节点</span>
|
||||||
|
<span v-if="task.type == 'serverChange'">服务</span>
|
||||||
|
<span v-if="task.type == 'domainChange'">域名</span>
|
||||||
|
</td>
|
||||||
|
<td style="word-break: break-word; width: 26em">
|
||||||
|
<span v-if="task.isDone" class="red">{{task.error}}</span>
|
||||||
|
<span v-else>正在同步...</span>
|
||||||
|
</td>
|
||||||
|
<td>{{task.updatedTime}}</td>
|
||||||
|
<td>
|
||||||
|
<a href="" title="删除" class="remove-btn" @click.prevent="deleteTask(task.id)"><i class="icon remove small grey"></i></a>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
|
||||||
<!-- 问题合集 -->
|
<!-- 问题合集 -->
|
||||||
<div v-if="issues.length > 0">
|
<div v-if="issues.length > 0">
|
||||||
<h3>需要修复的问题</h3>
|
<h4>需要修复的问题</h4>
|
||||||
<table class="ui table selectable celled" v-if="issues.length > 0">
|
<table class="ui table selectable celled" v-if="issues.length > 0">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
@@ -91,7 +131,7 @@
|
|||||||
<p class="comment">下面的DNS解析记录也可以手工在DNS服务商提供的管理平台添加。</p>
|
<p class="comment">下面的DNS解析记录也可以手工在DNS服务商提供的管理平台添加。</p>
|
||||||
|
|
||||||
<!-- 节点DNS解析记录 -->
|
<!-- 节点DNS解析记录 -->
|
||||||
<h3>节点DNS解析记录 <span> ({{nodes.length}}个)</span></h3>
|
<h4>节点DNS解析记录 <span> ({{nodes.length}}个)</span></h4>
|
||||||
<p class="comment" v-if="nodes.length == 0">暂时没有需要设置的DNS记录。</p>
|
<p class="comment" v-if="nodes.length == 0">暂时没有需要设置的DNS记录。</p>
|
||||||
<table class="ui table selectable celled" v-if="nodes.length > 0">
|
<table class="ui table selectable celled" v-if="nodes.length > 0">
|
||||||
<thead>
|
<thead>
|
||||||
@@ -134,7 +174,7 @@
|
|||||||
</table>
|
</table>
|
||||||
|
|
||||||
<!-- 网站服务解析记录 -->
|
<!-- 网站服务解析记录 -->
|
||||||
<h3>网站服务解析记录 <span> ({{servers.length}}个)</span></h3>
|
<h4>网站服务解析记录 <span> ({{servers.length}}个)</span></h4>
|
||||||
<p class="comment" v-if="servers.length == 0">暂时没有需要设置的DNS记录。</p>
|
<p class="comment" v-if="servers.length == 0">暂时没有需要设置的DNS记录。</p>
|
||||||
<table class="ui table selectable celled" v-if="servers.length > 0">
|
<table class="ui table selectable celled" v-if="servers.length > 0">
|
||||||
<thead>
|
<thead>
|
||||||
|
|||||||
@@ -40,4 +40,17 @@ Tea.context(function () {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.deleteTask = function (taskId) {
|
||||||
|
let that = this
|
||||||
|
teaweb.confirm("确定要删除这个任务吗?", function () {
|
||||||
|
that.$post("/dns/tasks/delete")
|
||||||
|
.params({
|
||||||
|
taskId: taskId
|
||||||
|
})
|
||||||
|
.success(function () {
|
||||||
|
teaweb.reload()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
})
|
})
|
||||||
@@ -15,7 +15,9 @@
|
|||||||
</thead>
|
</thead>
|
||||||
<tr v-for="task in tasks">
|
<tr v-for="task in tasks">
|
||||||
<td>
|
<td>
|
||||||
<span v-if="task.type == 'clusterChange'">{{task.cluster.name}}</span>
|
<span v-if="task.type == 'clusterChange'">{{task.cluster.name}}
|
||||||
|
<link-icon :href="'/dns/clusters/cluster?clusterId=' + task.cluster.id" target="_top"></link-icon>
|
||||||
|
</span>
|
||||||
<span v-if="task.type == 'nodeChange'">{{task.node.name}}</span>
|
<span v-if="task.type == 'nodeChange'">{{task.node.name}}</span>
|
||||||
<span v-if="task.type == 'serverChange'">{{task.server.name}}</span>
|
<span v-if="task.type == 'serverChange'">{{task.server.name}}</span>
|
||||||
<span v-if="task.type == 'domainChange'">{{task.domain.name}}</span>
|
<span v-if="task.type == 'domainChange'">{{task.domain.name}}</span>
|
||||||
|
|||||||
Reference in New Issue
Block a user