Fix non-appearing new icon, remove debug outputs

This commit is contained in:
pietervdvn 2021-12-14 17:29:21 +01:00
parent 7dfbe5f4b4
commit 90fc0e0840
7 changed files with 15 additions and 13 deletions

View file

@ -287,14 +287,14 @@ export default class FeaturePipeline {
// Also load points/lines that are newly added.
const newGeometry = new NewGeometryFromChangesFeatureSource(state.changes, state.osmConnection._oauth_config.url)
newGeometry.features.addCallbackAndRun(geometries => {
console.debug("New geometries are:", geometries)
})
new RegisteringAllFromFeatureSourceActor(newGeometry, state.allElements)
// A NewGeometryFromChangesFeatureSource does not split per layer, so we do this next
new PerLayerFeatureSourceSplitter(state.filteredLayers,
(perLayer) => {
if(perLayer.features.data.length === 0){
return
}
// We don't bother to split them over tiles as it'll contain little features by default, so we simply add them like this
perLayerHierarchy.get(perLayer.layer.layerDef.id).registerTile(perLayer)
// AT last, we always apply the metatags whenever possible
@ -499,7 +499,9 @@ export default class FeaturePipeline {
self.applyMetaTags(tile, <any> this.state)
})
})
this.applyMetaTags(this.state.currentView, <any> this.state)
if(this.state.currentView !== undefined){
this.applyMetaTags(this.state.currentView, <any> this.state)
}
self.metataggingRecalculated.ping()
}

View file

@ -63,7 +63,6 @@ export default class OsmFeatureSource {
try {
for (const neededTile of neededTiles) {
console.log("Tile download from OSM", Tiles.tile_from_index(neededTile).join("/"), "started")
self.downloadedTiles.add(neededTile)
self.LoadTile(...Tiles.tile_from_index(neededTile)).then(_ => {
console.debug("Tile ", Tiles.tile_from_index(neededTile).join("/"), "loaded from OSM")
@ -72,7 +71,6 @@ export default class OsmFeatureSource {
} catch (e) {
console.error(e)
} finally {
console.log("Done")
self.isRunning.setData(false)
}
})
@ -93,7 +91,6 @@ export default class OsmFeatureSource {
const url = `${this._backend}/api/0.6/map?bbox=${bbox.minLon},${bbox.minLat},${bbox.maxLon},${bbox.maxLat}`
try {
console.log("Attempting to get tile", z, x, y, "from the osm api")
const osmJson = await Utils.downloadJson(url)
try {
console.debug("Got tile", z, x, y, "from the osm api")

View file

@ -41,7 +41,7 @@ export class SimpleMetaTagger {
}
export class CountryTagger extends SimpleMetaTagger {
private static readonly coder = new CountryCoder("https://raw.githubusercontent.com/pietervdvn/MapComplete-data/main/latlon2country", ScriptUtils.DownloadJSON);
private static readonly coder = new CountryCoder("https://raw.githubusercontent.com/pietervdvn/MapComplete-data/main/latlon2country", Utils.downloadJson);
public runningTasks: Set<any>;
constructor() {

View file

@ -2,7 +2,7 @@ import {Utils} from "../Utils";
export default class Constants {
public static vNumber = "0.13.0-alpha-7";
public static vNumber = "0.13.0-alpha-8";
public static ImgurApiKey = '7070e7167f0a25a'
public static readonly mapillary_client_token_v4 = "MLY|4441509239301885|b40ad2d3ea105435bd40c7e76993ae85"

View file

@ -56,7 +56,6 @@ export class DropDown<T> extends InputElement<T> {
for (let i = 0; i < values.length; i++) {
const option = document.createElement("option")
option.value = "" + i
console.log(values[i].shown)
option.appendChild(Translations.W(values[i].shown).ConstructElement())
select.appendChild(option)
}

View file

@ -124,7 +124,7 @@ export class Translation extends BaseUIElement {
continue;
}
let template: string = this.translations[lang];
newTranslations[lang] = Utils.SubstituteKeys(template, text);
newTranslations[lang] = Utils.SubstituteKeys(template, text, lang);
}
return new Translation(newTranslations);

View file

@ -238,7 +238,7 @@ In the case that MapComplete is pointed to the testing grounds, the edit will be
return [a.substr(0, index), a.substr(index + sep.length)];
}
public static SubstituteKeys(txt: string | undefined, tags: any): string | undefined {
public static SubstituteKeys(txt: string | undefined, tags: any, useLang?: string): string | undefined {
if (txt === undefined) {
return undefined
}
@ -258,6 +258,10 @@ In the case that MapComplete is pointed to the testing grounds, the edit will be
v = date.toISOString()
}
if(useLang !== undefined && v?.translations !== undefined){
v = v.translations[useLang] ?? v.translations["*"] ?? (v.textFor !== undefined ? v.textFor(useLang) : v);
}
if(v.InnerConstructElement !== undefined){
console.warn("SubstituteKeys received a BaseUIElement to substitute in - this is probably a bug and will be downcast to a string\nThe key is", key,"\nThe value is", v)
v = ( <HTMLElement> v.InnerConstructElement())?.innerText