xyz
xyz copied to clipboard
infoj_order mode
The infoj method has a second infoj_order argument. This argument can be an array of keys and entry objects.
layer.infoj entries will be filtered in the order of keys. It is checked whether the key matches the entry's key, field, query, or group key value.
The key
key value is specifically used as an identifier for entries and serves no other purpose.
The infoj_order argument can be a mix of entry objects and keys. Entry object are directly spliced into the infoj array and don't require to be in the layer.infoj array.
The infoj_order can be defined as an array in the layer json. The infoj_order plugin will be retired in favour of this.
- To see the specific tasks where the Asana app for GitHub is being used, see below:
- https://app.asana.com/0/0/1207275671216623
when including a dataview object in the order I see the following error:
infoj.mjs:130 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'layer')
at line 130 in infoj.mjs: entry.location.layer.queryparams || {}
Entry in the order array doesn't inherit properties when they are referenced.
@KieronFerrey group won't work since the values are not unique. tyoe won't work neither for the same reason. we need to remove the group key since sorting requires a unique identifier.
I just pushed a commit to this PR after chatting to @RobAndrewHurst.
This PR simply console warns the developer if a value provided in infoj_order
array does not exist in the location.infoj
.
This is required to ensure that the developer added a unique identifier to plugin entries or other entries that may not be unique.
I have removed group from the infoj_order lookup since this is by definition not unique.
I just pushed a check on the mapview and locale - as is custom views called entries may not have a locale
// Assign queryparams from layer, and locale.
entry.queryparams = Object.assign(
entry.queryparams || {},
entry.location.layer.queryparams || {},
entry.location.layer?.mapview?.locale?.queryparams || {})
Quality Gate passed
Issues
0 New issues
0 Accepted issues
Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code
@simon-leech Can you test whether this works using the spread operator?
Aren't the locale queryparams already assigned to the layer somewhere else?
@dbauszus-glx Yeah all seems to be working for me :)
https://github.com/GEOLYTIX/xyz/wiki/Workspace-Configuration#infoj_order