Connect With Non-Terminal Widgets (#304)

- Adds connection buttons for previews
- Makes it possible for graphs and previews to connect on backend
(without a terminal open to connection)
- Changes the wsh install message
This commit is contained in:
Sylvie Crowe
2024-09-02 12:34:49 -07:00
committed by GitHub
parent 63cfe1d279
commit 226bc4ee6f
7 changed files with 99 additions and 10 deletions
+10 -1
View File
@@ -353,12 +353,21 @@ const ChangeConnectionBlockModal = React.memo(
}) => {
const [connSelected, setConnSelected] = React.useState("");
const changeConnModalOpen = jotai.useAtomValue(changeConnModalAtom);
const [blockData] = WOS.useWaveObjectValue<Block>(WOS.makeORef("block", blockId));
const changeConnection = React.useCallback(
async (connName: string) => {
const oldCwd = blockData?.meta?.file ?? "";
let newCwd: string;
if (oldCwd == "") {
newCwd = "";
} else {
newCwd = "~";
}
await WshServer.SetMetaCommand({
oref: WOS.makeORef("block", blockId),
meta: { connection: connName },
meta: { connection: connName, file: newCwd },
});
await services.BlockService.EnsureConnection(blockId).catch((e) => console.log(e));
await WshServer.ControllerRestartCommand({ blockid: blockId });
},
[blockId]