Skip to content

Commit

Permalink
Some UX Improvements & Bug Fixes:
Browse files Browse the repository at this point in the history
Bugs:
- Fix bug with tables page that prevented it from loading
- Fix bug with displaying some kinds of data
Improvements:
- Use resizable splitter panes for Query tab
- Allow changing between vertical/horizontal layout on query tab
- Allow "minimizing" the sidebar for a smaller app size
- Resizing: Rather than scaling whole app with a hack, we'll scale editor font size
  • Loading branch information
iDevelopThings committed Apr 18, 2023
1 parent 3d0b415 commit b694e46
Show file tree
Hide file tree
Showing 36 changed files with 839 additions and 160 deletions.
6 changes: 6 additions & 0 deletions backend/Application.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ func BootApplication(
windowSettings *Config.Window,
connections *Config.Connections,
queriesList *Config.QueriesList,
preferences *Config.Preferences,
menuBuilder *ApplicationMenuBuilder,
) {

Expand All @@ -42,6 +43,7 @@ func BootApplication(
Window: windowSettings,
Connections: connections,
Queries: queriesList,
Preferences: preferences,
}

Logger = Util.NewFileLogger(FileStore.Stores.GetAppDirFilePath("log.txt"))
Expand Down Expand Up @@ -210,3 +212,7 @@ func (a *App) UpdateCheck() *Updater.UpdateInfo {

return nil
}

func (a *App) UpdatePreferences(preferences *Config.Preferences) {
a.Config.Preferences.Update(preferences)
}
3 changes: 2 additions & 1 deletion backend/ApplicationSettings.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,14 @@ func NewApplicationSettings() *ApplicationSettings {
settings := &ApplicationSettings{
Title: "SurrealDB Explorer",
Name: "surrealdb_explorer",
Version: semver.MustParse("0.0.9"),
Version: semver.MustParse("0.0.12"),
}

FileStore.NewStores(settings.Name)
FileStore.DefineStore[Config.Window]("window_settings")
FileStore.DefineStore[Config.Connections]("connections")
FileStore.DefineStore[Config.QueriesList]("queries")
FileStore.DefineStore[Config.Preferences]("preferences")

return settings
}
Expand Down
49 changes: 49 additions & 0 deletions backend/Config/Preferences.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
package Config

import (
"context"
"github.com/wailsapp/wails/v2/pkg/runtime"
"wails_vue/backend/FileStore"
)

type PaneSize struct {
Min float64 `json:"min"`
Max float64 `json:"max"`
Size float64 `json:"size"`
}

type Preferences struct {
Ctx context.Context `json:"-"`

EditorFontSize int `json:"editorFontSize"`
QueryResultFontSize int `json:"queryResultFontSize"`

PaneSizes []PaneSize `json:"paneSizes"`
PanelLayout string `json:"panelLayout"`
}

func (p *Preferences) Setup() {
p.PaneSizes = []PaneSize{
{Min: 10, Max: 100, Size: 90},
{Min: 10, Max: 100, Size: 10},
}
p.EditorFontSize = 16
p.QueryResultFontSize = 14
p.PanelLayout = "horizontal"
}

func (p *Preferences) Update(data *Preferences) {
p.EditorFontSize = data.EditorFontSize
p.QueryResultFontSize = data.QueryResultFontSize
p.PaneSizes = data.PaneSizes
p.PanelLayout = data.PanelLayout

err := FileStore.Save[Preferences](p)
if err != nil {
runtime.LogError(p.Ctx, err.Error())
}
}
func (p *Preferences) UpdatePaneSizes(panes []PaneSize) {
p.PaneSizes = panes
p.Update(p)
}
1 change: 1 addition & 0 deletions backend/ConfigManager.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ type AllConfig struct {
Window *Config.Window `json:"window,omitempty"`
Connections *Config.Connections `json:"connections,omitempty"`
Queries *Config.QueriesList `json:"queries,omitempty"`
Preferences *Config.Preferences `json:"preferences,omitempty"`
}
39 changes: 39 additions & 0 deletions backend/Updater/AppUpdater.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,12 @@ import (
"github.com/wailsapp/wails/v2/pkg/runtime"
"io"
"net/http"
"os"
"time"

ss "github.com/blang/semver"

"github.com/rhysd/go-github-selfupdate/selfupdate"
)

type AppUpdater struct {
Expand Down Expand Up @@ -104,6 +109,40 @@ func (a *AppUpdater) CheckForUpdate() {
}
}

func (a *AppUpdater) RunNew() {
selfupdate.EnableLog()

up, err := selfupdate.NewUpdater(selfupdate.Config{})
if err != nil {
panic(err)
}

cv := ss.MustParse("0.0.9")
r, err := up.UpdateCommand(
"/Users/sam/Code/Testing/SurrealDbExplorer/build/bin/SurrealDB Explorer.app/Contents/MacOS/SurrealDB Explorer",
cv,
"iDevelopThings/SurrealDB-Explorer",
)

if err != nil {
runtime.LogInfof(a.Ctx, "Error occurred while updating binary: %s", err.Error())
os.Exit(2)
}
runtime.LogInfof(a.Ctx, "Successfully updated to version %s", r.Version.String())
rr, err := runtime.MessageDialog(a.Ctx, runtime.MessageDialogOptions{
Title: "Update",
Message: "Successfully updated to version " + r.Version.String(),
Type: runtime.InfoDialog,
})
if err != nil {
runtime.LogInfof(a.Ctx, "Error occurred while updating binary: %s", err.Error())
os.Exit(2)
}

runtime.LogInfof(a.Ctx, rr)
os.Exit(1)
}

func (a *AppUpdater) IsUpdateAvailable() bool {
if a.LatestVersion == nil {
return false
Expand Down
5 changes: 5 additions & 0 deletions frontend/.idea/codeStyles/codeStyleConfig.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions frontend/.idea/git_toolbox_prj.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions frontend/.idea/tailwindcss.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit b694e46

Please sign in to comment.