forked from MapComplete/MapComplete
chore: automated housekeeping...
This commit is contained in:
parent
a190597905
commit
087e639020
382 changed files with 29496 additions and 2675 deletions
|
|
@ -46,7 +46,7 @@ export class ImageUploadManager {
|
|||
* FeatureIDs of queued items
|
||||
*/
|
||||
public readonly queued: Store<string[]> = this._queue.imagesInQueue.map((queue) =>
|
||||
queue.map((q) => q.featureId),
|
||||
queue.map((q) => q.featureId)
|
||||
)
|
||||
public readonly queuedArgs = this._queue.imagesInQueue
|
||||
/**
|
||||
|
|
@ -56,7 +56,7 @@ export class ImageUploadManager {
|
|||
public readonly isUploading: Store<string | undefined> = this._isUploading
|
||||
private readonly _reportError: (
|
||||
message: string | Error | XMLHttpRequest,
|
||||
extramessage?: string,
|
||||
extramessage?: string
|
||||
) => Promise<void>
|
||||
|
||||
private readonly _progressCurrentImage: UIEventSource<number> = new UIEventSource(0)
|
||||
|
|
@ -71,8 +71,8 @@ export class ImageUploadManager {
|
|||
gpsLocation: Store<GeolocationCoordinates | undefined>,
|
||||
reportError: (
|
||||
message: string | Error | XMLHttpRequest,
|
||||
extramessage?: string,
|
||||
) => Promise<void>,
|
||||
extramessage?: string
|
||||
) => Promise<void>
|
||||
) {
|
||||
this._uploader = uploader
|
||||
this._featureProperties = featureProperties
|
||||
|
|
@ -132,7 +132,7 @@ export class ImageUploadManager {
|
|||
feature: Feature,
|
||||
options: {
|
||||
ignoreGPS: boolean | false
|
||||
},
|
||||
}
|
||||
): void {
|
||||
const tags: OsmTags = tagsStore.data
|
||||
const featureId = <OsmId | NoteId>tags.id
|
||||
|
|
@ -176,8 +176,9 @@ export class ImageUploadManager {
|
|||
const failed: Set<ImageUploadArguments> = new Set()
|
||||
this.uploadingAll = true
|
||||
do {
|
||||
queue = Utils.NoNull(this._queue.imagesInQueue.data ?? [])
|
||||
.filter(item => !failed.has(item))
|
||||
queue = Utils.NoNull(this._queue.imagesInQueue.data ?? []).filter(
|
||||
(item) => !failed.has(item)
|
||||
)
|
||||
|
||||
console.log("Checking image upload queue and uploading if needed")
|
||||
for (const currentItem of queue) {
|
||||
|
|
@ -233,7 +234,7 @@ export class ImageUploadManager {
|
|||
return false
|
||||
}
|
||||
let properties: UIEventSource<Record<string, string>> = this._featureProperties.getStore(
|
||||
args.featureId,
|
||||
args.featureId
|
||||
)
|
||||
|
||||
if (!isNaN(Number(args.featureId))) {
|
||||
|
|
@ -253,7 +254,7 @@ export class ImageUploadManager {
|
|||
if (properties === undefined) {
|
||||
const downloaded = await new OsmObjectDownloader(
|
||||
this._osmConnection.Backend(),
|
||||
this._changes,
|
||||
this._changes
|
||||
).DownloadObjectAsync(args.featureId)
|
||||
if (downloaded === "deleted") {
|
||||
this._queue.delete(args)
|
||||
|
|
@ -288,7 +289,7 @@ export class ImageUploadManager {
|
|||
*/
|
||||
private async attemptSingleUpload(
|
||||
{ featureId, author, blob, targetKey, noblur, location }: ImageUploadArguments,
|
||||
reportOnFail: boolean,
|
||||
reportOnFail: boolean
|
||||
): Promise<UploadResult | undefined> {
|
||||
let key: string
|
||||
let value: string
|
||||
|
|
@ -300,7 +301,7 @@ export class ImageUploadManager {
|
|||
location,
|
||||
author,
|
||||
noblur,
|
||||
this._progressCurrentImage,
|
||||
this._progressCurrentImage
|
||||
))
|
||||
} catch (e) {
|
||||
console.error("Could again not upload image due to", e)
|
||||
|
|
@ -312,7 +313,7 @@ export class ImageUploadManager {
|
|||
featureId,
|
||||
author,
|
||||
targetKey,
|
||||
}),
|
||||
})
|
||||
)
|
||||
}
|
||||
return undefined
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue