Skip to content
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

fix(config): fixed bug with config validation #2635

Conversation

DamonU2
Copy link
Member

@DamonU2 DamonU2 commented Dec 5, 2024

Closes #2632

Description

Config validation was assuming values for zoomAndCenter in config, this is no longer assumed. Also removed mapId value from createMapConfigFromMapState to better line up with what is expected in reload.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

https://damonu2.github.io/geoview/sandbox.html
With:
{
"mapId": "mapWM",
"map": {
"basemapOptions": {
"basemapId": "transport",
"shaded": true,
"labeled": true
},
"interaction": "dynamic",
"listOfGeoviewLayerConfig": [],
"highlightColor": "black",
"overlayObjects": { "pointMarkers": {} },
"viewSettings": {
"initialView": { "extent": [ -63.17068832713632, 47.54397873973516, -47.11323060823711, 48.06148308033754 ] },
"enableRotation": true,
"rotation": 0,
"minZoom": 0,
"maxZoom": 50,
"maxExtent": [ -135, 25, -50, 89 ],
"projection": 3978
}
},
"theme": "GEO.ca Language Selection - GEO.CA ",
"navBar": [ "zoom", "fullscreen", "home", "basemap-select" ],
"footerBar": {
"tabs": {
"core": [ "legend", "layers", "details", "data-table" ],
"custom": []
},
"collapsed": false,
"selectedTab": "legend"
},
"appBar": {
"tabs": { "core": [ "geolocator" ] },
"selectedTab": "",
"collapsed": false
},
"overviewMap": { "hideOnZoom": 0 },
"components": [ "north-arrow", "overview-map" ],
"corePackages": [],
"externalPackages": [],
"serviceUrls": {
"geocoreUrl": "https://geocore.api.geo.ca/",
"geolocator": "https://geolocator.api.geo.ca?keys=geonames,nominatim,locate",
"proxyUrl": "https://maps.canada.ca/wmsproxy/ws/wmsproxy/executeFromProxy"
},
"schemaVersionUsed": "1.0"
}

Checklist:

  • I have build (rush build) and deploy (rush host) my PR
  • I have connected the issues(s) to this PR
  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings
  • I have created new issue(s) related to the outcome of this PR is needed
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

This change is Reviewable

@DamonU2 DamonU2 requested a review from jolevesq December 5, 2024 18:22
@DamonU2 DamonU2 self-assigned this Dec 5, 2024
Copy link
Member

@jolevesq jolevesq left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 5 of 6 files at r1, all commit messages.
Reviewable status: 5 of 6 files reviewed, 2 unresolved discussions (waiting on @DamonU2)


packages/geoview-core/src/api/config/types/classes/map-feature-config.ts line 216 at r1 (raw file):

        : CV_DEFAULT_MAP_FEATURE_CONFIG.map.viewSettings.projection;

    // TODO: add validation for extent and layerIds

Is it something we can do quick as part of this PR?


packages/geoview-core/src/api/config/types/map-schema-types.ts line 63 at r1 (raw file):

  | 'data-table'
  | 'layers'
  | '';

We can put empty string or it is for when the array is empty?

Copy link
Member Author

@DamonU2 DamonU2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 5 of 6 files reviewed, 2 unresolved discussions (waiting on @jolevesq)


packages/geoview-core/src/api/config/types/map-schema-types.ts line 63 at r1 (raw file):

Previously, jolevesq (Johann Levesque) wrote…

We can put empty string or it is for when the array is empty?

With enum, the array cannot be empty. It's basically just to simplify creating the config from state

Copy link
Member

@jolevesq jolevesq left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 1 of 6 files at r1.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @DamonU2)

Copy link
Member

@jolevesq jolevesq left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 1 of 6 files at r1.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @DamonU2)

Copy link
Member

@jolevesq jolevesq left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @DamonU2)

Copy link
Member

@jolevesq jolevesq left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @DamonU2)

@jolevesq jolevesq merged commit 2c33a79 into Canadian-Geospatial-Platform:develop Dec 5, 2024
6 checks passed
@DamonU2 DamonU2 deleted the 2632-config-extent-bug branch December 9, 2024 15:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] Zoom to Extent from Config Failed - JIRA 1852
2 participants