Disable feature box if the feature has changed upstream and no longer matches the layer definition

This commit is contained in:
Pieter Vander Vennet 2024-02-20 23:47:49 +01:00
parent ac90379499
commit cae8854dbe
2 changed files with 12 additions and 1 deletions

View file

@ -27,6 +27,7 @@
"selectReason": "Please, select why this feature should be deleted", "selectReason": "Please, select why this feature should be deleted",
"softDelete": "This feature will be updated and hidden from this application. <span class='subtle'>{reason}</span>" "softDelete": "This feature will be updated and hidden from this application. <span class='subtle'>{reason}</span>"
}, },
"isChanged": "This feature has been changed and no longer matches this layer",
"isDeleted": "This feature is deleted", "isDeleted": "This feature is deleted",
"isntAPoint": "Only nodes can be deleted, the selected feature is a way, area or relation.", "isntAPoint": "Only nodes can be deleted, the selected feature is a way, area or relation.",
"loading": "Inspecting properties to check if this feature can be deleted.", "loading": "Inspecting properties to check if this feature can be deleted.",

View file

@ -17,6 +17,12 @@
export let tags: UIEventSource<Record<string, string>> = state.featureProperties.getStore( export let tags: UIEventSource<Record<string, string>> = state.featureProperties.getStore(
selectedElement.properties.id selectedElement.properties.id
) )
let stillMatches = tags.map(tags => {
console.log("Tags are now:",tags, layer.source.osmTags?.matchesProperties(tags))
return !layer.source?.osmTags || layer.source.osmTags?.matchesProperties(tags)
})
let _metatags: Record<string, string> let _metatags: Record<string, string>
onDestroy( onDestroy(
@ -35,7 +41,11 @@
) )
</script> </script>
{#if $tags._deleted === "yes"} {#if !$stillMatches}
<div class="alert" aria-live="assertive">
<Tr t={Translations.t.delete.isChanged}/>
</div>
{:else if $tags._deleted === "yes"}
<div aria-live="assertive"> <div aria-live="assertive">
<Tr t={Translations.t.delete.isDeleted} /> <Tr t={Translations.t.delete.isDeleted} />
</div> </div>