diff --git a/CHANGELOG.md b/CHANGELOG.md index 1f1b0ed001204cb31f8f836f475c5c63bf426c10..cf321619c1e385e861796d3c314d59a9921eb2e1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 A list of entity roles and names can be specified via the newly added `BUILD_FREE_SEARCH_ROLE_NAME_FACET_OPTIONS` build variable. See the docstring of `queryForm.initFreeSearch` for more information. +* [#189](https://gitlab.com/caosdb/caosdb-webui/-/issues/189) The order in which + the properties of (Records of) a RecordType are displayed can be configured. ### Changed (for changes in existing functionality) diff --git a/src/doc/extension/display_of_properties.rst b/src/doc/extension/display_of_properties.rst index b5fdfe30198cf5042be6ca940fdcf67220d834d9..591ce9b2a07f84eb20fe12a2128f47858103e266 100644 --- a/src/doc/extension/display_of_properties.rst +++ b/src/doc/extension/display_of_properties.rst @@ -77,10 +77,66 @@ the ``price`` of all ``MusicalInstruments`` from ``anonymous`` and their } } +Defining the order of properties +******************************** + +Similar to above, the order in which properties are displayed can also be +specified. Again, the build variable ``BUILD_MODULE_EXT_PROPERTY_DISPLAY`` has +to be enabled. Then, the order in which the properties are displayed can be +configured in the same configuration file as above, i.e., in +``conf/ext/json/ext_prop_display.json``: + +.. code-block:: json + + { + "RecordTypeName": { + "order": ["ordered", "list", "of", "properties"] + }, + ... + } + +This ensures that the properties of all entities with the declared types are +displayed in the defined order if present. Additional properties, that are not +part of this list are appended in their original order as returned from the CaosDB +server. + +Using again the data of demo.indiscale.com for an example, a configuration might +look the following: + +.. code-block:: json + + { + "MusicalInstrument": { + "order": ["price", "Manufacturer"] + } + } + +In all ``MusicalInstrument`` entities, the ``price`` would then be shown first, +then the ``Manufacturer``, and then all remaining properties. If it doesn't have +a ``price`` property, ``Manufacturer`` is shown on top. + +Of course, this feature can be combined with the hiding of properties: + +.. code-block:: json + + { + "MusicalInstrument": { + "hide": [ + {"name": "price", "roles": ["anonymous"], "users": []}, + {"name": "Manufacturer", "roles": [], "users": ["admin"]} + ], + "order": ["price", "Manufacturer"] + } + } + + +In this example, ``price`` would still be displayed on top of the list of +property in every ``MusicalInstrument`` entity, but it is hidden for the +``anonymous`` role. + Future ****** -In the future, this feature will be extended to allow the RecordType-wise -`sorting <https://gitlab.com/caosdb/caosdb-webui/-/issues/189>`__ of properties -and to `toggle <https://gitlab.com/caosdb/caosdb-webui/-/issues/190>`__ -properties. +In the future, this feature will be extended to allow to `toggle +<https://gitlab.com/caosdb/caosdb-webui/-/issues/190>`__ properties of +predifined RecordTypes.