Timeouts for sync config
This commit is contained in:
@@ -385,6 +385,8 @@ functions:
|
||||
name: "UI: Hide BHS"
|
||||
key: "Ctrl-Alt-b"
|
||||
mac: "Cmd-Alt-b"
|
||||
events:
|
||||
- log:hide
|
||||
|
||||
# Link unfurl infrastructure
|
||||
unfurlLink:
|
||||
|
||||
+87
-25
@@ -3,6 +3,7 @@ import {
|
||||
editor,
|
||||
markdown,
|
||||
sandbox as serverSandbox,
|
||||
system,
|
||||
} from "$sb/silverbullet-syscall/mod.ts";
|
||||
|
||||
export async function parsePageCommand() {
|
||||
@@ -17,29 +18,38 @@ export async function parsePageCommand() {
|
||||
}
|
||||
|
||||
export async function showLogsCommand() {
|
||||
const clientLogs = await sandbox.getLogs();
|
||||
const serverLogs = await serverSandbox.getServerLogs();
|
||||
// Running in client/server mode?
|
||||
const clientServer = !!(await system.getEnv());
|
||||
|
||||
await editor.showPanel(
|
||||
"bhs",
|
||||
1,
|
||||
`
|
||||
if (clientServer) {
|
||||
const clientLogs = await sandbox.getLogs();
|
||||
const serverLogs = await serverSandbox.getServerLogs();
|
||||
await editor.showPanel(
|
||||
"bhs",
|
||||
1,
|
||||
`
|
||||
<style>
|
||||
#reload {
|
||||
width: 75%;
|
||||
}
|
||||
#close {
|
||||
width: 20%;
|
||||
}
|
||||
#client-log-header {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 5px;
|
||||
top: 35px;
|
||||
}
|
||||
#server-log-header {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
top: 5px;
|
||||
top: 35px;
|
||||
width: 50%;
|
||||
}
|
||||
#client-log {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 30px;
|
||||
top: 60px;
|
||||
bottom: 0;
|
||||
width: 50%;
|
||||
overflow: scroll;
|
||||
@@ -47,41 +57,93 @@ export async function showLogsCommand() {
|
||||
#server-log {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
top: 30px;
|
||||
top: 60px;
|
||||
bottom: 0;
|
||||
width: 50%;
|
||||
overflow: scroll;
|
||||
}
|
||||
</style>
|
||||
<button onclick="self.reloadLogs()" id="reload">Reload</button>
|
||||
<button onclick="self.close()" id="close">Close</button>
|
||||
<div id="client-log-header">Client logs (max 100)</div>
|
||||
<div id="client-log">
|
||||
<pre>${
|
||||
clientLogs
|
||||
.map((le) => `[${le.level}] ${le.message}`)
|
||||
.join("\n")
|
||||
}</pre>
|
||||
clientLogs
|
||||
.map((le) => `[${le.level}] ${le.message}`)
|
||||
.join("\n")
|
||||
}</pre>
|
||||
</div>
|
||||
<div id="server-log-header">Server logs (max 100)</div>
|
||||
<div id="server-log">
|
||||
<pre>${
|
||||
serverLogs
|
||||
.map((le) => `[${le.level}] ${le.message}`)
|
||||
.join("\n")
|
||||
}</pre>
|
||||
serverLogs
|
||||
.map((le) => `[${le.level}] ${le.message}`)
|
||||
.join("\n")
|
||||
}</pre>
|
||||
</div>`,
|
||||
`
|
||||
`
|
||||
var clientDiv = document.getElementById("client-log");
|
||||
clientDiv.scrollTop = clientDiv.scrollHeight;
|
||||
var serverDiv = document.getElementById("server-log");
|
||||
serverDiv.scrollTop = serverDiv.scrollHeight;
|
||||
if(window.reloadInterval) {
|
||||
clearInterval(window.reloadInterval);
|
||||
}
|
||||
window.reloadInterval = setInterval(() => {
|
||||
|
||||
self.reloadLogs = () => {
|
||||
sendEvent("log:reload");
|
||||
}, 1000);
|
||||
};
|
||||
self.close = () => {
|
||||
sendEvent("log:hide");
|
||||
};
|
||||
`,
|
||||
);
|
||||
);
|
||||
} else {
|
||||
const logs = await sandbox.getLogs();
|
||||
await editor.showPanel(
|
||||
"bhs",
|
||||
1,
|
||||
`
|
||||
<style>
|
||||
#reload {
|
||||
width: 75%;
|
||||
}
|
||||
#close {
|
||||
width: 20%;
|
||||
}
|
||||
#log-header {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 35px;
|
||||
}
|
||||
#log {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 60px;
|
||||
bottom: 0;
|
||||
width: 100%;
|
||||
overflow: scroll;
|
||||
}
|
||||
</style>
|
||||
<button onclick="self.reloadLogs()" id="reload">Reload</button>
|
||||
<button onclick="self.close()" id="close">Close</button>
|
||||
<div id="log-header">Logs (max 100)</div>
|
||||
<div id="log">
|
||||
<pre>${
|
||||
logs
|
||||
.map((le) => `[${le.level}] ${le.message}`)
|
||||
.join("\n")
|
||||
}</pre>
|
||||
</div>`,
|
||||
`
|
||||
var clientDiv = document.getElementById("log");
|
||||
clientDiv.scrollTop = clientDiv.scrollHeight;
|
||||
self.reloadLogs = () => {
|
||||
sendEvent("log:reload");
|
||||
};
|
||||
self.close = () => {
|
||||
sendEvent("log:hide");
|
||||
};
|
||||
`,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export async function hideBhsCommand() {
|
||||
|
||||
@@ -54,6 +54,8 @@ export async function syncCommand() {
|
||||
}
|
||||
await editor.flashNotification("Starting sync...");
|
||||
try {
|
||||
await system.invokeFunction("server", "check", config);
|
||||
|
||||
const operations = await system.invokeFunction("server", "performSync");
|
||||
await editor.flashNotification(
|
||||
`Sync complete. Performed ${operations} operations.`,
|
||||
|
||||
Reference in New Issue
Block a user