1
0
mirror of https://github.com/garraflavatra/rolens.git synced 2025-07-22 15:18:02 +00:00

Zenity dialogs

This commit is contained in:
2023-02-20 21:04:01 +01:00
parent bab7f44ec3
commit bd18b54842
20 changed files with 176 additions and 429 deletions

View File

@ -3,6 +3,7 @@ package app
import (
"encoding/json"
"github.com/ncruces/zenity"
"github.com/wailsapp/wails/v2/pkg/runtime"
"go.mongodb.org/mongo-driver/bson"
@ -25,11 +26,7 @@ func (a *App) UpdateItems(hostKey, dbKey, collKey string, formJson string) int64
if err != nil {
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",
Message: err.Error(),
})
zenity.Info(err.Error(), zenity.Title("Could not parse form"), zenity.ErrorIcon)
return 0
}
@ -47,11 +44,7 @@ func (a *App) UpdateItems(hostKey, dbKey, collKey string, formJson string) int64
runtime.LogWarning(a.ctx, "Invalid update query:")
runtime.LogWarning(a.ctx, form.Query)
runtime.LogWarning(a.ctx, err.Error())
runtime.MessageDialog(a.ctx, runtime.MessageDialogOptions{
Type: runtime.ErrorDialog,
Title: "Invalid update query",
Message: err.Error(),
})
zenity.Info(err.Error(), zenity.Title("Invalid update query"), zenity.ErrorIcon)
return 0
}
@ -64,11 +57,7 @@ func (a *App) UpdateItems(hostKey, dbKey, collKey string, formJson string) int64
runtime.LogWarning(a.ctx, "Invalid update parameter value:")
runtime.LogWarning(a.ctx, param.Value)
runtime.LogWarning(a.ctx, err.Error())
runtime.MessageDialog(a.ctx, runtime.MessageDialogOptions{
Type: runtime.ErrorDialog,
Title: "Invalid update query",
Message: err.Error(),
})
zenity.Info(err.Error(), zenity.Title("Invalid update query"), zenity.ErrorIcon)
return 0
}
}
@ -85,11 +74,7 @@ func (a *App) UpdateItems(hostKey, dbKey, collKey string, formJson string) int64
if err != nil {
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",
Message: err.Error(),
})
zenity.Info(err.Error(), zenity.Title("Error while performing update"), zenity.ErrorIcon)
return 0
}