mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-11-06 23:00:25 +08:00
增加DNS同步任务状态显示
This commit is contained in:
@@ -264,6 +264,10 @@ func (this *RPCClient) DNSRPC() pb.DNSServiceClient {
|
|||||||
return pb.NewDNSServiceClient(this.pickConn())
|
return pb.NewDNSServiceClient(this.pickConn())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (this *RPCClient) DNSTaskRPC() pb.DNSTaskServiceClient {
|
||||||
|
return pb.NewDNSTaskServiceClient(this.pickConn())
|
||||||
|
}
|
||||||
|
|
||||||
func (this *RPCClient) ACMEUserRPC() pb.ACMEUserServiceClient {
|
func (this *RPCClient) ACMEUserRPC() pb.ACMEUserServiceClient {
|
||||||
return pb.NewACMEUserServiceClient(this.pickConn())
|
return pb.NewACMEUserServiceClient(this.pickConn())
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -95,6 +95,7 @@ func (this *ClusterHelper) createSettingMenu(cluster *pb.NodeCluster, selectedIt
|
|||||||
"name": "DNS设置",
|
"name": "DNS设置",
|
||||||
"url": "/clusters/cluster/settings/dns?clusterId=" + clusterId,
|
"url": "/clusters/cluster/settings/dns?clusterId=" + clusterId,
|
||||||
"isActive": selectedItem == "dns",
|
"isActive": selectedItem == "dns",
|
||||||
|
"isOn": cluster.DnsDomainId > 0 || len(cluster.DnsName) > 0,
|
||||||
})
|
})
|
||||||
items = append(items, maps.Map{
|
items = append(items, maps.Map{
|
||||||
"name": "系统服务",
|
"name": "系统服务",
|
||||||
|
|||||||
23
internal/web/actions/default/dns/tasks/check.go
Normal file
23
internal/web/actions/default/dns/tasks/check.go
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
package tasks
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
|
||||||
|
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
|
||||||
|
)
|
||||||
|
|
||||||
|
type CheckAction struct {
|
||||||
|
actionutils.ParentAction
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *CheckAction) RunPost(params struct{}) {
|
||||||
|
resp, err := this.RPC().DNSTaskRPC().ExistsDNSTasks(this.AdminContext(), &pb.ExistsDNSTasksRequest{})
|
||||||
|
if err != nil {
|
||||||
|
this.ErrorPage(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
this.Data["isDoing"] = resp.ExistTasks
|
||||||
|
this.Data["hasError"] = resp.ExistError
|
||||||
|
|
||||||
|
this.Success()
|
||||||
|
}
|
||||||
24
internal/web/actions/default/dns/tasks/delete.go
Normal file
24
internal/web/actions/default/dns/tasks/delete.go
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
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("删除DNS同步任务 %d", params.TaskId)
|
||||||
|
|
||||||
|
_, err := this.RPC().DNSTaskRPC().DeleteDNSTask(this.AdminContext(), &pb.DeleteDNSTaskRequest{DnsTaskId: params.TaskId})
|
||||||
|
if err != nil {
|
||||||
|
this.ErrorPage(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
this.Success()
|
||||||
|
}
|
||||||
22
internal/web/actions/default/dns/tasks/init.go
Normal file
22
internal/web/actions/default/dns/tasks/init.go
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
package tasks
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/TeaOSLab/EdgeAdmin/internal/configloaders"
|
||||||
|
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/clusters/clusterutils"
|
||||||
|
"github.com/TeaOSLab/EdgeAdmin/internal/web/helpers"
|
||||||
|
"github.com/iwind/TeaGo"
|
||||||
|
)
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
TeaGo.BeforeStart(func(server *TeaGo.Server) {
|
||||||
|
server.
|
||||||
|
Helper(helpers.NewUserMustAuth(configloaders.AdminModuleCodeDNS)).
|
||||||
|
Helper(clusterutils.NewClustersHelper()).
|
||||||
|
Prefix("/dns/tasks").
|
||||||
|
GetPost("/listPopup", new(ListPopupAction)).
|
||||||
|
Post("/check", new(CheckAction)).
|
||||||
|
Post("/delete", new(DeleteAction)).
|
||||||
|
|
||||||
|
EndAll()
|
||||||
|
})
|
||||||
|
}
|
||||||
76
internal/web/actions/default/dns/tasks/listPopup.go
Normal file
76
internal/web/actions/default/dns/tasks/listPopup.go
Normal file
@@ -0,0 +1,76 @@
|
|||||||
|
package tasks
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
|
||||||
|
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
|
||||||
|
"github.com/iwind/TeaGo/actions"
|
||||||
|
"github.com/iwind/TeaGo/maps"
|
||||||
|
timeutil "github.com/iwind/TeaGo/utils/time"
|
||||||
|
)
|
||||||
|
|
||||||
|
type ListPopupAction struct {
|
||||||
|
actionutils.ParentAction
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *ListPopupAction) Init() {
|
||||||
|
this.Nav("", "", "")
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *ListPopupAction) RunGet(params struct{}) {
|
||||||
|
this.retrieveTasks()
|
||||||
|
|
||||||
|
this.Show()
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *ListPopupAction) RunPost(params struct {
|
||||||
|
Must *actions.Must
|
||||||
|
}) {
|
||||||
|
this.retrieveTasks()
|
||||||
|
this.Success()
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *ListPopupAction) retrieveTasks() {
|
||||||
|
resp, err := this.RPC().DNSTaskRPC().FindAllDoingDNSTasks(this.AdminContext(), &pb.FindAllDoingDNSTasksRequest{})
|
||||||
|
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
|
||||||
|
|
||||||
|
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,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
this.Data["tasks"] = taskMaps
|
||||||
|
}
|
||||||
@@ -110,7 +110,8 @@ func (this *userMustAuth) BeforeAction(actionPtr actions.ActionWrapper, paramNam
|
|||||||
if !action.Data.Has("teaSubMenu") {
|
if !action.Data.Has("teaSubMenu") {
|
||||||
action.Data["teaSubMenu"] = ""
|
action.Data["teaSubMenu"] = ""
|
||||||
}
|
}
|
||||||
action.Data["teaCheckClusterTask"] = configloaders.AllowModule(adminId, configloaders.AdminModuleCodeNode)
|
action.Data["teaCheckNodeTasks"] = configloaders.AllowModule(adminId, configloaders.AdminModuleCodeNode)
|
||||||
|
action.Data["teaCheckDNSTasks"] = configloaders.AllowModule(adminId, configloaders.AdminModuleCodeDNS)
|
||||||
|
|
||||||
// 菜单
|
// 菜单
|
||||||
action.Data["firstMenuItem"] = ""
|
action.Data["firstMenuItem"] = ""
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ import (
|
|||||||
_ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/dashboard"
|
_ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/dashboard"
|
||||||
_ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/db"
|
_ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/db"
|
||||||
_ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/dns"
|
_ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/dns"
|
||||||
|
_ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/dns/tasks"
|
||||||
_ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/finance"
|
_ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/finance"
|
||||||
_ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/finance/bills"
|
_ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/finance/bills"
|
||||||
_ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/index"
|
_ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/index"
|
||||||
|
|||||||
@@ -220,9 +220,20 @@ p.margin {
|
|||||||
opacity: 0.8;
|
opacity: 0.8;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@keyframes rotation {
|
||||||
|
from {
|
||||||
|
transform: rotate(0);
|
||||||
|
}
|
||||||
|
to {
|
||||||
|
transform: rotate(360deg);
|
||||||
|
}
|
||||||
|
}
|
||||||
body .ui.menu .item .blink {
|
body .ui.menu .item .blink {
|
||||||
animation: blink 1s infinite;
|
animation: blink 1s infinite;
|
||||||
}
|
}
|
||||||
|
body .ui.menu .item:not(:hover) span.rotate {
|
||||||
|
animation: rotation 3s infinite;
|
||||||
|
}
|
||||||
body.expanded .main-menu {
|
body.expanded .main-menu {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
@@ -239,9 +250,6 @@ body.expanded .main {
|
|||||||
border: 0 !important;
|
border: 0 !important;
|
||||||
background: #276ac6 !important;
|
background: #276ac6 !important;
|
||||||
}
|
}
|
||||||
.top-nav::-webkit-scrollbar {
|
|
||||||
height: 2px;
|
|
||||||
}
|
|
||||||
.top-nav img.avatar {
|
.top-nav img.avatar {
|
||||||
width: 1.6em !important;
|
width: 1.6em !important;
|
||||||
height: 1.6em !important;
|
height: 1.6em !important;
|
||||||
@@ -255,9 +263,18 @@ body.expanded .main {
|
|||||||
font-size: 0.9em;
|
font-size: 0.9em;
|
||||||
padding-left: 0.2em;
|
padding-left: 0.2em;
|
||||||
}
|
}
|
||||||
|
.top-nav .item .hover-span span {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
.top-nav .item:hover .hover-span span {
|
||||||
|
display: inline;
|
||||||
|
}
|
||||||
.top-nav .item.red {
|
.top-nav .item.red {
|
||||||
color: red !important;
|
color: red !important;
|
||||||
}
|
}
|
||||||
|
.top-nav::-webkit-scrollbar {
|
||||||
|
height: 2px;
|
||||||
|
}
|
||||||
/** 顶部菜单 **/
|
/** 顶部菜单 **/
|
||||||
.top-secondary-menu {
|
.top-secondary-menu {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -28,10 +28,17 @@
|
|||||||
|
|
||||||
<div class="right menu">
|
<div class="right menu">
|
||||||
<!-- 集群同步 -->
|
<!-- 集群同步 -->
|
||||||
<a href="" class="item" v-if="teaCheckClusterTask && doingNodeTasks.isUpdated" @click.prevent="showNodeTasks()">
|
<a href="" class="item" v-if="teaCheckNodeTasks && doingNodeTasks.isUpdated" @click.prevent="showNodeTasks()">
|
||||||
<span v-if="!doingNodeTasks.isDoing && !doingNodeTasks.hasError"><i class="icon sync"></i>已同步</span>
|
<span v-if="!doingNodeTasks.isDoing && !doingNodeTasks.hasError" class="hover-span"><i class="icon cloud disabled"></i><span class="disabled">已同步节点</span></span>
|
||||||
<span v-if="doingNodeTasks.isDoing && !doingNodeTasks.hasError"><i class="icon sync"></i>正在同步...</span>
|
<span v-if="doingNodeTasks.isDoing && !doingNodeTasks.hasError" class="hover-span rotate"><i class="icon cloud"></i><span>正在同步节点...</span></span>
|
||||||
<span v-if="doingNodeTasks.hasError" class="red"><i class="icon sync"></i>同步失败</span>
|
<span v-if="doingNodeTasks.hasError" class="red"><i class="icon cloud"></i>节点同步失败</span>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<!-- DNS同步 -->
|
||||||
|
<a href="" class="item" v-if="teaCheckDNSTasks && doingDNSTasks.isUpdated" @click.prevent="showDNSTasks()">
|
||||||
|
<span v-if="!doingDNSTasks.isDoing && !doingDNSTasks.hasError" class="hover-span"><i class="icon globe disabled"></i><span class="disabled">已同步DNS</span></span>
|
||||||
|
<span v-if="doingDNSTasks.isDoing && !doingDNSTasks.hasError" class="hover-span rotate"><i class="icon globe"></i><span>正在同步DNS...</span></span>
|
||||||
|
<span v-if="doingDNSTasks.hasError" class="red"><i class="icon globe"></i>DNS同步失败</span>
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
<!-- 消息 -->
|
<!-- 消息 -->
|
||||||
@@ -45,7 +52,7 @@
|
|||||||
</a>
|
</a>
|
||||||
|
|
||||||
<!-- 退出登录 -->
|
<!-- 退出登录 -->
|
||||||
<a :href="Tea.url('logout')" class="item" title="安全退出登录"><i class="icon sign out"></i>退出</a>
|
<a :href="Tea.url('logout')" class="item" title="安全退出登录"><i class="icon sign out"></i></a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -16,6 +16,9 @@ Tea.context(function () {
|
|||||||
|
|
||||||
// 检查集群节点同步
|
// 检查集群节点同步
|
||||||
this.loadNodeTasks();
|
this.loadNodeTasks();
|
||||||
|
|
||||||
|
// 检查DNS同步
|
||||||
|
this.loadDNSTasks()
|
||||||
})
|
})
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -83,6 +86,9 @@ Tea.context(function () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.loadNodeTasks = function () {
|
this.loadNodeTasks = function () {
|
||||||
|
if (!Tea.Vue.teaCheckNodeTasks) {
|
||||||
|
return
|
||||||
|
}
|
||||||
this.$post("/clusters/tasks/check")
|
this.$post("/clusters/tasks/check")
|
||||||
.success(function (resp) {
|
.success(function (resp) {
|
||||||
this.doingNodeTasks.isDoing = resp.data.isDoing
|
this.doingNodeTasks.isDoing = resp.data.isDoing
|
||||||
@@ -102,6 +108,39 @@ Tea.context(function () {
|
|||||||
width: "50em"
|
width: "50em"
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* DNS同步任务
|
||||||
|
*/
|
||||||
|
this.doingDNSTasks = {
|
||||||
|
isDoing: false,
|
||||||
|
hasError: false,
|
||||||
|
isUpdated: false
|
||||||
|
}
|
||||||
|
|
||||||
|
this.loadDNSTasks = function () {
|
||||||
|
if (!Tea.Vue.teaCheckDNSTasks) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this.$post("/dns/tasks/check")
|
||||||
|
.success(function (resp) {
|
||||||
|
this.doingDNSTasks.isDoing = resp.data.isDoing
|
||||||
|
this.doingDNSTasks.hasError = resp.data.hasError
|
||||||
|
this.doingDNSTasks.isUpdated = true
|
||||||
|
})
|
||||||
|
.done(function () {
|
||||||
|
this.$delay(function () {
|
||||||
|
this.loadDNSTasks()
|
||||||
|
}, 3000)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
this.showDNSTasks = function () {
|
||||||
|
teaweb.popup("/dns/tasks/listPopup", {
|
||||||
|
height: "24em",
|
||||||
|
width: "50em"
|
||||||
|
})
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
window.NotifySuccess = function (message, url, params) {
|
window.NotifySuccess = function (message, url, params) {
|
||||||
|
|||||||
@@ -176,10 +176,23 @@ div.margin, p.margin {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@keyframes rotation {
|
||||||
|
from {
|
||||||
|
transform: rotate(0);
|
||||||
|
}
|
||||||
|
to {
|
||||||
|
transform: rotate(360deg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
body .ui.menu .item .blink {
|
body .ui.menu .item .blink {
|
||||||
animation: blink 1s infinite;
|
animation: blink 1s infinite;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
body .ui.menu .item:not(:hover) span.rotate {
|
||||||
|
animation: rotation 3s infinite;
|
||||||
|
}
|
||||||
|
|
||||||
body.expanded .main-menu {
|
body.expanded .main-menu {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
@@ -197,13 +210,8 @@ body.expanded .main {
|
|||||||
overflow-x: auto;
|
overflow-x: auto;
|
||||||
border: 0 !important;
|
border: 0 !important;
|
||||||
background: #276ac6 !important;
|
background: #276ac6 !important;
|
||||||
}
|
|
||||||
|
|
||||||
.top-nav::-webkit-scrollbar {
|
img.avatar {
|
||||||
height: 2px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.top-nav img.avatar {
|
|
||||||
width: 1.6em !important;
|
width: 1.6em !important;
|
||||||
height: 1.6em !important;
|
height: 1.6em !important;
|
||||||
padding: 0.2em;
|
padding: 0.2em;
|
||||||
@@ -212,15 +220,37 @@ body.expanded .main {
|
|||||||
margin-right: 0.5em !important;
|
margin-right: 0.5em !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.top-nav em {
|
em {
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
font-size: 0.9em;
|
font-size: 0.9em;
|
||||||
padding-left: 0.2em;
|
padding-left: 0.2em;
|
||||||
}
|
}
|
||||||
|
|
||||||
.top-nav .item.red {
|
.item {
|
||||||
|
.hover-span {
|
||||||
|
span {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.item:hover {
|
||||||
|
.hover-span {
|
||||||
|
span {
|
||||||
|
display: inline;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.item.red {
|
||||||
color: red !important;
|
color: red !important;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.top-nav::-webkit-scrollbar {
|
||||||
|
height: 2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/** 顶部菜单 **/
|
/** 顶部菜单 **/
|
||||||
.top-secondary-menu {
|
.top-secondary-menu {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{$layout "layout_popup"}
|
{$layout "layout_popup"}
|
||||||
|
|
||||||
<h3>正在同步的任务<span v-if="countTasks > 0">(共{{countTasks}}个)</span></h3>
|
<h3>正在同步的节点任务<span v-if="countTasks > 0">(共{{countTasks}}个)</span></h3>
|
||||||
<p class="comment" v-if="clusters.length == 0">暂时没有同步的集群。</p>
|
<p class="comment" v-if="clusters.length == 0">暂时没有同步的集群。</p>
|
||||||
<div v-if="clusters.length > 0">
|
<div v-if="clusters.length > 0">
|
||||||
<table class="ui table selectable">
|
<table class="ui table selectable">
|
||||||
|
|||||||
6
web/views/@default/dns/tasks/listPopup.css
Normal file
6
web/views/@default/dns/tasks/listPopup.css
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
h3 span {
|
||||||
|
margin-left: 0.5em;
|
||||||
|
color: grey;
|
||||||
|
font-size: 0.6em !important;
|
||||||
|
}
|
||||||
|
/*# sourceMappingURL=listPopup.css.map */
|
||||||
1
web/views/@default/dns/tasks/listPopup.css.map
Normal file
1
web/views/@default/dns/tasks/listPopup.css.map
Normal file
@@ -0,0 +1 @@
|
|||||||
|
{"version":3,"sources":["listPopup.less"],"names":[],"mappings":"AAAA,EAAG;EACF,kBAAA;EACA,WAAA;EACA,2BAAA","file":"listPopup.css"}
|
||||||
37
web/views/@default/dns/tasks/listPopup.html
Normal file
37
web/views/@default/dns/tasks/listPopup.html
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
{$layout "layout_popup"}
|
||||||
|
|
||||||
|
<h3>正在同步的DNS任务<span v-if="tasks.length > 0">(共{{tasks.length}}个)</span></h3>
|
||||||
|
<p class="comment" v-if="tasks.length == 0">暂时没有同步的集群。</p>
|
||||||
|
<div v-if="tasks.length > 0">
|
||||||
|
<table class="ui table selectable">
|
||||||
|
<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}}</span>
|
||||||
|
<span v-if="task.type == 'nodeChange'">{{task.node.name}}</span>
|
||||||
|
<span v-if="task.type == 'serverChange'">{{task.server.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>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<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>
|
||||||
30
web/views/@default/dns/tasks/listPopup.js
Normal file
30
web/views/@default/dns/tasks/listPopup.js
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
Tea.context(function () {
|
||||||
|
this.$delay(function () {
|
||||||
|
this.reload()
|
||||||
|
})
|
||||||
|
|
||||||
|
this.reload = function () {
|
||||||
|
this.$post("$")
|
||||||
|
.success(function (resp) {
|
||||||
|
this.tasks = resp.data.tasks
|
||||||
|
})
|
||||||
|
.done(function () {
|
||||||
|
this.$delay(function () {
|
||||||
|
this.reload()
|
||||||
|
}, 3000)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
this.deleteTask = function (taskId) {
|
||||||
|
let that = this
|
||||||
|
teaweb.confirm("确定要删除这个任务吗?", function () {
|
||||||
|
that.$post(".delete")
|
||||||
|
.params({
|
||||||
|
taskId: taskId
|
||||||
|
})
|
||||||
|
.success(function () {
|
||||||
|
teaweb.reload()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
5
web/views/@default/dns/tasks/listPopup.less
Normal file
5
web/views/@default/dns/tasks/listPopup.less
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
h3 span {
|
||||||
|
margin-left: 0.5em;
|
||||||
|
color: grey;
|
||||||
|
font-size: 0.6em !important;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user