forked from MapComplete/MapComplete
		
	Feat: add download as json to 'allTags'-panel (for debugging)
This commit is contained in:
		
							parent
							
								
									5ff52b5c1d
								
							
						
					
					
						commit
						af2905dc6d
					
				
					 1 changed files with 10 additions and 0 deletions
				
			
		|  | @ -2,6 +2,7 @@ | |||
|   import { Store, UIEventSource } from "../../Logic/UIEventSource" | ||||
|   import SimpleMetaTaggers from "../../Logic/SimpleMetaTagger" | ||||
|   import LayerConfig from "../../Models/ThemeConfig/LayerConfig" | ||||
|   import { Utils } from "../../Utils" | ||||
| 
 | ||||
|   export let tags: UIEventSource<Record<string, any>> | ||||
|   export let tagKeys = tags.map((tgs) => (tgs === undefined ? [] : Object.keys(tgs))) | ||||
|  | @ -31,9 +32,18 @@ | |||
| 
 | ||||
|   const metaKeys: string[] = [].concat(...SimpleMetaTaggers.metatags.map((k) => k.keys)) | ||||
|   let allCalculatedTags = new Set<string>([...calculatedTags, ...metaKeys]) | ||||
| 
 | ||||
|   function downloadAsJson(){ | ||||
|     Utils.offerContentsAsDownloadableFile( | ||||
|       JSON.stringify(tags.data, null, "  "), "tags-"+(tags.data.id ?? layer?.id ?? "")+".json" | ||||
|     ) | ||||
|   } | ||||
| </script> | ||||
| 
 | ||||
| <section> | ||||
|   <button class="as-link" on:click={() => downloadAsJson()}> | ||||
|     Download as JSON | ||||
|   </button> | ||||
|   <table class="zebra-table break-all"> | ||||
|     <tr> | ||||
|       <th>Key</th> | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue