@sixb/app 0.2.5 → 0.2.7
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/agent/components/agent-threads.d.ts.map +1 -1
- package/dist/agent/components/composer-place.d.ts.map +1 -1
- package/dist/agent/components/computer-place.d.ts +24 -6
- package/dist/agent/components/computer-place.d.ts.map +1 -1
- package/dist/agent/components/conversation-panel.d.ts.map +1 -1
- package/dist/agent/components/message-view.d.ts +13 -3
- package/dist/agent/components/message-view.d.ts.map +1 -1
- package/dist/agent/components/pending-messages.d.ts.map +1 -1
- package/dist/agent/components/sandbox-recovery.d.ts +8 -2
- package/dist/agent/components/sandbox-recovery.d.ts.map +1 -1
- package/dist/agent/components/transcript.d.ts +13 -0
- package/dist/agent/components/transcript.d.ts.map +1 -1
- package/dist/agent/conversation.d.ts +4 -0
- package/dist/agent/conversation.d.ts.map +1 -1
- package/dist/agent/delegation/use-children.d.ts +5 -5
- package/dist/agent/delegation/use-children.d.ts.map +1 -1
- package/dist/agent/format.d.ts +7 -0
- package/dist/agent/format.d.ts.map +1 -1
- package/dist/agent/hooks/thread-queries.d.ts +1548 -0
- package/dist/agent/hooks/thread-queries.d.ts.map +1 -0
- package/dist/agent/hooks/use-agent-conversation.d.ts +41 -2
- package/dist/agent/hooks/use-agent-conversation.d.ts.map +1 -1
- package/dist/agent/hooks/use-thread-lists.d.ts +80 -3
- package/dist/agent/hooks/use-thread-lists.d.ts.map +1 -1
- package/dist/agent/hooks/use-thread-place.d.ts +49 -0
- package/dist/agent/hooks/use-thread-place.d.ts.map +1 -0
- package/dist/agent/i18n/en.d.ts +44 -6
- package/dist/agent/i18n/en.d.ts.map +1 -1
- package/dist/agent/i18n/fr.d.ts.map +1 -1
- package/dist/agent/i18n/index.d.ts +76 -12
- package/dist/agent/i18n/index.d.ts.map +1 -1
- package/dist/agent/live-run.d.ts.map +1 -1
- package/dist/agent/model-selection.d.ts +3 -2
- package/dist/agent/model-selection.d.ts.map +1 -1
- package/dist/agent/moves.d.ts +40 -0
- package/dist/agent/moves.d.ts.map +1 -0
- package/dist/agent/thread-reader-state.d.ts +30 -0
- package/dist/agent/thread-reader-state.d.ts.map +1 -0
- package/dist/agent/types.d.ts +4 -0
- package/dist/agent/types.d.ts.map +1 -1
- package/dist/artifacts/live/session.d.ts.map +1 -1
- package/dist/artifacts/queries.d.ts.map +1 -1
- package/dist/artifacts/renderers/live-frame.d.ts.map +1 -1
- package/dist/{chunk-69qgh20f.js → chunk-1f4h75n3.js} +1 -1
- package/dist/{chunk-4fex83k2.js → chunk-7v9622qb.js} +2254 -739
- package/dist/{chunk-4fex83k2.js.map → chunk-7v9622qb.js.map} +29 -26
- package/dist/{chunk-5sgac68y.js → chunk-dntecmwb.js} +1 -1
- package/dist/{chunk-4wm09prf.js → chunk-qmka6aea.js} +1 -1
- package/dist/createCustomApp.d.ts +8 -1
- package/dist/createCustomApp.d.ts.map +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -2
- package/dist/index.js.map +3 -3
- package/dist/pages/console/data/accounts.d.ts +94 -0
- package/dist/pages/console/data/accounts.d.ts.map +1 -0
- package/dist/pages/console/data/connectors.d.ts.map +1 -1
- package/dist/pages/console/data/datasets.d.ts.map +1 -1
- package/dist/pages/console/data/live-updates.d.ts.map +1 -1
- package/dist/pages/console/data/messages.d.ts +46 -0
- package/dist/pages/console/data/messages.d.ts.map +1 -1
- package/dist/pages/console/data/pipelines.d.ts.map +1 -1
- package/dist/pages/console/data/projections.d.ts.map +1 -1
- package/dist/pages/console/data/sync-button.d.ts.map +1 -1
- package/dist/pages/console/data/syncs.d.ts.map +1 -1
- package/dist/pages/console/ontology/actions.d.ts.map +1 -1
- package/dist/pages/console/ontology/object-type.d.ts.map +1 -1
- package/dist/pages/console/ontology/object-types.d.ts.map +1 -1
- package/dist/pages/console/ontology/rules.d.ts.map +1 -1
- package/dist/pages/console/ontology/workflow.d.ts.map +1 -1
- package/dist/pages/console/ontology/workflows.d.ts.map +1 -1
- package/dist/pages/folders.d.ts +106 -0
- package/dist/pages/folders.d.ts.map +1 -0
- package/dist/pages/settings/usage/breakdown.d.ts.map +1 -1
- package/dist/pages/settings/usage/page.d.ts +4 -1
- package/dist/pages/settings/usage/page.d.ts.map +1 -1
- package/dist/pages/settings/usage/spend-model.d.ts +43 -19
- package/dist/pages/settings/usage/spend-model.d.ts.map +1 -1
- package/dist/pages.js +23453 -22656
- package/dist/pages.js.map +23 -21
- package/dist/server.d.ts +1 -1
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +40 -3
- package/dist/server.js.map +3 -3
- package/package.json +3 -3
- package/src/agent/agent-chat.tsx +2 -2
- package/src/agent/components/agent-threads.tsx +42 -2
- package/src/agent/components/composer-place.tsx +2 -7
- package/src/agent/components/computer-place.tsx +415 -70
- package/src/agent/components/conversation-panel.tsx +31 -26
- package/src/agent/components/message-view.tsx +418 -9
- package/src/agent/components/pending-messages.tsx +5 -1
- package/src/agent/components/sandbox-recovery.tsx +24 -6
- package/src/agent/components/transcript.tsx +136 -5
- package/src/agent/conversation.ts +16 -1
- package/src/agent/format.ts +52 -0
- package/src/agent/hooks/thread-queries.ts +75 -0
- package/src/agent/hooks/use-agent-conversation.ts +461 -112
- package/src/agent/hooks/use-thread-lists.ts +72 -7
- package/src/agent/hooks/use-thread-place.ts +239 -0
- package/src/agent/i18n/en.ts +69 -16
- package/src/agent/i18n/fr.ts +71 -19
- package/src/agent/live-run.ts +38 -0
- package/src/agent/model-selection.ts +3 -2
- package/src/agent/moves.ts +174 -0
- package/src/agent/thread-reader-state.ts +75 -0
- package/src/agent/types.ts +6 -0
- package/src/artifacts/live/session.ts +5 -0
- package/src/createCustomApp.ts +57 -3
- package/src/index.ts +4 -0
- package/src/pages/console/data/accounts.tsx +509 -0
- package/src/pages/console/data/connectors.tsx +67 -64
- package/src/pages/console/data/datasets.tsx +79 -68
- package/src/pages/console/data/live-updates.ts +2 -0
- package/src/pages/console/data/messages.ts +73 -0
- package/src/pages/console/data/pipelines.tsx +80 -69
- package/src/pages/console/data/projections.tsx +111 -82
- package/src/pages/console/data/sync-button.tsx +56 -16
- package/src/pages/console/data/syncs.tsx +121 -86
- package/src/pages/console/ontology/actions.tsx +51 -24
- package/src/pages/console/ontology/object-type.tsx +5 -1
- package/src/pages/console/ontology/object-types.tsx +41 -32
- package/src/pages/console/ontology/rules.tsx +48 -38
- package/src/pages/console/ontology/workflow.tsx +9 -3
- package/src/pages/console/ontology/workflows.tsx +55 -67
- package/src/pages/folders.tsx +335 -0
- package/src/pages/section-ui.tsx +1 -1
- package/src/pages/settings/usage/breakdown.tsx +5 -2
- package/src/pages/settings/usage/filter-menu.tsx +1 -1
- package/src/pages/settings/usage/page.tsx +32 -13
- package/src/pages/settings/usage/spend-chart.tsx +2 -2
- package/src/pages/settings/usage/spend-model.ts +118 -50
- package/src/server.ts +1 -0
- /package/dist/{chunk-69qgh20f.js.map → chunk-1f4h75n3.js.map} +0 -0
- /package/dist/{chunk-5sgac68y.js.map → chunk-dntecmwb.js.map} +0 -0
- /package/dist/{chunk-4wm09prf.js.map → chunk-qmka6aea.js.map} +0 -0
|
@@ -46,6 +46,7 @@ import {
|
|
|
46
46
|
import { type ReactElement, type SyntheticEvent, useCallback, useMemo, useState } from "react"
|
|
47
47
|
import { useNavigate, useSearchParams } from "react-router-dom"
|
|
48
48
|
import { useSectionOpen } from "../../../sections/sections"
|
|
49
|
+
import { FolderContents, noItems, useFolderBrowser } from "../../folders"
|
|
49
50
|
import { actionRunHref } from "../../routes"
|
|
50
51
|
import { notify, SectionPage } from "../../section-page"
|
|
51
52
|
import {
|
|
@@ -94,6 +95,17 @@ export function ConsoleActionsPage() {
|
|
|
94
95
|
const count = countQuery.data?.length
|
|
95
96
|
const [searchParams, setSearchParams] = useSearchParams()
|
|
96
97
|
const view = searchParams.get("view") === "runs" ? "runs" : "actions"
|
|
98
|
+
// The list below arranges the same actions by the same URL; this is its header.
|
|
99
|
+
const browser = useFolderBrowser({
|
|
100
|
+
items: countQuery.data ?? noItems,
|
|
101
|
+
title: "Actions",
|
|
102
|
+
meta: countQuery.isPending ? (
|
|
103
|
+
<CountSkeleton />
|
|
104
|
+
) : count === undefined ? undefined : (
|
|
105
|
+
<span>{`${count} action${count === 1 ? "" : "s"}`}</span>
|
|
106
|
+
),
|
|
107
|
+
narrowed: view === "runs" || actionFiltersActive(searchParams),
|
|
108
|
+
})
|
|
97
109
|
// Each view has its own filters, so switching starts them clear.
|
|
98
110
|
const showView = (next: "actions" | "runs") =>
|
|
99
111
|
setSearchParams(next === "runs" ? { view: "runs" } : {})
|
|
@@ -113,19 +125,7 @@ export function ConsoleActionsPage() {
|
|
|
113
125
|
)
|
|
114
126
|
|
|
115
127
|
return (
|
|
116
|
-
<SectionPage
|
|
117
|
-
section="console"
|
|
118
|
-
page="actions"
|
|
119
|
-
width="wide"
|
|
120
|
-
title="Actions"
|
|
121
|
-
meta={
|
|
122
|
-
countQuery.isPending ? (
|
|
123
|
-
<CountSkeleton />
|
|
124
|
-
) : count === undefined ? undefined : (
|
|
125
|
-
<span>{`${count} action${count === 1 ? "" : "s"}`}</span>
|
|
126
|
-
)
|
|
127
|
-
}
|
|
128
|
-
>
|
|
128
|
+
<SectionPage section="console" page="actions" width="wide" {...browser.frame}>
|
|
129
129
|
<ToolbarTabs
|
|
130
130
|
className="-mt-4"
|
|
131
131
|
value={view}
|
|
@@ -188,12 +188,23 @@ function ActionDefinitionsTab() {
|
|
|
188
188
|
if (scope === "object" && !action.objectTypeId) return false
|
|
189
189
|
if (objectType !== "all" && action.objectTypeId !== objectType) return false
|
|
190
190
|
if (!normalizedQuery) return true
|
|
191
|
-
return [
|
|
191
|
+
return [
|
|
192
|
+
action.id,
|
|
193
|
+
humanizeIdentifier(action.id),
|
|
194
|
+
action.description,
|
|
195
|
+
action.objectTypeId,
|
|
196
|
+
action.folder,
|
|
197
|
+
]
|
|
192
198
|
.filter((value): value is string => typeof value === "string")
|
|
193
199
|
.some((value) => value.toLowerCase().includes(normalizedQuery))
|
|
194
200
|
})
|
|
195
201
|
}, [actions, objectType, query, scope])
|
|
196
|
-
const filtersActive =
|
|
202
|
+
const filtersActive = actionFiltersActive(searchParams)
|
|
203
|
+
const browser = useFolderBrowser({
|
|
204
|
+
items: filteredActions,
|
|
205
|
+
title: "Actions",
|
|
206
|
+
narrowed: filtersActive,
|
|
207
|
+
})
|
|
197
208
|
|
|
198
209
|
const updateFilterParam = (key: "q" | "type", value: string) => {
|
|
199
210
|
setSearchParams(
|
|
@@ -318,15 +329,19 @@ function ActionDefinitionsTab() {
|
|
|
318
329
|
))}
|
|
319
330
|
</div>
|
|
320
331
|
) : filteredActions.length > 0 ? (
|
|
321
|
-
<
|
|
322
|
-
{
|
|
323
|
-
<
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
332
|
+
<FolderContents browser={browser} rootLabel="Actions">
|
|
333
|
+
{(shown) => (
|
|
334
|
+
<div className="grid gap-3 lg:grid-cols-2">
|
|
335
|
+
{shown.map((action) => (
|
|
336
|
+
<ActionCard
|
|
337
|
+
key={action.id}
|
|
338
|
+
action={action}
|
|
339
|
+
latestRun={latestRunByAction.get(action.id)}
|
|
340
|
+
/>
|
|
341
|
+
))}
|
|
342
|
+
</div>
|
|
343
|
+
)}
|
|
344
|
+
</FolderContents>
|
|
330
345
|
) : (
|
|
331
346
|
<PanelEmpty
|
|
332
347
|
icon={Search}
|
|
@@ -340,6 +355,18 @@ function ActionDefinitionsTab() {
|
|
|
340
355
|
)
|
|
341
356
|
}
|
|
342
357
|
|
|
358
|
+
/** Whether the URL narrows the actions, so they show by folder no longer but all matches at once. */
|
|
359
|
+
function actionFiltersActive(params: URLSearchParams): boolean {
|
|
360
|
+
const scope = params.get("scope")
|
|
361
|
+
const type = params.get("type")
|
|
362
|
+
return (
|
|
363
|
+
(params.get("q") ?? "").trim().length > 0 ||
|
|
364
|
+
scope === "global" ||
|
|
365
|
+
scope === "object" ||
|
|
366
|
+
(type !== null && type !== "all" && scope !== "global")
|
|
367
|
+
)
|
|
368
|
+
}
|
|
369
|
+
|
|
343
370
|
function ActionsFailure({ error }: { readonly error: unknown }) {
|
|
344
371
|
const failure = useLoadFailure(error)
|
|
345
372
|
return (
|
|
@@ -23,6 +23,7 @@ import { useQuery } from "@tanstack/react-query"
|
|
|
23
23
|
import { Box, ChevronRight, LayoutGrid, Network } from "lucide-react"
|
|
24
24
|
import { Fragment, type ReactNode, useMemo } from "react"
|
|
25
25
|
import { Link, useNavigate, useParams, useSearchParams } from "react-router-dom"
|
|
26
|
+
import { folderBack } from "../../folders"
|
|
26
27
|
import { graphTypeHref, objectsOfTypeHref, objectTypeHref } from "../../routes"
|
|
27
28
|
import { DetailFallback, SectionPage } from "../../section-page"
|
|
28
29
|
import { SkeletonText } from "../../section-ui"
|
|
@@ -103,7 +104,10 @@ export function ConsoleObjectTypePage() {
|
|
|
103
104
|
const resolvedTab: TabValue =
|
|
104
105
|
activeTab === "projections" && projectionCount === 0 ? DEFAULT_TAB : activeTab
|
|
105
106
|
|
|
106
|
-
const back =
|
|
107
|
+
const back = folderBack(
|
|
108
|
+
{ href: "/console/object-types", label: "Object types" },
|
|
109
|
+
objectType?.folder
|
|
110
|
+
)
|
|
107
111
|
if (!objectType) {
|
|
108
112
|
return (
|
|
109
113
|
<DetailFallback
|
|
@@ -5,6 +5,7 @@ import { useQuery } from "@tanstack/react-query"
|
|
|
5
5
|
import { CornerDownRight, LayoutGrid, Link2, Rows3, Zap } from "lucide-react"
|
|
6
6
|
import { useMemo, useState } from "react"
|
|
7
7
|
import { useNavigate } from "react-router-dom"
|
|
8
|
+
import { FolderContents, useFolderBrowser } from "../../folders"
|
|
8
9
|
import { objectTypeHref } from "../../routes"
|
|
9
10
|
import { SectionPage } from "../../section-page"
|
|
10
11
|
import { apiErrorMessage, PanelEmpty, SkeletonText } from "../../section-ui"
|
|
@@ -28,31 +29,33 @@ export function ConsoleObjectTypesPage() {
|
|
|
28
29
|
const typesQuery = useQuery({ ...listObjectTypesOptions(), retry: false })
|
|
29
30
|
const objectTypes = typesQuery.data ?? noObjectTypes
|
|
30
31
|
const byId = useMemo(() => new Map(objectTypes.map((type) => [type.id, type])), [objectTypes])
|
|
32
|
+
const query = search.trim().toLowerCase()
|
|
31
33
|
const filtered = useMemo(() => {
|
|
32
34
|
const sorted = [...objectTypes].sort((a, b) => displayName(a).localeCompare(displayName(b)))
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
35
|
+
return query
|
|
36
|
+
? sorted.filter(
|
|
37
|
+
(type) => matchesType(type, query) || type.folder?.toLowerCase().includes(query)
|
|
38
|
+
)
|
|
39
|
+
: sorted
|
|
40
|
+
}, [objectTypes, query])
|
|
41
|
+
const browser = useFolderBrowser({
|
|
42
|
+
items: filtered,
|
|
43
|
+
title: "Object types",
|
|
44
|
+
meta: typesQuery.isPending ? (
|
|
45
|
+
<CountSkeleton />
|
|
46
|
+
) : (
|
|
47
|
+
<span>{countLabel(objectTypes.length, "type")}</span>
|
|
48
|
+
),
|
|
49
|
+
narrowed: query.length > 0,
|
|
50
|
+
})
|
|
36
51
|
|
|
37
52
|
return (
|
|
38
|
-
<SectionPage
|
|
39
|
-
section="console"
|
|
40
|
-
page="object-types"
|
|
41
|
-
width="wide"
|
|
42
|
-
title="Object types"
|
|
43
|
-
meta={
|
|
44
|
-
typesQuery.isPending ? (
|
|
45
|
-
<CountSkeleton />
|
|
46
|
-
) : (
|
|
47
|
-
<span>{countLabel(objectTypes.length, "type")}</span>
|
|
48
|
-
)
|
|
49
|
-
}
|
|
50
|
-
>
|
|
53
|
+
<SectionPage section="console" page="object-types" width="wide" {...browser.frame}>
|
|
51
54
|
<div className="-mt-4 flex flex-col">
|
|
52
55
|
<CollectionToolbar
|
|
53
56
|
search={{
|
|
54
57
|
value: search,
|
|
55
|
-
placeholder: "Search types, fields, or links...",
|
|
58
|
+
placeholder: "Search types, fields, folders, or links...",
|
|
56
59
|
onChange: setSearch,
|
|
57
60
|
}}
|
|
58
61
|
/>
|
|
@@ -72,19 +75,25 @@ export function ConsoleObjectTypesPage() {
|
|
|
72
75
|
No types matching "{search}".
|
|
73
76
|
</div>
|
|
74
77
|
) : (
|
|
75
|
-
<div className=
|
|
76
|
-
<
|
|
77
|
-
{
|
|
78
|
-
<
|
|
79
|
-
<
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
78
|
+
<div className="mt-2">
|
|
79
|
+
<FolderContents browser={browser} rootLabel="Object types">
|
|
80
|
+
{(types) => (
|
|
81
|
+
<div className={typeListClass}>
|
|
82
|
+
<ul className="divide-y divide-border">
|
|
83
|
+
{types.map((type) => (
|
|
84
|
+
<li key={type.id}>
|
|
85
|
+
<TypeRow
|
|
86
|
+
type={type}
|
|
87
|
+
parent={type.extends ? (byId.get(type.extends) ?? null) : null}
|
|
88
|
+
onSelect={() => navigate(objectTypeHref(type.id))}
|
|
89
|
+
onSelectType={(typeId) => navigate(objectTypeHref(typeId))}
|
|
90
|
+
/>
|
|
91
|
+
</li>
|
|
92
|
+
))}
|
|
93
|
+
</ul>
|
|
94
|
+
</div>
|
|
95
|
+
)}
|
|
96
|
+
</FolderContents>
|
|
88
97
|
</div>
|
|
89
98
|
)}
|
|
90
99
|
</div>
|
|
@@ -93,13 +102,13 @@ export function ConsoleObjectTypesPage() {
|
|
|
93
102
|
}
|
|
94
103
|
|
|
95
104
|
const typeListClass =
|
|
96
|
-
"
|
|
105
|
+
"overflow-hidden rounded-xl border border-border bg-card shadow-[0_1px_2px_0_rgb(0_0_0/0.04)]"
|
|
97
106
|
const typeRowClass = "flex items-start gap-4 px-4 py-3.5"
|
|
98
107
|
|
|
99
108
|
/** The list while the types load, row for row the shape of `TypeRow`. */
|
|
100
109
|
function TypeListSkeleton() {
|
|
101
110
|
return (
|
|
102
|
-
<div aria-hidden className={typeListClass}>
|
|
111
|
+
<div aria-hidden className={cn("mt-2", typeListClass)}>
|
|
103
112
|
<ul className="divide-y divide-border">
|
|
104
113
|
{["w-64", "w-52", "w-72", "w-48", "w-60"].map((width) => (
|
|
105
114
|
<li key={width} className={typeRowClass}>
|
|
@@ -20,6 +20,13 @@ import { useQuery } from "@tanstack/react-query"
|
|
|
20
20
|
import { BellRing, ChevronRight, ListChecks, type LucideIcon, Search } from "lucide-react"
|
|
21
21
|
import { useMemo, useState } from "react"
|
|
22
22
|
import { useNavigate, useParams } from "react-router-dom"
|
|
23
|
+
import {
|
|
24
|
+
type FolderBrowser,
|
|
25
|
+
FolderContents,
|
|
26
|
+
folderBack,
|
|
27
|
+
noItems,
|
|
28
|
+
useFolderBrowser,
|
|
29
|
+
} from "../../folders"
|
|
23
30
|
import { objectHref, ruleHref } from "../../routes"
|
|
24
31
|
import { DetailFallback, SectionPage } from "../../section-page"
|
|
25
32
|
import {
|
|
@@ -380,7 +387,7 @@ function RuleTableView({
|
|
|
380
387
|
activeCount,
|
|
381
388
|
onSelect,
|
|
382
389
|
}: {
|
|
383
|
-
rules: ListRulesResponse
|
|
390
|
+
rules: readonly ListRulesResponse[number][]
|
|
384
391
|
activeCount: (ruleId: string) => ActiveStateCount
|
|
385
392
|
onSelect: (ruleId: string) => void
|
|
386
393
|
}) {
|
|
@@ -654,13 +661,13 @@ function RuleStatesSkeleton() {
|
|
|
654
661
|
|
|
655
662
|
function RulesContent({
|
|
656
663
|
rules,
|
|
657
|
-
|
|
664
|
+
browser,
|
|
658
665
|
viewStyle,
|
|
659
666
|
activeCount,
|
|
660
667
|
onSelectRule,
|
|
661
668
|
}: {
|
|
662
|
-
rules: ListRulesResponse
|
|
663
|
-
|
|
669
|
+
rules: readonly ListRulesResponse[number][]
|
|
670
|
+
browser: FolderBrowser<ListRulesResponse[number]>
|
|
664
671
|
viewStyle: RulesListViewStyle
|
|
665
672
|
activeCount: (ruleId: string) => ActiveStateCount
|
|
666
673
|
onSelectRule: (ruleId: string) => void
|
|
@@ -675,7 +682,7 @@ function RulesContent({
|
|
|
675
682
|
)
|
|
676
683
|
}
|
|
677
684
|
|
|
678
|
-
if (
|
|
685
|
+
if (browser.items.length === 0 && browser.folders.length === 0) {
|
|
679
686
|
return (
|
|
680
687
|
<EmptyState
|
|
681
688
|
icon={<Search className="h-9 w-9" />}
|
|
@@ -686,21 +693,25 @@ function RulesContent({
|
|
|
686
693
|
)
|
|
687
694
|
}
|
|
688
695
|
|
|
689
|
-
if (viewStyle === "table") {
|
|
690
|
-
return <RuleTableView rules={filteredRules} activeCount={activeCount} onSelect={onSelectRule} />
|
|
691
|
-
}
|
|
692
|
-
|
|
693
696
|
return (
|
|
694
|
-
<
|
|
695
|
-
{
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
697
|
+
<FolderContents browser={browser} rootLabel="Rules">
|
|
698
|
+
{(shown) =>
|
|
699
|
+
viewStyle === "table" ? (
|
|
700
|
+
<RuleTableView rules={shown} activeCount={activeCount} onSelect={onSelectRule} />
|
|
701
|
+
) : (
|
|
702
|
+
<CollectionCardGrid>
|
|
703
|
+
{shown.map((rule) => (
|
|
704
|
+
<RuleListItem
|
|
705
|
+
key={rule.id}
|
|
706
|
+
rule={rule}
|
|
707
|
+
activeCount={activeCount(rule.id)}
|
|
708
|
+
onSelect={() => onSelectRule(rule.id)}
|
|
709
|
+
/>
|
|
710
|
+
))}
|
|
711
|
+
</CollectionCardGrid>
|
|
712
|
+
)
|
|
713
|
+
}
|
|
714
|
+
</FolderContents>
|
|
704
715
|
)
|
|
705
716
|
}
|
|
706
717
|
|
|
@@ -715,7 +726,7 @@ export function ConsoleRulesPage() {
|
|
|
715
726
|
getCollectionViewStyle("rules", ["cards", "table"], "cards")
|
|
716
727
|
)
|
|
717
728
|
|
|
718
|
-
const rules = rulesQuery.data ??
|
|
729
|
+
const rules = rulesQuery.data ?? noItems
|
|
719
730
|
const states = statesQuery.data?.states ?? []
|
|
720
731
|
const unknownStates = unknownActiveStates(statesQuery)
|
|
721
732
|
const activeCountByRule = useMemo(() => {
|
|
@@ -730,13 +741,14 @@ export function ConsoleRulesPage() {
|
|
|
730
741
|
const activeCount = (ruleId: string): ActiveStateCount =>
|
|
731
742
|
unknownStates ?? { kind: "known", count: activeCountByRule.get(ruleId) ?? 0 }
|
|
732
743
|
|
|
744
|
+
const query = searchQuery.trim().toLowerCase()
|
|
733
745
|
const filteredRules = useMemo(() => {
|
|
734
|
-
const query = searchQuery.trim().toLowerCase()
|
|
735
746
|
if (!query) return rules
|
|
736
747
|
|
|
737
748
|
return rules.filter((rule) => {
|
|
738
749
|
return (
|
|
739
750
|
rule.id.toLowerCase().includes(query) ||
|
|
751
|
+
rule.folder?.toLowerCase().includes(query) ||
|
|
740
752
|
rule.subject.objectTypeId.toLowerCase().includes(query) ||
|
|
741
753
|
predicateSearchText(rule.predicate).toLowerCase().includes(query) ||
|
|
742
754
|
rule.dependencies.some((dependency) =>
|
|
@@ -744,26 +756,24 @@ export function ConsoleRulesPage() {
|
|
|
744
756
|
)
|
|
745
757
|
)
|
|
746
758
|
})
|
|
747
|
-
}, [rules,
|
|
759
|
+
}, [rules, query])
|
|
760
|
+
const browser = useFolderBrowser({
|
|
761
|
+
items: filteredRules,
|
|
762
|
+
title: "Rules",
|
|
763
|
+
meta: rulesQuery.isPending ? (
|
|
764
|
+
<CountSkeleton />
|
|
765
|
+
) : rulesQuery.data ? (
|
|
766
|
+
<span>{`${rules.length} rule${rules.length === 1 ? "" : "s"}`}</span>
|
|
767
|
+
) : undefined,
|
|
768
|
+
narrowed: query.length > 0,
|
|
769
|
+
})
|
|
748
770
|
|
|
749
771
|
const handleSelectRule = (ruleId: string) => {
|
|
750
772
|
navigate(ruleHref(ruleId))
|
|
751
773
|
}
|
|
752
774
|
|
|
753
775
|
return (
|
|
754
|
-
<SectionPage
|
|
755
|
-
section="console"
|
|
756
|
-
page="rules"
|
|
757
|
-
width="wide"
|
|
758
|
-
title="Rules"
|
|
759
|
-
meta={
|
|
760
|
-
rulesQuery.isPending ? (
|
|
761
|
-
<CountSkeleton />
|
|
762
|
-
) : rulesQuery.data ? (
|
|
763
|
-
<span>{`${rules.length} rule${rules.length === 1 ? "" : "s"}`}</span>
|
|
764
|
-
) : undefined
|
|
765
|
-
}
|
|
766
|
-
>
|
|
776
|
+
<SectionPage section="console" page="rules" width="wide" {...browser.frame}>
|
|
767
777
|
{rulesQuery.isError ? (
|
|
768
778
|
<LoadFailure icon={ListChecks} error={rulesQuery.error} />
|
|
769
779
|
) : (
|
|
@@ -772,7 +782,7 @@ export function ConsoleRulesPage() {
|
|
|
772
782
|
<CollectionToolbar
|
|
773
783
|
search={{
|
|
774
784
|
value: searchQuery,
|
|
775
|
-
placeholder: "Search rules, subjects, or predicates…",
|
|
785
|
+
placeholder: "Search rules, folders, subjects, or predicates…",
|
|
776
786
|
onChange: setSearchQuery,
|
|
777
787
|
}}
|
|
778
788
|
actions={
|
|
@@ -801,7 +811,7 @@ export function ConsoleRulesPage() {
|
|
|
801
811
|
) : (
|
|
802
812
|
<RulesContent
|
|
803
813
|
rules={rules}
|
|
804
|
-
|
|
814
|
+
browser={browser}
|
|
805
815
|
viewStyle={viewStyle}
|
|
806
816
|
activeCount={activeCount}
|
|
807
817
|
onSelectRule={handleSelectRule}
|
|
@@ -842,7 +852,7 @@ export function ConsoleRulePage() {
|
|
|
842
852
|
navigate(objectHref(state.subject.objectTypeId, state.subject.primaryId))
|
|
843
853
|
}
|
|
844
854
|
|
|
845
|
-
const back = { href: "/console/rules", label: "Rules" }
|
|
855
|
+
const back = folderBack({ href: "/console/rules", label: "Rules" }, rule?.folder)
|
|
846
856
|
if (!rule) {
|
|
847
857
|
return (
|
|
848
858
|
<DetailFallback
|
|
@@ -44,6 +44,7 @@ import {
|
|
|
44
44
|
} from "lucide-react"
|
|
45
45
|
import { type ReactNode, useEffect, useMemo } from "react"
|
|
46
46
|
import { Navigate, useNavigate, useParams, useSearchParams } from "react-router-dom"
|
|
47
|
+
import { folderBack } from "../../folders"
|
|
47
48
|
import { DetailFallback, SectionWorkspace } from "../../section-page"
|
|
48
49
|
import {
|
|
49
50
|
CopyButton,
|
|
@@ -156,12 +157,17 @@ export function ConsoleWorkflowPage() {
|
|
|
156
157
|
return <Navigate to="/console/workflows" replace />
|
|
157
158
|
}
|
|
158
159
|
|
|
160
|
+
const back = folderBack(
|
|
161
|
+
{ href: "/console/workflows", label: "Workflows" },
|
|
162
|
+
workflowQuery.data?.folder
|
|
163
|
+
)
|
|
164
|
+
|
|
159
165
|
if (!workflowQuery.data) {
|
|
160
166
|
return (
|
|
161
167
|
<DetailFallback
|
|
162
168
|
section="console"
|
|
163
169
|
page="workflows"
|
|
164
|
-
back={
|
|
170
|
+
back={back}
|
|
165
171
|
name={workflowId}
|
|
166
172
|
id={workflowId}
|
|
167
173
|
icon={GitBranch}
|
|
@@ -170,7 +176,7 @@ export function ConsoleWorkflowPage() {
|
|
|
170
176
|
<div className="relative min-h-0 w-full flex-1">
|
|
171
177
|
<WorkflowHeader
|
|
172
178
|
workflowId={workflowId}
|
|
173
|
-
onBack={() => navigate(
|
|
179
|
+
onBack={() => navigate(back.href)}
|
|
174
180
|
facts={
|
|
175
181
|
<span>
|
|
176
182
|
<SkeletonText className="h-2 w-40" />
|
|
@@ -273,7 +279,7 @@ export function ConsoleWorkflowPage() {
|
|
|
273
279
|
|
|
274
280
|
<WorkflowHeader
|
|
275
281
|
workflowId={workflow.id}
|
|
276
|
-
onBack={() => navigate(
|
|
282
|
+
onBack={() => navigate(back.href)}
|
|
277
283
|
facts={
|
|
278
284
|
activeRunId && runDetail ? (
|
|
279
285
|
<>
|
|
@@ -3,6 +3,7 @@ import { useQuery } from "@tanstack/react-query"
|
|
|
3
3
|
import { Search, Workflow } from "lucide-react"
|
|
4
4
|
import { useMemo } from "react"
|
|
5
5
|
import { useSearchParams } from "react-router-dom"
|
|
6
|
+
import { FolderContents, noItems, useFolderBrowser } from "../../folders"
|
|
6
7
|
import { SectionPage } from "../../section-page"
|
|
7
8
|
import { PanelEmpty, useLoadFailure } from "../../section-ui"
|
|
8
9
|
import { CardSkeleton, CountSkeleton } from "../skeletons"
|
|
@@ -15,37 +16,26 @@ import { WorkflowCard } from "./workflows/workflow-card"
|
|
|
15
16
|
/** Console › Workflows: every workflow with its latest run; each opens its canvas. */
|
|
16
17
|
export function ConsoleWorkflowsPage() {
|
|
17
18
|
useWorkflowLiveUpdates()
|
|
18
|
-
const countQuery = useQuery({ ...listWorkflowsOptions(), retry: false })
|
|
19
|
-
const count = countQuery.data?.length
|
|
20
|
-
return (
|
|
21
|
-
<SectionPage
|
|
22
|
-
section="console"
|
|
23
|
-
page="workflows"
|
|
24
|
-
width="wide"
|
|
25
|
-
title="Workflows"
|
|
26
|
-
meta={
|
|
27
|
-
countQuery.isPending ? (
|
|
28
|
-
<CountSkeleton />
|
|
29
|
-
) : count === undefined ? undefined : (
|
|
30
|
-
<span>{`${count} workflow${count === 1 ? "" : "s"}`}</span>
|
|
31
|
-
)
|
|
32
|
-
}
|
|
33
|
-
>
|
|
34
|
-
<WorkflowDefinitionsTab />
|
|
35
|
-
</SectionPage>
|
|
36
|
-
)
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
function WorkflowDefinitionsTab() {
|
|
40
19
|
const workflowsQuery = useQuery({ ...listWorkflowsOptions(), retry: false })
|
|
41
20
|
const [searchParams, setSearchParams] = useSearchParams()
|
|
42
|
-
const workflows = workflowsQuery.data ??
|
|
21
|
+
const workflows = workflowsQuery.data ?? noItems
|
|
22
|
+
const count = workflowsQuery.data?.length
|
|
43
23
|
const query = searchParams.get("q") ?? ""
|
|
24
|
+
const normalizedQuery = query.trim().toLowerCase()
|
|
44
25
|
const filteredWorkflows = useMemo(() => {
|
|
45
|
-
const normalizedQuery = query.trim().toLowerCase()
|
|
46
26
|
if (!normalizedQuery) return workflows
|
|
47
27
|
return workflows.filter((workflow) => workflowSearchText(workflow).includes(normalizedQuery))
|
|
48
|
-
}, [
|
|
28
|
+
}, [normalizedQuery, workflows])
|
|
29
|
+
const browser = useFolderBrowser({
|
|
30
|
+
items: filteredWorkflows,
|
|
31
|
+
title: "Workflows",
|
|
32
|
+
meta: workflowsQuery.isPending ? (
|
|
33
|
+
<CountSkeleton />
|
|
34
|
+
) : count === undefined ? undefined : (
|
|
35
|
+
<span>{`${count} workflow${count === 1 ? "" : "s"}`}</span>
|
|
36
|
+
),
|
|
37
|
+
narrowed: normalizedQuery.length > 0,
|
|
38
|
+
})
|
|
49
39
|
|
|
50
40
|
const updateQuery = (value: string) => {
|
|
51
41
|
setSearchParams(
|
|
@@ -64,11 +54,11 @@ function WorkflowDefinitionsTab() {
|
|
|
64
54
|
search={{
|
|
65
55
|
value: query,
|
|
66
56
|
onChange: updateQuery,
|
|
67
|
-
placeholder: "Search workflows, nodes, triggers, or inputs…",
|
|
57
|
+
placeholder: "Search workflows, folders, nodes, triggers, or inputs…",
|
|
68
58
|
}}
|
|
69
59
|
// The header counts every workflow; while searching, this counts the matches.
|
|
70
60
|
actions={
|
|
71
|
-
|
|
61
|
+
normalizedQuery && !workflowsQuery.isPending ? (
|
|
72
62
|
<p className="px-1 text-xs tabular-nums text-muted-foreground">
|
|
73
63
|
{`${filteredWorkflows.length} of ${workflows.length} workflows`}
|
|
74
64
|
</p>
|
|
@@ -77,51 +67,48 @@ function WorkflowDefinitionsTab() {
|
|
|
77
67
|
/>
|
|
78
68
|
)
|
|
79
69
|
|
|
80
|
-
if (workflowsQuery.isPending) {
|
|
81
|
-
return (
|
|
82
|
-
<section className="-mt-4 space-y-4">
|
|
83
|
-
{toolbar}
|
|
84
|
-
<div className="grid gap-3 lg:grid-cols-2">
|
|
85
|
-
{Array.from({ length: 4 }, (_, index) => (
|
|
86
|
-
<CardSkeleton key={index} />
|
|
87
|
-
))}
|
|
88
|
-
</div>
|
|
89
|
-
</section>
|
|
90
|
-
)
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
if (workflowsQuery.isError) {
|
|
94
|
-
return <WorkflowsFailure error={workflowsQuery.error} />
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
if (workflows.length === 0) {
|
|
98
|
-
return (
|
|
99
|
-
<PanelEmpty
|
|
100
|
-
icon={Workflow}
|
|
101
|
-
title="No workflows registered"
|
|
102
|
-
description="Create a workflow definition to see it appear here."
|
|
103
|
-
/>
|
|
104
|
-
)
|
|
105
|
-
}
|
|
106
|
-
|
|
107
70
|
return (
|
|
108
|
-
<section
|
|
109
|
-
{
|
|
110
|
-
|
|
111
|
-
|
|
71
|
+
<SectionPage section="console" page="workflows" width="wide" {...browser.frame}>
|
|
72
|
+
{workflowsQuery.isPending ? (
|
|
73
|
+
<section className="-mt-4 space-y-4">
|
|
74
|
+
{toolbar}
|
|
75
|
+
<div className="grid gap-3 lg:grid-cols-2">
|
|
76
|
+
{Array.from({ length: 4 }, (_, index) => (
|
|
77
|
+
<CardSkeleton key={index} />
|
|
78
|
+
))}
|
|
79
|
+
</div>
|
|
80
|
+
</section>
|
|
81
|
+
) : workflowsQuery.isError ? (
|
|
82
|
+
<WorkflowsFailure error={workflowsQuery.error} />
|
|
83
|
+
) : workflows.length === 0 ? (
|
|
112
84
|
<PanelEmpty
|
|
113
|
-
icon={
|
|
114
|
-
title="No
|
|
115
|
-
description="
|
|
85
|
+
icon={Workflow}
|
|
86
|
+
title="No workflows registered"
|
|
87
|
+
description="Create a workflow definition to see it appear here."
|
|
116
88
|
/>
|
|
117
89
|
) : (
|
|
118
|
-
<
|
|
119
|
-
{
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
90
|
+
<section className="-mt-4 space-y-4">
|
|
91
|
+
{toolbar}
|
|
92
|
+
{filteredWorkflows.length === 0 ? (
|
|
93
|
+
<PanelEmpty
|
|
94
|
+
icon={Search}
|
|
95
|
+
title="No matching workflows"
|
|
96
|
+
description="Try another workflow name, folder, node, trigger, or input."
|
|
97
|
+
/>
|
|
98
|
+
) : (
|
|
99
|
+
<FolderContents browser={browser} rootLabel="Workflows">
|
|
100
|
+
{(shown) => (
|
|
101
|
+
<div className="grid gap-3 lg:grid-cols-2">
|
|
102
|
+
{shown.map((workflow) => (
|
|
103
|
+
<WorkflowCard key={workflow.id} workflow={workflow} />
|
|
104
|
+
))}
|
|
105
|
+
</div>
|
|
106
|
+
)}
|
|
107
|
+
</FolderContents>
|
|
108
|
+
)}
|
|
109
|
+
</section>
|
|
123
110
|
)}
|
|
124
|
-
</
|
|
111
|
+
</SectionPage>
|
|
125
112
|
)
|
|
126
113
|
}
|
|
127
114
|
|
|
@@ -147,6 +134,7 @@ function workflowSearchText(workflow: WorkflowSummary): string {
|
|
|
147
134
|
return [
|
|
148
135
|
workflow.id,
|
|
149
136
|
humanizeIdentifier(workflow.id),
|
|
137
|
+
workflow.folder ?? "",
|
|
150
138
|
...Object.keys(workflow.input ?? {}),
|
|
151
139
|
...workflow.triggers.map((trigger) => trigger.scheduleId),
|
|
152
140
|
...nodeValues,
|