mirror of
https://github.com/wavetermdev/waveterm.git
synced 2025-01-04 18:59:08 +01:00
replace /model_old imports with /model
This commit is contained in:
parent
24690ff931
commit
3ad7feedad
@ -9,7 +9,7 @@ import { If } from "tsx-control-statements/components";
|
||||
import dayjs from "dayjs";
|
||||
import type { ContextMenuOpts } from "../types/types";
|
||||
import localizedFormat from "dayjs/plugin/localizedFormat";
|
||||
import { GlobalModel } from "../model/model_old";
|
||||
import { GlobalModel } from "../model";
|
||||
import { isBlank } from "../util/util";
|
||||
import { WorkspaceView } from "./workspace/workspaceview";
|
||||
import { PluginsView } from "./pluginsview/pluginsview";
|
||||
@ -32,7 +32,7 @@ class App extends React.Component<{}, {}> {
|
||||
dcWait: OV<boolean> = mobx.observable.box(false, { name: "dcWait" });
|
||||
mainContentRef: React.RefObject<HTMLDivElement> = React.createRef();
|
||||
|
||||
constructor(props: any) {
|
||||
constructor(props: {}) {
|
||||
super(props);
|
||||
if (GlobalModel.isDev) document.body.className = "is-dev";
|
||||
}
|
||||
|
@ -16,3 +16,33 @@ export const LineContainer_Sidebar = "sidebar";
|
||||
export const ConfirmKey_HideShellPrompt = "hideshellprompt";
|
||||
|
||||
export const NoStrPos = -1;
|
||||
|
||||
export const RemotePtyRows = 8; // also in main.tsx
|
||||
export const RemotePtyCols = 80;
|
||||
export const ProdServerEndpoint = "http://127.0.0.1:1619";
|
||||
export const ProdServerWsEndpoint = "ws://127.0.0.1:1623";
|
||||
export const DevServerEndpoint = "http://127.0.0.1:8090";
|
||||
export const DevServerWsEndpoint = "ws://127.0.0.1:8091";
|
||||
export const DefaultTermFontSize = 12;
|
||||
export const MinFontSize = 8;
|
||||
export const MaxFontSize = 24;
|
||||
export const InputChunkSize = 500;
|
||||
export const RemoteColors = ["red", "green", "yellow", "blue", "magenta", "cyan", "white", "orange"];
|
||||
export const TabColors = ["red", "orange", "yellow", "green", "mint", "cyan", "blue", "violet", "pink", "white"];
|
||||
export const TabIcons = [
|
||||
"sparkle",
|
||||
"fire",
|
||||
"ghost",
|
||||
"cloud",
|
||||
"compass",
|
||||
"crown",
|
||||
"droplet",
|
||||
"graduation-cap",
|
||||
"heart",
|
||||
"file",
|
||||
];
|
||||
|
||||
// @ts-ignore
|
||||
export const VERSION = __WAVETERM_VERSION__;
|
||||
// @ts-ignore
|
||||
export const BUILD = __WAVETERM_BUILD__;
|
||||
|
@ -8,7 +8,7 @@ import { boundMethod } from "autobind-decorator";
|
||||
import { If, For } from "tsx-control-statements/components";
|
||||
import cn from "classnames";
|
||||
import type { BookmarkType } from "../../types/types";
|
||||
import { GlobalModel } from "../../model/model_old";
|
||||
import { Model } from "../../model";
|
||||
import { CmdStrCode, Markdown } from "../common/elements";
|
||||
|
||||
import { ReactComponent as XmarkIcon } from "../assets/icons/line/xmark.svg";
|
||||
@ -19,39 +19,50 @@ import { ReactComponent as FavoritesIcon } from "../assets/icons/favourites.svg"
|
||||
|
||||
import "./bookmarks.less";
|
||||
|
||||
type BookmarkProps = {
|
||||
bookmark: BookmarkType;
|
||||
};
|
||||
|
||||
@mobxReact.observer
|
||||
class Bookmark extends React.Component<{ bookmark: BookmarkType }, {}> {
|
||||
class Bookmark extends React.Component<BookmarkProps, {}> {
|
||||
globalModel: Model;
|
||||
|
||||
constructor(props: BookmarkProps) {
|
||||
super(props);
|
||||
this.globalModel = Model.getInstance();
|
||||
}
|
||||
|
||||
@boundMethod
|
||||
handleDeleteClick(): void {
|
||||
let { bookmark } = this.props;
|
||||
let model = GlobalModel.bookmarksModel;
|
||||
let model = this.globalModel.bookmarksModel;
|
||||
model.handleDeleteBookmark(bookmark.bookmarkid);
|
||||
}
|
||||
|
||||
@boundMethod
|
||||
handleEditClick(): void {
|
||||
let { bookmark } = this.props;
|
||||
let model = GlobalModel.bookmarksModel;
|
||||
let model = this.globalModel.bookmarksModel;
|
||||
model.handleEditBookmark(bookmark.bookmarkid);
|
||||
}
|
||||
|
||||
@boundMethod
|
||||
handleEditCancel(): void {
|
||||
let model = GlobalModel.bookmarksModel;
|
||||
let model = this.globalModel.bookmarksModel;
|
||||
model.cancelEdit();
|
||||
return;
|
||||
}
|
||||
|
||||
@boundMethod
|
||||
handleEditUpdate(): void {
|
||||
let model = GlobalModel.bookmarksModel;
|
||||
let model = this.globalModel.bookmarksModel;
|
||||
model.confirmEdit();
|
||||
return;
|
||||
}
|
||||
|
||||
@boundMethod
|
||||
handleDescChange(e: any): void {
|
||||
let model = GlobalModel.bookmarksModel;
|
||||
let model = this.globalModel.bookmarksModel;
|
||||
mobx.action(() => {
|
||||
model.tempDesc.set(e.target.value);
|
||||
})();
|
||||
@ -59,7 +70,7 @@ class Bookmark extends React.Component<{ bookmark: BookmarkType }, {}> {
|
||||
|
||||
@boundMethod
|
||||
handleCmdChange(e: any): void {
|
||||
let model = GlobalModel.bookmarksModel;
|
||||
let model = this.globalModel.bookmarksModel;
|
||||
mobx.action(() => {
|
||||
model.tempCmd.set(e.target.value);
|
||||
})();
|
||||
@ -68,27 +79,27 @@ class Bookmark extends React.Component<{ bookmark: BookmarkType }, {}> {
|
||||
@boundMethod
|
||||
handleClick(): void {
|
||||
let { bookmark } = this.props;
|
||||
let model = GlobalModel.bookmarksModel;
|
||||
let model = this.globalModel.bookmarksModel;
|
||||
model.selectBookmark(bookmark.bookmarkid);
|
||||
}
|
||||
|
||||
@boundMethod
|
||||
handleUse(): void {
|
||||
let { bookmark } = this.props;
|
||||
let model = GlobalModel.bookmarksModel;
|
||||
let model = this.globalModel.bookmarksModel;
|
||||
model.useBookmark(bookmark.bookmarkid);
|
||||
}
|
||||
|
||||
@boundMethod
|
||||
clickCopy(): void {
|
||||
let bm = this.props.bookmark;
|
||||
let model = GlobalModel.bookmarksModel;
|
||||
let model = this.globalModel.bookmarksModel;
|
||||
model.handleCopyBookmark(bm.bookmarkid);
|
||||
}
|
||||
|
||||
render() {
|
||||
let bm = this.props.bookmark;
|
||||
let model = GlobalModel.bookmarksModel;
|
||||
let model = this.globalModel.bookmarksModel;
|
||||
let isSelected = model.activeBookmark.get() == bm.bookmarkid;
|
||||
let markdown = bm.description ?? "";
|
||||
let hasDesc = markdown != "";
|
||||
@ -179,17 +190,24 @@ class Bookmark extends React.Component<{ bookmark: BookmarkType }, {}> {
|
||||
|
||||
@mobxReact.observer
|
||||
class BookmarksView extends React.Component<{}, {}> {
|
||||
globalModel: Model;
|
||||
|
||||
constructor(props: {}) {
|
||||
super(props);
|
||||
this.globalModel = Model.getInstance();
|
||||
}
|
||||
|
||||
@boundMethod
|
||||
closeView(): void {
|
||||
GlobalModel.bookmarksModel.closeView();
|
||||
this.globalModel.bookmarksModel.closeView();
|
||||
}
|
||||
|
||||
render() {
|
||||
let isHidden = GlobalModel.activeMainView.get() != "bookmarks";
|
||||
let isHidden = this.globalModel.activeMainView.get() != "bookmarks";
|
||||
if (isHidden) {
|
||||
return null;
|
||||
}
|
||||
let bookmarks = GlobalModel.bookmarksModel.bookmarks;
|
||||
let bookmarks = this.globalModel.bookmarksModel.bookmarks;
|
||||
let idx: number = 0;
|
||||
let bookmark: BookmarkType = null;
|
||||
return (
|
||||
|
@ -6,24 +6,20 @@ import * as mobxReact from "mobx-react";
|
||||
import * as mobx from "mobx";
|
||||
import { boundMethod } from "autobind-decorator";
|
||||
import cn from "classnames";
|
||||
import { GlobalModel, GlobalCommandRunner, MinFontSize, MaxFontSize, RemotesModel } from "../../model/model_old";
|
||||
import { GlobalModel, GlobalCommandRunner, RemotesModel } from "../../model";
|
||||
import { Toggle, InlineSettingsTextEdit, SettingsError, Dropdown } from "../common/elements";
|
||||
import { CommandRtnType, ClientDataType } from "../../types/types";
|
||||
import * as types from "../../types/types";
|
||||
import { commandRtnHandler, isBlank } from "../../util/util";
|
||||
import * as appconst from "../appconst";
|
||||
|
||||
import "./clientsettings.less";
|
||||
|
||||
type OV<V> = mobx.IObservableValue<V>;
|
||||
|
||||
// @ts-ignore
|
||||
const VERSION = __WAVETERM_VERSION__;
|
||||
// @ts-ignore
|
||||
const BUILD = __WAVETERM_BUILD__;
|
||||
|
||||
@mobxReact.observer
|
||||
class ClientSettingsView extends React.Component<{ model: RemotesModel }, { hoveredItemId: string }> {
|
||||
fontSizeDropdownActive: OV<boolean> = mobx.observable.box(false, { name: "clientSettings-fontSizeDropdownActive" });
|
||||
errorMessage: OV<string> = mobx.observable.box(null, { name: "ClientSettings-errorMessage" });
|
||||
fontSizeDropdownActive: types.OV<boolean> = mobx.observable.box(false, {
|
||||
name: "clientSettings-fontSizeDropdownActive",
|
||||
});
|
||||
errorMessage: types.OV<string> = mobx.observable.box(null, { name: "ClientSettings-errorMessage" });
|
||||
|
||||
@boundMethod
|
||||
dismissError(): void {
|
||||
@ -52,7 +48,7 @@ class ClientSettingsView extends React.Component<{ model: RemotesModel }, { hove
|
||||
|
||||
@boundMethod
|
||||
handleChangeTelemetry(val: boolean): void {
|
||||
let prtn: Promise<CommandRtnType> = null;
|
||||
let prtn: Promise<types.CommandRtnType> = null;
|
||||
if (val) {
|
||||
prtn = GlobalCommandRunner.telemetryOn(false);
|
||||
} else {
|
||||
@ -63,7 +59,7 @@ class ClientSettingsView extends React.Component<{ model: RemotesModel }, { hove
|
||||
|
||||
@boundMethod
|
||||
handleChangeReleaseCheck(val: boolean): void {
|
||||
let prtn: Promise<CommandRtnType> = null;
|
||||
let prtn: Promise<types.CommandRtnType> = null;
|
||||
if (val) {
|
||||
prtn = GlobalCommandRunner.releaseCheckAutoOn(false);
|
||||
} else {
|
||||
@ -74,7 +70,7 @@ class ClientSettingsView extends React.Component<{ model: RemotesModel }, { hove
|
||||
|
||||
getFontSizes(): any {
|
||||
let availableFontSizes: { label: string; value: number }[] = [];
|
||||
for (let s = MinFontSize; s <= MaxFontSize; s++) {
|
||||
for (let s = appconst.MinFontSize; s <= appconst.MaxFontSize; s++) {
|
||||
availableFontSizes.push({ label: s + "px", value: s });
|
||||
}
|
||||
return availableFontSizes;
|
||||
@ -116,7 +112,7 @@ class ClientSettingsView extends React.Component<{ model: RemotesModel }, { hove
|
||||
return null;
|
||||
}
|
||||
|
||||
let cdata: ClientDataType = GlobalModel.clientData.get();
|
||||
let cdata: types.ClientDataType = GlobalModel.clientData.get();
|
||||
let openAIOpts = cdata.openaiopts ?? {};
|
||||
let apiTokenStr = isBlank(openAIOpts.apitoken) ? "(not set)" : "********";
|
||||
let maxTokensStr = String(
|
||||
@ -151,7 +147,7 @@ class ClientSettingsView extends React.Component<{ model: RemotesModel }, { hove
|
||||
<div className="settings-field">
|
||||
<div className="settings-label">Client Version</div>
|
||||
<div className="settings-input">
|
||||
{VERSION} {BUILD}
|
||||
{appconst.VERSION} {appconst.BUILD}
|
||||
</div>
|
||||
</div>
|
||||
<div className="settings-field">
|
||||
|
@ -6,7 +6,7 @@ import * as mobxReact from "mobx-react";
|
||||
import ReactMarkdown from "react-markdown";
|
||||
import remarkGfm from "remark-gfm";
|
||||
import cn from "classnames";
|
||||
import { GlobalModel } from "../../../model/model_old";
|
||||
import { GlobalModel } from "../../../model";
|
||||
|
||||
import "./markdown.less";
|
||||
|
||||
|
@ -6,7 +6,7 @@ import * as mobxReact from "mobx-react";
|
||||
import * as mobx from "mobx";
|
||||
import { boundMethod } from "autobind-decorator";
|
||||
import cn from "classnames";
|
||||
import { GlobalModel, GlobalCommandRunner } from "../../../model/model_old";
|
||||
import { GlobalModel, GlobalCommandRunner } from "../../../model";
|
||||
import { MagicLayout } from "../../magiclayout";
|
||||
|
||||
import "./resizablesidebar.less";
|
||||
|
@ -1,7 +1,7 @@
|
||||
// Copyright 2023, Command Line Inc.
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import { GlobalModel } from "../../../model/model_old";
|
||||
import { GlobalModel } from "../../../model";
|
||||
import * as appconst from "../../appconst";
|
||||
|
||||
function ShowWaveShellInstallPrompt(callbackFn: () => void) {
|
||||
|
@ -5,18 +5,14 @@ import * as React from "react";
|
||||
import * as mobxReact from "mobx-react";
|
||||
import * as mobx from "mobx";
|
||||
import { boundMethod } from "autobind-decorator";
|
||||
import { GlobalModel } from "../../../model/model_old";
|
||||
import { GlobalModel } from "../../../model";
|
||||
import { Modal, LinkButton } from "../elements";
|
||||
import * as util from "../../../util/util";
|
||||
import * as appconst from "../../appconst";
|
||||
|
||||
import logo from "../../assets/waveterm-logo-with-bg.svg";
|
||||
import "./about.less";
|
||||
|
||||
// @ts-ignore
|
||||
const VERSION = __WAVETERM_VERSION__;
|
||||
// @ts-ignore
|
||||
let BUILD = __WAVETERM_BUILD__;
|
||||
|
||||
@mobxReact.observer
|
||||
class AboutModal extends React.Component<{}, {}> {
|
||||
@boundMethod
|
||||
@ -42,7 +38,7 @@ class AboutModal extends React.Component<{}, {}> {
|
||||
return (
|
||||
<div className="status updated">
|
||||
<div className="text-selectable">
|
||||
Client Version {VERSION} ({BUILD})
|
||||
Client Version {appconst.VERSION} ({appconst.BUILD})
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
@ -55,7 +51,7 @@ class AboutModal extends React.Component<{}, {}> {
|
||||
<span>Up to Date</span>
|
||||
</div>
|
||||
<div className="selectable">
|
||||
Client Version {VERSION} ({BUILD})
|
||||
Client Version {appconst.VERSION} ({appconst.BUILD})
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
@ -67,7 +63,7 @@ class AboutModal extends React.Component<{}, {}> {
|
||||
<span>Outdated Version</span>
|
||||
</div>
|
||||
<div className="selectable">
|
||||
Client Version {VERSION} ({BUILD})
|
||||
Client Version {appconst.VERSION} ({appconst.BUILD})
|
||||
</div>
|
||||
<div>
|
||||
<button onClick={this.updateApp} className="button color-green text-secondary">
|
||||
|
@ -6,7 +6,7 @@ import * as mobxReact from "mobx-react";
|
||||
import { boundMethod } from "autobind-decorator";
|
||||
import { If } from "tsx-control-statements/components";
|
||||
import { Markdown, Modal, Button, Checkbox } from "../elements";
|
||||
import { GlobalModel, GlobalCommandRunner } from "../../../model/model_old";
|
||||
import { GlobalModel, GlobalCommandRunner } from "../../../model";
|
||||
|
||||
import "./alert.less";
|
||||
|
||||
|
@ -5,7 +5,7 @@ import * as React from "react";
|
||||
import * as mobxReact from "mobx-react";
|
||||
import { boundMethod } from "autobind-decorator";
|
||||
import { If } from "tsx-control-statements/components";
|
||||
import { GlobalModel } from "../../../model/model_old";
|
||||
import { GlobalModel } from "../../../model";
|
||||
import { Modal, Button } from "../elements";
|
||||
|
||||
import "./clientstop.less";
|
||||
|
@ -6,7 +6,7 @@ import * as mobxReact from "mobx-react";
|
||||
import * as mobx from "mobx";
|
||||
import { boundMethod } from "autobind-decorator";
|
||||
import { If } from "tsx-control-statements/components";
|
||||
import { GlobalModel, GlobalCommandRunner, RemotesModel } from "../../../model/model_old";
|
||||
import { GlobalModel, GlobalCommandRunner, RemotesModel } from "../../../model";
|
||||
import * as T from "../../../types/types";
|
||||
import {
|
||||
Modal,
|
||||
|
@ -5,7 +5,7 @@ import * as React from "react";
|
||||
import * as mobxReact from "mobx-react";
|
||||
import * as mobx from "mobx";
|
||||
import { boundMethod } from "autobind-decorator";
|
||||
import { GlobalModel } from "../../../model/model_old";
|
||||
import { GlobalModel } from "../../../model";
|
||||
import { Modal, Button } from "../elements";
|
||||
|
||||
import "./disconnected.less";
|
||||
|
@ -6,7 +6,7 @@ import * as mobxReact from "mobx-react";
|
||||
import * as mobx from "mobx";
|
||||
import { If } from "tsx-control-statements/components";
|
||||
import { boundMethod } from "autobind-decorator";
|
||||
import { GlobalModel, GlobalCommandRunner, RemotesModel } from "../../../model/model_old";
|
||||
import { GlobalModel, GlobalCommandRunner, RemotesModel } from "../../../model";
|
||||
import * as T from "../../../types/types";
|
||||
import { Modal, TextField, InputDecoration, Dropdown, PasswordField, Tooltip } from "../elements";
|
||||
import * as util from "../../../util/util";
|
||||
|
@ -5,7 +5,7 @@ import * as React from "react";
|
||||
import * as mobxReact from "mobx-react";
|
||||
import * as mobx from "mobx";
|
||||
import { boundMethod } from "autobind-decorator";
|
||||
import { GlobalModel, GlobalCommandRunner } from "../../../model/model_old";
|
||||
import { GlobalModel, GlobalCommandRunner } from "../../../model";
|
||||
import { SettingsError, Modal, Dropdown } from "../elements";
|
||||
import { LineType, RendererPluginType } from "../../../types/types";
|
||||
import { PluginModel } from "../../../plugins/plugins";
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
import * as React from "react";
|
||||
import * as mobxReact from "mobx-react";
|
||||
import { GlobalModel } from "../../../model/model_old";
|
||||
import { GlobalModel } from "../../../model";
|
||||
import { TosModal } from "./tos";
|
||||
|
||||
@mobxReact.observer
|
||||
|
@ -7,7 +7,7 @@ import * as mobx from "mobx";
|
||||
import { boundMethod } from "autobind-decorator";
|
||||
import { If, For } from "tsx-control-statements/components";
|
||||
import cn from "classnames";
|
||||
import { GlobalModel, GlobalCommandRunner, TabColors, TabIcons, Screen } from "../../../model/model_old";
|
||||
import { GlobalModel, GlobalCommandRunner, Screen } from "../../../model";
|
||||
import { Toggle, InlineSettingsTextEdit, SettingsError, Modal, Dropdown, Tooltip } from "../elements";
|
||||
import { RemoteType } from "../../../types/types";
|
||||
import * as util from "../../../util/util";
|
||||
@ -15,6 +15,7 @@ import { commandRtnHandler } from "../../../util/util";
|
||||
import { ReactComponent as SquareIcon } from "../../assets/icons/tab/square.svg";
|
||||
import { ReactComponent as GlobeIcon } from "../../assets/icons/globe.svg";
|
||||
import { ReactComponent as StatusCircleIcon } from "../../assets/icons/statuscircle.svg";
|
||||
import * as appconst from "../../appconst";
|
||||
|
||||
import "./screensettings.less";
|
||||
|
||||
@ -281,7 +282,7 @@ class ScreenSettingsModal extends React.Component<{}, {}> {
|
||||
<span className="tab-color-name">{screen.getTabColor()}</span>
|
||||
</div>
|
||||
<div className="tab-color-sep">|</div>
|
||||
<For each="color" of={TabColors}>
|
||||
<For each="color" of={appconst.TabColors}>
|
||||
<div
|
||||
key={color}
|
||||
className="tab-color-select"
|
||||
@ -307,7 +308,7 @@ class ScreenSettingsModal extends React.Component<{}, {}> {
|
||||
<span className="tab-icon-name">{screen.getTabIcon()}</span>
|
||||
</div>
|
||||
<div className="tab-icon-sep">|</div>
|
||||
<For each="icon" index="index" of={TabIcons}>
|
||||
<For each="icon" index="index" of={appconst.TabIcons}>
|
||||
<div
|
||||
key={`${color}-${index}`}
|
||||
className="tab-icon-select"
|
||||
|
@ -5,7 +5,7 @@ import * as React from "react";
|
||||
import * as mobxReact from "mobx-react";
|
||||
import * as mobx from "mobx";
|
||||
import { boundMethod } from "autobind-decorator";
|
||||
import { GlobalModel, GlobalCommandRunner, Session } from "../../../model/model_old";
|
||||
import { GlobalModel, GlobalCommandRunner, Session } from "../../../model";
|
||||
import { Toggle, InlineSettingsTextEdit, SettingsError, Modal, Tooltip } from "../elements";
|
||||
import * as util from "../../../util/util";
|
||||
import { commandRtnHandler } from "../../../util/util";
|
||||
|
@ -7,10 +7,10 @@ import * as mobx from "mobx";
|
||||
import { boundMethod } from "autobind-decorator";
|
||||
import { For } from "tsx-control-statements/components";
|
||||
import cn from "classnames";
|
||||
import { GlobalModel, GlobalCommandRunner } from "../../../model/model_old";
|
||||
import { GlobalModel, GlobalCommandRunner } from "../../../model";
|
||||
import { Modal, TextField, InputDecoration, Tooltip } from "../elements";
|
||||
import * as util from "../../../util/util";
|
||||
import { Screen } from "../../../model/model_old";
|
||||
import { Screen } from "../../../model";
|
||||
import { ReactComponent as SquareIcon } from "../../assets/icons/tab/square.svg";
|
||||
|
||||
import "./tabswitcher.less";
|
||||
|
@ -4,7 +4,7 @@
|
||||
import * as React from "react";
|
||||
import * as mobxReact from "mobx-react";
|
||||
import { boundMethod } from "autobind-decorator";
|
||||
import { GlobalModel, GlobalCommandRunner } from "../../../model/model_old";
|
||||
import { GlobalModel, GlobalCommandRunner } from "../../../model";
|
||||
import { Toggle, Modal, Button } from "../elements";
|
||||
import * as util from "../../../util/util";
|
||||
import { ClientDataType } from "../../../types/types";
|
||||
|
@ -7,7 +7,7 @@ import * as mobx from "mobx";
|
||||
import { boundMethod } from "autobind-decorator";
|
||||
import { If, For } from "tsx-control-statements/components";
|
||||
import cn from "classnames";
|
||||
import { GlobalModel, GlobalCommandRunner, RemotesModel } from "../../../model/model_old";
|
||||
import { GlobalModel, GlobalCommandRunner, RemotesModel } from "../../../model";
|
||||
import * as T from "../../../types/types";
|
||||
import { Modal, Tooltip, Button, Status } from "../elements";
|
||||
import * as util from "../../../util/util";
|
||||
|
@ -6,7 +6,7 @@ import * as mobxReact from "mobx-react";
|
||||
import * as mobx from "mobx";
|
||||
import dayjs from "dayjs";
|
||||
import localizedFormat from "dayjs/plugin/localizedFormat";
|
||||
import { GlobalModel, LineContainerModel } from "../../../model/model_old";
|
||||
import { GlobalModel, LineContainerModel } from "../../../model";
|
||||
import type { LineType, RemoteType, RemotePtrType, LineHeightChangeCallbackType } from "../../../types/types";
|
||||
import cn from "classnames";
|
||||
import { isBlank } from "../../../util/util";
|
||||
|
@ -7,7 +7,7 @@ import * as mobx from "mobx";
|
||||
import { boundMethod } from "autobind-decorator";
|
||||
import { If, For } from "tsx-control-statements/components";
|
||||
import cn from "classnames";
|
||||
import { GlobalModel, RemotesModel, GlobalCommandRunner } from "../../model/model_old";
|
||||
import { GlobalModel, RemotesModel, GlobalCommandRunner } from "../../model";
|
||||
import { Button, Status, ShowWaveShellInstallPrompt } from "../common/elements";
|
||||
import * as T from "../../types/types";
|
||||
import * as util from "../../util/util";
|
||||
|
@ -8,7 +8,7 @@ import { If, For } from "tsx-control-statements/components";
|
||||
import { sprintf } from "sprintf-js";
|
||||
import { boundMethod } from "autobind-decorator";
|
||||
import cn from "classnames";
|
||||
import { GlobalModel, GlobalCommandRunner, Cmd } from "../../model/model_old";
|
||||
import { GlobalModel, GlobalCommandRunner, Cmd } from "../../model";
|
||||
import { HistoryItem, RemotePtrType, LineType, CmdDataType } from "../../types/types";
|
||||
import dayjs from "dayjs";
|
||||
import localizedFormat from "dayjs/plugin/localizedFormat";
|
||||
|
@ -9,7 +9,7 @@ import { boundMethod } from "autobind-decorator";
|
||||
import dayjs from "dayjs";
|
||||
import localizedFormat from "dayjs/plugin/localizedFormat";
|
||||
import { If } from "tsx-control-statements/components";
|
||||
import { GlobalModel, GlobalCommandRunner, Cmd, getTermPtyData } from "../../model/model_old";
|
||||
import { GlobalModel, GlobalCommandRunner, Cmd } from "../../model";
|
||||
import { termHeightFromRows } from "../../util/textmeasure";
|
||||
import type {
|
||||
LineType,
|
||||
@ -19,10 +19,11 @@ import type {
|
||||
LineHeightChangeCallbackType,
|
||||
RendererModelInitializeParams,
|
||||
RendererModel,
|
||||
LineContainerType,
|
||||
} from "../../types/types";
|
||||
import cn from "classnames";
|
||||
import { getTermPtyData } from "../../util/modelutil";
|
||||
|
||||
import type { LineContainerModel } from "../../model/model_old";
|
||||
import { renderCmdText } from "../common/elements";
|
||||
import { SimpleBlobRenderer } from "../../plugins/core/basicrenderer";
|
||||
import { IncrementalRenderer } from "../../plugins/core/incrementalrenderer";
|
||||
@ -101,7 +102,7 @@ class SmallLineAvatar extends React.Component<{ line: LineType; cmd: Cmd; onRigh
|
||||
@mobxReact.observer
|
||||
class LineCmd extends React.Component<
|
||||
{
|
||||
screen: LineContainerModel;
|
||||
screen: LineContainerType;
|
||||
line: LineType;
|
||||
width: number;
|
||||
staticRender: boolean;
|
||||
@ -799,7 +800,7 @@ class LineCmd extends React.Component<
|
||||
@mobxReact.observer
|
||||
class Line extends React.Component<
|
||||
{
|
||||
screen: LineContainerModel;
|
||||
screen: LineContainerType;
|
||||
line: LineType;
|
||||
width: number;
|
||||
staticRender: boolean;
|
||||
@ -830,7 +831,7 @@ class Line extends React.Component<
|
||||
@mobxReact.observer
|
||||
class LineText extends React.Component<
|
||||
{
|
||||
screen: LineContainerModel;
|
||||
screen: LineContainerType;
|
||||
line: LineType;
|
||||
renderMode: RenderModeType;
|
||||
noSelect?: boolean;
|
||||
|
@ -25,7 +25,7 @@ import type {
|
||||
} from "../../../types/types";
|
||||
import { debounce } from "throttle-debounce";
|
||||
import * as util from "../../../util/util";
|
||||
import { GlobalModel } from "../../../model/model_old";
|
||||
import { GlobalModel } from "../../../model";
|
||||
|
||||
type OV<V> = mobx.IObservableValue<V>;
|
||||
type CV<V> = mobx.IComputedValue<V>;
|
||||
|
@ -5,7 +5,7 @@ import * as React from "react";
|
||||
import * as mobxReact from "mobx-react";
|
||||
import * as mobx from "mobx";
|
||||
import { boundMethod } from "autobind-decorator";
|
||||
import { GlobalModel } from "../../model/model_old";
|
||||
import { GlobalModel } from "../../model";
|
||||
import { PluginModel } from "../../plugins/plugins";
|
||||
import { Markdown } from "../common/elements";
|
||||
|
||||
|
@ -17,10 +17,10 @@ import { ReactComponent as WorkspacesIcon } from "../assets/icons/workspaces.svg
|
||||
import { ReactComponent as SettingsIcon } from "../assets/icons/settings.svg";
|
||||
|
||||
import localizedFormat from "dayjs/plugin/localizedFormat";
|
||||
import { GlobalModel, GlobalCommandRunner, Session, VERSION } from "../../model/model_old";
|
||||
import { GlobalModel, GlobalCommandRunner, Session } from "../../model";
|
||||
import { isBlank, openLink } from "../../util/util";
|
||||
import { ResizableSidebar } from "../common/elements";
|
||||
import * as constants from "../appconst";
|
||||
import * as appconst from "../appconst";
|
||||
|
||||
import "./sidebar.less";
|
||||
import { ActionsIcon, CenteredIcon, FrontIcon, StatusIndicator } from "../common/icons/icons";
|
||||
@ -167,7 +167,7 @@ class MainSideBar extends React.Component<MainSideBarProps, {}> {
|
||||
mobx.action(() => {
|
||||
GlobalModel.sessionSettingsModal.set(session.sessionId);
|
||||
})();
|
||||
GlobalModel.modalsModel.pushModal(constants.SESSION_SETTINGS);
|
||||
GlobalModel.modalsModel.pushModal(appconst.SESSION_SETTINGS);
|
||||
}
|
||||
|
||||
getSessions() {
|
||||
@ -208,7 +208,7 @@ class MainSideBar extends React.Component<MainSideBarProps, {}> {
|
||||
let clientData = this.props.clientData;
|
||||
let needsUpdate = false;
|
||||
if (!clientData?.clientopts.noreleasecheck && !isBlank(clientData?.releaseinfo?.latestversion)) {
|
||||
needsUpdate = compareLoose(VERSION, clientData.releaseinfo.latestversion) < 0;
|
||||
needsUpdate = compareLoose(appconst.VERSION, clientData.releaseinfo.latestversion) < 0;
|
||||
}
|
||||
let mainSidebar = GlobalModel.mainSidebarModel;
|
||||
let isCollapsed = mainSidebar.getCollapsed();
|
||||
|
@ -4,7 +4,7 @@
|
||||
import * as React from "react";
|
||||
import * as mobxReact from "mobx-react";
|
||||
import * as mobx from "mobx";
|
||||
import { GlobalModel } from "../../../model/model_old";
|
||||
import { GlobalModel } from "../../../model";
|
||||
import { isBlank } from "../../../util/util";
|
||||
import { boundMethod } from "autobind-decorator";
|
||||
import cn from "classnames";
|
||||
|
@ -10,7 +10,7 @@ import cn from "classnames";
|
||||
import dayjs from "dayjs";
|
||||
import type { RemoteType, RemoteInstanceType, RemotePtrType } from "../../../types/types";
|
||||
import localizedFormat from "dayjs/plugin/localizedFormat";
|
||||
import { GlobalModel, GlobalCommandRunner, Screen } from "../../../model/model_old";
|
||||
import { GlobalModel, GlobalCommandRunner, Screen } from "../../../model";
|
||||
import { renderCmdText } from "../../common/elements";
|
||||
import { TextAreaInput } from "./textareainput";
|
||||
import { InfoMsg } from "./infomsg";
|
||||
|
@ -11,7 +11,7 @@ import cn from "classnames";
|
||||
import dayjs from "dayjs";
|
||||
import type { HistoryItem, HistoryQueryOpts } from "../../../types/types";
|
||||
import localizedFormat from "dayjs/plugin/localizedFormat";
|
||||
import { GlobalModel } from "../../../model/model_old";
|
||||
import { GlobalModel } from "../../../model";
|
||||
import { isBlank } from "../../../util/util";
|
||||
|
||||
dayjs.extend(localizedFormat);
|
||||
|
@ -7,7 +7,7 @@ import { If, For } from "tsx-control-statements/components";
|
||||
import cn from "classnames";
|
||||
import dayjs from "dayjs";
|
||||
import localizedFormat from "dayjs/plugin/localizedFormat";
|
||||
import { GlobalModel } from "../../../model/model_old";
|
||||
import { GlobalModel } from "../../../model";
|
||||
import { makeExternLink } from "../../../util/util";
|
||||
|
||||
dayjs.extend(localizedFormat);
|
||||
|
@ -9,7 +9,7 @@ import * as util from "../../../util/util";
|
||||
import { If } from "tsx-control-statements/components";
|
||||
import { boundMethod } from "autobind-decorator";
|
||||
import cn from "classnames";
|
||||
import { GlobalModel, GlobalCommandRunner, Screen } from "../../../model/model_old";
|
||||
import { GlobalModel, GlobalCommandRunner, Screen } from "../../../model";
|
||||
import { getMonoFontSize } from "../../../util/textmeasure";
|
||||
import { isModKeyPress, hasNoModifiers } from "../../../util/util";
|
||||
import * as appconst from "../../appconst";
|
||||
|
@ -10,16 +10,7 @@ import { If, For } from "tsx-control-statements/components";
|
||||
import cn from "classnames";
|
||||
import { debounce } from "throttle-debounce";
|
||||
import dayjs from "dayjs";
|
||||
import {
|
||||
GlobalCommandRunner,
|
||||
TabColors,
|
||||
TabIcons,
|
||||
ForwardLineContainer,
|
||||
GlobalModel,
|
||||
ScreenLines,
|
||||
Screen,
|
||||
Session,
|
||||
} from "../../../model/model_old";
|
||||
import { GlobalCommandRunner, ForwardLineContainer, GlobalModel, ScreenLines, Screen, Session } from "../../../model";
|
||||
import type { LineType, RenderModeType, LineFactoryProps } from "../../../types/types";
|
||||
import * as T from "../../../types/types";
|
||||
import localizedFormat from "dayjs/plugin/localizedFormat";
|
||||
@ -442,7 +433,7 @@ class NewTabSettings extends React.Component<{ screen: Screen }, {}> {
|
||||
<div key="square" className="icondiv" title="square" onClick={() => this.selectTabIcon("square")}>
|
||||
<SquareIcon className="icon square-icon" />
|
||||
</div>
|
||||
<For each="icon" of={TabIcons}>
|
||||
<For each="icon" of={appconst.TabIcons}>
|
||||
<div
|
||||
className="icondiv tabicon"
|
||||
key={icon}
|
||||
@ -469,7 +460,7 @@ class NewTabSettings extends React.Component<{ screen: Screen }, {}> {
|
||||
<>
|
||||
<div className="text-s1 unselectable">Select the color</div>
|
||||
<div className="control-iconlist">
|
||||
<For each="color" of={TabColors}>
|
||||
<For each="color" of={appconst.TabColors}>
|
||||
<div
|
||||
className="icondiv"
|
||||
key={color}
|
||||
|
@ -6,7 +6,7 @@ import * as mobxReact from "mobx-react";
|
||||
import * as mobx from "mobx";
|
||||
import { boundMethod } from "autobind-decorator";
|
||||
import cn from "classnames";
|
||||
import { GlobalModel, GlobalCommandRunner, Screen } from "../../../model/model_old";
|
||||
import { GlobalModel, GlobalCommandRunner, Screen } from "../../../model";
|
||||
import { ActionsIcon, StatusIndicator, CenteredIcon } from "../../common/icons/icons";
|
||||
import { renderCmdText } from "../../common/elements";
|
||||
import { ReactComponent as SquareIcon } from "../../assets/icons/tab/square.svg";
|
||||
|
@ -7,7 +7,7 @@ import * as mobx from "mobx";
|
||||
import { sprintf } from "sprintf-js";
|
||||
import { boundMethod } from "autobind-decorator";
|
||||
import { For } from "tsx-control-statements/components";
|
||||
import { GlobalModel, GlobalCommandRunner, Session, Screen } from "../../../model/model_old";
|
||||
import { GlobalModel, GlobalCommandRunner, Session, Screen } from "../../../model";
|
||||
import { ReactComponent as AddIcon } from "../../assets/icons/add.svg";
|
||||
import { Reorder } from "framer-motion";
|
||||
import { ScreenTab } from "./tab";
|
||||
|
@ -7,7 +7,7 @@ import * as mobx from "mobx";
|
||||
import cn from "classnames";
|
||||
import dayjs from "dayjs";
|
||||
import localizedFormat from "dayjs/plugin/localizedFormat";
|
||||
import { GlobalModel } from "../../model/model_old";
|
||||
import { GlobalModel } from "../../model";
|
||||
import { CmdInput } from "./cmdinput/cmdinput";
|
||||
import { ScreenView } from "./screen/screenview";
|
||||
import { ScreenTabs } from "./screen/tabs";
|
||||
|
@ -8,7 +8,7 @@ import { genMergeSimpleData } from "../util/util";
|
||||
import { BookmarkType } from "../types/types";
|
||||
import { checkKeyPressed, adaptFromReactOrNativeKeyEvent } from "../util/keyutil";
|
||||
import { OV, OArr } from "../types/types";
|
||||
import { CommandRunner } from "./commandrunner";
|
||||
import { CommandRunner } from "./model";
|
||||
import { Model } from "./model";
|
||||
|
||||
class BookmarksModel {
|
||||
|
@ -1,437 +0,0 @@
|
||||
// Copyright 2023, Command Line Inc.
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import * as mobx from "mobx";
|
||||
import { RendererContext, HistorySearchParams, CommandRtnType } from "../types/types";
|
||||
import { LineStateType } from "../types/types";
|
||||
import { Model } from "./model";
|
||||
|
||||
class CommandRunner {
|
||||
globalModel: Model;
|
||||
|
||||
private constructor(globalModel: Model) {
|
||||
this.globalModel = globalModel;
|
||||
}
|
||||
|
||||
static getInstance() {
|
||||
if (!(window as any).GlobalCommandRunner) {
|
||||
const globalModel = Model.getInstance();
|
||||
(window as any).GlobalCommandRunner = new CommandRunner(globalModel);
|
||||
}
|
||||
return (window as any).GlobalCommandRunner;
|
||||
}
|
||||
|
||||
loadHistory(show: boolean, htype: string) {
|
||||
let kwargs = { nohist: "1" };
|
||||
if (!show) {
|
||||
kwargs["noshow"] = "1";
|
||||
}
|
||||
if (htype != null && htype != "screen") {
|
||||
kwargs["type"] = htype;
|
||||
}
|
||||
this.globalModel.submitCommand("history", null, null, kwargs, true);
|
||||
}
|
||||
|
||||
resetShellState() {
|
||||
this.globalModel.submitCommand("reset", null, null, null, true);
|
||||
}
|
||||
|
||||
historyPurgeLines(lines: string[]): Promise<CommandRtnType> {
|
||||
let prtn = this.globalModel.submitCommand("history", "purge", lines, { nohist: "1" }, false);
|
||||
return prtn;
|
||||
}
|
||||
|
||||
switchSession(session: string) {
|
||||
mobx.action(() => {
|
||||
this.globalModel.activeMainView.set("session");
|
||||
})();
|
||||
this.globalModel.submitCommand("session", null, [session], { nohist: "1" }, false);
|
||||
}
|
||||
|
||||
switchScreen(screen: string, session?: string) {
|
||||
mobx.action(() => {
|
||||
this.globalModel.activeMainView.set("session");
|
||||
})();
|
||||
let kwargs = { nohist: "1" };
|
||||
if (session != null) {
|
||||
kwargs["session"] = session;
|
||||
}
|
||||
this.globalModel.submitCommand("screen", null, [screen], kwargs, false);
|
||||
}
|
||||
|
||||
lineView(sessionId: string, screenId: string, lineNum?: number) {
|
||||
let screen = this.globalModel.getScreenById(sessionId, screenId);
|
||||
if (screen != null && lineNum != null) {
|
||||
screen.setAnchorFields(lineNum, 0, "line:view");
|
||||
}
|
||||
let lineNumStr = lineNum == null || lineNum == 0 ? "E" : String(lineNum);
|
||||
this.globalModel.submitCommand("line", "view", [sessionId, screenId, lineNumStr], { nohist: "1" }, false);
|
||||
}
|
||||
|
||||
lineArchive(lineArg: string, archive: boolean): Promise<CommandRtnType> {
|
||||
let kwargs = { nohist: "1" };
|
||||
let archiveStr = archive ? "1" : "0";
|
||||
return this.globalModel.submitCommand("line", "archive", [lineArg, archiveStr], kwargs, false);
|
||||
}
|
||||
|
||||
lineDelete(lineArg: string, interactive: boolean): Promise<CommandRtnType> {
|
||||
return this.globalModel.submitCommand("line", "delete", [lineArg], { nohist: "1" }, interactive);
|
||||
}
|
||||
|
||||
lineRestart(lineArg: string, interactive: boolean): Promise<CommandRtnType> {
|
||||
return this.globalModel.submitCommand("line", "restart", [lineArg], { nohist: "1" }, interactive);
|
||||
}
|
||||
|
||||
lineSet(lineArg: string, opts: { renderer?: string }): Promise<CommandRtnType> {
|
||||
let kwargs = { nohist: "1" };
|
||||
if ("renderer" in opts) {
|
||||
kwargs["renderer"] = opts.renderer ?? "";
|
||||
}
|
||||
return this.globalModel.submitCommand("line", "set", [lineArg], kwargs, false);
|
||||
}
|
||||
|
||||
createNewSession() {
|
||||
this.globalModel.submitCommand("session", "open", null, { nohist: "1" }, false);
|
||||
}
|
||||
|
||||
createNewScreen() {
|
||||
this.globalModel.submitCommand("screen", "open", null, { nohist: "1" }, false);
|
||||
}
|
||||
|
||||
closeScreen(screen: string) {
|
||||
this.globalModel.submitCommand("screen", "close", [screen], { nohist: "1" }, false);
|
||||
}
|
||||
|
||||
// include is lineIds to include, exclude is lineIds to exclude
|
||||
// if include is given then it *only* does those ids. if exclude is given (or not),
|
||||
// it does all running commands in the screen except for excluded.
|
||||
resizeScreen(screenId: string, rows: number, cols: number, opts?: { include?: string[]; exclude?: string[] }) {
|
||||
let kwargs: Record<string, string> = {
|
||||
nohist: "1",
|
||||
screen: screenId,
|
||||
cols: String(cols),
|
||||
rows: String(rows),
|
||||
};
|
||||
if (opts?.include != null && opts?.include.length > 0) {
|
||||
kwargs.include = opts.include.join(",");
|
||||
}
|
||||
if (opts?.exclude != null && opts?.exclude.length > 0) {
|
||||
kwargs.exclude = opts.exclude.join(",");
|
||||
}
|
||||
this.globalModel.submitCommand("screen", "resize", null, kwargs, false);
|
||||
}
|
||||
|
||||
screenArchive(screenId: string, shouldArchive: boolean): Promise<CommandRtnType> {
|
||||
return this.globalModel.submitCommand(
|
||||
"screen",
|
||||
"archive",
|
||||
[screenId, shouldArchive ? "1" : "0"],
|
||||
{ nohist: "1" },
|
||||
false
|
||||
);
|
||||
}
|
||||
|
||||
screenDelete(screenId: string, interactive: boolean): Promise<CommandRtnType> {
|
||||
return this.globalModel.submitCommand("screen", "delete", [screenId], { nohist: "1" }, interactive);
|
||||
}
|
||||
|
||||
screenWebShare(screenId: string, shouldShare: boolean): Promise<CommandRtnType> {
|
||||
let kwargs: Record<string, string> = { nohist: "1" };
|
||||
kwargs["screen"] = screenId;
|
||||
return this.globalModel.submitCommand("screen", "webshare", [shouldShare ? "1" : "0"], kwargs, false);
|
||||
}
|
||||
|
||||
showRemote(remoteid: string) {
|
||||
this.globalModel.submitCommand("remote", "show", null, { nohist: "1", remote: remoteid }, true);
|
||||
}
|
||||
|
||||
showAllRemotes() {
|
||||
this.globalModel.submitCommand("remote", "showall", null, { nohist: "1" }, true);
|
||||
}
|
||||
|
||||
connectRemote(remoteid: string) {
|
||||
this.globalModel.submitCommand("remote", "connect", null, { nohist: "1", remote: remoteid }, true);
|
||||
}
|
||||
|
||||
disconnectRemote(remoteid: string) {
|
||||
this.globalModel.submitCommand("remote", "disconnect", null, { nohist: "1", remote: remoteid }, true);
|
||||
}
|
||||
|
||||
installRemote(remoteid: string) {
|
||||
this.globalModel.submitCommand("remote", "install", null, { nohist: "1", remote: remoteid }, true);
|
||||
}
|
||||
|
||||
installCancelRemote(remoteid: string) {
|
||||
this.globalModel.submitCommand("remote", "installcancel", null, { nohist: "1", remote: remoteid }, true);
|
||||
}
|
||||
|
||||
createRemote(cname: string, kwargsArg: Record<string, string>, interactive: boolean): Promise<CommandRtnType> {
|
||||
let kwargs = Object.assign({}, kwargsArg);
|
||||
kwargs["nohist"] = "1";
|
||||
return this.globalModel.submitCommand("remote", "new", [cname], kwargs, interactive);
|
||||
}
|
||||
|
||||
openCreateRemote(): void {
|
||||
this.globalModel.submitCommand("remote", "new", null, { nohist: "1", visual: "1" }, true);
|
||||
}
|
||||
|
||||
screenSetRemote(remoteArg: string, nohist: boolean, interactive: boolean): Promise<CommandRtnType> {
|
||||
let kwargs = {};
|
||||
if (nohist) {
|
||||
kwargs["nohist"] = "1";
|
||||
}
|
||||
return this.globalModel.submitCommand("connect", null, [remoteArg], kwargs, interactive);
|
||||
}
|
||||
|
||||
editRemote(remoteid: string, kwargsArg: Record<string, string>): void {
|
||||
let kwargs = Object.assign({}, kwargsArg);
|
||||
kwargs["nohist"] = "1";
|
||||
kwargs["remote"] = remoteid;
|
||||
this.globalModel.submitCommand("remote", "set", null, kwargs, true);
|
||||
}
|
||||
|
||||
openEditRemote(remoteid: string): void {
|
||||
this.globalModel.submitCommand("remote", "set", null, { remote: remoteid, nohist: "1", visual: "1" }, true);
|
||||
}
|
||||
|
||||
archiveRemote(remoteid: string) {
|
||||
this.globalModel.submitCommand("remote", "archive", null, { remote: remoteid, nohist: "1" }, true);
|
||||
}
|
||||
|
||||
importSshConfig() {
|
||||
this.globalModel.submitCommand("remote", "parse", null, { nohist: "1", visual: "1" }, true);
|
||||
}
|
||||
|
||||
screenSelectLine(lineArg: string, focusVal?: string) {
|
||||
let kwargs: Record<string, string> = {
|
||||
nohist: "1",
|
||||
line: lineArg,
|
||||
};
|
||||
if (focusVal != null) {
|
||||
kwargs["focus"] = focusVal;
|
||||
}
|
||||
this.globalModel.submitCommand("screen", "set", null, kwargs, false);
|
||||
}
|
||||
|
||||
screenReorder(screenId: string, index: string) {
|
||||
let kwargs: Record<string, string> = {
|
||||
nohist: "1",
|
||||
screenId: screenId,
|
||||
index: index,
|
||||
};
|
||||
this.globalModel.submitCommand("screen", "reorder", null, kwargs, false);
|
||||
}
|
||||
|
||||
setTermUsedRows(termContext: RendererContext, height: number) {
|
||||
let kwargs: Record<string, string> = {};
|
||||
kwargs["screen"] = termContext.screenId;
|
||||
kwargs["hohist"] = "1";
|
||||
let posargs = [String(termContext.lineNum), String(height)];
|
||||
this.globalModel.submitCommand("line", "setheight", posargs, kwargs, false);
|
||||
}
|
||||
|
||||
screenSetAnchor(sessionId: string, screenId: string, anchorVal: string): void {
|
||||
let kwargs = {
|
||||
nohist: "1",
|
||||
anchor: anchorVal,
|
||||
session: sessionId,
|
||||
screen: screenId,
|
||||
};
|
||||
this.globalModel.submitCommand("screen", "set", null, kwargs, false);
|
||||
}
|
||||
|
||||
screenSetFocus(focusVal: string): void {
|
||||
this.globalModel.submitCommand("screen", "set", null, { focus: focusVal, nohist: "1" }, false);
|
||||
}
|
||||
|
||||
screenSetSettings(
|
||||
screenId: string,
|
||||
settings: { tabcolor?: string; tabicon?: string; name?: string; sharename?: string },
|
||||
interactive: boolean
|
||||
): Promise<CommandRtnType> {
|
||||
let kwargs: { [key: string]: any } = Object.assign({}, settings);
|
||||
kwargs["nohist"] = "1";
|
||||
kwargs["screen"] = screenId;
|
||||
return this.globalModel.submitCommand("screen", "set", null, kwargs, interactive);
|
||||
}
|
||||
|
||||
sessionArchive(sessionId: string, shouldArchive: boolean): Promise<CommandRtnType> {
|
||||
return this.globalModel.submitCommand(
|
||||
"session",
|
||||
"archive",
|
||||
[sessionId, shouldArchive ? "1" : "0"],
|
||||
{ nohist: "1" },
|
||||
false
|
||||
);
|
||||
}
|
||||
|
||||
sessionDelete(sessionId: string): Promise<CommandRtnType> {
|
||||
return this.globalModel.submitCommand("session", "delete", [sessionId], { nohist: "1" }, false);
|
||||
}
|
||||
|
||||
sessionSetSettings(sessionId: string, settings: { name?: string }, interactive: boolean): Promise<CommandRtnType> {
|
||||
let kwargs = Object.assign({}, settings);
|
||||
kwargs["nohist"] = "1";
|
||||
kwargs["session"] = sessionId;
|
||||
return this.globalModel.submitCommand("session", "set", null, kwargs, interactive);
|
||||
}
|
||||
|
||||
lineStar(lineId: string, starVal: number) {
|
||||
this.globalModel.submitCommand("line", "star", [lineId, String(starVal)], { nohist: "1" }, true);
|
||||
}
|
||||
|
||||
lineBookmark(lineId: string) {
|
||||
this.globalModel.submitCommand("line", "bookmark", [lineId], { nohist: "1" }, true);
|
||||
}
|
||||
|
||||
linePin(lineId: string, val: boolean) {
|
||||
this.globalModel.submitCommand("line", "pin", [lineId, val ? "1" : "0"], { nohist: "1" }, true);
|
||||
}
|
||||
|
||||
bookmarksView() {
|
||||
this.globalModel.submitCommand("bookmarks", "show", null, { nohist: "1" }, true);
|
||||
}
|
||||
|
||||
connectionsView() {
|
||||
this.globalModel.connectionViewModel.showConnectionsView();
|
||||
}
|
||||
|
||||
clientSettingsView() {
|
||||
this.globalModel.clientSettingsViewModel.showClientSettingsView();
|
||||
}
|
||||
|
||||
historyView(params: HistorySearchParams) {
|
||||
let kwargs = { nohist: "1" };
|
||||
kwargs["offset"] = String(params.offset);
|
||||
kwargs["rawoffset"] = String(params.rawOffset);
|
||||
if (params.searchText != null) {
|
||||
kwargs["text"] = params.searchText;
|
||||
}
|
||||
if (params.searchSessionId != null) {
|
||||
kwargs["searchsession"] = params.searchSessionId;
|
||||
}
|
||||
if (params.searchRemoteId != null) {
|
||||
kwargs["searchremote"] = params.searchRemoteId;
|
||||
}
|
||||
if (params.fromTs != null) {
|
||||
kwargs["fromts"] = String(params.fromTs);
|
||||
}
|
||||
if (params.noMeta) {
|
||||
kwargs["meta"] = "0";
|
||||
}
|
||||
if (params.filterCmds) {
|
||||
kwargs["filter"] = "1";
|
||||
}
|
||||
this.globalModel.submitCommand("history", "viewall", null, kwargs, true);
|
||||
}
|
||||
|
||||
telemetryOff(interactive: boolean): Promise<CommandRtnType> {
|
||||
return this.globalModel.submitCommand("telemetry", "off", null, { nohist: "1" }, interactive);
|
||||
}
|
||||
|
||||
telemetryOn(interactive: boolean): Promise<CommandRtnType> {
|
||||
return this.globalModel.submitCommand("telemetry", "on", null, { nohist: "1" }, interactive);
|
||||
}
|
||||
|
||||
releaseCheckAutoOff(interactive: boolean): Promise<CommandRtnType> {
|
||||
return this.globalModel.submitCommand("releasecheck", "autooff", null, { nohist: "1" }, interactive);
|
||||
}
|
||||
|
||||
releaseCheckAutoOn(interactive: boolean): Promise<CommandRtnType> {
|
||||
return this.globalModel.submitCommand("releasecheck", "autoon", null, { nohist: "1" }, interactive);
|
||||
}
|
||||
|
||||
setTermFontSize(fsize: number, interactive: boolean): Promise<CommandRtnType> {
|
||||
let kwargs = {
|
||||
nohist: "1",
|
||||
termfontsize: String(fsize),
|
||||
};
|
||||
return this.globalModel.submitCommand("client", "set", null, kwargs, interactive);
|
||||
}
|
||||
|
||||
setClientOpenAISettings(opts: { model?: string; apitoken?: string; maxtokens?: string }): Promise<CommandRtnType> {
|
||||
let kwargs = {
|
||||
nohist: "1",
|
||||
};
|
||||
if (opts.model != null) {
|
||||
kwargs["openaimodel"] = opts.model;
|
||||
}
|
||||
if (opts.apitoken != null) {
|
||||
kwargs["openaiapitoken"] = opts.apitoken;
|
||||
}
|
||||
if (opts.maxtokens != null) {
|
||||
kwargs["openaimaxtokens"] = opts.maxtokens;
|
||||
}
|
||||
return this.globalModel.submitCommand("client", "set", null, kwargs, false);
|
||||
}
|
||||
|
||||
clientAcceptTos(): void {
|
||||
this.globalModel.submitCommand("client", "accepttos", null, { nohist: "1" }, true);
|
||||
}
|
||||
|
||||
clientSetConfirmFlag(flag: string, value: boolean): Promise<CommandRtnType> {
|
||||
let kwargs = { nohist: "1" };
|
||||
let valueStr = value ? "1" : "0";
|
||||
return this.globalModel.submitCommand("client", "setconfirmflag", [flag, valueStr], kwargs, false);
|
||||
}
|
||||
|
||||
clientSetSidebar(width: number, collapsed: boolean): Promise<CommandRtnType> {
|
||||
let kwargs = { nohist: "1", width: `${width}`, collapsed: collapsed ? "1" : "0" };
|
||||
return this.globalModel.submitCommand("client", "setsidebar", null, kwargs, false);
|
||||
}
|
||||
|
||||
editBookmark(bookmarkId: string, desc: string, cmdstr: string) {
|
||||
let kwargs = {
|
||||
nohist: "1",
|
||||
desc: desc,
|
||||
cmdstr: cmdstr,
|
||||
};
|
||||
this.globalModel.submitCommand("bookmark", "set", [bookmarkId], kwargs, true);
|
||||
}
|
||||
|
||||
deleteBookmark(bookmarkId: string): void {
|
||||
this.globalModel.submitCommand("bookmark", "delete", [bookmarkId], { nohist: "1" }, true);
|
||||
}
|
||||
|
||||
openSharedSession(): void {
|
||||
this.globalModel.submitCommand("session", "openshared", null, { nohist: "1" }, true);
|
||||
}
|
||||
|
||||
setLineState(
|
||||
screenId: string,
|
||||
lineId: string,
|
||||
state: LineStateType,
|
||||
interactive: boolean
|
||||
): Promise<CommandRtnType> {
|
||||
let stateStr = JSON.stringify(state);
|
||||
return this.globalModel.submitCommand(
|
||||
"line",
|
||||
"set",
|
||||
[lineId],
|
||||
{ screen: screenId, nohist: "1", state: stateStr },
|
||||
interactive
|
||||
);
|
||||
}
|
||||
|
||||
screenSidebarAddLine(lineId: string) {
|
||||
this.globalModel.submitCommand("sidebar", "add", null, { nohist: "1", line: lineId }, false);
|
||||
}
|
||||
|
||||
screenSidebarRemove() {
|
||||
this.globalModel.submitCommand("sidebar", "remove", null, { nohist: "1" }, false);
|
||||
}
|
||||
|
||||
screenSidebarClose(): void {
|
||||
this.globalModel.submitCommand("sidebar", "close", null, { nohist: "1" }, false);
|
||||
}
|
||||
|
||||
screenSidebarOpen(width?: string): void {
|
||||
let kwargs: Record<string, string> = { nohist: "1" };
|
||||
if (width != null) {
|
||||
kwargs.width = width;
|
||||
}
|
||||
this.globalModel.submitCommand("sidebar", "open", null, kwargs, false);
|
||||
}
|
||||
}
|
||||
|
||||
export { CommandRunner };
|
117
src/model/forwardlinecontainer.ts
Normal file
117
src/model/forwardlinecontainer.ts
Normal file
@ -0,0 +1,117 @@
|
||||
// Copyright 2023, Command Line Inc.
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import { TermWrap } from "../plugins/terminal/term";
|
||||
import * as types from "../types/types";
|
||||
import { windowWidthToCols, windowHeightToRows } from "../util/textmeasure";
|
||||
import { MagicLayout } from "../app/magiclayout";
|
||||
import { Model } from "./model";
|
||||
import { CommandRunner } from "./model";
|
||||
import { Cmd } from "./cmd";
|
||||
import { Screen } from "./screen";
|
||||
|
||||
class ForwardLineContainer {
|
||||
globalCommandRunner: CommandRunner;
|
||||
globalModel: Model;
|
||||
winSize: types.WindowSize;
|
||||
screen: Screen;
|
||||
containerType: types.LineContainerStrs;
|
||||
lineId: string;
|
||||
|
||||
constructor(screen: Screen, winSize: types.WindowSize, containerType: types.LineContainerStrs, lineId: string) {
|
||||
this.globalModel = Model.getInstance();
|
||||
this.globalCommandRunner = CommandRunner.getInstance();
|
||||
this.screen = screen;
|
||||
this.winSize = winSize;
|
||||
this.containerType = containerType;
|
||||
this.lineId = lineId;
|
||||
}
|
||||
|
||||
screenSizeCallback(winSize: types.WindowSize): void {
|
||||
this.winSize = winSize;
|
||||
let termWrap = this.getTermWrap(this.lineId);
|
||||
if (termWrap != null) {
|
||||
let fontSize = this.globalModel.termFontSize.get();
|
||||
let cols = windowWidthToCols(winSize.width, fontSize);
|
||||
let rows = windowHeightToRows(winSize.height, fontSize);
|
||||
termWrap.resizeCols(cols);
|
||||
this.globalCommandRunner.resizeScreen(this.screen.screenId, rows, cols, { include: [this.lineId] });
|
||||
}
|
||||
}
|
||||
|
||||
getContainerType(): types.LineContainerStrs {
|
||||
return this.containerType;
|
||||
}
|
||||
|
||||
getCmd(line: types.LineType): Cmd {
|
||||
return this.screen.getCmd(line);
|
||||
}
|
||||
|
||||
isSidebarOpen(): boolean {
|
||||
return false;
|
||||
}
|
||||
|
||||
isLineIdInSidebar(lineId: string): boolean {
|
||||
return false;
|
||||
}
|
||||
|
||||
setLineFocus(lineNum: number, focus: boolean): void {
|
||||
this.screen.setLineFocus(lineNum, focus);
|
||||
}
|
||||
|
||||
setContentHeight(context: types.RendererContext, height: number): void {
|
||||
return;
|
||||
}
|
||||
|
||||
getMaxContentSize(): types.WindowSize {
|
||||
let rtn = { width: this.winSize.width, height: this.winSize.height };
|
||||
rtn.width = rtn.width - MagicLayout.ScreenMaxContentWidthBuffer;
|
||||
return rtn;
|
||||
}
|
||||
|
||||
getIdealContentSize(): types.WindowSize {
|
||||
return this.winSize;
|
||||
}
|
||||
|
||||
loadTerminalRenderer(elem: Element, line: types.LineType, cmd: Cmd, width: number): void {
|
||||
this.screen.loadTerminalRenderer(elem, line, cmd, width);
|
||||
}
|
||||
|
||||
registerRenderer(lineId: string, renderer: types.RendererModel): void {
|
||||
this.screen.registerRenderer(lineId, renderer);
|
||||
}
|
||||
|
||||
unloadRenderer(lineId: string): void {
|
||||
this.screen.unloadRenderer(lineId);
|
||||
}
|
||||
|
||||
getContentHeight(context: types.RendererContext): number {
|
||||
return this.screen.getContentHeight(context);
|
||||
}
|
||||
|
||||
getUsedRows(context: types.RendererContext, line: types.LineType, cmd: Cmd, width: number): number {
|
||||
return this.screen.getUsedRows(context, line, cmd, width);
|
||||
}
|
||||
|
||||
getIsFocused(lineNum: number): boolean {
|
||||
return this.screen.getIsFocused(lineNum);
|
||||
}
|
||||
|
||||
getRenderer(lineId: string): types.RendererModel {
|
||||
return this.screen.getRenderer(lineId);
|
||||
}
|
||||
|
||||
getTermWrap(lineId: string): TermWrap {
|
||||
return this.screen.getTermWrap(lineId);
|
||||
}
|
||||
|
||||
getFocusType(): types.FocusTypeStrs {
|
||||
return this.screen.getFocusType();
|
||||
}
|
||||
|
||||
getSelectedLine(): number {
|
||||
return this.screen.getSelectedLine();
|
||||
}
|
||||
}
|
||||
|
||||
export { ForwardLineContainer };
|
@ -17,7 +17,7 @@ import dayjs from "dayjs";
|
||||
import * as appconst from "../app/appconst";
|
||||
import { checkKeyPressed, adaptFromReactOrNativeKeyEvent } from "../util/keyutil";
|
||||
import { OV, OArr, OMap } from "../types/types";
|
||||
import { CommandRunner } from "./commandrunner";
|
||||
import { CommandRunner } from "./model";
|
||||
import { Model } from "./model";
|
||||
import { Cmd } from "./cmd";
|
||||
import { SpecialLineContainer } from "./speciallinecontainer";
|
||||
|
@ -1,15 +1,15 @@
|
||||
export * from "./model";
|
||||
export { BookmarksModel } from "./bookmarks";
|
||||
export { ClientSettingsViewModel } from "./clientsettingsview";
|
||||
export { Cmd } from "./cmd";
|
||||
export { CommandRunner } from "./commandrunner";
|
||||
export { ConnectionsViewModel } from "./connectionsview";
|
||||
export { InputModel } from "./input";
|
||||
export { MainSidebarModel } from "./mainsidebar";
|
||||
export { ModalsModel } from "./modals";
|
||||
export { Model } from "./model";
|
||||
export { PluginsModel } from "./plugins";
|
||||
export { RemotesModel } from "./remotes";
|
||||
export { Screen } from "./screen";
|
||||
export { ScreenLines } from "./screenlines";
|
||||
export { Session } from "./session";
|
||||
export { SpecialLineContainer } from "./speciallinecontainer";
|
||||
export { ForwardLineContainer } from "./forwardlinecontainer";
|
||||
|
@ -18,7 +18,7 @@ import { StrWithPos } from "../types/types";
|
||||
import * as appconst from "../app/appconst";
|
||||
import { OV } from "../types/types";
|
||||
import { Model } from "./model";
|
||||
import { CommandRunner } from "./commandrunner";
|
||||
import { CommandRunner } from "./model";
|
||||
|
||||
function getDefaultHistoryQueryOpts(): HistoryQueryOpts {
|
||||
return {
|
||||
|
@ -38,6 +38,8 @@ import {
|
||||
CmdInputTextPacketType,
|
||||
FileInfoType,
|
||||
ExtFile,
|
||||
HistorySearchParams,
|
||||
LineStateType,
|
||||
} from "../types/types";
|
||||
import { WSControl } from "./ws";
|
||||
import { cmdStatusIsRunning } from "../app/line/lineutil";
|
||||
@ -46,7 +48,6 @@ import { remotePtrToString, cmdPacketString } from "../util/modelutil";
|
||||
import { checkKeyPressed, adaptFromReactOrNativeKeyEvent, setKeyUtilPlatform } from "../util/keyutil";
|
||||
import { OV, OArr, OMap, CV } from "../types/types";
|
||||
import { Session } from "./session";
|
||||
import { CommandRunner } from "./commandrunner";
|
||||
import { ScreenLines } from "./screenlines";
|
||||
import { InputModel } from "./input";
|
||||
import { PluginsModel } from "./plugins";
|
||||
@ -60,19 +61,6 @@ import { MainSidebarModel } from "./mainsidebar";
|
||||
import { Screen } from "./screen";
|
||||
import { Cmd } from "./cmd";
|
||||
|
||||
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;
|
||||
|
||||
// @ts-ignore
|
||||
const VERSION = __WAVETERM_VERSION__;
|
||||
// @ts-ignore
|
||||
const BUILD = __WAVETERM_BUILD__;
|
||||
|
||||
type KeyModsType = {
|
||||
meta?: boolean;
|
||||
ctrl?: boolean;
|
||||
@ -120,7 +108,6 @@ function getApi(): ElectronApi {
|
||||
}
|
||||
|
||||
class Model {
|
||||
globalCommandRunner: CommandRunner;
|
||||
clientId: string;
|
||||
activeSessionId: OV<string> = mobx.observable.box(null, {
|
||||
name: "activeSessionId",
|
||||
@ -192,8 +179,7 @@ class Model {
|
||||
});
|
||||
packetSeqNum: number = 0;
|
||||
|
||||
private constructor(commandRunner: CommandRunner) {
|
||||
this.globalCommandRunner = commandRunner;
|
||||
private constructor() {
|
||||
this.clientId = getApi().getId();
|
||||
this.isDev = getApi().getIsDev();
|
||||
this.authKey = getApi().getAuthKey();
|
||||
@ -219,14 +205,14 @@ class Model {
|
||||
this.termFontSize = mobx.computed(() => {
|
||||
let cdata = this.clientData.get();
|
||||
if (cdata == null || cdata.feopts == null || cdata.feopts.termfontsize == null) {
|
||||
return DefaultTermFontSize;
|
||||
return appconst.DefaultTermFontSize;
|
||||
}
|
||||
let fontSize = Math.ceil(cdata.feopts.termfontsize);
|
||||
if (fontSize < MinFontSize) {
|
||||
return MinFontSize;
|
||||
if (fontSize < appconst.MinFontSize) {
|
||||
return appconst.MinFontSize;
|
||||
}
|
||||
if (fontSize > MaxFontSize) {
|
||||
return MaxFontSize;
|
||||
if (fontSize > appconst.MaxFontSize) {
|
||||
return appconst.MaxFontSize;
|
||||
}
|
||||
return fontSize;
|
||||
});
|
||||
@ -252,8 +238,7 @@ class Model {
|
||||
|
||||
static getInstance() {
|
||||
if (!(window as any).GlobalModel) {
|
||||
const commandRunner = CommandRunner.getInstance();
|
||||
(window as any).GlobalModel = new Model(commandRunner);
|
||||
(window as any).GlobalModel = new Model();
|
||||
}
|
||||
return (window as any).GlobalModel;
|
||||
}
|
||||
@ -382,17 +367,17 @@ class Model {
|
||||
|
||||
getBaseHostPort(): string {
|
||||
if (this.isDev) {
|
||||
return DevServerEndpoint;
|
||||
return appconst.DevServerEndpoint;
|
||||
}
|
||||
return ProdServerEndpoint;
|
||||
return appconst.ProdServerEndpoint;
|
||||
}
|
||||
|
||||
setTermFontSize(fontSize: number) {
|
||||
if (fontSize < MinFontSize) {
|
||||
fontSize = MinFontSize;
|
||||
if (fontSize < appconst.MinFontSize) {
|
||||
fontSize = appconst.MinFontSize;
|
||||
}
|
||||
if (fontSize > MaxFontSize) {
|
||||
fontSize = MaxFontSize;
|
||||
if (fontSize > appconst.MaxFontSize) {
|
||||
fontSize = appconst.MaxFontSize;
|
||||
}
|
||||
mobx.action(() => {
|
||||
this.termFontSize.set(fontSize);
|
||||
@ -401,9 +386,9 @@ class Model {
|
||||
|
||||
getBaseWsHostPort(): string {
|
||||
if (this.isDev) {
|
||||
return DevServerWsEndpoint;
|
||||
return appconst.DevServerWsEndpoint;
|
||||
}
|
||||
return ProdServerWsEndpoint;
|
||||
return appconst.ProdServerWsEndpoint;
|
||||
}
|
||||
|
||||
getFetchHeaders(): Record<string, string> {
|
||||
@ -468,7 +453,7 @@ class Model {
|
||||
}
|
||||
if (checkKeyPressed(waveEvent, "Cmd:b")) {
|
||||
e.preventDefault();
|
||||
this.globalCommandRunner.bookmarksView();
|
||||
GlobalCommandRunner.bookmarksView();
|
||||
}
|
||||
if (this.activeMainView.get() == "session" && checkKeyPressed(waveEvent, "Cmd:Ctrl:s")) {
|
||||
e.preventDefault();
|
||||
@ -476,9 +461,9 @@ class Model {
|
||||
if (activeScreen != null) {
|
||||
let isSidebarOpen = activeScreen.isSidebarOpen();
|
||||
if (isSidebarOpen) {
|
||||
this.globalCommandRunner.screenSidebarClose();
|
||||
GlobalCommandRunner.screenSidebarClose();
|
||||
} else {
|
||||
this.globalCommandRunner.screenSidebarOpen();
|
||||
GlobalCommandRunner.screenSidebarOpen();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -511,7 +496,7 @@ class Model {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
this.globalCommandRunner.lineDelete(String(selectedLine), true);
|
||||
GlobalCommandRunner.lineDelete(String(selectedLine), true);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -531,7 +516,7 @@ class Model {
|
||||
if (!result) {
|
||||
return;
|
||||
}
|
||||
this.globalCommandRunner.screenDelete(activeScreen.screenId, true);
|
||||
GlobalCommandRunner.screenDelete(activeScreen.screenId, true);
|
||||
});
|
||||
}
|
||||
|
||||
@ -545,14 +530,14 @@ class Model {
|
||||
}
|
||||
if (mods.shift) {
|
||||
// restart last line
|
||||
this.globalCommandRunner.lineRestart("E", true);
|
||||
GlobalCommandRunner.lineRestart("E", true);
|
||||
} else {
|
||||
// restart selected line
|
||||
let selectedLine = activeScreen.selectedLine.get();
|
||||
if (selectedLine == null || selectedLine == 0) {
|
||||
return;
|
||||
}
|
||||
this.globalCommandRunner.lineRestart(String(selectedLine), true);
|
||||
GlobalCommandRunner.lineRestart(String(selectedLine), true);
|
||||
}
|
||||
}
|
||||
|
||||
@ -622,7 +607,7 @@ class Model {
|
||||
setContentHeight(context: RendererContext, height: number): void {
|
||||
let key = context.screenId + "/" + context.lineId;
|
||||
this.termUsedRowsCache[key] = height;
|
||||
this.globalCommandRunner.setTermUsedRows(context, height);
|
||||
GlobalCommandRunner.setTermUsedRows(context, height);
|
||||
}
|
||||
|
||||
contextScreen(e: any, screenId: string) {
|
||||
@ -640,7 +625,7 @@ class Model {
|
||||
remote: null,
|
||||
winsize: null,
|
||||
linenum: null,
|
||||
build: VERSION + " " + BUILD,
|
||||
build: appconst.VERSION + " " + appconst.BUILD,
|
||||
};
|
||||
let session = this.getActiveSession();
|
||||
if (session != null) {
|
||||
@ -657,7 +642,7 @@ class Model {
|
||||
}
|
||||
|
||||
onTCmd(e: any, mods: KeyModsType) {
|
||||
this.globalCommandRunner.createNewScreen();
|
||||
GlobalCommandRunner.createNewScreen();
|
||||
}
|
||||
|
||||
onICmd(e: any, mods: KeyModsType) {
|
||||
@ -667,7 +652,7 @@ class Model {
|
||||
onLCmd(e: any, mods: KeyModsType) {
|
||||
let screen = this.getActiveScreen();
|
||||
if (screen != null) {
|
||||
this.globalCommandRunner.screenSetFocus("cmd");
|
||||
GlobalCommandRunner.screenSetFocus("cmd");
|
||||
}
|
||||
}
|
||||
|
||||
@ -722,35 +707,35 @@ class Model {
|
||||
}
|
||||
|
||||
onMetaPageUp(): void {
|
||||
this.globalCommandRunner.screenSelectLine("-1");
|
||||
GlobalCommandRunner.screenSelectLine("-1");
|
||||
}
|
||||
|
||||
onMetaPageDown(): void {
|
||||
this.globalCommandRunner.screenSelectLine("+1");
|
||||
GlobalCommandRunner.screenSelectLine("+1");
|
||||
}
|
||||
|
||||
onMetaArrowUp(): void {
|
||||
this.globalCommandRunner.screenSelectLine("-1");
|
||||
GlobalCommandRunner.screenSelectLine("-1");
|
||||
}
|
||||
|
||||
onMetaArrowDown(): void {
|
||||
this.globalCommandRunner.screenSelectLine("+1");
|
||||
GlobalCommandRunner.screenSelectLine("+1");
|
||||
}
|
||||
|
||||
onBracketCmd(e: any, arg: { relative: number }, mods: KeyModsType) {
|
||||
if (arg.relative == 1) {
|
||||
this.globalCommandRunner.switchScreen("+");
|
||||
GlobalCommandRunner.switchScreen("+");
|
||||
} else if (arg.relative == -1) {
|
||||
this.globalCommandRunner.switchScreen("-");
|
||||
GlobalCommandRunner.switchScreen("-");
|
||||
}
|
||||
}
|
||||
|
||||
onDigitCmd(e: any, arg: { digit: number }, mods: KeyModsType) {
|
||||
if (mods.meta && mods.ctrl) {
|
||||
this.globalCommandRunner.switchSession(String(arg.digit));
|
||||
GlobalCommandRunner.switchSession(String(arg.digit));
|
||||
return;
|
||||
}
|
||||
this.globalCommandRunner.switchScreen(String(arg.digit));
|
||||
GlobalCommandRunner.switchScreen(String(arg.digit));
|
||||
}
|
||||
|
||||
isConnected(): boolean {
|
||||
@ -1431,4 +1416,429 @@ class Model {
|
||||
}
|
||||
}
|
||||
|
||||
export { Model };
|
||||
class CommandRunner {
|
||||
private constructor() {}
|
||||
|
||||
static getInstance() {
|
||||
if (!(window as any).GlobalCommandRunner) {
|
||||
(window as any).GlobalCommandRunner = new CommandRunner();
|
||||
}
|
||||
return (window as any).GlobalCommandRunner;
|
||||
}
|
||||
|
||||
loadHistory(show: boolean, htype: string) {
|
||||
let kwargs = { nohist: "1" };
|
||||
if (!show) {
|
||||
kwargs["noshow"] = "1";
|
||||
}
|
||||
if (htype != null && htype != "screen") {
|
||||
kwargs["type"] = htype;
|
||||
}
|
||||
GlobalModel.submitCommand("history", null, null, kwargs, true);
|
||||
}
|
||||
|
||||
resetShellState() {
|
||||
GlobalModel.submitCommand("reset", null, null, null, true);
|
||||
}
|
||||
|
||||
historyPurgeLines(lines: string[]): Promise<CommandRtnType> {
|
||||
let prtn = GlobalModel.submitCommand("history", "purge", lines, { nohist: "1" }, false);
|
||||
return prtn;
|
||||
}
|
||||
|
||||
switchSession(session: string) {
|
||||
mobx.action(() => {
|
||||
GlobalModel.activeMainView.set("session");
|
||||
})();
|
||||
GlobalModel.submitCommand("session", null, [session], { nohist: "1" }, false);
|
||||
}
|
||||
|
||||
switchScreen(screen: string, session?: string) {
|
||||
mobx.action(() => {
|
||||
GlobalModel.activeMainView.set("session");
|
||||
})();
|
||||
let kwargs = { nohist: "1" };
|
||||
if (session != null) {
|
||||
kwargs["session"] = session;
|
||||
}
|
||||
GlobalModel.submitCommand("screen", null, [screen], kwargs, false);
|
||||
}
|
||||
|
||||
lineView(sessionId: string, screenId: string, lineNum?: number) {
|
||||
let screen = GlobalModel.getScreenById(sessionId, screenId);
|
||||
if (screen != null && lineNum != null) {
|
||||
screen.setAnchorFields(lineNum, 0, "line:view");
|
||||
}
|
||||
let lineNumStr = lineNum == null || lineNum == 0 ? "E" : String(lineNum);
|
||||
GlobalModel.submitCommand("line", "view", [sessionId, screenId, lineNumStr], { nohist: "1" }, false);
|
||||
}
|
||||
|
||||
lineArchive(lineArg: string, archive: boolean): Promise<CommandRtnType> {
|
||||
let kwargs = { nohist: "1" };
|
||||
let archiveStr = archive ? "1" : "0";
|
||||
return GlobalModel.submitCommand("line", "archive", [lineArg, archiveStr], kwargs, false);
|
||||
}
|
||||
|
||||
lineDelete(lineArg: string, interactive: boolean): Promise<CommandRtnType> {
|
||||
return GlobalModel.submitCommand("line", "delete", [lineArg], { nohist: "1" }, interactive);
|
||||
}
|
||||
|
||||
lineRestart(lineArg: string, interactive: boolean): Promise<CommandRtnType> {
|
||||
return GlobalModel.submitCommand("line", "restart", [lineArg], { nohist: "1" }, interactive);
|
||||
}
|
||||
|
||||
lineSet(lineArg: string, opts: { renderer?: string }): Promise<CommandRtnType> {
|
||||
let kwargs = { nohist: "1" };
|
||||
if ("renderer" in opts) {
|
||||
kwargs["renderer"] = opts.renderer ?? "";
|
||||
}
|
||||
return GlobalModel.submitCommand("line", "set", [lineArg], kwargs, false);
|
||||
}
|
||||
|
||||
createNewSession() {
|
||||
GlobalModel.submitCommand("session", "open", null, { nohist: "1" }, false);
|
||||
}
|
||||
|
||||
createNewScreen() {
|
||||
GlobalModel.submitCommand("screen", "open", null, { nohist: "1" }, false);
|
||||
}
|
||||
|
||||
closeScreen(screen: string) {
|
||||
GlobalModel.submitCommand("screen", "close", [screen], { nohist: "1" }, false);
|
||||
}
|
||||
|
||||
// include is lineIds to include, exclude is lineIds to exclude
|
||||
// if include is given then it *only* does those ids. if exclude is given (or not),
|
||||
// it does all running commands in the screen except for excluded.
|
||||
resizeScreen(screenId: string, rows: number, cols: number, opts?: { include?: string[]; exclude?: string[] }) {
|
||||
let kwargs: Record<string, string> = {
|
||||
nohist: "1",
|
||||
screen: screenId,
|
||||
cols: String(cols),
|
||||
rows: String(rows),
|
||||
};
|
||||
if (opts?.include != null && opts?.include.length > 0) {
|
||||
kwargs.include = opts.include.join(",");
|
||||
}
|
||||
if (opts?.exclude != null && opts?.exclude.length > 0) {
|
||||
kwargs.exclude = opts.exclude.join(",");
|
||||
}
|
||||
GlobalModel.submitCommand("screen", "resize", null, kwargs, false);
|
||||
}
|
||||
|
||||
screenArchive(screenId: string, shouldArchive: boolean): Promise<CommandRtnType> {
|
||||
return GlobalModel.submitCommand(
|
||||
"screen",
|
||||
"archive",
|
||||
[screenId, shouldArchive ? "1" : "0"],
|
||||
{ nohist: "1" },
|
||||
false
|
||||
);
|
||||
}
|
||||
|
||||
screenDelete(screenId: string, interactive: boolean): Promise<CommandRtnType> {
|
||||
return GlobalModel.submitCommand("screen", "delete", [screenId], { nohist: "1" }, interactive);
|
||||
}
|
||||
|
||||
screenWebShare(screenId: string, shouldShare: boolean): Promise<CommandRtnType> {
|
||||
let kwargs: Record<string, string> = { nohist: "1" };
|
||||
kwargs["screen"] = screenId;
|
||||
return GlobalModel.submitCommand("screen", "webshare", [shouldShare ? "1" : "0"], kwargs, false);
|
||||
}
|
||||
|
||||
showRemote(remoteid: string) {
|
||||
GlobalModel.submitCommand("remote", "show", null, { nohist: "1", remote: remoteid }, true);
|
||||
}
|
||||
|
||||
showAllRemotes() {
|
||||
GlobalModel.submitCommand("remote", "showall", null, { nohist: "1" }, true);
|
||||
}
|
||||
|
||||
connectRemote(remoteid: string) {
|
||||
GlobalModel.submitCommand("remote", "connect", null, { nohist: "1", remote: remoteid }, true);
|
||||
}
|
||||
|
||||
disconnectRemote(remoteid: string) {
|
||||
GlobalModel.submitCommand("remote", "disconnect", null, { nohist: "1", remote: remoteid }, true);
|
||||
}
|
||||
|
||||
installRemote(remoteid: string) {
|
||||
GlobalModel.submitCommand("remote", "install", null, { nohist: "1", remote: remoteid }, true);
|
||||
}
|
||||
|
||||
installCancelRemote(remoteid: string) {
|
||||
GlobalModel.submitCommand("remote", "installcancel", null, { nohist: "1", remote: remoteid }, true);
|
||||
}
|
||||
|
||||
createRemote(cname: string, kwargsArg: Record<string, string>, interactive: boolean): Promise<CommandRtnType> {
|
||||
let kwargs = Object.assign({}, kwargsArg);
|
||||
kwargs["nohist"] = "1";
|
||||
return GlobalModel.submitCommand("remote", "new", [cname], kwargs, interactive);
|
||||
}
|
||||
|
||||
openCreateRemote(): void {
|
||||
GlobalModel.submitCommand("remote", "new", null, { nohist: "1", visual: "1" }, true);
|
||||
}
|
||||
|
||||
screenSetRemote(remoteArg: string, nohist: boolean, interactive: boolean): Promise<CommandRtnType> {
|
||||
let kwargs = {};
|
||||
if (nohist) {
|
||||
kwargs["nohist"] = "1";
|
||||
}
|
||||
return GlobalModel.submitCommand("connect", null, [remoteArg], kwargs, interactive);
|
||||
}
|
||||
|
||||
editRemote(remoteid: string, kwargsArg: Record<string, string>): void {
|
||||
let kwargs = Object.assign({}, kwargsArg);
|
||||
kwargs["nohist"] = "1";
|
||||
kwargs["remote"] = remoteid;
|
||||
GlobalModel.submitCommand("remote", "set", null, kwargs, true);
|
||||
}
|
||||
|
||||
openEditRemote(remoteid: string): void {
|
||||
GlobalModel.submitCommand("remote", "set", null, { remote: remoteid, nohist: "1", visual: "1" }, true);
|
||||
}
|
||||
|
||||
archiveRemote(remoteid: string) {
|
||||
GlobalModel.submitCommand("remote", "archive", null, { remote: remoteid, nohist: "1" }, true);
|
||||
}
|
||||
|
||||
importSshConfig() {
|
||||
GlobalModel.submitCommand("remote", "parse", null, { nohist: "1", visual: "1" }, true);
|
||||
}
|
||||
|
||||
screenSelectLine(lineArg: string, focusVal?: string) {
|
||||
let kwargs: Record<string, string> = {
|
||||
nohist: "1",
|
||||
line: lineArg,
|
||||
};
|
||||
if (focusVal != null) {
|
||||
kwargs["focus"] = focusVal;
|
||||
}
|
||||
GlobalModel.submitCommand("screen", "set", null, kwargs, false);
|
||||
}
|
||||
|
||||
screenReorder(screenId: string, index: string) {
|
||||
let kwargs: Record<string, string> = {
|
||||
nohist: "1",
|
||||
screenId: screenId,
|
||||
index: index,
|
||||
};
|
||||
GlobalModel.submitCommand("screen", "reorder", null, kwargs, false);
|
||||
}
|
||||
|
||||
setTermUsedRows(termContext: RendererContext, height: number) {
|
||||
let kwargs: Record<string, string> = {};
|
||||
kwargs["screen"] = termContext.screenId;
|
||||
kwargs["hohist"] = "1";
|
||||
let posargs = [String(termContext.lineNum), String(height)];
|
||||
GlobalModel.submitCommand("line", "setheight", posargs, kwargs, false);
|
||||
}
|
||||
|
||||
screenSetAnchor(sessionId: string, screenId: string, anchorVal: string): void {
|
||||
let kwargs = {
|
||||
nohist: "1",
|
||||
anchor: anchorVal,
|
||||
session: sessionId,
|
||||
screen: screenId,
|
||||
};
|
||||
GlobalModel.submitCommand("screen", "set", null, kwargs, false);
|
||||
}
|
||||
|
||||
screenSetFocus(focusVal: string): void {
|
||||
GlobalModel.submitCommand("screen", "set", null, { focus: focusVal, nohist: "1" }, false);
|
||||
}
|
||||
|
||||
screenSetSettings(
|
||||
screenId: string,
|
||||
settings: { tabcolor?: string; tabicon?: string; name?: string; sharename?: string },
|
||||
interactive: boolean
|
||||
): Promise<CommandRtnType> {
|
||||
let kwargs: { [key: string]: any } = Object.assign({}, settings);
|
||||
kwargs["nohist"] = "1";
|
||||
kwargs["screen"] = screenId;
|
||||
return GlobalModel.submitCommand("screen", "set", null, kwargs, interactive);
|
||||
}
|
||||
|
||||
sessionArchive(sessionId: string, shouldArchive: boolean): Promise<CommandRtnType> {
|
||||
return GlobalModel.submitCommand(
|
||||
"session",
|
||||
"archive",
|
||||
[sessionId, shouldArchive ? "1" : "0"],
|
||||
{ nohist: "1" },
|
||||
false
|
||||
);
|
||||
}
|
||||
|
||||
sessionDelete(sessionId: string): Promise<CommandRtnType> {
|
||||
return GlobalModel.submitCommand("session", "delete", [sessionId], { nohist: "1" }, false);
|
||||
}
|
||||
|
||||
sessionSetSettings(sessionId: string, settings: { name?: string }, interactive: boolean): Promise<CommandRtnType> {
|
||||
let kwargs = Object.assign({}, settings);
|
||||
kwargs["nohist"] = "1";
|
||||
kwargs["session"] = sessionId;
|
||||
return GlobalModel.submitCommand("session", "set", null, kwargs, interactive);
|
||||
}
|
||||
|
||||
lineStar(lineId: string, starVal: number) {
|
||||
GlobalModel.submitCommand("line", "star", [lineId, String(starVal)], { nohist: "1" }, true);
|
||||
}
|
||||
|
||||
lineBookmark(lineId: string) {
|
||||
GlobalModel.submitCommand("line", "bookmark", [lineId], { nohist: "1" }, true);
|
||||
}
|
||||
|
||||
linePin(lineId: string, val: boolean) {
|
||||
GlobalModel.submitCommand("line", "pin", [lineId, val ? "1" : "0"], { nohist: "1" }, true);
|
||||
}
|
||||
|
||||
bookmarksView() {
|
||||
GlobalModel.submitCommand("bookmarks", "show", null, { nohist: "1" }, true);
|
||||
}
|
||||
|
||||
connectionsView() {
|
||||
GlobalModel.connectionViewModel.showConnectionsView();
|
||||
}
|
||||
|
||||
clientSettingsView() {
|
||||
GlobalModel.clientSettingsViewModel.showClientSettingsView();
|
||||
}
|
||||
|
||||
historyView(params: HistorySearchParams) {
|
||||
let kwargs = { nohist: "1" };
|
||||
kwargs["offset"] = String(params.offset);
|
||||
kwargs["rawoffset"] = String(params.rawOffset);
|
||||
if (params.searchText != null) {
|
||||
kwargs["text"] = params.searchText;
|
||||
}
|
||||
if (params.searchSessionId != null) {
|
||||
kwargs["searchsession"] = params.searchSessionId;
|
||||
}
|
||||
if (params.searchRemoteId != null) {
|
||||
kwargs["searchremote"] = params.searchRemoteId;
|
||||
}
|
||||
if (params.fromTs != null) {
|
||||
kwargs["fromts"] = String(params.fromTs);
|
||||
}
|
||||
if (params.noMeta) {
|
||||
kwargs["meta"] = "0";
|
||||
}
|
||||
if (params.filterCmds) {
|
||||
kwargs["filter"] = "1";
|
||||
}
|
||||
GlobalModel.submitCommand("history", "viewall", null, kwargs, true);
|
||||
}
|
||||
|
||||
telemetryOff(interactive: boolean): Promise<CommandRtnType> {
|
||||
return GlobalModel.submitCommand("telemetry", "off", null, { nohist: "1" }, interactive);
|
||||
}
|
||||
|
||||
telemetryOn(interactive: boolean): Promise<CommandRtnType> {
|
||||
return GlobalModel.submitCommand("telemetry", "on", null, { nohist: "1" }, interactive);
|
||||
}
|
||||
|
||||
releaseCheckAutoOff(interactive: boolean): Promise<CommandRtnType> {
|
||||
return GlobalModel.submitCommand("releasecheck", "autooff", null, { nohist: "1" }, interactive);
|
||||
}
|
||||
|
||||
releaseCheckAutoOn(interactive: boolean): Promise<CommandRtnType> {
|
||||
return GlobalModel.submitCommand("releasecheck", "autoon", null, { nohist: "1" }, interactive);
|
||||
}
|
||||
|
||||
setTermFontSize(fsize: number, interactive: boolean): Promise<CommandRtnType> {
|
||||
let kwargs = {
|
||||
nohist: "1",
|
||||
termfontsize: String(fsize),
|
||||
};
|
||||
return GlobalModel.submitCommand("client", "set", null, kwargs, interactive);
|
||||
}
|
||||
|
||||
setClientOpenAISettings(opts: { model?: string; apitoken?: string; maxtokens?: string }): Promise<CommandRtnType> {
|
||||
let kwargs = {
|
||||
nohist: "1",
|
||||
};
|
||||
if (opts.model != null) {
|
||||
kwargs["openaimodel"] = opts.model;
|
||||
}
|
||||
if (opts.apitoken != null) {
|
||||
kwargs["openaiapitoken"] = opts.apitoken;
|
||||
}
|
||||
if (opts.maxtokens != null) {
|
||||
kwargs["openaimaxtokens"] = opts.maxtokens;
|
||||
}
|
||||
return GlobalModel.submitCommand("client", "set", null, kwargs, false);
|
||||
}
|
||||
|
||||
clientAcceptTos(): void {
|
||||
GlobalModel.submitCommand("client", "accepttos", null, { nohist: "1" }, true);
|
||||
}
|
||||
|
||||
clientSetConfirmFlag(flag: string, value: boolean): Promise<CommandRtnType> {
|
||||
let kwargs = { nohist: "1" };
|
||||
let valueStr = value ? "1" : "0";
|
||||
return GlobalModel.submitCommand("client", "setconfirmflag", [flag, valueStr], kwargs, false);
|
||||
}
|
||||
|
||||
clientSetSidebar(width: number, collapsed: boolean): Promise<CommandRtnType> {
|
||||
let kwargs = { nohist: "1", width: `${width}`, collapsed: collapsed ? "1" : "0" };
|
||||
return GlobalModel.submitCommand("client", "setsidebar", null, kwargs, false);
|
||||
}
|
||||
|
||||
editBookmark(bookmarkId: string, desc: string, cmdstr: string) {
|
||||
let kwargs = {
|
||||
nohist: "1",
|
||||
desc: desc,
|
||||
cmdstr: cmdstr,
|
||||
};
|
||||
GlobalModel.submitCommand("bookmark", "set", [bookmarkId], kwargs, true);
|
||||
}
|
||||
|
||||
deleteBookmark(bookmarkId: string): void {
|
||||
GlobalModel.submitCommand("bookmark", "delete", [bookmarkId], { nohist: "1" }, true);
|
||||
}
|
||||
|
||||
openSharedSession(): void {
|
||||
GlobalModel.submitCommand("session", "openshared", null, { nohist: "1" }, true);
|
||||
}
|
||||
|
||||
setLineState(
|
||||
screenId: string,
|
||||
lineId: string,
|
||||
state: LineStateType,
|
||||
interactive: boolean
|
||||
): Promise<CommandRtnType> {
|
||||
let stateStr = JSON.stringify(state);
|
||||
return GlobalModel.submitCommand(
|
||||
"line",
|
||||
"set",
|
||||
[lineId],
|
||||
{ screen: screenId, nohist: "1", state: stateStr },
|
||||
interactive
|
||||
);
|
||||
}
|
||||
|
||||
screenSidebarAddLine(lineId: string) {
|
||||
GlobalModel.submitCommand("sidebar", "add", null, { nohist: "1", line: lineId }, false);
|
||||
}
|
||||
|
||||
screenSidebarRemove() {
|
||||
GlobalModel.submitCommand("sidebar", "remove", null, { nohist: "1" }, false);
|
||||
}
|
||||
|
||||
screenSidebarClose(): void {
|
||||
GlobalModel.submitCommand("sidebar", "close", null, { nohist: "1" }, false);
|
||||
}
|
||||
|
||||
screenSidebarOpen(width?: string): void {
|
||||
let kwargs: Record<string, string> = { nohist: "1" };
|
||||
if (width != null) {
|
||||
kwargs.width = width;
|
||||
}
|
||||
GlobalModel.submitCommand("sidebar", "open", null, kwargs, false);
|
||||
}
|
||||
}
|
||||
|
||||
const GlobalModel = Model.getInstance();
|
||||
const GlobalCommandRunner = CommandRunner.getInstance();
|
||||
export { Model, CommandRunner, GlobalModel, GlobalCommandRunner };
|
||||
|
@ -5,7 +5,7 @@ import * as mobx from "mobx";
|
||||
import { PluginModel } from "../plugins/plugins";
|
||||
import { RendererPluginType } from "../types/types";
|
||||
import { OV } from "../types/types";
|
||||
import { CommandRunner } from "./commandrunner";
|
||||
import { CommandRunner } from "./model";
|
||||
import { Model } from "./model";
|
||||
|
||||
class PluginsModel {
|
||||
|
@ -8,7 +8,7 @@ import { TermWrap } from "../plugins/terminal/term";
|
||||
import { RemoteInputPacketType, RemoteEditType } from "../types/types";
|
||||
import * as appconst from "../app/appconst";
|
||||
import { OV } from "../types/types";
|
||||
import { CommandRunner } from "./commandrunner";
|
||||
import { CommandRunner } from "./model";
|
||||
import { Model } from "./model";
|
||||
import { getTermPtyData } from "../util/modelutil";
|
||||
|
||||
|
@ -29,12 +29,12 @@ import * as appconst from "../app/appconst";
|
||||
import { checkKeyPressed, adaptFromReactOrNativeKeyEvent } from "../util/keyutil";
|
||||
import { OV } from "../types/types";
|
||||
import { Model } from "./model";
|
||||
import { CommandRunner } from "./commandrunner";
|
||||
import { CommandRunner } from "./model";
|
||||
import { Cmd } from "./cmd";
|
||||
import { ScreenLines } from "./screenlines";
|
||||
import { getTermPtyData } from "../util/modelutil";
|
||||
|
||||
class ScreenModel {
|
||||
class Screen {
|
||||
globalCommandRunner: CommandRunner;
|
||||
globalModel: Model;
|
||||
sessionId: string;
|
||||
@ -696,4 +696,4 @@ class ScreenModel {
|
||||
}
|
||||
}
|
||||
|
||||
export { ScreenModel };
|
||||
export { Screen };
|
||||
|
@ -6,7 +6,7 @@ import * as T from "../../types/types";
|
||||
import Editor, { Monaco } from "@monaco-editor/react";
|
||||
import type * as MonacoTypes from "monaco-editor/esm/vs/editor/editor.api";
|
||||
import { Markdown } from "../../app/common/elements";
|
||||
import { GlobalModel, GlobalCommandRunner } from "../../model/model_old";
|
||||
import { GlobalModel, GlobalCommandRunner } from "../../model";
|
||||
import Split from "react-split-it";
|
||||
import loader from "@monaco-editor/loader";
|
||||
loader.config({ paths: { vs: "./node_modules/monaco-editor/min/vs" } });
|
||||
|
@ -20,7 +20,7 @@ import type {
|
||||
import * as T from "../../types/types";
|
||||
import { debounce, throttle } from "throttle-debounce";
|
||||
import * as util from "../../util/util";
|
||||
import { GlobalModel } from "../../model/model_old";
|
||||
import { GlobalModel } from "../../model";
|
||||
|
||||
type OV<V> = mobx.IObservableValue<V>;
|
||||
type CV<V> = mobx.IComputedValue<V>;
|
||||
|
@ -4,7 +4,7 @@
|
||||
import React, { FC, useEffect, useState, useRef, useMemo } from "react";
|
||||
import { RendererContext, RendererOpts, LineStateType, RendererModelContainerApi } from "../../types/types";
|
||||
import * as T from "../../types/types";
|
||||
import { GlobalModel } from "../../model/model_old";
|
||||
import { GlobalModel } from "../../model";
|
||||
import Papa from "papaparse";
|
||||
import {
|
||||
createColumnHelper,
|
||||
|
@ -9,7 +9,7 @@ import * as T from "../../types/types";
|
||||
import { isBlank } from "../../util/util";
|
||||
import mustache from "mustache";
|
||||
import * as DOMPurify from "dompurify";
|
||||
import { GlobalModel } from "../../model/model_old";
|
||||
import { GlobalModel } from "../../model";
|
||||
|
||||
import "./mustache.less";
|
||||
|
||||
|
@ -9,7 +9,7 @@ import { sprintf } from "sprintf-js";
|
||||
import { boundMethod } from "autobind-decorator";
|
||||
import { windowWidthToCols, windowHeightToRows } from "../../util/textmeasure";
|
||||
import { boundInt } from "../../util/util";
|
||||
import { GlobalModel } from "../../model/model_old";
|
||||
import { GlobalModel } from "../../model";
|
||||
import { Model } from "../../model/model";
|
||||
import type {
|
||||
TermContextUnion,
|
||||
|
@ -8,7 +8,7 @@ import { boundMethod } from "autobind-decorator";
|
||||
import dayjs from "dayjs";
|
||||
import localizedFormat from "dayjs/plugin/localizedFormat";
|
||||
import { If } from "tsx-control-statements/components";
|
||||
import { GlobalModel, LineContainerModel } from "../../model/model_old";
|
||||
import { GlobalModel, LineContainerModel } from "../../model";
|
||||
import { termHeightFromRows } from "../../util/textmeasure";
|
||||
import type { LineType } from "../../types/types";
|
||||
import cn from "classnames";
|
||||
|
@ -4,7 +4,7 @@
|
||||
import * as React from "react";
|
||||
import * as mobx from "mobx";
|
||||
import { TermWrap } from "../plugins/terminal/term";
|
||||
import { Cmd } from "../model/cmd";
|
||||
import { Cmd, Model } from "../model";
|
||||
|
||||
type ShareModeType = "local" | "web";
|
||||
type FocusTypeStrs = "input" | "cmd";
|
||||
@ -474,7 +474,7 @@ type RendererModelInitializeParams = {
|
||||
opts: RendererOpts;
|
||||
lineState: LineStateType;
|
||||
api: RendererModelContainerApi;
|
||||
ptyDataSource: (termContext: TermContextUnion) => Promise<PtyDataType>;
|
||||
ptyDataSource: (termContext: TermContextUnion, globalModel: Model) => Promise<PtyDataType>;
|
||||
};
|
||||
|
||||
type RendererModel = {
|
||||
|
Loading…
Reference in New Issue
Block a user