Add a property from Live Data
- XWiki
- Feature
- Idea
- No
Description
Context and goal
This proposal lets a user with edit right on a class add a new property to it directly from a Live Data table.
From XWIKI-25519:
- UI mockups for the entry point and the creation step, a technical proposal (source capability, configuration update, backend endpoint), and this forum proposal, from which implementation issues are filed.
- Entry points, forms, rights, sources, Live Data configuration, App Within Minutes (AWM), and backend.
Prior work and discussions
| XWIKI-17627 | Live Data: add entry from layout. Experimental | |
| XWIKI-24160 | Design task for row creation | |
| Design for Live Data row creation (#18412) | Forum discussion of the row design | |
| LiveDataAddEntryAction | Design page for row creation | |
| PR #5639 | Row creation implementation | |
| XWIKI-24726, XWIKI-24727 | Row follow-ups: editor switching in edit mode, template support. Open, Fix 18.10.0-rc-1 | |
| App Within Minutes revamp (XWIKI-23758) | AWM revamp idea page. Phase 2, agreed on the forum: create properties from Live Data on the app homepage | |
| CRISTAL-538, Livedata for Cristal | Earlier Live Data UI proposal for Cristal (inline add, batch actions) | |
| CRISTAL-81 | Umbrella: Live Data editing, Notion-like | |
| XWIKI-12597 | Add, modify, delete class properties in the REST API. Open since 2015 |
Proposal
Summary
The new column is created in the table itself, in its header, with no modal or separate form. The property is stated before creating, in the type list, and then confirmed.
- Find the +: a small "plus" button at the end of the header row, shown only when the user can add a property here (wireframe D1, E1).
- Name it: clicking + turns it into the new column's header field. The user types the name (D2, E2).
- Type: a type list opens under the header. The type is suggested from the name and preselected; arrow down on the keyboard allows to pick another (D2, E2).
- Add: Enter adds the property to the class.
- Saving: a busy state shows only if the save is slow (E3).
- Fill in place: focus moves to the new column's first cell; Enter saves and moves down (D3, E4).
- Done: a notification confirms the property was added to the class.
Entry point and visibility
The only entry point is a + button at the end of the header row.
The + is shown when all of these hold:
- The Live Data source declares that it can add properties (see Technical proposal), the same pattern as newRowNamingStrategy for rows in XWIKI-17627.
- The current user has edit right on the class document, plus the rights that document requires.
- The layout has a header row (table layout).

Example of the button on the rightmost part of the table.
On wide tables the + stays pinned at the right edge of the header, so it never scrolls out of reach.

Naming and type
After actioning the + button the user names the column, and most columns need no type choice: the suggested type is preselected and users can hit Enter to accept it.
- Name: the + icon turns into the new column's header.
- The pretty name is what the user types;
- The technical name is generated from it ("Due date" -> dueDate).
- Suggested type: updated as the user types based on predefined rules. Example rules:
- date, deadline, due -> Date;
- owner, assignee, author -> User;
- is…, has…, done -> Boolean;
- count, amount, price -> Number. No match → the default type.
- Type list: a list that opens under the header. Hitting arrow down navigate through the available options. Hitting Enter confirm the selection.
- Commit: only Enter or clicking the type commits the new column. Esc or clicking away cancels and nothing is saved.

Choosing a type
After creation
After adding a property and filling it, the focus lands in its first cell, and a message states what changed.
- Saving: the header shows "Adding…" only if the save takes longer than about 300 ms, so fast saves don't flicker. The rest of the table stays usable.
- Fill in place: focus moves to the first cell of the new column. This relies on Live Data's cell editing and should match the edit-mode behaviour being changed in XWIKI-24726.
- Confirmation: the standard XWiki notification toast: "Due date (Date) added to ProjectTaskClass.".


Card layout
Cards have no header row, so the + moves into the card itself; the rest of the flow is the same as in the table.
- Add property on the card: in edit mode every card already shows an actions area (`LayoutCardsCard.vue`).
- Name and type in the card: after actioning the button becomes the new field's name input. The same list presented on the table layout should appear here.
- Field added to every card: the new field appears on all cards at once, empty on the others. Focus goes to its value on the card it was added from, and the same notification toast confirms the class-wide change.



Removing a property
"Remove" can mean two things, and the UI keeps them apart. In edit mode, each column header (and each field on a card) gets an options button, ⋯, with:
- Hide in this table ("Hide on these cards" in the card layout): the same visibility toggle as the existing Properties panel (More Actions ⋮ → Panels → Properties…, LivedataAdvancedPanelProperties.vue). It only changes this view, the values stay, and the property can be shown again from that panel.
- Delete property…: removes the property from the class and deletes its values in every entry. Shown only when the source supports it and the user can edit the class.
Deleting asks for confirmation with the same XWiki confirmation box used to delete an entry (deleteEntry calls confirm("livedata.table.action.delete.confirm") in LiveDataLogic.ts). A modal fits here: it is XWiki's existing pattern for destructive actions, while adding stays modal-free. The dialog names the property and the class, says every Live Data using the class loses the column, and that this can't be undone here. A notification toast confirms the deletion, as after adding.
- Document properties (doc.title, doc.date, …) only offer Hide: they aren't class properties, so they can't be deleted.
- When the source refuses to delete a property, the menu item is shown disabled, with the reason in its tooltip, instead of being hidden.
- The id is also dropped from query.properties, the sort and the filters, so the table keeps no broken reference.

Edge Cases


Efficiency and accessibility
The common case is name + Enter, done entirely from the keyboard.
Efficiency
- Keyboard all the way: Tab to the +, type, Enter, fill, Enter.
- Suggested type preselected, so most columns need no type choice.
- Shift+Enter to add several columns in a row.
- Focus in the first cell after creation; Enter moves down the column.
- No confirmation dialog: the class is named in the type list before Enter.
- Collisions lead to the existing column instead of a dead end.
Accessibility
- The + is a real <button> with the accessible name "Add property", reachable with Tab in the header row.
- The type list is a listbox; its options are announced with their group.
- Focus returns to the + after Esc, and moves to the first cell after adding.
- Errors are tied to the name field with aria-describedby and aria-invalid.
- The notification and errors are announced through live regions.
Technical proposal
Most of the backend already exists in Live Data: the work is implementing one method in the livetable source, not building a new REST API. Checked on xwiki-platform at commit 5dd5053417e.
What exists
- LiveDataPropertyDescriptorStore (livedata-api) has save(LiveDataPropertyDescriptor), which adds or updates a property descriptor, and remove(propertyId). Both throw UnsupportedOperationException by default.
- LiveDataPropertiesResource (livedata-rest) already exposes a POST addProperty. DefaultLiveDataPropertiesResource calls source.getProperties().save(...) and returns 201 Created with the new descriptor.
- LiveTableLiveDataPropertyStore (livedata-livetable) overrides neither save nor remove.
What to build
- Implement save() in LiveTableLiveDataPropertyStore: add the property to the class through the model, with the rights check on the class document. This keeps Live Data generic, as Marius Florea asked in #18412: the UI only knows properties, the source knows classes.
- Implement remove() later, for removing properties; it isn't needed in v1 since there is no Undo.
- Source capability: copy the add-row pattern. The livetable DefaultLiveDataConfigurationResolver adds an addEntry action to meta.actions only when the naming strategy allows creation. Add an addProperty action the same way, only when the current user can edit the class. The client shows the + when isEditMode() is true and that action is present, mirroring canAddEntry().
- Client API: the client-side LiveDataSource interface (livedata-api/src/liveDataSource.ts, beta) has addEntry but no addProperty. Add addProperty(source, descriptor) and implement it in XWikiLiveDataSource.ts as a POST to the existing /liveData/sources/{sourceId}/properties.
- Type list: read it from GET /liveData/sources/{sourceId}/types, filtered by a new "can be created" flag on the property type descriptors (see Naming and type).
- Type defaults: create Date properties with the wiki's default date format, and Static list properties with the values from the values step.
- Validation on the server: duplicate pretty or technical name, reserved names, invalid identifiers. A concurrent duplicate returns a conflict instead of overwriting (edge case X4).
- Show the new column: columns render from query.properties only (getPropertyDescriptors() in LiveDataLogic.ts). After a successful save, reload the property descriptors, add the new id to query.properties and mark it visible, so it stays after edit mode is turned off. That list is saved per user, in the URL and local storage (LivedataPersistentConfiguration.vue), not in the macro: "Add to the configuration" is what makes the column permanent for everyone.
With this, XWIKI-12597 (class properties in the generic REST API) becomes a nice-to-have rather than a prerequisite.
Live Data configuration: when the macro lists its columns in properties, "Add to the configuration" has to update the macro call on the page that holds it. That is a page edit, not a class edit, and needs its own rights check. How to do it safely (one macro among several on a page, macros inside other content) needs a technical answer.
Thiago Krieck