mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-19 17:38:19 +08:00
system check & setting_secret
This commit is contained in:
1 parent
c52ddd7512
commit
57f711ed4f
18 files changed
+295
-134
No files matched your search
@@ -0,0 +1,34 @@
|
||||
import { NamedPage } from 'vj/misc/PageLoader';
|
||||
|
||||
const page = new NamedPage('manage_dashboard', async () => {
|
||||
const { default: SockJs } = await import('sockjs-client');
|
||||
|
||||
const sock = new SockJs(Context.socketUrl);
|
||||
sock.onopen = () => {
|
||||
$('<blockquote class="blue"><p>Connection opened.</p></blockquote>').appendTo('#messages');
|
||||
};
|
||||
|
||||
sock.onmessage = (message) => {
|
||||
const msg = JSON.parse(message.data);
|
||||
if (msg.type === 'log') {
|
||||
const div = $('<blockquote class="blue">').appendTo('#messages');
|
||||
$(`<p>${msg.payload}</p>`).appendTo(div);
|
||||
} else if (msg.type === 'warn') {
|
||||
const div = $('<blockquote class="yellow">').appendTo('#messages');
|
||||
$(`<p>${msg.payload}</p>`).appendTo(div);
|
||||
} else if (msg.type === 'error') {
|
||||
const div = $('<blockquote class="red">').appendTo('#messages');
|
||||
$(`<p>${msg.payload}</p>`).appendTo(div);
|
||||
}
|
||||
};
|
||||
|
||||
sock.onclose = (message) => {
|
||||
$(`
|
||||
<blockquote class="yellow">
|
||||
<p>Connection closed,reason=${JSON.stringify(message.reason)}</p>
|
||||
</blockquote>
|
||||
`).appendTo('#messages');
|
||||
};
|
||||
});
|
||||
|
||||
export default page;
|
||||
Reference in new issue
Block a user