@agimon-ai/po-template-advanced 0.0.0-alpha.75 → 0.0.0-alpha.76
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/extensions/native.mjs +46 -33
- package/dist/extensions/native.mjs.map +1 -1
- package/dist/extensions/web.mjs +49 -28
- package/dist/extensions/web.mjs.map +1 -1
- package/dist/webClient.cjs +49 -28
- package/dist/webClient.cjs.map +1 -1
- package/dist/webClient.mjs +49 -28
- package/dist/webClient.mjs.map +1 -1
- package/package.json +7 -7
|
@@ -3,7 +3,7 @@ import { View } from "react-native-unistyles/components/native/View";
|
|
|
3
3
|
import { Text } from "react-native-unistyles/components/native/Text";
|
|
4
4
|
import { SectionList } from "react-native-unistyles/components/native/SectionList";
|
|
5
5
|
import { Pressable } from "react-native-unistyles/components/native/Pressable";
|
|
6
|
-
import { ActivityIcon, AlertIcon, Badge, BranchIcon, Button, CheckIcon, CountBadge, EditIcon, EmptyState, FolderIcon, ForkIcon, HostTag, InfoStrip, Input, KebabIcon, Label, ListRow, LiveDuration, PlusIcon, Sheet, SheetBody, SheetContent, SheetHeader, SheetTitle, Spinner, Textarea, TrashIcon, UsersIcon, fontOf } from "@agimon-ai/po-native-components";
|
|
6
|
+
import { ActivityIcon, AlertIcon, Badge, BranchIcon, Button, CheckIcon, CountBadge, DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger, EditIcon, EmptyState, FolderIcon, ForkIcon, HostTag, InfoStrip, Input, KebabIcon, Label, ListRow, LiveDuration, PlusIcon, Sheet, SheetBody, SheetContent, SheetHeader, SheetTitle, Spinner, Textarea, TrashIcon, UsersIcon, fontOf } from "@agimon-ai/po-native-components";
|
|
7
7
|
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
8
8
|
import { StyleSheet } from "react-native-unistyles";
|
|
9
9
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -1370,6 +1370,28 @@ function sessionSections(workspaces, presentation, selectedHost = null) {
|
|
|
1370
1370
|
}
|
|
1371
1371
|
return sections;
|
|
1372
1372
|
}
|
|
1373
|
+
function SessionCreateMenu({ onCreateWorkspace, onCreateSession, workspaceDisabled = false, sessionDisabled = false, defaultOpen = false }) {
|
|
1374
|
+
return /* @__PURE__ */ jsxs(DropdownMenu, {
|
|
1375
|
+
defaultOpen,
|
|
1376
|
+
children: [/* @__PURE__ */ jsx(DropdownMenuTrigger, {
|
|
1377
|
+
variant: "ghost",
|
|
1378
|
+
size: "icon",
|
|
1379
|
+
accessibilityLabel: "Create workspace or session",
|
|
1380
|
+
children: /* @__PURE__ */ jsx(PlusIcon, {
|
|
1381
|
+
size: 18,
|
|
1382
|
+
color: "dim"
|
|
1383
|
+
})
|
|
1384
|
+
}), /* @__PURE__ */ jsxs(DropdownMenuContent, { children: [onCreateWorkspace ? /* @__PURE__ */ jsx(DropdownMenuItem, {
|
|
1385
|
+
disabled: workspaceDisabled,
|
|
1386
|
+
onSelect: onCreateWorkspace,
|
|
1387
|
+
children: "Create workspace"
|
|
1388
|
+
}) : null, onCreateSession ? /* @__PURE__ */ jsx(DropdownMenuItem, {
|
|
1389
|
+
disabled: sessionDisabled,
|
|
1390
|
+
onSelect: onCreateSession,
|
|
1391
|
+
children: "Create session"
|
|
1392
|
+
}) : null] })]
|
|
1393
|
+
});
|
|
1394
|
+
}
|
|
1373
1395
|
/** The cockpit's workspace groups, with computers as a display filter rather than separate rails. */
|
|
1374
1396
|
function AdvancedSessions({ workspaces, openSession, actions, setHeaderAction, hostPresentation }) {
|
|
1375
1397
|
const [selectedHost, setSelectedHost] = useState(hostPresentation?.initialHostId ?? null);
|
|
@@ -1421,27 +1443,31 @@ function AdvancedSessions({ workspaces, openSession, actions, setHeaderAction, h
|
|
|
1421
1443
|
} else if (hosts.length > 1) setChoosing("general");
|
|
1422
1444
|
else generalAction.current?.();
|
|
1423
1445
|
}, [hosts, selected]);
|
|
1446
|
+
const workspaceDisabled = hosts.length === 1 && hosts[0].status !== "connected";
|
|
1447
|
+
const generalHost = hosts.find((host) => host.id === selected) ?? (hosts.length === 1 ? hosts[0] : void 0);
|
|
1448
|
+
const sessionDisabled = generalHost !== void 0 && (generalHost.status !== "connected" || generalHost.createGeneralSession === void 0);
|
|
1449
|
+
const createMenu = useMemo(() => /* @__PURE__ */ jsx(SessionCreateMenu, {
|
|
1450
|
+
onCreateWorkspace: canAdd ? beginAdd : void 0,
|
|
1451
|
+
onCreateSession: canGeneral ? beginGeneral : void 0,
|
|
1452
|
+
workspaceDisabled,
|
|
1453
|
+
sessionDisabled
|
|
1454
|
+
}), [
|
|
1455
|
+
canAdd,
|
|
1456
|
+
canGeneral,
|
|
1457
|
+
beginAdd,
|
|
1458
|
+
beginGeneral,
|
|
1459
|
+
workspaceDisabled,
|
|
1460
|
+
sessionDisabled
|
|
1461
|
+
]);
|
|
1424
1462
|
const titleAdd = (canGeneral || canAdd) && setHeaderAction !== void 0;
|
|
1425
1463
|
useEffect(() => {
|
|
1426
1464
|
if (!titleAdd) return;
|
|
1427
|
-
setHeaderAction(
|
|
1428
|
-
label: canGeneral ? "New session" : "Add workspace",
|
|
1429
|
-
onPress: canGeneral ? beginGeneral : beginAdd,
|
|
1430
|
-
disabled: canGeneral && selected !== null ? hosts.find((host) => host.id === selected)?.status !== "connected" : hosts.length === 1 && hosts[0].status !== "connected",
|
|
1431
|
-
children: /* @__PURE__ */ jsx(PlusIcon, {
|
|
1432
|
-
size: 18,
|
|
1433
|
-
color: "dim"
|
|
1434
|
-
})
|
|
1435
|
-
}));
|
|
1465
|
+
setHeaderAction(createMenu);
|
|
1436
1466
|
return () => setHeaderAction(null);
|
|
1437
1467
|
}, [
|
|
1438
1468
|
titleAdd,
|
|
1439
1469
|
setHeaderAction,
|
|
1440
|
-
|
|
1441
|
-
beginGeneral,
|
|
1442
|
-
canGeneral,
|
|
1443
|
-
hosts,
|
|
1444
|
-
selected
|
|
1470
|
+
createMenu
|
|
1445
1471
|
]);
|
|
1446
1472
|
const sessions = workspaces.flatMap((workspace) => workspace.sessions).filter((session) => !stale(session.id));
|
|
1447
1473
|
const { setSessionGroups, renameGroup, deleteGroup, removePendingSetup } = actions;
|
|
@@ -1503,24 +1529,11 @@ function AdvancedSessions({ workspaces, openSession, actions, setHeaderAction, h
|
|
|
1503
1529
|
}),
|
|
1504
1530
|
ListHeaderComponent: /* @__PURE__ */ jsxs(View, {
|
|
1505
1531
|
style: styles.listHeader,
|
|
1506
|
-
children: [
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
}, host.id)),
|
|
1512
|
-
canGeneral && !titleAdd ? /* @__PURE__ */ jsx(Button, {
|
|
1513
|
-
variant: "ghost",
|
|
1514
|
-
onPress: beginGeneral,
|
|
1515
|
-
children: "New session"
|
|
1516
|
-
}) : null,
|
|
1517
|
-
canAdd && (canGeneral || !titleAdd) ? /* @__PURE__ */ jsx(Button, {
|
|
1518
|
-
variant: "ghost",
|
|
1519
|
-
onPress: beginAdd,
|
|
1520
|
-
disabled: hosts.length === 1 && hosts[0].status !== "connected",
|
|
1521
|
-
children: "Add workspace"
|
|
1522
|
-
}) : null
|
|
1523
|
-
]
|
|
1532
|
+
children: [hosts.filter((host) => host.status !== "connected" && (selected === null || selected === host.id)).map((host) => /* @__PURE__ */ jsx(InfoStrip, {
|
|
1533
|
+
message: host.status === "update_required" ? `${host.label} needs an app update. Sessions are read-only.` : `${host.label} is offline. Showing last known sessions.`,
|
|
1534
|
+
actionLabel: "Retry",
|
|
1535
|
+
onAction: host.onRetry
|
|
1536
|
+
}, host.id)), (canGeneral || canAdd) && !titleAdd ? createMenu : null]
|
|
1524
1537
|
})
|
|
1525
1538
|
}),
|
|
1526
1539
|
/* @__PURE__ */ jsx(SessionMenuSheet, {
|