forked from MapComplete/MapComplete
Fix duplicate building upload in GRB theme (hopefully), remove type from method name, improve typing and error messages
This commit is contained in:
parent
fc483ed547
commit
b8a631f368
11 changed files with 49 additions and 26 deletions
|
|
@ -30,6 +30,7 @@
|
|||
import Direction_gradient from "../../assets/svg/Direction_gradient.svelte"
|
||||
import Mastodon from "../../assets/svg/Mastodon.svelte"
|
||||
import Party from "../../assets/svg/Party.svelte"
|
||||
import AddSmall from "../../assets/svg/AddSmall.svelte"
|
||||
|
||||
/**
|
||||
* Renders a single icon.
|
||||
|
|
@ -111,6 +112,8 @@
|
|||
<Mastodon {color} class={clss} />
|
||||
{:else if icon === "party"}
|
||||
<Party {color} class={clss} />
|
||||
{:else if icon === "addSmall"}
|
||||
<AddSmall {color} class={clss} />
|
||||
{:else}
|
||||
<img class={clss ?? "h-full w-full"} src={icon} aria-hidden="true" alt="" />
|
||||
{/if}
|
||||
|
|
|
|||
|
|
@ -159,7 +159,7 @@ class ApplyButton extends UIElement {
|
|||
private async Run() {
|
||||
try {
|
||||
console.log("Applying auto-action on " + this.target_feature_ids.length + " features")
|
||||
|
||||
const appliedOn: string[] = []
|
||||
for (let i = 0; i < this.target_feature_ids.length; i++) {
|
||||
const targetFeatureId = this.target_feature_ids[i]
|
||||
const feature = this.state.indexedFeatures.featuresById.data.get(targetFeatureId)
|
||||
|
|
@ -190,6 +190,7 @@ class ApplyButton extends UIElement {
|
|||
specialRendering.args
|
||||
)
|
||||
}
|
||||
appliedOn.push(targetFeatureId)
|
||||
if (i % 50 === 0) {
|
||||
await this.state.changes.flushChanges("Auto button: intermediate save")
|
||||
}
|
||||
|
|
@ -198,6 +199,12 @@ class ApplyButton extends UIElement {
|
|||
console.log("Flushing changes...")
|
||||
await this.state.changes.flushChanges("Auto button: done")
|
||||
this.buttonState.setData("done")
|
||||
console.log(
|
||||
"Applied changes onto",
|
||||
appliedOn.length,
|
||||
"items, unique IDs:",
|
||||
new Set(appliedOn).size
|
||||
)
|
||||
} catch (e) {
|
||||
console.error("Error while running autoApply: ", e)
|
||||
this.buttonState.setData({ error: e })
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue