1
0
mirror of https://github.com/garraflavatra/rolens.git synced 2025-07-19 14:14:05 +00:00
This commit is contained in:
2023-01-29 20:00:15 +01:00
parent 2d33c6f2ab
commit 1cf89b3278
20 changed files with 817 additions and 370 deletions

View File

@ -11,15 +11,30 @@ import (
)
type ViewType string
type InputType string
const (
TableView ViewType = "table"
ListView ViewType = "list"
NoInput InputType = "none"
StringInput InputType = "string"
ObjectIdInput InputType = "objectid"
IntegerInput InputType = "int"
LongInput InputType = "long"
Uint64Input InputType = "uint64"
DoubleInput InputType = "double"
DecimalInput InputType = "decimal"
BoolInput InputType = "bool"
DateInput InputType = "date"
)
type ViewColumn struct {
Key string `json:"key"`
Width int64 `json:"width"`
Key string `json:"key"`
Width int64 `json:"width"`
ShowInTable bool `json:"showInTable"`
Mandatory bool `json:"mandatory"`
InputType InputType `json:"inputType"`
}
type View struct {
@ -82,48 +97,6 @@ func (a *App) Views() (ViewStore, error) {
return views, nil
}
// func (a *App) AddView(jsonData string) error {
// views, err := a.Views()
// if err != nil {
// runtime.MessageDialog(a.ctx, runtime.MessageDialogOptions{
// Type: runtime.InfoDialog,
// Title: "Could not retrieve views",
// })
// return errors.New("could not retrieve existing view store")
// }
// var newView View
// err = json.Unmarshal([]byte(jsonData), &newView)
// if err != nil {
// runtime.MessageDialog(a.ctx, runtime.MessageDialogOptions{
// Type: runtime.InfoDialog,
// Title: "Malformed JSON",
// })
// return errors.New("invalid JSON")
// }
// id, err := uuid.NewRandom()
// if err != nil {
// runtime.MessageDialog(a.ctx, runtime.MessageDialogOptions{
// Type: runtime.InfoDialog,
// Title: "Failed to generate a UUID",
// })
// return errors.New("could not generate a UUID")
// }
// views[id.String()] = newView
// err = updateViewStore(views)
// if err != nil {
// runtime.MessageDialog(a.ctx, runtime.MessageDialogOptions{
// Type: runtime.InfoDialog,
// Title: "Could not update view store",
// })
// return errors.New("could not update view store")
// }
// return nil
// }
func (a *App) UpdateViewStore(jsonData string) error {
var viewStore ViewStore
err := json.Unmarshal([]byte(jsonData), &viewStore)