feat: remove confirm for feature delete

This commit is contained in:
Yohan Boniface 2025-04-07 10:48:34 +02:00
parent a2749ce805
commit 49bba24b90
4 changed files with 5 additions and 18 deletions

View file

@ -61,7 +61,7 @@ export default class Browser {
DomEvent.on(zoom_to, 'click', viewFeature) DomEvent.on(zoom_to, 'click', viewFeature)
DomEvent.on(title, 'click', viewFeature) DomEvent.on(title, 'click', viewFeature)
DomEvent.on(edit, 'click', feature.edit, feature) DomEvent.on(edit, 'click', feature.edit, feature)
DomEvent.on(del, 'click', feature.confirmDelete, feature) DomEvent.on(del, 'click', feature.del, feature)
// HOTFIX. Remove when this is released: // HOTFIX. Remove when this is released:
// https://github.com/Leaflet/Leaflet/pull/9052 // https://github.com/Leaflet/Leaflet/pull/9052
DomEvent.disableClickPropagation(row) DomEvent.disableClickPropagation(row)

View file

@ -278,7 +278,8 @@ class Feature {
<i class="icon icon-24 icon-delete"></i>${translate('Delete')} <i class="icon icon-24 icon-delete"></i>${translate('Delete')}
</button>`) </button>`)
button.addEventListener('click', () => { button.addEventListener('click', () => {
this.confirmDelete().then(() => this._umap.editPanel.close()) this.del()
this._umap.editPanel.close()
}) })
container.appendChild(button) container.appendChild(button)
} }
@ -363,17 +364,6 @@ class Feature {
return popup.loadContent() return popup.loadContent()
} }
async confirmDelete() {
const confirmed = await this._umap.dialog.confirm(
translate('Are you sure you want to delete the feature?')
)
if (confirmed) {
this.del()
return true
}
return false
}
del(sync) { del(sync) {
this.isDirty = true this.isDirty = true
this._umap._leafletMap.closePopup() this._umap._leafletMap.closePopup()
@ -518,7 +508,7 @@ class Feature {
icon: 'icon-edit', icon: 'icon-edit',
}, },
{ {
action: () => this.confirmDelete(), action: () => this.del(),
title: translate('Delete this feature'), title: translate('Delete this feature'),
icon: 'icon-delete', icon: 'icon-delete',
}, },
@ -673,7 +663,7 @@ class Feature {
}, },
{ {
label: translate('Delete this feature'), label: translate('Delete this feature'),
action: () => this.confirmDelete(), action: () => this.del(),
}, },
{ {
label: translate('Clone this feature'), label: translate('Clone this feature'),

View file

@ -348,7 +348,6 @@ def test_should_redraw_list_on_feature_delete(live_server, openmap, page, bootst
buttons = page.locator(".umap-browser .datalayer li .icon-delete") buttons = page.locator(".umap-browser .datalayer li .icon-delete")
expect(buttons).to_have_count(3) expect(buttons).to_have_count(3)
buttons.first.click() buttons.first.click()
page.locator("dialog").get_by_role("button", name="OK").click()
expect(buttons).to_have_count(2) expect(buttons).to_have_count(2)
page.get_by_role("button", name="Undo").click() page.get_by_role("button", name="Undo").click()
expect(buttons).to_have_count(3) expect(buttons).to_have_count(3)

View file

@ -86,7 +86,6 @@ def test_websocket_connection_can_sync_markers(new_page, asgi_live_server, tilel
# Delete a marker from peer A and check it's been deleted on peer B # Delete a marker from peer A and check it's been deleted on peer B
a_first_marker.click(button="right") a_first_marker.click(button="right")
peerA.get_by_role("button", name="Delete this feature").click() peerA.get_by_role("button", name="Delete this feature").click()
peerA.locator("dialog").get_by_role("button", name="OK").click()
expect(a_marker_pane).to_have_count(1) expect(a_marker_pane).to_have_count(1)
expect(b_marker_pane).to_have_count(1) expect(b_marker_pane).to_have_count(1)
@ -166,7 +165,6 @@ def test_websocket_connection_can_sync_polygons(context, asgi_live_server, tilel
# Delete a polygon from peer A and check it's been deleted on peer B # Delete a polygon from peer A and check it's been deleted on peer B
a_polygon.click(button="right") a_polygon.click(button="right")
peerA.get_by_role("button", name="Delete this feature").click() peerA.get_by_role("button", name="Delete this feature").click()
peerA.locator("dialog").get_by_role("button", name="OK").click()
expect(a_polygons).to_have_count(0) expect(a_polygons).to_have_count(0)
expect(b_polygons).to_have_count(0) expect(b_polygons).to_have_count(0)