wmbeers / cmv-app

CMV - The Configurable Map Viewer - A community supported open source mapping framework built with the Esri JavaScript API and the Dojo Toolkit
https://demo.cmv.io/
MIT License
1 stars 2 forks source link

Metadata links need to take ArcGIS Server folder structure into account #40

Closed wmbeers closed 4 years ago

wmbeers commented 4 years ago

https://repo.fla-etat.org/bugzilla/show_bug.cgi?id=5730

The current method for getting the layer name for a given layer within a service assumes the map service's list of layers will contain the same list of references to layers within the service as we have in t_rest_services_mxd.

The way the LayerControl widget (core CMV) works is it only interrogates ArcGIS Server to get the info it needs to render the control in the widget, and it knows nothing about the rest of our internal configuration (info from t_rest_services_mxd, etc.) We have code in the viewMetadata method that gets the layerName by just using the id (really the index) from the LayerControl widget to as an index into our array. That works fine without folders, because the ids from AGS and indexes in our table are the same. But when you add folders in the mix, the ids from AGS no longer match up with the index from our table.

Two ways come to mind to fix this:

  1. Filter the layers coming from AGS to exclude folders (not entirely throughout the application, just in this one function, find the index of the layer in the filtered list (ignoring that first id entirely), and use that index to find the layerName from our table. This is simpler, but I'm concerned that there might be some other quirk of AGS that might trip us up.
  2. We do track the layer indexes in t_rest_services_mxd. If we include that in the generated layerLoader.js config file, we can use AGS id (first column) to find the record. More complicated because it's a change to the map and the LLC, but (assuming our database is up to date), but it reduces the (small) chance the first method will get tripped up by some AGS quirk.
wmbeers commented 4 years ago

Fixes will be in https://github.com/wmbeers/cmv-app/tree/Metadata-Fix-Issue-40 branch.

wmbeers commented 4 years ago

Took some doing to merge to stage and sort out why it wasn't initially working. Changes made for #29 were causing metadata menu item to not show up. I fixed those (under the branch for #29) and merged to Stage. Both issues are now on Stage for testing.