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

Get config from url #2091

Merged

Conversation

ychoquet
Copy link
Contributor

@ychoquet ychoquet commented May 6, 2024

Description

Add the getConfigFromUrl to the new ConfigApi. The new method accepts a string like :
p=3857&z=4&c=-100,40&l=en&t=dark&b={basemapId:transport,shaded:false,labeled:true}&i=dynamic&cc=overview-map&keys=12acd145-626a-49eb-b850-0a59c9bc7506,ccc75c12-5acc-4a6a-959f-ef6f621147b9
and create a new MapFeatureConfig

Fixes #2090

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?

Using Chrome Devtools.

Deploy URL: https://ychoquet.github.io/GeoView/

Checklist:

  • x ] 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

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 10 of 12 files at r1, all commit messages.
Reviewable status: 10 of 12 files reviewed, 4 unresolved discussions (waiting on @ychoquet)


packages/geoview-core/public/templates/config-sandbox.html line 198 at r1 (raw file):

        // get config and test if JSON is valid
        // const mapConfig = cgpv.api.configApi.getMapConfig(configArea.value, langue);
        const returnedValue = cgpv.api.configApi.getConfigFromUrl('p=3857&z=4&c=-100,40&l=en&t=dark&b={basemapId:transport,shaded:false,labeled:true}&i=dynamic&cc=overview-map&keys=12acd145-626a-49eb-b850-0a59c9bc7506,ccc75c12-5acc-4a6a-959f-ef6f621147b9');

This can be remove, we already have a page (default-config who will implement this demo.

Or keep the old way and build a new section to generate the config from url text box


packages/geoview-core/src/api/config/config-api.ts line 22 at r1 (raw file):

   * @static @private
   */
  static #getMapPropsFromUrlParams(urlParams: string): TypeJsonObject {

The viewer will pass the split values to the config


packages/geoview-core/src/api/config/config-api.ts line 167 at r1 (raw file):

  /**
   * @static

remove this param, you added it below


packages/geoview-core/src/api/config/types/config-constants.ts line 165 at r1 (raw file):

  components: ['north-arrow', 'overview-map'],
  appBar: { tabs: { core: ['geolocator'] } } as TypeAppBarProps,
  footerBar: {} as TypeFooterBarProps,

Why have you removed it? I fix my code to use it

Copy link
Contributor Author

@ychoquet ychoquet 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: 10 of 12 files reviewed, 4 unresolved discussions (waiting on @jolevesq)


packages/geoview-core/public/templates/config-sandbox.html line 198 at r1 (raw file):

Previously, jolevesq (Johann Levesque) wrote…

This can be remove, we already have a page (default-config who will implement this demo.

Or keep the old way and build a new section to generate the config from url text box

Done.


packages/geoview-core/src/api/config/config-api.ts line 22 at r1 (raw file):

Previously, jolevesq (Johann Levesque) wrote…

The viewer will pass the split values to the config

Done.


packages/geoview-core/src/api/config/config-api.ts line 167 at r1 (raw file):

Previously, jolevesq (Johann Levesque) wrote…

remove this param, you added it below

Done.


packages/geoview-core/src/api/config/types/config-constants.ts line 165 at r1 (raw file):

Previously, jolevesq (Johann Levesque) wrote…

Why have you removed it? I fix my code to use it

I removed it because if footerBar is {}, the validation detects an error because tabs is mandatory.

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 12 files at r1, 2 of 2 files at r2, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @ychoquet)

@ychoquet ychoquet force-pushed the Get_config_from_url branch from be1a79e to 2ab05dd Compare May 6, 2024 18:39
@jolevesq jolevesq merged commit 15af70d into Canadian-Geospatial-Platform:develop May 6, 2024
5 of 6 checks passed
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.

Add getConfigFromUrl to ConfigApi
2 participants