mirror of
https://github.com/wavetermdev/waveterm.git
synced 2024-12-21 16:38:23 +01:00
new wails bindings format working
This commit is contained in:
parent
f3383d1847
commit
901334eb49
8
db/migrations-wstore/000001_init.down.sql
Normal file
8
db/migrations-wstore/000001_init.down.sql
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
DROP TABLE db_client;
|
||||||
|
|
||||||
|
DROP TABLE db_workspace;
|
||||||
|
|
||||||
|
DROP TABLE db_tab;
|
||||||
|
|
||||||
|
DROP TABLE db_block;
|
||||||
|
|
20
db/migrations-wstore/000001_init.up.sql
Normal file
20
db/migrations-wstore/000001_init.up.sql
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
CREATE TABLE db_client (
|
||||||
|
clientid varchar(36) PRIMARY KEY, -- unnecessary, but useful to have a PK
|
||||||
|
data json NOT NULL
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE TABLE db_workspace (
|
||||||
|
workspaceid varchar(36) PRIMARY KEY,
|
||||||
|
data json NOT NULL
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE TABLE db_tab (
|
||||||
|
tabid varchar(36) PRIMARY KEY,
|
||||||
|
data json NOT NULL
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE TABLE db_block (
|
||||||
|
blockid varchar(36) PRIMARY KEY,
|
||||||
|
tabid varchar(36) NOT NULL, -- the tab this block belongs to
|
||||||
|
data json NOT NULL
|
||||||
|
);
|
@ -8,7 +8,7 @@ import * as rxjs from "rxjs";
|
|||||||
import type { WailsEvent } from "@wailsio/runtime/types/events";
|
import type { WailsEvent } from "@wailsio/runtime/types/events";
|
||||||
import { Events } from "@wailsio/runtime";
|
import { Events } from "@wailsio/runtime";
|
||||||
import { produce } from "immer";
|
import { produce } from "immer";
|
||||||
import * as BlockService from "@/bindings/pkg/service/blockservice/BlockService";
|
import { BlockService } from "@/bindings/blockservice";
|
||||||
|
|
||||||
const globalStore = jotai.createStore();
|
const globalStore = jotai.createStore();
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@ import * as React from "react";
|
|||||||
import * as jotai from "jotai";
|
import * as jotai from "jotai";
|
||||||
import { atoms, blockDataMap, useBlockAtom } from "@/store/global";
|
import { atoms, blockDataMap, useBlockAtom } from "@/store/global";
|
||||||
import { Markdown } from "@/element/markdown";
|
import { Markdown } from "@/element/markdown";
|
||||||
import * as FileService from "@/bindings/pkg/service/fileservice/FileService";
|
import { FileService } from "@/bindings/fileservice";
|
||||||
import * as util from "@/util/util";
|
import * as util from "@/util/util";
|
||||||
import { CenteredDiv } from "../element/quickelems";
|
import { CenteredDiv } from "../element/quickelems";
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@ import { Terminal } from "@xterm/xterm";
|
|||||||
import type { ITheme } from "@xterm/xterm";
|
import type { ITheme } from "@xterm/xterm";
|
||||||
import { FitAddon } from "@xterm/addon-fit";
|
import { FitAddon } from "@xterm/addon-fit";
|
||||||
import { Button } from "@/element/button";
|
import { Button } from "@/element/button";
|
||||||
import * as BlockService from "@/bindings/pkg/service/blockservice/BlockService";
|
import { BlockService } from "@/bindings/blockservice";
|
||||||
import { getBlockSubject } from "@/store/global";
|
import { getBlockSubject } from "@/store/global";
|
||||||
import { base64ToArray } from "@/util/util";
|
import { base64ToArray } from "@/util/util";
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@ import { TabContent } from "@/app/tab/tab";
|
|||||||
import { clsx } from "clsx";
|
import { clsx } from "clsx";
|
||||||
import { atoms, addBlockIdToTab, blockDataMap } from "@/store/global";
|
import { atoms, addBlockIdToTab, blockDataMap } from "@/store/global";
|
||||||
import { v4 as uuidv4 } from "uuid";
|
import { v4 as uuidv4 } from "uuid";
|
||||||
import * as BlockService from "@/bindings/pkg/service/blockservice/BlockService";
|
import { BlockService } from "@/bindings/blockservice";
|
||||||
|
|
||||||
import "./workspace.less";
|
import "./workspace.less";
|
||||||
|
|
||||||
|
11
go.mod
11
go.mod
@ -13,7 +13,7 @@ require (
|
|||||||
github.com/sawka/txwrap v0.2.0
|
github.com/sawka/txwrap v0.2.0
|
||||||
github.com/wailsapp/wails/v3 v3.0.0-alpha.0
|
github.com/wailsapp/wails/v3 v3.0.0-alpha.0
|
||||||
github.com/wavetermdev/waveterm/wavesrv v0.0.0-20240508181017-d07068c09d94
|
github.com/wavetermdev/waveterm/wavesrv v0.0.0-20240508181017-d07068c09d94
|
||||||
golang.org/x/sys v0.19.0
|
golang.org/x/sys v0.20.0
|
||||||
)
|
)
|
||||||
|
|
||||||
require (
|
require (
|
||||||
@ -52,11 +52,12 @@ require (
|
|||||||
github.com/wailsapp/mimetype v1.4.1 // indirect
|
github.com/wailsapp/mimetype v1.4.1 // indirect
|
||||||
github.com/xanzy/ssh-agent v0.3.3 // indirect
|
github.com/xanzy/ssh-agent v0.3.3 // indirect
|
||||||
go.uber.org/atomic v1.7.0 // indirect
|
go.uber.org/atomic v1.7.0 // indirect
|
||||||
golang.org/x/crypto v0.21.0 // indirect
|
golang.org/x/crypto v0.23.0 // indirect
|
||||||
golang.org/x/exp v0.0.0-20230626212559-97b1e661b5df // indirect
|
golang.org/x/exp v0.0.0-20230626212559-97b1e661b5df // indirect
|
||||||
golang.org/x/mod v0.12.0 // indirect
|
golang.org/x/mod v0.17.0 // indirect
|
||||||
golang.org/x/net v0.21.0 // indirect
|
golang.org/x/net v0.25.0 // indirect
|
||||||
golang.org/x/tools v0.13.0 // indirect
|
golang.org/x/sync v0.7.0 // indirect
|
||||||
|
golang.org/x/tools v0.21.0 // indirect
|
||||||
gopkg.in/warnings.v0 v0.1.2 // indirect
|
gopkg.in/warnings.v0 v0.1.2 // indirect
|
||||||
)
|
)
|
||||||
|
|
||||||
|
28
go.sum
28
go.sum
@ -137,14 +137,14 @@ golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5y
|
|||||||
golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
|
golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
|
||||||
golang.org/x/crypto v0.3.1-0.20221117191849-2c476679df9a/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4=
|
golang.org/x/crypto v0.3.1-0.20221117191849-2c476679df9a/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4=
|
||||||
golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU=
|
golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU=
|
||||||
golang.org/x/crypto v0.21.0 h1:X31++rzVUdKhX5sWmSOFZxx8UW/ldWx55cbf08iNAMA=
|
golang.org/x/crypto v0.23.0 h1:dIJU/v2J8Mdglj/8rJ6UUOM3Zc9zLZxVZwwxMooUSAI=
|
||||||
golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs=
|
golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8=
|
||||||
golang.org/x/exp v0.0.0-20230626212559-97b1e661b5df h1:UA2aFVmmsIlefxMk29Dp2juaUSth8Pyn3Tq5Y5mJGME=
|
golang.org/x/exp v0.0.0-20230626212559-97b1e661b5df h1:UA2aFVmmsIlefxMk29Dp2juaUSth8Pyn3Tq5Y5mJGME=
|
||||||
golang.org/x/exp v0.0.0-20230626212559-97b1e661b5df/go.mod h1:FXUEEKJgO7OQYeo8N01OfiKP8RXMtf6e8aTskBGqWdc=
|
golang.org/x/exp v0.0.0-20230626212559-97b1e661b5df/go.mod h1:FXUEEKJgO7OQYeo8N01OfiKP8RXMtf6e8aTskBGqWdc=
|
||||||
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
|
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
|
||||||
golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
|
golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
|
||||||
golang.org/x/mod v0.12.0 h1:rmsUpXtvNzj340zd98LZ4KntptpfRHwpFOHG188oHXc=
|
golang.org/x/mod v0.17.0 h1:zY54UmvipHiNd+pm+m0x9KhZ9hl1/7QNMyxXbc6ICqA=
|
||||||
golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
|
golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
|
||||||
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||||
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
||||||
golang.org/x/net v0.0.0-20210505024714-0287a6fb4125/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
golang.org/x/net v0.0.0-20210505024714-0287a6fb4125/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
||||||
@ -153,8 +153,8 @@ golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug
|
|||||||
golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY=
|
golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY=
|
||||||
golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
|
golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
|
||||||
golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc=
|
golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc=
|
||||||
golang.org/x/net v0.21.0 h1:AQyQV4dYCvJ7vGmJyKki9+PBdyvhkSd8EIx/qb0AYv4=
|
golang.org/x/net v0.25.0 h1:d/OCCoBEUq33pjydKrGQhw7IlUPI2Oylr+8qLx49kac=
|
||||||
golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44=
|
golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM=
|
||||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
@ -177,15 +177,15 @@ golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
|||||||
golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.19.0 h1:q5f1RH2jigJ1MoAWp2KTp3gm5zAGFUTarQZ5U386+4o=
|
golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y=
|
||||||
golang.org/x/sys v0.19.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||||
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
||||||
golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc=
|
golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc=
|
||||||
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
|
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
|
||||||
golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U=
|
golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U=
|
||||||
golang.org/x/term v0.19.0 h1:+ThwsDv+tYfnJFhF4L8jITxu1tdTWRTZpdsWgEgjL6Q=
|
golang.org/x/term v0.20.0 h1:VnkxpohqXaOBYJtBmEppKUG6mXpi+4O6purfc2+sMhw=
|
||||||
golang.org/x/term v0.19.0/go.mod h1:2CuTdWZ7KHSQwUzKva0cbMg6q2DMI3Mmxp+gKJbskEk=
|
golang.org/x/term v0.20.0/go.mod h1:8UkIAJTvZgivsXaD6/pH6U9ecQzZ45awqEOzuCvwpFY=
|
||||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||||
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||||
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||||
@ -193,14 +193,14 @@ golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
|
|||||||
golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
|
golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
|
||||||
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
|
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
|
||||||
golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
|
golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
|
||||||
golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ=
|
golang.org/x/text v0.15.0 h1:h1V/4gjBv8v9cjcR6+AR5+/cIYK5N/WAgiv4xlsEtAk=
|
||||||
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
|
golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
|
||||||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||||
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||||
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
|
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
|
||||||
golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=
|
golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=
|
||||||
golang.org/x/tools v0.13.0 h1:Iey4qkscZuv0VvIt8E0neZjtPVQFSc870HQ448QgEmQ=
|
golang.org/x/tools v0.21.0 h1:qc0xYgIbsSDt9EyWz05J5wfa7LOVW0YTLOXrqdLAWIw=
|
||||||
golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58=
|
golang.org/x/tools v0.21.0/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk=
|
||||||
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
|
6
main.go
6
main.go
@ -108,9 +108,9 @@ func main() {
|
|||||||
app := application.New(application.Options{
|
app := application.New(application.Options{
|
||||||
Name: "NextWave",
|
Name: "NextWave",
|
||||||
Description: "The Next Wave Terminal",
|
Description: "The Next Wave Terminal",
|
||||||
Bind: []any{
|
Services: []application.Service{
|
||||||
&fileservice.FileService{},
|
application.NewService(&fileservice.FileService{}),
|
||||||
&blockservice.BlockService{},
|
application.NewService(&blockservice.BlockService{}),
|
||||||
},
|
},
|
||||||
Icon: appIcon,
|
Icon: appIcon,
|
||||||
Assets: application.AssetOptions{
|
Assets: application.AssetOptions{
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
"@types/react": "^18.3.2",
|
"@types/react": "^18.3.2",
|
||||||
"@types/uuid": "^9.0.8",
|
"@types/uuid": "^9.0.8",
|
||||||
"@vitejs/plugin-react": "^4.2.1",
|
"@vitejs/plugin-react": "^4.2.1",
|
||||||
"@wailsio/runtime": "latest",
|
"@wailsio/runtime": "^3.0.0-alpha.24",
|
||||||
"less": "^4.2.0",
|
"less": "^4.2.0",
|
||||||
"vite": "^5.0.0",
|
"vite": "^5.0.0",
|
||||||
"vite-tsconfig-paths": "^4.3.2"
|
"vite-tsconfig-paths": "^4.3.2"
|
||||||
|
@ -1,3 +1,6 @@
|
|||||||
|
// Copyright 2024, Command Line Inc.
|
||||||
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
package blockstore
|
package blockstore
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
@ -1,3 +1,6 @@
|
|||||||
|
// Copyright 2024, Command Line Inc.
|
||||||
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
package blockstore
|
package blockstore
|
||||||
|
|
||||||
// setup for blockstore db
|
// setup for blockstore db
|
||||||
@ -22,7 +25,7 @@ import (
|
|||||||
dbfs "github.com/wavetermdev/thenextwave/db"
|
dbfs "github.com/wavetermdev/thenextwave/db"
|
||||||
)
|
)
|
||||||
|
|
||||||
const BlockstoreDbName = "blockstore.db"
|
const BlockstoreDBName = "blockstore.db"
|
||||||
|
|
||||||
type TxWrap = txwrap.TxWrap
|
type TxWrap = txwrap.TxWrap
|
||||||
|
|
||||||
@ -46,8 +49,8 @@ func InitBlockstore() error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func GetDBName() string {
|
func GetDBName() string {
|
||||||
scHome := wavebase.GetWaveHomeDir()
|
waveHome := wavebase.GetWaveHomeDir()
|
||||||
return path.Join(scHome, BlockstoreDbName)
|
return path.Join(waveHome, BlockstoreDBName)
|
||||||
}
|
}
|
||||||
|
|
||||||
func MakeDB(ctx context.Context) (*sqlx.DB, error) {
|
func MakeDB(ctx context.Context) (*sqlx.DB, error) {
|
||||||
@ -60,7 +63,7 @@ func MakeDB(ctx context.Context) (*sqlx.DB, error) {
|
|||||||
} else {
|
} else {
|
||||||
dbName := GetDBName()
|
dbName := GetDBName()
|
||||||
log.Printf("[db] opening db %s\n", dbName)
|
log.Printf("[db] opening db %s\n", dbName)
|
||||||
rtn, err = sqlx.Open("sqlite3", fmt.Sprintf("file:%s?cache=shared&mode=rwc&_journal_mode=WAL&_busy_timeout=5000", dbName))
|
rtn, err = sqlx.Open("sqlite3", fmt.Sprintf("file:%s?mode=rwc&_journal_mode=WAL&_busy_timeout=5000", dbName))
|
||||||
}
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("opening db: %w", err)
|
return nil, fmt.Errorf("opening db: %w", err)
|
||||||
|
@ -4,8 +4,10 @@
|
|||||||
package wstore
|
package wstore
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
|
"github.com/google/uuid"
|
||||||
"github.com/wavetermdev/thenextwave/pkg/shellexec"
|
"github.com/wavetermdev/thenextwave/pkg/shellexec"
|
||||||
"github.com/wavetermdev/thenextwave/pkg/util/ds"
|
"github.com/wavetermdev/thenextwave/pkg/util/ds"
|
||||||
)
|
)
|
||||||
@ -14,17 +16,35 @@ var WorkspaceMap = ds.NewSyncMap[*Workspace]()
|
|||||||
var TabMap = ds.NewSyncMap[*Tab]()
|
var TabMap = ds.NewSyncMap[*Tab]()
|
||||||
var BlockMap = ds.NewSyncMap[*Block]()
|
var BlockMap = ds.NewSyncMap[*Block]()
|
||||||
|
|
||||||
|
type Client struct {
|
||||||
|
DefaultWorkspaceId string `json:"defaultworkspaceid"`
|
||||||
|
}
|
||||||
|
|
||||||
type Workspace struct {
|
type Workspace struct {
|
||||||
|
Lock *sync.Mutex `json:"-"`
|
||||||
WorkspaceId string `json:"workspaceid"`
|
WorkspaceId string `json:"workspaceid"`
|
||||||
TabIds []string `json:"tabids"`
|
TabIds []string `json:"tabids"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (ws *Workspace) WithLock(f func()) {
|
||||||
|
ws.Lock.Lock()
|
||||||
|
defer ws.Lock.Unlock()
|
||||||
|
f()
|
||||||
|
}
|
||||||
|
|
||||||
type Tab struct {
|
type Tab struct {
|
||||||
|
Lock *sync.Mutex `json:"-"`
|
||||||
TabId string `json:"tabid"`
|
TabId string `json:"tabid"`
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
BlockIds []string `json:"blockids"`
|
BlockIds []string `json:"blockids"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (tab *Tab) WithLock(f func()) {
|
||||||
|
tab.Lock.Lock()
|
||||||
|
defer tab.Lock.Unlock()
|
||||||
|
f()
|
||||||
|
}
|
||||||
|
|
||||||
type FileDef struct {
|
type FileDef struct {
|
||||||
FileType string `json:"filetype,omitempty"`
|
FileType string `json:"filetype,omitempty"`
|
||||||
Path string `json:"path,omitempty"`
|
Path string `json:"path,omitempty"`
|
||||||
@ -66,3 +86,35 @@ func (b *Block) WithLock(f func()) {
|
|||||||
defer b.Lock.Unlock()
|
defer b.Lock.Unlock()
|
||||||
f()
|
f()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func CreateTab(workspaceId string, name string) (*Tab, error) {
|
||||||
|
tab := &Tab{
|
||||||
|
Lock: &sync.Mutex{},
|
||||||
|
TabId: uuid.New().String(),
|
||||||
|
Name: name,
|
||||||
|
BlockIds: []string{},
|
||||||
|
}
|
||||||
|
TabMap.Set(tab.TabId, tab)
|
||||||
|
ws := WorkspaceMap.Get(workspaceId)
|
||||||
|
if ws == nil {
|
||||||
|
return nil, fmt.Errorf("workspace not found: %q", workspaceId)
|
||||||
|
}
|
||||||
|
ws.WithLock(func() {
|
||||||
|
ws.TabIds = append(ws.TabIds, tab.TabId)
|
||||||
|
})
|
||||||
|
return tab, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func CreateWorkspace() (*Workspace, error) {
|
||||||
|
ws := &Workspace{
|
||||||
|
Lock: &sync.Mutex{},
|
||||||
|
WorkspaceId: uuid.New().String(),
|
||||||
|
TabIds: []string{},
|
||||||
|
}
|
||||||
|
WorkspaceMap.Set(ws.WorkspaceId, ws)
|
||||||
|
_, err := CreateTab(ws.WorkspaceId, "Tab 1")
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return ws, nil
|
||||||
|
}
|
||||||
|
57
pkg/wstore/wstore_dbsetup.go
Normal file
57
pkg/wstore/wstore_dbsetup.go
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
// Copyright 2024, Command Line Inc.
|
||||||
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
package wstore
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"fmt"
|
||||||
|
"log"
|
||||||
|
"path"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"github.com/jmoiron/sqlx"
|
||||||
|
"github.com/sawka/txwrap"
|
||||||
|
"github.com/wavetermdev/thenextwave/pkg/wavebase"
|
||||||
|
)
|
||||||
|
|
||||||
|
const WStoreDBName = "waveterm.db"
|
||||||
|
|
||||||
|
type TxWrap = txwrap.TxWrap
|
||||||
|
|
||||||
|
var globalDB *sqlx.DB
|
||||||
|
|
||||||
|
func InitWStore() error {
|
||||||
|
ctx, cancelFn := context.WithTimeout(context.Background(), 2*time.Second)
|
||||||
|
defer cancelFn()
|
||||||
|
var err error
|
||||||
|
globalDB, err = MakeDB(ctx)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
err = MigrateWStore()
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
log.Printf("wstore initialized\n")
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func GetDBName() string {
|
||||||
|
waveHome := wavebase.GetWaveHomeDir()
|
||||||
|
return path.Join(waveHome, WStoreDBName)
|
||||||
|
}
|
||||||
|
|
||||||
|
func MakeDB(ctx context.Context) (*sqlx.DB, error) {
|
||||||
|
dbName := GetDBName()
|
||||||
|
rtn, err := sqlx.Open("sqlite3", fmt.Sprintf("file:%s?mode=rwc&_journal_mode=WAL&_busy_timeout=5000", dbName))
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
rtn.DB.SetMaxOpenConns(1)
|
||||||
|
return rtn, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func MigrateWStore() error {
|
||||||
|
return nil
|
||||||
|
}
|
@ -19,7 +19,7 @@
|
|||||||
"@/util/*": ["frontend/util/*"],
|
"@/util/*": ["frontend/util/*"],
|
||||||
"@/store/*": ["frontend/app/store/*"],
|
"@/store/*": ["frontend/app/store/*"],
|
||||||
"@/element/*": ["frontend/app/element/*"],
|
"@/element/*": ["frontend/app/element/*"],
|
||||||
"@/bindings/*": ["frontend/bindings/*"],
|
"@/bindings/*": ["frontend/bindings/github.com/wavetermdev/thenextwave/pkg/service/*"],
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -560,10 +560,10 @@
|
|||||||
"@types/babel__core" "^7.20.5"
|
"@types/babel__core" "^7.20.5"
|
||||||
react-refresh "^0.14.0"
|
react-refresh "^0.14.0"
|
||||||
|
|
||||||
"@wailsio/runtime@latest":
|
"@wailsio/runtime@^3.0.0-alpha.24":
|
||||||
version "3.0.0-alpha.22"
|
version "3.0.0-alpha.24"
|
||||||
resolved "https://registry.yarnpkg.com/@wailsio/runtime/-/runtime-3.0.0-alpha.22.tgz#40dfcd0cebf055f455438712fcfdb64a8292384b"
|
resolved "https://registry.yarnpkg.com/@wailsio/runtime/-/runtime-3.0.0-alpha.24.tgz#87d8465a08fbfc7e3131cd8f8832601fb2a2c99c"
|
||||||
integrity sha512-72i0cq17cLlbjHZyD3XT8VPxcDIK2RLLYaBwcUYGWCQHSuZFPdR0ZR2ghSeZnTey8h30PBtYqQzWyOTvOYN5Jw==
|
integrity sha512-bd36Qj6CfIMPeUd+fhLpcb9O/XEUEOgLzelkHw45lk0OWHMRlTV5QYdAT3cBncvztH7xYijoN5v2+O3U/Jwreg==
|
||||||
dependencies:
|
dependencies:
|
||||||
nanoid "^5.0.7"
|
nanoid "^5.0.7"
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user