-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Layer dataviews target #1781
base: minor
Are you sure you want to change the base?
Layer dataviews target #1781
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This section in the location/entries/dataview.mjs
is wrong.
An entry does not (ever) have a class. So entry.class
is undefined, resulting in a class for the entry of location undefined
. Instead I think this should use entry.query or entry.key as the class name?
// Dataview will be rendered into location view.
entry.locationViewTarget = mapp.utils.html.node`
<div class="${`location ${entry.class}`}">`
@simon-leech I am ok for you to ammend this PR. Is the location class even needed for the dataview target element? It should be assumed from the element being positioned inside the location view grid. Can you also review this item? I didn't want to add this to the layer dataview logic as I don't think this is ever used. I believe this to be some legacy logic from ancient 'report' application views. I believe in modern view scripts the dataview is created by calling the dataview method directly rather than calling the infoj method. // Dataview will be rendered into target identified by ID.
if (typeof entry.target === 'string' && document.getElementById(entry.target)) {
// Assign element by ID as target.
entry.target = document.getElementById(entry.target)
// Create and update the dataview.
if (mapp.ui.Dataview(entry) instanceof Error) return;
entry.update()
return;
} |
I have addressed this in this PR #1786 - as part of a patch, which will subsequently be merged into this PR once approved. |
On the second part of this example - we actually do still use this sometimes. You are right it came from legacy but I think we should still support it or it will mean re-writes to all 'report' application views when upgrading? {
"skipEntry": true,
"label": "Demographics",
"type": "dataview",
"target": "demographic-details",
"query": "report_demogs",
"table": {
"placeholder": "No Demographics",
"layout": "fitColumns",
"columns": [
{
"title": "Field",
"field": "field",
"headerSort": false,
"resizable": false
},
{
"title": "Value",
"field": "value",
"headerSort": false,
"resizable": false
},
{
"title": "Field",
"field": "field2",
"headerSort": false,
"resizable": false
},
{
"title": "Value",
"field": "value2",
"headerSort": false,
"resizable": false
}
]
}
} // Create tableviews that are stored on the report layer
location.infoj
.filter((entry) =>
new Set([
"demographic-details",
]).has(entry.target)
)
.forEach((entry) =>
mapp.ui.Dataview(entry).then((table) => table.update())
); |
I put this into draft until we merge the other dataview PR as i think they'll be merge conflicts to resolve. |
️✅ There are no secrets present in this pull request anymore.If these secrets were true positive and are still valid, we highly recommend you to revoke them. 🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request. |
The show/hide methods in the dataview layer panel are only required for dataviews in tabviews. For dataviews in the layer panel itself the default dataview methods assigned by the dataview ui module should work as expected. |
36ccef6
to
607d1b8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am all happy with this!
Quality Gate passedIssues Measures |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Working as expected.
Layer dataviews should behave similar to location dataviews. It should be possible to create dataviews in the layer view dataviews panel without the need for a tabview.
The forEach iteration of dataview object entries wasn't very elegant.
The method will now use a for of loop of the dataview object entries.
The chkbox element generated by the mapp.ui.Dataview() method will be added to the contents array for the dataview drawer.
The for loop will continue if the tabview has been identified on a mobile.
The dataview.target will be added to the content array if no target is defined in the dataview entry. This is the same behaviour used for location view dataviews.
It should be possible in the future to add the content from any panel method without the drawer element to the layer view. #1719