Conversation
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
support and replace data_manager's get_portal_catalog_map view
Supporting GeoPortal catalog assists in Layer admin form
|
|
||
| # This property gets an array of all of the Layer records that are direct children of this Theme | ||
| # This is particularly used by the 'get_portal_catalog_map' view to identify 'visualizable' layers | ||
| # in the catalog. |
There was a problem hiding this comment.
Love the comments. Would it be helpful to have these as doc strings for the properties so that they are visible in vscode?
|
|
||
| return JsonResponse(data) | ||
|
|
||
| # This allows the catalog page to link to 'visualize' layers, which requires knowing the layerID that corresponds to a |
| # given catalog record. Only layers with a catalog_name field will be included in this mapping. | ||
| def get_portal_catalog_map(request): | ||
| data = {} | ||
| if settings.CATALOG_TECHNOLOGY == "GeoPortal2": |
There was a problem hiding this comment.
Not sure how we feel about constants in this codebase, but if GeoPortal2 is used elsewhere it might be nice to make that a constant.
| layers = self.layers | ||
| for child_order in child_theme_orders: | ||
| if child_order.content_object.is_visible: | ||
| layers = layers + child_order.content_object.all_layers |
There was a problem hiding this comment.
likely a python noob question: Why did you use + here and not append?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces new functionality for mapping catalog records to visualizable layers, along with improvements to the
Thememodel, integrating Layer admin forms with a paired GeoPortal catalog instance, and test coverage. It adds two new properties to theThememodel for retrieving direct and all descendant layers, implements a new view and endpoint for catalog-to-layer mapping, and provides comprehensive tests for these features. Additionally, it includes minor JavaScript and CSS tweaks and some cleanup in template scripts.New functionality for catalog mapping and Theme model:
layersandall_layersproperties to theThememodel to retrieve direct and all descendant visible layers, respectively. These are used to identify "visualizable" layers for the catalog.get_portal_catalog_mapview and corresponding endpoint/get_portal_catalog_map, which returns a mapping from catalog record names to layer primary keys for visible layers under top-level themes. [1] [2]Testing improvements:
Theme.layers,Theme.all_layersproperties, and theget_portal_catalog_mapview, covering edge cases and visibility rules.JavaScript and CSS adjustments:
unionfunction and error logging for AJAX failures. [1] [2]Template cleanup: