mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2026-09-26 21:24:46 +01:00
* Add implementation plan for removing Phoenix and notebooks Co-authored-by: Copilot <[email protected]> * Phase 1: Decouple database shells from Phoenix to CloudShell-only Migrate all shell terminals to the CloudShell path and remove the legacy Phoenix notebook-server terminal code so shells no longer depend on notebook provisioning. - TerminalTab now always uses CloudShellTerminalComponentAdapter; removed the notebook-server adapter branch, getNotebookServerInfo, and the dead VCoreMongo firewall check - Migrate Postgres and VCore Mongo quickstart tabs to CloudShellTerminalComponent (drop allocateContainer/useNotebook dependencies) - Refactor useTerminal to send input via the CloudShell WebSocket instead of postRobot/iframe; register the socket from CloudShellTerminalComponent - Simplify Explorer.openNotebookTerminal to always open a CloudShell terminal - Delete NotebookTerminalComponent(+test/less/snapshot), NotebookTerminalComponentAdapter, and the src/Terminal/ entry point - Remove the terminal.html webpack entry/HTML plugin and src/Terminal from tsconfig.strict.json Co-authored-by: Copilot <[email protected]> --------- Co-authored-by: Copilot <[email protected]>
21 lines
556 B
TypeScript
21 lines
556 B
TypeScript
import create, { UseStore } from "zustand";
|
|
|
|
interface TerminalState {
|
|
socket: WebSocket | undefined;
|
|
setSocket: (socket: WebSocket | undefined) => void;
|
|
sendMessage: (message: string) => void;
|
|
}
|
|
|
|
export const useTerminal: UseStore<TerminalState> = create((set, get) => ({
|
|
socket: undefined,
|
|
setSocket: (socket: WebSocket | undefined) => {
|
|
set({ socket });
|
|
},
|
|
sendMessage: (message: string) => {
|
|
const socket = get().socket;
|
|
if (socket && socket.readyState === WebSocket.OPEN) {
|
|
socket.send(message + "\r");
|
|
}
|
|
},
|
|
}));
|