merge branch 'main' into sylvie/plot-variety

This commit is contained in:
Sylvia Crowe 2024-09-25 17:59:43 -07:00
commit 07675787c8
9 changed files with 107 additions and 31 deletions

View File

@ -219,10 +219,6 @@ func main() {
log.Printf("error initializing wstore: %v\n", err)
return
}
migrateErr := wstore.TryMigrateOldHistory()
if migrateErr != nil {
log.Printf("error migrating old history: %v\n", migrateErr)
}
go func() {
err := shellutil.InitCustomShellStartupFiles()
if err != nil {
@ -234,6 +230,12 @@ func main() {
log.Printf("error ensuring initial data: %v\n", err)
return
}
if firstRun {
migrateErr := wstore.TryMigrateOldHistory()
if migrateErr != nil {
log.Printf("error migrating old history: %v\n", migrateErr)
}
}
if window != nil {
ctx, cancelFn := context.WithTimeout(context.Background(), 2*time.Second)
defer cancelFn()

View File

@ -12,7 +12,7 @@ export function getLaunchSettings(): SettingsType {
try {
const settingsContents = fs.readFileSync(settingsPath, "utf8");
return JSON.parse(settingsContents);
} catch (e) {
console.error("Unable to load settings.json to get initial launch settings", e);
} catch (_) {
// fail silently
}
}

View File

@ -7,6 +7,8 @@ import path from "path";
import { WaveDevVarName, WaveDevViteVarName } from "../frontend/util/isdev";
import * as keyutil from "../frontend/util/keyutil";
const WaveHomeVarName = "WAVETERM_HOME";
const isDev = !app.isPackaged;
const isDevVite = isDev && process.env.ELECTRON_RENDERER_URL;
if (isDev) {
@ -37,6 +39,10 @@ ipcMain.on("get-host-name", (event) => {
// must match golang
function getWaveHomeDir() {
const override = process.env[WaveHomeVarName];
if (override) {
return override;
}
return path.join(os.homedir(), isDev ? ".waveterm-dev" : ".waveterm");
}

View File

@ -233,6 +233,10 @@
font-size: 14px;
}
button:not(:first-child) {
margin-left: 10px;
}
button.disabled-button {
cursor: default;
}

View File

@ -10,7 +10,7 @@ import { useEffect, useRef, useState } from "react";
import { FlexiModal } from "./modal";
import { QuickTips } from "@/app/element/quicktips";
import { atoms } from "@/app/store/global";
import { atoms, getApi } from "@/app/store/global";
import { modalsModel } from "@/app/store/modalmodel";
import { atom, PrimitiveAtom, useAtom, useAtomValue, useSetAtom } from "jotai";
import "./tos.less";
@ -153,6 +153,58 @@ const ModalPage2 = () => {
);
};
const ModalPageLegacy = () => {
const setPageNum = useSetAtom(pageNumAtom);
const handleContinue = () => {
setPageNum(1);
};
const handleDownloadLegacy = () => {
getApi().openExternal("https://waveterm.dev/download-legacy?ref=v7upgrade");
};
return (
<>
<header className="modal-header tos-header unselectable">
<div className="logo">
<Logo />
</div>
<div className="modal-title">Welcome to Wave v0.8</div>
</header>
<div className="modal-content tos-content unselectable">
<div className="item">
Were excited to announce the release of Wave Terminal v0.8. This update introduces a brand-new
layout engine, featuring drag-and-drop screen splitting with flexible block sizing and positioning.
We've also integrated powerful tools like file previews, an editor, web integration, and AI, all
designed to keep you focused and minimize context switching. And for the first time, Wave Terminal
runs <b>natively on Windows</b>!
</div>
<div>
Wave v0.8 is less opinionated, giving you the freedom to use your standard terminal prompt and
command completions, while supporting all shells (not just bash/zsh). We've also improved
compatibility with ohmyzsh packages, removing some of the friction users experienced. Its faster,
more performant, and provides a stronger foundation for you to build your own blocks and widgets in
the future.
</div>
<div className="item">
The new build is a fresh start, and a clean break from the current version. As such, your history,
settings, and configuration will <i>not</i> be carried over. If you'd like to continue to run the
legacy version, you will need to download it separately.
</div>
</div>
<footer className="unselectable">
<div className="button-wrapper">
<Button className="outlined grey" onClick={handleDownloadLegacy}>
Download WaveLegacy
</Button>
<Button className="font-weight-600" onClick={handleContinue}>
Continue
</Button>
</div>
</footer>
</>
);
};
const TosModal = () => {
const modalRef = useRef<HTMLDivElement | null>(null);
const [pageNum, setPageNum] = useAtom(pageNumAtom);
@ -173,7 +225,9 @@ const TosModal = () => {
useEffect(() => {
// on unmount, always reset pagenum
if (clientData.tosagreed) {
if (!clientData.tosagreed && clientData.hasoldhistory) {
setPageNum(0);
} else if (clientData.tosagreed) {
setPageNum(2);
}
return () => {
@ -189,11 +243,25 @@ const TosModal = () => {
window.removeEventListener("resize", updateModalHeight);
};
}, []);
let pageComp: React.JSX.Element = null;
switch (pageNum) {
case 0:
pageComp = <ModalPageLegacy />;
break;
case 1:
pageComp = <ModalPage1 />;
break;
case 2:
pageComp = <ModalPage2 />;
break;
}
if (pageComp == null) {
return null;
}
return (
<FlexiModal className="tos-modal" ref={modalRef}>
<OverlayScrollbarsComponent className="modal-inner" options={{ scrollbars: { autoHide: "leave" } }}>
{pageNum === 1 ? <ModalPage1 /> : <ModalPage2 />}
{pageComp}
</OverlayScrollbarsComponent>
</FlexiModal>
);

View File

@ -44,7 +44,7 @@ declare global {
type Client = WaveObj & {
windowids: string[];
tosagreed?: number;
historymigrated?: boolean;
hasoldhistory?: boolean;
};
// wshrpc.CommandAppendIJsonData

View File

@ -7,7 +7,7 @@
"productName": "Wave",
"description": "Open-Source AI-Native Terminal Built for Seamless Workflows",
"license": "Apache-2.0",
"version": "0.8.4-beta.4",
"version": "0.8.4",
"homepage": "https://waveterm.dev",
"build": {
"appId": "dev.commandline.waveterm"

View File

@ -117,7 +117,7 @@ type Client struct {
WindowIds []string `json:"windowids"`
Meta MetaMapType `json:"meta"`
TosAgreed int64 `json:"tosagreed,omitempty"`
HistoryMigrated bool `json:"historymigrated,omitempty"`
HasOldHistory bool `json:"hasoldhistory,omitempty"`
}
func (*Client) GetOType() string {

View File

@ -83,19 +83,6 @@ func ReplaceOldHistory(ctx context.Context, hist []*OldHistoryType) error {
func TryMigrateOldHistory() error {
ctx, cancelFn := context.WithTimeout(context.Background(), 10*time.Second)
defer cancelFn()
client, err := DBGetSingleton[*waveobj.Client](ctx)
if err != nil {
return err
}
if client.HistoryMigrated {
return nil
}
log.Printf("trying to migrate old wave history\n")
client.HistoryMigrated = true
err = DBUpdate(ctx, client)
if err != nil {
return err
}
hist, err := GetAllOldHistory()
if err != nil {
return err
@ -108,5 +95,14 @@ func TryMigrateOldHistory() error {
return err
}
log.Printf("migrated %d old wave history records\n", len(hist))
client, err := DBGetSingleton[*waveobj.Client](ctx)
if err != nil {
return err
}
client.HasOldHistory = true
err = DBUpdate(ctx, client)
if err != nil {
return err
}
return nil
}