forked from MapComplete/MapComplete
		
	Studio: some fixes, show user id when running localhost
This commit is contained in:
		
							parent
							
								
									26214ed2a3
								
							
						
					
					
						commit
						09ea799ad4
					
				
					 2 changed files with 45 additions and 22 deletions
				
			
		|  | @ -12,10 +12,11 @@ | ||||||
|     export let osmConnection: OsmConnection |     export let osmConnection: OsmConnection | ||||||
| 
 | 
 | ||||||
|     let displayName = UIEventSource.FromPromise( |     let displayName = UIEventSource.FromPromise( | ||||||
|     osmConnection.getInformationAboutUser(info.owner) |         osmConnection.getInformationAboutUser(info.owner), | ||||||
|     ).mapD((response) => response.display_name) |     ).mapD((response) => response.display_name) | ||||||
| 
 | 
 | ||||||
|     let selfId = osmConnection.userDetails.mapD((ud) => ud.uid) |     let selfId = osmConnection.userDetails.mapD((ud) => ud.uid) | ||||||
|  | 
 | ||||||
|     function fetchIconDescription(layerId): any { |     function fetchIconDescription(layerId): any { | ||||||
|         if (category === "themes") { |         if (category === "themes") { | ||||||
|             return AllKnownLayouts.allKnownLayouts.get(layerId).icon |             return AllKnownLayouts.allKnownLayouts.get(layerId).icon | ||||||
|  | @ -32,6 +33,14 @@ | ||||||
|   </div> |   </div> | ||||||
|   <b class="px-1">{info.id}</b> |   <b class="px-1">{info.id}</b> | ||||||
|   {#if info.owner && info.owner !== $selfId} |   {#if info.owner && info.owner !== $selfId} | ||||||
|     (made by {$displayName ?? info.owner}) |     {#if $displayName} | ||||||
|  |       (made by {$displayName} | ||||||
|  |       {#if window.location.host.startsWith("127.0.0.1")} | ||||||
|  |         - {info.owner} | ||||||
|  |       {/if} | ||||||
|  |       ) | ||||||
|  |     {:else } | ||||||
|  |       ({info.owner}) | ||||||
|  |     {/if} | ||||||
|   {/if} |   {/if} | ||||||
| </NextButton> | </NextButton> | ||||||
|  |  | ||||||
|  | @ -299,6 +299,9 @@ export default class EditLayerState extends EditJsonState<LayerConfigJson> { | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|         function cleanArray(data: object, key: string): boolean{ |         function cleanArray(data: object, key: string): boolean{ | ||||||
|  |             if(!data){ | ||||||
|  |                 return false | ||||||
|  |             } | ||||||
|             if (data[key]) { |             if (data[key]) { | ||||||
|                 // A bit of cleanup
 |                 // A bit of cleanup
 | ||||||
|                 const lBefore = data[key].length |                 const lBefore = data[key].length | ||||||
|  | @ -312,7 +315,18 @@ export default class EditLayerState extends EditJsonState<LayerConfigJson> { | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         this.configuration.addCallbackAndRunD((layer) => { |         this.configuration.addCallbackAndRunD((layer) => { | ||||||
|             const changed = cleanArray(layer, "tagRenderings") || cleanArray(layer, "pointRenderings") |             let changed = cleanArray(layer, "tagRenderings") || cleanArray(layer, "pointRenderings") | ||||||
|  |             for (const tr of layer.tagRenderings ?? []) { | ||||||
|  |                 if(typeof tr === "string"){ | ||||||
|  |                     continue | ||||||
|  |                 } | ||||||
|  | 
 | ||||||
|  |                 const qtr = (<QuestionableTagRenderingConfigJson> tr) | ||||||
|  |                 if(qtr.freeform && Object.keys(qtr.freeform ).length === 0){ | ||||||
|  |                     delete qtr.freeform | ||||||
|  |                     changed = true | ||||||
|  |                 } | ||||||
|  |             } | ||||||
|             if(changed){ |             if(changed){ | ||||||
|                 this.configuration.ping() |                 this.configuration.ping() | ||||||
|             } |             } | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue