Vue.component("http-access-log-box", { props: ["v-access-log"], data: function () { return { accessLog: this.vAccessLog } }, methods: { formatCost: function (seconds) { var s = (seconds * 1000).toString(); var pieces = s.split("."); if (pieces.length < 2) { return s; } return pieces[0] + "." + pieces[1].substr(0, 3); }, 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("/servers/server/log/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: `
[{{accessLog.region}}] {{accessLog.remoteAddr}} [{{accessLog.timeLocal}}] "{{accessLog.requestMethod}} {{accessLog.scheme}}://{{accessLog.host}}{{accessLog.requestURI}} {{accessLog.proto}}" {{accessLog.status}} [cached] [waf {{accessLog.attrs['waf.action']}}] - 耗时:{{formatCost(accessLog.requestTime)}} ms  
` })