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> = ({
87
87
} ) ) ;
88
88
} ;
89
89
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
+
90
102
return (
91
103
< div
92
104
className = "jgis-identify-wrapper"
@@ -106,7 +118,7 @@ export const IdentifyPanelComponent: React.FC<IIdentifyComponentProps> = ({
106
118
className = { `jp-gis-layerGroupCollapser${ visibleFeatures [ featureIndex ] ? ' jp-mod-expanded' : '' } ` }
107
119
tag = { 'span' }
108
120
/>
109
- < span > Feature { featureIndex + 1 } </ span >
121
+ < span > { getFeatureNameOrId ( feature , featureIndex ) } </ span >
110
122
</ span >
111
123
112
124
{ ( ( ) => {
You can’t perform that action at this time.
0 commit comments