Skip to content

crate2tables: in-app config tree editor, _config/_outputs paths - #18

Open
ptsefton wants to merge 3 commits into
mainfrom
feature/crate2tables-config-ui
Open

crate2tables: in-app config tree editor, _config/_outputs paths#18
ptsefton wants to merge 3 commits into
mainfrom
feature/crate2tables-config-ui

Conversation

@ptsefton

@ptsefton ptsefton commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Summary

Replaces "hand-edit crate2tables-config.json in 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 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 whichever one already 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.
  • Renamed crate2tablesroctable throughout (directory, registered name, option keys) to match the _config/roctable/_outputs/roctable slug it already used — inconsistent with itself otherwise.
  • Fix: roctable's own discoverExpandedProperties only ever walks config.tables (verified against its source), silently skipping any type still in potential_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. discoverExpandedPropertiesForAllTables runs 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".
  • Widened the editor modal — the host's shared .modal caps at 420px, sized for a short confirmation, not a four-control-per-row property table.

Dependencies

Test plan

  • 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 (no jsdom in this repo): type selection moving between tables/potential_tables, property include/expand/load_text/join, sub-property rendering, Cancel/dismiss/Save
  • The whole plugin end-to-end: forced-modal cancellation, confirmed selection through to written CSV, a second build skipping the modal, and the standalone action both with and without an existing crate
  • The potential_tables expand fix specifically: a real F2F RepositoryObject, left unselected, with contentLocation (a genuine Place reference) checked for expansion — sub-properties (address, @label, geo) populate correctly on the next rebuild
  • All of the above against a real 764-entity F2F collection — ldac:mainText seeds correctly on real RepositoryObject data, and the resulting CSV contains genuinely loaded transcript text

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant