-
Notifications
You must be signed in to change notification settings - Fork 350
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add JSON UI and optional sort for metadata widget #877
Conversation
I moved the new react component into the |
I guess I'm missing something. The tab doesn't show up after I ran |
You have to open it via the Command Palette tab, it is not enabled by default |
So I don't have to look it up again (: |
This was a side effect of how the JSON Component was written. I can play with it some and see if I can show only the contents of a node without showing a parent. (should be possible)
Actually having an optional
I actually discussed this some with @kevin-bates a while ago and currently the api doesn't distinguish whether metadata is user-defined or system-defined until you call the delete api. I believe a "fix" for this on either the front or back ends would be overly complicated and messy for little benefit. Especially because you can "edit" a default to override it, at which point you could delete that edited version. |
Only the server distinguishes between user and system-define metadata instances. We would need to add a meta-property to indicate this - probably something like a boolean-valued However, because we allow system-owned instances to be modified and essentially become user-defined instances - which can be deleted - then things get very confusing. For example, if we were to set the As a result, I'd be inclined to a) add a system-owned meta-property where necessary (i.e., schemas that can span the user/system domain), and b) disallow updates to system-owned instances. This would mean that a user wishing to "update" a system-owned instance would be required to create a new instance with a different name containing the updated properties. |
Yep, I noticed that:
For the sake of simplicity that's the option I would favor, even though a case could be made to not restrict editing/deletion of system-defined metadata at all. (Ignoring for now that a user can already do that by manually accessing the file system with the appropriate permissions.) |
I pushed a couple commits addressing @ptitzler commit's. I updated the display to not show the "root" node and just the json contents. I also added an optional default alphabetical sorting based on |
Thank you Alex! I do believe all lists should be sorted by default using a criteria that enables the user to quickly find relevant information for the majority of use case scenarios. A system-sorted order (whatever that means specifically as to how the sort order is implemented explicitly) shouldn't be used unless it provides a clear advantage. Let's assume (dunno if that is the case) the current system-sort order for the metadata widgets is "by change date [of the underlying file], descending". Does the user derive any benefits from having the list presented in that order? How would the criteria help the user find the appropriate entry faster compared to an alphabetically sorted list? Example: You are looking for an entry
Most likely you would assume that this list is ordered alphabetically (given the implicit hint) and jump to the bottom of the list instead (or close to it) instead of moving lower just a little bit to view the next couple entries. With system sorted order you can't do that without having explicit knowledge about that order. You also have to know the "actual sort value" or at least how it compares to the value of other entries. ("The runtime image definition I am looking for was changed 12 days ago, but where does that put the entry in the list if I don't know when other definitions were last updated?") |
Not sure why but when you create a metadata entry or open an existing one for editing the first input field is no longer selected by default. I remember you had this fixed in another PR ... |
Regarding sorting, I agree that we should have a consistent message regarding sorting - with the default being that items are sorted by I don't know what the implementation of the Code Snippets list widget (not sure that's the correct term) is, but we could probably introduce a meta-property to the schemas named something like The same rules should apply to the CLI tooling as well. |
Based on the conversation above I updated to also sort code snippets using the method Kevin described |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested this locally and looks good :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just tested locally and LGTM!
* A React Component for displaying a json object | ||
* | ||
* A slimmed down copy of the `Component` class in @jupyterlab/json-extension | ||
*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have updated the license to reflect the info above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Fixes #851
Adds a default JSON viewer to the MetadataWidget and adds an optional sort which default to alphabetical by display name.
Developer's Certificate of Origin 1.1