@acmekit/dashboard 2.13.21 → 2.13.23

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.
@@ -1,175 +0,0 @@
1
- import {
2
- StatusCell
3
- } from "./chunk-WILMJYUB.mjs";
4
- import {
5
- getTransactionState,
6
- getTransactionStateColor
7
- } from "./chunk-RPAL6FHW.mjs";
8
- import {
9
- _DataTable,
10
- useDataTable
11
- } from "./chunk-YLPAZ2DP.mjs";
12
- import {
13
- useQueryParams
14
- } from "./chunk-C76H5USB.mjs";
15
- import "./chunk-DFFLVEZ5.mjs";
16
- import "./chunk-535OVBXR.mjs";
17
- import {
18
- SingleColumnPage
19
- } from "./chunk-22YYMH6M.mjs";
20
- import {
21
- useExtension
22
- } from "./chunk-C5P5PL3E.mjs";
23
- import {
24
- useWorkflowExecutions
25
- } from "./chunk-LKWTBYYC.mjs";
26
- import "./chunk-ITNQKZQQ.mjs";
27
- import "./chunk-S4DMV3ZT.mjs";
28
- import "./chunk-774WSTCC.mjs";
29
- import "./chunk-DTY37DDZ.mjs";
30
- import "./chunk-QZ7TP4HQ.mjs";
31
-
32
- // src/routes/workflow-executions/workflow-execution-list/components/workflow-execution-list-table/workflow-execution-list-table.tsx
33
- import { Container, Heading, Text } from "@acmekit/ui";
34
- import { keepPreviousData } from "@tanstack/react-query";
35
- import { useTranslation as useTranslation2 } from "react-i18next";
36
-
37
- // src/routes/workflow-executions/workflow-execution-list/components/workflow-execution-list-table/use-workflow-execution-table-columns.tsx
38
- import { Badge } from "@acmekit/ui";
39
- import { createColumnHelper } from "@tanstack/react-table";
40
- import { useMemo } from "react";
41
- import { useTranslation } from "react-i18next";
42
- import { jsx } from "react/jsx-runtime";
43
- var columnHelper = createColumnHelper();
44
- var useWorkflowExecutionTableColumns = () => {
45
- const { t } = useTranslation();
46
- return useMemo(
47
- () => [
48
- columnHelper.accessor("transaction_id", {
49
- header: t("workflowExecutions.transactionIdLabel"),
50
- cell: ({ getValue }) => /* @__PURE__ */ jsx(Badge, { size: "2xsmall", children: getValue() })
51
- }),
52
- columnHelper.accessor("state", {
53
- header: t("fields.state"),
54
- cell: ({ getValue }) => {
55
- const state = getValue();
56
- const color = getTransactionStateColor(state);
57
- const translatedState = getTransactionState(t, state);
58
- return /* @__PURE__ */ jsx(StatusCell, { color, children: /* @__PURE__ */ jsx("span", { className: "capitalize", children: translatedState }) });
59
- }
60
- }),
61
- columnHelper.accessor("execution", {
62
- header: t("workflowExecutions.progressLabel"),
63
- cell: ({ getValue }) => {
64
- const steps = getValue()?.steps;
65
- if (!steps) {
66
- return "0 of 0 steps";
67
- }
68
- const actionableSteps = Object.values(steps).filter(
69
- (step) => step.id !== ROOT_PREFIX
70
- );
71
- const completedSteps = actionableSteps.filter(
72
- (step) => step.invoke.state === "done" /* DONE */
73
- );
74
- return t("workflowExecutions.stepsCompletedLabel", {
75
- completed: completedSteps.length,
76
- count: actionableSteps.length
77
- });
78
- }
79
- })
80
- ],
81
- [t]
82
- );
83
- };
84
- var ROOT_PREFIX = "_root";
85
-
86
- // src/routes/workflow-executions/workflow-execution-list/components/workflow-execution-list-table/use-workflow-execution-table-query.tsx
87
- var useWorkflowExecutionTableQuery = ({
88
- pageSize = 20,
89
- prefix
90
- }) => {
91
- const raw = useQueryParams(["q", "offset"], prefix);
92
- const { offset, ...rest } = raw;
93
- const searchParams = {
94
- limit: pageSize,
95
- offset: offset ? parseInt(offset) : 0,
96
- ...rest
97
- };
98
- return {
99
- searchParams,
100
- raw
101
- };
102
- };
103
-
104
- // src/routes/workflow-executions/workflow-execution-list/components/workflow-execution-list-table/workflow-execution-list-table.tsx
105
- import { jsx as jsx2, jsxs } from "react/jsx-runtime";
106
- var PAGE_SIZE = 20;
107
- var WorkflowExecutionListTable = () => {
108
- const { t } = useTranslation2();
109
- const { searchParams, raw } = useWorkflowExecutionTableQuery({
110
- pageSize: PAGE_SIZE
111
- });
112
- const { workflow_executions, count, isLoading, isError, error } = useWorkflowExecutions(
113
- {
114
- ...searchParams
115
- },
116
- {
117
- placeholderData: keepPreviousData
118
- }
119
- );
120
- const columns = useWorkflowExecutionTableColumns();
121
- const { table } = useDataTable({
122
- data: workflow_executions || [],
123
- columns,
124
- count,
125
- pageSize: PAGE_SIZE,
126
- enablePagination: true,
127
- getRowId: (row) => row.id
128
- });
129
- if (isError) {
130
- throw error;
131
- }
132
- return /* @__PURE__ */ jsxs(Container, { className: "divide-y p-0", children: [
133
- /* @__PURE__ */ jsx2("div", { className: "flex items-center justify-between px-6 py-4", children: /* @__PURE__ */ jsxs("div", { children: [
134
- /* @__PURE__ */ jsx2(Heading, { children: t("workflowExecutions.domain") }),
135
- /* @__PURE__ */ jsx2(Text, { className: "text-ui-fg-subtle", size: "small", children: t(`workflowExecutions.subtitle`) })
136
- ] }) }),
137
- /* @__PURE__ */ jsx2(
138
- _DataTable,
139
- {
140
- table,
141
- columns,
142
- count,
143
- isLoading,
144
- pageSize: PAGE_SIZE,
145
- navigateTo: (row) => `${row.id}`,
146
- search: true,
147
- pagination: true,
148
- queryObject: raw,
149
- noRecords: {
150
- message: t("workflowExecutions.list.noRecordsMessage")
151
- }
152
- }
153
- )
154
- ] });
155
- };
156
-
157
- // src/routes/workflow-executions/workflow-execution-list/workflow-execution-list.tsx
158
- import { jsx as jsx3 } from "react/jsx-runtime";
159
- var WorkflowExcecutionList = () => {
160
- const { getWidgets } = useExtension();
161
- return /* @__PURE__ */ jsx3(
162
- SingleColumnPage,
163
- {
164
- widgets: {
165
- after: getWidgets("workflow.list.after"),
166
- before: getWidgets("workflow.list.before")
167
- },
168
- hasOutlet: false,
169
- children: /* @__PURE__ */ jsx3(WorkflowExecutionListTable, {})
170
- }
171
- );
172
- };
173
- export {
174
- WorkflowExcecutionList as Component
175
- };