Skip to content

Edit resources - #92

Open
mihailefter wants to merge 38 commits into
masterfrom
feature/edit-resources
Open

mihailefter wants to merge 38 commits into
masterfrom
feature/edit-resources

Conversation

@mihailefter

Copy link
Copy Markdown
Collaborator

Resource metadata was read-only. These changes add an Edit link, a form generated from the resource’s SHACL shapes, and a PUT request on save.

Access control

Editing requires being signed in, holding W permission on the resource or being an administrator, and the backend advertising the corresponding PUT operation. useMeta.ts supplies the shared access rule for the Edit link, edit page, and route guard. Denied edit permission redirects to /not-allowed; request failures are displayed on the edit page.

Resource operations use the existing API-discovery mechanism to resolve endpoint URLs and HTTP methods, following PR #64.

Edit form

The client loads SHACL shapes through the resource’s dct:conformsTo profile. shaclUtils.ts supplies a shared property map for display and editing; property shapes with dash:editor define form fields, ordered by sh:order and populated from existing RDF values.

ShapeFormFields.vue supports text fields, text areas, IRIs, dates, date-times, and nested records. Entries can be added or removed within cardinality limits, and individual values can be restored. For input controls not yet implemented, the form names the missing editor and preserves the stored values.

Updating and previewing the graph

shapeGraph.ts builds the updated graph for PUT, preserving RDF properties outside the form, literal language tags, and datatypes. The “View RDF” panel shows the serialized draft as the form changes.

Validation

Before saving, local checks enforce required values and valid absolute IRIs for supported fields. The backend performs full SHACL validation; errors appear beside matching fields or in a summary, with the raw response under “View report.” Failed saves preserve edits for correction and retry.

Related UI changes

The resource header shows membership and ownership badges, with other owners’ names available to administrators. RawContentPanel.vue shares syntax highlighting and resizing across the raw-format viewer, RDF preview, and validation reports. A modal blocks interaction during saving and confirms success before returning to the resource page.

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