Skip to main content
Version: Next

Embedding Contract

This page lists everything a host application relies on when it embeds the Statistics Explorer or the Statistics Loader. It describes the current behavior and is pinned by the JS tests in assets/js (run them with the test script of package.json). Changes to anything listed here are backwards compatibility breaks.

Endpoints​

All endpoints are served by the bundle's StatisticsController under /<PREFIX>/{context}/.... {context} matches \w+ and selects the user provider and data sources. Parameters are query parameters unless noted. Errors are answered as {"success": false, "message": "..."} with status 500 (404 for a missing configuration). Contexts without a user provider are answered with access denied by data-sources, field-collection, field-settings and data; the other endpoints do not check it themselves.

EndpointUsed byParametersResponse
/{context}/data-sourcesexplorer–success, dataSources, otherUsers (users and roles configurations can be shared with)
/{context}/field-collectionexplorerdataSourcesuccess, fields, operators
/{context}/field-settingsexplorerdataSource, statisticMode, rows (JSON), columns (JSON)fieldSettings
/{context}/dataexplorer, loaderdataSource, statisticMode (default statistic), rows (comma separated), columns (comma separated), filters (JSON), fieldSettings (JSON), locale, configurationId, chartData (boolean)HTML table (statistic or list template), or with chartData=1 JSON columnHeaders and data
/{context}/load-configuration-listexplorer–options: groups of {label, options: [{label, value}]}
/{context}/save-configurationexplorerform fields: configId (empty for new), name, configuration (JSON string, see below), sharedUsers, sharedRoles (comma separated)success, configurationId, ownerShip
/{context}/loadexplorer, loaderconfigurationIdname, configurationId, configuration (JSON string), shares, ownerShip
/{context}/deleteexplorerconfigurationIdsuccess
/{context}/translationsexplorer, loaderlocalemap of statistics_container.* keys to translations of locale when it is a valid language, else of the request locale; trailing line feeds trimmed

statisticsExplorerConfig​

A global window.statisticsExplorerConfig object holding one URL per endpoint. A missing or empty required key is reported with console.error (the explorer also shows a toast) and nothing is mounted. Other keys are ignored.

KeyEndpointExplorerLoader
dataSourceListUrldata-sourcesrequired–
fieldsListUrlfield-collectionrequired–
resultDataUrldatarequiredrequired
loadFieldSettingsUrlfield-settingsrequired–
loadConfigurationListUrlload-configuration-listrequired–
saveConfigurationUrlsave-configurationrequired–
loadConfigurationUrlloadrequiredrequired
deleteConfigurationUrldeleterequired–
translationsUrltranslationsrequiredrequired
locale–optionaloptional

locale is the language the new build (assets/explorer) asks translations in; without it the page's <html lang>, without that none (the request locale).

DOM hooks​

  • #statistics-explorer: the node the explorer entry renders into (looked up once, when the script runs).
  • .statistics-container: every element with this class gets a loader from the loader entry.
  • data-config-id: on a .statistics-container, the id of the saved configuration to show, e.g. global_global1.

Webpack Encore entries: explorer and loader of the pimcoreStatisticsExplorer build.

The new build (assets/explorer) has the same two entries and keeps the hooks above. It ships in the bundle as /bundles/pimcorestatisticsexplorer/explorer with one style sheet and one script per entry: static/css/<entry>.css and static/js/<entry>.js (no content hash; the asset version handles caching). Lazy chunks load from beside the script on their own.

Saved configuration JSON​

save-configuration stores and load returns a JSON string with these fields. Rows and columns are saved without the id the list widget adds for sorting.

FieldTypeMeaning
showTablebooleanshow the result table
showChartbooleanshow the chart
chartTypenull, "Line", "Bar", "Area" or "Pie"chart kind
selectedDataSource{label, value}the data source
statisticMode"statistic" or "list"statistic mode
rowsarray of {label, value}row fields
columnsarray of {label, value}column fields
filtersarrayfilter definitions
fieldSettingsobject, field name to settingsper field settings

The explorer applies all nine fields when loading, the loader passes them unchanged to the result view.