mirror of
https://github.com/wavetermdev/backup.git
synced 2026-08-05 13:57:07 -07:00
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:
@@ -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]
|
||||
|
||||
@@ -7,6 +7,9 @@ import * as WOS from "./wos";
|
||||
|
||||
// blockservice.BlockService (block)
|
||||
class BlockServiceType {
|
||||
EnsureConnection(arg2: string): Promise<void> {
|
||||
return WOS.callBackendService("block", "EnsureConnection", Array.from(arguments))
|
||||
}
|
||||
GetControllerStatus(arg2: string): Promise<BlockControllerRuntimeStatus> {
|
||||
return WOS.callBackendService("block", "GetControllerStatus", Array.from(arguments))
|
||||
}
|
||||
|
||||
@@ -52,6 +52,7 @@ export class PreviewModel implements ViewModel {
|
||||
previewTextRef: React.RefObject<HTMLDivElement>;
|
||||
editMode: jotai.Atom<boolean>;
|
||||
canPreview: jotai.PrimitiveAtom<boolean>;
|
||||
manageConnection: jotai.Atom<boolean>;
|
||||
|
||||
fileName: jotai.Atom<string>;
|
||||
connection: jotai.Atom<string>;
|
||||
@@ -81,6 +82,7 @@ export class PreviewModel implements ViewModel {
|
||||
this.ceReadOnly = jotai.atom(true);
|
||||
this.canPreview = jotai.atom(false);
|
||||
this.openFileModal = jotai.atom(false);
|
||||
this.manageConnection = jotai.atom(true);
|
||||
this.blockAtom = WOS.getWaveObjectAtom<Block>(`block:${blockId}`);
|
||||
this.viewIcon = jotai.atom((get) => {
|
||||
let blockData = get(this.blockAtom);
|
||||
|
||||
Reference in New Issue
Block a user