:file-path widget
Folder select + filename.
Uploading a file asks the user to type a logical path, and the parent directory must already exist. Before any directories are created, the only valid parent is /, which a novice does not know to type. Replace the path textbox with a folder select plus an editable filename. The control still submits one path string; the API is unchanged.
Decided 2026-10-17 (Donnie):
- The widget lives on the path field, not on
:widget :file.:filekeeps the bytes and the two-phase upload. - Widget name
:file-path, so a future directory widget is not boxed in. Parameter is:directory-type(not:parent, which reads as type-level:parent-type, and not:table, whichfe-fieldsoverwrites). - Default folder is
/. Options are whatever/api/liston that type already returns for this user — no extra filtering. - Filename is prefilled from the picked file and stays editable.
The only Lisp is the closed :ui vocabulary: :file-path in *widgets*, :directory-type in *ui-keys*, required on that widget, must name an existing type. No REST, no DDL, no path-validation change.
Plan: refine-file-uploads-plan.org.
Implemented 2026-10-17 per the plan. Compiler (lisp/model.lisp): :file-path in *widgets*, :directory-type in *ui-keys*, valid-directory-type-value (keyword check + :file-path-only, the :options=/:select precedent) called from finalize-ui, and a compile-field existence check beside the :select rule (required on :file-path, must name a type in the model). No REST, no DDL, no path-validation change; fe-fields passes the key through verbatim on the wire. Tests: new tests/file-path-tests.lisp (compile probes + fe-fields wire emission; sub-suites file-path-compile / file-path-wire), new fixture models/test/file-path-test.lisp, registered in data-ui.asd, run-file-path-tests in tests/helpers.lisp and added to run-tests (36 groups). Frontend: new web/src/FilePath.tsx (folder select + editable filename; splits at last /, joins on change, / always offered and default, schema-derived folder column via the :path flag, stale stored folder appended as an extra option, limit 200, filename prefilled from the sibling :widget :file File basename only while untouched and empty) + App.tsx form-map branch (beside the file branch, so it can see the sibling file field), file-path in WIDGET_VOCABULARY, directory-type in the Field interface; built with tsc + vite via node_modules/.bin. Docs: :widget row, new :directory-type row, widget-semantics paragraph, file-server worked example, and the Quick key index in docs/model-reference.md. Models: the four checked-in textbox-plus-file leaf types switched to :widget :file-path :directory-type :directories — file-server :files, parts :files, modelbank :images, books :covers. All four compile (validate-model); /api/list on the live image emits directory-type: "directories". run-tests: 2019 checks, 36 groups, all green (first run failed 33 backend checks — my parallel (set-model "file-path-test") had swapped the model mid-suite; clean second run with no interference passes everything). One plan deviation: tests landed as a new suite file (allowed by the plan's fallback) rather than inside the predicate suite, keeping existing test suites untouched.
- Slot
- 2200
- Status
- 60 Done
- Tags
- mvp, frontend, model, compiler
- Contributors
- Donnie