mirror of
https://github.com/wavetermdev/backup.git
synced 2026-08-05 13:57:07 -07:00
implement wsh conn commands (#319)
This commit is contained in:
@@ -589,9 +589,9 @@ function subscribeToConnEvents() {
|
||||
try {
|
||||
const connStatus = event.data as ConnStatus;
|
||||
if (connStatus == null || util.isBlank(connStatus.connection)) {
|
||||
console.log("connchange2 early return");
|
||||
return;
|
||||
}
|
||||
console.log("connstatus update", connStatus);
|
||||
let curAtom = getConnStatusAtom(connStatus.connection);
|
||||
globalStore.set(curAtom, connStatus);
|
||||
} catch (e) {
|
||||
@@ -603,7 +603,13 @@ function subscribeToConnEvents() {
|
||||
function getConnStatusAtom(conn: string): jotai.PrimitiveAtom<ConnStatus> {
|
||||
let rtn = ConnStatusMap.get(conn);
|
||||
if (rtn == null) {
|
||||
const connStatus: ConnStatus = { connection: conn, connected: false, error: null, status: "disconnected" };
|
||||
const connStatus: ConnStatus = {
|
||||
connection: conn,
|
||||
connected: false,
|
||||
error: null,
|
||||
status: "disconnected",
|
||||
hasconnected: false,
|
||||
};
|
||||
rtn = jotai.atom(connStatus);
|
||||
ConnStatusMap.set(conn, rtn);
|
||||
}
|
||||
|
||||
@@ -17,6 +17,11 @@ class WshServerType {
|
||||
return WOS.wshServerRpcHelper_call("authenticate", data, opts);
|
||||
}
|
||||
|
||||
// command "connconnect" [call]
|
||||
ConnConnectCommand(data: string, opts?: RpcOpts): Promise<void> {
|
||||
return WOS.wshServerRpcHelper_call("connconnect", data, opts);
|
||||
}
|
||||
|
||||
// command "conndisconnect" [call]
|
||||
ConnDisconnectCommand(data: string, opts?: RpcOpts): Promise<void> {
|
||||
return WOS.wshServerRpcHelper_call("conndisconnect", data, opts);
|
||||
@@ -27,16 +32,16 @@ class WshServerType {
|
||||
return WOS.wshServerRpcHelper_call("connensure", data, opts);
|
||||
}
|
||||
|
||||
// command "connforceconnect" [call]
|
||||
ConnForceConnectCommand(data: string, opts?: RpcOpts): Promise<void> {
|
||||
return WOS.wshServerRpcHelper_call("connforceconnect", data, opts);
|
||||
}
|
||||
|
||||
// command "connreinstallwsh" [call]
|
||||
ConnReinstallWshCommand(data: string, opts?: RpcOpts): Promise<void> {
|
||||
return WOS.wshServerRpcHelper_call("connreinstallwsh", data, opts);
|
||||
}
|
||||
|
||||
// command "connstatus" [call]
|
||||
ConnStatusCommand(opts?: RpcOpts): Promise<ConnStatus[]> {
|
||||
return WOS.wshServerRpcHelper_call("connstatus", null, opts);
|
||||
}
|
||||
|
||||
// command "controllerinput" [call]
|
||||
ControllerInputCommand(data: CommandBlockInputData, opts?: RpcOpts): Promise<void> {
|
||||
return WOS.wshServerRpcHelper_call("controllerinput", data, opts);
|
||||
|
||||
Reference in New Issue
Block a user