Ready for review
Point the Live Data Macro page at the new Live Data documentation
This is the second half of that conversion, and it is a separate change request only because a change request cannot carry pages from two wikis of the farm.
The whole description xproperty (43,307 characters, 42 sections) was converted, so every section is replaced here by a pointer at the page that now owns it:
| Sections | Now at |
|---|---|
| Usage, In Wiki Syntax, Parameters, Examples | Display a List of Data in a Page and "liveData" Macro |
| Using Velocity, Script Service | Live Data Script Service |
| Live Data Sources, Live Table Results, Properties from Other Classes | Live Data Sources and Migrate a Live Table to Live Data |
| Layouts, Table, Cards, Selection | Live Data Layouts |
| Properties Panel, Sort Panel, Filter Panel | Live Data Panels |
| In-place Edit | Edit a Value in Place |
| Edit Mode | Edit Several Entries at Once |
| In-line Data, Macro Configuration guide, Actions, Live Data JSON, Async Actions, Colored icons | Live Data Configuration |
| JavaScript, JavaScript API, Html Structure | Live Data JavaScript API |
| Adding a Panel, Vue Components Loading, LiveTable New Row Naming Strategy | Live Data Extension Points |
| Troubleshooting, Live Table Source | Debug the SQL Query of a Live Data |
| Persistent State, User Features, Developer Features | the user and developer hubs |
Every heading is kept, in its original order and byte for byte, including the ones whose body is now a single pointer. A heading's HTML id is generated from its text, so removing one would break every link aimed at it, and the Backlinks list never shows anchors. Order matters too: Parameters appears three times and Example/Examples twice, and XWiki numbers the repeated ids by position.
website is set to the "Documentation" button, as on Panels Application and Icon Theme Application. Note what that does: ExtensionCode.ExtensionSheet hides the description and its heading while website is non-empty, on purpose, so the pointer skeleton above is the stored fallback rather than what a reader sees. It also means the page's #H… anchors stop resolving, which is why the backlinks have to be re-pointed without them.
Only description and website are posted. Every other xproperty, the 7 dependency xobjects, the proxy xobject and the sheet binding are left exactly as they are, and the page is not deleted: it still carries the extension's own metadata.
Two things this change deliberately does not do, both because a file change cannot express them:
- the page's 12 attachments (liveData-*.png, cards-no-entries.png, table-no-entries.png) are no longer referenced by anything and have to be deleted, which a file change cannot do. The new pages carry their own re-captured screenshots, so nothing is lost by deleting them after this merges.
- the backlinks of this page still have to be triaged: prose links that mean "read about this" re-pointed at the new pages without their #H… anchor, links that mean "install this extension" left alone. extensions.xwiki.org currently answers a Cloudflare interstitial to the Information tab, so that list has to be read from a browser.
-
Eleni Cojocariu created this Change Request with changes for Live Data Macro
3 hours ago
All changes
Summary
-
Page properties (1 modified, 0 added, 0 removed)
-
Objects (1 modified, 0 added, 0 removed)
Details
- Page properties
-
- Author
-
... ... @@ -1,1 +1,1 @@ 1 -xwiki:XWiki. Admin1 +xwiki:XWiki.elenicojocariu
- ExtensionCode.ExtensionClass[0]
-
- Description
-
... ... @@ -1,1112 +1,169 @@ 1 - Displaysdynamic lists of data usingvarious layouts (table,cards) providing supportfor pagination, selection(for batchactions), multi-sort, advanced filtering and in-linedataediting.1 +See [[Live Data>>xwiki:documentation.xs.user.livedata.WebHome]]. 2 2 3 -{{info}} 4 -The Live Data feature is a replacement for the older [[Live Table feature>>Extension.Livetable Macro]]. You should migrate to use Live Data as Live Table will be removed eventually. 5 -{{/info}} 6 - 7 7 = Usage = 8 8 5 +See [[Display a List of Data in a Page>>xwiki:documentation.xs.user.livedata.display-data.WebHome]]. 6 + 9 9 == In Wiki Syntax == 10 10 11 -{{code language="none"}} 12 -{{liveData 13 - id="recentPages" 14 - properties="doc.title,doc.location,doc.author,doc.date" 15 - source="liveTable" 16 - sourceParameters="translationPrefix=platform.index." 17 - filters="doc.location=help" 18 - sort="doc.date:desc" 19 - limit="5" 20 -/}} 21 -{{/code}} 9 +See [["liveData" Macro>>xwiki:documentation.xs.user.livedata.display-data.macro.WebHome]]. 22 22 23 23 == Using Velocity == 24 24 25 -{{version since="16.0.0RC1"}} 26 -((( 27 -{{warning}} 28 -Whenever XWiki syntax is available, it is preferable to use the macro instead of the Velocity script service. 13 +See [[Live Data Script Service>>xwiki:documentation.xs.dev.livedata.script-service.WebHome]]. 29 29 30 -The script service should be used only when the macro cannot be used (for example in ##.vm## templates, rendering macros cannot be used and only Velocity scripting can be used). 31 -{{/warning}} 32 -))) 33 - 34 -{{code language="velocity"}} 35 -$services.liveData.render({ 36 - 'id': "recentPages", 37 - 'properties': "doc.title,doc.location,doc.author,doc.date", 38 - 'source': "liveTable", 39 - 'sourceParameters': "translationPrefix=platform.index.", 40 - 'filters': "doc.location=help", 41 - 'sort': "doc.date:desc", 42 - 'limit': 5 43 -}) 44 -{{/code}} 45 - 46 -See the [[Script Service>>||anchor="HScriptService"]] section for more details. 47 - 48 -{{image reference="liveData-table.png"/}} 49 -{{/version}} 50 - 51 51 == Parameters == 52 52 53 -|=Name|=Description|=Default Value|=Since 54 -|id|The live data instance id.| | 55 -|properties|The comma-separated list of properties to fetch and display.| | 56 -|source|The live data source to use, specified as a [[component>>Extension.Component Module]] hint.| | 57 -|sourceParameters|The live data source parameters, specified as a URL query string.| | 58 -|filters|The initial filters to apply on the live data, specified as a URL query string.| | 59 -|sort|The properties to sort on the live data initially, specified as a comma-separated list of property names, where each property name can be optionally suffixed with the sort order using ##:asc## or ##:desc##.| | 60 -|limit|The maximum number of live data entries to show on a page. {{version since="16.10.11,17.4.4,17.7.0RC1"}}[[Query limits>>extensions:Extension.Query Module||anchor="HQueryLimits"]] apply to the limit, by default at maximum 1000 entries can be displayed on a page.{{/version}}|15| 61 -|offset|The index of the first live data entry to show.|0| 62 -|layouts|The comma-separated list of layouts the user can choose from to display the live data. The first layout in the list will be loaded initially.|table,cards| 63 -|showPageSizeDropdown|Show or hide the page size drop-down that allows the user to change the number of entries displayed per page.|false| 64 -|pageSizes|The comma-separated list of page sizes to display in the page size drop-down.|15,25,50,100| 65 -|description|An optional textual description of the Live Data.| |16.0.0 17 +See [["liveData" Macro>>xwiki:documentation.xs.user.livedata.display-data.macro.WebHome]]. 66 66 67 -You can use the macro content to pass advanced Live Data configuration using the JSON format specified [[below>>||anchor="HLiveDataJSON"]]. 68 - 69 -{{code language="none"}} 70 -{{liveData ...}}{ 71 - "meta": { 72 - "propertyDescriptors": [ 73 - { 74 - "id": "actions", 75 - "displayer": "html", 76 - "sortable": false, 77 - "filterable": false 78 - } 79 - ] 80 - } 81 -}{{/liveData}} 82 -{{/code}} 83 - 84 -The final configuration is obtained by merging the configuration build from the macro parameters with the configuration read from the macro content, giving priority to the former (i.e., macro parameters overwrite the corresponding advanced configuration property). 85 - 86 86 = Live Data Sources = 87 87 88 - Alivedatasourceisimplementedas a [[component>>Extension.Component Module]] and providesboth thedata (thelivedataentries) andinformation on how to interact with the data (how to displayandeditthe propertiesof a livedata entry).21 +See [[Live Data Sources>>xwiki:documentation.xs.user.livedata.display-data.sources.WebHome]]. 89 89 90 -Here's a list of known live data sources: 91 - 92 -* ##liveTable##: exposes any [[live table>>Extension.Livetable Macro]] results page as a live data source, allowing you to easily replace an existing live table with a live data instance. 93 -* in-line data: the data is specified within the macro content, using the advanced live data configuration 94 - 95 95 == Live Table Results == 96 96 97 - The##liveTable##livedatasourceallowsus toreuseany [[livetable>>Extension.Livetable Macro]] resultspageas alivedatasource.Moreover,you canpreviewthelivedatawidgeton any pagethathasalivetable by adding##useLiveData=true## totheURL query string.25 +See [[Live Data Sources>>xwiki:documentation.xs.user.livedata.display-data.sources.WebHome]] and [[Migrate a Live Table to Live Data>>xwiki:documentation.xs.user.livedata.migrate-live-table.WebHome]]. 98 98 99 99 === Examples === 100 100 101 -* Reuse the default live table results that correspond to a specified class name:((( 102 -{{code language="none"}} 103 -{{liveData 104 - id="users" 105 - properties="_avatar,doc.name,first_name,last_name" 106 - source="liveTable" 107 - sourceParameters="className=XWiki.XWikiUsers&translationPrefix=xe.userdirectory." 108 -/}} 109 -{{/code}} 110 -))) 111 -* Result the default live table results that correspond to a specific class name, with a filter on a property:((( 112 -{{code language="none"}} 113 -{{liveData 114 - id="users" 115 - properties="_avatar,doc.name,first_name,last_name" 116 - source="liveTable" 117 - sourceParameters="className=XWiki.XWikiUsers&translationPrefix=xe.userdirectory.&last_name=Doe" 118 -/}} 119 -{{/code}} 120 -))) 121 -* Reuse the default live table results that correspond to a specified class name, from another wiki in the farm:((( 122 -{{code language="none"}} 123 -{{liveData 124 - id="users" 125 - properties="_avatar,doc.name,first_name,last_name" 126 - source="liveTable" 127 - sourceParameters="className=XWiki.XWikiUsers&resultPage=xwiki:XWiki.LiveTableResults&translationPrefix=xe.userdirectory." 128 -/}} 129 -{{/code}} 130 -))){{warning}} This is a workaround for the bug [[XWIKI-22688>>https://jira.xwiki.org/browse/XWIKI-22688]]. You'll probably also need to set your displayer manually.{{/warning}} 131 -* Reuse custom live table results page:((( 132 -{{code language="none"}} 133 -{{liveData 134 - id="wikis" 135 - properties="wikiprettyname,description,owner,doc.creationDate" 136 - source="liveTable" 137 - sourceParameters="resultPage=WikiManager.WikisLiveTableResults&className=XWiki.XWikiServerClass&translationPrefix=platform.wiki.browse." 138 -/}} 139 -{{/code}} 140 -))) 141 -* Reuse custom live table results template:((( 142 -{{code language="none"}} 143 -{{liveData 144 - id="groups" 145 - properties="name,members" 146 - source="liveTable" 147 - sourceParameters="template=getgroups.vm&translationPrefix=xe.admin.groups." 148 -/}} 149 -{{/code}} 150 -))) 151 -* Reuse custom live table results page with advanced configuration:((( 152 -{{code language="none"}} 153 -{{liveData 154 - id="logging" 155 - properties="logger,level,actions" 156 - source="liveTable" 157 - sourceParameters="resultPage=XWiki.LoggingAdminTableJson&translationPrefix=logging.admin.livetable." 158 -}}{ 159 - "meta": { 160 - "propertyDescriptors": [ 161 - { 162 - "id": "actions", 163 - "displayer": "html", 164 - "sortable": false, 165 - "filterable": false 166 - } 167 - ] 168 - } 169 -}{{/liveData}} 170 -{{/code}} 171 -))) 172 -* Display all pages having a tag with value "aaa" or value "bbb" (but don't display a tag column):((( 173 -{{code language="none"}} 174 -{{liveData 175 - id="documents" 176 - properties="doc.title,doc.date,doc.author,_actions,tags" 177 - source="liveTable" 178 - filters="tags=aaa&tags=bbb" 179 - sourceParameters="className=XWiki.TagClass&translationPrefix=platform.index." 180 -}} 181 - { 182 - "meta": { 183 - "propertyDescriptors": [ 184 - { 185 - "id": "tags", 186 - "visible": false 187 - } 188 - ] 189 - } 190 -} 191 -{{/liveData}} 192 -{{/code}} 193 -))) 29 +See [["liveData" Macro>>xwiki:documentation.xs.user.livedata.display-data.macro.WebHome]]. 194 194 195 195 === Parameters === 196 196 197 - The##liveTable##livedatasourcesupports the following [[livetable parameters>>Extension.Livetable Macro||anchor="HParameter24options"]]:33 +See [[Live Data Sources>>xwiki:documentation.xs.user.livedata.display-data.sources.WebHome]]. 198 198 199 -* className 200 -* resultPage 201 -* queryFilters (default value: ##currentlanguage,hidden##) 202 -** see [[Extension.Query Module]] for more details on the filters 203 -** with those filters, the content is translated to the locale of the user and hidden pages are only displayed when ##Display hidden pages## is set to ##Yes## in the user preferences 204 -* translationPrefix 205 - 206 -Besides these, the following custom parameters are also supported: 207 - 208 -|=Name|=Description 209 -|template|Use this in case you have a live table with results generated from a Velocity template. The value of this parameter should match the template specified in the ##url## live table configuration using the ##xpage## query string. 210 -|hasEditMode|{{version since="18.7.0RC1"}}If set to ##true##, enable the Live Data to enter [[Edit mode>>||anchor="HEditMode"]] (default value: ##false##).{{/version}} 211 -|newRowNamingStrategy|{{version since="18.7.0RC1"}}Strategy to use to generate page names when creating new rows. Right now, the only value supported is ##uuid## which uses a random UUID for each new page and create them in the location set by ##newRowLocation##.{{/version}} 212 -|newRowLocation|{{version since="18.7.0RC1"}}Location to store pages when creating new rows. Requires a compatible row naming strategy, //e.g.//, ##uuid##.{{/version}} 213 - 214 -The ##extraParams## live table parameter is not listed above because its main usage is filtering, and the live data has its own **generic** way to perform filtering. If you're migrating a live table that uses ##extraParams## to live data then you should: 215 - 216 -* try to convert the ##extraParams## used for filtering to live data filters (e.g. by using the ##filters## live data macro parameter) 217 -* try to pass the rest of the ##extraParams## directly as live data source parameters, **BUT** there's no guarantee that they will have the same effect on the live data 218 - 219 -Example of a code using originally extraParams: 220 - 221 -{{code}} 222 -{{velocity}} 223 -#set ($options = { 224 - 'className': 'ExtensionCode.ExtensionVersionClass', 225 - 'location': "${doc.space}" 226 -}) 227 - 228 -{{liveData 229 - id="versions" 230 - properties="version,notes" 231 - source="liveTable" 232 - sourceParameters="$services.rendering.escape($escapetool.url($options), 'xwiki/2.1')" 233 -/}} 234 - 235 -{{/velocity}} 236 -{{/code}} 237 - 238 -{{version since="18.0.0RC1"}} 239 239 ==== Properties from Other Classes ==== 240 240 241 -S imilar to thepossibility to specifycustom classesforsinglepropertieswith ##myProperty_class## parameters inLiveTable with ##extraParams##, itis possibleto specify a property-specific classin LiveData.For this,pass the ##myProperty_class=MySpace.MyClass## parameter in the source parameters.Propertiesfrom otherclassessupport filtering, sorting and editing.When a displayed document doesn't yet have an object of the specified class, it is created when the property is saved.37 +See [[Live Data Sources>>xwiki:documentation.xs.user.livedata.display-data.sources.WebHome]]. 242 242 243 -As an example, with the following Live Data you can get an index of all pages with the tags being displayed if there are any. If there are no tags on a page, an object is automatically added for them when they are edited. 244 - 245 -{{code language="none"}} 246 -{{liveData properties="doc.location,doc.title,tags" source="liveTable" sourceParameters="tags_class=XWiki.TagClass&translationPrefix=platform.index."/}} 247 -{{/code}} 248 -{{/version}} 249 - 250 250 == In-line Data == 251 251 252 - Thelivedatacanbe specifiedin-linewithin the macrocontent, usingtheJSON format:41 +See [[Live Data Configuration>>xwiki:documentation.xs.dev.livedata.configuration.WebHome]]. 253 253 254 -{{code language="none"}} 255 -{{liveData 256 - id="movies" 257 - properties="title,genre,releaseDate,director" 258 -}}{ 259 - "data": { 260 - "count": 2, 261 - "entries": [ 262 - { 263 - "title": "Meet John Doe", 264 - "url": "https://www.imdb.com/title/tt0033891/", 265 - "genre": ["Comedy", "Romance"], 266 - "releaseDate": -904615200, 267 - "director": "Frank Capra", 268 - "directorURL": "https://www.imdb.com/name/nm0001008/" 269 - }, 270 - { 271 - "title": "Modern Times", 272 - "url": "https://www.imdb.com/title/tt0027977/", 273 - "genre": ["Comedy", "Drama"], 274 - "releaseDate": -1068256800, 275 - "director": "Charlie Chaplin", 276 - "directorURL": "https://www.imdb.com/name/nm0000122/" 277 - } 278 - ] 279 - }, 280 - "meta": { 281 - "propertyDescriptors": [ 282 - { 283 - "id": "title", 284 - "name": "Title", 285 - "visible": true, 286 - "displayer": {"id": "link", "propertyHref": "url"} 287 - }, 288 - { 289 - "id": "genre", 290 - "name": "Genre", 291 - "visible": true 292 - }, 293 - { 294 - "id": "releaseDate", 295 - "name": "Release Date", 296 - "visible": true, 297 - "displayer": "date" 298 - }, 299 - { 300 - "id": "director", 301 - "name": "Director", 302 - "visible": true, 303 - "displayer": {"id": "link", "propertyHref": "directorURL"} 304 - } 305 - ] 306 - } 307 -}{{/liveData}} 308 -{{/code}} 309 - 310 -{{warning}} 311 -Please note that In-Line Data [[currently does not support filtering, sorting, or pagination>>https://jira.xwiki.org/browse/XWIKI-19783]]. Therefore, it is recommended to deactivate these features to avoid unexpected error messages when the table Topbar and the Buttombar is used. While filtering and sorting are disabled by default if not set, pagination must be explicitly disabled in the "meta" section of the JSON configuration: 312 - 313 -{{code language="none"}} 314 -… 315 -"pagination": { 316 - "showEntryRange": false, 317 - "showNextPrevious": false, 318 - "showFirstLast": false 319 -} 320 -… 321 -{{/code}} 322 - 323 -If you want to avoid also displaying the remaining and buggy Page Counter or hide the entire Topbar/Bottombar without disabling pagination in the JSON configuration, you can achieve this using a XWiki.StyleSheetExtension for that specific page, as documented in the [[Skin Extension Tutorial>>https://www.xwiki.org/xwiki/bin/view/Documentation/DevGuide/Tutorials/SkinExtensionsTutorial/]]: 324 - 325 -{{code language="none"}} 326 -.livedata-topbar {display: none !important;} 327 -.livedata-bottombar {display: none !important;} 328 -{{/code}} 329 -{{/warning}} 330 - 331 331 = User Features = 332 332 45 +See [[Live Data>>xwiki:documentation.xs.user.livedata.WebHome]]. 46 + 333 333 == Layouts == 334 334 335 - Thelivedatacan be displayedusing multiple layouts.Thefollowinglayoutsarecurrently supported:49 +See [[Live Data Layouts>>xwiki:documentation.xs.user.livedata.layouts.WebHome]]. 336 336 337 -|=Name|=Description|=Since 338 -|table|Displays the live data entries using a table, allowing the user to sort and filter from the table header.| 339 -|cards|Displays the live data entries using cards arranged in a grid. Sorting and filtering is performed through dedicated panels that can be accessed from the live data menu.| 340 - 341 341 === Table === 342 342 343 - Displays thelivedataentries usingatable, allowing theusertosort and filter from the table header. The user can alsochange the column (property) orderand resizethe columnswith drag and drop or keyboard arrows.To reset the column width you can double click onthe resize handler thatisvisiblewhen hovering the column header, or press Escape when focusing it.53 +See [[Live Data Layouts>>xwiki:documentation.xs.user.livedata.layouts.WebHome]]. 344 344 345 -{{image reference="liveData-table.png"/}} 346 - 347 -This layout is responsive on small screens. 348 - 349 -{{image reference="liveData-table-responsive.png"/}} 350 - 351 -When the Live Data is empty, a message is displayed at the bottom. 352 - 353 -{{image reference="table-no-entries.png"/}} 354 - 355 355 === Cards === 356 356 357 - Displays thelivedataentries using cards arranged in a grid. Sorting and filtering is performedthrough dedicated panelsthatcanbe accessed from thelivedatamenu.The user can change the propertyorderusing drag & drop.57 +See [[Live Data Layouts>>xwiki:documentation.xs.user.livedata.layouts.WebHome]]. 358 358 359 -{{image reference="liveData-cards.png"/}} 360 - 361 361 == Properties Panel == 362 362 363 - ThePropertiespanel, accessiblefromthe hamburgermenu on theright, allowsyou to hide / showlivedata properties andto changetheirorder with drag & drop. Changing theproperty order is also possibledirectly from the Tableand Cardslayoutsusing the3-dot icon that is visible when hovering the property name(column name).61 +See [[Live Data Panels>>xwiki:documentation.xs.user.livedata.panels.WebHome]]. 364 364 365 -{{image reference="liveData-panel-properties.png"/}} 366 - 367 -When the Live Data is empty, a message is displayed at the bottom. 368 - 369 -{{image reference="cards-no-entries.png"/}} 370 - 371 371 == Sort Panel == 372 372 373 - TheSort panel allows you to sort on multipleproperties, providedthe propertiesare sortableand provided thelivedata source supports sortingonsingle or multipleproperties.Somelayouts, likethe Table layout, might have shortcuts for sorting (e.g., click on thecolumn header).65 +See [[Live Data Panels>>xwiki:documentation.xs.user.livedata.panels.WebHome]]. 374 374 375 -{{image reference="liveData-panel-sort.png"/}} 376 - 377 377 == Filter Panel == 378 378 379 - TheFilterpanel allows you to filteron multiple properties. For each property you canadd multiple constraints, provided the property is filterable (asindicatedby the live data configuration). Somelayouts, like the Table layout, might have shortcuts for filtering (e.g., thefilterrow below the table header).The filterinput (widget)depends on the property typeand onthe constraint operator. The following filter widgets are currentlysupported: text, number, list (suggest), date, boolean.69 +See [[Live Data Panels>>xwiki:documentation.xs.user.livedata.panels.WebHome]]. 380 380 381 -{{image reference="liveData-panel-filter.png"/}} 382 - 383 383 == In-place Edit == 384 384 385 - When thelivedatais editable(i.e.,if thelive data sourcesupports updating thedata and thecurrentuser isallowedto make changes), double-clickingona property value (e.g., on a table cell in the table layout) willswitch that property to edit mode.The displayedproperty value isthen replacedby a form, allowing youto update the propertyvalue. Pressing the ##escape## key will cancel themodification and switchback todisplay value. Clicking outside the edited content will save themodifications and reload the live data to reflect the change.73 +See [[Edit a Value in Place>>xwiki:documentation.xs.user.livedata.edit-value-place.WebHome]]. 386 386 387 -When a property of a Live Data is editable (i.e., if the Live Data source supports updating the data and the current user is allowed to make changes), hovering on an editable property value (e.g., on a cell in the table layout) shows a popover containing an edit action button. Clicking on this button switches the property to edit mode, displaying a form allowing to update the property value in-place. Pressing the ##escape## key will cancel the modification and switch back to display value. Clicking outside the edited content will save the modifications and reload the live data to reflect the change. 388 -On touch-based devices, the popover is displayed when touching an editable property. In addition, touching a link contained on any Live Data property shows the popover too, with a follow link action (when touching a link inside an editable property, both actions are proposed in the popover). 389 - 390 390 == Selection == 391 391 392 - When selectionisenabled,theusercanselect livedataentries.77 +See [[Live Data Layouts>>xwiki:documentation.xs.user.livedata.layouts.WebHome]]. 393 393 394 -{{image reference="liveData-table-selection.png"/}} 395 - 396 396 == Persistent State == 397 397 398 - Thecurrentpage URLis updated wheneverthe live datastate changes through pagination, sorting, filtering, hidingor re-ordering properties, etc. whichmeansthe live data stateis bookmarkable.The live datastate ispreservedif you reloadthe pageor if you give the page URL to someone else.81 +See [[Live Data>>xwiki:documentation.xs.user.livedata.WebHome]]. 399 399 400 400 == Edit Mode == 401 401 402 -{{version since="18.7.0RC1"}} 403 -Edit mode is a mode that helps with bulk editing, that can be toggled on a Live Data that explicitly supports it (//e.g.//, with the live table source, by setting the ##hasEditMode## [[source parameter>>||anchor="HParameters-1"]] to ##true##). 85 +See [[Edit Several Entries at Once>>xwiki:documentation.xs.user.livedata.edit-mode.WebHome]]. 404 404 405 -{{image reference="liveData-editMode-toggle.png"/}} 406 - 407 -In this mode, all hidden columns are forcefully displayed, and clicking any editable cell directly opens it in edit mode. It's also possible to navigate between cells with the keyboard through Tab/Shift+Tab, with every switch saving the previously focused cell and opening the editor on the newly focused one. 408 - 409 -For sources that also support row creation (//e.g.//, live table with a properly configured ##newRowNamingStrategy## [[source parameter>>||anchor="HParameters-1"]]), a **+ Add entry** button is also available at the bottom of the table for users that have enough rights to create new content. 410 - 411 -{{image reference="liveData-addEntry.png"/}} 412 - 413 -Clicking it will create a draft row, with cells that can be navigated either by mouse or keyboard. Once all the necessary data has been set, it can be saved either by clicking on the **✓** action button on the right, or with keyboard: Return to validate, or Ctrl+Return to validate and create a new draft row again. There is also a **✗** action button on the right to cancel and delete the draft row. 414 - 415 -{{image reference="liveData-rowDraft.png"/}} 416 - 417 -{{/version}} 418 - 419 419 = Macro Configuration guide = 420 420 89 +See [[Live Data Configuration>>xwiki:documentation.xs.dev.livedata.configuration.WebHome]]. 90 + 421 421 == Actions == 422 422 93 +See [[Live Data Configuration>>xwiki:documentation.xs.dev.livedata.configuration.WebHome]]. 94 + 423 423 === Allow an action === 424 424 425 -The action descriptors have a ##allowProperty## field. This field references another property of the entry, holding a boolean value indicating whether the action is allowed for the current entry. 426 -See the example below for an action ##A## with an allow property ##allowA##. 97 +See [[Live Data Configuration>>xwiki:documentation.xs.dev.livedata.configuration.WebHome]]. 427 427 428 -{{code language="json"}} 429 -{ 430 - "data": { 431 - "count": 2, 432 - "entries": [ 433 - { 434 - "title": "Allowed Entry", 435 - "allowA": true 436 - }, 437 - { 438 - "title": "Disallowed Entry", 439 - "allowA": false 440 - } 441 - ] 442 - }, 443 - "meta": { 444 - "propertyDescriptors": [ 445 - { 446 - "id": "title", 447 - "type": "String" 448 - }, 449 - { 450 - "id": "allowA", 451 - "type": "Boolean" 452 - }, 453 - { 454 - "id": "_actions", 455 - "name": "_actions", 456 - "visible": true, 457 - "displayer": { "id": "actions", "actions": ["actionA"] } 458 - } 459 - ], 460 - "entryDescriptor": { 461 - "idProperty": "title" 462 - }, 463 - "actions": [ 464 - { 465 - "id": "actionA", 466 - "name": "Action A", 467 - "description": "Perform action A", 468 - "allowProperty": "allowA" 469 - } 470 - ] 471 - } 472 -} 473 -{{/code}} 474 - 475 475 = Developer Features = 476 476 101 +See the [[Live Data>>xwiki:documentation.xs.dev.livedata.WebHome]] developer documentation. 102 + 477 477 == Live Data JSON == 478 478 479 - ThefollowingJSONconfigurationis supported:105 +See [[Live Data Configuration>>xwiki:documentation.xs.dev.livedata.configuration.WebHome]]. 480 480 481 -{{code language="js"}} 482 -{ 483 - // 484 - // The query 485 - // 486 - 487 - "query": { 488 - // The list of properties to fetch. 489 - "properties": ["title", "year", ...], 490 - 491 - "source": { 492 - // The component hint of the live data source 493 - "id": "...", 494 - 495 - // Parameters specific to each live data source implementation. This can also be used to implement hidden filters, that the user cannot change from the live data UI. 496 - "customParam1": "...", 497 - ... 498 - }, 499 - 500 - // Filter the live data entries. 501 - "filters": [ 502 - { 503 - "property": "title", 504 - "matchAll": true, 505 - "constraints": [ 506 - {"operator": "contains", "value": "help"}, 507 - ], 508 - }, 509 - ], 510 - 511 - // The list of properties to sort on. 512 - "sort": [ 513 - { 514 - "property": "birthdate", 515 - "descending": false 516 - }, 517 - ], 518 - 519 - // Indicates where the current page starts. 520 - "offset": 0, 521 - 522 - // The number of entries to fetch (the page size). 523 - "limit": 10 524 - }, 525 - 526 - // 527 - // The data 528 - // 529 - 530 - "data": { 531 - // The total number of entries available (on the server side). 532 - "count": 54, 533 - 534 - "entries": [ 535 - { 536 - // property: value 537 - "title": "Work from home", 538 - "year": 2020, 539 - ... 540 - }, 541 - ... 542 - ], 543 - }, 544 - 545 - // 546 - // The meta data (used to control how we interact with the data) 547 - // 548 - 549 - "meta": { 550 - "defaultLayout": "table", 551 - 552 - "layouts": [ 553 - { 554 - "id": "table", 555 - "name": "Table", 556 - "icon": {"iconSetName": "Font Awesome", "cssClass": "fa fa-table"}, 557 - }, 558 - { 559 - "id": "cards", 560 - "name": "Cards", 561 - "icon": {"iconSetName": "Font Awesome", "cssClass": "fa fa-th"}, 562 - "titleProperty": "doc_title", 563 - }, 564 - ], 565 - 566 - // Describes the properties that may appear in the data set. This determines the list of known (available) 567 - // properties. Creating new properties, removing existing properties as well as editing the property descriptor 568 - // should be done through this array. 569 - "propertyDescriptors": [ 570 - { 571 - // Identifies the property that this descriptor corresponds to. 572 - "id": "title", 573 - 574 - // The property name. Could be displayed before the property value. 575 - "name": "Title", 576 - 577 - // Could be displayed when hovering the property name. 578 - "description": "...", 579 - 580 - // Could be displayed before the property name, if specified. 581 - "icon": {...}, 582 - 583 - // The property type, selected when creating the property. It is used to prefill the property descriptor. 584 - // Could be mapped to an xclass property type. 585 - "type": "String", 586 - 587 - // Whether the user can sort on this property or not. 588 - "sortable": true, 589 - 590 - // Whether to user can edit in-place this property (the user also need to have the right to edit a given entry to edit it). 591 - "editable": true, 592 - 593 - // Whether to show this property or not. 594 - "visible": true, 595 - 596 - // Displayer configuration. 597 - "displayer": { 598 - "id": "link", 599 - 600 - // Indicates the property whose value is the URL that should be used as the link target (e.g. 'doc.url'). 601 - "propertyHref": "...", 602 - 603 - // Whether to allow HTML in the link content, used by the 'link' displayer 604 - "html": true 605 - }, 606 - 607 - // Whether the user can filter by this property or not. 608 - "filterable": true, 609 - 610 - // Filter configuration. 611 - "filter": { 612 - "id": "text", 613 - 614 - // This is used only by the 'text' filter (which receives the property descriptor). 615 - "match": "prefix" 616 - }, 617 - 618 - // Optional CSS class name to add to the HTML element used to display this property. 619 - "styleName": "..." 620 - } 621 - ], 622 - 623 - // The list of known property types. When creating a new property the user can select from this list and the 624 - // property descriptor will be prefilled based on the selected property type. 625 - "propertyTypes": [ 626 - {"id": "string", "name": "String", "icon": {...}, "sortable": true, "displayer": {...}, "filterable": true, "filter": {...}}, 627 - ... 628 - ], 629 - 630 - "defaultFilter": "text", 631 - 632 - // The list of known filters to choose from when editing the property descriptor. 633 - "filters": [ 634 - {"id": "text", ...}, 635 - {"id": "date", ...}, 636 - {"id": "list", ...}, 637 - {"id": "number", ...}, 638 - {"id": "boolean", ...}, 639 - ... 640 - ], 641 - 642 - // The list of known property displayers to choose from when editing the property descriptor. 643 - "displayers": [ 644 - {"id": "text", ...}, 645 - {"id": "html", ...}, 646 - {"id": "link", ...}, 647 - {"id": "actions", ...}, 648 - {"id": "date", ...}, 649 - {"id": "boolean", ...}, 650 - {"id": "number", ...}, 651 - {"id": "docTitle", ...}, 652 - {"id": "xObjectProperty", ...}, 653 - ... 654 - ], 655 - 656 - "defaultDisplayer": "text", 657 - 658 - // Configure the pagination display. 659 - "pagination": { 660 - // The maximum number of page links to display in the pagination. 661 - "maxShownPages": 10, 662 - "pageSizes": [15, 25, 50, 100], 663 - "showEntryRange": true, 664 - "showNextPrevious": true, 665 - "showFirstLast": false, 666 - "showPageSizeDropdown": false 667 - }, 668 - 669 - "entryDescriptor": { 670 - // The property that can be used to identify a live data entry. This is used for entry selection. 671 - "idProperty": "doc.fullName", 672 - }, 673 - 674 - // The list of actions known / supported by this live data instance. This is used by the actions displayer. 675 - "actions": [ 676 - { 677 - "id": "view", 678 - "name": "View", 679 - "description": "View entry", 680 - "icon": {...}, 681 - "allowProperty": "doc.viewable", 682 - "urlProperty": "doc.url" 683 - }, 684 - // Specify the edit action with an allowProperty to control who can in-place edit the entries 685 - // By default, the action is allowed. 686 - { 687 - "id": "edit", 688 - "allowProperty": "doc.editable" 689 - } 690 - ... 691 - ], 692 - 693 - // Selection configuration. 694 - "selection": { 695 - // Whether to enable or not the entry selection (e.g. for batch actions). 696 - "enabled": false 697 - } 698 - } 699 -} 700 -{{/code}} 701 - 702 702 == Script Service == 703 703 704 -{{code language="java"}} 705 -/** 706 - * Scripting APIs for the Live Data component. 707 - * 708 - * @since 12.10 709 - */ 710 -@Component 711 -@Named("liveData") 712 -@Singleton 713 -public class LiveDataScriptService implements ScriptService 714 -{ 715 - /** 716 - * Executes a live data query. 717 - * 718 - * @param queryConfig the live data query configuration 719 - * @return the live data entries that match the given query 720 - */ 721 - public LiveData query(Map<String, Object> queryConfig) 722 - { 723 - // ... 724 - } 109 +See [[Live Data Script Service>>xwiki:documentation.xs.dev.livedata.script-service.WebHome]]. 725 725 726 - /** 727 - * Executes a live data query. 728 - * 729 - * @param queryConfigJSON the live data query configuration 730 - * @return the live data entries that match the given query 731 - */ 732 - public LiveData query(String queryConfigJSON) 733 - { 734 - // ... 735 - } 736 - 737 - /** 738 - * Computes the effective live data configuration by normalizing the given configuration (i.e. transforming it to 739 - * match the format expected by the live data widget) and adding the (missing) default values. 740 - * 741 - * @param liveDataConfig the live data configuration to start with 742 - * @return the effective live data configuration, using the standard format and containing the default values 743 - */ 744 - public Map<String, Object> effectiveConfig(Map<String, Object> liveDataConfig) 745 - { 746 - // ... 747 - } 748 - 749 - /** 750 - * Computes the effective live data configuration by normalizing the given configuration (i.e. transforming it to 751 - * match the format expected by the live data widget) and adding the (missing) default values. 752 - * 753 - * @param liveDataConfigJSON the live data configuration to start with 754 - * @return the effective live data configuration, using the standard format and containing the default values 755 - */ 756 - public String effectiveConfig(String liveDataConfigJSON) 757 - { 758 - // ... 759 - } 760 - 761 - /** 762 - * Execute the Live Data and return a {@link Block}. 763 - * 764 - * @param parameters the parameters to pass to the Live Data renderer 765 - * @return the Live Data {@link Block} 766 - * @throws LiveDataException in case of error when rendering the Live Data 767 - * @since 16.0.0RC1 768 - */ 769 - @Unstable 770 - public Block execute(Map<String, Object> parameters) throws LiveDataException 771 - { 772 - // ... 773 - } 774 - 775 - /** 776 - * Execute the Live Data and return a {@link Block}. 777 - * 778 - * @param parameters the parameters to pass to the Live Data renderer 779 - * @param advancedParameters the advanced parameters to pass to the Live Data renderer 780 - * @return the Live Data {@link Block} 781 - * @throws LiveDataException in case of error when rendering the Live Data 782 - * @since 16.0.0RC1 783 - */ 784 - @Unstable 785 - public Block execute(Map<String, Object> parameters, Map advancedParameters) throws LiveDataException 786 - { 787 - // ... 788 - } 789 - 790 - /** 791 - * Renders a Live Data. 792 - * 793 - * @param parameters the parameters to pass to the Live Data executor. The parameters cae 794 - * @return the result of {@link #execute(Map)} in the current syntax 795 - * @throws LiveDataException in case of error when rendering the Live Data 796 - * @since 16.0.0RC1 797 - */ 798 - @Unstable 799 - public String render(Map<String, Object> parameters) throws LiveDataException 800 - { 801 - // ... 802 - } 803 - 804 - /** 805 - * Renders a Live Data. 806 - * 807 - * @param parameters the parameters to pass to the Live Data executor 808 - * @param advancedParameters the advanced parameters to pass to the Live Data executor 809 - * @return the result of {@link #execute(Map, Map)} in the current syntax 810 - * @throws LiveDataException in case of error when rendering the Live Data 811 - * @since 16.0.0RC1 812 - */ 813 - @Unstable 814 - public String render(Map<String, Object> parameters, Map advancedParameters) throws LiveDataException 815 - { 816 - // ... 817 - } 818 -} 819 -{{/code}} 820 - 821 -Example of using the script service : 822 - 823 -{{code}} 824 -{{velocity}} 825 - #set($properties = { 826 - "id" : "users", 827 - "properties" : "_avatar,doc.name,first_name,last_name", 828 - "source" : "liveTable", 829 - "sourceParameters" : "className=XWiki.XWikiUsers&translationPrefix=xe.userdirectory.&last_name=Doe" 830 - }) 831 - {{html}} 832 - $services.liveData.render($properties) 833 - {{/html}} 834 -{{/velocity}} 835 -{{/code}} 836 - 837 -is the equivalent of : 838 - 839 -{{code}} 840 -{{liveData 841 - id="users" 842 - properties="_avatar,doc.name,first_name,last_name" 843 - source="liveTable" 844 - sourceParameters="className=XWiki.XWikiUsers&translationPrefix=xe.userdirectory.&last_name=Doe" 845 -/}} 846 -{{/code}} 847 - 848 -And another example of using the script service : 849 - 850 -{{code}} 851 -{{velocity}} 852 - #set($properties = { 853 - "id" : "logging", 854 - "properties" : "logger,level,actions", 855 - "source" : "liveTable", 856 - "sourceParameters" : "resultPage=XWiki.LoggingAdminTableJson&translationPrefix=logging.admin.livetable." 857 - }) 858 - #set($advancedProperties = { 859 - "meta": { 860 - "propertyDescriptors": [ 861 - { 862 - "id": "actions", 863 - "displayer": "html", 864 - "sortable": false, 865 - "filterable": false 866 - } 867 - ] 868 - } 869 - }) 870 - {{html}} 871 - $services.liveData.render($properties, $advancedProperties) 872 - {{/html}} 873 -{{/velocity}} 874 -{{/code}} 875 - 876 -is the equivalent of : 877 - 878 -{{code}} 879 -{{liveData 880 - id="logging" 881 - properties="logger,level,actions" 882 - source="liveTable" 883 - sourceParameters="resultPage=XWiki.LoggingAdminTableJson&translationPrefix=logging.admin.livetable." 884 -}}{ 885 - "meta": { 886 - "propertyDescriptors": [ 887 - { 888 - "id": "actions", 889 - "displayer": "html", 890 - "sortable": false, 891 - "filterable": false 892 - } 893 - ] 894 - } 895 -}{{/liveData}} 896 -{{/code}} 897 - 898 - 899 899 == JavaScript == 900 900 113 +See [[Live Data JavaScript API>>xwiki:documentation.xs.dev.livedata.javascript-api.WebHome]]. 114 + 901 901 === JavaScript API === 902 902 903 -{{version since="14.4RC1"}} 904 -Live Data provides a JavaScript API that is accessible on the container of the instance via the jQuery data-property ##liveData## (e.g., ##jQuery("#wikis").data("liveData")##) and in [[Live Data events>>xwiki:Documentation.DevGuide.FrontendResources.JavaScriptAPI.WebHome||anchor="HLiveDataevents28Logic.js29"]]. 117 +See [[Live Data JavaScript API>>xwiki:documentation.xs.dev.livedata.javascript-api.WebHome]]. 905 905 906 906 ==== getLayoutIds ==== 907 907 908 - Returns thelistofavailablelayoutsids.121 +See [[Live Data JavaScript API>>xwiki:documentation.xs.dev.livedata.javascript-api.WebHome]]. 909 909 910 -Example: 911 - 912 -{{code language="javascript"}} 913 -jQuery("#myld").data("liveData").getLayoutIds(); 914 -{{/code}} 915 - 916 916 ==== getPropertyDescriptors ==== 917 917 918 - Get thelistof propertydescriptors.125 +See [[Live Data JavaScript API>>xwiki:documentation.xs.dev.livedata.javascript-api.WebHome]]. 919 919 920 -Example: 921 - 922 -{{code language="javascript"}} 923 -jQuery("#myld").data("liveData").getPropertyDescriptors(); 924 -{{/code}} 925 - 926 926 ==== updateEntries ==== 927 927 928 - Reload the Live Data accordingtoitscurrentfilters andsortconfiguration.129 +See [[Live Data JavaScript API>>xwiki:documentation.xs.dev.livedata.javascript-api.WebHome]]. 929 929 930 -Example: 931 - 932 -{{code language="javascript"}} 933 -jQuery("#myld").data("liveData").updateEntries(); 934 -{{/code}} 935 - 936 936 === Adding a Panel === 937 937 938 - It is possibletoextendLive Databy adding new panelsthat canbe toggled viathemenu viathe ##registerPanel## method, thefollowing demonstratesa simple "HelloWorld"-panel:133 +See [[Live Data Extension Points>>xwiki:documentation.xs.dev.livedata.extension-points.WebHome]]. 939 939 940 -{{code language="js"}} 941 -document.addEventListener('xwiki:livedata:instanceCreated', function(e) { 942 - const panel = { 943 - id: 'myExtension', 944 - name: 'My Extension', 945 - title: 'Hello World', 946 - icon: 'camera', 947 - container: document.createElement('div'), 948 - component: 'LiveDataAdvancedPanelExtension', 949 - order: 4000 950 - }; 951 - 952 - panel.container.textContent = 'Hello World!'; 953 - 954 - e.detail.livedata.registerPanel(panel); 955 -}); 956 -{{/code}} 957 - 958 -The id must be unique among all panels, the name is the text that is displayed in the menu, the title the text that is displayed in the title of the panel. The icon is displayed in the menu and the panel's title. The order is the display order for the panels, the default properties, sort and filter panels have order 1000, 2000 and 3000. The ##container## must be a DOM node, it is automatically attached to the panel's body when it is not collapsed, when the panel is collapsed the ##container## will be detached. The component should be ##LiveDataAdvancedPanelExtension## for the supported API but in theory could be any Vue component. Note, however, that while Live Data is currently based on Vue 2 it will be upgraded to Vue 3 at some point which might break custom components, the component's API isn't considered stable. All properties of the panel must be present when it is registered but, apart from the order, they can be changed later, changes will be reflected in the UI. This could be used, e.g., to add and update a counter in the name or title. 959 -{{/version}} 960 - 961 961 == Async Actions == 962 962 963 -{{version since="16.2.0RC1"}} 964 -Is it possible to define an action as asynchronous. In this case, instead of following the link, the action will be performed in the background. The Live Data is refreshed once the asynchronous action is successful. 137 +See [[Live Data Configuration>>xwiki:documentation.xs.dev.livedata.configuration.WebHome]]. 965 965 966 966 === Parameters === 967 967 968 - Theparametersareto beaddedto the ##async##keyoftheaction, located inthe ##meta.actions## array.TheURL is the one resolvedthrough the ##urlProperty## of theaction.141 +See [[Live Data Configuration>>xwiki:documentation.xs.dev.livedata.configuration.WebHome]]. 969 969 970 -* ##httpMethod##: the HTTP method to use to call the action URL 971 -* ##loadingMessage##: the localized message to display while the action is running asynchronously 972 -* ##successMessage##: the localized message to display once the action finished successfully 973 -* ##failureMessage##: the localized message to display once the action finished unsuccessfully 974 -* ##body##: (optional) a value to use in the request body 975 -* ##headers## (optional) a map of headers to use for the request 976 - 977 977 === Example === 978 978 979 -{{code language="none"}} 980 -{{liveData 981 - id="test" 982 - properties="name,_actions" 983 - source="liveTable" sourceParameters="className=Space.MyClass" 984 -}}{ 985 - "meta": { 986 - "actions": [{ 987 - "id": "delete", 988 - "async": { 989 - "httpMethod": "POST", 990 - "loadingMessage": "Loading", 991 - "successMessage": "Delete Success", 992 - "failureMessage": "Failed", 993 - "body": "newBacklinkTarget=&updateLinks=false&autoRedirect=false&form_token=${services.csrf.token}&confirm=1&async=true", 994 - "headers": { 995 - "Content-Type": "application/x-www-form-urlencoded" 996 - } 997 - } 998 - }] 999 - } 1000 -} 1001 -{{/liveData}} 1002 -{{/code}} 1003 -{{/version}} 145 +See [[Live Data Configuration>>xwiki:documentation.xs.dev.livedata.configuration.WebHome]]. 1004 1004 1005 1005 == Colored icons == 1006 1006 1007 -{{version since="16.3.0RC1"}} 1008 -Is is possible to add additional classes on icons (in addition to the one possible introduced by the icon sets) by adding the ##extraIconClasses## property on icon descriptors. 149 +See [[Live Data Configuration>>xwiki:documentation.xs.dev.livedata.configuration.WebHome]]. 1009 1009 1010 -On the example below, we add the ##tex-danger## class on the ##delete## action, making the delete action icon displayed in the danger color (i.e., red by default). 1011 -{{code language="none"}}{"id": "delete", "icon": "cross", "extraIconClasses": "text-danger"}{{/code}} 1012 -{{/version}} 1013 - 1014 1014 == Html Structure == 1015 1015 1016 - This section lists interestingattributesthat are usefultoperformpreciser selection of LiveDataelements while stayingagnosticofagiven layout.153 +See [[Live Data JavaScript API>>xwiki:documentation.xs.dev.livedata.javascript-api.WebHome]]. 1017 1017 1018 -* {{version since="16.2.0RC1"}}##data-livedata-property-id## attribute added on all property displayers. Contains the ID of the displayer.{{/version}} 1019 -* {{version since="15.10.1"}}##data-livedata-entry-index## attribute added to the root element of an entry. Contains the index of the displayed entry for the current pagination.{{/version}} 1020 -* {{version since="15.10.1"}}##data-livedata-entry-id# attribute added to the root element of an entry. Contains the value of the identifier of the displayed entry.{{/version}} 1021 - 1022 1022 == Vue Components Loading == 1023 1023 1024 -{{version since="17.4.0RC1"}} 1025 -Globally loading components with {{code language="javascript"}}Vue.component('ComponentName', Component);{{/code}} is not possible anymore with Vue 3. 157 +See [[Live Data Extension Points>>xwiki:documentation.xs.dev.livedata.extension-points.WebHome]]. 1026 1026 1027 -A component store is now provided by Live Data, allowing for the registration of new displayers. 1028 - 1029 -##componentsStore.register(string, string, () => Promise<VueComponent>)## 1030 - 1031 -* **kind: string**: any of ##filter##, ##layout##, or ##displayer##, defines the type of loaded component 1032 -* **name: string**: the name of the registered component 1033 -* **loader: () => Promise<VueComponent>**: a function returning a ##VueComponent## wrapped in a promise. This allows for the lazy loading of components, only when effectively loaded (see ##load## below= 1034 - 1035 -##componentsStore.load(string, string): Promise<VueComponent>## 1036 - 1037 -* **kind: string**: the kind of component to load 1038 -* **name: string**: the name of the component to load 1039 -* **returns**: a Promise with the resolved components if found, ##undefined## otherwise 1040 - 1041 -**Example:** 1042 - 1043 -{{code language="javascript"}} 1044 -import { componentStore } from "xwiki-livedata"; 1045 - 1046 -// Dynamically register a new "toggle" displayer component. 1047 -componentStore.register("displayer", "toggle", async () => { 1048 - return (await import("./components/DisplayerToggle.vue")).default; 1049 -}); 1050 -{{/code}} 1051 -{{/version}} 1052 - 1053 1053 == LiveTable New Row Naming Strategy == 1054 1054 1055 -{{version since="18.7.0RC1"}} 1056 -For the live table source, new row creation requires a page naming strategy. For that, there is a specific interface: 161 +See [[Live Data Extension Points>>xwiki:documentation.xs.dev.livedata.extension-points.WebHome]]. 1057 1057 1058 -{{code language="java"}} 1059 -/** 1060 - * Strategy to generate the document reference of a new livetable entry. 1061 - * 1062 - * @since 18.7.0RC1 1063 - */ 1064 -@Role 1065 -@Unstable 1066 -public interface LiveTableNewRowNamingStrategy 1067 -{ 1068 - /** 1069 - * Generates a document reference for a new livetable entry. 1070 - * 1071 - * @param parameters the livedata source parameters 1072 - * @return the generated document reference 1073 - * @throws LiveDataException if the reference cannot be generated 1074 - * @throws XWikiException if there is a wiki-level error 1075 - */ 1076 - DocumentReference generate(Map<String, Object> parameters) throws LiveDataException, XWikiException; 1077 - 1078 - /** 1079 - * Checks if the current user is allowed to create a new entry based on the provided source parameters. 1080 - * 1081 - * @param parameters the live data source parameters 1082 - * @return whether the current user is allowed to create a new entry with this strategy 1083 - */ 1084 - boolean isCreationAllowed(Map<String, Object> parameters); 1085 -} 1086 -{{/code}} 1087 - 1088 -New strategies can be added by creating new named components implementing this interface, and using their name in a Live Data's ##newRowNamingStrategy## [[source parameter>>||anchor="HParameters-1"]]. 1089 -{{/version}} 1090 - 1091 1091 = Troubleshooting = 1092 1092 165 +See [[Debug the SQL Query of a Live Data>>xwiki:documentation.xs.dev.livedata.sql-query-debugging.WebHome]]. 166 + 1093 1093 == Live Table Source == 1094 1094 1095 -The live table results page used by the ##liveTable## data source supports the ##sql## request parameter that can be used to include in the JSON response the SQL performed on the database and its parameters. This can be useful when debugging problems with the [[Live Table Macro>>Extension.Livetable Macro]], but unfortunately, it can't be used (directly) to debug Live Data problems. You can obtain the same information though from a Live Data instance that uses the ##liveTable## source, with a bit of tweaking: 1096 - 1097 -* First, obtain the URL used to fetch the live data entries, by inspecting the web page and looking at the Network tab from the browser's developer tools. Filter for ##/entries## 1098 -* Open the URL in a new browser tab and add this to the query string: ##&sourceParams.sql=1## 1099 -* Then edit ##XWiki.LiveTableResultsMacros## and look for ##request.sql## 1100 -* Add these two lines:((( 1101 -{{code language="none"}} 1102 -#set ($discard = $services.logging.getLogger('XWiki.LiveTableResultsMacros').debug("SQL: $sql")) 1103 -#set ($discard = $services.logging.getLogger('XWiki.LiveTableResultsMacros').debug("SQL parameters: $sqlParams")) 1104 -{{/code}} 1105 -))) 1106 -* Reload the live data entries URL and then go to the Logging administration section. Search for the "LiveTableResultsMacros" logger and set debug level. 1107 -* Reload again the live data entries URL. The server logs should contain something like this:((( 1108 -{{code langauge="none"}} 1109 -DEBUG X.LiveTableResultsMacros - SQL: where 1=1 order by lower(doc.fullName) asc, doc.fullName asc 1110 -DEBUG X.LiveTableResultsMacros - SQL parameters: {} 1111 -{{/code}} 1112 -))) 169 +See [[Debug the SQL Query of a Live Data>>xwiki:documentation.xs.dev.livedata.sql-query-debugging.WebHome]]. - Website
-
... ... @@ -1,0 +1,1 @@ 1 +https://www.xwiki.org/xwiki/bin/view/DocApp/Code/ExtensionLD?id=xwiki:org.xwiki.platform:xwiki-platform-livedata-macro&name=%22Live%20Data%20Macro%22