Initial commit (code only without large binaries)
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
.chart-box {
|
||||
height: 20em;
|
||||
}
|
||||
/*# sourceMappingURL=clients.css.map */
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["clients.less"],"names":[],"mappings":"AAAA;EACC,YAAA","file":"clients.css"}
|
||||
21
EdgeUser/web/views/@default/servers/server/stat/clients.html
Normal file
21
EdgeUser/web/views/@default/servers/server/stat/clients.html
Normal file
@@ -0,0 +1,21 @@
|
||||
{$layout}
|
||||
|
||||
{$var "header"}
|
||||
<!-- echart -->
|
||||
<script type="text/javascript" src="/js/echarts/echarts.min.js"></script>
|
||||
{$end}
|
||||
|
||||
{$template "/left_menu"}
|
||||
<div class="right-box">
|
||||
{$ if eq .statIsOn false}
|
||||
<p class="ui message">
|
||||
要想查看统计数据,需要先开启统计功能,<a :href="'/servers/server/settings/stat?serverId=' + serverId">[点击这里]</a>修改配置。
|
||||
</p>
|
||||
{$else}
|
||||
<h4>操作系统排行</h4>
|
||||
<div class="chart-box" id="system-chart"></div>
|
||||
|
||||
<h4>浏览器排行</h4>
|
||||
<div class="chart-box" id="browser-chart"></div>
|
||||
{$end}
|
||||
</div>
|
||||
111
EdgeUser/web/views/@default/servers/server/stat/clients.js
Normal file
111
EdgeUser/web/views/@default/servers/server/stat/clients.js
Normal file
@@ -0,0 +1,111 @@
|
||||
Tea.context(function () {
|
||||
this.$delay(function () {
|
||||
let that = this
|
||||
|
||||
let systemUnit = this.processMaxUnit(this.systemStats)
|
||||
this.reloadChart("system-chart", "操作系统", this.systemStats, function (v) {
|
||||
return v.system.name
|
||||
}, function (args) {
|
||||
return that.systemStats[args.dataIndex].system.name + ": " + teaweb.formatNumber(that.systemStats[args.dataIndex].rawCount)
|
||||
}, systemUnit)
|
||||
window.addEventListener("resize", function () {
|
||||
that.resizeChart("system-chart")
|
||||
})
|
||||
|
||||
let browserUnit = this.processMaxUnit(this.browserStats)
|
||||
this.reloadChart("browser-chart", "浏览器", this.browserStats, function (v) {
|
||||
return v.browser.name
|
||||
}, function (args) {
|
||||
return that.browserStats[args.dataIndex].browser.name + ": " + teaweb.formatNumber(that.browserStats[args.dataIndex].rawCount)
|
||||
}, browserUnit)
|
||||
|
||||
window.addEventListener("resize", function () {
|
||||
that.resizeChart("system-chart")
|
||||
that.resizeChart("browser-chart")
|
||||
})
|
||||
})
|
||||
|
||||
this.reloadChart = function (chartId, name, stats, xFunc, tooltipFunc, unit) {
|
||||
let chartBox = document.getElementById(chartId)
|
||||
if (chartBox == null) {
|
||||
return
|
||||
}
|
||||
let chart = echarts.init(chartBox)
|
||||
let option = {
|
||||
xAxis: {
|
||||
data: stats.map(xFunc),
|
||||
axisLabel: {
|
||||
interval: 0
|
||||
}
|
||||
},
|
||||
yAxis: {
|
||||
axisLabel: {
|
||||
formatter: function (value) {
|
||||
return value + unit
|
||||
}
|
||||
}
|
||||
},
|
||||
tooltip: {
|
||||
show: true,
|
||||
trigger: "item",
|
||||
formatter: tooltipFunc
|
||||
},
|
||||
grid: {
|
||||
left: 40,
|
||||
top: 10,
|
||||
right: 20,
|
||||
bottom: 20
|
||||
},
|
||||
series: [
|
||||
{
|
||||
name: name,
|
||||
type: "bar",
|
||||
data: stats.map(function (v) {
|
||||
return v.count;
|
||||
}),
|
||||
itemStyle: {
|
||||
color: "#9DD3E8"
|
||||
},
|
||||
barWidth: "20em"
|
||||
}
|
||||
],
|
||||
animation: true
|
||||
}
|
||||
chart.setOption(option)
|
||||
chart.resize()
|
||||
}
|
||||
|
||||
this.resizeChart = function (chartId) {
|
||||
let chartBox = document.getElementById(chartId)
|
||||
if (chartBox == null) {
|
||||
return
|
||||
}
|
||||
let chart = echarts.init(chartBox)
|
||||
chart.resize()
|
||||
}
|
||||
|
||||
this.processMaxUnit = function (stats) {
|
||||
let max = stats.$map(function (k, v) {
|
||||
return v.count
|
||||
}).$max()
|
||||
let divider = 0
|
||||
let unit = ""
|
||||
if (max >= 1000 * 1000 * 1000) {
|
||||
unit = "B"
|
||||
divider = 1000 * 1000 * 1000
|
||||
} else if (max >= 1000 * 1000) {
|
||||
unit = "M"
|
||||
divider = 1000 * 1000
|
||||
} else if (max >= 1000) {
|
||||
unit = "K"
|
||||
divider = 1000
|
||||
}
|
||||
stats.forEach(function (v) {
|
||||
v.rawCount = v.count
|
||||
if (divider > 0) {
|
||||
v.count /= divider
|
||||
}
|
||||
})
|
||||
return unit
|
||||
}
|
||||
})
|
||||
@@ -0,0 +1,3 @@
|
||||
.chart-box {
|
||||
height: 20em;
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
.chart-box {
|
||||
height: 20em;
|
||||
}
|
||||
/*# sourceMappingURL=index.css.map */
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["index.less"],"names":[],"mappings":"AAAA;EACC,YAAA","file":"index.css"}
|
||||
30
EdgeUser/web/views/@default/servers/server/stat/index.html
Normal file
30
EdgeUser/web/views/@default/servers/server/stat/index.html
Normal file
@@ -0,0 +1,30 @@
|
||||
{$layout}
|
||||
|
||||
{$var "header"}
|
||||
<!-- echart -->
|
||||
<script type="text/javascript" src="/js/echarts/echarts.min.js"></script>
|
||||
{$end}
|
||||
|
||||
{$template "/left_menu"}
|
||||
<div class="right-box">
|
||||
{$ if eq .statIsOn false}
|
||||
<p class="ui message">
|
||||
要想查看统计数据,需要先开启统计功能,<a :href="'/servers/server/settings/stat?serverId=' + serverId">[点击这里]</a>修改配置。
|
||||
</p>
|
||||
{$else}
|
||||
<h4>地区排行</h4>
|
||||
<div class="chart-box" id="country-chart">
|
||||
|
||||
</div>
|
||||
|
||||
<h4>省市排行</h4>
|
||||
<div class="chart-box" id="province-chart">
|
||||
|
||||
</div>
|
||||
|
||||
<h4>城市排行</h4>
|
||||
<div class="chart-box" id="city-chart">
|
||||
|
||||
</div>
|
||||
{$end}
|
||||
</div>
|
||||
116
EdgeUser/web/views/@default/servers/server/stat/index.js
Normal file
116
EdgeUser/web/views/@default/servers/server/stat/index.js
Normal file
@@ -0,0 +1,116 @@
|
||||
Tea.context(function () {
|
||||
this.$delay(function () {
|
||||
let that = this
|
||||
|
||||
let countryUnit = this.processMaxUnit(this.countryStats)
|
||||
this.reloadChart("country-chart", "地区", this.countryStats, function (v) {
|
||||
return v.country.name
|
||||
}, function (args) {
|
||||
return that.countryStats[args.dataIndex].country.name + ": " + teaweb.formatNumber(that.countryStats[args.dataIndex].rawCount)
|
||||
}, countryUnit)
|
||||
|
||||
let provinceUnit = this.processMaxUnit(this.provinceStats)
|
||||
this.reloadChart("province-chart", "省市", this.provinceStats, function (v) {
|
||||
return v.province.name
|
||||
}, function (args) {
|
||||
return that.provinceStats[args.dataIndex].country.name + ": " + that.provinceStats[args.dataIndex].province.name + " " + teaweb.formatNumber(that.provinceStats[args.dataIndex].rawCount)
|
||||
}, provinceUnit)
|
||||
|
||||
let cityUnit = this.processMaxUnit(this.cityStats)
|
||||
this.reloadChart("city-chart", "城市", this.cityStats, function (v) {
|
||||
return v.city.name
|
||||
}, function (args) {
|
||||
return that.cityStats[args.dataIndex].country.name + ": " + that.cityStats[args.dataIndex].province.name + " " + that.cityStats[args.dataIndex].city.name + " " + teaweb.formatNumber(that.cityStats[args.dataIndex].rawCount)
|
||||
}, cityUnit)
|
||||
|
||||
window.addEventListener("resize", function () {
|
||||
that.resizeChart("country-chart")
|
||||
that.resizeChart("province-chart")
|
||||
that.resizeChart("city-chart")
|
||||
})
|
||||
})
|
||||
|
||||
this.reloadChart = function (chartId, name, stats, xFunc, tooltipFunc, unit) {
|
||||
let chartBox = document.getElementById(chartId)
|
||||
if (chartBox == null) {
|
||||
return
|
||||
}
|
||||
let chart = echarts.init(chartBox)
|
||||
let option = {
|
||||
xAxis: {
|
||||
data: stats.map(xFunc),
|
||||
axisLabel: {
|
||||
interval: 0
|
||||
}
|
||||
},
|
||||
yAxis: {
|
||||
axisLabel: {
|
||||
formatter: function (value) {
|
||||
return value + unit
|
||||
}
|
||||
}
|
||||
},
|
||||
tooltip: {
|
||||
show: true,
|
||||
trigger: "item",
|
||||
formatter: tooltipFunc
|
||||
},
|
||||
grid: {
|
||||
left: 40,
|
||||
top: 10,
|
||||
right: 20,
|
||||
bottom: 20
|
||||
},
|
||||
series: [
|
||||
{
|
||||
name: name,
|
||||
type: "bar",
|
||||
data: stats.map(function (v) {
|
||||
return v.count;
|
||||
}),
|
||||
itemStyle: {
|
||||
color: "#9DD3E8"
|
||||
},
|
||||
barWidth: "20em"
|
||||
}
|
||||
],
|
||||
animation: true
|
||||
}
|
||||
chart.setOption(option)
|
||||
chart.resize()
|
||||
}
|
||||
|
||||
this.resizeChart = function (chartId) {
|
||||
let chartBox = document.getElementById(chartId)
|
||||
if (chartBox == null) {
|
||||
return
|
||||
}
|
||||
let chart = echarts.init(chartBox)
|
||||
chart.resize()
|
||||
}
|
||||
|
||||
this.processMaxUnit = function (stats) {
|
||||
let max = stats.$map(function (k, v) {
|
||||
return v.count
|
||||
}).$max()
|
||||
let divider = 0
|
||||
let unit = ""
|
||||
if (max >= 1000 * 1000 * 1000) {
|
||||
unit = "B"
|
||||
divider = 1000 * 1000 * 1000
|
||||
} else if (max >= 1000 * 1000) {
|
||||
unit = "M"
|
||||
divider = 1000 * 1000
|
||||
} else if (max >= 1000) {
|
||||
unit = "K"
|
||||
divider = 1000
|
||||
}
|
||||
stats.forEach(function (v) {
|
||||
v.rawCount = v.count
|
||||
if (divider > 0) {
|
||||
v.count /= divider
|
||||
}
|
||||
})
|
||||
return unit
|
||||
}
|
||||
})
|
||||
@@ -0,0 +1,3 @@
|
||||
.chart-box {
|
||||
height: 20em;
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
.chart-box {
|
||||
height: 20em;
|
||||
}
|
||||
/*# sourceMappingURL=providers.css.map */
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["providers.less"],"names":[],"mappings":"AAAA;EACC,YAAA","file":"providers.css"}
|
||||
@@ -0,0 +1,18 @@
|
||||
{$layout}
|
||||
|
||||
{$var "header"}
|
||||
<!-- echart -->
|
||||
<script type="text/javascript" src="/js/echarts/echarts.min.js"></script>
|
||||
{$end}
|
||||
|
||||
{$template "/left_menu"}
|
||||
<div class="right-box">
|
||||
{$ if eq .statIsOn false}
|
||||
<p class="ui message">
|
||||
要想查看统计数据,需要先开启统计功能,<a :href="'/servers/server/settings/stat?serverId=' + serverId">[点击这里]</a>修改配置。
|
||||
</p>
|
||||
{$else}
|
||||
<h4>运营商排行</h4>
|
||||
<div class="chart-box" id="provider-chart"></div>
|
||||
{$end}
|
||||
</div>
|
||||
99
EdgeUser/web/views/@default/servers/server/stat/providers.js
Normal file
99
EdgeUser/web/views/@default/servers/server/stat/providers.js
Normal file
@@ -0,0 +1,99 @@
|
||||
Tea.context(function () {
|
||||
this.$delay(function () {
|
||||
let that = this
|
||||
|
||||
let providerUnit = this.processMaxUnit(this.providerStats)
|
||||
this.reloadChart("provider-chart", "运营商", this.providerStats, function (v) {
|
||||
return v.provider.name
|
||||
}, function (args) {
|
||||
return that.providerStats[args.dataIndex].provider.name + ": " + teaweb.formatNumber(that.providerStats[args.dataIndex].rawCount)
|
||||
}, providerUnit)
|
||||
window.addEventListener("resize", function () {
|
||||
that.resizeChart("provider-chart")
|
||||
})
|
||||
})
|
||||
|
||||
this.reloadChart = function (chartId, name, stats, xFunc, tooltipFunc, unit) {
|
||||
let chartBox = document.getElementById(chartId)
|
||||
if (chartBox == null) {
|
||||
return
|
||||
}
|
||||
let chart = echarts.init(chartBox)
|
||||
let option = {
|
||||
xAxis: {
|
||||
data: stats.map(xFunc),
|
||||
axisLabel: {
|
||||
interval: 0
|
||||
}
|
||||
},
|
||||
yAxis: {
|
||||
axisLabel: {
|
||||
formatter: function (value) {
|
||||
return value + unit
|
||||
}
|
||||
}
|
||||
},
|
||||
tooltip: {
|
||||
show: true,
|
||||
trigger: "item",
|
||||
formatter: tooltipFunc
|
||||
},
|
||||
grid: {
|
||||
left: 40,
|
||||
top: 10,
|
||||
right: 20,
|
||||
bottom: 20
|
||||
},
|
||||
series: [
|
||||
{
|
||||
name: name,
|
||||
type: "bar",
|
||||
data: stats.map(function (v) {
|
||||
return v.count;
|
||||
}),
|
||||
itemStyle: {
|
||||
color: "#9DD3E8"
|
||||
},
|
||||
barWidth: "20em"
|
||||
}
|
||||
],
|
||||
animation: true
|
||||
}
|
||||
chart.setOption(option)
|
||||
chart.resize()
|
||||
}
|
||||
|
||||
this.resizeChart = function (chartId) {
|
||||
let chartBox = document.getElementById(chartId)
|
||||
if (chartBox == null) {
|
||||
return
|
||||
}
|
||||
let chart = echarts.init(chartBox)
|
||||
chart.resize()
|
||||
}
|
||||
|
||||
this.processMaxUnit = function (stats) {
|
||||
let max = stats.$map(function (k, v) {
|
||||
return v.count
|
||||
}).$max()
|
||||
let divider = 0
|
||||
let unit = ""
|
||||
if (max >= 1000 * 1000 * 1000) {
|
||||
unit = "B"
|
||||
divider = 1000 * 1000 * 1000
|
||||
} else if (max >= 1000 * 1000) {
|
||||
unit = "M"
|
||||
divider = 1000 * 1000
|
||||
} else if (max >= 1000) {
|
||||
unit = "K"
|
||||
divider = 1000
|
||||
}
|
||||
stats.forEach(function (v) {
|
||||
v.rawCount = v.count
|
||||
if (divider > 0) {
|
||||
v.count /= divider
|
||||
}
|
||||
})
|
||||
return unit
|
||||
}
|
||||
})
|
||||
@@ -0,0 +1,3 @@
|
||||
.chart-box {
|
||||
height: 20em;
|
||||
}
|
||||
26
EdgeUser/web/views/@default/servers/server/stat/waf.css
Normal file
26
EdgeUser/web/views/@default/servers/server/stat/waf.css
Normal file
@@ -0,0 +1,26 @@
|
||||
.grid {
|
||||
margin-top: 2em !important;
|
||||
margin-left: 2em !important;
|
||||
}
|
||||
.grid .column {
|
||||
margin-bottom: 2em;
|
||||
border-right: 1px #eee solid;
|
||||
}
|
||||
.grid .column div.value {
|
||||
margin-top: 1.5em;
|
||||
}
|
||||
.grid .column div.value span {
|
||||
font-size: 2em;
|
||||
margin-right: 0.2em;
|
||||
}
|
||||
.grid .column.no-border {
|
||||
border-right: 0;
|
||||
}
|
||||
.chart-box {
|
||||
height: 20em;
|
||||
}
|
||||
h4 .color-span {
|
||||
font-size: 0.6em;
|
||||
padding: 2px 4px;
|
||||
}
|
||||
/*# sourceMappingURL=waf.css.map */
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["waf.less"],"names":[],"mappings":"AAAA;EACC,0BAAA;EACA,2BAAA;;AAFD,KAIC;EACC,kBAAA;EACA,4BAAA;;AANF,KAIC,QAIC,IAAG;EACF,iBAAA;;AATH,KAIC,QAIC,IAAG,MAGF;EACC,cAAA;EACA,mBAAA;;AAbJ,KAkBC,QAAO;EACN,eAAA;;AAIF;EACC,YAAA;;AAGD,EAAG;EACF,gBAAA;EACA,gBAAA","file":"waf.css"}
|
||||
47
EdgeUser/web/views/@default/servers/server/stat/waf.html
Normal file
47
EdgeUser/web/views/@default/servers/server/stat/waf.html
Normal file
@@ -0,0 +1,47 @@
|
||||
{$layout}
|
||||
|
||||
{$var "header"}
|
||||
<!-- echart -->
|
||||
<script type="text/javascript" src="/js/echarts/echarts.min.js"></script>
|
||||
{$end}
|
||||
|
||||
{$template "/left_menu"}
|
||||
<div class="right-box">
|
||||
<div class="ui three columns grid">
|
||||
<div class="ui column">
|
||||
<h4>今日拦截</h4>
|
||||
<div class="value"><span>{{countDailyBlock}}</span>次</div>
|
||||
</div>
|
||||
|
||||
<div class="ui column">
|
||||
<h4>今日验证码验证</h4>
|
||||
<div class="value"><span>{{countDailyCaptcha}}</span>次</div>
|
||||
</div>
|
||||
|
||||
<div class="ui column no-border">
|
||||
<h4>今日记录</h4>
|
||||
<div class="value"><span>{{countDailyLog}}</span>次</div>
|
||||
</div>
|
||||
|
||||
<div class="ui column">
|
||||
<h4>本周拦截</h4>
|
||||
<div class="value"><span>{{countWeeklyBlock}}</span>次</div>
|
||||
</div>
|
||||
|
||||
<div class="ui column no-border">
|
||||
<h4>本月拦截</h4>
|
||||
<div class="value"><span>{{countMonthlyBlock}}</span>次</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h4>近15日趋势
|
||||
<span class="color-span" style="background: #9DD3E8">全部</span>
|
||||
<span class="color-span" style="background: #F39494">拦截</span>
|
||||
<span class="color-span" style="background: #FBD88A">验证码</span>
|
||||
<span class="color-span" style="background: #879BD7">记录</span>
|
||||
</h4>
|
||||
<div class="chart-box" id="daily-chart"></div>
|
||||
|
||||
<h4>拦截类型分布</h4>
|
||||
<div class="chart-box" id="group-chart"></div>
|
||||
</div>
|
||||
198
EdgeUser/web/views/@default/servers/server/stat/waf.js
Normal file
198
EdgeUser/web/views/@default/servers/server/stat/waf.js
Normal file
@@ -0,0 +1,198 @@
|
||||
Tea.context(function () {
|
||||
this.$delay(function () {
|
||||
let that = this
|
||||
|
||||
this.totalDailyStats = this.logDailyStats.map(function (v, k) {
|
||||
return {
|
||||
day: v.day,
|
||||
count: that.logDailyStats[k].count + that.blockDailyStats[k].count + that.captchaDailyStats[k].count
|
||||
}
|
||||
})
|
||||
let dailyUnit = this.processMaxUnit(this.totalDailyStats)
|
||||
this.reloadLineChart("daily-chart", "规则分组", this.totalDailyStats, function (v) {
|
||||
return v.day.substring(4, 6) + "-" + v.day.substring(6)
|
||||
}, function (args) {
|
||||
|
||||
return that.logDailyStats[args.dataIndex].day.substring(4, 6) + "-" + that.logDailyStats[args.dataIndex].day.substring(6) + ": 拦截: "
|
||||
+ teaweb.formatNumber(that.blockDailyStats[args.dataIndex].count) + ", 验证码: " + teaweb.formatNumber(that.captchaDailyStats[args.dataIndex].count) + ", 记录: " + teaweb.formatNumber(that.logDailyStats[args.dataIndex].count)
|
||||
}, dailyUnit)
|
||||
|
||||
let groupUnit = this.processMaxUnit(this.groupStats)
|
||||
let total = this.groupStats.$sum(function (k, v) {
|
||||
return v.rawCount
|
||||
})
|
||||
this.reloadBarChart("group-chart", "规则分组", this.groupStats, function (v) {
|
||||
return v.group.name
|
||||
}, function (args) {
|
||||
let percent = ""
|
||||
if (total > 0) {
|
||||
percent = ", 占比: " + (Math.round(that.groupStats[args.dataIndex].rawCount * 100 * 100 / total) / 100) + "%"
|
||||
}
|
||||
return that.groupStats[args.dataIndex].group.name + ": " + teaweb.formatNumber(that.groupStats[args.dataIndex].rawCount) + percent
|
||||
}, groupUnit)
|
||||
|
||||
window.addEventListener("resize", function () {
|
||||
that.resizeChart("daily-chart")
|
||||
that.resizeChart("group-chart")
|
||||
})
|
||||
})
|
||||
|
||||
this.reloadLineChart = function (chartId, name, stats, xFunc, tooltipFunc, unit) {
|
||||
let chartBox = document.getElementById(chartId)
|
||||
if (chartBox == null) {
|
||||
return
|
||||
}
|
||||
let that = this
|
||||
let chart = echarts.init(chartBox)
|
||||
let option = {
|
||||
xAxis: {
|
||||
data: stats.map(xFunc)
|
||||
},
|
||||
yAxis: {
|
||||
axisLabel: {
|
||||
formatter: function (value) {
|
||||
return value + unit
|
||||
}
|
||||
}
|
||||
},
|
||||
tooltip: {
|
||||
show: true,
|
||||
trigger: "item",
|
||||
formatter: tooltipFunc
|
||||
},
|
||||
grid: {
|
||||
left: 40,
|
||||
top: 10,
|
||||
right: 20,
|
||||
bottom: 20
|
||||
},
|
||||
series: [
|
||||
{
|
||||
name: name,
|
||||
type: "line",
|
||||
data: this.totalDailyStats.map(function (v, index) {
|
||||
return that.totalDailyStats[index].count;
|
||||
}),
|
||||
areaStyle: {},
|
||||
itemStyle: {
|
||||
color: "#9DD3E8"
|
||||
}
|
||||
},
|
||||
{
|
||||
name: name,
|
||||
type: "line",
|
||||
data: this.logDailyStats.map(function (v) {
|
||||
return v.count;
|
||||
}),
|
||||
itemStyle: {
|
||||
color: "#879BD7"
|
||||
}
|
||||
},
|
||||
{
|
||||
name: name,
|
||||
type: "line",
|
||||
data: this.blockDailyStats.map(function (v) {
|
||||
return v.count;
|
||||
}),
|
||||
itemStyle: {
|
||||
color: "#F39494"
|
||||
}
|
||||
},
|
||||
{
|
||||
name: name,
|
||||
type: "line",
|
||||
data: this.captchaDailyStats.map(function (v) {
|
||||
return v.count;
|
||||
}),
|
||||
itemStyle: {
|
||||
color: "#FBD88A"
|
||||
}
|
||||
}
|
||||
],
|
||||
animation: true
|
||||
}
|
||||
chart.setOption(option)
|
||||
chart.resize()
|
||||
}
|
||||
|
||||
this.reloadBarChart = function (chartId, name, stats, xFunc, tooltipFunc, unit) {
|
||||
let chartBox = document.getElementById(chartId)
|
||||
if (chartBox == null) {
|
||||
return
|
||||
}
|
||||
let chart = echarts.init(chartBox)
|
||||
let option = {
|
||||
xAxis: {
|
||||
data: stats.map(xFunc)
|
||||
},
|
||||
yAxis: {
|
||||
axisLabel: {
|
||||
formatter: function (value) {
|
||||
return value + unit
|
||||
}
|
||||
}
|
||||
},
|
||||
tooltip: {
|
||||
show: true,
|
||||
trigger: "item",
|
||||
formatter: tooltipFunc
|
||||
},
|
||||
grid: {
|
||||
left: 40,
|
||||
top: 10,
|
||||
right: 20,
|
||||
bottom: 20
|
||||
},
|
||||
series: [
|
||||
{
|
||||
name: name,
|
||||
type: "bar",
|
||||
data: stats.map(function (v) {
|
||||
return v.count;
|
||||
}),
|
||||
itemStyle: {
|
||||
color: "#9DD3E8"
|
||||
},
|
||||
barWidth: "20em"
|
||||
}
|
||||
],
|
||||
animation: true
|
||||
}
|
||||
chart.setOption(option)
|
||||
chart.resize()
|
||||
}
|
||||
|
||||
this.resizeChart = function (chartId) {
|
||||
let chartBox = document.getElementById(chartId)
|
||||
if (chartBox == null) {
|
||||
return
|
||||
}
|
||||
let chart = echarts.init(chartBox)
|
||||
chart.resize()
|
||||
}
|
||||
|
||||
this.processMaxUnit = function (stats) {
|
||||
let max = stats.$map(function (k, v) {
|
||||
return v.count
|
||||
}).$max()
|
||||
let divider = 0
|
||||
let unit = ""
|
||||
if (max >= 1000 * 1000 * 1000) {
|
||||
unit = "B"
|
||||
divider = 1000 * 1000 * 1000
|
||||
} else if (max >= 1000 * 1000) {
|
||||
unit = "M"
|
||||
divider = 1000 * 1000
|
||||
} else if (max >= 1000) {
|
||||
unit = "K"
|
||||
divider = 1000
|
||||
}
|
||||
stats.forEach(function (v) {
|
||||
v.rawCount = v.count
|
||||
if (divider > 0) {
|
||||
v.count /= divider
|
||||
}
|
||||
})
|
||||
return unit
|
||||
}
|
||||
})
|
||||
31
EdgeUser/web/views/@default/servers/server/stat/waf.less
Normal file
31
EdgeUser/web/views/@default/servers/server/stat/waf.less
Normal file
@@ -0,0 +1,31 @@
|
||||
.grid {
|
||||
margin-top: 2em !important;
|
||||
margin-left: 2em !important;
|
||||
|
||||
.column {
|
||||
margin-bottom: 2em;
|
||||
border-right: 1px #eee solid;
|
||||
|
||||
div.value {
|
||||
margin-top: 1.5em;
|
||||
|
||||
span {
|
||||
font-size: 2em;
|
||||
margin-right: 0.2em;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.column.no-border {
|
||||
border-right: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.chart-box {
|
||||
height: 20em;
|
||||
}
|
||||
|
||||
h4 .color-span {
|
||||
font-size: 0.6em;
|
||||
padding: 2px 4px;
|
||||
}
|
||||
Reference in New Issue
Block a user