Skip to content

Commit

Permalink
Implementation of the new schema (revert properties)
Browse files Browse the repository at this point in the history
  • Loading branch information
ychoquet committed May 9, 2024
1 parent 4f15615 commit 225c154
Show file tree
Hide file tree
Showing 9 changed files with 98 additions and 85 deletions.
164 changes: 82 additions & 82 deletions common/config/rush/pnpm-lock.yaml

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions packages/geoview-core/public/templates/config-sandbox.html
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ <h1><strong>Sandbox Configuration</strong></h1>
'queryable': true
}
},
'attributtions': 'Ressources naturelles Canada, Secteur des terres et des minéraux, Commission Géologique du Canada, Service canadien d\'information sur les risques',
'attributions': ['Ressources naturelles Canada, Secteur des terres et des minéraux, Commission Géologique du Canada, Service canadien d\'information sur les risques'],
'source': {
'layerFilter': '',
'maxRecordCount': 0,
Expand Down Expand Up @@ -205,7 +205,7 @@ <h1><strong>Sandbox Configuration</strong></h1>
'en': 'Earthquakes 1990-2000',
'fr': ' Tremblements de terre 1990-2000'
},
'attributtions': 'Ressources naturelles Canada, Secteur des terres et des minéraux, Commission Géologique du Canada, Service canadien d\'information sur les risques',
'attributions': ['Ressources naturelles Canada, Secteur des terres et des minéraux, Commission Géologique du Canada, Service canadien d\'information sur les risques'],
'source': {
'layerFilter': '',
'maxRecordCount': 0,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// Needs to disable class-methods-use-this because we need to pass the instance reference 'this' to the agregated sublayers.
// eslint-disable-next-line @typescript-eslint/class-methods-use-this
import defaultsDeep from 'lodash/defaultsDeep';
import cloneDeep from 'lodash/cloneDeep';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export class EsriDynamicLayerConfig extends AbstractGeoviewLayerConfig {
constructor(layerConfig: TypeJsonObject, language: TypeDisplayLanguage, mapFeatureConfig?: MapFeatureConfig) {
super(layerConfig, language, mapFeatureConfig);
this.geoviewLayerType = CV_CONST_LAYER_TYPES.ESRI_DYNAMIC;
if (!isvalidComparedToSchema(this.geoviewLayerSchema, layerConfig)) this.propagateError();
if (!isvalidComparedToSchema(this.geoviewLayerSchema, this)) this.propagateError();
this.validate();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export class EsriFeatureLayerConfig extends AbstractGeoviewLayerConfig {
constructor(layerConfig: TypeJsonObject, language: TypeDisplayLanguage, mapFeatureConfig?: MapFeatureConfig) {
super(layerConfig, language, mapFeatureConfig);
this.geoviewLayerType = CV_CONST_LAYER_TYPES.ESRI_FEATURE;
if (!isvalidComparedToSchema(this.geoviewLayerSchema, layerConfig)) this.propagateError();
if (!isvalidComparedToSchema(this.geoviewLayerSchema, this)) this.propagateError();
this.validate();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// Needs to disable class-methods-use-this because we need to pass the instance reference 'this' to the validator.
// eslint-disable-next-line @typescript-eslint/class-methods-use-this
import cloneDeep from 'lodash/cloneDeep';
import defaultsDeep from 'lodash/defaultsDeep';

Expand Down Expand Up @@ -109,6 +111,7 @@ export class MapFeatureConfig {
this.#originalgeoviewLayerConfig = cloneDeep(this.#getJsonMapFeatureConfig(providedMapFeatureConfig));
const clonedJsonConfig = this.#originalgeoviewLayerConfig;
this.#language = language;
this.#errorDetected = this.#errorDetected || !isvalidComparedToSchema(CV_MAP_CONFIG_SCHEMA_PATH, clonedJsonConfig);

// set map configuration
const gvMap = clonedJsonConfig.map as TypeJsonObject;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// Needs to disable class-methods-use-this because we need to pass the instance reference 'this' to the validator.
// eslint-disable-next-line @typescript-eslint/class-methods-use-this
import { CV_CONST_SUB_LAYER_TYPES, CV_CONST_LEAF_LAYER_SCHEMA_PATH } from '@config/types/config-constants';
import { TypeJsonObject } from '@config/types/config-types';
import {
Expand Down Expand Up @@ -45,6 +47,7 @@ export class EsriDynamicLayerEntryConfig extends AbstractBaseLayerEntryConfig {
throw new Error(`The layer entry with layer path equal to ${this.layerPath} must be an integer string`);
}
this.source.format = (layerConfig?.source?.format || 'png') as TypeEsriFormatParameter; // Set the source.format property
if (!isvalidComparedToSchema(this.schemaPath, layerConfig)) this.propagateError();
if (!isvalidComparedToSchema(this.schemaPath, this)) this.propagateError();
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// Needs to disable class-methods-use-this because we need to pass the instance reference 'this' to the validator.
// eslint-disable-next-line @typescript-eslint/class-methods-use-this
import { CV_CONST_SUB_LAYER_TYPES, CV_CONST_LEAF_LAYER_SCHEMA_PATH } from '@config/types/config-constants';
import { TypeJsonObject } from '@config/types/config-types';
import {
Expand Down Expand Up @@ -45,6 +47,7 @@ export class EsriFeatureLayerEntryConfig extends AbstractBaseLayerEntryConfig {
throw new Error(`The layer entry with layerId equal to ${this.layerPath} must be an integer string`);
}
this.source.format = 'EsriJSON' as TypeEsriFormatParameter; // Set the source.format property
if (!isvalidComparedToSchema(this.schemaPath, layerConfig)) this.propagateError();
if (!isvalidComparedToSchema(this.schemaPath, this)) this.propagateError();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -974,7 +974,7 @@
"entryType": {
"enum": ["raster-image"]
},
"LayerId": {
"layerId": {
"type": "string",
"description": "The id of the layer to display on the map."
},
Expand Down

0 comments on commit 225c154

Please sign in to comment.