🐛 fix(alert): 添加报警规则

This commit is contained in:
naiba
2020-12-21 16:34:21 +08:00
parent 789065cb5f
commit 4ec61d0043
5 changed files with 33 additions and 22 deletions

View File

@@ -1,13 +1,7 @@
/**
* Converts a long string of bytes into a readable format e.g KB, MB, GB, TB, YB
*
* @param {Int} num The number of bytes.
*/
function readableBytes(bytes) {
var i = Math.floor(Math.log(bytes) / Math.log(1024)),
sizes = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
return (bytes / Math.pow(1024, i)).toFixed(2) * 1 + ' ' + sizes[i];
return (bytes / Math.pow(1024, i)).toFixed(0) + ' ' + sizes[i];
}
const confirmBtn = $('.mini.confirm.modal .positive.button')

View File

@@ -9,7 +9,7 @@
<script src="https://cdn.jsdelivr.net/npm/semantic-ui@2.4.1/dist/semantic.min.js"></script>
<script src="/static/semantic-ui-alerts.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/vue"></script>
<script src="/static/main.js?v202012202118"></script>
<script src="/static/main.js?v202012211616"></script>
</body>
</html>

View File

@@ -151,10 +151,13 @@
},
secondToDate(s) {
var d = Math.floor(s / 3600 / 24);
if (d > 0) {
return d + "天"
}
var h = Math.floor(s / 3600 % 24);
var m = Math.floor((s / 60 % 60));
var s = Math.floor((s % 60));
return result = d + "" + h + "小时" + m + "分钟" + s + "秒";
var m = Math.floor(s / 60 % 60);
var s = Math.floor(s % 60);
return h + ":" + ("0" + m).slice(-2) + ":" + ("0" + s).slice(-2);
},
formatTimestamp(t) {
return new Date(t * 1000).toLocaleString()

View File

@@ -48,8 +48,8 @@
<th>运行状态</th>
<th>节点名</th>
<th>系统</th>
<th>服务器位置</th>
<th>在线时间</th>
<th>位置</th>
<th>在线</th>
<th>网络(B/s) ↓|↑</th>
<th>流量(B) ↓|↑</th>
<th>CPU</th>
@@ -200,8 +200,7 @@
readableBytes(bytes) {
var i = Math.floor(Math.log(bytes) / Math.log(1024)),
sizes = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
return (bytes / Math.pow(1024, i)).toFixed(2) * 1 + ' ' + sizes[i];
return (bytes / Math.pow(1024, i)).toFixed(0) + ' ' + sizes[i];
},
troggleDarkMode() {
const hour = new Date(Date.now()).getHours()
@@ -211,10 +210,13 @@
},
secondToDate(s) {
var d = Math.floor(s / 3600 / 24);
if (d > 0) {
return d + "天"
}
var h = Math.floor(s / 3600 % 24);
var m = Math.floor((s / 60 % 60));
var s = Math.floor((s % 60));
return result = d + "" + h + "小时" + m + "分钟" + s + "秒";
var m = Math.floor(s / 60 % 60);
var s = Math.floor(s % 60);
return h + ":" + ("0" + m).slice(-2) + ":" + ("0" + s).slice(-2);
},
formatTimestamp(t) {
return new Date(t * 1000).toLocaleString()