mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-12-24 10:56:36 +08:00
网站访问日志未开启时,在访问日志列表显示提醒文字
This commit is contained in:
@@ -2,6 +2,7 @@ package log
|
||||
|
||||
import (
|
||||
"github.com/TeaOSLab/EdgeCommon/pkg/iplibrary"
|
||||
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/dao"
|
||||
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
|
||||
"github.com/iwind/TeaGo/lists"
|
||||
"github.com/iwind/TeaGo/maps"
|
||||
@@ -61,6 +62,27 @@ func (this *HistoryAction) RunGet(params struct {
|
||||
return
|
||||
}
|
||||
|
||||
// 检查当前网站有无开启访问日志
|
||||
this.Data["serverAccessLogIsOn"] = true
|
||||
|
||||
groupResp, err := this.RPC().ServerGroupRPC().FindEnabledServerGroupConfigInfo(this.AdminContext(), &pb.FindEnabledServerGroupConfigInfoRequest{
|
||||
ServerId: params.ServerId,
|
||||
})
|
||||
if err != nil {
|
||||
this.ErrorPage(err)
|
||||
return
|
||||
}
|
||||
if !groupResp.HasAccessLogConfig {
|
||||
webConfig, err := dao.SharedHTTPWebDAO.FindWebConfigWithServerId(this.AdminContext(), params.ServerId)
|
||||
if err != nil {
|
||||
this.ErrorPage(err)
|
||||
return
|
||||
}
|
||||
if webConfig != nil && webConfig.AccessLogRef != nil && !webConfig.AccessLogRef.IsOn {
|
||||
this.Data["serverAccessLogIsOn"] = false
|
||||
}
|
||||
}
|
||||
|
||||
var day = params.Day
|
||||
var ipList = []string{}
|
||||
var wafMaps = []maps.Map{}
|
||||
|
||||
@@ -2,6 +2,7 @@ package log
|
||||
|
||||
import (
|
||||
"github.com/TeaOSLab/EdgeCommon/pkg/iplibrary"
|
||||
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/dao"
|
||||
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
|
||||
"github.com/iwind/TeaGo/actions"
|
||||
"github.com/iwind/TeaGo/lists"
|
||||
@@ -41,8 +42,29 @@ func (this *IndexAction) RunGet(params struct {
|
||||
return
|
||||
}
|
||||
|
||||
// 检查当前网站有无开启访问日志
|
||||
this.Data["serverAccessLogIsOn"] = true
|
||||
|
||||
groupResp, err := this.RPC().ServerGroupRPC().FindEnabledServerGroupConfigInfo(this.AdminContext(), &pb.FindEnabledServerGroupConfigInfoRequest{
|
||||
ServerId: params.ServerId,
|
||||
})
|
||||
if err != nil {
|
||||
this.ErrorPage(err)
|
||||
return
|
||||
}
|
||||
if !groupResp.HasAccessLogConfig {
|
||||
webConfig, err := dao.SharedHTTPWebDAO.FindWebConfigWithServerId(this.AdminContext(), params.ServerId)
|
||||
if err != nil {
|
||||
this.ErrorPage(err)
|
||||
return
|
||||
}
|
||||
if webConfig != nil && webConfig.AccessLogRef != nil && !webConfig.AccessLogRef.IsOn {
|
||||
this.Data["serverAccessLogIsOn"] = false
|
||||
}
|
||||
}
|
||||
|
||||
// 记录最近使用
|
||||
_, err := this.RPC().LatestItemRPC().IncreaseLatestItem(this.AdminContext(), &pb.IncreaseLatestItemRequest{
|
||||
_, err = this.RPC().LatestItemRPC().IncreaseLatestItem(this.AdminContext(), &pb.IncreaseLatestItemRequest{
|
||||
ItemType: "server",
|
||||
ItemId: params.ServerId,
|
||||
})
|
||||
|
||||
@@ -2,6 +2,7 @@ package log
|
||||
|
||||
import (
|
||||
"github.com/TeaOSLab/EdgeCommon/pkg/iplibrary"
|
||||
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/dao"
|
||||
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
|
||||
"github.com/iwind/TeaGo/lists"
|
||||
"github.com/iwind/TeaGo/maps"
|
||||
@@ -55,6 +56,27 @@ func (this *TodayAction) RunGet(params struct {
|
||||
return
|
||||
}
|
||||
|
||||
// 检查当前网站有无开启访问日志
|
||||
this.Data["serverAccessLogIsOn"] = true
|
||||
|
||||
groupResp, err := this.RPC().ServerGroupRPC().FindEnabledServerGroupConfigInfo(this.AdminContext(), &pb.FindEnabledServerGroupConfigInfoRequest{
|
||||
ServerId: params.ServerId,
|
||||
})
|
||||
if err != nil {
|
||||
this.ErrorPage(err)
|
||||
return
|
||||
}
|
||||
if !groupResp.HasAccessLogConfig {
|
||||
webConfig, err := dao.SharedHTTPWebDAO.FindWebConfigWithServerId(this.AdminContext(), params.ServerId)
|
||||
if err != nil {
|
||||
this.ErrorPage(err)
|
||||
return
|
||||
}
|
||||
if webConfig != nil && webConfig.AccessLogRef != nil && !webConfig.AccessLogRef.IsOn {
|
||||
this.Data["serverAccessLogIsOn"] = false
|
||||
}
|
||||
}
|
||||
|
||||
resp, err := this.RPC().HTTPAccessLogRPC().ListHTTPAccessLogs(this.AdminContext(), &pb.ListHTTPAccessLogsRequest{
|
||||
Partition: params.Partition,
|
||||
RequestId: params.RequestId,
|
||||
|
||||
@@ -21,7 +21,7 @@ func (this *IndexAction) Init() {
|
||||
func (this *IndexAction) RunGet(params struct {
|
||||
ServerId int64
|
||||
}) {
|
||||
// 服务分组设置
|
||||
// 网站分组设置
|
||||
groupResp, err := this.RPC().ServerGroupRPC().FindEnabledServerGroupConfigInfo(this.AdminContext(), &pb.FindEnabledServerGroupConfigInfoRequest{
|
||||
ServerId: params.ServerId,
|
||||
})
|
||||
|
||||
@@ -20,6 +20,12 @@
|
||||
<warning-message>当前集群已经设置不允许网站记录访问日志,可以在"集群设置" -- "网站设置"中修改此选项。</warning-message>
|
||||
</div>
|
||||
|
||||
<!-- 网站设置提醒 -->
|
||||
<div v-if="!serverAccessLogIsOn">
|
||||
<div class="margin"></div>
|
||||
<warning-message>当前网站尚未启用访问日志,可以在 <a :href="'/servers/server/settings/accessLog?serverId=' + serverId">[这里]</a> 修改。</warning-message>
|
||||
</div>
|
||||
|
||||
<first-menu>
|
||||
<menu-item :href="path + '?' + query()" :active="hasError == 0 && hasWAF == 0">所有日志</menu-item>
|
||||
<menu-item :href="path + '?' + query('hasError=1')" :active="hasError > 0">错误日志</menu-item>
|
||||
|
||||
@@ -18,6 +18,12 @@
|
||||
<warning-message>当前集群已经设置不允许网站记录访问日志,可以在"集群设置" -- "网站设置"中修改此选项。</warning-message>
|
||||
</div>
|
||||
|
||||
<!-- 网站设置提醒 -->
|
||||
<div v-if="!serverAccessLogIsOn">
|
||||
<div class="margin"></div>
|
||||
<warning-message>当前网站尚未启用访问日志,可以在 <a :href="'/servers/server/settings/accessLog?serverId=' + serverId">[这里]</a> 修改。</warning-message>
|
||||
</div>
|
||||
|
||||
<form method="get" class="ui form small" :action="path" autocomplete="off">
|
||||
<input type="hidden" name="serverId" :value="serverId"/>
|
||||
<http-access-log-search-box :v-ip="ip" :v-domain="domain" :v-keyword="keyword" :v-cluster-id="clusterId" :v-node-id="nodeId"></http-access-log-search-box>
|
||||
|
||||
@@ -18,6 +18,12 @@
|
||||
<warning-message>当前集群已经设置不允许网站记录访问日志,可以在"集群设置" -- "网站设置"中修改此选项。</warning-message>
|
||||
</div>
|
||||
|
||||
<!-- 网站设置提醒 -->
|
||||
<div v-if="!serverAccessLogIsOn">
|
||||
<div class="margin"></div>
|
||||
<warning-message>当前网站尚未启用访问日志,可以在 <a :href="'/servers/server/settings/accessLog?serverId=' + serverId">[这里]</a> 修改。</warning-message>
|
||||
</div>
|
||||
|
||||
<first-menu>
|
||||
<menu-item :href="path + '?' + query()" :active="hasError == 0 && hasWAF == 0">所有日志</menu-item>
|
||||
<menu-item :href="path + '?' + query('hasError=1')" :active="hasError > 0">错误日志</menu-item>
|
||||
|
||||
Reference in New Issue
Block a user