mirror of
https://github.com/nezhahq/nezha.git
synced 2025-02-08 12:38:13 -05:00
🚀 dashboard v0.13.29
前端断开后自动重连
This commit is contained in:
parent
fd697c5f44
commit
9bff4fae2f
@ -4,7 +4,7 @@
|
|||||||
<br>
|
<br>
|
||||||
<small><i>LOGO designed by <a href="https://xio.ng" target="_blank">熊大</a> .</i></small>
|
<small><i>LOGO designed by <a href="https://xio.ng" target="_blank">熊大</a> .</i></small>
|
||||||
<br><br>
|
<br><br>
|
||||||
<img src="https://img.shields.io/github/workflow/status/naiba/nezha/Dashboard%20image?label=Dash%20v0.13.28&logo=github&style=for-the-badge"> <img src="https://img.shields.io/github/v/release/naiba/nezha?color=brightgreen&label=Agent&style=for-the-badge&logo=github"> <img src="https://img.shields.io/github/workflow/status/naiba/nezha/Agent%20release?label=Agent%20CI&logo=github&style=for-the-badge"> <img src="https://img.shields.io/badge/Installer-v0.10.6-brightgreen?style=for-the-badge&logo=linux">
|
<img src="https://img.shields.io/github/workflow/status/naiba/nezha/Dashboard%20image?label=Dash%20v0.13.29&logo=github&style=for-the-badge"> <img src="https://img.shields.io/github/v/release/naiba/nezha?color=brightgreen&label=Agent&style=for-the-badge&logo=github"> <img src="https://img.shields.io/github/workflow/status/naiba/nezha/Agent%20release?label=Agent%20CI&logo=github&style=for-the-badge"> <img src="https://img.shields.io/badge/Installer-v0.10.6-brightgreen?style=for-the-badge&logo=linux">
|
||||||
<br>
|
<br>
|
||||||
<br>
|
<br>
|
||||||
<p>:trollface: <b>Nezha Monitoring: Self-hosted, lightweight server and website monitoring and O&M tool.</b></p>
|
<p>:trollface: <b>Nezha Monitoring: Self-hosted, lightweight server and website monitoring and O&M tool.</b></p>
|
||||||
|
15
resource/template/theme-daynight/home.html
vendored
15
resource/template/theme-daynight/home.html
vendored
@ -256,8 +256,11 @@
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
const wsProtocol = window.location.protocol == "https:" ? "wss" : "ws"
|
const wsProtocol = window.location.protocol == "https:" ? "wss" : "ws"
|
||||||
|
let canShowError = true;
|
||||||
|
function connect() {
|
||||||
const ws = new WebSocket(wsProtocol + '://' + window.location.host + '/ws');
|
const ws = new WebSocket(wsProtocol + '://' + window.location.host + '/ws');
|
||||||
ws.onopen = function (evt) {
|
ws.onopen = function (evt) {
|
||||||
|
canShowError = true;
|
||||||
Swal.fire({
|
Swal.fire({
|
||||||
position: 'top',
|
position: 'top',
|
||||||
icon: 'success',
|
icon: 'success',
|
||||||
@ -285,6 +288,8 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
ws.onclose = function () {
|
ws.onclose = function () {
|
||||||
|
if (canShowError) {
|
||||||
|
canShowError = false;
|
||||||
Swal.fire({
|
Swal.fire({
|
||||||
position: 'top',
|
position: 'top',
|
||||||
icon: 'error',
|
icon: 'error',
|
||||||
@ -293,8 +298,16 @@
|
|||||||
showConfirmButton: false,
|
showConfirmButton: false,
|
||||||
timer: 2000
|
timer: 2000
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
setTimeout(function () {
|
||||||
|
connect()
|
||||||
|
}, 3000);
|
||||||
|
}
|
||||||
|
ws.onerror = function () {
|
||||||
|
ws.close()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
connect();
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
|
20
resource/template/theme-default/home.html
vendored
20
resource/template/theme-default/home.html
vendored
@ -262,9 +262,12 @@
|
|||||||
return dest;
|
return dest;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let canShowError = true;
|
||||||
|
function connect() {
|
||||||
const wsProtocol = window.location.protocol == "https:" ? "wss" : "ws"
|
const wsProtocol = window.location.protocol == "https:" ? "wss" : "ws"
|
||||||
const ws = new WebSocket(wsProtocol + '://' + window.location.host + '/ws');
|
const ws = new WebSocket(wsProtocol + '://' + window.location.host + '/ws');
|
||||||
ws.onopen = function (evt) {
|
ws.onopen = function (evt) {
|
||||||
|
canShowError = true;
|
||||||
$.suiAlert({
|
$.suiAlert({
|
||||||
title: '{{tr "RealtimeChannelEstablished"}}',
|
title: '{{tr "RealtimeChannelEstablished"}}',
|
||||||
description: '{{tr "GetTheLatestMonitoringDataInRealTime"}}',
|
description: '{{tr "GetTheLatestMonitoringDataInRealTime"}}',
|
||||||
@ -292,6 +295,8 @@
|
|||||||
statusCards.groups = groupingData(statusCards.servers, "Tag")
|
statusCards.groups = groupingData(statusCards.servers, "Tag")
|
||||||
}
|
}
|
||||||
ws.onclose = function () {
|
ws.onclose = function () {
|
||||||
|
if (canShowError) {
|
||||||
|
canShowError = false;
|
||||||
$.suiAlert({
|
$.suiAlert({
|
||||||
title: '{{tr "RealtimeChannelDisconnect"}}',
|
title: '{{tr "RealtimeChannelDisconnect"}}',
|
||||||
description: '{{tr "CanNotGetTheLatestMonitoringDataInRealTime"}}',
|
description: '{{tr "CanNotGetTheLatestMonitoringDataInRealTime"}}',
|
||||||
@ -300,8 +305,17 @@
|
|||||||
position: 'top-center',
|
position: 'top-center',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
$('.ui.accordion')
|
setTimeout(function () {
|
||||||
.accordion({ "exclusive": false })
|
connect()
|
||||||
;
|
}, 3000);
|
||||||
|
}
|
||||||
|
ws.onerror = function () {
|
||||||
|
ws.close()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
connect();
|
||||||
|
|
||||||
|
$('.ui.accordion').accordion({ "exclusive": false });
|
||||||
</script>
|
</script>
|
||||||
{{end}}
|
{{end}}
|
14
resource/template/theme-hotaru/home.html
vendored
14
resource/template/theme-hotaru/home.html
vendored
@ -243,8 +243,11 @@
|
|||||||
})
|
})
|
||||||
|
|
||||||
const wsProtocol = window.location.protocol == "https:" ? "wss" : "ws"
|
const wsProtocol = window.location.protocol == "https:" ? "wss" : "ws"
|
||||||
|
let canShowError = true;
|
||||||
|
function connect() {
|
||||||
const ws = new WebSocket(wsProtocol + '://' + window.location.host + '/ws');
|
const ws = new WebSocket(wsProtocol + '://' + window.location.host + '/ws');
|
||||||
ws.onopen = function (evt) {
|
ws.onopen = function (evt) {
|
||||||
|
canShowError = true;
|
||||||
$.suiAlert({
|
$.suiAlert({
|
||||||
title: '{{tr "RealtimeChannelEstablished"}}',
|
title: '{{tr "RealtimeChannelEstablished"}}',
|
||||||
description: '{{tr "GetTheLatestMonitoringDataInRealTime"}}',
|
description: '{{tr "GetTheLatestMonitoringDataInRealTime"}}',
|
||||||
@ -270,6 +273,8 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
ws.onclose = function () {
|
ws.onclose = function () {
|
||||||
|
if (canShowError) {
|
||||||
|
canShowError = false;
|
||||||
$.suiAlert({
|
$.suiAlert({
|
||||||
title: '{{tr "RealtimeChannelDisconnect"}}',
|
title: '{{tr "RealtimeChannelDisconnect"}}',
|
||||||
description: '{{tr "CanNotGetTheLatestMonitoringDataInRealTime"}}',
|
description: '{{tr "CanNotGetTheLatestMonitoringDataInRealTime"}}',
|
||||||
@ -278,6 +283,15 @@
|
|||||||
position: 'top-center',
|
position: 'top-center',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
setTimeout(function () {
|
||||||
|
connect()
|
||||||
|
}, 3000);
|
||||||
|
}
|
||||||
|
ws.onerror = function () {
|
||||||
|
ws.close()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
connect()
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
|
14
resource/template/theme-mdui/home.html
vendored
14
resource/template/theme-mdui/home.html
vendored
@ -228,8 +228,11 @@
|
|||||||
})
|
})
|
||||||
|
|
||||||
const wsProtocol = window.location.protocol == "https:" ? "wss" : "ws"
|
const wsProtocol = window.location.protocol == "https:" ? "wss" : "ws"
|
||||||
|
let canShowError = true;
|
||||||
|
function connect() {
|
||||||
const ws = new WebSocket(wsProtocol + '://' + window.location.host + '/ws');
|
const ws = new WebSocket(wsProtocol + '://' + window.location.host + '/ws');
|
||||||
ws.onopen = function (evt) {
|
ws.onopen = function (evt) {
|
||||||
|
canShowError = true;
|
||||||
mdui.snackbar({
|
mdui.snackbar({
|
||||||
message: '{{tr "RealtimeChannelEstablished"}}',
|
message: '{{tr "RealtimeChannelEstablished"}}',
|
||||||
timeout: 2000,
|
timeout: 2000,
|
||||||
@ -282,12 +285,23 @@
|
|||||||
mdui.mutation();
|
mdui.mutation();
|
||||||
}
|
}
|
||||||
ws.onclose = function () {
|
ws.onclose = function () {
|
||||||
|
if (canShowError) {
|
||||||
|
canShowError = false;
|
||||||
mdui.snackbar({
|
mdui.snackbar({
|
||||||
message: '{{tr "RealtimeChannelDisconnect"}}',
|
message: '{{tr "RealtimeChannelDisconnect"}}',
|
||||||
timeout: 2000,
|
timeout: 2000,
|
||||||
position: 'top',
|
position: 'top',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
setTimeout(function () {
|
||||||
|
connect()
|
||||||
|
}, 3000);
|
||||||
|
}
|
||||||
|
ws.onerror = function () {
|
||||||
|
ws.close()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
connect();
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -12,7 +12,7 @@ import (
|
|||||||
"github.com/naiba/nezha/pkg/utils"
|
"github.com/naiba/nezha/pkg/utils"
|
||||||
)
|
)
|
||||||
|
|
||||||
var Version = "v0.13.28" // !!记得修改 README 中的 badge 版本!!
|
var Version = "v0.13.29" // !!记得修改 README 中的 badge 版本!!
|
||||||
|
|
||||||
var (
|
var (
|
||||||
Conf *model.Config
|
Conf *model.Config
|
||||||
|
Loading…
Reference in New Issue
Block a user