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

2259 osdp geocore #2535

Merged

Conversation

jolevesq
Copy link
Member

@jolevesq jolevesq commented Oct 3, 2024

Description

Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.

  • Add the ability to extract layers config from Geocore
  • Fix the issue with the details panel not opening on feature click because of panel index added to id. At the same time fix the script loading issue for packages when index is not in the id
  • Fix for the third time the regex for date filter. Kept the old version in comment and kept the todo to standardize that section of code

Fixes #2259, #2531

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?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce.

Hosted, October 3rd, 7:30AM

https://jolevesq.github.io/geoview/add-layers.html

https://jolevesq.github.io/geoview/demos-navigator.html?config=./configs/navigator/27-geocore-custom.json

  • Layers added automatically

https://jolevesq.github.io/geoview/config-sandbox.html

  • On first tab, replace uuid of first layer by ea4c0bdb-a63f-49a4-b14a-09c1560aad0b and select "Create .... apply user config"
  • Check the updated value in the right section after pressed execute

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

Copy link
Member Author

@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 13 of 14 files at r1, all commit messages.
Reviewable status: 13 of 14 files reviewed, 3 unresolved discussions (waiting on @Alex-NRCan and @DamonU2)


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

                return mergedConfig;

                // return toJsonObject({

DEad code, add comment if we need to keep. Fix the esri dynamic as well


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

        script.src = `${scriptPath}/corePackages/geoview-${pluginId}.js`;
        script.id = pluginId;
        script.setAttribute('data-name', `geoview-${pluginId}`);

This may not be needed as we are only using id with query selector


packages/geoview-geochart/src/index.tsx line 65 at r1 (raw file):

   */
  override onAdd(): void {
    // Initialize the store with geochart provided configuration in there is one

Typo if instead of in

Copy link
Member

@Alex-NRCan Alex-NRCan 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 14 files at r1, 4 of 4 files at r2, all commit messages.
Reviewable status: all files reviewed, 5 unresolved discussions (waiting on @DamonU2 and @jolevesq)


packages/geoview-core/src/api/config/uuid-config-reader.ts line 62 at r2 (raw file):

          // Get Geocore custom config layer entries values
          // TODO: The prrof of concept is done only for WMS layers. We need to implement other layer types after the refactor

typo 'proof'


packages/geoview-core/src/core/utils/config/reader/uuid-config-reader.ts line 124 at r2 (raw file):

                customGeocoreLayerConfig as unknown as TypeJsonObject
              );
              const esriDynamicLayerEntryConfig = new EsriDynamicLayerEntryConfig(mergedConfig as unknown as EsriDynamicLayerEntryConfig);

This type of self-construct using another copy of the class has been causing many issues when we started privatizing methods with '#'. We realized that the variable sent in the constructor were NOT in fact a class, but a simple JS object casted as a class.
If it's still working, I guess we can keep for now, but this should be revised here and other places in this section.
For example, here, mergedConfig is not an EsriDynamicLayerEntryConfig. The constructor of EsriDynamicLayerEntryConfig shouldn't expect a EsriDynamicLayerEntryConfig.

Copy link
Member Author

@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 4 files at r2.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @DamonU2)

Copy link
Member Author

@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 2 of 4 files at r2.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @Alex-NRCan and @DamonU2)


packages/geoview-core/src/core/utils/config/reader/uuid-config-reader.ts line 124 at r2 (raw file):

Previously, Alex-NRCan (Alex) wrote…

This type of self-construct using another copy of the class has been causing many issues when we started privatizing methods with '#'. We realized that the variable sent in the constructor were NOT in fact a class, but a simple JS object casted as a class.
If it's still working, I guess we can keep for now, but this should be revised here and other places in this section.
For example, here, mergedConfig is not an EsriDynamicLayerEntryConfig. The constructor of EsriDynamicLayerEntryConfig shouldn't expect a EsriDynamicLayerEntryConfig.

Is it the same way it is done in new config API? I don't think so, looks like it uses TypeJSON

 else if (layerType === CV_CONST_LAYER_TYPES.WMS) {
            const geoviewLayerConfig = toJsonObject({
              geoviewLayerId: `${id}`,
              geoviewLayerName: createLocalizedString(name),
              metadataAccessPath: createLocalizedString(url),
              geoviewLayerType: CV_CONST_LAYER_TYPES.WMS,
              isGeocore: true,
              isTimeAware,
            });
            (geoviewLayerConfig.listOfLayerEntryConfig as TypeJsonObject[]) = (layerEntries as TypeJsonArray).map(
              (item): TypeJsonObject => {
                const originalConfig = {
                  layerId: `${item.id}`,
                  source: {
                    serverType: serverType === undefined ? 'mapserver' : serverType,
                  },
                };

                // Overwrite default from geocore custom config
                const mergedConfig = deepMergeObjects(
                  originalConfig as unknown as TypeJsonObject,
                  customGeocoreLayerConfig as unknown as TypeJsonObject
                );

                return mergedConfig;
              }
            );
            listOfGeoviewLayerConfig.push(geoviewLayerConfig);

This whole file will be deleted once refactor is done

Copy link
Member

@Alex-NRCan Alex-NRCan 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: all files reviewed, 1 unresolved discussion (waiting on @DamonU2 and @jolevesq)

Copy link
Member

@Alex-NRCan Alex-NRCan 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: all files reviewed, 1 unresolved discussion (waiting on @DamonU2 and @jolevesq)


packages/geoview-core/src/core/utils/config/reader/uuid-config-reader.ts line 124 at r2 (raw file):

Previously, jolevesq (Johann Levesque) wrote…

Is it the same way it is done in new config API? I don't think so, looks like it uses TypeJSON

 else if (layerType === CV_CONST_LAYER_TYPES.WMS) {
            const geoviewLayerConfig = toJsonObject({
              geoviewLayerId: `${id}`,
              geoviewLayerName: createLocalizedString(name),
              metadataAccessPath: createLocalizedString(url),
              geoviewLayerType: CV_CONST_LAYER_TYPES.WMS,
              isGeocore: true,
              isTimeAware,
            });
            (geoviewLayerConfig.listOfLayerEntryConfig as TypeJsonObject[]) = (layerEntries as TypeJsonArray).map(
              (item): TypeJsonObject => {
                const originalConfig = {
                  layerId: `${item.id}`,
                  source: {
                    serverType: serverType === undefined ? 'mapserver' : serverType,
                  },
                };

                // Overwrite default from geocore custom config
                const mergedConfig = deepMergeObjects(
                  originalConfig as unknown as TypeJsonObject,
                  customGeocoreLayerConfig as unknown as TypeJsonObject
                );

                return mergedConfig;
              }
            );
            listOfGeoviewLayerConfig.push(geoviewLayerConfig);

This whole file will be deleted once refactor is done

I believe it's more in nodeFactory that it's now done and it looks better yes.
Here layerConfig is of right type, no 'as' is used.

image.png

Copy link
Member Author

@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 4 files at r2, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @DamonU2)

Copy link
Member

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

Reviewed 10 of 14 files at r1, 4 of 4 files at r2, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @jolevesq)


packages/geoview-core/src/core/utils/utilities.ts line 62 at r2 (raw file):

 * Check if an object is empty
 * @param {object} obj - The object to test
 * @returns true is object is empty, false otherwise

true is > true if

Copy link
Member

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

Reviewed 2 of 2 files at r3, 10 of 11 files at r4, 1 of 1 files at r5, all commit messages.
Reviewable status: all files reviewed, 6 unresolved discussions (waiting on @jolevesq)


packages/geoview-core/src/geo/layer/layer-sets/abstract-layer-set.ts line 452 at r5 (raw file):

   * Align records with informatiom provided by OutFields from layer config.
   * This will update fields in and delete unwanted fields from the arrayOfRecords
   * @param {TypeLayerEntryConfig} layerPath - Path of the layerto get config from.

layerto > layer to


packages/geoview-core/src/geo/layer/layer-sets/abstract-layer-set.ts line 457 at r5 (raw file):

   * @static
   */
  protected static alingRecordsWithOutFields(layerEntryConfig: TypeLayerEntryConfig, arrayOfRecords: TypeFeatureInfoEntry[]): void {

alingRecordsWithOutFields > align...


packages/geoview-core/src/geo/layer/layer-sets/all-feature-info-layer-set.ts line 131 at r5 (raw file):

        // Use the response to align arrayOfRecords fields with layerConfig fields
        if (arrayOfRecords?.length)
          AbstractLayerSet.alingRecordsWithOutFields(this.layerApi.getLayerEntryConfig(layerPath) as TypeLayerEntryConfig, arrayOfRecords);

alingRecordsWithOutFields > align...


packages/geoview-core/src/geo/layer/layer-sets/feature-info-layer-set.ts line 159 at r5 (raw file):

            // Use the response to align arrayOfRecords fields with layerConfig fields
            if (arrayOfRecords?.length)
              AbstractLayerSet.alingRecordsWithOutFields(

alingRecordsWithOutFields > align...

Copy link
Member Author

@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 2 of 2 files at r3, 10 of 11 files at r4, 2 of 3 files at r6, all commit messages.
Reviewable status: 20 of 21 files reviewed, 5 unresolved discussions (waiting on @DamonU2)


packages/geoview-core/src/core/utils/utilities.ts line 62 at r2 (raw file):

Previously, DamonU2 (Damon Ulmi) wrote…

true is > true if

Done.


packages/geoview-core/src/geo/layer/layer-sets/abstract-layer-set.ts line 452 at r5 (raw file):

Previously, DamonU2 (Damon Ulmi) wrote…

layerto > layer to

Done.


packages/geoview-core/src/geo/layer/layer-sets/abstract-layer-set.ts line 457 at r5 (raw file):

Previously, DamonU2 (Damon Ulmi) wrote…

alingRecordsWithOutFields > align...

Done.


packages/geoview-core/src/geo/layer/layer-sets/all-feature-info-layer-set.ts line 131 at r5 (raw file):

Previously, DamonU2 (Damon Ulmi) wrote…

alingRecordsWithOutFields > align...

Done.


packages/geoview-core/src/geo/layer/layer-sets/feature-info-layer-set.ts line 159 at r5 (raw file):

Previously, DamonU2 (Damon Ulmi) wrote…

alingRecordsWithOutFields > align...

Done.

Copy link
Member

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

Reviewed 3 of 3 files at r6, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @jolevesq)

@jolevesq jolevesq merged commit 8f4d8b5 into Canadian-Geospatial-Platform:develop Oct 4, 2024
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.

[FEATURE] Method to handle feature info for outlier layers
3 participants