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(details): Display detail fields when service returns alias instea… #2658

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -579,11 +579,14 @@ 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:
// If fieldName is the alias for the entry, we will not get a value, so we try the fieldEntry name.
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
Loading