mirror of
https://github.com/wavetermdev/waveterm.git
synced 2025-01-04 18:59:08 +01:00
cleanup commandrunner model
This commit is contained in:
parent
23b3250f18
commit
5770e482a1
@ -1,123 +1,11 @@
|
||||
// Copyright 2023, Command Line Inc.
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type React from "react";
|
||||
import * as mobx from "mobx";
|
||||
import { sprintf } from "sprintf-js";
|
||||
import { v4 as uuidv4 } from "uuid";
|
||||
import { boundMethod } from "autobind-decorator";
|
||||
import { debounce } from "throttle-debounce";
|
||||
import * as mobxReact from "mobx-react";
|
||||
import {
|
||||
handleJsonFetchResponse,
|
||||
base64ToString,
|
||||
stringToBase64,
|
||||
base64ToArray,
|
||||
genMergeData,
|
||||
genMergeDataMap,
|
||||
genMergeSimpleData,
|
||||
boundInt,
|
||||
isModKeyPress,
|
||||
} from "../util/util";
|
||||
import { TermWrap } from "../plugins/terminal/term";
|
||||
import { PluginModel } from "../plugins/plugins";
|
||||
import {
|
||||
SessionDataType,
|
||||
LineType,
|
||||
RemoteType,
|
||||
HistoryItem,
|
||||
RemoteInstanceType,
|
||||
RemotePtrType,
|
||||
CmdDataType,
|
||||
FeCmdPacketType,
|
||||
TermOptsType,
|
||||
ScreenDataType,
|
||||
ScreenOptsType,
|
||||
PtyDataUpdateType,
|
||||
ModelUpdateType,
|
||||
UpdateMessage,
|
||||
InfoType,
|
||||
UIContextType,
|
||||
HistoryInfoType,
|
||||
HistoryQueryOpts,
|
||||
FeInputPacketType,
|
||||
RemoteInputPacketType,
|
||||
ContextMenuOpts,
|
||||
RendererContext,
|
||||
RendererModel,
|
||||
PtyDataType,
|
||||
BookmarkType,
|
||||
ClientDataType,
|
||||
HistoryViewDataType,
|
||||
AlertMessageType,
|
||||
HistorySearchParams,
|
||||
FocusTypeStrs,
|
||||
ScreenLinesType,
|
||||
HistoryTypeStrs,
|
||||
RendererPluginType,
|
||||
WindowSize,
|
||||
WebShareOpts,
|
||||
TermContextUnion,
|
||||
RemoteEditType,
|
||||
RemoteViewType,
|
||||
CommandRtnType,
|
||||
WebCmd,
|
||||
WebRemote,
|
||||
OpenAICmdInfoChatMessageType,
|
||||
StatusIndicatorLevel,
|
||||
} from "../types/types";
|
||||
import * as T from "../types/types";
|
||||
import { WSControl } from "./ws";
|
||||
import {
|
||||
getMonoFontSize,
|
||||
windowWidthToCols,
|
||||
windowHeightToRows,
|
||||
termWidthFromCols,
|
||||
termHeightFromRows,
|
||||
} from "../util/textmeasure";
|
||||
import dayjs from "dayjs";
|
||||
import localizedFormat from "dayjs/plugin/localizedFormat";
|
||||
import customParseFormat from "dayjs/plugin/customParseFormat";
|
||||
import { getRendererContext, cmdStatusIsRunning } from "../app/line/lineutil";
|
||||
import { MagicLayout } from "../app/magiclayout";
|
||||
import { modalsRegistry } from "../app/common/modals/registry";
|
||||
import * as appconst from "../app/appconst";
|
||||
import { checkKeyPressed, adaptFromReactOrNativeKeyEvent, setKeyUtilPlatform } from "../util/keyutil";
|
||||
import { RendererContext, HistorySearchParams, CommandRtnType } from "../types/types";
|
||||
import { LineStateType } from "../types/types";
|
||||
import { Model } from "./model";
|
||||
|
||||
dayjs.extend(customParseFormat);
|
||||
dayjs.extend(localizedFormat);
|
||||
|
||||
const RemotePtyRows = 8; // also in main.tsx
|
||||
const RemotePtyCols = 80;
|
||||
const ProdServerEndpoint = "http://127.0.0.1:1619";
|
||||
const ProdServerWsEndpoint = "ws://127.0.0.1:1623";
|
||||
const DevServerEndpoint = "http://127.0.0.1:8090";
|
||||
const DevServerWsEndpoint = "ws://127.0.0.1:8091";
|
||||
const DefaultTermFontSize = 12;
|
||||
const MinFontSize = 8;
|
||||
const MaxFontSize = 24;
|
||||
const InputChunkSize = 500;
|
||||
const RemoteColors = ["red", "green", "yellow", "blue", "magenta", "cyan", "white", "orange"];
|
||||
const TabColors = ["red", "orange", "yellow", "green", "mint", "cyan", "blue", "violet", "pink", "white"];
|
||||
const TabIcons = [
|
||||
"sparkle",
|
||||
"fire",
|
||||
"ghost",
|
||||
"cloud",
|
||||
"compass",
|
||||
"crown",
|
||||
"droplet",
|
||||
"graduation-cap",
|
||||
"heart",
|
||||
"file",
|
||||
];
|
||||
|
||||
// @ts-ignore
|
||||
const VERSION = __WAVETERM_VERSION__;
|
||||
// @ts-ignore
|
||||
const BUILD = __WAVETERM_BUILD__;
|
||||
|
||||
class CommandRunner {
|
||||
globalModel: Model;
|
||||
|
||||
@ -512,7 +400,7 @@ class CommandRunner {
|
||||
setLineState(
|
||||
screenId: string,
|
||||
lineId: string,
|
||||
state: T.LineStateType,
|
||||
state: LineStateType,
|
||||
interactive: boolean
|
||||
): Promise<CommandRtnType> {
|
||||
let stateStr = JSON.stringify(state);
|
||||
|
Loading…
Reference in New Issue
Block a user