mobie / mobie.github.io

1 stars 3 forks source link

Views name obsolete? #20

Closed tischi closed 3 years ago

tischi commented 3 years ago

I realized that the views probably don't need a name, because the menuItem fully specifies how to reference them and the menuItem also must be unique (otherwise the UI cannot present them for selection). Thus, we could the views a plain list instead of a Map in the JSON. This anyway feels better, because the individual source views also don't have this key -> view structure.

constantinpape commented 3 years ago

Thus, we could the views a plain list instead of a Map in the JSON. This anyway feels better, because the individual source views also don't have this key -> view structure.

sources and views are equivalent in the spec right now: both are a Map from string (source/viewName) to object (source/view):

"sources": {
  "source1": {"source..."},
  "source2": {"source..."}
},
"views": {
  "default": {"view..."},
  "otherView": {"view..."}
}

I am very much in favor of leaving it like this, because it makes working with the spec a lot easier on the python side, and I also think it's a better design in general.

I realized that the views probably don't need a name, because the menuItem fully specifies how to reference them and the menuItem also must be unique

I see that problem, but maybe we should solve it by moving menuItem back to source. This covers the case of everything in the source field. For the views in views (or additional bookmark files), you put it into the bookmark menu, using the view name as name for the entry. This also solves the problem that we were not sure of how to handle the menuItem for bookmarks, see https://github.com/mobie/mobie.github.io/issues/11#issuecomment-804704283.

This leaves one problem that cannot easily be enforced statically in the spec: the menuItems for sources need to be unique. I think we need to live with that and if you have duplicate menu items the viewer prints a warning and only one of the sources with the same entry can be selected.

tischi commented 3 years ago

What about the following:

We leave the menuItem in the view, but rename it to,uiSelectionGroup, in which we only specify the name of the dropdown group. The dropdown item names are then simply the respective source or view names (in your example this is in fact true). This makes it less flexible to configure the names in the menu but it makes everything a bit easier.

constantinpape commented 3 years ago

Yes, I like that proposal, let's do it.

constantinpape commented 3 years ago

Done.