crate2tables: in-app config tree editor, _config/_outputs paths - #18
Open
ptsefton wants to merge 3 commits into
Open
crate2tables: in-app config tree editor, _config/_outputs paths#18ptsefton wants to merge 3 commits into
ptsefton wants to merge 3 commits into
Conversation
Replaces "hand-edit crate2tables-config.json in a text editor" (Phase 1) with an actual UI, per the standing request to build the config picker described in the plugin spec's Phase 2: - Config moves to _config/roctable/config.json, output to _outputs/roctable/ — chaos2crate issue #81's proposed per-plugin directory convention, adopted here ahead of it becoming repo-wide. - First build against a folder with no config blocks on a checkbox tree editor (config-tree-ui.js): one heading per discovered @type, tick to select it as a table, unroll to choose include/expand/ load_text/join per property, one level deeper for an expanded property's own sub-properties. Confirming writes the config and that same build continues into extraction — not a seed-then-rebuild two-step. Dismissing without confirming cancels the build. - Every later build uses the existing config directly, no prompt. "Configure tables…" (a new action child) reopens the same editor on demand, reading the folder's crate directly via loadCrateFromJson — no build has to run first, other than the one that created the crate. - discover.js factors out the one discovery+merge path both the build-time hook and the standalone action call, adding one default: ldac:mainText (falling back to indexableText when a type has none) seeds include+load_text the first time that property is seen on a type, and is never touched again once it's been through one config round-trip — checked by presence in the config that existed before the call, not by shape, since a person deliberately declining it looks identical to a never-seen property otherwise. Depends on this repo's chaos2crate companion PR for two core additions "Configure tables…" needs: a nested type:"action" child (the same idea as the existing top-level action tile, just usable inside a group) and loadCrateFromJson added to buildDeps(). Verified: discoverConfig's default-seeding against all four cases (present fresh, absent-with-fallback, already-declined, already- customised); the tree UI's full interaction surface against a minimal fake DOM (type selection, include/expand/load_text/join, sub-property rendering, Cancel/dismiss/Save); the whole plugin end-to-end — cancellation, confirmed selection through to written CSV, a second build skipping the modal, and the standalone action with and without an existing crate — against a real 764-entity F2F collection, including confirming ldac:mainText seeds correctly on real RepositoryObject data and the resulting CSV contains genuinely loaded transcript text.
The plugin already used "roctable" as its _config//_outputs directory slug (matching chaos2crate issue #81's own example) but was registered and referred to everywhere else as "crate2tables" — inconsistent with itself. Renamed throughout: src/crate2tables/ -> src/roctable/, name: "roctable", enableCrate2Tables -> enableRoctable, crate2tablesConfigure -> roctableConfigure, crate2tablesConfigUpload -> roctableConfigUpload. No behavioural change — re-verified end-to-end against the real F2F collection after the rename.
roctable's own discoverExpandedProperties (lib/inspect.js) only walks config.tables, silently skipping any type still in potential_tables — verified against its actual source. The tree editor lets a person check "expand" on a potential (not yet ticked) table's property, so that setting was getting saved but never actually resolved into sub-properties, no matter how many rebuilds ran, since the function never even looked at it. discoverExpandedPropertiesForAllTables (discover.js) runs the same trusted function twice — once normally, once with tables/potential_tables swapped — rather than reimplementing its crate-walking logic. Verified against a real F2F RepositoryObject, still unselected, with contentLocation (a genuine Place reference) checked for expansion: sub-properties now populate on the very next rebuild. Also: a property whose expansion was tried and genuinely found nothing (a plain-text value, not an @id reference — e.g. F2F's own `author` field, a bare name rather than a Person link) now gets its own message distinguishing "tried, nothing to expand" from "not tried yet", instead of one hint implying a rebuild might eventually help when it never will. Also widens the config editor modal — the host's shared .modal caps out at 420px, sized for a short confirmation, not a four-control-per-row property table.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Replaces "hand-edit
crate2tables-config.jsonin a text editor" with an actual UI — the Phase 2 the plugin spec described as not-yet-built — then two follow-up fixes found while using it, and a rename to match the plugin's own slug._config/roctable/config.json, output to_outputs/roctable/— chaos2crate issue #81's proposed per-plugin directory convention, adopted here ahead of it becoming repo-wide.config-tree-ui.js): one heading per discovered@type, tick to select it as a table, unroll to choose include/expand/load_text/join per property, one level deeper for an expanded property's own sub-properties. Confirming writes the config and that same build continues into extraction — not a seed-then-rebuild two-step. Dismissing without confirming cancels the build.loadCrateFromJson— no build has to run first, other than whichever one already created the crate.discover.jsfactors out the one discovery+merge path both the build-time hook and the standalone action call, adding one default:ldac:mainText(falling back toindexableTextwhen a type has none) seedsinclude+load_textthe first time that property is seen on a type, and is never touched again once it's been through one config round-trip — checked by presence in the config that existed before the call, not by shape, since a person deliberately declining it looks identical to a never-seen property otherwise.crate2tables→roctablethroughout (directory, registered name, option keys) to match the_config/roctable/_outputs/roctableslug it already used — inconsistent with itself otherwise.discoverExpandedPropertiesonly ever walksconfig.tables(verified against its source), silently skipping any type still inpotential_tables— checking "expand" on a property before ticking its type as selected meant that property's sub-properties never got discovered, no matter how many rebuilds ran.discoverExpandedPropertiesForAllTablesruns the same trusted function twice (buckets swapped for the second pass) rather than reimplementing its crate-walking logic. A property whose expansion was tried and genuinely found nothing (a plain-text value, not a reference) now gets its own message distinguishing that from "not tried yet"..modalcaps at 420px, sized for a short confirmation, not a four-control-per-row property table.Dependencies
type:"action"support andloadCrateFromJson.Test plan
discoverConfig's default-seeding against all four cases: present fresh, absent-with-fallback, already-declined, already-customisedtables/potential_tables, property include/expand/load_text/join, sub-property rendering, Cancel/dismiss/Savepotential_tablesexpand fix specifically: a real F2FRepositoryObject, left unselected, withcontentLocation(a genuinePlacereference) checked for expansion — sub-properties (address,@label,geo) populate correctly on the next rebuildldac:mainTextseeds correctly on realRepositoryObjectdata, and the resulting CSV contains genuinely loaded transcript text