mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-11-09 08:40:26 +08:00
IP名单中的IP增加添加日期显示
This commit is contained in:
@@ -15,6 +15,7 @@ func init() {
|
||||
Prefix("/clusters/logs").
|
||||
Get("", new(IndexAction)).
|
||||
Post("/readLogs", new(ReadLogsAction)).
|
||||
Post("/readAllLogs", new(ReadAllLogsAction)).
|
||||
EndAll()
|
||||
})
|
||||
}
|
||||
|
||||
24
internal/web/actions/default/clusters/logs/readAllLogs.go
Normal file
24
internal/web/actions/default/clusters/logs/readAllLogs.go
Normal file
@@ -0,0 +1,24 @@
|
||||
// Copyright 2021 Liuxiangchao iwind.liu@gmail.com. All rights reserved.
|
||||
|
||||
package logs
|
||||
|
||||
import (
|
||||
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
|
||||
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
|
||||
)
|
||||
|
||||
type ReadAllLogsAction struct {
|
||||
actionutils.ParentAction
|
||||
}
|
||||
|
||||
func (this *ReadAllLogsAction) RunPost(params struct {
|
||||
LogIds []int64
|
||||
}) {
|
||||
_, err := this.RPC().NodeLogRPC().UpdateAllNodeLogsRead(this.AdminContext(), &pb.UpdateAllNodeLogsReadRequest{})
|
||||
if err != nil {
|
||||
this.ErrorPage(err)
|
||||
return
|
||||
}
|
||||
|
||||
this.Success()
|
||||
}
|
||||
@@ -63,6 +63,7 @@ func (this *ListsAction) RunGet(params struct {
|
||||
"id": item.Id,
|
||||
"ipFrom": item.IpFrom,
|
||||
"ipTo": item.IpTo,
|
||||
"createdTime": timeutil.FormatTime("Y-m-d", item.CreatedAt),
|
||||
"expiredTime": expiredTime,
|
||||
"reason": item.Reason,
|
||||
"type": item.Type,
|
||||
|
||||
@@ -60,6 +60,7 @@ func (this *TestAction) RunPost(params struct {
|
||||
"ipFrom": resp.IpItem.IpFrom,
|
||||
"ipTo": resp.IpItem.IpTo,
|
||||
"reason": resp.IpItem.Reason,
|
||||
"createdTime": timeutil.FormatTime("Y-m-d", resp.IpItem.CreatedAt),
|
||||
"expiredAt": resp.IpItem.ExpiredAt,
|
||||
"expiredTime": timeutil.FormatTime("Y-m-d H:i:s", resp.IpItem.ExpiredAt),
|
||||
"type": resp.IpItem.Type,
|
||||
|
||||
@@ -74,6 +74,7 @@ func (this *AllowListAction) RunGet(params struct {
|
||||
"id": item.Id,
|
||||
"ipFrom": item.IpFrom,
|
||||
"ipTo": item.IpTo,
|
||||
"createdTime": timeutil.FormatTime("Y-m-d", item.CreatedAt),
|
||||
"expiredTime": expiredTime,
|
||||
"reason": item.Reason,
|
||||
"type": item.Type,
|
||||
|
||||
@@ -74,6 +74,7 @@ func (this *DenyListAction) RunGet(params struct {
|
||||
"id": item.Id,
|
||||
"ipFrom": item.IpFrom,
|
||||
"ipTo": item.IpTo,
|
||||
"createdTime": timeutil.FormatTime("Y-m-d", item.CreatedAt),
|
||||
"expiredTime": expiredTime,
|
||||
"reason": item.Reason,
|
||||
"type": item.Type,
|
||||
|
||||
@@ -74,6 +74,7 @@ func (this *TestAction) RunPost(params struct {
|
||||
"ipTo": resp.IpItem.IpTo,
|
||||
"reason": resp.IpItem.Reason,
|
||||
"expiredAt": resp.IpItem.ExpiredAt,
|
||||
"createdTime": timeutil.FormatTime("Y-m-d", resp.IpItem.CreatedAt),
|
||||
"expiredTime": timeutil.FormatTime("Y-m-d H:i:s", resp.IpItem.ExpiredAt),
|
||||
"type": resp.IpItem.Type,
|
||||
"eventLevelName": firewallconfigs.FindFirewallEventLevelName(resp.IpItem.EventLevel),
|
||||
|
||||
@@ -66,6 +66,7 @@ func (this *ItemsAction) RunGet(params struct {
|
||||
"id": item.Id,
|
||||
"ipFrom": item.IpFrom,
|
||||
"ipTo": item.IpTo,
|
||||
"createdTime": timeutil.FormatTime("Y-m-d", item.CreatedAt),
|
||||
"expiredTime": expiredTime,
|
||||
"reason": item.Reason,
|
||||
"type": item.Type,
|
||||
|
||||
@@ -62,6 +62,7 @@ func (this *TestAction) RunPost(params struct {
|
||||
"ipTo": resp.IpItem.IpTo,
|
||||
"reason": resp.IpItem.Reason,
|
||||
"expiredAt": resp.IpItem.ExpiredAt,
|
||||
"createdTime": timeutil.FormatTime("Y-m-d", resp.IpItem.CreatedAt),
|
||||
"expiredTime": timeutil.FormatTime("Y-m-d H:i:s", resp.IpItem.ExpiredAt),
|
||||
"type": resp.IpItem.Type,
|
||||
"eventLevelName": firewallconfigs.FindFirewallEventLevelName(resp.IpItem.EventLevel),
|
||||
|
||||
@@ -74,6 +74,7 @@ func (this *AllowListAction) RunGet(params struct {
|
||||
"id": item.Id,
|
||||
"ipFrom": item.IpFrom,
|
||||
"ipTo": item.IpTo,
|
||||
"createdTime": timeutil.FormatTime("Y-m-d", item.CreatedAt),
|
||||
"expiredTime": expiredTime,
|
||||
"reason": item.Reason,
|
||||
"type": item.Type,
|
||||
|
||||
@@ -74,6 +74,7 @@ func (this *DenyListAction) RunGet(params struct {
|
||||
"id": item.Id,
|
||||
"ipFrom": item.IpFrom,
|
||||
"ipTo": item.IpTo,
|
||||
"createdTime": timeutil.FormatTime("Y-m-d", item.CreatedAt),
|
||||
"expiredTime": expiredTime,
|
||||
"reason": item.Reason,
|
||||
"type": item.Type,
|
||||
|
||||
@@ -74,6 +74,7 @@ func (this *TestAction) RunPost(params struct {
|
||||
"ipTo": resp.IpItem.IpTo,
|
||||
"reason": resp.IpItem.Reason,
|
||||
"expiredAt": resp.IpItem.ExpiredAt,
|
||||
"createdTime": timeutil.FormatTime("Y-m-d", resp.IpItem.CreatedAt),
|
||||
"expiredTime": timeutil.FormatTime("Y-m-d H:i:s", resp.IpItem.ExpiredAt),
|
||||
"type": resp.IpItem.Type,
|
||||
"eventLevelName": firewallconfigs.FindFirewallEventLevelName(resp.IpItem.EventLevel),
|
||||
|
||||
@@ -36,6 +36,9 @@ Vue.component("ip-list-table", {
|
||||
<td>
|
||||
<span v-if="item.type != 'all'"><keyword :v-word="keyword">{{item.ipFrom}}</keyword><span v-if="item.ipTo.length > 0"> - <keyword :v-word="keyword">{{item.ipTo}}</keyword></span></span>
|
||||
<span v-else class="disabled">*</span>
|
||||
<div v-if="item.createdTime != null">
|
||||
<span class="small disabled">添加于 {{item.createdTime}}</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<span v-if="item.type.length == 0">IPv4</span>
|
||||
|
||||
@@ -38,6 +38,7 @@
|
||||
<div class="ui divider" style="margin-bottom: 0"></div>
|
||||
<second-menu v-if="logs.length > 0">
|
||||
<a href="" class="item" @click.prevent="updatePageRead()">[本页已读]</a>
|
||||
<a href="" class="item" @click.prevent="updateAllRead()">[全部已读]</a>
|
||||
</second-menu>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@ Tea.context(function () {
|
||||
let logIds = this.logs.map(function (v) {
|
||||
return v.id
|
||||
})
|
||||
teaweb.confirm("确定要设置本页日志为已读吗?", function () {
|
||||
this.$post(".readLogs")
|
||||
.params({
|
||||
logIds: logIds
|
||||
@@ -25,5 +26,16 @@ Tea.context(function () {
|
||||
.success(function () {
|
||||
teaweb.reload()
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
this.updateAllRead = function () {
|
||||
teaweb.confirm("确定要设置所有日志为已读吗?", function () {
|
||||
this.$post(".readAllLogs")
|
||||
.params({})
|
||||
.success(function () {
|
||||
teaweb.reload()
|
||||
})
|
||||
})
|
||||
}
|
||||
})
|
||||
@@ -5,6 +5,7 @@
|
||||
|
||||
<second-menu v-if="logs.length > 0">
|
||||
<a href="" class="item" @click.prevent="updatePageRead()">[本页已读]</a>
|
||||
<a href="" class="item" @click.prevent="updateAllRead()">[全部已读]</a>
|
||||
</second-menu>
|
||||
|
||||
<table class="ui table selectable celled" v-if="logs.length > 0">
|
||||
|
||||
@@ -13,12 +13,24 @@ Tea.context(function () {
|
||||
let logIds = this.logs.map(function (v) {
|
||||
return v.id
|
||||
})
|
||||
this.$post(".readEvents")
|
||||
teaweb.confirm("确定要设置本页日志为已读吗?", function () {
|
||||
this.$post(".readLogs")
|
||||
.params({
|
||||
logIds: logIds
|
||||
})
|
||||
.success(function () {
|
||||
teaweb.reload()
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
this.updateAllRead = function () {
|
||||
teaweb.confirm("确定要设置所有日志为已读吗?", function () {
|
||||
this.$post(".readAllLogs")
|
||||
.params({})
|
||||
.success(function () {
|
||||
teaweb.reload()
|
||||
})
|
||||
})
|
||||
}
|
||||
})
|
||||
@@ -40,7 +40,7 @@
|
||||
</td>
|
||||
<td>{{list.description}}</td>
|
||||
<td class="center">
|
||||
<span v-if="list.countItems > 0">{{list.countItems}}</span>
|
||||
<a :href="'/servers/iplists/items?listId=' + list.id" v-if="list.countItems > 0">{{list.countItems}}</a>
|
||||
<span v-else class="disabled">0</span>
|
||||
</td>
|
||||
<td>
|
||||
|
||||
Reference in New Issue
Block a user