Skip to content

Commit f46c913

Browse files
committed
feat: change text editor
1 parent a8ebf51 commit f46c913

File tree

4 files changed

+32
-7
lines changed

4 files changed

+32
-7
lines changed

desktop/app.go

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package main
33
import (
44
"context"
55
"fmt"
6+
jsoniter "github.com/json-iterator/go"
67
"io/ioutil"
78

89
"github.com/slowrookie/redis-web-manager/api"
@@ -86,12 +87,21 @@ func (a *App) NewConnection(con api.Connection) error {
8687
return con.New()
8788
}
8889

89-
func (a *App) CommandConnection(cmd api.Command) ([]interface{}, error) {
90+
func (a *App) CommandConnection(cmd api.Command) (interface{}, error) {
9091
connection, err := api.GetConnection(cmd.ID)
9192
if err != nil {
9293
return nil, err
9394
}
94-
return connection.Command(cmd.Commands)
95+
ret, err := connection.Command(cmd.Commands)
96+
if err != nil {
97+
return nil, err
98+
}
99+
var json = jsoniter.ConfigCompatibleWithStandardLibrary
100+
retJson, err := json.Marshal(ret)
101+
if err != nil {
102+
return nil, err
103+
}
104+
return string(retJson), nil
95105
}
96106

97107
func (a *App) ExecutionScript(lua *api.Lua) (*api.Lua, error) {

desktop/go.mod

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ module github.com/slowrookie/redis-web-manager
33
go 1.18
44

55
require (
6+
github.com/json-iterator/go v1.1.12
67
github.com/slowrookie/redis-web-manager/api v0.0.0-20220525113429-86ac49708877
78
github.com/stretchr/testify v1.7.1
89
github.com/wailsapp/wails/v2 v2.0.0-beta.37
@@ -26,15 +27,19 @@ require (
2627
github.com/leaanthony/slicer v1.6.0 // indirect
2728
github.com/mattn/go-colorable v0.1.12 // indirect
2829
github.com/mattn/go-isatty v0.0.14 // indirect
30+
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
31+
github.com/modern-go/reflect2 v1.0.2 // indirect
2932
github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 // indirect
3033
github.com/pkg/errors v0.9.1 // indirect
3134
github.com/pmezard/go-difflib v1.0.0 // indirect
3235
github.com/rivo/uniseg v0.2.0 // indirect
36+
github.com/samber/lo v1.21.0 // indirect
3337
github.com/tkrajina/go-reflector v0.5.6 // indirect
3438
github.com/valyala/bytebufferpool v1.0.0 // indirect
3539
github.com/valyala/fasttemplate v1.2.1 // indirect
3640
github.com/wailsapp/mimetype v1.4.1 // indirect
3741
golang.org/x/crypto v0.0.0-20220525230936-793ad666bf5e // indirect
42+
golang.org/x/exp v0.0.0-20220303212507-bbda1eaf7a17 // indirect
3843
golang.org/x/net v0.0.0-20220526153639-5463443f8c37 // indirect
3944
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a // indirect
4045
golang.org/x/text v0.3.7 // indirect

web/craco.config.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
1+
const MonacoWebpackPlugin = require('monaco-editor-webpack-plugin');
2+
13
module.exports = {
24
devServer: {
35
devMiddleware: {
4-
writeToDisk: true,
6+
writeToDisk: false,
57
},
68
},
9+
webpack: {
10+
plugins: {
11+
add: [new MonacoWebpackPlugin({languages: ['json', 'lua']})]
12+
}
13+
}
714
};

web/package.json

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,6 @@
99
"@fluentui/react-icons-mdl2": "^1.2.8",
1010
"@fluentui/theme-samples": "^8.4.6",
1111
"@monaco-editor/react": "^4.4.5",
12-
"@testing-library/jest-dom": "^5.11.4",
13-
"@testing-library/react": "^11.1.0",
14-
"@testing-library/user-event": "^12.1.10",
15-
"@types/jest": "^27.0.1",
1612
"@types/lodash": "^4.14.170",
1713
"@types/node": "^16.7.13",
1814
"@types/react": "^17.0.20",
@@ -30,6 +26,13 @@
3026
"typescript": "^4.4.2",
3127
"web-vitals": "^2.1.0"
3228
},
29+
"devDependencies": {
30+
"@testing-library/jest-dom": "^5.11.4",
31+
"@testing-library/react": "^11.1.0",
32+
"@testing-library/user-event": "^12.1.10",
33+
"@types/jest": "^27.0.1",
34+
"monaco-editor-webpack-plugin": "^7.0.1"
35+
},
3336
"scripts": {
3437
"start": "craco start",
3538
"build": "craco build && cp -r ./build/** ../desktop/web/build",

0 commit comments

Comments
 (0)