forked from MapComplete/MapComplete
Feat: panoramax uploads in testmode are sent to a different sequence
This commit is contained in:
parent
40eceafc80
commit
834b6b18ff
4 changed files with 13 additions and 8 deletions
|
@ -43,7 +43,8 @@
|
||||||
"panoramax": {
|
"panoramax": {
|
||||||
"url": "https://panoramax.mapcomplete.org",
|
"url": "https://panoramax.mapcomplete.org",
|
||||||
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnZW92aXNpbyIsInN1YiI6IjU5ZjgzOGI0LTM4ZjAtNDdjYi04OWYyLTM3NDQ3MWMxNTUxOCJ9.0rBioZS_48NTjnkIyN9497c3fQdTqtGgH1HDqlz1bWs",
|
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnZW92aXNpbyIsInN1YiI6IjU5ZjgzOGI0LTM4ZjAtNDdjYi04OWYyLTM3NDQ3MWMxNTUxOCJ9.0rBioZS_48NTjnkIyN9497c3fQdTqtGgH1HDqlz1bWs",
|
||||||
"sequence": "6e702976-580b-419c-8fb3-cf7bd364e6f8"
|
"sequence": "6e702976-580b-419c-8fb3-cf7bd364e6f8",
|
||||||
|
"testsequence": "7f34cf53-27ff-46c9-ac22-78511fa8457a"
|
||||||
},
|
},
|
||||||
"default_overpass_urls": [
|
"default_overpass_urls": [
|
||||||
"https://overpass-api.de/api/interpreter",
|
"https://overpass-api.de/api/interpreter",
|
||||||
|
|
|
@ -171,8 +171,10 @@ export default class PanoramaxImageProvider extends ImageProvider {
|
||||||
export class PanoramaxUploader implements ImageUploader {
|
export class PanoramaxUploader implements ImageUploader {
|
||||||
public readonly panoramax: AuthorizedPanoramax
|
public readonly panoramax: AuthorizedPanoramax
|
||||||
maxFileSizeInMegabytes = 100 * 1000 * 1000 // 100MB
|
maxFileSizeInMegabytes = 100 * 1000 * 1000 // 100MB
|
||||||
|
private readonly _targetSequence: Store<string>
|
||||||
|
|
||||||
constructor(url: string, token: string) {
|
constructor(url: string, token: string, targetSequence: Store<string>) {
|
||||||
|
this._targetSequence = targetSequence
|
||||||
this.panoramax = new AuthorizedPanoramax(url, token)
|
this.panoramax = new AuthorizedPanoramax(url, token)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -208,10 +210,10 @@ export class PanoramaxUploader implements ImageUploader {
|
||||||
|
|
||||||
|
|
||||||
const p = this.panoramax
|
const p = this.panoramax
|
||||||
const defaultSequence: {id: string, "stats:items":{count:number}} =
|
sequenceId ??= this._targetSequence?.data ?? Constants.panoramax.sequence
|
||||||
(await p.mySequences()).find(s => s.id === Constants.panoramax.sequence)
|
const sequence: {id: string, "stats:items":{count:number}} =
|
||||||
console.log("Upload options are", lon, lat, datetime, blob)
|
(await p.mySequences()).find(s => s.id === sequenceId)
|
||||||
const img = <ImageData>await p.addImage(blob, defaultSequence, {
|
const img = <ImageData>await p.addImage(blob, sequence, {
|
||||||
lon,
|
lon,
|
||||||
lat,
|
lat,
|
||||||
datetime,
|
datetime,
|
||||||
|
|
|
@ -50,7 +50,7 @@ export default class Constants {
|
||||||
...Constants.no_include,
|
...Constants.no_include,
|
||||||
] as const
|
] as const
|
||||||
|
|
||||||
public static panoramax: { url: string; token: string, sequence: string } = packagefile.config.panoramax
|
public static panoramax: { url: string; token: string, sequence: string, testsequence: string } = packagefile.config.panoramax
|
||||||
|
|
||||||
// The user journey states thresholds when a new feature gets unlocked
|
// The user journey states thresholds when a new feature gets unlocked
|
||||||
public static userJourney = {
|
public static userJourney = {
|
||||||
|
|
|
@ -373,7 +373,9 @@ export default class ThemeViewState implements SpecialVisualizationState {
|
||||||
this.hasDataInView = new NoElementsInViewDetector(this).hasFeatureInView
|
this.hasDataInView = new NoElementsInViewDetector(this).hasFeatureInView
|
||||||
this.imageUploadManager = new ImageUploadManager(
|
this.imageUploadManager = new ImageUploadManager(
|
||||||
layout,
|
layout,
|
||||||
new PanoramaxUploader(Constants.panoramax.url, Constants.panoramax.token),
|
new PanoramaxUploader(Constants.panoramax.url, Constants.panoramax.token,
|
||||||
|
this.featureSwitchIsTesting.map(t => t ? Constants.panoramax.testsequence : Constants.panoramax.sequence)
|
||||||
|
),
|
||||||
this.featureProperties,
|
this.featureProperties,
|
||||||
this.osmConnection,
|
this.osmConnection,
|
||||||
this.changes,
|
this.changes,
|
||||||
|
|
Loading…
Reference in a new issue