mirror of
https://github.com/wavetermdev/backup.git
synced 2026-04-22 15:26:58 -07:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| e2ff745f55 | |||
| eab8e3be02 | |||
| e589d9c4fa |
+5
-2
@@ -7,9 +7,10 @@ import * as mobx from "mobx";
|
|||||||
import { boundMethod } from "autobind-decorator";
|
import { boundMethod } from "autobind-decorator";
|
||||||
import { If } from "tsx-control-statements/components";
|
import { If } from "tsx-control-statements/components";
|
||||||
import dayjs from "dayjs";
|
import dayjs from "dayjs";
|
||||||
|
import type { ContextMenuOpts } from "../types/types";
|
||||||
import localizedFormat from "dayjs/plugin/localizedFormat";
|
import localizedFormat from "dayjs/plugin/localizedFormat";
|
||||||
import { GlobalModel } from "@/models";
|
import { GlobalModel } from "../models";
|
||||||
import { isBlank } from "@/util/util";
|
import { isBlank } from "../util/util";
|
||||||
import { WorkspaceView } from "./workspace/workspaceview";
|
import { WorkspaceView } from "./workspace/workspaceview";
|
||||||
import { PluginsView } from "./pluginsview/pluginsview";
|
import { PluginsView } from "./pluginsview/pluginsview";
|
||||||
import { BookmarksView } from "./bookmarks/bookmarks";
|
import { BookmarksView } from "./bookmarks/bookmarks";
|
||||||
@@ -24,6 +25,8 @@ import "./app.less";
|
|||||||
|
|
||||||
dayjs.extend(localizedFormat);
|
dayjs.extend(localizedFormat);
|
||||||
|
|
||||||
|
type OV<V> = mobx.IObservableValue<V>;
|
||||||
|
|
||||||
@mobxReact.observer
|
@mobxReact.observer
|
||||||
class App extends React.Component<{}, {}> {
|
class App extends React.Component<{}, {}> {
|
||||||
dcWait: OV<boolean> = mobx.observable.box(false, { name: "dcWait" });
|
dcWait: OV<boolean> = mobx.observable.box(false, { name: "dcWait" });
|
||||||
|
|||||||
@@ -47,13 +47,3 @@ export const TabIcons = [
|
|||||||
export const VERSION = __WAVETERM_VERSION__;
|
export const VERSION = __WAVETERM_VERSION__;
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
export const BUILD = __WAVETERM_BUILD__;
|
export const BUILD = __WAVETERM_BUILD__;
|
||||||
|
|
||||||
/**
|
|
||||||
* Levels for the screen status indicator
|
|
||||||
*/
|
|
||||||
export enum StatusIndicatorLevel {
|
|
||||||
None = 0,
|
|
||||||
Output = 1,
|
|
||||||
Success = 2,
|
|
||||||
Error = 3,
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
@import "@/common/themes/themes.less";
|
@import "../../app/common/themes/themes.less";
|
||||||
|
|
||||||
.bookmarks-view {
|
.bookmarks-view {
|
||||||
background-color: @background-session;
|
background-color: @background-session;
|
||||||
|
|||||||
@@ -7,14 +7,15 @@ import * as mobx from "mobx";
|
|||||||
import { boundMethod } from "autobind-decorator";
|
import { boundMethod } from "autobind-decorator";
|
||||||
import { If, For } from "tsx-control-statements/components";
|
import { If, For } from "tsx-control-statements/components";
|
||||||
import cn from "classnames";
|
import cn from "classnames";
|
||||||
import { GlobalModel } from "@/models";
|
import type { BookmarkType } from "../../types/types";
|
||||||
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 XmarkIcon } from "../assets/icons/line/xmark.svg";
|
||||||
import { ReactComponent as CopyIcon } from "@/assets/icons/favourites/copy.svg";
|
import { ReactComponent as CopyIcon } from "../assets/icons/favourites/copy.svg";
|
||||||
import { ReactComponent as PenIcon } from "@/assets/icons/favourites/pen.svg";
|
import { ReactComponent as PenIcon } from "../assets/icons/favourites/pen.svg";
|
||||||
import { ReactComponent as TrashIcon } from "@/assets/icons/favourites/trash.svg";
|
import { ReactComponent as TrashIcon } from "../assets/icons/favourites/trash.svg";
|
||||||
import { ReactComponent as FavoritesIcon } from "@/assets/icons/favourites.svg";
|
import { ReactComponent as FavoritesIcon } from "../assets/icons/favourites.svg";
|
||||||
|
|
||||||
import "./bookmarks.less";
|
import "./bookmarks.less";
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
@import "@/common/themes/themes.less";
|
@import "../../app/common/themes/themes.less";
|
||||||
|
|
||||||
.clientsettings-view {
|
.clientsettings-view {
|
||||||
background-color: @background-session;
|
background-color: @background-session;
|
||||||
|
|||||||
@@ -6,19 +6,20 @@ import * as mobxReact from "mobx-react";
|
|||||||
import * as mobx from "mobx";
|
import * as mobx from "mobx";
|
||||||
import { boundMethod } from "autobind-decorator";
|
import { boundMethod } from "autobind-decorator";
|
||||||
import cn from "classnames";
|
import cn from "classnames";
|
||||||
import { GlobalModel, GlobalCommandRunner, RemotesModel } from "@/models";
|
import { GlobalModel, GlobalCommandRunner, RemotesModel } from "../../models";
|
||||||
import { Toggle, InlineSettingsTextEdit, SettingsError, Dropdown } from "@/common/elements";
|
import { Toggle, InlineSettingsTextEdit, SettingsError, Dropdown } from "../common/elements";
|
||||||
import { commandRtnHandler, isBlank } from "@/util/util";
|
import * as types from "../../types/types";
|
||||||
import * as appconst from "@/app/appconst";
|
import { commandRtnHandler, isBlank } from "../../util/util";
|
||||||
|
import * as appconst from "../appconst";
|
||||||
|
|
||||||
import "./clientsettings.less";
|
import "./clientsettings.less";
|
||||||
|
|
||||||
@mobxReact.observer
|
@mobxReact.observer
|
||||||
class ClientSettingsView extends React.Component<{ model: RemotesModel }, { hoveredItemId: string }> {
|
class ClientSettingsView extends React.Component<{ model: RemotesModel }, { hoveredItemId: string }> {
|
||||||
fontSizeDropdownActive: OV<boolean> = mobx.observable.box(false, {
|
fontSizeDropdownActive: types.OV<boolean> = mobx.observable.box(false, {
|
||||||
name: "clientSettings-fontSizeDropdownActive",
|
name: "clientSettings-fontSizeDropdownActive",
|
||||||
});
|
});
|
||||||
errorMessage: OV<string> = mobx.observable.box(null, { name: "ClientSettings-errorMessage" });
|
errorMessage: types.OV<string> = mobx.observable.box(null, { name: "ClientSettings-errorMessage" });
|
||||||
|
|
||||||
@boundMethod
|
@boundMethod
|
||||||
dismissError(): void {
|
dismissError(): void {
|
||||||
@@ -29,12 +30,12 @@ class ClientSettingsView extends React.Component<{ model: RemotesModel }, { hove
|
|||||||
|
|
||||||
@boundMethod
|
@boundMethod
|
||||||
handleChangeFontSize(fontSize: string): void {
|
handleChangeFontSize(fontSize: string): void {
|
||||||
const newFontSize = Number(fontSize);
|
let newFontSize = Number(fontSize);
|
||||||
this.fontSizeDropdownActive.set(false);
|
this.fontSizeDropdownActive.set(false);
|
||||||
if (GlobalModel.termFontSize.get() == newFontSize) {
|
if (GlobalModel.termFontSize.get() == newFontSize) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const prtn = GlobalCommandRunner.setTermFontSize(newFontSize, false);
|
let prtn = GlobalCommandRunner.setTermFontSize(newFontSize, false);
|
||||||
commandRtnHandler(prtn, this.errorMessage);
|
commandRtnHandler(prtn, this.errorMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -47,7 +48,7 @@ class ClientSettingsView extends React.Component<{ model: RemotesModel }, { hove
|
|||||||
|
|
||||||
@boundMethod
|
@boundMethod
|
||||||
handleChangeTelemetry(val: boolean): void {
|
handleChangeTelemetry(val: boolean): void {
|
||||||
let prtn: Promise<CommandRtnType> = null;
|
let prtn: Promise<types.CommandRtnType> = null;
|
||||||
if (val) {
|
if (val) {
|
||||||
prtn = GlobalCommandRunner.telemetryOn(false);
|
prtn = GlobalCommandRunner.telemetryOn(false);
|
||||||
} else {
|
} else {
|
||||||
@@ -58,7 +59,7 @@ class ClientSettingsView extends React.Component<{ model: RemotesModel }, { hove
|
|||||||
|
|
||||||
@boundMethod
|
@boundMethod
|
||||||
handleChangeReleaseCheck(val: boolean): void {
|
handleChangeReleaseCheck(val: boolean): void {
|
||||||
let prtn: Promise<CommandRtnType> = null;
|
let prtn: Promise<types.CommandRtnType> = null;
|
||||||
if (val) {
|
if (val) {
|
||||||
prtn = GlobalCommandRunner.releaseCheckAutoOn(false);
|
prtn = GlobalCommandRunner.releaseCheckAutoOn(false);
|
||||||
} else {
|
} else {
|
||||||
@@ -67,29 +68,29 @@ class ClientSettingsView extends React.Component<{ model: RemotesModel }, { hove
|
|||||||
commandRtnHandler(prtn, this.errorMessage);
|
commandRtnHandler(prtn, this.errorMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
getFontSizes(): DropdownItem[] {
|
getFontSizes(): any {
|
||||||
const availableFontSizes: DropdownItem[] = [];
|
let availableFontSizes: { label: string; value: number }[] = [];
|
||||||
for (let s = appconst.MinFontSize; s <= appconst.MaxFontSize; s++) {
|
for (let s = appconst.MinFontSize; s <= appconst.MaxFontSize; s++) {
|
||||||
availableFontSizes.push({ label: s + "px", value: String(s) });
|
availableFontSizes.push({ label: s + "px", value: s });
|
||||||
}
|
}
|
||||||
return availableFontSizes;
|
return availableFontSizes;
|
||||||
}
|
}
|
||||||
|
|
||||||
@boundMethod
|
@boundMethod
|
||||||
inlineUpdateOpenAIModel(newModel: string): void {
|
inlineUpdateOpenAIModel(newModel: string): void {
|
||||||
const prtn = GlobalCommandRunner.setClientOpenAISettings({ model: newModel });
|
let prtn = GlobalCommandRunner.setClientOpenAISettings({ model: newModel });
|
||||||
commandRtnHandler(prtn, this.errorMessage);
|
commandRtnHandler(prtn, this.errorMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
@boundMethod
|
@boundMethod
|
||||||
inlineUpdateOpenAIToken(newToken: string): void {
|
inlineUpdateOpenAIToken(newToken: string): void {
|
||||||
const prtn = GlobalCommandRunner.setClientOpenAISettings({ apitoken: newToken });
|
let prtn = GlobalCommandRunner.setClientOpenAISettings({ apitoken: newToken });
|
||||||
commandRtnHandler(prtn, this.errorMessage);
|
commandRtnHandler(prtn, this.errorMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
@boundMethod
|
@boundMethod
|
||||||
inlineUpdateOpenAIMaxTokens(newMaxTokensStr: string): void {
|
inlineUpdateOpenAIMaxTokens(newMaxTokensStr: string): void {
|
||||||
const prtn = GlobalCommandRunner.setClientOpenAISettings({ maxtokens: newMaxTokensStr });
|
let prtn = GlobalCommandRunner.setClientOpenAISettings({ maxtokens: newMaxTokensStr });
|
||||||
commandRtnHandler(prtn, this.errorMessage);
|
commandRtnHandler(prtn, this.errorMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -105,41 +106,19 @@ class ClientSettingsView extends React.Component<{ model: RemotesModel }, { hove
|
|||||||
GlobalModel.clientSettingsViewModel.closeView();
|
GlobalModel.clientSettingsViewModel.closeView();
|
||||||
}
|
}
|
||||||
|
|
||||||
@boundMethod
|
|
||||||
handleChangeShortcut(newShortcut: string): void {
|
|
||||||
const prtn = GlobalCommandRunner.setGlobalShortcut(newShortcut);
|
|
||||||
commandRtnHandler(prtn, this.errorMessage);
|
|
||||||
}
|
|
||||||
|
|
||||||
getFKeys(): DropdownItem[] {
|
|
||||||
const opts: DropdownItem[] = [];
|
|
||||||
opts.push({ label: "Disabled", value: "" });
|
|
||||||
const platform = GlobalModel.getPlatform();
|
|
||||||
for (let i = 1; i <= 12; i++) {
|
|
||||||
const shortcut = (platform == "darwin" ? "Cmd" : "Alt") + "+F" + String(i);
|
|
||||||
opts.push({ label: shortcut, value: shortcut });
|
|
||||||
}
|
|
||||||
return opts;
|
|
||||||
}
|
|
||||||
|
|
||||||
getCurrentShortcut(): string {
|
|
||||||
const clientData = GlobalModel.clientData.get();
|
|
||||||
return clientData?.clientopts?.globalshortcut ?? "";
|
|
||||||
}
|
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const isHidden = GlobalModel.activeMainView.get() != "clientsettings";
|
let isHidden = GlobalModel.activeMainView.get() != "clientsettings";
|
||||||
if (isHidden) {
|
if (isHidden) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
const cdata: ClientDataType = GlobalModel.clientData.get();
|
let cdata: types.ClientDataType = GlobalModel.clientData.get();
|
||||||
const openAIOpts = cdata.openaiopts ?? {};
|
let openAIOpts = cdata.openaiopts ?? {};
|
||||||
const apiTokenStr = isBlank(openAIOpts.apitoken) ? "(not set)" : "********";
|
let apiTokenStr = isBlank(openAIOpts.apitoken) ? "(not set)" : "********";
|
||||||
const maxTokensStr = String(
|
let maxTokensStr = String(
|
||||||
openAIOpts.maxtokens == null || openAIOpts.maxtokens == 0 ? 1000 : openAIOpts.maxtokens
|
openAIOpts.maxtokens == null || openAIOpts.maxtokens == 0 ? 1000 : openAIOpts.maxtokens
|
||||||
);
|
);
|
||||||
const curFontSize = GlobalModel.termFontSize.get();
|
let curFontSize = GlobalModel.termFontSize.get();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={cn("view clientsettings-view")}>
|
<div className={cn("view clientsettings-view")}>
|
||||||
@@ -229,17 +208,6 @@ class ClientSettingsView extends React.Component<{ model: RemotesModel }, { hove
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="settings-field">
|
|
||||||
<div className="settings-label">Global Hotkey</div>
|
|
||||||
<div className="settings-input">
|
|
||||||
<Dropdown
|
|
||||||
className="hotkey-dropdown"
|
|
||||||
options={this.getFKeys()}
|
|
||||||
defaultValue={this.getCurrentShortcut()}
|
|
||||||
onChange={this.handleChangeShortcut}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<SettingsError errorMessage={this.errorMessage} />
|
<SettingsError errorMessage={this.errorMessage} />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
@import "@/common/themes/themes.less";
|
@import "../../../app/common/themes/themes.less";
|
||||||
|
|
||||||
.wave-button {
|
.wave-button {
|
||||||
background: none;
|
background: none;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
@import "@/common/themes/themes.less";
|
@import "../../../app/common/themes/themes.less";
|
||||||
|
|
||||||
.checkbox {
|
.checkbox {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
@import "@/common/themes/themes.less";
|
@import "../../../app/common/themes/themes.less";
|
||||||
|
|
||||||
.cmdstr-code {
|
.cmdstr-code {
|
||||||
position: relative;
|
position: relative;
|
||||||
|
|||||||
@@ -6,8 +6,8 @@ import { boundMethod } from "autobind-decorator";
|
|||||||
import cn from "classnames";
|
import cn from "classnames";
|
||||||
import { If } from "tsx-control-statements/components";
|
import { If } from "tsx-control-statements/components";
|
||||||
|
|
||||||
import { ReactComponent as CheckIcon } from "@/assets/icons/line/check.svg";
|
import { ReactComponent as CheckIcon } from "../../assets/icons/line/check.svg";
|
||||||
import { ReactComponent as CopyIcon } from "@/assets/icons/history/copy.svg";
|
import { ReactComponent as CopyIcon } from "../../assets/icons/history/copy.svg";
|
||||||
|
|
||||||
import "./cmdstrcode.less";
|
import "./cmdstrcode.less";
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
@import "@/common/themes/themes.less";
|
@import "../../../app/common/themes/themes.less";
|
||||||
|
|
||||||
.wave-dropdown {
|
.wave-dropdown {
|
||||||
position: relative;
|
position: relative;
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ interface DropdownDecorationProps {
|
|||||||
|
|
||||||
interface DropdownProps {
|
interface DropdownProps {
|
||||||
label?: string;
|
label?: string;
|
||||||
options: DropdownItem[];
|
options: { value: string; label: string }[];
|
||||||
value?: string;
|
value?: string;
|
||||||
className?: string;
|
className?: string;
|
||||||
onChange: (value: string) => void;
|
onChange: (value: string) => void;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
@import "@/common/themes/themes.less";
|
@import "../../../app/common/themes/themes.less";
|
||||||
|
|
||||||
.inline-edit {
|
.inline-edit {
|
||||||
.icon {
|
.icon {
|
||||||
|
|||||||
@@ -7,10 +7,12 @@ import * as mobx from "mobx";
|
|||||||
import { boundMethod } from "autobind-decorator";
|
import { boundMethod } from "autobind-decorator";
|
||||||
import cn from "classnames";
|
import cn from "classnames";
|
||||||
import { If } from "tsx-control-statements/components";
|
import { If } from "tsx-control-statements/components";
|
||||||
import { checkKeyPressed, adaptFromReactOrNativeKeyEvent } from "@/util/keyutil";
|
import { checkKeyPressed, adaptFromReactOrNativeKeyEvent } from "../../../util/keyutil";
|
||||||
|
|
||||||
import "./inlinesettingstextedit.less";
|
import "./inlinesettingstextedit.less";
|
||||||
|
|
||||||
|
type OV<V> = mobx.IObservableValue<V>;
|
||||||
|
|
||||||
@mobxReact.observer
|
@mobxReact.observer
|
||||||
class InlineSettingsTextEdit extends React.Component<
|
class InlineSettingsTextEdit extends React.Component<
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
@import "@/common/themes/themes.less";
|
@import "../../../app/common/themes/themes.less";
|
||||||
|
|
||||||
.wave-input-decoration {
|
.wave-input-decoration {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
@import "@/common/themes/themes.less";
|
@import "../../../app/common/themes/themes.less";
|
||||||
|
|
||||||
.markdown {
|
.markdown {
|
||||||
color: @term-white;
|
color: @term-white;
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import * as mobxReact from "mobx-react";
|
|||||||
import ReactMarkdown from "react-markdown";
|
import ReactMarkdown from "react-markdown";
|
||||||
import remarkGfm from "remark-gfm";
|
import remarkGfm from "remark-gfm";
|
||||||
import cn from "classnames";
|
import cn from "classnames";
|
||||||
import { GlobalModel } from "@/models";
|
import { GlobalModel } from "../../../models";
|
||||||
|
|
||||||
import "./markdown.less";
|
import "./markdown.less";
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
@import "@/common/themes/themes.less";
|
@import "../../../app/common/themes/themes.less";
|
||||||
|
|
||||||
.wave-modal-container {
|
.wave-modal-container {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
|
|||||||
@@ -10,6 +10,8 @@ import { IconButton } from "./iconbutton";
|
|||||||
|
|
||||||
import "./modal.less";
|
import "./modal.less";
|
||||||
|
|
||||||
|
type OV<V> = mobx.IObservableValue<V>;
|
||||||
|
|
||||||
interface ModalHeaderProps {
|
interface ModalHeaderProps {
|
||||||
onClose?: () => void;
|
onClose?: () => void;
|
||||||
title: string;
|
title: string;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
@import "@/common/themes/themes.less";
|
@import "../../../app/common/themes/themes.less";
|
||||||
|
|
||||||
.wave-password {
|
.wave-password {
|
||||||
.wave-textfield-inner-eye {
|
.wave-textfield-inner-eye {
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user