Description
New Feature / Enhancement Checklist
- I am not disclosing a vulnerability.
- I am not just asking a question.
- I have searched through existing issues.
Current Limitation
The info panel added in #2495 displays data based on the row selected in the data browser. It's not possible to display only a subset of information. This has the disadvantage that the called Cloud Function needs to process and return all data, even if only a subset is needed.
Feature / Enhancement Description
Add a new info panel element that allows to load subsets of data on-demand. An element that is initially collapsed and can be expanded on click. When expanded, it loads the subset of data. That allows to remove unnecessary workload on the server if that subset of data is not needed, and only load the data if needed.
- This should allow to nest subsets of data that can be loaded on demand. The Cloud Code function response of the subset can contain another subset element that allows to load another Cloud Code function on demand.
- A loading indicator should be displayed then the user clicks to expand the subset while its data is loading.
- Each subset requires a refresh button to reload the data.
Example Use Case
- A click on an object in
_User
shows the info panel with:- The number of purchases a user has made.
- A collapsed element "Purchase History".
- The user expands the "Purchase History" subset to load the purchase history on demand.
Dashboard options:
"apps": [
{
"infoPanel": [
{
"title": "User Details",
"classes": ["_User"],
"cloudCodeFunction": "getUserDetails",
}
]
}
]
The response of the Cloud Function:
{
"panel": {
"segments": [
{
"title": "User Details",
"items": [
{
"type": "keyValue",
"key": "Number of purchases",
"value": "3"
},
{
// A nested, expandable sub-panel that loads data on-demand
"type": "panel",
"title": "Purchase History",
"cloudCodeFunction": "getUserPurchaseHistory"
}
]
}
]
}
}
When expanding the sub-panel "Purchase History" the Cloud Code function getUserPurchaseHistory
returns:
{
"panel": {
"segments": [
{
"title": "Purchase History",
"items": [
{
"type": "keyValue",
"key": "Purchase #1 value",
"value": "1 USD"
},
{
"type": "keyValue",
"key": "Purchase #2 value",
"value": "2 USD"
},
{
"type": "keyValue",
"key": "Purchase #3 value",
"value": "3 USD"
}
]
}
]
}
}
Visually, nested data should be displayed indented to indicate the hierarchy of the data. This is especially important in case of deeper nesting, where subsets are nested within subsets.
Returning the subset also in form of a panel
payload has several benefits:
- modular use; same response can be used as main-panel or sub-panel
- no introduction of new payload syntax
- panel syntax allows to add metadata on the root level for future features, compared to a response of only segments or elements
Alternatives / Workarounds
Load all data which consumes resources unnecessarily if subsets of data are not needed.