Deploy AIOS web (React glide grid + FastAPI slice)
Browse files- RELEASES.json +1 -1
- VERSION +1 -1
- api/application_registry.py +29 -9
- web/public/AIOS_DEPLOY_RECEIPT +1 -1
- web/src/apps/AppRail.tsx +7 -0
- web/src/customer-grid/AppFrame.tsx +2 -2
- web/src/customer-grid/viewModes.tsx +1 -1
RELEASES.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
{
|
| 2 |
-
"current": "
|
| 3 |
"releases": []
|
| 4 |
}
|
|
|
|
| 1 |
{
|
| 2 |
+
"current": "f3f930b75",
|
| 3 |
"releases": []
|
| 4 |
}
|
VERSION
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
|
|
|
|
| 1 |
+
f3f930b75
|
api/application_registry.py
CHANGED
|
@@ -278,6 +278,19 @@ def _refuse_template_held(applications, identity):
|
|
| 278 |
raise _TemplateHeld(live)
|
| 279 |
|
| 280 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 281 |
def own_template_apps(runtime, user, is_admin=False):
|
| 282 |
"""Return every template copy the App home lists for the caller, grouped by template identity.
|
| 283 |
|
|
@@ -1461,19 +1474,24 @@ def create(runtime, tenant, user, payload, *, semantic_records=None, field_contr
|
|
| 1461 |
else:
|
| 1462 |
_update_with_activity(runtime, app_id, user, apply, via=via, on_behalf_of=on_behalf_of)
|
| 1463 |
except _TemplateHeld as exc:
|
| 1464 |
-
|
|
|
|
|
|
|
| 1465 |
if readable is None:
|
| 1466 |
raise ApplicationExistsError() from None
|
| 1467 |
result = None
|
| 1468 |
-
if (is_admin and readable.get("createdBy") != user
|
| 1469 |
-
and (readable.get("share") or {}).get("mode") != "tenant"
|
| 1470 |
and template_identity(readable) != "route"
|
| 1471 |
and not workspace_share_needs_approval(readable, is_admin)):
|
| 1472 |
# The tenant's one copy is listed for everyone; an admin's add shares a private legacy copy.
|
|
|
|
| 1473 |
# Routing is one private copy per account, as in `_template_share_plan`.
|
|
|
|
|
|
|
|
|
|
| 1474 |
try:
|
| 1475 |
result = mutate(runtime, readable["id"], user, is_admin,
|
| 1476 |
-
{"share":
|
| 1477 |
except Exception:
|
| 1478 |
result = None
|
| 1479 |
if result is None:
|
|
@@ -1895,7 +1913,7 @@ TEMPLATE_SHARES_MARKER = "templateShares"
|
|
| 1895 |
|
| 1896 |
|
| 1897 |
def _template_share_plan(documents):
|
| 1898 |
-
"""`{document key: {app id: identity}}`: the oldest live copy of each identity
|
| 1899 |
groups = {}
|
| 1900 |
for key, doc in documents.items():
|
| 1901 |
for app_id, app in doc["applications"].items():
|
|
@@ -1910,14 +1928,16 @@ def _template_share_plan(documents):
|
|
| 1910 |
if any((app.get("share") if isinstance(app.get("share"), dict) else {}).get("mode") == "tenant"
|
| 1911 |
for _key, _app_id, app in copies):
|
| 1912 |
continue
|
| 1913 |
-
key, app_id,
|
| 1914 |
-
|
| 1915 |
-
|
|
|
|
|
|
|
| 1916 |
return plan
|
| 1917 |
|
| 1918 |
|
| 1919 |
def migrate_template_shares(runtime, tenant):
|
| 1920 |
-
"""Share with the tenant the oldest live copy of each template identity
|
| 1921 |
|
| 1922 |
Writes only a document that holds a copy to share, so a second run writes nothing.
|
| 1923 |
"""
|
|
|
|
| 278 |
raise _TemplateHeld(live)
|
| 279 |
|
| 280 |
|
| 281 |
+
def _sole_holder(app, copies):
|
| 282 |
+
"""True when every other live copy of `app`'s template is its creator's own and unshared.
|
| 283 |
+
|
| 284 |
+
Only then does a tenant share list no account a second copy of the template.
|
| 285 |
+
"""
|
| 286 |
+
creator = app.get("createdBy")
|
| 287 |
+
return all(other.get("id") == app.get("id")
|
| 288 |
+
or (other.get("createdBy") == creator
|
| 289 |
+
and (other.get("share") or {}).get("mode") != "tenant"
|
| 290 |
+
and not (other.get("share") or {}).get("users"))
|
| 291 |
+
for other in copies)
|
| 292 |
+
|
| 293 |
+
|
| 294 |
def own_template_apps(runtime, user, is_admin=False):
|
| 295 |
"""Return every template copy the App home lists for the caller, grouped by template identity.
|
| 296 |
|
|
|
|
| 1474 |
else:
|
| 1475 |
_update_with_activity(runtime, app_id, user, apply, via=via, on_behalf_of=on_behalf_of)
|
| 1476 |
except _TemplateHeld as exc:
|
| 1477 |
+
# A copy the caller already lists answers first: answering another would list it a second one.
|
| 1478 |
+
listed = next((held for held in exc.live if _listed(held, user)), None)
|
| 1479 |
+
readable = listed or next((held for held in exc.live if may_read(held, user, is_admin)), None)
|
| 1480 |
if readable is None:
|
| 1481 |
raise ApplicationExistsError() from None
|
| 1482 |
result = None
|
| 1483 |
+
if (listed is None and is_admin and readable.get("createdBy") != user
|
|
|
|
| 1484 |
and template_identity(readable) != "route"
|
| 1485 |
and not workspace_share_needs_approval(readable, is_admin)):
|
| 1486 |
# The tenant's one copy is listed for everyone; an admin's add shares a private legacy copy.
|
| 1487 |
+
# Beside another account's copy it grants the admin alone, so nobody lists two.
|
| 1488 |
# Routing is one private copy per account, as in `_template_share_plan`.
|
| 1489 |
+
held_share = readable.get("share") if isinstance(readable.get("share"), dict) else {}
|
| 1490 |
+
share = ({"mode": "tenant", "users": []} if _sole_holder(readable, exc.live)
|
| 1491 |
+
else {"mode": "users", "users": sorted({*(held_share.get("users") or ()), user})})
|
| 1492 |
try:
|
| 1493 |
result = mutate(runtime, readable["id"], user, is_admin,
|
| 1494 |
+
{"share": share}, allowed_databases=allowed_databases)
|
| 1495 |
except Exception:
|
| 1496 |
result = None
|
| 1497 |
if result is None:
|
|
|
|
| 1913 |
|
| 1914 |
|
| 1915 |
def _template_share_plan(documents):
|
| 1916 |
+
"""`{document key: {app id: identity}}`: the oldest live copy of each unshared identity one account holds."""
|
| 1917 |
groups = {}
|
| 1918 |
for key, doc in documents.items():
|
| 1919 |
for app_id, app in doc["applications"].items():
|
|
|
|
| 1928 |
if any((app.get("share") if isinstance(app.get("share"), dict) else {}).get("mode") == "tenant"
|
| 1929 |
for _key, _app_id, app in copies):
|
| 1930 |
continue
|
| 1931 |
+
key, app_id, app = min(copies, key=lambda row: (str(row[2].get("createdAt") or ""),
|
| 1932 |
+
str(row[2].get("id") or "")))
|
| 1933 |
+
# Another account's copy would list beside the shared one: that account would see two.
|
| 1934 |
+
if _sole_holder(app, [row[2] for row in copies]):
|
| 1935 |
+
plan.setdefault(key, {})[app_id] = identity
|
| 1936 |
return plan
|
| 1937 |
|
| 1938 |
|
| 1939 |
def migrate_template_shares(runtime, tenant):
|
| 1940 |
+
"""Share with the tenant the oldest live copy of each unshared template identity one account holds.
|
| 1941 |
|
| 1942 |
Writes only a document that holds a copy to share, so a second run writes nothing.
|
| 1943 |
"""
|
web/public/AIOS_DEPLOY_RECEIPT
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
|
|
|
|
| 1 |
+
f127dbd18a4a8d68563b5ec451b6f4293cf81f975be98f8ab653ff654bd6c696
|
web/src/apps/AppRail.tsx
CHANGED
|
@@ -119,6 +119,13 @@ export function AppRail({ appId }: { appId: string }) {
|
|
| 119 |
return <nav className={"app-rail" + (folded ? " is-collapsed" : "") + (narrow && narrowOpen ? " is-narrow-open" : "")}
|
| 120 |
aria-label="Apps" data-app-rail={appId}>
|
| 121 |
<div className="app-rail-top">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 122 |
<span className="app-rail-title">Apps</span>
|
| 123 |
<button type="button" className="cg-rail-toggle" aria-label={toggleLabel} title={toggleLabel}
|
| 124 |
aria-expanded={!folded} onClick={narrow ? () => setNarrowOpen(open => !open) : toggleRail}>
|
|
|
|
| 119 |
return <nav className={"app-rail" + (folded ? " is-collapsed" : "") + (narrow && narrowOpen ? " is-narrow-open" : "")}
|
| 120 |
aria-label="Apps" data-app-rail={appId}>
|
| 121 |
<div className="app-rail-top">
|
| 122 |
+
{/* The Table rail's Back control, matched by class: it opens the Apps home. */}
|
| 123 |
+
<a className="cg-path-history-button" href="#/app" aria-label="Back to Apps" title="Back to Apps">
|
| 124 |
+
<svg viewBox="0 0 16 16" width="16" height="16" fill="none" aria-hidden="true">
|
| 125 |
+
<path d="M9.8 3.6 5.4 8l4.4 4.4" stroke="currentColor" strokeWidth="1.35"
|
| 126 |
+
strokeLinecap="round" strokeLinejoin="round" />
|
| 127 |
+
</svg>
|
| 128 |
+
</a>
|
| 129 |
<span className="app-rail-title">Apps</span>
|
| 130 |
<button type="button" className="cg-rail-toggle" aria-label={toggleLabel} title={toggleLabel}
|
| 131 |
aria-expanded={!folded} onClick={narrow ? () => setNarrowOpen(open => !open) : toggleRail}>
|
web/src/customer-grid/AppFrame.tsx
CHANGED
|
@@ -10,13 +10,13 @@ interface AppFrameProps {
|
|
| 10 |
|
| 11 |
export function AppFrame({ appName, actions, rail, children }: AppFrameProps) {
|
| 12 |
const header = <header className="cg-map-bar cg-app-frame-header">
|
| 13 |
-
<a className="cg-app-frame-back" href="#/app">Back to Apps</a>
|
| 14 |
<span className="cg-app-map-name cg-app-frame-name" title={appName} aria-label="App name">
|
| 15 |
<strong>{appName}</strong>
|
| 16 |
</span>
|
| 17 |
{actions}
|
| 18 |
</header>;
|
| 19 |
-
// With a rail, the header and body share one column beside it.
|
| 20 |
return rail
|
| 21 |
? <>{rail}<div className="cg-app-frame-main">{header}{children}</div></>
|
| 22 |
: <>{header}{children}</>;
|
|
|
|
| 10 |
|
| 11 |
export function AppFrame({ appName, actions, rail, children }: AppFrameProps) {
|
| 12 |
const header = <header className="cg-map-bar cg-app-frame-header">
|
| 13 |
+
{rail ? null : <a className="cg-app-frame-back" href="#/app">Back to Apps</a>}
|
| 14 |
<span className="cg-app-map-name cg-app-frame-name" title={appName} aria-label="App name">
|
| 15 |
<strong>{appName}</strong>
|
| 16 |
</span>
|
| 17 |
{actions}
|
| 18 |
</header>;
|
| 19 |
+
// With a rail, the header and body share one column beside it, and the rail carries the Back.
|
| 20 |
return rail
|
| 21 |
? <>{rail}<div className="cg-app-frame-main">{header}{children}</div></>
|
| 22 |
: <>{header}{children}</>;
|
web/src/customer-grid/viewModes.tsx
CHANGED
|
@@ -107,7 +107,7 @@ export function appViewAvailable(view: unknown): view is string {
|
|
| 107 |
return typeof view === "string" && /^[a-z0-9-]+$/.test(view) && appViewPath(view) in APP_VIEWS;
|
| 108 |
}
|
| 109 |
|
| 110 |
-
/** C2: the one frame around every App screen: the App rail
|
| 111 |
export function AppViewFrame({ application, children }: { application: TemplateApplication; children?: ReactNode }) {
|
| 112 |
return <div className="cg-app-frame-catalog" data-app-view={application.templateView}>
|
| 113 |
<AppFrame appName={application.name}
|
|
|
|
| 107 |
return typeof view === "string" && /^[a-z0-9-]+$/.test(view) && appViewPath(view) in APP_VIEWS;
|
| 108 |
}
|
| 109 |
|
| 110 |
+
/** C2: the one frame around every App screen: the App rail with its Back, its name, the connector mark. */
|
| 111 |
export function AppViewFrame({ application, children }: { application: TemplateApplication; children?: ReactNode }) {
|
| 112 |
return <div className="cg-app-frame-catalog" data-app-view={application.templateView}>
|
| 113 |
<AppFrame appName={application.name}
|