From 5abff8075b7cac8f168f41507eebe889dbcac012 Mon Sep 17 00:00:00 2001 From: Sylvia Crowe Date: Tue, 13 Feb 2024 16:30:07 -0800 Subject: [PATCH] merge branch 'main' into 'ssh--auth-control' This was mostly straightforward, but it appears that a previous commit to main broke the user input modals by deleting a function. This adds that back in addition to the merge. --- src/app/app.tsx | 7 +- src/app/appconst.ts | 10 + src/app/bookmarks/bookmarks.less | 2 +- src/app/bookmarks/bookmarks.tsx | 15 +- src/app/clientsettings/clientsettings.less | 2 +- src/app/clientsettings/clientsettings.tsx | 19 +- src/app/common/elements/button.less | 2 +- src/app/common/elements/checkbox.less | 2 +- src/app/common/elements/cmdstrcode.less | 2 +- src/app/common/elements/cmdstrcode.tsx | 4 +- src/app/common/elements/dropdown.less | 2 +- .../elements/inlinesettingstextedit.less | 2 +- .../elements/inlinesettingstextedit.tsx | 4 +- src/app/common/elements/inputdecoration.less | 2 +- src/app/common/elements/markdown.less | 2 +- src/app/common/elements/markdown.tsx | 2 +- src/app/common/elements/modal.less | 2 +- src/app/common/elements/modal.tsx | 2 - src/app/common/elements/passwordfield.less | 2 +- src/app/common/elements/resizablesidebar.less | 2 +- src/app/common/elements/resizablesidebar.tsx | 6 +- src/app/common/elements/settingserror.tsx | 2 - .../elements/showwaveshellinstallprompt.tsx | 4 +- src/app/common/elements/status.less | 2 +- src/app/common/elements/textfield.less | 2 +- src/app/common/elements/toggle.less | 2 +- src/app/common/elements/tooltip.less | 2 +- src/app/common/error/errorboundary.tsx | 1 - src/app/common/icons/icons.less | 2 +- src/app/common/icons/icons.tsx | 16 +- src/app/common/modals/about.less | 2 +- src/app/common/modals/about.tsx | 10 +- src/app/common/modals/alert.less | 2 +- src/app/common/modals/alert.tsx | 4 +- src/app/common/modals/clientstop.less | 2 +- src/app/common/modals/clientstop.tsx | 4 +- src/app/common/modals/createremoteconn.less | 2 +- src/app/common/modals/createremoteconn.tsx | 11 +- src/app/common/modals/disconnected.less | 2 +- src/app/common/modals/disconnected.tsx | 4 +- src/app/common/modals/editremoteconn.less | 2 +- src/app/common/modals/editremoteconn.tsx | 13 +- src/app/common/modals/linesettings.less | 2 +- src/app/common/modals/linesettings.tsx | 11 +- src/app/common/modals/provider.tsx | 2 +- src/app/common/modals/registry.tsx | 4 +- src/app/common/modals/screensettings.less | 2 +- src/app/common/modals/screensettings.tsx | 30 +- src/app/common/modals/sessionsettings.less | 2 +- src/app/common/modals/sessionsettings.tsx | 15 +- src/app/common/modals/tabswitcher.less | 2 +- src/app/common/modals/tabswitcher.tsx | 121 ++- src/app/common/modals/tos.less | 2 +- src/app/common/modals/tos.tsx | 13 +- src/app/common/modals/userinput.less | 2 +- src/app/common/modals/userinput.tsx | 5 +- .../common/modals/viewremoteconndetail.less | 8 +- .../common/modals/viewremoteconndetail.tsx | 29 +- src/app/common/prompt/prompt.less | 2 +- src/app/common/prompt/prompt.tsx | 31 +- src/app/connections/connections.less | 2 +- src/app/connections/connections.tsx | 16 +- src/app/history/history.less | 12 +- src/app/history/history.tsx | 48 +- src/app/line/linecomps.tsx | 52 +- src/app/line/lines.less | 2 +- src/app/line/linesview.tsx | 22 +- src/app/line/lineutil.ts | 3 +- src/app/line/renderer/basicrenderer.tsx | 28 +- src/app/pluginsview/pluginsview.less | 2 +- src/app/pluginsview/pluginsview.tsx | 8 +- src/app/sidebar/sidebar.less | 4 +- src/app/sidebar/sidebar.tsx | 19 +- src/app/workspace/cmdinput/aichat.tsx | 13 +- src/app/workspace/cmdinput/cmdinput.less | 2 +- src/app/workspace/cmdinput/cmdinput.tsx | 11 +- src/app/workspace/cmdinput/historyinfo.tsx | 5 +- src/app/workspace/cmdinput/infomsg.tsx | 4 +- src/app/workspace/cmdinput/textareainput.tsx | 18 +- src/app/workspace/screen/screenview.less | 5 +- src/app/workspace/screen/screenview.tsx | 36 +- src/app/workspace/screen/tab.tsx | 12 +- src/app/workspace/screen/tabs.less | 4 +- src/app/workspace/screen/tabs.tsx | 4 +- src/app/workspace/workspace.less | 2 +- src/app/workspace/workspaceview.tsx | 6 +- src/electron/emain.ts | 45 +- src/index.ts | 2 +- src/models/bookmarks.ts | 6 +- src/models/cmd.ts | 16 +- src/models/commandrunner.ts | 9 +- src/models/forwardlinecontainer.ts | 37 +- src/models/global.ts | 4 +- src/models/historyview.ts | 17 +- src/models/input.ts | 36 +- src/models/mainsidebar.ts | 4 +- src/models/modals.ts | 4 +- src/models/model.ts | 572 ++++++------ .../{model_old.ts => model_old.ts-deprecated} | 18 +- src/models/plugins.ts | 5 +- src/models/remotes.ts | 19 +- src/models/screen.ts | 39 +- src/models/screenlines.ts | 8 +- src/models/session.ts | 4 +- src/models/speciallinecontainer.ts | 9 +- src/models/ws.ts | 1 - src/plugins/code/code.less | 2 +- src/plugins/code/code.tsx | 17 +- src/plugins/core/basicrenderer.tsx | 29 +- src/plugins/core/incrementalrenderer.tsx | 12 +- src/plugins/core/ptydata.ts | 6 +- src/plugins/csv/csv.less | 2 +- src/plugins/csv/csv.tsx | 14 +- src/plugins/image/image.less | 2 +- src/plugins/image/image.tsx | 6 +- src/plugins/markdown/markdown.less | 2 +- src/plugins/markdown/markdown.tsx | 13 +- src/plugins/mustache/mustache.less | 2 +- src/plugins/mustache/mustache.tsx | 15 +- src/plugins/openai/openai.less | 2 +- src/plugins/openai/openai.tsx | 23 +- src/plugins/plugins.ts | 29 +- src/plugins/terminal/term.ts | 17 +- src/plugins/terminal/terminal.less | 6 +- src/plugins/terminal/terminal.tsx | 11 +- src/types/custom.d.ts | 816 +++++++++++++++- src/types/types.ts | 877 ------------------ src/util/modelutil.ts | 3 +- src/util/textmeasure.ts | 2 +- src/util/util.ts | 125 ++- tsconfig.json | 18 +- wavesrv/pkg/cmdrunner/cmdrunner.go | 531 +++++------ wavesrv/pkg/releasechecker/releasechecker.go | 5 +- wavesrv/pkg/remote/remote.go | 27 +- wavesrv/pkg/remote/sshclient.go | 5 +- wavesrv/pkg/scws/scws.go | 11 +- wavesrv/pkg/sstore/dbops.go | 137 +-- wavesrv/pkg/sstore/sstore.go | 67 +- wavesrv/pkg/sstore/updatebus.go | 187 +--- wavesrv/pkg/sstore/updatetypes.go | 234 +++++ webpack/webpack.electron.js | 12 +- webpack/webpack.web.js | 10 + 142 files changed, 2437 insertions(+), 2502 deletions(-) rename src/models/{model_old.ts => model_old.ts-deprecated} (99%) delete mode 100644 src/types/types.ts create mode 100644 wavesrv/pkg/sstore/updatetypes.go diff --git a/src/app/app.tsx b/src/app/app.tsx index 2d11394cc..381c18e3c 100644 --- a/src/app/app.tsx +++ b/src/app/app.tsx @@ -7,10 +7,9 @@ import * as mobx from "mobx"; import { boundMethod } from "autobind-decorator"; 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 "../models"; -import { isBlank } from "../util/util"; +import { GlobalModel } from "@/models"; +import { isBlank } from "@/util/util"; import { WorkspaceView } from "./workspace/workspaceview"; import { PluginsView } from "./pluginsview/pluginsview"; import { BookmarksView } from "./bookmarks/bookmarks"; @@ -25,8 +24,6 @@ import "./app.less"; dayjs.extend(localizedFormat); -type OV = mobx.IObservableValue; - @mobxReact.observer class App extends React.Component<{}, {}> { dcWait: OV = mobx.observable.box(false, { name: "dcWait" }); diff --git a/src/app/appconst.ts b/src/app/appconst.ts index 24e177e1f..742331801 100644 --- a/src/app/appconst.ts +++ b/src/app/appconst.ts @@ -47,3 +47,13 @@ export const TabIcons = [ export const VERSION = __WAVETERM_VERSION__; // @ts-ignore export const BUILD = __WAVETERM_BUILD__; + +/** + * Levels for the screen status indicator + */ +export enum StatusIndicatorLevel { + None = 0, + Output = 1, + Success = 2, + Error = 3, +} diff --git a/src/app/bookmarks/bookmarks.less b/src/app/bookmarks/bookmarks.less index 462a94b36..f781a5a3a 100644 --- a/src/app/bookmarks/bookmarks.less +++ b/src/app/bookmarks/bookmarks.less @@ -1,4 +1,4 @@ -@import "../../app/common/themes/themes.less"; +@import "@/common/themes/themes.less"; .bookmarks-view { background-color: @background-session; diff --git a/src/app/bookmarks/bookmarks.tsx b/src/app/bookmarks/bookmarks.tsx index 6809ff3b2..133fa3d89 100644 --- a/src/app/bookmarks/bookmarks.tsx +++ b/src/app/bookmarks/bookmarks.tsx @@ -7,15 +7,14 @@ import * as mobx from "mobx"; 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 "../../models"; -import { CmdStrCode, Markdown } from "../common/elements"; +import { GlobalModel } from "@/models"; +import { CmdStrCode, Markdown } from "@/common/elements"; -import { ReactComponent as XmarkIcon } from "../assets/icons/line/xmark.svg"; -import { ReactComponent as CopyIcon } from "../assets/icons/favourites/copy.svg"; -import { ReactComponent as PenIcon } from "../assets/icons/favourites/pen.svg"; -import { ReactComponent as TrashIcon } from "../assets/icons/favourites/trash.svg"; -import { ReactComponent as FavoritesIcon } from "../assets/icons/favourites.svg"; +import { ReactComponent as XmarkIcon } from "@/assets/icons/line/xmark.svg"; +import { ReactComponent as CopyIcon } from "@/assets/icons/favourites/copy.svg"; +import { ReactComponent as PenIcon } from "@/assets/icons/favourites/pen.svg"; +import { ReactComponent as TrashIcon } from "@/assets/icons/favourites/trash.svg"; +import { ReactComponent as FavoritesIcon } from "@/assets/icons/favourites.svg"; import "./bookmarks.less"; diff --git a/src/app/clientsettings/clientsettings.less b/src/app/clientsettings/clientsettings.less index 034953ecf..2d7b97cd3 100644 --- a/src/app/clientsettings/clientsettings.less +++ b/src/app/clientsettings/clientsettings.less @@ -1,4 +1,4 @@ -@import "../../app/common/themes/themes.less"; +@import "@/common/themes/themes.less"; .clientsettings-view { background-color: @background-session; diff --git a/src/app/clientsettings/clientsettings.tsx b/src/app/clientsettings/clientsettings.tsx index 3786e594b..48c7b0ea2 100644 --- a/src/app/clientsettings/clientsettings.tsx +++ b/src/app/clientsettings/clientsettings.tsx @@ -6,20 +6,19 @@ import * as mobxReact from "mobx-react"; import * as mobx from "mobx"; import { boundMethod } from "autobind-decorator"; import cn from "classnames"; -import { GlobalModel, GlobalCommandRunner, RemotesModel } from "../../models"; -import { Toggle, InlineSettingsTextEdit, SettingsError, Dropdown } from "../common/elements"; -import * as types from "../../types/types"; -import { commandRtnHandler, isBlank } from "../../util/util"; -import * as appconst from "../appconst"; +import { GlobalModel, GlobalCommandRunner, RemotesModel } from "@/models"; +import { Toggle, InlineSettingsTextEdit, SettingsError, Dropdown } from "@/common/elements"; +import { commandRtnHandler, isBlank } from "@/util/util"; +import * as appconst from "@/app/appconst"; import "./clientsettings.less"; @mobxReact.observer class ClientSettingsView extends React.Component<{ model: RemotesModel }, { hoveredItemId: string }> { - fontSizeDropdownActive: types.OV = mobx.observable.box(false, { + fontSizeDropdownActive: OV = mobx.observable.box(false, { name: "clientSettings-fontSizeDropdownActive", }); - errorMessage: types.OV = mobx.observable.box(null, { name: "ClientSettings-errorMessage" }); + errorMessage: OV = mobx.observable.box(null, { name: "ClientSettings-errorMessage" }); @boundMethod dismissError(): void { @@ -48,7 +47,7 @@ class ClientSettingsView extends React.Component<{ model: RemotesModel }, { hove @boundMethod handleChangeTelemetry(val: boolean): void { - let prtn: Promise = null; + let prtn: Promise = null; if (val) { prtn = GlobalCommandRunner.telemetryOn(false); } else { @@ -59,7 +58,7 @@ class ClientSettingsView extends React.Component<{ model: RemotesModel }, { hove @boundMethod handleChangeReleaseCheck(val: boolean): void { - let prtn: Promise = null; + let prtn: Promise = null; if (val) { prtn = GlobalCommandRunner.releaseCheckAutoOn(false); } else { @@ -112,7 +111,7 @@ class ClientSettingsView extends React.Component<{ model: RemotesModel }, { hove return null; } - let cdata: types.ClientDataType = GlobalModel.clientData.get(); + let cdata: ClientDataType = GlobalModel.clientData.get(); let openAIOpts = cdata.openaiopts ?? {}; let apiTokenStr = isBlank(openAIOpts.apitoken) ? "(not set)" : "********"; let maxTokensStr = String( diff --git a/src/app/common/elements/button.less b/src/app/common/elements/button.less index ac10dbdbe..d2303acc4 100644 --- a/src/app/common/elements/button.less +++ b/src/app/common/elements/button.less @@ -1,4 +1,4 @@ -@import "../../../app/common/themes/themes.less"; +@import "@/common/themes/themes.less"; .wave-button { background: none; diff --git a/src/app/common/elements/checkbox.less b/src/app/common/elements/checkbox.less index f0c52877e..82e126b7c 100644 --- a/src/app/common/elements/checkbox.less +++ b/src/app/common/elements/checkbox.less @@ -1,4 +1,4 @@ -@import "../../../app/common/themes/themes.less"; +@import "@/common/themes/themes.less"; .checkbox { display: flex; diff --git a/src/app/common/elements/cmdstrcode.less b/src/app/common/elements/cmdstrcode.less index 83bb17fc4..2f54d4301 100644 --- a/src/app/common/elements/cmdstrcode.less +++ b/src/app/common/elements/cmdstrcode.less @@ -1,4 +1,4 @@ -@import "../../../app/common/themes/themes.less"; +@import "@/common/themes/themes.less"; .cmdstr-code { position: relative; diff --git a/src/app/common/elements/cmdstrcode.tsx b/src/app/common/elements/cmdstrcode.tsx index 8063d8732..67c993251 100644 --- a/src/app/common/elements/cmdstrcode.tsx +++ b/src/app/common/elements/cmdstrcode.tsx @@ -6,8 +6,8 @@ import { boundMethod } from "autobind-decorator"; import cn from "classnames"; import { If } from "tsx-control-statements/components"; -import { ReactComponent as CheckIcon } from "../../assets/icons/line/check.svg"; -import { ReactComponent as CopyIcon } from "../../assets/icons/history/copy.svg"; +import { ReactComponent as CheckIcon } from "@/assets/icons/line/check.svg"; +import { ReactComponent as CopyIcon } from "@/assets/icons/history/copy.svg"; import "./cmdstrcode.less"; diff --git a/src/app/common/elements/dropdown.less b/src/app/common/elements/dropdown.less index 267fbffcf..8a6ad050f 100644 --- a/src/app/common/elements/dropdown.less +++ b/src/app/common/elements/dropdown.less @@ -1,4 +1,4 @@ -@import "../../../app/common/themes/themes.less"; +@import "@/common/themes/themes.less"; .wave-dropdown { position: relative; diff --git a/src/app/common/elements/inlinesettingstextedit.less b/src/app/common/elements/inlinesettingstextedit.less index bab9243bc..31a77ffbd 100644 --- a/src/app/common/elements/inlinesettingstextedit.less +++ b/src/app/common/elements/inlinesettingstextedit.less @@ -1,4 +1,4 @@ -@import "../../../app/common/themes/themes.less"; +@import "@/common/themes/themes.less"; .inline-edit { .icon { diff --git a/src/app/common/elements/inlinesettingstextedit.tsx b/src/app/common/elements/inlinesettingstextedit.tsx index 194eeead3..d6cf9497b 100644 --- a/src/app/common/elements/inlinesettingstextedit.tsx +++ b/src/app/common/elements/inlinesettingstextedit.tsx @@ -7,12 +7,10 @@ import * as mobx from "mobx"; import { boundMethod } from "autobind-decorator"; import cn from "classnames"; import { If } from "tsx-control-statements/components"; -import { checkKeyPressed, adaptFromReactOrNativeKeyEvent } from "../../../util/keyutil"; +import { checkKeyPressed, adaptFromReactOrNativeKeyEvent } from "@/util/keyutil"; import "./inlinesettingstextedit.less"; -type OV = mobx.IObservableValue; - @mobxReact.observer class InlineSettingsTextEdit extends React.Component< { diff --git a/src/app/common/elements/inputdecoration.less b/src/app/common/elements/inputdecoration.less index 0ae5f74b5..27f0df9f2 100644 --- a/src/app/common/elements/inputdecoration.less +++ b/src/app/common/elements/inputdecoration.less @@ -1,4 +1,4 @@ -@import "../../../app/common/themes/themes.less"; +@import "@/common/themes/themes.less"; .wave-input-decoration { display: flex; diff --git a/src/app/common/elements/markdown.less b/src/app/common/elements/markdown.less index 1e68db420..e6ef018c1 100644 --- a/src/app/common/elements/markdown.less +++ b/src/app/common/elements/markdown.less @@ -1,4 +1,4 @@ -@import "../../../app/common/themes/themes.less"; +@import "@/common/themes/themes.less"; .markdown { color: @term-white; diff --git a/src/app/common/elements/markdown.tsx b/src/app/common/elements/markdown.tsx index 89ea05a37..86c558973 100644 --- a/src/app/common/elements/markdown.tsx +++ b/src/app/common/elements/markdown.tsx @@ -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 "../../../models"; +import { GlobalModel } from "@/models"; import "./markdown.less"; diff --git a/src/app/common/elements/modal.less b/src/app/common/elements/modal.less index 7ac04104f..432291f62 100644 --- a/src/app/common/elements/modal.less +++ b/src/app/common/elements/modal.less @@ -1,4 +1,4 @@ -@import "../../../app/common/themes/themes.less"; +@import "@/common/themes/themes.less"; .wave-modal-container { position: fixed; diff --git a/src/app/common/elements/modal.tsx b/src/app/common/elements/modal.tsx index cc8c1ff80..f05d27c2f 100644 --- a/src/app/common/elements/modal.tsx +++ b/src/app/common/elements/modal.tsx @@ -10,8 +10,6 @@ import { IconButton } from "./iconbutton"; import "./modal.less"; -type OV = mobx.IObservableValue; - interface ModalHeaderProps { onClose?: () => void; title: string; diff --git a/src/app/common/elements/passwordfield.less b/src/app/common/elements/passwordfield.less index 88c6e948d..753403dec 100644 --- a/src/app/common/elements/passwordfield.less +++ b/src/app/common/elements/passwordfield.less @@ -1,4 +1,4 @@ -@import "../../../app/common/themes/themes.less"; +@import "@/common/themes/themes.less"; .wave-password { .wave-textfield-inner-eye { diff --git a/src/app/common/elements/resizablesidebar.less b/src/app/common/elements/resizablesidebar.less index 819c05ad1..a67363df7 100644 --- a/src/app/common/elements/resizablesidebar.less +++ b/src/app/common/elements/resizablesidebar.less @@ -1,4 +1,4 @@ -@import "../../../app/common/themes/themes.less"; +@import "@/common/themes/themes.less"; .sidebar-handle { position: absolute; diff --git a/src/app/common/elements/resizablesidebar.tsx b/src/app/common/elements/resizablesidebar.tsx index e34f7424c..2652c308c 100644 --- a/src/app/common/elements/resizablesidebar.tsx +++ b/src/app/common/elements/resizablesidebar.tsx @@ -6,13 +6,11 @@ import * as mobxReact from "mobx-react"; import * as mobx from "mobx"; import { boundMethod } from "autobind-decorator"; import cn from "classnames"; -import { GlobalModel, GlobalCommandRunner } from "../../../models"; -import { MagicLayout } from "../../magiclayout"; +import { GlobalModel, GlobalCommandRunner } from "@/models"; +import { MagicLayout } from "@/app/magiclayout"; import "./resizablesidebar.less"; -type OV = mobx.IObservableValue; - interface ResizableSidebarProps { parentRef: React.RefObject; position: "left" | "right"; diff --git a/src/app/common/elements/settingserror.tsx b/src/app/common/elements/settingserror.tsx index aa72b836a..e2296b13b 100644 --- a/src/app/common/elements/settingserror.tsx +++ b/src/app/common/elements/settingserror.tsx @@ -6,8 +6,6 @@ import * as mobxReact from "mobx-react"; import * as mobx from "mobx"; import { boundMethod } from "autobind-decorator"; -type OV = mobx.IObservableValue; - @mobxReact.observer class SettingsError extends React.Component<{ errorMessage: OV }, {}> { @boundMethod diff --git a/src/app/common/elements/showwaveshellinstallprompt.tsx b/src/app/common/elements/showwaveshellinstallprompt.tsx index 42679ecd0..647cd74d4 100644 --- a/src/app/common/elements/showwaveshellinstallprompt.tsx +++ b/src/app/common/elements/showwaveshellinstallprompt.tsx @@ -1,8 +1,8 @@ // Copyright 2023, Command Line Inc. // SPDX-License-Identifier: Apache-2.0 -import { GlobalModel } from "../../../models"; -import * as appconst from "../../appconst"; +import { GlobalModel } from "@/models"; +import * as appconst from "@/app/appconst"; function ShowWaveShellInstallPrompt(callbackFn: () => void) { let message: string = ` diff --git a/src/app/common/elements/status.less b/src/app/common/elements/status.less index 9c1028b83..e7d15dd98 100644 --- a/src/app/common/elements/status.less +++ b/src/app/common/elements/status.less @@ -1,4 +1,4 @@ -@import "../../../app/common/themes/themes.less"; +@import "@/common/themes/themes.less"; .wave-status-container { display: flex; diff --git a/src/app/common/elements/textfield.less b/src/app/common/elements/textfield.less index 12261ce69..2354c808f 100644 --- a/src/app/common/elements/textfield.less +++ b/src/app/common/elements/textfield.less @@ -1,4 +1,4 @@ -@import "../../../app/common/themes/themes.less"; +@import "@/common/themes/themes.less"; .wave-textfield { display: flex; diff --git a/src/app/common/elements/toggle.less b/src/app/common/elements/toggle.less index d920b9b0b..81ef1c485 100644 --- a/src/app/common/elements/toggle.less +++ b/src/app/common/elements/toggle.less @@ -1,4 +1,4 @@ -@import "../../../app/common/themes/themes.less"; +@import "@/common/themes/themes.less"; .checkbox-toggle { position: relative; diff --git a/src/app/common/elements/tooltip.less b/src/app/common/elements/tooltip.less index e51b85152..f37f925c6 100644 --- a/src/app/common/elements/tooltip.less +++ b/src/app/common/elements/tooltip.less @@ -1,4 +1,4 @@ -@import "../../../app/common/themes/themes.less"; +@import "@/common/themes/themes.less"; .wave-tooltip { display: flex; diff --git a/src/app/common/error/errorboundary.tsx b/src/app/common/error/errorboundary.tsx index d4d32a7b0..6b1e15d3b 100644 --- a/src/app/common/error/errorboundary.tsx +++ b/src/app/common/error/errorboundary.tsx @@ -1,5 +1,4 @@ import React, { Component, ReactNode } from "react"; -import { RendererContext } from "../../../types/types"; import cn from "classnames"; interface ErrorBoundaryState { diff --git a/src/app/common/icons/icons.less b/src/app/common/icons/icons.less index 800d18856..64b081c8f 100644 --- a/src/app/common/icons/icons.less +++ b/src/app/common/icons/icons.less @@ -1,4 +1,4 @@ -@import "../../../app/common/themes/themes.less"; +@import "@/common/themes/themes.less"; .front-icon { margin-right: 5px; diff --git a/src/app/common/icons/icons.tsx b/src/app/common/icons/icons.tsx index e437b0447..80f4b63ce 100644 --- a/src/app/common/icons/icons.tsx +++ b/src/app/common/icons/icons.tsx @@ -1,12 +1,12 @@ import React from "react"; -import { StatusIndicatorLevel } from "../../../types/types"; import cn from "classnames"; -import { ReactComponent as SpinnerIndicator } from "../../assets/icons/spinner-indicator.svg"; +import { ReactComponent as SpinnerIndicator } from "@/assets/icons/spinner-indicator.svg"; import { boundMethod } from "autobind-decorator"; import * as mobx from "mobx"; import * as mobxReact from "mobx-react"; +import * as appconst from "@/app/appconst"; -import { ReactComponent as RotateIconSvg } from "../../assets/icons/line/rotate.svg"; +import { ReactComponent as RotateIconSvg } from "@/assets/icons/line/rotate.svg"; interface PositionalIconProps { children?: React.ReactNode; @@ -131,7 +131,7 @@ interface StatusIndicatorProps { /** * The level of the status indicator. This will determine the color of the status indicator. */ - level: StatusIndicatorLevel; + level: appconst.StatusIndicatorLevel; className?: string; /** * If true, a spinner will be shown around the status indicator. @@ -191,16 +191,16 @@ export class StatusIndicator extends React.Component { const { level, className, runningCommands } = this.props; const spinnerVisible = this.spinnerVisible.get(); let statusIndicator = null; - if (level != StatusIndicatorLevel.None || spinnerVisible) { + if (level != appconst.StatusIndicatorLevel.None || spinnerVisible) { let indicatorLevelClass = null; switch (level) { - case StatusIndicatorLevel.Output: + case appconst.StatusIndicatorLevel.Output: indicatorLevelClass = "output"; break; - case StatusIndicatorLevel.Success: + case appconst.StatusIndicatorLevel.Success: indicatorLevelClass = "success"; break; - case StatusIndicatorLevel.Error: + case appconst.StatusIndicatorLevel.Error: indicatorLevelClass = "error"; break; } diff --git a/src/app/common/modals/about.less b/src/app/common/modals/about.less index 025246493..e6ec8869b 100644 --- a/src/app/common/modals/about.less +++ b/src/app/common/modals/about.less @@ -1,4 +1,4 @@ -@import "../../../app/common/themes/themes.less"; +@import "@/common/themes/themes.less"; .about-modal { .wave-modal-content { diff --git a/src/app/common/modals/about.tsx b/src/app/common/modals/about.tsx index c8ab58f74..7c844f13b 100644 --- a/src/app/common/modals/about.tsx +++ b/src/app/common/modals/about.tsx @@ -5,12 +5,12 @@ import * as React from "react"; import * as mobxReact from "mobx-react"; import * as mobx from "mobx"; import { boundMethod } from "autobind-decorator"; -import { GlobalModel } from "../../../models"; -import { Modal, LinkButton } from "../elements"; -import * as util from "../../../util/util"; -import * as appconst from "../../appconst"; +import { GlobalModel } from "@/models"; +import { Modal, LinkButton } from "@/elements"; +import * as util from "@/util/util"; +import * as appconst from "@/app/appconst"; -import logo from "../../assets/waveterm-logo-with-bg.svg"; +import logo from "@/assets/waveterm-logo-with-bg.svg"; import "./about.less"; @mobxReact.observer diff --git a/src/app/common/modals/alert.less b/src/app/common/modals/alert.less index ddec18c57..953ce7996 100644 --- a/src/app/common/modals/alert.less +++ b/src/app/common/modals/alert.less @@ -1,4 +1,4 @@ -@import "../../../app/common/themes/themes.less"; +@import "@/common/themes/themes.less"; .alert-modal { width: 500px; diff --git a/src/app/common/modals/alert.tsx b/src/app/common/modals/alert.tsx index b6fbf99c7..a65d6f173 100644 --- a/src/app/common/modals/alert.tsx +++ b/src/app/common/modals/alert.tsx @@ -5,8 +5,8 @@ import * as React from "react"; 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 "../../../models"; +import { Markdown, Modal, Button, Checkbox } from "@/elements"; +import { GlobalModel, GlobalCommandRunner } from "@/models"; import "./alert.less"; diff --git a/src/app/common/modals/clientstop.less b/src/app/common/modals/clientstop.less index 4ce7d7594..bad36c4b6 100644 --- a/src/app/common/modals/clientstop.less +++ b/src/app/common/modals/clientstop.less @@ -1,4 +1,4 @@ -@import "../../../app/common/themes/themes.less"; +@import "@/common/themes/themes.less"; .clientstop-modal { .inner-content { diff --git a/src/app/common/modals/clientstop.tsx b/src/app/common/modals/clientstop.tsx index 9b381fe01..9a6f99eea 100644 --- a/src/app/common/modals/clientstop.tsx +++ b/src/app/common/modals/clientstop.tsx @@ -5,8 +5,8 @@ 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 "../../../models"; -import { Modal, Button } from "../elements"; +import { GlobalModel } from "@/models"; +import { Modal, Button } from "@/elements"; import "./clientstop.less"; diff --git a/src/app/common/modals/createremoteconn.less b/src/app/common/modals/createremoteconn.less index f6e3a1f00..e92036056 100644 --- a/src/app/common/modals/createremoteconn.less +++ b/src/app/common/modals/createremoteconn.less @@ -1,4 +1,4 @@ -@import "../../../app/common/themes/themes.less"; +@import "@/common/themes/themes.less"; .crconn-modal { width: 452px; diff --git a/src/app/common/modals/createremoteconn.tsx b/src/app/common/modals/createremoteconn.tsx index 08cb18eca..297e67973 100644 --- a/src/app/common/modals/createremoteconn.tsx +++ b/src/app/common/modals/createremoteconn.tsx @@ -6,8 +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 "../../../models"; -import * as T from "../../../types/types"; +import { GlobalModel, GlobalCommandRunner, RemotesModel } from "@/models"; import { Modal, TextField, @@ -17,13 +16,11 @@ import { PasswordField, Tooltip, ShowWaveShellInstallPrompt, -} from "../elements"; -import * as util from "../../../util/util"; +} from "@/elements"; +import * as util from "@/util/util"; import "./createremoteconn.less"; -type OV = mobx.IObservableValue; - @mobxReact.observer class CreateRemoteConnModal extends React.Component<{}, {}> { tempAlias: OV; @@ -35,7 +32,7 @@ class CreateRemoteConnModal extends React.Component<{}, {}> { tempKeyFile: OV; tempShellPref: OV; errorStr: OV; - remoteEdit: T.RemoteEditType; + remoteEdit: RemoteEditType; model: RemotesModel; constructor(props: { remotesModel?: RemotesModel }) { diff --git a/src/app/common/modals/disconnected.less b/src/app/common/modals/disconnected.less index 1439c9298..7ff50c612 100644 --- a/src/app/common/modals/disconnected.less +++ b/src/app/common/modals/disconnected.less @@ -1,4 +1,4 @@ -@import "../../../app/common/themes/themes.less"; +@import "@/common/themes/themes.less"; .disconnected-modal { .wave-modal-content { diff --git a/src/app/common/modals/disconnected.tsx b/src/app/common/modals/disconnected.tsx index 97f42b695..623729e8b 100644 --- a/src/app/common/modals/disconnected.tsx +++ b/src/app/common/modals/disconnected.tsx @@ -5,8 +5,8 @@ import * as React from "react"; import * as mobxReact from "mobx-react"; import * as mobx from "mobx"; import { boundMethod } from "autobind-decorator"; -import { GlobalModel } from "../../../models"; -import { Modal, Button } from "../elements"; +import { GlobalModel } from "@/models"; +import { Modal, Button } from "@/elements"; import "./disconnected.less"; diff --git a/src/app/common/modals/editremoteconn.less b/src/app/common/modals/editremoteconn.less index bb98eb3d6..ff5284250 100644 --- a/src/app/common/modals/editremoteconn.less +++ b/src/app/common/modals/editremoteconn.less @@ -1,4 +1,4 @@ -@import "../../../app/common/themes/themes.less"; +@import "@/common/themes/themes.less"; .erconn-modal { width: 502px; diff --git a/src/app/common/modals/editremoteconn.tsx b/src/app/common/modals/editremoteconn.tsx index 3184de618..c59813801 100644 --- a/src/app/common/modals/editremoteconn.tsx +++ b/src/app/common/modals/editremoteconn.tsx @@ -6,15 +6,12 @@ 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 "../../../models"; -import * as T from "../../../types/types"; -import { Modal, TextField, InputDecoration, Dropdown, PasswordField, Tooltip } from "../elements"; -import * as util from "../../../util/util"; +import { GlobalModel, GlobalCommandRunner, RemotesModel } from "@/models"; +import { Modal, TextField, InputDecoration, Dropdown, PasswordField, Tooltip } from "@/elements"; +import * as util from "@/util/util"; import "./editremoteconn.less"; -type OV = mobx.IObservableValue; - const PasswordUnchangedSentinel = "--unchanged--"; @mobxReact.observer @@ -42,11 +39,11 @@ class EditRemoteConnModal extends React.Component<{}, {}> { return this.model.selectedRemoteId.get(); } - get selectedRemote(): T.RemoteType { + get selectedRemote(): RemoteType { return GlobalModel.getRemote(this.selectedRemoteId); } - get remoteEdit(): T.RemoteEditType { + get remoteEdit(): RemoteEditType { return this.model.remoteEdit.get(); } diff --git a/src/app/common/modals/linesettings.less b/src/app/common/modals/linesettings.less index d7f2c03b0..23cb8d497 100644 --- a/src/app/common/modals/linesettings.less +++ b/src/app/common/modals/linesettings.less @@ -1,4 +1,4 @@ -@import "../../../app/common/themes/themes.less"; +@import "@/common/themes/themes.less"; .line-settings-modal { width: 640px; diff --git a/src/app/common/modals/linesettings.tsx b/src/app/common/modals/linesettings.tsx index 8ce648b22..d9af09fb2 100644 --- a/src/app/common/modals/linesettings.tsx +++ b/src/app/common/modals/linesettings.tsx @@ -5,16 +5,13 @@ 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 "../../../models"; -import { SettingsError, Modal, Dropdown } from "../elements"; -import { LineType, RendererPluginType } from "../../../types/types"; -import { PluginModel } from "../../../plugins/plugins"; -import { commandRtnHandler } from "../../../util/util"; +import { GlobalModel, GlobalCommandRunner } from "@/models"; +import { SettingsError, Modal, Dropdown } from "@/elements"; +import { PluginModel } from "@/plugins/plugins"; +import { commandRtnHandler } from "@/util/util"; import "./linesettings.less"; -type OV = mobx.IObservableValue; - @mobxReact.observer class LineSettingsModal extends React.Component<{}, {}> { rendererDropdownActive: OV = mobx.observable.box(false, { name: "lineSettings-rendererDropdownActive" }); diff --git a/src/app/common/modals/provider.tsx b/src/app/common/modals/provider.tsx index a0bfec656..27acbd308 100644 --- a/src/app/common/modals/provider.tsx +++ b/src/app/common/modals/provider.tsx @@ -3,7 +3,7 @@ import * as React from "react"; import * as mobxReact from "mobx-react"; -import { GlobalModel } from "../../../models"; +import { GlobalModel } from "@/models"; import { TosModal } from "./tos"; @mobxReact.observer diff --git a/src/app/common/modals/registry.tsx b/src/app/common/modals/registry.tsx index 4f073c776..7853742c4 100644 --- a/src/app/common/modals/registry.tsx +++ b/src/app/common/modals/registry.tsx @@ -13,8 +13,8 @@ import { ScreenSettingsModal, LineSettingsModal, UserInputModal, -} from "../modals"; -import * as constants from "../../appconst"; +} from "@/modals"; +import * as constants from "@/app/appconst"; const modalsRegistry: { [key: string]: React.ComponentType } = { [constants.ABOUT]: AboutModal, diff --git a/src/app/common/modals/screensettings.less b/src/app/common/modals/screensettings.less index 5d2d7674d..1719a9c0f 100644 --- a/src/app/common/modals/screensettings.less +++ b/src/app/common/modals/screensettings.less @@ -1,4 +1,4 @@ -@import "../../../app/common/themes/themes.less"; +@import "@/common/themes/themes.less"; .screen-settings-modal { width: 640px; diff --git a/src/app/common/modals/screensettings.tsx b/src/app/common/modals/screensettings.tsx index 3f657fc78..3e3a5fc21 100644 --- a/src/app/common/modals/screensettings.tsx +++ b/src/app/common/modals/screensettings.tsx @@ -7,20 +7,16 @@ 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, Screen } from "../../../models"; -import { Toggle, InlineSettingsTextEdit, SettingsError, Modal, Dropdown, Tooltip } from "../elements"; -import { RemoteType } from "../../../types/types"; -import * as util from "../../../util/util"; -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 { GlobalModel, GlobalCommandRunner, Screen } from "@/models"; +import { Toggle, InlineSettingsTextEdit, SettingsError, Modal, Dropdown, Tooltip } from "@/elements"; +import * as util 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 "@/app/appconst"; import "./screensettings.less"; -type OV = mobx.IObservableValue; - const ScreenDeleteMessage = ` Are you sure you want to delete this tab? @@ -98,7 +94,7 @@ class ScreenSettingsModal extends React.Component<{}, {}> { return; } let prtn = GlobalCommandRunner.screenSetSettings(this.screenId, { tabcolor: color }, false); - commandRtnHandler(prtn, this.errorMessage); + util.commandRtnHandler(prtn, this.errorMessage); } @boundMethod @@ -119,7 +115,7 @@ class ScreenSettingsModal extends React.Component<{}, {}> { return; } let prtn = GlobalCommandRunner.screenArchive(this.screenId, val); - commandRtnHandler(prtn, this.errorMessage); + util.commandRtnHandler(prtn, this.errorMessage); } @boundMethod @@ -137,7 +133,7 @@ class ScreenSettingsModal extends React.Component<{}, {}> { return; } let prtn = GlobalCommandRunner.screenWebShare(this.screen.screenId, val); - commandRtnHandler(prtn, this.errorMessage); + util.commandRtnHandler(prtn, this.errorMessage); }); } @@ -170,7 +166,7 @@ class ScreenSettingsModal extends React.Component<{}, {}> { return; } let prtn = GlobalCommandRunner.screenSetSettings(this.screenId, { name: val }, false); - commandRtnHandler(prtn, this.errorMessage); + util.commandRtnHandler(prtn, this.errorMessage); } @boundMethod @@ -182,7 +178,7 @@ class ScreenSettingsModal extends React.Component<{}, {}> { return; } let prtn = GlobalCommandRunner.screenSetSettings(this.screenId, { sharename: val }, false); - commandRtnHandler(prtn, this.errorMessage); + util.commandRtnHandler(prtn, this.errorMessage); } @boundMethod @@ -209,7 +205,7 @@ class ScreenSettingsModal extends React.Component<{}, {}> { return; } let prtn = GlobalCommandRunner.screenDelete(this.screenId, false); - commandRtnHandler(prtn, this.errorMessage); + util.commandRtnHandler(prtn, this.errorMessage); GlobalModel.modalsModel.popModal(); }); } diff --git a/src/app/common/modals/sessionsettings.less b/src/app/common/modals/sessionsettings.less index a28564cc4..d8c7535ce 100644 --- a/src/app/common/modals/sessionsettings.less +++ b/src/app/common/modals/sessionsettings.less @@ -1,4 +1,4 @@ -@import "../../../app/common/themes/themes.less"; +@import "@/common/themes/themes.less"; .session-settings-modal { width: 640px; diff --git a/src/app/common/modals/sessionsettings.tsx b/src/app/common/modals/sessionsettings.tsx index e0be3f09c..c7590b8be 100644 --- a/src/app/common/modals/sessionsettings.tsx +++ b/src/app/common/modals/sessionsettings.tsx @@ -5,15 +5,12 @@ 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 "../../../models"; -import { Toggle, InlineSettingsTextEdit, SettingsError, Modal, Tooltip } from "../elements"; -import * as util from "../../../util/util"; -import { commandRtnHandler } from "../../../util/util"; +import { GlobalModel, GlobalCommandRunner, Session } from "@/models"; +import { Toggle, InlineSettingsTextEdit, SettingsError, Modal, Tooltip } from "@/elements"; +import * as util from "@/util/util"; import "./sessionsettings.less"; -type OV = mobx.IObservableValue; - const SessionDeleteMessage = ` Are you sure you want to delete this workspace? @@ -52,7 +49,7 @@ class SessionSettingsModal extends React.Component<{}, {}> { return; } let prtn = GlobalCommandRunner.sessionSetSettings(this.sessionId, { name: newVal }, false); - commandRtnHandler(prtn, this.errorMessage); + util.commandRtnHandler(prtn, this.errorMessage); } @boundMethod @@ -64,7 +61,7 @@ class SessionSettingsModal extends React.Component<{}, {}> { return; } let prtn = GlobalCommandRunner.sessionArchive(this.sessionId, val); - commandRtnHandler(prtn, this.errorMessage); + util.commandRtnHandler(prtn, this.errorMessage); } @boundMethod @@ -76,7 +73,7 @@ class SessionSettingsModal extends React.Component<{}, {}> { return; } let prtn = GlobalCommandRunner.sessionDelete(this.sessionId); - commandRtnHandler(prtn, this.errorMessage, () => GlobalModel.modalsModel.popModal()); + util.commandRtnHandler(prtn, this.errorMessage, () => GlobalModel.modalsModel.popModal()); }); } diff --git a/src/app/common/modals/tabswitcher.less b/src/app/common/modals/tabswitcher.less index 1bbfee5af..17f8a78a3 100644 --- a/src/app/common/modals/tabswitcher.less +++ b/src/app/common/modals/tabswitcher.less @@ -1,4 +1,4 @@ -@import "../../../app/common/themes/themes.less"; +@import "@/common/themes/themes.less"; .tabswitcher-modal { width: 452px; diff --git a/src/app/common/modals/tabswitcher.tsx b/src/app/common/modals/tabswitcher.tsx index 5a4b213e3..9b0f207fc 100644 --- a/src/app/common/modals/tabswitcher.tsx +++ b/src/app/common/modals/tabswitcher.tsx @@ -5,18 +5,20 @@ import * as React from "react"; import * as mobxReact from "mobx-react"; import * as mobx from "mobx"; import { boundMethod } from "autobind-decorator"; -import { For } from "tsx-control-statements/components"; +import { If, For } from "tsx-control-statements/components"; import cn from "classnames"; -import { GlobalModel, GlobalCommandRunner } from "../../../models"; -import { Modal, TextField, InputDecoration, Tooltip } from "../elements"; -import * as util from "../../../util/util"; -import { Screen } from "../../../models"; -import { ReactComponent as SquareIcon } from "../../assets/icons/tab/square.svg"; +import { GlobalModel, GlobalCommandRunner } from "@/models"; +import { Modal, TextField, InputDecoration, Tooltip } from "@/elements"; +import * as util from "@/util/util"; +import { Screen } from "@/models"; +import { ReactComponent as SquareIcon } from "@/assets/icons/tab/square.svg"; import "./tabswitcher.less"; -type OV = mobx.IObservableValue; -type OArr = mobx.IObservableArray; +type ViewDataType = { + label: string; + value: string; +}; type SwitcherDataType = { sessionId: string; @@ -27,9 +29,25 @@ type SwitcherDataType = { screenName: string; icon: string; color: string; + viewData?: ViewDataType; }; const MaxOptionsToDisplay = 100; +const additionalOptions = [ + { label: "Connections", value: "connections" }, + { label: "History", value: "history" }, + { label: "Settings", value: "clientsettings" }, +].map((item, index) => ({ + sessionId: `additional-${index}`, + sessionName: "", + sessionIdx: -1, + screenId: `additional-${index}`, + screenIdx: -1, + screenName: "", + icon: "", + color: "", + viewData: item, +})); @mobxReact.observer class TabSwitcherModal extends React.Component<{}, {}> { @@ -47,8 +65,8 @@ class TabSwitcherModal extends React.Component<{}, {}> { componentDidMount() { this.activeSessionIdx = GlobalModel.getActiveSession().sessionIdx.get(); - let oSessions = GlobalModel.sessionList; - let oScreens = GlobalModel.screenMap; + const oSessions = GlobalModel.sessionList; + const oScreens = GlobalModel.screenMap; oScreens.forEach((oScreen) => { if (oScreen == null) { return; @@ -57,13 +75,13 @@ class TabSwitcherModal extends React.Component<{}, {}> { return; } // Find the matching session in the observable array - let foundSession = oSessions.find((s) => { + const foundSession = oSessions.find((s) => { return s.sessionId == oScreen.sessionId && !s.archived.get(); }); if (!foundSession) { return; } - let data: SwitcherDataType = { + const data: SwitcherDataType = { sessionName: foundSession.name.get(), sessionId: foundSession.sessionId, sessionIdx: foundSession.sessionIdx.get(), @@ -88,11 +106,11 @@ class TabSwitcherModal extends React.Component<{}, {}> { } componentDidUpdate() { - let currFocusedIdx = this.focusedIdx.get(); + const currFocusedIdx = this.focusedIdx.get(); // Check if selectedIdx has changed if (currFocusedIdx !== this.prevFocusedIdx) { - let optionElement = this.optionRefs[currFocusedIdx]?.current; + const optionElement = this.optionRefs[currFocusedIdx]?.current; if (optionElement) { optionElement.scrollIntoView({ block: "nearest" }); @@ -109,7 +127,7 @@ class TabSwitcherModal extends React.Component<{}, {}> { @boundMethod getTabIcon(screen: Screen): string { let tabIcon = "default"; - let screenOpts = screen.opts.get(); + const screenOpts = screen.opts.get(); if (screenOpts != null && !util.isBlank(screenOpts.tabicon)) { tabIcon = screenOpts.tabicon; } @@ -119,7 +137,7 @@ class TabSwitcherModal extends React.Component<{}, {}> { @boundMethod getTabColor(screen: Screen): string { let tabColor = "default"; - let screenOpts = screen.opts.get(); + const screenOpts = screen.opts.get(); if (screenOpts != null && !util.isBlank(screenOpts.tabcolor)) { tabColor = screenOpts.tabcolor; } @@ -132,7 +150,7 @@ class TabSwitcherModal extends React.Component<{}, {}> { this.closeModal(); } else if (e.key === "ArrowUp" || e.key === "ArrowDown") { e.preventDefault(); - let newIndex = this.calculateNewIndex(e.key === "ArrowUp"); + const newIndex = this.calculateNewIndex(e.key === "ArrowUp"); this.setFocusedIndex(newIndex); } else if (e.key === "Enter") { e.preventDefault(); @@ -142,7 +160,7 @@ class TabSwitcherModal extends React.Component<{}, {}> { @boundMethod calculateNewIndex(isUpKey) { - let currentIndex = this.focusedIdx.get(); + const currentIndex = this.focusedIdx.get(); if (isUpKey) { return Math.max(currentIndex - 1, 0); } else { @@ -165,6 +183,11 @@ class TabSwitcherModal extends React.Component<{}, {}> { @boundMethod handleSelect(index: number): void { const selectedOption = this.sOptions[index]; + if (selectedOption.sessionIdx === -1) { + GlobalCommandRunner.switchView(selectedOption.viewData.value); + this.closeModal(); + return; + } if (selectedOption) { GlobalCommandRunner.switchScreen(selectedOption.screenId, selectedOption.sessionId); this.closeModal(); @@ -192,27 +215,28 @@ class TabSwitcherModal extends React.Component<{}, {}> { @mobx.computed @boundMethod filterOptions(searchInput: string): SwitcherDataType[] { - let filteredScreens = []; - - for (let i = 0; i < this.options.length; i++) { - let tab = this.options[i]; - let match = false; + const searchLower = searchInput.toLowerCase(); + let filteredScreens = this.options.filter((tab) => { if (searchInput.includes("/")) { - let [sessionFilter, screenFilter] = searchInput.split("/").map((s) => s.trim().toLowerCase()); - match = + const [sessionFilter, screenFilter] = searchInput.split("/").map((s) => s.trim().toLowerCase()); + return ( tab.sessionName.toLowerCase().includes(sessionFilter) && - tab.screenName.toLowerCase().includes(screenFilter); + tab.screenName.toLowerCase().includes(screenFilter) + ); } else { - match = - tab.sessionName.toLowerCase().includes(searchInput) || - tab.screenName.toLowerCase().includes(searchInput); + return ( + tab.sessionName.toLowerCase().includes(searchLower) || + tab.screenName.toLowerCase().includes(searchLower) + ); } + }); - // Add tab to filtered list if it matches the criteria - if (match) { - filteredScreens.push(tab); - } + if (searchLower.length > 0) { + const additionalFiltered = additionalOptions.filter((item) => + item.viewData?.label.toLowerCase().includes(searchLower) + ); + filteredScreens = filteredScreens.concat(additionalFiltered); } return filteredScreens; @@ -221,9 +245,10 @@ class TabSwitcherModal extends React.Component<{}, {}> { @mobx.computed @boundMethod sortOptions(options: SwitcherDataType[]): SwitcherDataType[] { - return options.sort((a, b) => { - let aInCurrentSession = a.sessionIdx === this.activeSessionIdx; - let bInCurrentSession = b.sessionIdx === this.activeSessionIdx; + const mainOptions = options.filter((o) => o.sessionIdx !== -1); + mainOptions.sort((a, b) => { + const aInCurrentSession = a.sessionIdx === this.activeSessionIdx; + const bInCurrentSession = b.sessionIdx === this.activeSessionIdx; // Tabs in the current session are sorted by screenIdx if (aInCurrentSession && bInCurrentSession) { @@ -246,11 +271,16 @@ class TabSwitcherModal extends React.Component<{}, {}> { } } }); + + const additionalOptions = options.filter((o) => o.sessionIdx === -1); + additionalOptions.sort((a, b) => a.viewData?.label.localeCompare(b.viewData?.label)); + + return mainOptions.concat(additionalOptions); } @boundMethod renderIcon(option: SwitcherDataType): React.ReactNode { - let tabIcon = option.icon; + const tabIcon = option.icon; if (tabIcon === "default" || tabIcon === "square") { return ; } @@ -271,10 +301,15 @@ class TabSwitcherModal extends React.Component<{}, {}> { })} onClick={() => this.handleSelect(index)} > -
{this.renderIcon(option)}
-
- #{option.sessionName} / {option.screenName} -
+ +
{this.renderIcon(option)}
+
+ #{option.sessionName} / {option.screenName} +
+
+ +
{option.viewData?.label}
+
); } @@ -293,13 +328,13 @@ class TabSwitcherModal extends React.Component<{}, {}> { decoration={{ startDecoration: ( -
Switch to Tab:
+
Go to:
), endDecoration: ( } > diff --git a/src/app/common/modals/tos.less b/src/app/common/modals/tos.less index fddb8efc7..6327a7a74 100644 --- a/src/app/common/modals/tos.less +++ b/src/app/common/modals/tos.less @@ -1,4 +1,4 @@ -@import "../../../app/common/themes/themes.less"; +@import "@/common/themes/themes.less"; .tos-modal { width: 640px; diff --git a/src/app/common/modals/tos.tsx b/src/app/common/modals/tos.tsx index 3ef78cbf8..1252c9c87 100644 --- a/src/app/common/modals/tos.tsx +++ b/src/app/common/modals/tos.tsx @@ -4,14 +4,13 @@ import * as React from "react"; import * as mobxReact from "mobx-react"; import { boundMethod } from "autobind-decorator"; -import { GlobalModel, GlobalCommandRunner } from "../../../models"; -import { Toggle, Modal, Button } from "../elements"; -import * as util from "../../../util/util"; -import { ClientDataType } from "../../../types/types"; +import { GlobalModel, GlobalCommandRunner } from "@/models"; +import { Toggle, Modal, Button } from "@/elements"; +import * as util from "@/util/util"; -import shield from "../../assets/icons/shield_check.svg"; -import help from "../../assets/icons/help_filled.svg"; -import github from "../../assets/icons/github.svg"; +import shield from "@/assets/icons/shield_check.svg"; +import help from "@/assets/icons/help_filled.svg"; +import github from "@/assets/icons/github.svg"; import "./tos.less"; diff --git a/src/app/common/modals/userinput.less b/src/app/common/modals/userinput.less index a672fa28d..ae143ad3e 100644 --- a/src/app/common/modals/userinput.less +++ b/src/app/common/modals/userinput.less @@ -1,4 +1,4 @@ -@import "../../../app/common/themes/themes.less"; +@import "@/common/themes/themes.less"; .userinput-modal { width: 500px; diff --git a/src/app/common/modals/userinput.tsx b/src/app/common/modals/userinput.tsx index b431043e4..89223783f 100644 --- a/src/app/common/modals/userinput.tsx +++ b/src/app/common/modals/userinput.tsx @@ -1,8 +1,7 @@ import * as React from "react"; -import { GlobalModel } from "../../../models"; +import { GlobalModel } from "@/models"; import { Choose, When, If } from "tsx-control-statements/components"; -import { Modal, PasswordField, Markdown } from "../elements"; -import { UserInputRequest } from "../../../types/types"; +import { Modal, PasswordField, Markdown } from "@/elements"; import "./userinput.less"; diff --git a/src/app/common/modals/viewremoteconndetail.less b/src/app/common/modals/viewremoteconndetail.less index 2789c8779..f59838f6f 100644 --- a/src/app/common/modals/viewremoteconndetail.less +++ b/src/app/common/modals/viewremoteconndetail.less @@ -1,4 +1,4 @@ -@import "../../../app/common/themes/themes.less"; +@import "@/common/themes/themes.less"; .rconndetail-modal { width: 631px; @@ -54,6 +54,8 @@ } .remote-detail { + width: 100%; + .settings-field { display: flex; flex-direction: row; @@ -91,8 +93,9 @@ } .terminal-wrapper { - width: 100%; margin-top: 5px; + overflow-x: auto; + overflow-y: hidden; .terminal-connectelem { height: 163px !important; // Needed to override plugin height @@ -111,7 +114,6 @@ .xterm-screen { padding: 10px; - width: 541px !important; // Needed to override plugin width } } } diff --git a/src/app/common/modals/viewremoteconndetail.tsx b/src/app/common/modals/viewremoteconndetail.tsx index cf5ca95b4..48536c603 100644 --- a/src/app/common/modals/viewremoteconndetail.tsx +++ b/src/app/common/modals/viewremoteconndetail.tsx @@ -7,17 +7,14 @@ 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 "../../../models"; -import * as T from "../../../types/types"; -import { Modal, Tooltip, Button, Status } from "../elements"; -import * as util from "../../../util/util"; -import * as textmeasure from "../../../util/textmeasure"; +import { GlobalModel, GlobalCommandRunner, RemotesModel } from "@/models"; +import { Modal, Tooltip, Button, Status } from "@/elements"; +import * as util from "@/util/util"; +import * as textmeasure from "@/util/textmeasure"; +import * as appconst from "@/app/appconst"; import "./viewremoteconndetail.less"; -const RemotePtyRows = 9; -const RemotePtyCols = 80; - @mobxReact.observer class ViewRemoteConnDetailModal extends React.Component<{}, {}> { termRef: React.RefObject = React.createRef(); @@ -29,7 +26,7 @@ class ViewRemoteConnDetailModal extends React.Component<{}, {}> { } @mobx.computed - getSelectedRemote(): T.RemoteType { + getSelectedRemote(): RemoteType { const selectedRemoteId = this.model.selectedRemoteId.get(); return GlobalModel.getRemote(selectedRemoteId); } @@ -60,7 +57,7 @@ class ViewRemoteConnDetailModal extends React.Component<{}, {}> { } } - getRemoteTypeStr(remote: T.RemoteType): string { + getRemoteTypeStr(remote: RemoteType): string { if (!util.isBlank(remote.uname)) { let unameStr = remote.uname; unameStr = unameStr.replace("|", ", "); @@ -138,7 +135,7 @@ class ViewRemoteConnDetailModal extends React.Component<{}, {}> { this.model.setRecentConnAdded(false); } - renderInstallStatus(remote: T.RemoteType): any { + renderInstallStatus(remote: RemoteType): any { let statusStr: string = null; if (remote.installstatus == "disconnected") { if (remote.needsmshellupgrade) { @@ -162,7 +159,7 @@ class ViewRemoteConnDetailModal extends React.Component<{}, {}> { ); } - renderHeaderBtns(remote: T.RemoteType): React.ReactNode { + renderHeaderBtns(remote: RemoteType): React.ReactNode { let buttons: React.ReactNode[] = []; const disconnectButton = (