1
0
mirror of https://github.com/garraflavatra/rolens.git synced 2025-01-18 21:17:59 +00:00

Fixed view store bugs

This commit is contained in:
Romein van Buren 2023-02-16 11:58:20 +01:00
parent 0bbd50857c
commit 38ef130684
Signed by: romein
GPG Key ID: 0EFF8478ADDF6C49
3 changed files with 11 additions and 3 deletions

View File

@ -52,6 +52,9 @@
align-items: center; align-items: center;
cursor: pointer; cursor: pointer;
} }
summary::before {
content: '';
}
summary :global(svg) { summary :global(svg) {
width: 14px; width: 14px;
height: 14px; height: 14px;

View File

@ -127,6 +127,7 @@ select:disabled {
padding: 0.5rem; padding: 0.5rem;
border: 1px solid #ccc; border: 1px solid #ccc;
background-color: #fff; background-color: #fff;
appearance: none;
} }
.field > input:focus, .field > input:focus,
.field > textarea:focus, .field > textarea:focus,

View File

@ -55,7 +55,8 @@ var BuiltInListView = View{
type ViewStore map[string]View type ViewStore map[string]View
func updateViewStore(a *App, newData ViewStore) error { func updateViewStore(a *App, newData ViewStore) error {
filePath := path.Join(a.Env.DataDirectory, "settings.json") newData["list"] = BuiltInListView
filePath := path.Join(a.Env.DataDirectory, "views.json")
jsonData, err := json.MarshalIndent(newData, "", "\t") jsonData, err := json.MarshalIndent(newData, "", "\t")
if err != nil { if err != nil {
@ -71,6 +72,7 @@ func (a *App) Views() (ViewStore, error) {
filePath := path.Join(a.Env.DataDirectory, "views.json") filePath := path.Join(a.Env.DataDirectory, "views.json")
jsonData, err := ioutil.ReadFile(filePath) jsonData, err := ioutil.ReadFile(filePath)
views["list"] = BuiltInListView
if err != nil { if err != nil {
// It's ok if the file cannot be opened, for example if it is not accessible. // It's ok if the file cannot be opened, for example if it is not accessible.
// Therefore no error is returned. // Therefore no error is returned.
@ -84,15 +86,17 @@ func (a *App) Views() (ViewStore, error) {
if err != nil { if err != nil {
runtime.LogInfo(a.ctx, "views.json file contains malformatted JSON data") runtime.LogInfo(a.ctx, "views.json file contains malformatted JSON data")
runtime.LogInfo(a.ctx, err.Error()) runtime.LogInfo(a.ctx, err.Error())
return nil, errors.New("views.json file contains malformatted JSON data") return views, errors.New("views.json file contains malformatted JSON data")
} }
} }
views["list"] = BuiltInListView
return views, nil return views, nil
} }
func (a *App) UpdateViewStore(jsonData string) error { func (a *App) UpdateViewStore(jsonData string) error {
runtime.LogDebug(a.ctx, "Updating view store. New data:")
runtime.LogDebug(a.ctx, jsonData)
var viewStore ViewStore var viewStore ViewStore
err := json.Unmarshal([]byte(jsonData), &viewStore) err := json.Unmarshal([]byte(jsonData), &viewStore)
if err != nil { if err != nil {