forked from MapComplete/MapComplete
		
	Add debugging-featureswitch which toggles an overview of all tags
This commit is contained in:
		
							parent
							
								
									0dce7b1f3b
								
							
						
					
					
						commit
						2dcc5b21f5
					
				
					 3 changed files with 15 additions and 6 deletions
				
			
		| 
						 | 
					@ -390,8 +390,8 @@ export class InitUiElements {
 | 
				
			||||||
            if (featuresFreshness === undefined) {
 | 
					            if (featuresFreshness === undefined) {
 | 
				
			||||||
                return;
 | 
					                return;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            let features = featuresFreshness.map(ff => ff.feature);
 | 
					            featuresFreshness.forEach(featureFresh => {
 | 
				
			||||||
            features.forEach(feature => {
 | 
					                const feature = featureFresh.feature;
 | 
				
			||||||
                State.state.allElements.addOrGetElement(feature);
 | 
					                State.state.allElements.addOrGetElement(feature);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                if (Hash.hash.data === feature.properties.id) {
 | 
					                if (Hash.hash.data === feature.properties.id) {
 | 
				
			||||||
| 
						 | 
					@ -399,7 +399,7 @@ export class InitUiElements {
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            })
 | 
					            })
 | 
				
			||||||
            MetaTagging.addMetatags(features);
 | 
					            MetaTagging.addMetatags(featuresFreshness);
 | 
				
			||||||
        })
 | 
					        })
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        new ShowDataLayer(source.features, State.state.leafletMap,
 | 
					        new ShowDataLayer(source.features, State.state.leafletMap,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										7
									
								
								State.ts
									
										
									
									
									
								
							
							
						
						
									
										7
									
								
								State.ts
									
										
									
									
									
								
							| 
						 | 
					@ -1,4 +1,3 @@
 | 
				
			||||||
import {UIElement} from "./UI/UIElement";
 | 
					 | 
				
			||||||
import {Utils} from "./Utils";
 | 
					import {Utils} from "./Utils";
 | 
				
			||||||
import {ElementStorage} from "./Logic/ElementStorage";
 | 
					import {ElementStorage} from "./Logic/ElementStorage";
 | 
				
			||||||
import {Changes} from "./Logic/Osm/Changes";
 | 
					import {Changes} from "./Logic/Osm/Changes";
 | 
				
			||||||
| 
						 | 
					@ -8,7 +7,6 @@ import {UIEventSource} from "./Logic/UIEventSource";
 | 
				
			||||||
import {LocalStorageSource} from "./Logic/Web/LocalStorageSource";
 | 
					import {LocalStorageSource} from "./Logic/Web/LocalStorageSource";
 | 
				
			||||||
import {QueryParameters} from "./Logic/Web/QueryParameters";
 | 
					import {QueryParameters} from "./Logic/Web/QueryParameters";
 | 
				
			||||||
import LayoutConfig from "./Customizations/JSON/LayoutConfig";
 | 
					import LayoutConfig from "./Customizations/JSON/LayoutConfig";
 | 
				
			||||||
import Hash from "./Logic/Web/Hash";
 | 
					 | 
				
			||||||
import {MangroveIdentity} from "./Logic/Web/MangroveReviews";
 | 
					import {MangroveIdentity} from "./Logic/Web/MangroveReviews";
 | 
				
			||||||
import InstalledThemes from "./Logic/Actors/InstalledThemes";
 | 
					import InstalledThemes from "./Logic/Actors/InstalledThemes";
 | 
				
			||||||
import BaseLayer from "./Models/BaseLayer";
 | 
					import BaseLayer from "./Models/BaseLayer";
 | 
				
			||||||
| 
						 | 
					@ -89,6 +87,7 @@ export default class State {
 | 
				
			||||||
    public readonly featureSwitchShareScreen: UIEventSource<boolean>;
 | 
					    public readonly featureSwitchShareScreen: UIEventSource<boolean>;
 | 
				
			||||||
    public readonly featureSwitchGeolocation: UIEventSource<boolean>;
 | 
					    public readonly featureSwitchGeolocation: UIEventSource<boolean>;
 | 
				
			||||||
    public readonly featureSwitchIsTesting: UIEventSource<boolean>;
 | 
					    public readonly featureSwitchIsTesting: UIEventSource<boolean>;
 | 
				
			||||||
 | 
					    public readonly featureSwitchIsDebugging: UIEventSource<boolean>;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
| 
						 | 
					@ -194,6 +193,10 @@ export default class State {
 | 
				
			||||||
            this.featureSwitchIsTesting = QueryParameters.GetQueryParameter("test", "false",
 | 
					            this.featureSwitchIsTesting = QueryParameters.GetQueryParameter("test", "false",
 | 
				
			||||||
                "If true, 'dryrun' mode is activated. The app will behave as normal, except that changes to OSM will be printed onto the console instead of actually uploaded to osm.org")
 | 
					                "If true, 'dryrun' mode is activated. The app will behave as normal, except that changes to OSM will be printed onto the console instead of actually uploaded to osm.org")
 | 
				
			||||||
                .map(str => str === "true", [], b => "" + b);
 | 
					                .map(str => str === "true", [], b => "" + b);
 | 
				
			||||||
 | 
					            
 | 
				
			||||||
 | 
					            this.featureSwitchIsDebugging = QueryParameters.GetQueryParameter("debug","false",
 | 
				
			||||||
 | 
					                "If true, shows some extra debugging help such as all the available tags on every object")
 | 
				
			||||||
 | 
					                .map(str => str === "true", [], b => "" + b)
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -9,6 +9,7 @@ import State from "../../State";
 | 
				
			||||||
import TagRenderingConfig from "../../Customizations/JSON/TagRenderingConfig";
 | 
					import TagRenderingConfig from "../../Customizations/JSON/TagRenderingConfig";
 | 
				
			||||||
import ScrollableFullScreen from "../Base/ScrollableFullScreen";
 | 
					import ScrollableFullScreen from "../Base/ScrollableFullScreen";
 | 
				
			||||||
import {Utils} from "../../Utils";
 | 
					import {Utils} from "../../Utils";
 | 
				
			||||||
 | 
					import {Tag} from "../../Logic/Tags";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export default class FeatureInfoBox extends ScrollableFullScreen {
 | 
					export default class FeatureInfoBox extends ScrollableFullScreen {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -54,7 +55,7 @@ export default class FeatureInfoBox extends ScrollableFullScreen {
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        let questionBoxIsUsed = false;
 | 
					        let questionBoxIsUsed = false;
 | 
				
			||||||
        const renderings = layerConfig.tagRenderings.map((tr,i) => {
 | 
					        const renderings = layerConfig.tagRenderings.map(tr => {
 | 
				
			||||||
            if (tr.question === null) {
 | 
					            if (tr.question === null) {
 | 
				
			||||||
                // This is the question box!
 | 
					                // This is the question box!
 | 
				
			||||||
                questionBoxIsUsed = true;
 | 
					                questionBoxIsUsed = true;
 | 
				
			||||||
| 
						 | 
					@ -66,6 +67,11 @@ export default class FeatureInfoBox extends ScrollableFullScreen {
 | 
				
			||||||
            renderings.push(questionBox);
 | 
					            renderings.push(questionBox);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
 | 
					        if(State.state.featureSwitchIsDebugging.data){
 | 
				
			||||||
 | 
					            const config: TagRenderingConfig = new TagRenderingConfig({render:"{all_tags()}"}, new Tag("id",""), "");
 | 
				
			||||||
 | 
					            renderings.push(new TagRenderingAnswer(tags,config ))
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return new Combine(renderings).SetClass("block")
 | 
					        return new Combine(renderings).SetClass("block")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue