File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed
packages/base/src/panelview/components/identify-panel Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -87,6 +87,18 @@ export const IdentifyPanelComponent: React.FC<IIdentifyComponentProps> = ({
8787 } ) ) ;
8888 } ;
8989
90+ const getFeatureNameOrId = ( feature : any , featureIndex : number ) => {
91+ for ( const key of Object . keys ( feature ) ) {
92+ const lowerCase = key . toLowerCase ( ) ;
93+
94+ if ( ( lowerCase . includes ( 'name' ) || lowerCase === 'id' ) && feature [ key ] ) {
95+ return feature [ key ] ;
96+ }
97+ }
98+
99+ return `Feature ${ featureIndex + 1 } ` ;
100+ } ;
101+
90102 return (
91103 < div
92104 className = "jgis-identify-wrapper"
@@ -106,7 +118,7 @@ export const IdentifyPanelComponent: React.FC<IIdentifyComponentProps> = ({
106118 className = { `jp-gis-layerGroupCollapser${ visibleFeatures [ featureIndex ] ? ' jp-mod-expanded' : '' } ` }
107119 tag = { 'span' }
108120 />
109- < span > Feature { featureIndex + 1 } </ span >
121+ < span > { getFeatureNameOrId ( feature , featureIndex ) } </ span >
110122 </ span >
111123
112124 { ( ( ) => {
You can’t perform that action at this time.
0 commit comments