1
0
mirror of https://github.com/garraflavatra/rolens.git synced 2025-07-22 15:18:02 +00:00
This commit is contained in:
2023-02-11 21:57:52 +01:00
parent ff3766ad85
commit 126b42d570
19 changed files with 168 additions and 84 deletions

View File

@ -2,7 +2,6 @@ package app
import (
"encoding/json"
"fmt"
"github.com/wailsapp/wails/v2/pkg/runtime"
@ -24,7 +23,8 @@ func (a *App) UpdateItems(hostKey, dbKey, collKey string, formJson string) int64
err := json.Unmarshal([]byte(formJson), &form)
if err != nil {
fmt.Println(err.Error())
runtime.LogError(a.ctx, "Could not parse update form:")
runtime.LogError(a.ctx, err.Error())
runtime.MessageDialog(a.ctx, runtime.MessageDialogOptions{
Type: runtime.ErrorDialog,
Title: "Couldn't parse form",
@ -35,7 +35,6 @@ func (a *App) UpdateItems(hostKey, dbKey, collKey string, formJson string) int64
client, ctx, close, err := a.connectToHost(hostKey)
if err != nil {
fmt.Println(err.Error())
return 0
}
@ -45,7 +44,8 @@ func (a *App) UpdateItems(hostKey, dbKey, collKey string, formJson string) int64
err = bson.UnmarshalExtJSON([]byte(form.Query), true, &query)
if err != nil {
fmt.Println(err.Error())
runtime.LogError(a.ctx, "Invalid update query:")
runtime.LogError(a.ctx, err.Error())
runtime.MessageDialog(a.ctx, runtime.MessageDialogOptions{
Type: runtime.ErrorDialog,
Title: "Invalid query",
@ -60,7 +60,8 @@ func (a *App) UpdateItems(hostKey, dbKey, collKey string, formJson string) int64
if err == nil {
update[param.Type] = unmarshalled
} else {
fmt.Println(err.Error())
runtime.LogError(a.ctx, "Invalid update query:")
runtime.LogError(a.ctx, err.Error())
runtime.MessageDialog(a.ctx, runtime.MessageDialogOptions{
Type: runtime.ErrorDialog,
Title: "Invalid query",
@ -80,7 +81,8 @@ func (a *App) UpdateItems(hostKey, dbKey, collKey string, formJson string) int64
}
if err != nil {
fmt.Println(err.Error())
runtime.LogWarning(a.ctx, "Encountered an error while performing update:")
runtime.LogWarning(a.ctx, err.Error())
runtime.MessageDialog(a.ctx, runtime.MessageDialogOptions{
Type: runtime.ErrorDialog,
Title: "Encountered an error while updating items",