Fix(linkeddata): velopark deals with sections, fix image loading

This commit is contained in:
Pieter Vander Vennet 2024-12-17 03:31:28 +01:00
parent 7a06bb9930
commit ef1d2c9f56
8 changed files with 242 additions and 123 deletions

View file

@ -5,7 +5,7 @@
import Tr from "../Base/Tr.svelte"
import Translations from "../i18n/Translations"
import Icon from "../Map/Icon.svelte"
import Maproulette from "../../Logic/Maproulette"
import Maproulette, { maprouletteStatus } from "../../Logic/Maproulette"
import LoginToggle from "../Base/LoginToggle.svelte"
/**
@ -38,10 +38,11 @@
async function apply() {
const maproulette_id = tags.data[maproulette_id_key] ?? tags.data.mr_taskId ?? tags.data.id
try {
await Maproulette.singleton.closeTask(Number(maproulette_id), Number(statusToSet), state, {
const statusIndex = Maproulette.codeToIndex(statusToSet) ?? Number(statusToSet)
await Maproulette.singleton.closeTask(Number(maproulette_id), statusIndex, state, {
comment: feedback,
})
tags.data["mr_taskStatus"] = Maproulette.STATUS_MEANING[Number(statusToSet)]
tags.data["mr_taskStatus"] = maprouletteStatus[statusIndex]
tags.data.status = statusToSet
tags.ping()
} catch (e) {

View file

@ -9,6 +9,7 @@ import { PointImportFlowArguments, PointImportFlowState } from "./PointImportFlo
import { Utils } from "../../../Utils"
import { ImportFlowUtils } from "./ImportFlow"
import Translations from "../../i18n/Translations"
import { GeoOperations } from "../../../Logic/GeoOperations"
/**
* The wrapper to make the special visualisation for the PointImportFlow
@ -44,6 +45,10 @@ export class PointImportButtonViz implements SpecialVisualization {
name: "maproulette_id",
doc: "The property name of the maproulette_id - this is probably `mr_taskId`. If given, the maproulette challenge will be marked as fixed. Only use this if part of a maproulette-layer.",
},
{
name: "to_point",
doc: "If set, a feature will be converted to a centerpoint",
},
]
}
@ -51,10 +56,17 @@ export class PointImportButtonViz implements SpecialVisualization {
state: SpecialVisualizationState,
tagSource: UIEventSource<Record<string, string>>,
argument: string[],
feature: Feature
feature: Feature,
): BaseUIElement {
const to_point_index = this.args.findIndex(arg => arg.name === "to_point")
const summarizePointArg = argument[to_point_index].toLowerCase()
if (feature.geometry.type !== "Point") {
return Translations.t.general.add.import.wrongType.SetClass("alert")
if (summarizePointArg !== "no" && summarizePointArg !== "false") {
feature = GeoOperations.centerpoint(feature)
} else {
return Translations.t.general.add.import.wrongType.SetClass("alert")
}
}
const baseArgs: PointImportFlowArguments = <any>Utils.ParseVisArgs(this.args, argument)
const tagsToApply = ImportFlowUtils.getTagsToApply(tagSource, baseArgs)
@ -63,7 +75,7 @@ export class PointImportButtonViz implements SpecialVisualization {
<Feature<Point>>feature,
baseArgs,
tagsToApply,
tagSource
tagSource,
)
return new SvelteUIElement(PointImportFlow, {