Deploy AIOS web (React glide grid + FastAPI slice)
Browse files- RELEASES.json +1 -1
- VERSION +1 -1
- api/routes_customers.py +10 -6
- web/public/AIOS_DEPLOY_RECEIPT +1 -1
- web/src/customer-grid/MapView.tsx +1 -2
RELEASES.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
{
|
| 2 |
-
"current": "
|
| 3 |
"releases": []
|
| 4 |
}
|
|
|
|
| 1 |
{
|
| 2 |
+
"current": "ad5cbc72",
|
| 3 |
"releases": []
|
| 4 |
}
|
VERSION
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
|
|
|
|
| 1 |
+
ad5cbc72
|
api/routes_customers.py
CHANGED
|
@@ -1330,8 +1330,7 @@ def _route_dto(route, allowed, active, session, share_mark=None):
|
|
| 1330 |
# ⚠ THIS GRANTS NO NEW AUTHORITY. The three branches below are `_route_mutation_allowed`'s
|
| 1331 |
# three passing branches, in its order: the owner (or an admin, already folded into
|
| 1332 |
# `owns_route`), an explicit `edit` share on the Route, then an editor of the source View.
|
| 1333 |
-
#
|
| 1334 |
-
# `route_view_read_only` without it — that door is not the one R6 corrected.
|
| 1335 |
# ⭐ `not compatibility and ...` led this expression until the legacy projection was retired.
|
| 1336 |
# Only a projected Route ever carried that marker, and nothing mints one now.
|
| 1337 |
can_edit = bool(owns_route or mark.get("sharedRole") == "edit" or source_edit)
|
|
@@ -1341,7 +1340,8 @@ def _route_dto(route, allowed, active, session, share_mark=None):
|
|
| 1341 |
"permission": {"canEdit": can_edit,
|
| 1342 |
"sourceViewId": route.get("sourceViewId")},
|
| 1343 |
"capabilities": route_system.route_capabilities(
|
| 1344 |
-
route, can_edit=can_edit,
|
|
|
|
| 1345 |
can_delete=can_edit),
|
| 1346 |
"assignee": route.get("assignee"), "date": route.get("date"),
|
| 1347 |
# D-599 (wave 46 hotfix) — the route's Zone association. ALWAYS present, `null` when
|
|
@@ -1581,7 +1581,8 @@ def create_route(body: dict = Body(default=None), session: Session = Depends(mod
|
|
| 1581 |
from core import route_system
|
| 1582 |
raw = dict(body or {})
|
| 1583 |
_reject_client_create_id(raw, "Route")
|
| 1584 |
-
|
|
|
|
| 1585 |
raise err(403, "route_view_read_only", "a Route requires an editable source View")
|
| 1586 |
permitted = allowed_pids(session)
|
| 1587 |
if any(pid not in permitted for pid in _route_input_pids(raw)):
|
|
@@ -1600,8 +1601,11 @@ def duplicate_route(route_id: str, body: dict = Body(default=None),
|
|
| 1600 |
session: Session = Depends(module_gate(MODULE))):
|
| 1601 |
from core import route_system
|
| 1602 |
prior = _route_or_404(session, route_id)
|
| 1603 |
-
if
|
| 1604 |
-
|
|
|
|
|
|
|
|
|
|
| 1605 |
route = route_system.duplicate_route(
|
| 1606 |
session.runtime, route_id, tenant_id=session.tenant, created_by=session.uname,
|
| 1607 |
name=(body or {}).get("name"))
|
|
|
|
| 1330 |
# ⚠ THIS GRANTS NO NEW AUTHORITY. The three branches below are `_route_mutation_allowed`'s
|
| 1331 |
# three passing branches, in its order: the owner (or an admin, already folded into
|
| 1332 |
# `owns_route`), an explicit `edit` share on the Route, then an editor of the source View.
|
| 1333 |
+
# View-backed duplication still requires source View edit permission.
|
|
|
|
| 1334 |
# ⭐ `not compatibility and ...` led this expression until the legacy projection was retired.
|
| 1335 |
# Only a projected Route ever carried that marker, and nothing mints one now.
|
| 1336 |
can_edit = bool(owns_route or mark.get("sharedRole") == "edit" or source_edit)
|
|
|
|
| 1340 |
"permission": {"canEdit": can_edit,
|
| 1341 |
"sourceViewId": route.get("sourceViewId")},
|
| 1342 |
"capabilities": route_system.route_capabilities(
|
| 1343 |
+
route, can_edit=can_edit,
|
| 1344 |
+
can_duplicate=source_edit if route.get("sourceViewId") else can_edit,
|
| 1345 |
can_delete=can_edit),
|
| 1346 |
"assignee": route.get("assignee"), "date": route.get("date"),
|
| 1347 |
# D-599 (wave 46 hotfix) — the route's Zone association. ALWAYS present, `null` when
|
|
|
|
| 1581 |
from core import route_system
|
| 1582 |
raw = dict(body or {})
|
| 1583 |
_reject_client_create_id(raw, "Route")
|
| 1584 |
+
source_view = raw.get("sourceViewId", raw.get("source_view_id"))
|
| 1585 |
+
if source_view and not _route_view_can_edit(session, source_view):
|
| 1586 |
raise err(403, "route_view_read_only", "a Route requires an editable source View")
|
| 1587 |
permitted = allowed_pids(session)
|
| 1588 |
if any(pid not in permitted for pid in _route_input_pids(raw)):
|
|
|
|
| 1601 |
session: Session = Depends(module_gate(MODULE))):
|
| 1602 |
from core import route_system
|
| 1603 |
prior = _route_or_404(session, route_id)
|
| 1604 |
+
if prior.get("sourceViewId"):
|
| 1605 |
+
if not _route_view_can_edit(session, prior.get("sourceViewId")):
|
| 1606 |
+
raise err(403, "route_view_read_only", "an editable source View is required to duplicate this Route")
|
| 1607 |
+
else:
|
| 1608 |
+
_route_mutation_allowed(session, prior)
|
| 1609 |
route = route_system.duplicate_route(
|
| 1610 |
session.runtime, route_id, tenant_id=session.tenant, created_by=session.uname,
|
| 1611 |
name=(body or {}).get("name"))
|
web/public/AIOS_DEPLOY_RECEIPT
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
|
|
|
|
| 1 |
+
13ee55f772c3ecc603c0d979593c37f7a351adda070b568312b92f8aaab20a74
|
web/src/customer-grid/MapView.tsx
CHANGED
|
@@ -1664,12 +1664,11 @@ function MapViewSurface({
|
|
| 1664 |
pids: routeSourceStopIds(rows.map((row) => row.pid)) },
|
| 1665 |
], [activeZonePids, selectedPids, rows]);
|
| 1666 |
const createNamedRoute = useCallback(async (name: string, source: MapRouteSource): Promise<string | null> => {
|
| 1667 |
-
if (!activeView) return "Select a saved View before creating a Route.";
|
| 1668 |
if (!source.pids.length) return "Choose a Route source with at least one customer.";
|
| 1669 |
try {
|
| 1670 |
const res = await fetch("/api/v1/customers/routes", {
|
| 1671 |
method: "POST", credentials: "same-origin", headers: { "Content-Type": "application/json" },
|
| 1672 |
-
body: JSON.stringify({ name, stops: source.pids, sourceViewId: activeView.id }),
|
| 1673 |
});
|
| 1674 |
const body = await res.json().catch(() => null);
|
| 1675 |
if (!res.ok) return body?.error?.message || "The Route could not be created.";
|
|
|
|
| 1664 |
pids: routeSourceStopIds(rows.map((row) => row.pid)) },
|
| 1665 |
], [activeZonePids, selectedPids, rows]);
|
| 1666 |
const createNamedRoute = useCallback(async (name: string, source: MapRouteSource): Promise<string | null> => {
|
|
|
|
| 1667 |
if (!source.pids.length) return "Choose a Route source with at least one customer.";
|
| 1668 |
try {
|
| 1669 |
const res = await fetch("/api/v1/customers/routes", {
|
| 1670 |
method: "POST", credentials: "same-origin", headers: { "Content-Type": "application/json" },
|
| 1671 |
+
body: JSON.stringify({ name, stops: source.pids, ...(activeView ? { sourceViewId: activeView.id } : {}) }),
|
| 1672 |
});
|
| 1673 |
const body = await res.json().catch(() => null);
|
| 1674 |
if (!res.ok) return body?.error?.message || "The Route could not be created.";
|