UX: add progress bar to panoramax upload, fix hanging upload in case of multiple selected images, rm old log statements

This commit is contained in:
Pieter Vander Vennet 2025-05-08 11:28:00 +02:00
parent 767bd18234
commit e33d448055
8 changed files with 35 additions and 22 deletions

View file

@ -11,6 +11,7 @@ import SvelteUIElement from "../../UI/Base/SvelteUIElement"
import Panoramax_bw from "../../assets/svg/Panoramax_bw.svelte"
import Link from "../../UI/Base/Link"
import { Feature, Point } from "geojson"
import { AddImageOptions } from "panoramax-js/dist/Panoramax"
export default class PanoramaxImageProvider extends ImageProvider {
public static readonly singleton: PanoramaxImageProvider = new PanoramaxImageProvider()
@ -166,7 +167,6 @@ export default class PanoramaxImageProvider extends ImageProvider {
getRelevantUrls(tags: Record<string, string>, prefixes: string[]): Store<ProvidedImage[]> {
const source = UIEventSource.FromPromise(super.getRelevantUrlsFor(tags, prefixes))
console.trace("Getting relevant URLS for panoramax yielded", source.data)
function hasLoading(data: ProvidedImage[]) {
if (data === undefined) {
return true
@ -252,7 +252,7 @@ export class PanoramaxUploader implements ImageUploader {
currentGps: [number, number],
author: string,
noblur: boolean = false,
progress?: UIEventSource<number>,
progress?: UIEventSource<number | undefined>,
sequenceId?: string,
datetime?: string
): Promise<{
@ -320,12 +320,13 @@ export class PanoramaxUploader implements ImageUploader {
const sequence: { id: string; "stats:items": { count: number } } = (
await p.mySequences()
).find((s) => s.id === sequenceId)
const options = {
const options: AddImageOptions = {
lon,
lat,
datetime,
isBlurred: noblur,
onProgress: undefined,
indexInSequence: sequence["stats:items"].count + 1, // stats:items is '1'-indexed, so .count is also the last index
exifOverride: {
Artist: author,
},
@ -337,9 +338,11 @@ export class PanoramaxUploader implements ImageUploader {
progress.set(Math.round(percentage))
}
}
progress.set(0)
}
const img = <ImageData>await p.addImage(blob, sequence, options)
const img = <ImageData>await p.addImage(blob, sequenceId, options)
PanoramaxImageProvider.singleton.addKnownMeta(img)
progress.set(undefined)
return {
key: "panoramax",
value: img.id,