Closed benloh closed 1 year ago
Nice!! Looking good so far! A few minor notes:
BL Adding more to do items to this comment so that it's all in one place.
If we want to change the default text for provenance and comments, should we edit template-schema (in a separate branch and then merge request)?
If we want to change the default text for provenance and comments, should we edit template-schema (in a separate branch and then merge request)?
You'll want to edit the template-schema.js
and also _default.template.toml
files.
Probably safer to do it in a branch off of this branch in case I need to touch those while fixing the bugs you reported.
If we want to change the default text for provenance and comments, should we edit template-schema (in a separate branch and then merge request)?
You'll want to edit the
template-schema.js
and also_default.template.toml
files. Probably safer to do it in a branch off of this branch in case I need to touch those while fixing the bugs you reported.
Makes sense and we can wait until this is locked down but figured I’d ask! Thanks!!
Some changes to the default template. Excerpts from the wiki:
https://github.com/netcreateorg/netcreate-2018/wiki/Using-Templates/
_default.template.toml
_default.template.toml
is used as the starting point for any new template file. If a dataset is requested that does not already have a template file, it is cloned from _default.template.toml
. So you can use this to define a starting point for projects. Use this to set stuff like default node and edge types, common feature parameters etc. The defaults established in the _default.template.toml
file can differ from those set by template-schema.js
, and will in fact override those in template-schema.js
.
Administrators might want to modify this to establish a baseline for all projects and then commit it to the repo for all projects.
Curriculum designers can modify this for their local projects. They should not commit this to the repo unless the intent is for ALL Net.Create users across all organizations to use these defaults.
The file can be found at /build/public/templates/_default.template.toml
.
template-schema.js
template-schema.js
defines the core format of the template toml file. It lists ALL available parameters, sets some json-editor-specific settings, and has help text. This is the source of truth for templates.
This should not be touched by anyone but developers!!!
See [SCHEMA](https://github.com/netcreateorg/netcreate-2018/pull/252#schema), below, for more information.
Default "No Type Selected" Type
A blank label will set the default "No Type Selected" type color. If this is missing, just add a new type with a blank label. Note that the order of the types is the order they will be displayed in the LEGEND/KEY, so move them up/down as you want.
Extra blank labels will be removed when the template is saved. Only the first blank is kept.
_default.template.toml
If you change the template-schema.js
the _default.template.toml
will no longer reflect the settings in the schema. If you want _default.template.toml
to match the settings in template-schema.js
, you need to regenerate the _default.template.tom
file.
This is easy to do with with a browser.
ncRegenerateDefaultTemplate()
This will generate a new _default.template.toml
file in /build/public/templates/_default.template.toml
. You can then copy this to any new installs.
template-schema.js
and _default.template.toml
How to test that changes to template.schema.js
make it all the way through to _default.template.toml
.
template-schema.js
color
property, change default: '#eeeee'
to default: #ff0000
./nc.js --dataset=test
) to load the new schema.localhost:3000
ncRegenerateDefaultTemplate()
_default.template.toml
file.build/app/assets/templates/_default.template.toml
and check around line 44, you should see
[[nodeDefs.type.options]]
color = "#ff0000"
ctrl-c
to quit Net.Create./nc.js --dataset=newdefault
-- this should create a new db from the updated default template file.localhost:3000
Quick thought - is there an easy way, that isn't a waste of time, to modify the comment filter so that we can say something like "if it is not empty"? Long-term that'll be a badge, but checking for non-empty or empty fields feels useful. But not if it is a distraction. @benloh
Standalone appears to work, though I'll keep banging on it.
The provenance and comments fields appear to show up in the table view but clicking on them does not sort the data the way the other tabs do.
The notes field is now a bit narrow ... not sure how we want to solve that long-term, though?
I had been thinking a full table module / plugin would be nice to let people re-size columns but easier said than done I presume?
modify the comment filter so that we can say something like "if it is not empty"? Long-term that'll be a badge, but checking for non-empty or empty fields feels useful.
@jdanish I think we can easily add a new test for strings.
The provenance and comments fields appear to show up in the table view but clicking on them does not sort the data the way the other tabs do.
It seems to work for me. Are you sure it's broken? Can you tell me how to reproduce or show me a video?
The notes field is now a bit narrow ... not sure how we want to solve that long-term, though?
I didn't really touch the styling on the table at all. We might consider making the tables the full width of the browser to give them more room. We could also style the text a little more (e.g. Provenance can be smaller. The text in general could probably be smaller.
I didn't want to touch the styling without checking in with you first. Do you want to take a crack at it and style it as I see fit? Or did you want to talk through the changes?
I had been thinking a full table module / plugin would be nice to let people re-size columns but easier said than done I presume?
This really depends on whether we can find the right library. In the past, we had issues with libraries not working well with React, or being a pain in the tuchus to implement. If this is significant enough of an issue, add it to the issues db and we can prioritize.
The provenance and comment sorting do appear to work now. Prior issue may have been an artifact of sparse population in the sense that it worked but I couldn't tell.
Re: styling, do what you need, but the big overhaul should wait until we have more change done and should do a round together at that time.
Re: table ... let's revisit when we look at the long-term timeline etc.
Added "is empty" and "is not empty"
Provenance and Comment now sort properly for v1.3-era projects that have been only partially migrated to the current version. The issue was that provenance
and comments
fields were undefined so nothing was ever sorted. We had to introduce "typing" so that we know how to sort the data and catch undefined data. This also addresses #247 .
@jdanish this ended up expanding to many other issues/fixes, but I think we should be able to merge and close this now? We'll handle the other issues in another branch/merge?
@benloh Ready to merge! Only last minor thing is that the yellow on the comments on nodes table (awesome) isn't also on edges. I'd say merge it once that is in, though!
Oh, one minor catch @benloh - provenance needs to be slightly wider to keep the arrow visible.
Merging and closing.
This pull request adds the
provenance
andcomments
fields.See the issues for details on implementation.
244
243
Both fields have now been added to the base
template-schema.js
. We can now also generate a new default template JSON from thetemplate-schema.js
. Both fields can be added to filters (this came for free with our template-schema implementation).If you open a project that did not have these fields defined, the project will gracefully open with no errors and by default hide the fields. If you want them on, edit the template to unhide them.