diff --git a/public/modules/ui/routes-overview.js b/public/modules/ui/routes-overview.js
index 883df3dea..10e99c040 100644
--- a/public/modules/ui/routes-overview.js
+++ b/public/modules/ui/routes-overview.js
@@ -171,16 +171,41 @@ function overviewRoutes() {
}
function triggerAllRoutesRemove() {
- alertMessage.innerHTML = /* html */ `Are you sure you want to remove all routes? This action can't be undone`;
+ const toRemove = pack.routes.filter(route => !route.lock);
+ if (!toRemove.length) {
+ if (!pack.routes.length) {
+ tip("There are no routes to remove", false, "error");
+ } else {
+ tip("All routes are locked. Unlock routes to remove them, or use Lock all to unlock first.", false, "error");
+ }
+ return;
+ }
+
+ const lockedCount = pack.routes.length - toRemove.length;
+ alertMessage.innerHTML =
+ lockedCount > 0
+ ? /* html */ `Remove all unlocked routes (${toRemove.length})? ${lockedCount} locked route(s) will be kept. This cannot be undone.`
+ : /* html */ `Are you sure you want to remove all routes? This action can't be undone`;
+
$("#alert").dialog({
resizable: false,
- title: "Remove all routes",
+ title: lockedCount > 0 ? "Remove unlocked routes" : "Remove all routes",
buttons: {
Remove: function () {
- pack.cells.routes = {};
- pack.routes = [];
- routes.selectAll("path").remove();
-
+ const routesToRemove = pack.routes.filter(route => !route.lock);
+ if (!routesToRemove.length) {
+ if (!pack.routes.length) {
+ tip("There are no routes to remove", false, "error");
+ } else {
+ tip("All routes are now locked; nothing was removed.", false, "error");
+ }
+ $(this).dialog("close");
+ return;
+ }
+ for (const route of routesToRemove) {
+ Routes.remove(route);
+ }
+ pack.cells.routes = Routes.buildLinks(pack.routes);
routesOverviewAddLines();
$(this).dialog("close");
},
diff --git a/src/index.html b/src/index.html
index cd9635847..ca04c2fb3 100644
--- a/src/index.html
+++ b/src/index.html
@@ -5523,7 +5523,7 @@
class="icon-download"
>
-
+