1.4.5.2
This commit is contained in:
18
EdgeAdmin/web/views/@default/servers/server/boards/index.css
Normal file
18
EdgeAdmin/web/views/@default/servers/server/boards/index.css
Normal file
@@ -0,0 +1,18 @@
|
||||
.chart-box {
|
||||
height: 14em;
|
||||
}
|
||||
.traffic-map-box {
|
||||
height: 16em;
|
||||
}
|
||||
.traffic-map-box div::-webkit-scrollbar {
|
||||
width: 4px;
|
||||
}
|
||||
h4 span {
|
||||
font-size: 0.8em;
|
||||
color: grey;
|
||||
font-weight: normal !important;
|
||||
}
|
||||
.menu .item span.small {
|
||||
font-size: 0.8em;
|
||||
}
|
||||
/*# sourceMappingURL=index.css.map */
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["index.less"],"names":[],"mappings":"AAAA;EACC,YAAA;;AAGD;EACC,YAAA;;AADD,gBAGC,IAAG;EACF,UAAA;;AAIF,EACC;EACC,gBAAA;EACA,WAAA;EACA,8BAAA;;AAIF,KACC,MAAM,KAAI;EACT,gBAAA","file":"index.css"}
|
||||
122
EdgeAdmin/web/views/@default/servers/server/boards/index.html
Normal file
122
EdgeAdmin/web/views/@default/servers/server/boards/index.html
Normal file
@@ -0,0 +1,122 @@
|
||||
{$layout}
|
||||
|
||||
{$var "header"}
|
||||
<!-- world map -->
|
||||
<script type="text/javascript" src="/js/echarts/echarts.min.js"></script>
|
||||
<script type="text/javascript" src="/js/world.js"></script>
|
||||
<script type="text/javascript" src="/js/world-countries-map.js"></script>
|
||||
{$end}
|
||||
|
||||
<first-menu>
|
||||
<menu-item href="/servers">网站列表</menu-item>
|
||||
<span class="item disabled">|</span>
|
||||
<menu-item :href="'/servers/server?serverId=' + server.id" active="true">"{{server.name}}"看板</menu-item>
|
||||
<span class="disabled item">|</span>
|
||||
<more-items-angle
|
||||
:v-data-url="'/servers/nearby?serverId=' + server.id"
|
||||
:v-url="'/servers/server/boards?serverId=${serverId}'"></more-items-angle>
|
||||
</first-menu>
|
||||
|
||||
<!-- 加载中 -->
|
||||
<div style="margin-top: 0.8em">
|
||||
<div class="ui message loading" v-if="isLoading">
|
||||
<div class="ui active inline loader small"></div> 数据加载中...
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 总体统计 -->
|
||||
<columns-grid v-if="!isLoading">
|
||||
<div class="ui column">
|
||||
<h4>上月峰值带宽</h4>
|
||||
<div class="value"><bits-var :v-bits="lastMonthlyPeekBandwidthBits"></bits-var></div>
|
||||
</div>
|
||||
<div class="ui column">
|
||||
<h4>当月峰值带宽</h4>
|
||||
<div class="value"><bits-var :v-bits="monthlyPeekBandwidthBits"></bits-var></div>
|
||||
</div>
|
||||
<div class="ui column">
|
||||
<h4>当天峰值带宽</h4>
|
||||
<div class="value"><bits-var :v-bits="dailyPeekBandwidthBits"></bits-var></div>
|
||||
</div>
|
||||
<div class="ui column">
|
||||
<h4>当前峰值带宽</h4>
|
||||
<div class="value"><bits-var :v-bits="minutelyPeekBandwidthBits"></bits-var></div>
|
||||
</div>
|
||||
<div class="ui column">
|
||||
<h4>当天独立IP</h4>
|
||||
<div class="value">
|
||||
<span v-if="dailyCountIPs > 0">{{dailyCountIPsFormat}}</span>
|
||||
<span v-else class="disabled">尚无数据</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="ui column">
|
||||
<h4>当天流量</h4>
|
||||
<div class="value"><bytes-var :v-bytes="dailyTrafficBytes"></bytes-var></div>
|
||||
</div>
|
||||
</columns-grid>
|
||||
|
||||
<chart-columns-grid>
|
||||
<div class="ui column">
|
||||
<!-- 流量地图 -->
|
||||
<div v-if="!isLoading">
|
||||
<traffic-map-box :v-stats="topCountryStats"></traffic-map-box>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="ui column">
|
||||
<!-- 带宽图表 -->
|
||||
<div class="ui menu text blue" v-show="!isLoading">
|
||||
<a href="" class="item" :class="{active: bandwidthTab == 'minutely'}" @click.prevent="selectBandwidthTab('minutely')">最近带宽<span class="small grey">(比特)</span></a>
|
||||
<a href="" class="item" :class="{active: bandwidthTab == 'hourly'}" @click.prevent="selectBandwidthTab('hourly')">按小时带宽<span class="small grey">(比特)</span></a>
|
||||
<a href="" class="item" :class="{active: bandwidthTab == 'daily'}" @click.prevent="selectBandwidthTab('daily')">按天带宽<span class="small grey">(比特)</span></a>
|
||||
<a :href="'/servers/traffic-stats?serverId=' + server.id" class="item right">更多</a>
|
||||
</div>
|
||||
<div class="ui divider"></div>
|
||||
<div class="chart-box" id="bandwidth-chart"></div>
|
||||
</div>
|
||||
|
||||
<div class="ui column">
|
||||
<!-- 流量图表 -->
|
||||
<div class="ui menu text blue" v-show="!isLoading">
|
||||
<a href="" class="item" :class="{active: trafficTab == 'hourly'}" @click.prevent="selectTrafficTab('hourly')">24小时流量趋势</a>
|
||||
<a href="" class="item" :class="{active: trafficTab == 'daily'}" @click.prevent="selectTrafficTab('daily')">15天流量趋势</a>
|
||||
</div>
|
||||
<div class="ui divider"></div>
|
||||
|
||||
<!-- 按小时统计流量 -->
|
||||
<div class="chart-box" id="hourly-traffic-chart" v-show="trafficTab == 'hourly'"></div>
|
||||
|
||||
<!-- 按日统计流量 -->
|
||||
<div class="chart-box" id="daily-traffic-chart" v-show="trafficTab == 'daily'"></div>
|
||||
</div>
|
||||
|
||||
<div class="ui column">
|
||||
<div class="ui menu text blue" v-show="!isLoading">
|
||||
<a href="" class="item" :class="{active: requestsTab == 'hourly'}" @click.prevent="selectRequestsTab('hourly')">24小时访问量趋势</a>
|
||||
<a href="" class="item" :class="{active: requestsTab == 'daily'}" @click.prevent="selectRequestsTab('daily')">15天访问量趋势</a>
|
||||
</div>
|
||||
<div class="ui divider"></div>
|
||||
|
||||
<!-- 按小时统计访问量 -->
|
||||
<div class="chart-box" id="hourly-requests-chart" v-show="requestsTab == 'hourly'"></div>
|
||||
|
||||
<!-- 按日统计访问量 -->
|
||||
<div class="chart-box" id="daily-requests-chart" v-show="requestsTab == 'daily'"></div>
|
||||
</div>
|
||||
|
||||
<div class="ui column">
|
||||
<!-- 域名排行 -->
|
||||
<h4 v-show="!isLoading">域名访问排行 <span>(24小时)</span></h4>
|
||||
<div class="ui divider"></div>
|
||||
<div class="chart-box" id="top-domains-chart"><loading-message>数据加载中...</loading-message></div>
|
||||
</div>
|
||||
|
||||
<!-- 指标 -->
|
||||
<metric-chart v-for="chart in metricCharts"
|
||||
:key="chart.id"
|
||||
:v-chart="chart.chart"
|
||||
:v-stats="chart.stats"
|
||||
:v-item="chart.item"
|
||||
:v-column="true">
|
||||
</metric-chart>
|
||||
</chart-columns-grid>
|
||||
498
EdgeAdmin/web/views/@default/servers/server/boards/index.js
Normal file
498
EdgeAdmin/web/views/@default/servers/server/boards/index.js
Normal file
@@ -0,0 +1,498 @@
|
||||
Tea.context(function () {
|
||||
this.isLoading = true
|
||||
this.metricCharts = []
|
||||
|
||||
this.formatBytes = teaweb.formatBytes
|
||||
this.dailyCountIPsFormat = "0"
|
||||
|
||||
|
||||
/**
|
||||
* 流量统计
|
||||
*/
|
||||
this.trafficTab = "hourly"
|
||||
|
||||
this.$delay(function () {
|
||||
this.load()
|
||||
})
|
||||
|
||||
this.load = function () {
|
||||
this.$post("$")
|
||||
.params({
|
||||
serverId: this.server.id
|
||||
})
|
||||
.success(function (resp) {
|
||||
for (let k in resp.data) {
|
||||
this[k] = resp.data[k]
|
||||
}
|
||||
this.isLoading = false
|
||||
|
||||
if (this.dailyCountIPs > 0) {
|
||||
this.dailyCountIPsFormat = teaweb.formatNumber(this.dailyCountIPs)
|
||||
}
|
||||
|
||||
this.$delay(function () {
|
||||
this.reloadMinutelyBandwidthChart()
|
||||
this.reloadHourlyTrafficChart()
|
||||
this.reloadHourlyRequestsChart()
|
||||
})
|
||||
|
||||
// 域名统计
|
||||
this.$post(".domainStats")
|
||||
.params({
|
||||
serverId: this.server.id
|
||||
})
|
||||
.success(function (resp) {
|
||||
for (let k in resp.data) {
|
||||
this[k] = resp.data[k]
|
||||
}
|
||||
this.reloadTopDomainsChart()
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
this.bandwidthTab = "minutely"
|
||||
this.hourlyBandwidthStats = []
|
||||
this.dailyBandwidthStats = []
|
||||
|
||||
this.selectBandwidthTab = function (tab) {
|
||||
this.bandwidthTab = tab
|
||||
switch (tab) {
|
||||
case "minutely":
|
||||
this.reloadMinutelyBandwidthChart()
|
||||
break
|
||||
case "hourly":
|
||||
this.$post(".hourlyBandwidth")
|
||||
.params({
|
||||
serverId: this.serverId
|
||||
})
|
||||
.success(function (response) {
|
||||
this.hourlyBandwidthStats = response.data.stats
|
||||
this.reloadHourlyBandwidthChart(response.data.percentile, response.data.percentileBits)
|
||||
})
|
||||
break
|
||||
case "daily":
|
||||
this.$post(".dailyBandwidth")
|
||||
.params({
|
||||
serverId: this.serverId
|
||||
})
|
||||
.success(function (response) {
|
||||
this.dailyBandwidthStats = response.data.stats
|
||||
this.reloadDailyBandwidthChart(response.data.percentile, response.data.percentileBits)
|
||||
})
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
this.reloadMinutelyBandwidthChart = function () {
|
||||
let axis = teaweb.bitsAxis(this.bandwidthStats, function (stat) {
|
||||
return stat.bits
|
||||
})
|
||||
teaweb.renderLineChart({
|
||||
id: "bandwidth-chart",
|
||||
values: this.bandwidthStats,
|
||||
axis: axis,
|
||||
x: function (stat) {
|
||||
return stat.timeAt
|
||||
},
|
||||
value: function (stat) {
|
||||
return stat.bits / axis.divider
|
||||
},
|
||||
tooltip: function (args, values) {
|
||||
if (args.componentType == "markLine") {
|
||||
return args.name
|
||||
}
|
||||
let index = args.dataIndex
|
||||
let day = values[index].day
|
||||
return day.substr(0, 4) + "-" + day.substr(4, 2) + "-" + day.substr(6, 2) + " " + values[index].timeAt + "<br/>峰值带宽:" + teaweb.formatBits(values[index].bits)
|
||||
},
|
||||
markLine: {
|
||||
precision: 4,
|
||||
data: [{
|
||||
name: this.bandwidthPercentile + "th",
|
||||
yAxis: this.bandwidthPercentileBits/axis.divider
|
||||
}],
|
||||
symbol: "none",
|
||||
lineStyle: {
|
||||
color: teaweb.chartColor("red")
|
||||
}
|
||||
},
|
||||
left: 30,
|
||||
right: 40
|
||||
})
|
||||
}
|
||||
|
||||
this.reloadHourlyBandwidthChart = function (percentile, percentileBits) {
|
||||
let axis = teaweb.bitsAxis(this.hourlyBandwidthStats, function (stat) {
|
||||
return stat.bits
|
||||
})
|
||||
teaweb.renderLineChart({
|
||||
id: "bandwidth-chart",
|
||||
values: this.hourlyBandwidthStats,
|
||||
axis: axis,
|
||||
x: function (stat) {
|
||||
return stat.hour
|
||||
},
|
||||
value: function (stat) {
|
||||
return stat.bits / axis.divider
|
||||
},
|
||||
tooltip: function (args, values) {
|
||||
if (args.componentType == "markLine") {
|
||||
return args.name
|
||||
}
|
||||
let index = args.dataIndex
|
||||
let day = values[index].day
|
||||
return day.substr(0, 4) + "-" + day.substr(4, 2) + "-" + day.substr(6, 2) + " " + values[index].hour + "时<br/>峰值带宽:" + teaweb.formatBits(values[index].bits)
|
||||
},
|
||||
markLine: {
|
||||
precision: 4,
|
||||
data: [{
|
||||
name: percentile + "th",
|
||||
yAxis: percentileBits/axis.divider
|
||||
}],
|
||||
symbol: "none",
|
||||
lineStyle: {
|
||||
color: teaweb.chartColor("red")
|
||||
}
|
||||
},
|
||||
left: 30,
|
||||
right: 40
|
||||
})
|
||||
}
|
||||
|
||||
this.reloadDailyBandwidthChart = function (percentile, percentileBits) {
|
||||
let axis = teaweb.bitsAxis(this.dailyBandwidthStats, function (stat) {
|
||||
return stat.bits
|
||||
})
|
||||
teaweb.renderLineChart({
|
||||
id: "bandwidth-chart",
|
||||
values: this.dailyBandwidthStats,
|
||||
axis: axis,
|
||||
x: function (stat) {
|
||||
let day = stat.day
|
||||
return day.substr(4, 2) + "-" + day.substr(6, 2)
|
||||
},
|
||||
value: function (stat) {
|
||||
return stat.bits / axis.divider
|
||||
},
|
||||
tooltip: function (args, values) {
|
||||
if (args.componentType == "markLine") {
|
||||
return args.name
|
||||
}
|
||||
let index = args.dataIndex
|
||||
let day = values[index].day
|
||||
return day.substr(0, 4) + "-" + day.substr(4, 2) + "-" + day.substr(6, 2) + "<br/>峰值带宽:" + teaweb.formatBits(values[index].bits)
|
||||
},
|
||||
markLine: {
|
||||
precision: 4,
|
||||
data: [{
|
||||
name: percentile + "th",
|
||||
yAxis: percentileBits/axis.divider
|
||||
}],
|
||||
symbol: "none",
|
||||
lineStyle: {
|
||||
color: teaweb.chartColor("red")
|
||||
}
|
||||
},
|
||||
left: 30,
|
||||
right: 40
|
||||
})
|
||||
}
|
||||
|
||||
this.selectTrafficTab = function (tab) {
|
||||
this.trafficTab = tab
|
||||
if (tab == "hourly") {
|
||||
this.$delay(function () {
|
||||
this.reloadHourlyTrafficChart()
|
||||
})
|
||||
} else if (tab == "daily") {
|
||||
this.$delay(function () {
|
||||
this.reloadDailyTrafficChart()
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
this.reloadHourlyTrafficChart = function () {
|
||||
let stats = this.hourlyStats
|
||||
this.reloadTrafficChart("hourly-traffic-chart", "流量统计", stats, function (args) {
|
||||
let index = args.dataIndex
|
||||
let cachedRatio = 0
|
||||
let attackRatio = 0
|
||||
if (stats[index].bytes > 0) {
|
||||
cachedRatio = Math.round(stats[index].cachedBytes * 10000 / stats[index].bytes) / 100
|
||||
attackRatio = Math.round(stats[index].attackBytes * 10000 / stats[index].bytes) / 100
|
||||
}
|
||||
|
||||
return stats[index].day + " " + stats[index].hour + "时<br/>总流量:" + teaweb.formatBytes(stats[index].bytes) + "<br/>缓存流量:" + teaweb.formatBytes(stats[index].cachedBytes) + "<br/>缓存命中率:" + cachedRatio + "%<br/>拦截攻击流量:" + teaweb.formatBytes(stats[index].attackBytes) + "<br/>拦截比例:" + attackRatio + "%"
|
||||
})
|
||||
}
|
||||
|
||||
this.reloadDailyTrafficChart = function () {
|
||||
let stats = this.dailyStats
|
||||
this.reloadTrafficChart("daily-traffic-chart", "流量统计", stats, function (args) {
|
||||
let index = args.dataIndex
|
||||
let cachedRatio = 0
|
||||
let attackRatio = 0
|
||||
if (stats[index].bytes > 0) {
|
||||
cachedRatio = Math.round(stats[index].cachedBytes * 10000 / stats[index].bytes) / 100
|
||||
attackRatio = Math.round(stats[index].attackBytes * 10000 / stats[index].bytes) / 100
|
||||
}
|
||||
|
||||
return stats[index].day + "<br/>总流量:" + teaweb.formatBytes(stats[index].bytes) + "<br/>缓存流量:" + teaweb.formatBytes(stats[index].cachedBytes) + "<br/>缓存命中率:" + cachedRatio + "%<br/>拦截攻击流量:" + teaweb.formatBytes(stats[index].attackBytes) + "<br/>拦截比例:" + attackRatio + "%"
|
||||
})
|
||||
}
|
||||
|
||||
this.reloadTrafficChart = function (chartId, name, stats, tooltipFunc) {
|
||||
let chartBox = document.getElementById(chartId)
|
||||
if (chartBox == null) {
|
||||
return
|
||||
}
|
||||
|
||||
let axis = teaweb.bytesAxis(stats, function (v) {
|
||||
return Math.max(v.bytes, v.cachedBytes)
|
||||
})
|
||||
|
||||
let chart = teaweb.initChart(chartBox)
|
||||
let option = {
|
||||
xAxis: {
|
||||
data: stats.map(function (v) {
|
||||
if (v.hour != null) {
|
||||
return v.hour
|
||||
}
|
||||
return v.day
|
||||
})
|
||||
},
|
||||
yAxis: {
|
||||
axisLabel: {
|
||||
formatter: function (value) {
|
||||
return value + axis.unit
|
||||
}
|
||||
}
|
||||
},
|
||||
tooltip: {
|
||||
show: true,
|
||||
trigger: "item",
|
||||
formatter: tooltipFunc
|
||||
},
|
||||
grid: {
|
||||
left: 50,
|
||||
top: 40,
|
||||
right: 20,
|
||||
bottom: 20
|
||||
},
|
||||
series: [
|
||||
{
|
||||
name: "流量",
|
||||
type: "line",
|
||||
data: stats.map(function (v) {
|
||||
return v.bytes / axis.divider
|
||||
}),
|
||||
itemStyle: {
|
||||
color: teaweb.DefaultChartColor
|
||||
},
|
||||
areaStyle: {
|
||||
color: teaweb.DefaultChartColor
|
||||
},
|
||||
smooth: true
|
||||
},
|
||||
{
|
||||
name: "缓存流量",
|
||||
type: "line",
|
||||
data: stats.map(function (v) {
|
||||
return v.cachedBytes / axis.divider
|
||||
}),
|
||||
itemStyle: {
|
||||
color: "#61A0A8"
|
||||
},
|
||||
areaStyle: {
|
||||
color: "#61A0A8"
|
||||
},
|
||||
smooth: true
|
||||
},
|
||||
{
|
||||
name: "攻击流量",
|
||||
type: "line",
|
||||
data: stats.map(function (v) {
|
||||
return v.attackBytes / axis.divider;
|
||||
}),
|
||||
itemStyle: {
|
||||
color: "#F39494"
|
||||
},
|
||||
areaStyle: {
|
||||
color: "#F39494"
|
||||
},
|
||||
smooth: true
|
||||
}
|
||||
],
|
||||
legend: {
|
||||
data: ["流量", "缓存流量", "攻击流量"]
|
||||
},
|
||||
animation: true
|
||||
}
|
||||
chart.setOption(option)
|
||||
chart.resize()
|
||||
}
|
||||
|
||||
/**
|
||||
* 请求数统计
|
||||
*/
|
||||
this.requestsTab = "hourly"
|
||||
|
||||
this.selectRequestsTab = function (tab) {
|
||||
this.requestsTab = tab
|
||||
if (tab == "hourly") {
|
||||
this.$delay(function () {
|
||||
this.reloadHourlyRequestsChart()
|
||||
})
|
||||
} else if (tab == "daily") {
|
||||
this.$delay(function () {
|
||||
this.reloadDailyRequestsChart()
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
this.reloadHourlyRequestsChart = function () {
|
||||
let stats = this.hourlyStats
|
||||
this.reloadRequestsChart("hourly-requests-chart", "请求数统计", stats, function (args) {
|
||||
let index = args.dataIndex
|
||||
let cachedRatio = 0
|
||||
let attackRatio = 0
|
||||
if (stats[index].countRequests > 0) {
|
||||
cachedRatio = Math.round(stats[index].countCachedRequests * 10000 / stats[index].countRequests) / 100
|
||||
attackRatio = Math.round(stats[index].countAttackRequests * 10000 / stats[index].countRequests) / 100
|
||||
}
|
||||
|
||||
return stats[index].day + " " + stats[index].hour + "时<br/>总请求数:" + teaweb.formatNumber(stats[index].countRequests) + "<br/>缓存请求数:" + teaweb.formatNumber(stats[index].countCachedRequests) + "<br/>缓存命中率:" + cachedRatio + "%<br/>拦截攻击数:" + teaweb.formatNumber(stats[index].countAttackRequests) + "<br/>拦截比例:" + attackRatio + "%"
|
||||
})
|
||||
}
|
||||
|
||||
this.reloadDailyRequestsChart = function () {
|
||||
let stats = this.dailyStats
|
||||
this.reloadRequestsChart("daily-requests-chart", "请求数统计", stats, function (args) {
|
||||
let index = args.dataIndex
|
||||
let cachedRatio = 0
|
||||
let attackRatio = 0
|
||||
if (stats[index].countRequests > 0) {
|
||||
cachedRatio = Math.round(stats[index].countCachedRequests * 10000 / stats[index].countRequests) / 100
|
||||
attackRatio = Math.round(stats[index].countAttackRequests * 10000 / stats[index].countRequests) / 100
|
||||
}
|
||||
|
||||
return stats[index].day + "<br/>总请求数:" + teaweb.formatNumber(stats[index].countRequests) + "<br/>缓存请求数:" + teaweb.formatNumber(stats[index].countCachedRequests) + "<br/>缓存命中率:" + cachedRatio + "%<br/>拦截攻击数:" + teaweb.formatNumber(stats[index].countAttackRequests) + "<br/>拦截比例:" + attackRatio + "%"
|
||||
})
|
||||
}
|
||||
|
||||
this.reloadRequestsChart = function (chartId, name, stats, tooltipFunc) {
|
||||
let chartBox = document.getElementById(chartId)
|
||||
if (chartBox == null) {
|
||||
return
|
||||
}
|
||||
|
||||
let axis = teaweb.countAxis(stats, function (v) {
|
||||
return Math.max(v.countRequests, v.countCachedRequests)
|
||||
})
|
||||
|
||||
let chart = teaweb.initChart(chartBox)
|
||||
let option = {
|
||||
xAxis: {
|
||||
data: stats.map(function (v) {
|
||||
if (v.hour != null) {
|
||||
return v.hour
|
||||
}
|
||||
if (v.day != null) {
|
||||
return v.day
|
||||
}
|
||||
return ""
|
||||
})
|
||||
},
|
||||
yAxis: {
|
||||
axisLabel: {
|
||||
formatter: function (value) {
|
||||
return value + axis.unit
|
||||
}
|
||||
}
|
||||
},
|
||||
tooltip: {
|
||||
show: true,
|
||||
trigger: "item",
|
||||
formatter: tooltipFunc
|
||||
},
|
||||
grid: {
|
||||
left: 50,
|
||||
top: 40,
|
||||
right: 20,
|
||||
bottom: 20
|
||||
},
|
||||
series: [
|
||||
{
|
||||
name: "请求数",
|
||||
type: "line",
|
||||
data: stats.map(function (v) {
|
||||
return v.countRequests / axis.divider
|
||||
}),
|
||||
itemStyle: {
|
||||
color: teaweb.DefaultChartColor
|
||||
},
|
||||
areaStyle: {
|
||||
color: teaweb.DefaultChartColor
|
||||
},
|
||||
smooth: true
|
||||
},
|
||||
{
|
||||
name: "缓存请求数",
|
||||
type: "line",
|
||||
data: stats.map(function (v) {
|
||||
return v.countCachedRequests / axis.divider
|
||||
}),
|
||||
itemStyle: {
|
||||
color: "#61A0A8"
|
||||
},
|
||||
areaStyle: {
|
||||
color: "#61A0A8"
|
||||
},
|
||||
smooth: true
|
||||
},
|
||||
{
|
||||
name: "攻击请求数",
|
||||
type: "line",
|
||||
data: stats.map(function (v) {
|
||||
return v.countAttackRequests / axis.divider;
|
||||
}),
|
||||
itemStyle: {
|
||||
color: "#F39494"
|
||||
},
|
||||
areaStyle: {
|
||||
color: "#F39494"
|
||||
},
|
||||
smooth: true
|
||||
}
|
||||
],
|
||||
legend: {
|
||||
data: ["请求数", "缓存请求数", "攻击请求数"]
|
||||
},
|
||||
animation: true
|
||||
}
|
||||
chart.setOption(option)
|
||||
chart.resize()
|
||||
}
|
||||
|
||||
// 域名排行
|
||||
this.reloadTopDomainsChart = function () {
|
||||
let axis = teaweb.countAxis(this.topDomainStats, function (v) {
|
||||
return v.countRequests
|
||||
})
|
||||
teaweb.renderBarChart({
|
||||
id: "top-domains-chart",
|
||||
name: "域名",
|
||||
values: this.topDomainStats,
|
||||
x: function (v) {
|
||||
return v.domain
|
||||
},
|
||||
tooltip: function (args, stats) {
|
||||
return stats[args.dataIndex].domain + "<br/>请求数:" + " " + teaweb.formatNumber(stats[args.dataIndex].countRequests) + "<br/>流量:" + teaweb.formatBytes(stats[args.dataIndex].bytes)
|
||||
},
|
||||
value: function (v) {
|
||||
return v.countRequests / axis.divider;
|
||||
},
|
||||
axis: axis
|
||||
})
|
||||
}
|
||||
})
|
||||
@@ -0,0 +1,25 @@
|
||||
.chart-box {
|
||||
height: 14em;
|
||||
}
|
||||
|
||||
.traffic-map-box {
|
||||
height: 16em;
|
||||
|
||||
div::-webkit-scrollbar {
|
||||
width: 4px;
|
||||
}
|
||||
}
|
||||
|
||||
h4 {
|
||||
span {
|
||||
font-size: 0.8em;
|
||||
color: grey;
|
||||
font-weight: normal !important;
|
||||
}
|
||||
}
|
||||
|
||||
.menu {
|
||||
.item span.small {
|
||||
font-size: 0.8em;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user