Skip to content

Commit

Permalink
fix(details): Display detail fields when service returns alias instea…
Browse files Browse the repository at this point in the history
…d of field name

Fixes some of #2596, info is displayed properly, but icons are not fixed.
  • Loading branch information
DamonU2 committed Dec 12, 2024
1 parent dfdadc5 commit e84c5aa
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -579,11 +579,13 @@ export abstract class AbstractGVLayer extends AbstractBaseLayer {
dictFieldTypes[fieldName] = this.getFieldType(fieldName);
}
const fieldType = dictFieldTypes[fieldName];
const fieldEntry = outfields?.find((outfield) => outfield.name === fieldName);
const fieldEntry = outfields?.find((outfield) => outfield.name === fieldName || outfield.alias === fieldName);
if (fieldEntry) {
featureInfoEntry.fieldInfo[fieldName] = {
featureInfoEntry.fieldInfo[fieldEntry.name] = {
fieldKey: fieldKeyCounter++,
value: this.getFieldValue(feature, fieldName, fieldEntry!.type as 'string' | 'number' | 'date'),
value:
this.getFieldValue(feature, fieldName, fieldEntry!.type as 'string' | 'number' | 'date') ||
this.getFieldValue(feature, fieldEntry.name, fieldEntry!.type as 'string' | 'number' | 'date'),
dataType: fieldEntry!.type,
alias: fieldEntry!.alias,
domain: fieldDomain,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,7 @@ export class GVEsriDynamic extends AbstractGVRaster {
logger.logInfo('There is a problem with this query: ', identifyUrl);
throw new Error(`Error code = ${jsonResponse.error.code} ${jsonResponse.error.message}` || '');
}

const features = new EsriJSON().readFeatures(
{ features: jsonResponse.results },
{ dataProjection: Projection.PROJECTION_NAMES.LNGLAT, featureProjection: mapViewer.getProjection().getCode() }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1260,7 +1260,7 @@ function searchUniqueValueEntry(fields: string[], uniqueValueStyleInfo: TypeLaye
// For obscure reasons, it seems that sometimes the field names in the feature do not have the same case as those in the
// unique value definition.
const fieldName = feature.getKeys().find((key) => {
return key.toLowerCase() === fields?.[j]?.toLowerCase();
return key.toLowerCase() === fields[j]?.toLowerCase();
});
if (fieldName) {
// TODO: info - explain why we need to use == instead of ===
Expand Down

0 comments on commit e84c5aa

Please sign in to comment.