forked from MapComplete/MapComplete
		
	Change type of query-parameter-documention to Map instead of an object
This commit is contained in:
		
							parent
							
								
									53e760437c
								
							
						
					
					
						commit
						8b59f1208e
					
				
					 3 changed files with 13 additions and 10 deletions
				
			
		|  | @ -8,7 +8,7 @@ import {Utils} from "../../Utils"; | |||
| export class QueryParameters { | ||||
| 
 | ||||
|     static defaults = {} | ||||
|     static documentation = {} | ||||
|     static documentation: Map<string, string> = new Map<string, string>() | ||||
|     private static order: string [] = ["layout", "test", "z", "lat", "lon"]; | ||||
|     private static _wasInitialized: Set<string> = new Set() | ||||
|     private static knownSources = {}; | ||||
|  | @ -18,7 +18,7 @@ export class QueryParameters { | |||
|         if (!this.initialized) { | ||||
|             this.init(); | ||||
|         } | ||||
|         QueryParameters.documentation[key] = documentation; | ||||
|         QueryParameters.documentation.set(key, documentation); | ||||
|         if (deflt !== undefined) { | ||||
|             QueryParameters.defaults[key] = deflt; | ||||
|         } | ||||
|  |  | |||
|  | @ -41,7 +41,7 @@ export interface DeleteConfigJson { | |||
|          * The tags that will be given to the object. | ||||
|          * This must remove tags so that the 'source/osmTags' won't match anymore | ||||
|          */ | ||||
|         if: AndOrTagConfigJson, | ||||
|         if: string | AndOrTagConfigJson, | ||||
|         /** | ||||
|          * The human explanation for the options | ||||
|          */ | ||||
|  |  | |||
|  | @ -6,6 +6,7 @@ import Translations from "./i18n/Translations"; | |||
| import {QueryParameters} from "../Logic/Web/QueryParameters"; | ||||
| import FeatureSwitchState from "../Logic/State/FeatureSwitchState"; | ||||
| import LayoutConfig from "../Models/ThemeConfig/LayoutConfig"; | ||||
| import {DefaultGuiState} from "./DefaultGuiState"; | ||||
| 
 | ||||
| export default class QueryParameterDocumentation { | ||||
| 
 | ||||
|  | @ -26,7 +27,7 @@ export default class QueryParameterDocumentation { | |||
|         "Finally, the URL-hash is the part after the `#`. It is `node/1234` in this case." | ||||
|     ]) | ||||
| 
 | ||||
|     public static UrlParamDocs(): object{ | ||||
|     public static UrlParamDocs(): Map<string, string> { | ||||
|         const dummyLayout = new LayoutConfig({ | ||||
|             id: ">theme<", | ||||
|             maintainer: "pietervdvn", | ||||
|  | @ -50,7 +51,7 @@ export default class QueryParameterDocumentation { | |||
|             ] | ||||
| 
 | ||||
|         }) | ||||
| 
 | ||||
|         new DefaultGuiState(); // Init a featureSwitchState to init all the parameters
 | ||||
|         new FeatureSwitchState(dummyLayout) | ||||
| 
 | ||||
|         QueryParameters.GetQueryParameter("layer-<layer-id>", "true", "Wether or not the layer with id <layer-id> is shown") | ||||
|  | @ -58,16 +59,18 @@ export default class QueryParameterDocumentation { | |||
|     } | ||||
| 
 | ||||
|     public static GenerateQueryParameterDocs(): BaseUIElement { | ||||
| 
 | ||||
| 
 | ||||
|         const docs: (string | BaseUIElement)[] = [...QueryParameterDocumentation.QueryParamDocsIntro]; | ||||
|         for (const key in QueryParameters.documentation) { | ||||
|         this.UrlParamDocs().forEach((value, key) => { | ||||
|             const c = new Combine([ | ||||
|                 new Title(key, 2), | ||||
|                 QueryParameters.documentation[key], | ||||
|                 value, | ||||
|                 QueryParameters.defaults[key] === undefined ? "No default value set" : `The default value is _${QueryParameters.defaults[key]}_` | ||||
| 
 | ||||
|             ]) | ||||
|             docs.push(c) | ||||
|         } | ||||
|         }) | ||||
|         return new Combine(docs).SetClass("flex flex-col") | ||||
|     } | ||||
| } | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue