xyz icon indicating copy to clipboard operation
xyz copied to clipboard

infoj_order mode

Open dbauszus-glx opened this issue 9 months ago • 1 comments

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

dbauszus-glx avatar May 10 '24 13:05 dbauszus-glx

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.

cityremade avatar May 13 '24 10:05 cityremade

@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.

dbauszus-glx avatar May 13 '24 11:05 dbauszus-glx

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.

simon-leech avatar May 13 '24 13:05 simon-leech

I have removed group from the infoj_order lookup since this is by definition not unique.

dbauszus-glx avatar May 13 '24 15:05 dbauszus-glx

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 || {})

simon-leech avatar May 13 '24 15:05 simon-leech

@simon-leech Can you test whether this works using the spread operator?

image

Aren't the locale queryparams already assigned to the layer somewhere else?

dbauszus-glx avatar May 13 '24 15:05 dbauszus-glx

@dbauszus-glx Yeah all seems to be working for me :)

simon-leech avatar May 13 '24 15:05 simon-leech

https://github.com/GEOLYTIX/xyz/wiki/Workspace-Configuration#infoj_order

dbauszus-glx avatar May 14 '24 10:05 dbauszus-glx