Chore: remove some obsolete console.logs
This commit is contained in:
parent
57e0093e47
commit
6f5b0622a5
13 changed files with 39 additions and 53 deletions
0
src/Logic/ImageProviders/ImageUploadManager.ts
Normal file
0
src/Logic/ImageProviders/ImageUploadManager.ts
Normal file
0
src/Logic/ImageProviders/ImageUploader.ts
Normal file
0
src/Logic/ImageProviders/ImageUploader.ts
Normal file
|
@ -1,43 +0,0 @@
|
||||||
import { UIEventSource } from "../UIEventSource"
|
|
||||||
import { Imgur } from "./Imgur"
|
|
||||||
|
|
||||||
export default class ImgurUploader {
|
|
||||||
public readonly queue: UIEventSource<string[]> = new UIEventSource<string[]>([])
|
|
||||||
public readonly failed: UIEventSource<string[]> = new UIEventSource<string[]>([])
|
|
||||||
public readonly success: UIEventSource<string[]> = new UIEventSource<string[]>([])
|
|
||||||
public maxFileSizeInMegabytes = 10
|
|
||||||
private readonly _handleSuccessUrl: (string) => Promise<void>
|
|
||||||
|
|
||||||
constructor(handleSuccessUrl: (string) => Promise<void>) {
|
|
||||||
this._handleSuccessUrl = handleSuccessUrl
|
|
||||||
}
|
|
||||||
|
|
||||||
public uploadMany(title: string, description: string, files: FileList): void {
|
|
||||||
for (let i = 0; i < files.length; i++) {
|
|
||||||
this.queue.data.push(files.item(i).name)
|
|
||||||
}
|
|
||||||
this.queue.ping()
|
|
||||||
|
|
||||||
const self = this
|
|
||||||
this.queue.setData([...self.queue.data])
|
|
||||||
Imgur.uploadMultiple(
|
|
||||||
title,
|
|
||||||
description,
|
|
||||||
files,
|
|
||||||
async function (url) {
|
|
||||||
console.log("File saved at", url)
|
|
||||||
self.success.data.push(url)
|
|
||||||
self.success.ping()
|
|
||||||
await self._handleSuccessUrl(url)
|
|
||||||
},
|
|
||||||
function () {
|
|
||||||
console.log("All uploads completed")
|
|
||||||
},
|
|
||||||
|
|
||||||
function (failReason) {
|
|
||||||
console.log("Upload failed due to ", failReason)
|
|
||||||
self.failed.setData([...self.failed.data, failReason])
|
|
||||||
}
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -5,6 +5,7 @@ import Locale from "../../UI/i18n/Locale"
|
||||||
import Constants from "../../Models/Constants"
|
import Constants from "../../Models/Constants"
|
||||||
import { Changes } from "./Changes"
|
import { Changes } from "./Changes"
|
||||||
import { Utils } from "../../Utils"
|
import { Utils } from "../../Utils"
|
||||||
|
import FeaturePropertiesStore from "../FeatureSource/Actors/FeaturePropertiesStore";
|
||||||
|
|
||||||
export interface ChangesetTag {
|
export interface ChangesetTag {
|
||||||
key: string
|
key: string
|
||||||
|
@ -13,7 +14,7 @@ export interface ChangesetTag {
|
||||||
}
|
}
|
||||||
|
|
||||||
export class ChangesetHandler {
|
export class ChangesetHandler {
|
||||||
private readonly allElements: { addAlias: (id0: String, id1: string) => void }
|
private readonly allElements: FeaturePropertiesStore
|
||||||
private osmConnection: OsmConnection
|
private osmConnection: OsmConnection
|
||||||
private readonly changes: Changes
|
private readonly changes: Changes
|
||||||
private readonly _dryRun: Store<boolean>
|
private readonly _dryRun: Store<boolean>
|
||||||
|
@ -29,11 +30,11 @@ export class ChangesetHandler {
|
||||||
constructor(
|
constructor(
|
||||||
dryRun: Store<boolean>,
|
dryRun: Store<boolean>,
|
||||||
osmConnection: OsmConnection,
|
osmConnection: OsmConnection,
|
||||||
allElements: { addAlias: (id0: string, id1: string) => void } | undefined,
|
allElements: FeaturePropertiesStore | { addAlias: (id0: string, id1: string) => void } | undefined,
|
||||||
changes: Changes
|
changes: Changes
|
||||||
) {
|
) {
|
||||||
this.osmConnection = osmConnection
|
this.osmConnection = osmConnection
|
||||||
this.allElements = allElements
|
this.allElements = <FeaturePropertiesStore> allElements
|
||||||
this.changes = changes
|
this.changes = changes
|
||||||
this._dryRun = dryRun
|
this._dryRun = dryRun
|
||||||
this.userDetails = osmConnection.userDetails
|
this.userDetails = osmConnection.userDetails
|
||||||
|
|
|
@ -61,7 +61,6 @@ export class GeoLocationState {
|
||||||
const self = this;
|
const self = this;
|
||||||
|
|
||||||
this.permission.addCallbackAndRunD(async (state) => {
|
this.permission.addCallbackAndRunD(async (state) => {
|
||||||
console.trace("GEOPERMISSION", state)
|
|
||||||
if (state === "granted") {
|
if (state === "granted") {
|
||||||
self._previousLocationGrant.setData("true");
|
self._previousLocationGrant.setData("true");
|
||||||
self._grantedThisSession.setData(true);
|
self._grantedThisSession.setData(true);
|
||||||
|
|
|
@ -9,6 +9,6 @@ export class ThemeMetaTagging {
|
||||||
Utils.AddLazyProperty(feat.properties, '_mastodon_candidate_a', () => (feat => {const e = document.createElement('div');e.innerHTML = feat.properties._d;return Array.from(e.getElementsByTagName("a")).filter(a => a.href.match(/mastodon|en.osm.town/) !== null)[0]?.href }) (feat) )
|
Utils.AddLazyProperty(feat.properties, '_mastodon_candidate_a', () => (feat => {const e = document.createElement('div');e.innerHTML = feat.properties._d;return Array.from(e.getElementsByTagName("a")).filter(a => a.href.match(/mastodon|en.osm.town/) !== null)[0]?.href }) (feat) )
|
||||||
Utils.AddLazyProperty(feat.properties, '_mastodon_link', () => (feat => {const e = document.createElement('div');e.innerHTML = feat.properties._d;return Array.from(e.getElementsByTagName("a")).filter(a => a.getAttribute("rel")?.indexOf('me') >= 0)[0]?.href})(feat) )
|
Utils.AddLazyProperty(feat.properties, '_mastodon_link', () => (feat => {const e = document.createElement('div');e.innerHTML = feat.properties._d;return Array.from(e.getElementsByTagName("a")).filter(a => a.getAttribute("rel")?.indexOf('me') >= 0)[0]?.href})(feat) )
|
||||||
Utils.AddLazyProperty(feat.properties, '_mastodon_candidate', () => feat.properties._mastodon_candidate_md ?? feat.properties._mastodon_candidate_a )
|
Utils.AddLazyProperty(feat.properties, '_mastodon_candidate', () => feat.properties._mastodon_candidate_md ?? feat.properties._mastodon_candidate_a )
|
||||||
Utils.AddLazyProperty(feat.properties, '__current_background', () => 'initial_value' )
|
feat.properties['__current_backgroun'] = 'initial_value'
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -515,7 +515,7 @@ class MappedStore<TIn, T> extends Store<T> {
|
||||||
}
|
}
|
||||||
|
|
||||||
private unregisterFromUpstream() {
|
private unregisterFromUpstream() {
|
||||||
console.log("Unregistering callbacks for", this.tag)
|
console.debug("Unregistering callbacks for", this.tag)
|
||||||
this._callbacksAreRegistered = false
|
this._callbacksAreRegistered = false
|
||||||
this._unregisterFromUpstream()
|
this._unregisterFromUpstream()
|
||||||
this._unregisterFromExtraStores?.forEach((unr) => unr())
|
this._unregisterFromExtraStores?.forEach((unr) => unr())
|
||||||
|
|
0
src/UI/Base/FileSelector.svelte
Normal file
0
src/UI/Base/FileSelector.svelte
Normal file
0
src/UI/Image/UploadImage.svelte
Normal file
0
src/UI/Image/UploadImage.svelte
Normal file
31
src/UI/Image/UploadingImageCounter.svelte
Normal file
31
src/UI/Image/UploadingImageCounter.svelte
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
<script lang="ts">/**
|
||||||
|
* Shows an 'upload'-button which will start the upload for this feature
|
||||||
|
*/
|
||||||
|
|
||||||
|
import type { SpecialVisualizationState } from "../SpecialVisualization";
|
||||||
|
import type { Feature } from "geojson";
|
||||||
|
import { Store } from "../../Logic/UIEventSource";
|
||||||
|
import type { OsmTags } from "../../Models/OsmFeature";
|
||||||
|
import { ImageUploader } from "../../Logic/ImageProviders/ImageUploader";
|
||||||
|
import LoginToggle from "../Base/LoginToggle.svelte";
|
||||||
|
import Translations from "../i18n/Translations";
|
||||||
|
import Tr from "../Base/Tr.svelte";
|
||||||
|
import { ImageUploadManager } from "../../Logic/ImageProviders/ImageUploadManager";
|
||||||
|
|
||||||
|
export let state: SpecialVisualizationState;
|
||||||
|
export let feature: Feature;
|
||||||
|
|
||||||
|
export let tags: Store<OsmTags>;
|
||||||
|
export let state: SpecialVisualizationState;
|
||||||
|
export let lon: number;
|
||||||
|
export let lat: number;
|
||||||
|
const t = Translations.t.image
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
<LoginToggle>
|
||||||
|
|
||||||
|
<Tr slot="not-logged-in" t={t.pleaseLogin}/>
|
||||||
|
|
||||||
|
</LoginToggle>
|
|
@ -38,7 +38,6 @@
|
||||||
const hasSoftDeletion = deleteConfig.softDeletionTags !== undefined
|
const hasSoftDeletion = deleteConfig.softDeletionTags !== undefined
|
||||||
let currentState: "start" | "confirm" | "applying" | "deleted" = "start"
|
let currentState: "start" | "confirm" | "applying" | "deleted" = "start"
|
||||||
$: {
|
$: {
|
||||||
console.log("Current state is", currentState, $canBeDeleted, canBeDeletedReason)
|
|
||||||
deleteAbility.CheckDeleteability(true)
|
deleteAbility.CheckDeleteability(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,7 +54,6 @@
|
||||||
let actionToTake: OsmChangeAction
|
let actionToTake: OsmChangeAction
|
||||||
const changedProperties = TagUtils.changeAsProperties(selectedTags.asChange(tags?.data ?? {}))
|
const changedProperties = TagUtils.changeAsProperties(selectedTags.asChange(tags?.data ?? {}))
|
||||||
const deleteReason = changedProperties[DeleteConfig.deleteReasonKey]
|
const deleteReason = changedProperties[DeleteConfig.deleteReasonKey]
|
||||||
console.log("Deleting! Hard?:", canBeDeleted.data, deleteReason)
|
|
||||||
if (deleteReason) {
|
if (deleteReason) {
|
||||||
// This is a proper, hard deletion
|
// This is a proper, hard deletion
|
||||||
actionToTake = new DeleteAction(
|
actionToTake = new DeleteAction(
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
import ToSvelte from "../Base/ToSvelte.svelte"
|
import ToSvelte from "../Base/ToSvelte.svelte"
|
||||||
import { AttributedImage } from "../Image/AttributedImage"
|
import { AttributedImage } from "../Image/AttributedImage"
|
||||||
import AllImageProviders from "../../Logic/ImageProviders/AllImageProviders"
|
import AllImageProviders from "../../Logic/ImageProviders/AllImageProviders"
|
||||||
import LinkPicture from "../../Logic/Osm/Actions/LinkPicture"
|
import LinkImageAction from "../../Logic/Osm/Actions/LinkImageAction"
|
||||||
import ChangeTagAction from "../../Logic/Osm/Actions/ChangeTagAction"
|
import ChangeTagAction from "../../Logic/Osm/Actions/ChangeTagAction"
|
||||||
import { Tag } from "../../Logic/Tags/Tag"
|
import { Tag } from "../../Logic/Tags/Tag"
|
||||||
import { GeoOperations } from "../../Logic/GeoOperations"
|
import { GeoOperations } from "../../Logic/GeoOperations"
|
||||||
|
@ -40,7 +40,7 @@
|
||||||
const key = Object.keys(image.osmTags)[0]
|
const key = Object.keys(image.osmTags)[0]
|
||||||
const url = image.osmTags[key]
|
const url = image.osmTags[key]
|
||||||
if (isLinked) {
|
if (isLinked) {
|
||||||
const action = new LinkPicture(currentTags.id, key, url, currentTags, {
|
const action = new LinkImageAction(currentTags.id, key, url, currentTags, {
|
||||||
theme: state.layout.id,
|
theme: state.layout.id,
|
||||||
changeType: "link-image",
|
changeType: "link-image",
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in a new issue