@acmekit/dashboard 2.13.35 → 2.13.36
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/package.json +9 -9
- package/src/components/layout/main-layout/main-layout.tsx +1 -28
- package/src/dashboard-app/routes/get-route.map.tsx +0 -71
- package/src/hooks/api/workflow-executions.tsx +1 -145
- package/src/i18n/translations/$schema.json +4 -534
- package/src/i18n/translations/en.json +3 -132
- package/src/routes/workflow-executions/constants.ts +0 -16
- package/src/routes/workflow-executions/utils.ts +14 -170
- package/src/routes/workflow-executions/workflow-execution-detail/breadcrumb.tsx +1 -7
- package/src/routes/workflow-executions/workflow-execution-detail/components/workflow-execution-history-section/workflow-execution-history-section.tsx +6 -157
- package/src/routes/workflow-executions/workflow-execution-detail/components/workflow-execution-payload-section/workflow-execution-payload-section.tsx +6 -122
- package/src/routes/workflow-executions/workflow-execution-detail/components/workflow-execution-timeline-section/workflow-execution-timeline-section.tsx +1 -7
- package/src/routes/workflow-executions/workflow-execution-detail/workflow-detail.tsx +1 -46
- package/src/routes/workflow-executions/workflow-execution-list/components/workflow-execution-list-table/use-workflow-execution-table-columns.tsx +0 -7
- package/src/routes/workflow-executions/workflow-execution-list/components/workflow-execution-list-table/use-workflow-execution-table-filters.tsx +1 -7
- package/src/routes/workflow-executions/workflow-execution-list/components/workflow-execution-list-table/use-workflow-execution-table-query.tsx +2 -4
- package/src/routes/workflow-executions/workflow-execution-list/components/workflow-execution-list-table/workflow-execution-list-table.tsx +1 -17
- package/src/routes/workflow-executions/workflow-execution-list/workflow-execution-list.tsx +1 -1
- package/src/hooks/api/workflow-definitions.tsx +0 -79
- package/src/hooks/api/workflow-metrics.tsx +0 -48
- package/src/hooks/use-workflow-sse.tsx +0 -78
- package/src/routes/workflow-analytics/workflow-analytics.tsx +0 -167
- package/src/routes/workflow-definitions/workflow-definition-detail/workflow-definition-detail.tsx +0 -98
- package/src/routes/workflow-definitions/workflow-definition-list/components/workflow-definition-list-table/use-workflow-definition-table-columns.tsx +0 -78
- package/src/routes/workflow-definitions/workflow-definition-list/components/workflow-definition-list-table/workflow-definition-list-table.tsx +0 -65
- package/src/routes/workflow-definitions/workflow-definition-list/workflow-definition-list.tsx +0 -15
- package/src/routes/workflow-executions/workflow-execution-complete-step/workflow-execution-complete-step.tsx +0 -270
- package/src/routes/workflow-executions/workflow-execution-detail/components/workflow-execution-action-bar/index.ts +0 -1
- package/src/routes/workflow-executions/workflow-execution-detail/components/workflow-execution-action-bar/workflow-execution-action-bar.tsx +0 -212
- package/src/routes/workflow-executions/workflow-execution-detail/components/workflow-execution-error-card/index.ts +0 -1
- package/src/routes/workflow-executions/workflow-execution-detail/components/workflow-execution-error-card/workflow-execution-error-card.tsx +0 -59
- package/src/routes/workflow-executions/workflow-execution-detail/components/workflow-execution-waiting-banner/index.ts +0 -1
- package/src/routes/workflow-executions/workflow-execution-detail/components/workflow-execution-waiting-banner/workflow-execution-waiting-banner.tsx +0 -63
- package/src/routes/workflow-executions/workflow-execution-list/components/workflow-execution-list-table/workflow-execution-auto-refresh.tsx +0 -73
- package/src/routes/workflow-executions/workflow-execution-list/components/workflow-execution-list-table/workflow-execution-row-actions.tsx +0 -116
- package/src/routes/workflow-executions/workflow-execution-list/components/workflow-execution-list-table/workflow-execution-saved-views.tsx +0 -84
- package/src/routes/workflow-executions/workflow-execution-rerun/workflow-execution-rerun.tsx +0 -159
- package/src/routes/workflow-executions/workflow-execution-run/workflow-execution-run.tsx +0 -139
- package/src/routes/workflow-scheduled/workflow-scheduled-list.tsx +0 -269
|
@@ -1,167 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Badge,
|
|
3
|
-
Container,
|
|
4
|
-
Heading,
|
|
5
|
-
Text,
|
|
6
|
-
} from "@acmekit/ui"
|
|
7
|
-
import { useTranslation } from "react-i18next"
|
|
8
|
-
import { SingleColumnPage } from "../../components/layout/pages"
|
|
9
|
-
import { useWorkflowMetrics } from "../../hooks/api/workflow-metrics"
|
|
10
|
-
|
|
11
|
-
export const WorkflowAnalytics = () => {
|
|
12
|
-
const { t } = useTranslation()
|
|
13
|
-
|
|
14
|
-
const {
|
|
15
|
-
total_24h,
|
|
16
|
-
success_rate_24h,
|
|
17
|
-
avg_duration_ms_24h,
|
|
18
|
-
running_now,
|
|
19
|
-
per_workflow,
|
|
20
|
-
isPending: isLoading,
|
|
21
|
-
} = useWorkflowMetrics()
|
|
22
|
-
|
|
23
|
-
const formatDuration = (ms: number) => {
|
|
24
|
-
if (ms < 1000) return `${ms}ms`
|
|
25
|
-
if (ms < 60000) return `${(ms / 1000).toFixed(1)}s`
|
|
26
|
-
const min = Math.floor(ms / 60000)
|
|
27
|
-
const sec = Math.round((ms % 60000) / 1000)
|
|
28
|
-
return `${min}m ${sec}s`
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
const formatRate = (rate: number) => `${(rate * 100).toFixed(1)}%`
|
|
32
|
-
|
|
33
|
-
return (
|
|
34
|
-
<SingleColumnPage widgets={{ before: [], after: [] }}>
|
|
35
|
-
<Container className="divide-y p-0">
|
|
36
|
-
<div className="px-6 py-4">
|
|
37
|
-
<Heading>{t("workflowExecutions.analytics.domain")}</Heading>
|
|
38
|
-
<Text className="text-ui-fg-subtle" size="small">
|
|
39
|
-
{t("workflowExecutions.analytics.subtitle")}
|
|
40
|
-
</Text>
|
|
41
|
-
</div>
|
|
42
|
-
|
|
43
|
-
<div className="grid grid-cols-4 gap-px bg-ui-border-base">
|
|
44
|
-
<MetricCard
|
|
45
|
-
label={t("workflowExecutions.analytics.executions24h")}
|
|
46
|
-
value={isLoading ? "-" : String(total_24h ?? 0)}
|
|
47
|
-
subtitle="Last 24h"
|
|
48
|
-
/>
|
|
49
|
-
<MetricCard
|
|
50
|
-
label={t("workflowExecutions.analytics.successRate")}
|
|
51
|
-
value={isLoading ? "-" : formatRate(success_rate_24h ?? 0)}
|
|
52
|
-
subtitle="Last 24h"
|
|
53
|
-
color={
|
|
54
|
-
(success_rate_24h ?? 1) >= 0.9
|
|
55
|
-
? "green"
|
|
56
|
-
: (success_rate_24h ?? 1) >= 0.7
|
|
57
|
-
? "orange"
|
|
58
|
-
: "red"
|
|
59
|
-
}
|
|
60
|
-
/>
|
|
61
|
-
<MetricCard
|
|
62
|
-
label={t("workflowExecutions.analytics.avgDuration")}
|
|
63
|
-
value={
|
|
64
|
-
isLoading ? "-" : formatDuration(avg_duration_ms_24h ?? 0)
|
|
65
|
-
}
|
|
66
|
-
subtitle="Last 24h"
|
|
67
|
-
/>
|
|
68
|
-
<MetricCard
|
|
69
|
-
label={t("workflowExecutions.analytics.runningNow")}
|
|
70
|
-
value={isLoading ? "-" : String(running_now ?? 0)}
|
|
71
|
-
color={(running_now ?? 0) > 0 ? "blue" : undefined}
|
|
72
|
-
/>
|
|
73
|
-
</div>
|
|
74
|
-
</Container>
|
|
75
|
-
|
|
76
|
-
{per_workflow && per_workflow.length > 0 && (
|
|
77
|
-
<Container className="divide-y p-0">
|
|
78
|
-
<div className="px-6 py-4">
|
|
79
|
-
<Heading level="h2">
|
|
80
|
-
{t("workflowExecutions.analytics.perWorkflowBreakdown")}
|
|
81
|
-
</Heading>
|
|
82
|
-
</div>
|
|
83
|
-
<div className="overflow-x-auto">
|
|
84
|
-
<table className="w-full">
|
|
85
|
-
<thead>
|
|
86
|
-
<tr className="border-ui-border-base border-b">
|
|
87
|
-
<th className="text-ui-fg-subtle txt-compact-small-plus px-6 py-2 text-left">
|
|
88
|
-
Workflow
|
|
89
|
-
</th>
|
|
90
|
-
<th className="text-ui-fg-subtle txt-compact-small-plus px-6 py-2 text-right">
|
|
91
|
-
Runs
|
|
92
|
-
</th>
|
|
93
|
-
<th className="text-ui-fg-subtle txt-compact-small-plus px-6 py-2 text-right">
|
|
94
|
-
Success Rate
|
|
95
|
-
</th>
|
|
96
|
-
<th className="text-ui-fg-subtle txt-compact-small-plus px-6 py-2 text-right">
|
|
97
|
-
Avg Duration
|
|
98
|
-
</th>
|
|
99
|
-
</tr>
|
|
100
|
-
</thead>
|
|
101
|
-
<tbody>
|
|
102
|
-
{per_workflow.map((wf) => (
|
|
103
|
-
<tr
|
|
104
|
-
key={wf.workflow_id}
|
|
105
|
-
className="border-ui-border-base border-b last:border-b-0"
|
|
106
|
-
>
|
|
107
|
-
<td className="px-6 py-3">
|
|
108
|
-
<Badge size="2xsmall">{wf.workflow_id}</Badge>
|
|
109
|
-
</td>
|
|
110
|
-
<td className="txt-compact-small text-ui-fg-subtle px-6 py-3 text-right">
|
|
111
|
-
{wf.runs}
|
|
112
|
-
</td>
|
|
113
|
-
<td className="txt-compact-small text-ui-fg-subtle px-6 py-3 text-right">
|
|
114
|
-
{formatRate(wf.success_rate)}
|
|
115
|
-
</td>
|
|
116
|
-
<td className="txt-compact-small text-ui-fg-subtle px-6 py-3 text-right">
|
|
117
|
-
{formatDuration(wf.avg_duration_ms)}
|
|
118
|
-
</td>
|
|
119
|
-
</tr>
|
|
120
|
-
))}
|
|
121
|
-
</tbody>
|
|
122
|
-
</table>
|
|
123
|
-
</div>
|
|
124
|
-
</Container>
|
|
125
|
-
)}
|
|
126
|
-
</SingleColumnPage>
|
|
127
|
-
)
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
const MetricCard = ({
|
|
131
|
-
label,
|
|
132
|
-
value,
|
|
133
|
-
subtitle,
|
|
134
|
-
color,
|
|
135
|
-
}: {
|
|
136
|
-
label: string
|
|
137
|
-
value: string
|
|
138
|
-
subtitle?: string
|
|
139
|
-
color?: "green" | "orange" | "red" | "blue"
|
|
140
|
-
}) => {
|
|
141
|
-
const colorClass = color
|
|
142
|
-
? {
|
|
143
|
-
green: "text-ui-tag-green-icon",
|
|
144
|
-
orange: "text-ui-tag-orange-icon",
|
|
145
|
-
red: "text-ui-tag-red-icon",
|
|
146
|
-
blue: "text-ui-tag-blue-icon",
|
|
147
|
-
}[color]
|
|
148
|
-
: "text-ui-fg-base"
|
|
149
|
-
|
|
150
|
-
return (
|
|
151
|
-
<div className="bg-ui-bg-base flex flex-col gap-y-1 px-6 py-4">
|
|
152
|
-
<Text size="small" className="text-ui-fg-subtle">
|
|
153
|
-
{label}
|
|
154
|
-
</Text>
|
|
155
|
-
<Text size="xlarge" weight="plus" className={colorClass}>
|
|
156
|
-
{value}
|
|
157
|
-
</Text>
|
|
158
|
-
{subtitle && (
|
|
159
|
-
<Text size="xsmall" className="text-ui-fg-muted">
|
|
160
|
-
{subtitle}
|
|
161
|
-
</Text>
|
|
162
|
-
)}
|
|
163
|
-
</div>
|
|
164
|
-
)
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
export const Component = WorkflowAnalytics
|
package/src/routes/workflow-definitions/workflow-definition-detail/workflow-definition-detail.tsx
DELETED
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
import { ArrowPathMini } from "@acmekit/icons"
|
|
2
|
-
import {
|
|
3
|
-
Badge,
|
|
4
|
-
Button,
|
|
5
|
-
Container,
|
|
6
|
-
Copy,
|
|
7
|
-
Heading,
|
|
8
|
-
Text,
|
|
9
|
-
} from "@acmekit/ui"
|
|
10
|
-
import { useTranslation } from "react-i18next"
|
|
11
|
-
import { Link, useParams } from "react-router-dom"
|
|
12
|
-
import { SingleColumnPageSkeleton } from "../../../components/common/skeleton"
|
|
13
|
-
import { SingleColumnPage } from "../../../components/layout/pages"
|
|
14
|
-
import { useWorkflowDefinition } from "../../../hooks/api/workflow-definitions"
|
|
15
|
-
|
|
16
|
-
export const WorkflowDefinitionDetail = () => {
|
|
17
|
-
const { id } = useParams()
|
|
18
|
-
const { t } = useTranslation()
|
|
19
|
-
|
|
20
|
-
const {
|
|
21
|
-
workflow_definition: definition,
|
|
22
|
-
isPending: isLoading,
|
|
23
|
-
isError,
|
|
24
|
-
error,
|
|
25
|
-
} = useWorkflowDefinition(id!)
|
|
26
|
-
|
|
27
|
-
if (isLoading) {
|
|
28
|
-
return <SingleColumnPageSkeleton sections={2} showJSON />
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
if (isError) {
|
|
32
|
-
throw error
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
if (!definition) {
|
|
36
|
-
return <SingleColumnPageSkeleton sections={2} showJSON />
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
return (
|
|
40
|
-
<SingleColumnPage
|
|
41
|
-
widgets={{ before: [], after: [] }}
|
|
42
|
-
data={definition}
|
|
43
|
-
showJSON
|
|
44
|
-
hasOutlet
|
|
45
|
-
>
|
|
46
|
-
<Container className="divide-y p-0">
|
|
47
|
-
<div className="flex items-center justify-between px-6 py-4">
|
|
48
|
-
<div className="flex items-center gap-x-3">
|
|
49
|
-
<Copy content={definition.id} asChild>
|
|
50
|
-
<Badge size="2xsmall" className="cursor-pointer">
|
|
51
|
-
{definition.id}
|
|
52
|
-
</Badge>
|
|
53
|
-
</Copy>
|
|
54
|
-
</div>
|
|
55
|
-
<Button variant="secondary" size="small" asChild>
|
|
56
|
-
<Link to="run">
|
|
57
|
-
<ArrowPathMini className="mr-1" />
|
|
58
|
-
{t("workflowExecutions.actions.runWorkflow")}
|
|
59
|
-
</Link>
|
|
60
|
-
</Button>
|
|
61
|
-
</div>
|
|
62
|
-
</Container>
|
|
63
|
-
|
|
64
|
-
<Container className="divide-y p-0">
|
|
65
|
-
<div className="px-6 py-4">
|
|
66
|
-
<Heading level="h2">
|
|
67
|
-
{t("workflowExecutions.definitions.steps")}
|
|
68
|
-
</Heading>
|
|
69
|
-
<Text size="small" className="text-ui-fg-subtle mt-1">
|
|
70
|
-
{t("workflowExecutions.definitions.stepCount")}:{" "}
|
|
71
|
-
{definition.steps?.length || 0}
|
|
72
|
-
</Text>
|
|
73
|
-
</div>
|
|
74
|
-
<div className="divide-y">
|
|
75
|
-
{(definition.steps || []).map((step, idx) => (
|
|
76
|
-
<div
|
|
77
|
-
key={`${step.action}-${idx}`}
|
|
78
|
-
className="flex items-center justify-between px-6 py-3"
|
|
79
|
-
style={{ paddingLeft: `${1.5 + step.depth * 1.5}rem` }}
|
|
80
|
-
>
|
|
81
|
-
<div className="flex items-center gap-x-2">
|
|
82
|
-
<span className="text-ui-fg-muted txt-compact-xsmall">
|
|
83
|
-
{step.depth > 0 ? "└" : "●"}
|
|
84
|
-
</span>
|
|
85
|
-
<Badge size="2xsmall">{step.action}</Badge>
|
|
86
|
-
</div>
|
|
87
|
-
<span className="text-ui-fg-muted txt-compact-xsmall">
|
|
88
|
-
{step.noCompensation ? "no compensation" : ""}
|
|
89
|
-
</span>
|
|
90
|
-
</div>
|
|
91
|
-
))}
|
|
92
|
-
</div>
|
|
93
|
-
</Container>
|
|
94
|
-
</SingleColumnPage>
|
|
95
|
-
)
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
export const Component = WorkflowDefinitionDetail
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import { Badge, Copy } from "@acmekit/ui"
|
|
2
|
-
import { ColumnDef, createColumnHelper } from "@tanstack/react-table"
|
|
3
|
-
import { useMemo } from "react"
|
|
4
|
-
import { useTranslation } from "react-i18next"
|
|
5
|
-
|
|
6
|
-
type WorkflowDefinition = {
|
|
7
|
-
id: string
|
|
8
|
-
handler_count: number
|
|
9
|
-
steps: Array<{ action: string; depth: number; noCompensation: boolean }>
|
|
10
|
-
options: Record<string, unknown>
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
const columnHelper = createColumnHelper<WorkflowDefinition>()
|
|
14
|
-
|
|
15
|
-
export const useWorkflowDefinitionTableColumns = (): ColumnDef<
|
|
16
|
-
WorkflowDefinition,
|
|
17
|
-
any
|
|
18
|
-
>[] => {
|
|
19
|
-
const { t } = useTranslation()
|
|
20
|
-
|
|
21
|
-
return useMemo(
|
|
22
|
-
() => [
|
|
23
|
-
columnHelper.accessor("id", {
|
|
24
|
-
header: t("workflowExecutions.definitions.name"),
|
|
25
|
-
cell: ({ getValue }) => {
|
|
26
|
-
const id = getValue()
|
|
27
|
-
return (
|
|
28
|
-
<div className="flex items-center gap-x-1">
|
|
29
|
-
<Badge size="2xsmall" className="truncate">
|
|
30
|
-
{id}
|
|
31
|
-
</Badge>
|
|
32
|
-
<Copy content={id} className="text-ui-fg-muted" />
|
|
33
|
-
</div>
|
|
34
|
-
)
|
|
35
|
-
},
|
|
36
|
-
}),
|
|
37
|
-
columnHelper.accessor("steps", {
|
|
38
|
-
header: t("workflowExecutions.definitions.stepCount"),
|
|
39
|
-
cell: ({ getValue }) => {
|
|
40
|
-
const steps = getValue()
|
|
41
|
-
return (
|
|
42
|
-
<span className="text-ui-fg-subtle txt-compact-small">
|
|
43
|
-
{steps?.length || 0} {t("workflowExecutions.definitions.steps")}
|
|
44
|
-
</span>
|
|
45
|
-
)
|
|
46
|
-
},
|
|
47
|
-
}),
|
|
48
|
-
columnHelper.accessor("handler_count", {
|
|
49
|
-
header: t("workflowExecutions.definitions.handlers"),
|
|
50
|
-
cell: ({ getValue }) => {
|
|
51
|
-
return (
|
|
52
|
-
<span className="text-ui-fg-subtle txt-compact-small">
|
|
53
|
-
{getValue() || 0}
|
|
54
|
-
</span>
|
|
55
|
-
)
|
|
56
|
-
},
|
|
57
|
-
}),
|
|
58
|
-
columnHelper.display({
|
|
59
|
-
id: "schedule",
|
|
60
|
-
header: t("workflowExecutions.scheduled.schedule"),
|
|
61
|
-
cell: ({ row }) => {
|
|
62
|
-
const schedule = (row.original.options as any)?.schedule
|
|
63
|
-
if (!schedule) {
|
|
64
|
-
return (
|
|
65
|
-
<span className="text-ui-fg-muted txt-compact-small">-</span>
|
|
66
|
-
)
|
|
67
|
-
}
|
|
68
|
-
return (
|
|
69
|
-
<Badge size="2xsmall" color="purple">
|
|
70
|
-
{String(schedule)}
|
|
71
|
-
</Badge>
|
|
72
|
-
)
|
|
73
|
-
},
|
|
74
|
-
}),
|
|
75
|
-
],
|
|
76
|
-
[t]
|
|
77
|
-
)
|
|
78
|
-
}
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import { Container, Heading, Text } from "@acmekit/ui"
|
|
2
|
-
import { keepPreviousData } from "@tanstack/react-query"
|
|
3
|
-
import { useTranslation } from "react-i18next"
|
|
4
|
-
import { _DataTable } from "../../../../../components/table/data-table"
|
|
5
|
-
import { useWorkflowDefinitions } from "../../../../../hooks/api/workflow-definitions"
|
|
6
|
-
import { useDataTable } from "../../../../../hooks/use-data-table"
|
|
7
|
-
import { useWorkflowDefinitionTableColumns } from "./use-workflow-definition-table-columns"
|
|
8
|
-
|
|
9
|
-
const PAGE_SIZE = 20
|
|
10
|
-
|
|
11
|
-
export const WorkflowDefinitionListTable = () => {
|
|
12
|
-
const { t } = useTranslation()
|
|
13
|
-
|
|
14
|
-
const {
|
|
15
|
-
workflow_definitions,
|
|
16
|
-
count,
|
|
17
|
-
isPending: isLoading,
|
|
18
|
-
isError,
|
|
19
|
-
error,
|
|
20
|
-
} = useWorkflowDefinitions(undefined, {
|
|
21
|
-
placeholderData: keepPreviousData,
|
|
22
|
-
})
|
|
23
|
-
|
|
24
|
-
const definitions = workflow_definitions || []
|
|
25
|
-
|
|
26
|
-
const columns = useWorkflowDefinitionTableColumns()
|
|
27
|
-
|
|
28
|
-
const { table } = useDataTable({
|
|
29
|
-
data: definitions,
|
|
30
|
-
columns,
|
|
31
|
-
count,
|
|
32
|
-
pageSize: PAGE_SIZE,
|
|
33
|
-
enablePagination: true,
|
|
34
|
-
getRowId: (row: any) => row.id,
|
|
35
|
-
})
|
|
36
|
-
|
|
37
|
-
if (isError) {
|
|
38
|
-
throw error
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
return (
|
|
42
|
-
<Container className="divide-y p-0">
|
|
43
|
-
<div className="flex items-center justify-between px-6 py-4">
|
|
44
|
-
<div>
|
|
45
|
-
<Heading>
|
|
46
|
-
{t("workflowExecutions.definitions.domain")}
|
|
47
|
-
</Heading>
|
|
48
|
-
<Text className="text-ui-fg-subtle" size="small">
|
|
49
|
-
{t("workflowExecutions.definitions.subtitle")}
|
|
50
|
-
</Text>
|
|
51
|
-
</div>
|
|
52
|
-
</div>
|
|
53
|
-
<_DataTable
|
|
54
|
-
table={table}
|
|
55
|
-
columns={columns}
|
|
56
|
-
count={count}
|
|
57
|
-
isLoading={isLoading}
|
|
58
|
-
pageSize={PAGE_SIZE}
|
|
59
|
-
navigateTo={(row: any) => row.id}
|
|
60
|
-
search
|
|
61
|
-
pagination
|
|
62
|
-
/>
|
|
63
|
-
</Container>
|
|
64
|
-
)
|
|
65
|
-
}
|
package/src/routes/workflow-definitions/workflow-definition-list/workflow-definition-list.tsx
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { SingleColumnPage } from "../../../components/layout/pages"
|
|
2
|
-
import { WorkflowDefinitionListTable } from "./components/workflow-definition-list-table/workflow-definition-list-table"
|
|
3
|
-
|
|
4
|
-
export const WorkflowDefinitionList = () => {
|
|
5
|
-
return (
|
|
6
|
-
<SingleColumnPage
|
|
7
|
-
widgets={{ before: [], after: [] }}
|
|
8
|
-
hasOutlet
|
|
9
|
-
>
|
|
10
|
-
<WorkflowDefinitionListTable />
|
|
11
|
-
</SingleColumnPage>
|
|
12
|
-
)
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export const Component = WorkflowDefinitionList
|
|
@@ -1,270 +0,0 @@
|
|
|
1
|
-
import { zodResolver } from "@hookform/resolvers/zod"
|
|
2
|
-
import { Button, Heading, Select, Textarea, toast } from "@acmekit/ui"
|
|
3
|
-
import { useForm } from "react-hook-form"
|
|
4
|
-
import { useTranslation } from "react-i18next"
|
|
5
|
-
import { useParams } from "react-router-dom"
|
|
6
|
-
import * as zod from "zod"
|
|
7
|
-
|
|
8
|
-
import { Form } from "../../../components/common/form"
|
|
9
|
-
import { RouteDrawer, useRouteModal } from "../../../components/modals"
|
|
10
|
-
import { KeyboundForm } from "../../../components/utilities/keybound-form"
|
|
11
|
-
import {
|
|
12
|
-
useSetStepFailure,
|
|
13
|
-
useSetStepSuccess,
|
|
14
|
-
useWorkflowExecution,
|
|
15
|
-
} from "../../../hooks/api/workflow-executions"
|
|
16
|
-
import { getWaitingSteps } from "../utils"
|
|
17
|
-
|
|
18
|
-
const CompleteStepSchema = zod.object({
|
|
19
|
-
step_id: zod.string().min(1, "Step is required"),
|
|
20
|
-
outcome: zod.enum(["success", "failure"]),
|
|
21
|
-
response: zod.string().refine(
|
|
22
|
-
(val) => {
|
|
23
|
-
if (!val.trim()) return true
|
|
24
|
-
try {
|
|
25
|
-
JSON.parse(val)
|
|
26
|
-
return true
|
|
27
|
-
} catch {
|
|
28
|
-
return false
|
|
29
|
-
}
|
|
30
|
-
},
|
|
31
|
-
{ message: "Must be valid JSON" }
|
|
32
|
-
),
|
|
33
|
-
})
|
|
34
|
-
|
|
35
|
-
export const WorkflowExecutionCompleteStep = () => {
|
|
36
|
-
const { t } = useTranslation()
|
|
37
|
-
const { id } = useParams()
|
|
38
|
-
const { handleSuccess } = useRouteModal()
|
|
39
|
-
|
|
40
|
-
const {
|
|
41
|
-
workflow_execution,
|
|
42
|
-
isPending: isLoading,
|
|
43
|
-
isError,
|
|
44
|
-
error,
|
|
45
|
-
} = useWorkflowExecution(id!)
|
|
46
|
-
|
|
47
|
-
if (isError) {
|
|
48
|
-
throw error
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
if (isLoading || !workflow_execution) {
|
|
52
|
-
return (
|
|
53
|
-
<RouteDrawer>
|
|
54
|
-
<RouteDrawer.Header>
|
|
55
|
-
<Heading>{t("workflowExecutions.actions.completeStep")}</Heading>
|
|
56
|
-
</RouteDrawer.Header>
|
|
57
|
-
</RouteDrawer>
|
|
58
|
-
)
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
const waitingSteps = getWaitingSteps(workflow_execution)
|
|
62
|
-
|
|
63
|
-
return (
|
|
64
|
-
<RouteDrawer>
|
|
65
|
-
<RouteDrawer.Header>
|
|
66
|
-
<Heading>{t("workflowExecutions.actions.completeStep")}</Heading>
|
|
67
|
-
</RouteDrawer.Header>
|
|
68
|
-
<CompleteStepForm
|
|
69
|
-
workflowId={workflow_execution.workflow_id}
|
|
70
|
-
transactionId={workflow_execution.transaction_id}
|
|
71
|
-
waitingSteps={waitingSteps}
|
|
72
|
-
onSuccess={handleSuccess}
|
|
73
|
-
/>
|
|
74
|
-
</RouteDrawer>
|
|
75
|
-
)
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
const CompleteStepForm = ({
|
|
79
|
-
workflowId,
|
|
80
|
-
transactionId,
|
|
81
|
-
waitingSteps,
|
|
82
|
-
onSuccess,
|
|
83
|
-
}: {
|
|
84
|
-
workflowId: string
|
|
85
|
-
transactionId: string
|
|
86
|
-
waitingSteps: { stepId: string }[]
|
|
87
|
-
onSuccess: () => void
|
|
88
|
-
}) => {
|
|
89
|
-
const { t } = useTranslation()
|
|
90
|
-
|
|
91
|
-
const form = useForm<zod.infer<typeof CompleteStepSchema>>({
|
|
92
|
-
defaultValues: {
|
|
93
|
-
step_id: waitingSteps[0]?.stepId || "",
|
|
94
|
-
outcome: "success",
|
|
95
|
-
response: "{}",
|
|
96
|
-
},
|
|
97
|
-
resolver: zodResolver(CompleteStepSchema),
|
|
98
|
-
})
|
|
99
|
-
|
|
100
|
-
const outcome = form.watch("outcome")
|
|
101
|
-
|
|
102
|
-
const { mutateAsync: setSuccess, isPending: isSettingSuccess } =
|
|
103
|
-
useSetStepSuccess(workflowId)
|
|
104
|
-
const { mutateAsync: setFailure, isPending: isSettingFailure } =
|
|
105
|
-
useSetStepFailure(workflowId)
|
|
106
|
-
|
|
107
|
-
const isPending = isSettingSuccess || isSettingFailure
|
|
108
|
-
|
|
109
|
-
const handleSubmit = form.handleSubmit(async (values) => {
|
|
110
|
-
const response = values.response.trim()
|
|
111
|
-
? JSON.parse(values.response)
|
|
112
|
-
: {}
|
|
113
|
-
|
|
114
|
-
if (values.outcome === "success") {
|
|
115
|
-
await setSuccess(
|
|
116
|
-
{ transaction_id: transactionId, step_id: values.step_id, response },
|
|
117
|
-
{
|
|
118
|
-
onSuccess: () => {
|
|
119
|
-
toast.success(
|
|
120
|
-
t("workflowExecutions.asyncStep.completedSuccess")
|
|
121
|
-
)
|
|
122
|
-
onSuccess()
|
|
123
|
-
},
|
|
124
|
-
onError: (err) => {
|
|
125
|
-
toast.error(err.message)
|
|
126
|
-
},
|
|
127
|
-
}
|
|
128
|
-
)
|
|
129
|
-
} else {
|
|
130
|
-
await setFailure(
|
|
131
|
-
{ transaction_id: transactionId, step_id: values.step_id, response },
|
|
132
|
-
{
|
|
133
|
-
onSuccess: () => {
|
|
134
|
-
toast.success(
|
|
135
|
-
t("workflowExecutions.asyncStep.completedSuccess")
|
|
136
|
-
)
|
|
137
|
-
onSuccess()
|
|
138
|
-
},
|
|
139
|
-
onError: (err) => {
|
|
140
|
-
toast.error(err.message)
|
|
141
|
-
},
|
|
142
|
-
}
|
|
143
|
-
)
|
|
144
|
-
}
|
|
145
|
-
})
|
|
146
|
-
|
|
147
|
-
return (
|
|
148
|
-
<RouteDrawer.Form form={form}>
|
|
149
|
-
<KeyboundForm
|
|
150
|
-
onSubmit={handleSubmit}
|
|
151
|
-
className="flex flex-1 flex-col overflow-hidden"
|
|
152
|
-
>
|
|
153
|
-
<RouteDrawer.Body className="flex max-w-full flex-1 flex-col gap-y-4 overflow-y-auto">
|
|
154
|
-
<Form.Field
|
|
155
|
-
control={form.control}
|
|
156
|
-
name="step_id"
|
|
157
|
-
render={({ field }) => {
|
|
158
|
-
return (
|
|
159
|
-
<Form.Item>
|
|
160
|
-
<Form.Label>
|
|
161
|
-
{t("workflowExecutions.asyncStep.stepLabel")}
|
|
162
|
-
</Form.Label>
|
|
163
|
-
<Form.Control>
|
|
164
|
-
<Select
|
|
165
|
-
value={field.value}
|
|
166
|
-
onValueChange={field.onChange}
|
|
167
|
-
>
|
|
168
|
-
<Select.Trigger>
|
|
169
|
-
<Select.Value
|
|
170
|
-
placeholder={t(
|
|
171
|
-
"workflowExecutions.asyncStep.stepLabel"
|
|
172
|
-
)}
|
|
173
|
-
/>
|
|
174
|
-
</Select.Trigger>
|
|
175
|
-
<Select.Content>
|
|
176
|
-
{waitingSteps.map((step) => (
|
|
177
|
-
<Select.Item
|
|
178
|
-
key={step.stepId}
|
|
179
|
-
value={step.stepId}
|
|
180
|
-
>
|
|
181
|
-
{step.stepId}
|
|
182
|
-
</Select.Item>
|
|
183
|
-
))}
|
|
184
|
-
</Select.Content>
|
|
185
|
-
</Select>
|
|
186
|
-
</Form.Control>
|
|
187
|
-
<Form.ErrorMessage />
|
|
188
|
-
</Form.Item>
|
|
189
|
-
)
|
|
190
|
-
}}
|
|
191
|
-
/>
|
|
192
|
-
<Form.Field
|
|
193
|
-
control={form.control}
|
|
194
|
-
name="outcome"
|
|
195
|
-
render={({ field }) => {
|
|
196
|
-
return (
|
|
197
|
-
<Form.Item>
|
|
198
|
-
<Form.Label>
|
|
199
|
-
{t("workflowExecutions.asyncStep.outcomeLabel")}
|
|
200
|
-
</Form.Label>
|
|
201
|
-
<Form.Control>
|
|
202
|
-
<Select
|
|
203
|
-
value={field.value}
|
|
204
|
-
onValueChange={field.onChange}
|
|
205
|
-
>
|
|
206
|
-
<Select.Trigger>
|
|
207
|
-
<Select.Value />
|
|
208
|
-
</Select.Trigger>
|
|
209
|
-
<Select.Content>
|
|
210
|
-
<Select.Item value="success">
|
|
211
|
-
{t("workflowExecutions.asyncStep.success")}
|
|
212
|
-
</Select.Item>
|
|
213
|
-
<Select.Item value="failure">
|
|
214
|
-
{t("workflowExecutions.asyncStep.failure")}
|
|
215
|
-
</Select.Item>
|
|
216
|
-
</Select.Content>
|
|
217
|
-
</Select>
|
|
218
|
-
</Form.Control>
|
|
219
|
-
<Form.ErrorMessage />
|
|
220
|
-
</Form.Item>
|
|
221
|
-
)
|
|
222
|
-
}}
|
|
223
|
-
/>
|
|
224
|
-
<Form.Field
|
|
225
|
-
control={form.control}
|
|
226
|
-
name="response"
|
|
227
|
-
render={({ field }) => {
|
|
228
|
-
return (
|
|
229
|
-
<Form.Item>
|
|
230
|
-
<Form.Label>
|
|
231
|
-
{t("workflowExecutions.asyncStep.responsePayload")}
|
|
232
|
-
</Form.Label>
|
|
233
|
-
<Form.Control>
|
|
234
|
-
<Textarea
|
|
235
|
-
{...field}
|
|
236
|
-
className="font-mono text-xs"
|
|
237
|
-
rows={10}
|
|
238
|
-
/>
|
|
239
|
-
</Form.Control>
|
|
240
|
-
<Form.ErrorMessage />
|
|
241
|
-
</Form.Item>
|
|
242
|
-
)
|
|
243
|
-
}}
|
|
244
|
-
/>
|
|
245
|
-
</RouteDrawer.Body>
|
|
246
|
-
<RouteDrawer.Footer>
|
|
247
|
-
<div className="flex items-center justify-end gap-x-2">
|
|
248
|
-
<RouteDrawer.Close asChild>
|
|
249
|
-
<Button size="small" variant="secondary">
|
|
250
|
-
{t("actions.cancel")}
|
|
251
|
-
</Button>
|
|
252
|
-
</RouteDrawer.Close>
|
|
253
|
-
<Button
|
|
254
|
-
size="small"
|
|
255
|
-
type="submit"
|
|
256
|
-
isLoading={isPending}
|
|
257
|
-
variant={outcome === "failure" ? "danger" : "primary"}
|
|
258
|
-
>
|
|
259
|
-
{outcome === "failure"
|
|
260
|
-
? t("workflowExecutions.asyncStep.markFailure")
|
|
261
|
-
: t("workflowExecutions.asyncStep.markSuccess")}
|
|
262
|
-
</Button>
|
|
263
|
-
</div>
|
|
264
|
-
</RouteDrawer.Footer>
|
|
265
|
-
</KeyboundForm>
|
|
266
|
-
</RouteDrawer.Form>
|
|
267
|
-
)
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
export const Component = WorkflowExecutionCompleteStep
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { WorkflowExecutionActionBar } from "./workflow-execution-action-bar"
|