Archived
域名服务增加访问日志
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
Vue.component("ns-access-log-box", {
|
||||
props: ["v-access-log"],
|
||||
data: function () {
|
||||
let accessLog = this.vAccessLog
|
||||
return {
|
||||
accessLog: accessLog
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
showLog: function () {
|
||||
let that = this
|
||||
let requestId = this.accessLog.requestId
|
||||
this.$parent.$children.forEach(function (v) {
|
||||
if (v.deselect != null) {
|
||||
v.deselect()
|
||||
}
|
||||
})
|
||||
this.select()
|
||||
|
||||
teaweb.popup("/ns/clusters/accessLogs/viewPopup?requestId=" + requestId, {
|
||||
width: "50em",
|
||||
height: "24em",
|
||||
onClose: function () {
|
||||
that.deselect()
|
||||
}
|
||||
})
|
||||
},
|
||||
select: function () {
|
||||
this.$refs.box.parentNode.style.cssText = "background: rgba(0, 0, 0, 0.1)"
|
||||
},
|
||||
deselect: function () {
|
||||
this.$refs.box.parentNode.style.cssText = ""
|
||||
}
|
||||
},
|
||||
template: `<div class="access-log-row" :style="{'color': (accessLog.nsRecordId == null || accessLog.nsRecordId == 0) ? '#dc143c' : ''}" ref="box">
|
||||
<span v-if="accessLog.region != null && accessLog.region.length > 0" class="grey">[{{accessLog.region}}]</span> {{accessLog.remoteAddr}} [{{accessLog.timeLocal}}] [{{accessLog.networking}}] <em>{{accessLog.questionType}} {{accessLog.questionName}}</em> -> <em>{{accessLog.recordType}} {{accessLog.recordValue}}</em><!-- <a href="" @click.prevent="showLog" title="查看详情"><i class="icon expand"></i></a>-->
|
||||
</div>`
|
||||
})
|
||||
@@ -0,0 +1,27 @@
|
||||
Vue.component("ns-access-log-ref-box", {
|
||||
props:["v-access-log-ref"],
|
||||
data: function () {
|
||||
let config = this.vAccessLogRef
|
||||
if (config == null) {
|
||||
config = {
|
||||
isOn: false,
|
||||
isPrior: false
|
||||
}
|
||||
}
|
||||
return {
|
||||
config: config
|
||||
}
|
||||
},
|
||||
template: `<div>
|
||||
<input type="hidden" name="accessLogJSON" :value="JSON.stringify(config)"/>
|
||||
<table class="ui table definition selectable">
|
||||
<tr>
|
||||
<td class="title">是否启用</td>
|
||||
<td>
|
||||
<checkbox name="isOn" value="1" v-model="config.isOn"></checkbox>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<div class="margin"></div>
|
||||
</div>`
|
||||
})
|
||||
@@ -1,4 +1,5 @@
|
||||
Vue.component("ns-cluster-selector", {
|
||||
props: ["v-cluster-id"],
|
||||
mounted: function () {
|
||||
let that = this
|
||||
|
||||
@@ -8,7 +9,6 @@ Vue.component("ns-cluster-selector", {
|
||||
that.clusters = resp.data.clusters
|
||||
})
|
||||
},
|
||||
props: ["v-cluster-id"],
|
||||
data: function () {
|
||||
let clusterId = this.vClusterId
|
||||
if (clusterId == null) {
|
||||
|
||||
@@ -7,9 +7,10 @@
|
||||
|
||||
<!-- 升级提醒 -->
|
||||
<div class="ui message error" v-if="nodeUpgradeInfo.count > 0"><a href="/clusters">升级提醒:有 {{nodeUpgradeInfo.count}} 个边缘节点需要升级到 v{{nodeUpgradeInfo.version}} 版本</a><a href="" title="关闭" @click.prevent="closeMessage"><i class="ui icon remove small"></i></a></div>
|
||||
<div class="ui message error" v-if="monitorNodeUpgradeInfo.count > 0"><a href="/settings/monitorNodes">升级提醒:有 {{monitorNodeUpgradeInfo.count}} 个监控节点需要升级到 v{{monitorNodeUpgradeInfo.version}} 版本</a><a href="" title="关闭" @click.prevent="closeMessage"><i class="ui icon remove small"></i></a></div>
|
||||
<div class="ui message error" v-if="userNodeUpgradeInfo.count > 0"><a href="/settings/userNodes">升级提醒:有 {{userNodeUpgradeInfo.count}} 个用户节点需要升级到 v{{userNodeUpgradeInfo.version}} 版本</a><a href="" title="关闭" @click.prevent="closeMessage"><i class="ui icon remove small"></i></a></div>
|
||||
<div class="ui message error" v-if="monitorNodeUpgradeInfo.count > 0 && teaIsPlus"><a href="/settings/monitorNodes">升级提醒:有 {{monitorNodeUpgradeInfo.count}} 个监控节点需要升级到 v{{monitorNodeUpgradeInfo.version}} 版本</a><a href="" title="关闭" @click.prevent="closeMessage"><i class="ui icon remove small"></i></a></div>
|
||||
<div class="ui message error" v-if="userNodeUpgradeInfo.count > 0 && teaIsPlus"><a href="/settings/userNodes">升级提醒:有 {{userNodeUpgradeInfo.count}} 个用户节点需要升级到 v{{userNodeUpgradeInfo.version}} 版本</a><a href="" title="关闭" @click.prevent="closeMessage"><i class="ui icon remove small"></i></a></div>
|
||||
<div class="ui message error" v-if="apiNodeUpgradeInfo.count > 0"><a href="/api">升级提醒:有 {{apiNodeUpgradeInfo.count}} 个API节点需要升级到 v{{apiNodeUpgradeInfo.version}} 版本</a><a href="" title="关闭" @click.prevent="closeMessage"><i class="ui icon remove small"></i></a></div>
|
||||
<div class="ui message error" v-if="nsNodeUpgradeInfo.count > 0 && teaIsPlus"><a href="/ns/clusters">升级提醒:有 {{nsNodeUpgradeInfo.count}} 个DNS节点需要升级到 v{{nsNodeUpgradeInfo.version}} 版本</a><a href="" title="关闭" @click.prevent="closeMessage"><i class="ui icon remove small"></i></a></div>
|
||||
<div class="ui message error" v-if="authorityNodeUpgradeInfo.count > 0 && teaIsPlus"><a href="/settings/authority/nodes">升级提醒:有 {{authorityNodeUpgradeInfo.count}} 个企业版认证节点需要升级到 v{{authorityNodeUpgradeInfo.version}} 版本</a><a href="" title="关闭" @click.prevent="closeMessage"><i class="ui icon remove small"></i></a></div>
|
||||
|
||||
<!-- 统计图表 -->
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
.access-log-row em {
|
||||
font-style: italic !important;
|
||||
font-size: 1em !important;
|
||||
}
|
||||
/*# sourceMappingURL=index.css.map */
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["index.less"],"names":[],"mappings":"AAAA,eACC;EACC,6BAAA;EACA,yBAAA","file":"index.css"}
|
||||
@@ -0,0 +1,65 @@
|
||||
{$layout}
|
||||
|
||||
{$var "header"}
|
||||
<!-- datepicker -->
|
||||
<script type="text/javascript" src="/js/moment.min.js"></script>
|
||||
<script type="text/javascript" src="/js/pikaday.js"></script>
|
||||
<link rel="stylesheet" href="/js/pikaday.css"/>
|
||||
<link rel="stylesheet" href="/js/pikaday.theme.css"/>
|
||||
<link rel="stylesheet" href="/js/pikaday.triangle.css"/>
|
||||
{$end}
|
||||
|
||||
<first-menu>
|
||||
<div class="item right">
|
||||
<form method="get" class="ui form small" :action="path" autocomplete="off">
|
||||
<div class="ui fields inline">
|
||||
<div class="ui field">
|
||||
<input type="text" name="day" maxlength="10" placeholder="选择日期" style="width:7.8em" id="day-input" v-model="day"/>
|
||||
</div>
|
||||
<div class="ui field">
|
||||
<button class="ui button small" type="submit">查找</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</first-menu>
|
||||
|
||||
<p class="comment" v-if="accessLogs.length == 0">暂时还没有访问日志。</p>
|
||||
|
||||
<table class="ui table selectable" v-if="accessLogs.length > 0">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="two wide">集群</th>
|
||||
<th class="two wide">节点</th>
|
||||
<th class="two wide">域名</th>
|
||||
<th>概要</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<!-- 这里之所以需要添加 :key,是因为要不然不会刷新显示 -->
|
||||
<tr v-for="accessLog in accessLogs" :key="accessLog.requestId">
|
||||
<td>
|
||||
<div v-if="accessLog.node.cluster != null">
|
||||
<link-icon :href="'/ns/clusters/cluster?clusterId=' + accessLog.node.cluster.id">{{accessLog.node.cluster.name}}</link-icon>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<div v-if="accessLog.node != null">
|
||||
<link-icon :href="'/ns/clusters/cluster/node?clusterId=' + accessLog.node.cluster.id + '&nodeId=' + accessLog.node.id">{{accessLog.node.name}}</link-icon>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<div v-if="accessLog.domain != null">
|
||||
<link-icon :href="'/ns/domains/domain?domainId=' + accessLog.domain.id">{{accessLog.domain.name}}</link-icon>
|
||||
</div>
|
||||
</td>
|
||||
<td><ns-access-log-box :v-access-log="accessLog"></ns-access-log-box></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<div v-if="accessLogs.length > 0">
|
||||
<a :href="path + '?requestId=' + lastRequestId + '&day=' + day" v-if="hasPrev">上一页</a>
|
||||
<span v-else class="disabled">上一页</span>
|
||||
<span class="disabled"> | </span>
|
||||
<a :href="path + '?requestId=' + nextRequestId + '&day=' + day" v-if="hasMore">下一页</a>
|
||||
<span v-else class="disabled">下一页</span>
|
||||
</div>
|
||||
@@ -0,0 +1,32 @@
|
||||
Tea.context(function () {
|
||||
let that = this
|
||||
this.accessLogs.forEach(function (accessLog) {
|
||||
// 区域
|
||||
if (typeof (that.regions[accessLog.remoteAddr]) == "string") {
|
||||
accessLog.region = that.regions[accessLog.remoteAddr]
|
||||
} else {
|
||||
accessLog.region = ""
|
||||
}
|
||||
|
||||
// 节点
|
||||
if (typeof (that.nodes[accessLog.nsNodeId]) != "undefined") {
|
||||
accessLog["node"] = that.nodes[accessLog.nsNodeId]
|
||||
} else {
|
||||
accessLog["node"] = null
|
||||
}
|
||||
|
||||
// 域名
|
||||
if (typeof (that.domains[accessLog.nsDomainId]) != "undefined") {
|
||||
accessLog["domain"] = that.domains[accessLog.nsDomainId]
|
||||
} else {
|
||||
accessLog["domain"] = null
|
||||
}
|
||||
})
|
||||
|
||||
this.$delay(function () {
|
||||
let that = this
|
||||
teaweb.datepicker("day-input", function (v) {
|
||||
that.day = v
|
||||
})
|
||||
})
|
||||
})
|
||||
@@ -0,0 +1,6 @@
|
||||
.access-log-row {
|
||||
em {
|
||||
font-style: italic !important;
|
||||
font-size: 1em !important;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
{$layout}
|
||||
{$template "/left_menu"}
|
||||
|
||||
<div class="right-box">
|
||||
<form class="ui form" data-tea-action="$" data-tea-success="success">
|
||||
<csrf-token></csrf-token>
|
||||
<input type="hidden" name="clusterId" :value="clusterId"/>
|
||||
<ns-access-log-ref-box :v-access-log-ref="accessLogRef"></ns-access-log-ref-box>
|
||||
<submit-btn></submit-btn>
|
||||
</form>
|
||||
</div>
|
||||
@@ -0,0 +1,3 @@
|
||||
Tea.context(function () {
|
||||
this.success = NotifyReloadSuccess("保存成功")
|
||||
})
|
||||
Reference in New Issue
Block a user