@loopstack/loopstack-studio 0.21.3 → 0.22.0
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/api/auth.js +10 -0
- package/dist/api/client.js +13 -0
- package/dist/api/config.js +10 -0
- package/dist/api/dashboard.js +4 -0
- package/dist/api/documents.js +7 -0
- package/dist/api/index.js +24 -0
- package/dist/api/namespaces.js +7 -0
- package/dist/api/pipelines.js +13 -0
- package/dist/api/processor.js +4 -0
- package/dist/api/workflows.js +8 -0
- package/dist/api/workspaces.js +12 -0
- package/dist/app/EnvironmentEmbedRoot.js +33 -0
- package/dist/components/data-table/DataTableFilters.js +74 -63
- package/dist/components/layout/MainLayout.js +7 -4
- package/dist/components/page/PageBreadcrumbs.js +1 -1
- package/dist/components/ui/sidebar.js +359 -359
- package/dist/components/ui-widgets/UiActions.js +22 -15
- package/dist/components/ui-widgets/UiWidget.js +31 -26
- package/dist/components/ui-widgets/widgets/AiPromptInput.js +27 -27
- package/dist/components/ui-widgets/widgets/ButtonFullWidth.js +12 -12
- package/dist/components/ui-widgets/widgets/SandboxRun.js +32 -0
- package/dist/components/ui-widgets/widgets/SubmitButton.js +11 -11
- package/dist/features/code-explorer/utils/fileIcons.js +4 -7
- package/dist/features/oauth/OAuthPromptRenderer.js +1 -1
- package/dist/features/runs/Runs.js +197 -0
- package/dist/features/workbench/NavigationItems.js +1 -1
- package/dist/features/workbench/Workbench.js +109 -75
- package/dist/features/workbench/WorkflowItem.js +8 -11
- package/dist/features/workbench/WorkflowList.js +29 -20
- package/dist/features/workbench/components/DocumentList.js +20 -20
- package/dist/features/workbench/components/NewRunDialog.js +328 -0
- package/dist/features/workbench/components/WorkbenchFloatingPanel.js +88 -0
- package/dist/features/workbench/components/WorkbenchFlowPanel.js +48 -0
- package/dist/features/workbench/components/WorkbenchIconSidebar.js +68 -0
- package/dist/features/workbench/components/WorkbenchPreviewPanel.js +128 -0
- package/dist/features/workbench/components/WorkflowForms.js +7 -6
- package/dist/features/workbench/components/WorkflowHistoryItem.js +68 -63
- package/dist/features/workbench/components/buttons/WorkflowButtons.js +79 -61
- package/dist/features/workbench/components/document-renderer/DocumentFormRenderer.js +6 -5
- package/dist/features/workbench/providers/WorkbenchLayoutProvider.js +77 -0
- package/dist/features/workspaces/Workspaces.js +2 -2
- package/dist/features/workspaces/components/CreateWorkspace.js +164 -81
- package/dist/features/workspaces/components/EnvironmentSlotSelector.js +63 -0
- package/dist/features/workspaces/components/ExecutionTimeline.js +69 -68
- package/dist/features/workspaces/components/PipelineForm.js +4 -4
- package/dist/hooks/index.js +2 -0
- package/dist/hooks/useApi.js +9 -33
- package/dist/hooks/useAuth.js +18 -38
- package/dist/hooks/useConfig.js +31 -33
- package/dist/hooks/useDashboard.js +1 -4
- package/dist/hooks/useDocuments.js +4 -8
- package/dist/hooks/useFiles.js +31 -41
- package/dist/hooks/useNamespaces.js +5 -8
- package/dist/hooks/usePipelines.js +98 -108
- package/dist/hooks/useProcessor.js +1 -4
- package/dist/hooks/useWorkflows.js +25 -41
- package/dist/hooks/useWorkspaces.js +45 -72
- package/dist/index.d.ts +266 -48
- package/dist/index.js +10 -2
- package/dist/packages/contracts/dist/enums/index.js +25 -0
- package/dist/packages/contracts/dist/enums/pipeline-state.js +10 -0
- package/dist/packages/contracts/dist/enums/registry.enum.js +20 -0
- package/dist/packages/contracts/dist/enums/sort-order.enum.js +10 -0
- package/dist/packages/contracts/dist/enums/user-type.enum.js +10 -0
- package/dist/packages/contracts/dist/enums/workflow-state.enum.js +10 -0
- package/dist/pages/DebugPage.js +12 -14
- package/dist/pages/DebugWorkflowDetailsPage.js +1 -1
- package/dist/pages/DebugWorkflowsPage.js +3 -4
- package/dist/pages/EmbedWorkbenchPage.js +4 -3
- package/dist/pages/PipelineDebugPage.js +2 -2
- package/dist/pages/PreviewWorkbenchPage.js +416 -0
- package/dist/pages/RunsListPage.js +36 -0
- package/dist/pages/RunsPage.js +49 -0
- package/dist/pages/StudioLandingPage.js +145 -0
- package/dist/pages/WorkbenchPage.js +75 -51
- package/dist/providers/InvalidationEventsProvider.js +7 -7
- package/dist/providers/QueryProvider.js +21 -0
- package/dist/routing/LocalRouter.js +9 -0
- package/dist/services/createApiClient.js +4 -10
- package/dist/services/index.js +1 -1
- package/package.json +2 -3
- package/dist/features/code-explorer/CodeExplorer.js +0 -69
- package/dist/features/code-explorer/components/CodeExplorerTree.js +0 -43
- package/dist/features/code-explorer/components/CodeExplorerTreeNode.js +0 -82
- package/dist/features/workbench/components/WorkbenchSidebar.js +0 -109
- package/dist/features/workbench/providers/WorkbenchContextProvider.js +0 -3
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { useAvailableEnvironments } from "../../../hooks/useConfig.js";
|
|
1
2
|
import { useCreateWorkspace, useUpdateWorkspace } from "../../../hooks/useWorkspaces.js";
|
|
2
3
|
import { Button } from "../../../components/ui/button.js";
|
|
3
4
|
import { DialogHeader } from "../../../components/ui/dialog.js";
|
|
@@ -5,147 +6,229 @@ import { Input } from "../../../components/ui/input.js";
|
|
|
5
6
|
import { Label } from "../../../components/ui/label.js";
|
|
6
7
|
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "../../../components/ui/select.js";
|
|
7
8
|
import ErrorSnackbar_default from "../../../components/snackbars/ErrorSnackbar.js";
|
|
9
|
+
import { EnvironmentSlotSelector } from "./EnvironmentSlotSelector.js";
|
|
8
10
|
import { c } from "react/compiler-runtime";
|
|
9
|
-
import { useEffect, useState } from "react";
|
|
11
|
+
import { useCallback, useEffect, useMemo, useState } from "react";
|
|
10
12
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
11
13
|
import { Loader2, Star } from "lucide-react";
|
|
12
14
|
import { DialogTitle } from "@radix-ui/react-dialog";
|
|
13
|
-
var CreateWorkspace_default = (
|
|
14
|
-
let
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
let
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
15
|
+
var CreateWorkspace_default = (ye) => {
|
|
16
|
+
let a = c(87), { types: o, workspace: s, onSuccess: l } = ye, u = useCreateWorkspace(), d = useUpdateWorkspace(), [f, be] = useState(o[0]?.blockName ?? ""), [p, xe] = useState(s?.isFavourite ?? !1), m;
|
|
17
|
+
a[0] === Symbol.for("react.memo_cache_sentinel") ? (m = {}, a[0] = m) : m = a[0];
|
|
18
|
+
let [h, g] = useState(m), _;
|
|
19
|
+
a[1] === o[0]?.blockName ? _ = a[2] : (_ = () => {
|
|
20
|
+
be(o[0]?.blockName ?? "");
|
|
21
|
+
}, a[1] = o[0]?.blockName, a[2] = _);
|
|
22
|
+
let v;
|
|
23
|
+
a[3] === o ? v = a[4] : (v = [o], a[3] = o, a[4] = v), useEffect(_, v);
|
|
24
|
+
let y;
|
|
25
|
+
if (a[5] !== o || a[6] !== f) {
|
|
26
|
+
let e;
|
|
27
|
+
a[8] === f ? e = a[9] : (e = (e) => e.blockName === f, a[8] = f, a[9] = e), y = o.find(e), a[5] = o, a[6] = f, a[7] = y;
|
|
28
|
+
} else y = a[7];
|
|
29
|
+
let Se = y, b;
|
|
30
|
+
a[10] === Se?.environments ? b = a[11] : (b = Se?.environments ?? [], a[10] = Se?.environments, a[11] = b);
|
|
31
|
+
let x = b, S = x.length > 0, C;
|
|
32
|
+
a[12] === S ? C = a[13] : (C = { enabled: S }, a[12] = S, a[13] = C);
|
|
33
|
+
let { data: w } = useAvailableEnvironments(C), T;
|
|
34
|
+
a[14] === w ? T = a[15] : (T = w?.map(_temp) ?? [], a[14] = w, a[15] = T);
|
|
35
|
+
let E = T, D = E.length > 0 && x.length > 0, O;
|
|
36
|
+
a[16] !== E || a[17] !== x || a[18] !== s ? (O = () => {
|
|
37
|
+
if (E.length === 0 || x.length === 0) return;
|
|
38
|
+
let e = {};
|
|
39
|
+
for (let t of x) {
|
|
40
|
+
if (s?.environments) {
|
|
41
|
+
let n = s.environments.find((e) => e.slotId === t.id);
|
|
42
|
+
if (n) {
|
|
43
|
+
e[t.id] = n.remoteEnvironmentId;
|
|
44
|
+
continue;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
let n = E.find((e) => !t.type || e.type === t.type);
|
|
48
|
+
n && (e[t.id] = n.id);
|
|
49
|
+
}
|
|
50
|
+
g(e);
|
|
51
|
+
}, a[16] = E, a[17] = x, a[18] = s, a[19] = O) : O = a[19];
|
|
52
|
+
let k = s?.environments, A;
|
|
53
|
+
a[20] !== E || a[21] !== x || a[22] !== k ? (A = [
|
|
54
|
+
E,
|
|
55
|
+
x,
|
|
56
|
+
k
|
|
57
|
+
], a[20] = E, a[21] = x, a[22] = k, a[23] = A) : A = a[23], useEffect(O, A);
|
|
58
|
+
let j;
|
|
59
|
+
a[24] === Symbol.for("react.memo_cache_sentinel") ? (j = (e) => {
|
|
60
|
+
be(e), g({});
|
|
61
|
+
}, a[24] = j) : j = a[24];
|
|
62
|
+
let Ce = j, M;
|
|
63
|
+
a[25] === Symbol.for("react.memo_cache_sentinel") ? (M = (e, t) => {
|
|
64
|
+
g((n) => ({
|
|
65
|
+
...n,
|
|
66
|
+
[e]: t
|
|
67
|
+
}));
|
|
68
|
+
}, a[25] = M) : M = a[25];
|
|
69
|
+
let we = M, N;
|
|
70
|
+
a[26] !== w || a[27] !== h || a[28] !== E || a[29] !== D || a[30] !== x ? (N = () => {
|
|
71
|
+
if (!D) return;
|
|
72
|
+
let e = [];
|
|
73
|
+
for (let t of x) {
|
|
74
|
+
let n = h[t.id];
|
|
75
|
+
if (n && n !== "__none__") {
|
|
76
|
+
let r = E.find((e) => e.id === n), i = w?.find((e) => e.type === n);
|
|
77
|
+
r && i && e.push({
|
|
78
|
+
slotId: t.id,
|
|
79
|
+
type: r.type,
|
|
80
|
+
remoteEnvironmentId: r.id,
|
|
81
|
+
envName: r.name,
|
|
82
|
+
connectionUrl: i.connectionUrl,
|
|
83
|
+
agentUrl: i.agentUrl,
|
|
84
|
+
workerUrl: i.connectionUrl,
|
|
85
|
+
local: i.local
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
return e.length > 0 ? e : void 0;
|
|
90
|
+
}, a[26] = w, a[27] = h, a[28] = E, a[29] = D, a[30] = x, a[31] = N) : N = a[31];
|
|
91
|
+
let P = N, F;
|
|
92
|
+
a[32] !== P || a[33] !== p || a[34] !== l || a[35] !== d || a[36] !== s ? (F = (e) => {
|
|
93
|
+
e.preventDefault();
|
|
94
|
+
let t = new FormData(e.currentTarget).get("name");
|
|
95
|
+
!t || !s || d.mutate({
|
|
96
|
+
id: s.id,
|
|
30
97
|
workspaceUpdateDto: {
|
|
31
|
-
title:
|
|
32
|
-
isFavourite:
|
|
98
|
+
title: t,
|
|
99
|
+
isFavourite: p,
|
|
100
|
+
environments: P()
|
|
33
101
|
}
|
|
34
102
|
}, { onSuccess: () => {
|
|
35
|
-
|
|
103
|
+
l();
|
|
36
104
|
} });
|
|
37
|
-
},
|
|
38
|
-
let
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
let
|
|
42
|
-
|
|
43
|
-
title:
|
|
44
|
-
blockName:
|
|
45
|
-
isFavourite:
|
|
105
|
+
}, a[32] = P, a[33] = p, a[34] = l, a[35] = d, a[36] = s, a[37] = F) : F = a[37];
|
|
106
|
+
let Te = F, I;
|
|
107
|
+
a[38] !== P || a[39] !== u || a[40] !== p || a[41] !== l || a[42] !== f ? (I = (e) => {
|
|
108
|
+
e.preventDefault();
|
|
109
|
+
let t = new FormData(e.currentTarget).get("name");
|
|
110
|
+
f && u.mutate({ workspaceCreateDto: {
|
|
111
|
+
title: t || void 0,
|
|
112
|
+
blockName: f,
|
|
113
|
+
isFavourite: p || void 0,
|
|
114
|
+
environments: P()
|
|
46
115
|
} }, { onSuccess: () => {
|
|
47
|
-
console.log("closing"),
|
|
116
|
+
console.log("closing"), l();
|
|
48
117
|
} });
|
|
49
|
-
},
|
|
50
|
-
let
|
|
51
|
-
|
|
52
|
-
let
|
|
53
|
-
|
|
54
|
-
let
|
|
55
|
-
|
|
118
|
+
}, a[38] = P, a[39] = u, a[40] = p, a[41] = l, a[42] = f, a[43] = I) : I = a[43];
|
|
119
|
+
let Ee = I, L = u.isPending || d.isPending, R;
|
|
120
|
+
a[44] === u.error ? R = a[45] : (R = /* @__PURE__ */ jsx(ErrorSnackbar_default, { error: u.error }), a[44] = u.error, a[45] = R);
|
|
121
|
+
let z;
|
|
122
|
+
a[46] === d.error ? z = a[47] : (z = /* @__PURE__ */ jsx(ErrorSnackbar_default, { error: d.error }), a[46] = d.error, a[47] = z);
|
|
123
|
+
let De = s ? "Edit" : "Add", B;
|
|
124
|
+
a[48] === De ? B = a[49] : (B = /* @__PURE__ */ jsx(DialogHeader, {
|
|
56
125
|
className: "space-y-1",
|
|
57
126
|
children: /* @__PURE__ */ jsxs(DialogTitle, {
|
|
58
127
|
className: "mb-4 text-lg leading-none font-semibold",
|
|
59
|
-
children: [
|
|
128
|
+
children: [De, " Workspace"]
|
|
60
129
|
})
|
|
61
|
-
}),
|
|
62
|
-
let
|
|
63
|
-
|
|
130
|
+
}), a[48] = De, a[49] = B);
|
|
131
|
+
let Oe = s ? Te : Ee, V;
|
|
132
|
+
a[50] === Symbol.for("react.memo_cache_sentinel") ? (V = /* @__PURE__ */ jsx(Label, {
|
|
64
133
|
htmlFor: "name",
|
|
65
134
|
children: "Workspace Name"
|
|
66
|
-
}),
|
|
67
|
-
let
|
|
68
|
-
|
|
135
|
+
}), a[50] = V) : V = a[50];
|
|
136
|
+
let ke = s?.title ?? "", H;
|
|
137
|
+
a[51] === ke ? H = a[52] : (H = /* @__PURE__ */ jsx(Input, {
|
|
69
138
|
id: "name",
|
|
70
139
|
name: "name",
|
|
71
|
-
defaultValue:
|
|
140
|
+
defaultValue: ke,
|
|
72
141
|
placeholder: "Enter workspace name (optional)",
|
|
73
142
|
autoFocus: !0
|
|
74
|
-
}),
|
|
143
|
+
}), a[51] = ke, a[52] = H);
|
|
75
144
|
let U;
|
|
76
|
-
|
|
77
|
-
let W = `h-4 w-4 ${
|
|
78
|
-
|
|
145
|
+
a[53] === Symbol.for("react.memo_cache_sentinel") ? (U = () => xe(_temp2), a[53] = U) : U = a[53];
|
|
146
|
+
let W = `h-4 w-4 ${p ? "fill-yellow-400 text-yellow-400" : "text-muted-foreground"}`, G;
|
|
147
|
+
a[54] === W ? G = a[55] : (G = /* @__PURE__ */ jsx(Button, {
|
|
79
148
|
type: "button",
|
|
80
149
|
variant: "ghost",
|
|
81
150
|
size: "icon",
|
|
82
151
|
className: "shrink-0",
|
|
83
152
|
onClick: U,
|
|
84
153
|
children: /* @__PURE__ */ jsx(Star, { className: W })
|
|
85
|
-
}),
|
|
154
|
+
}), a[54] = W, a[55] = G);
|
|
86
155
|
let K;
|
|
87
|
-
|
|
156
|
+
a[56] !== H || a[57] !== G ? (K = /* @__PURE__ */ jsxs("div", {
|
|
88
157
|
className: "space-y-2",
|
|
89
|
-
children: [
|
|
158
|
+
children: [V, /* @__PURE__ */ jsxs("div", {
|
|
90
159
|
className: "flex items-center gap-2",
|
|
91
160
|
children: [H, G]
|
|
92
161
|
})]
|
|
93
|
-
}),
|
|
162
|
+
}), a[56] = H, a[57] = G, a[58] = K) : K = a[58];
|
|
94
163
|
let q;
|
|
95
|
-
|
|
164
|
+
a[59] !== o || a[60] !== s || a[61] !== f ? (q = !s && o.length > 1 && /* @__PURE__ */ jsxs("div", {
|
|
96
165
|
className: "space-y-2",
|
|
97
166
|
children: [/* @__PURE__ */ jsx(Label, {
|
|
98
167
|
htmlFor: "blockName",
|
|
99
168
|
children: "Type"
|
|
100
169
|
}), /* @__PURE__ */ jsxs(Select, {
|
|
101
170
|
name: "blockName",
|
|
102
|
-
value:
|
|
103
|
-
onValueChange:
|
|
171
|
+
value: f,
|
|
172
|
+
onValueChange: Ce,
|
|
104
173
|
children: [/* @__PURE__ */ jsx(SelectTrigger, {
|
|
105
174
|
id: "blockName",
|
|
106
175
|
className: "w-full",
|
|
107
176
|
children: /* @__PURE__ */ jsx(SelectValue, { placeholder: "Select a type" })
|
|
108
|
-
}), /* @__PURE__ */ jsx(SelectContent, { children:
|
|
177
|
+
}), /* @__PURE__ */ jsx(SelectContent, { children: o.map(_temp3) })]
|
|
109
178
|
})]
|
|
110
|
-
}),
|
|
179
|
+
}), a[59] = o, a[60] = s, a[61] = f, a[62] = q) : q = a[62];
|
|
111
180
|
let J;
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
181
|
+
a[63] !== h || a[64] !== E || a[65] !== D || a[66] !== x ? (J = D && x.map((e) => /* @__PURE__ */ jsx(EnvironmentSlotSelector, {
|
|
182
|
+
slot: e,
|
|
183
|
+
environments: E,
|
|
184
|
+
selectedEnvironmentId: h[e.id],
|
|
185
|
+
onSelect: (t) => we(e.id, t)
|
|
186
|
+
}, e.id)), a[63] = h, a[64] = E, a[65] = D, a[66] = x, a[67] = J) : J = a[67];
|
|
187
|
+
let Y;
|
|
188
|
+
a[68] === L ? Y = a[69] : (Y = L && /* @__PURE__ */ jsx(Loader2, { className: "mr-2 h-4 w-4 animate-spin" }), a[68] = L, a[69] = Y);
|
|
189
|
+
let Ae = s ? "Save" : "Create", X;
|
|
190
|
+
a[70] !== L || a[71] !== Y || a[72] !== Ae ? (X = /* @__PURE__ */ jsxs(Button, {
|
|
115
191
|
type: "submit",
|
|
116
192
|
className: "w-full",
|
|
117
|
-
disabled:
|
|
118
|
-
children: [
|
|
119
|
-
}),
|
|
193
|
+
disabled: L,
|
|
194
|
+
children: [Y, Ae]
|
|
195
|
+
}), a[70] = L, a[71] = Y, a[72] = Ae, a[73] = X) : X = a[73];
|
|
120
196
|
let Z;
|
|
121
|
-
|
|
122
|
-
onSubmit:
|
|
197
|
+
a[74] !== Oe || a[75] !== K || a[76] !== q || a[77] !== J || a[78] !== X ? (Z = /* @__PURE__ */ jsxs("form", {
|
|
198
|
+
onSubmit: Oe,
|
|
123
199
|
className: "space-y-4",
|
|
124
200
|
children: [
|
|
125
201
|
K,
|
|
126
202
|
q,
|
|
203
|
+
J,
|
|
127
204
|
X
|
|
128
205
|
]
|
|
129
|
-
}),
|
|
206
|
+
}), a[74] = Oe, a[75] = K, a[76] = q, a[77] = J, a[78] = X, a[79] = Z) : Z = a[79];
|
|
130
207
|
let Q;
|
|
131
|
-
|
|
208
|
+
a[80] !== B || a[81] !== Z ? (Q = /* @__PURE__ */ jsxs("div", {
|
|
132
209
|
className: "mb-4",
|
|
133
|
-
children: [
|
|
134
|
-
}),
|
|
210
|
+
children: [B, Z]
|
|
211
|
+
}), a[80] = B, a[81] = Z, a[82] = Q) : Q = a[82];
|
|
135
212
|
let $;
|
|
136
|
-
return
|
|
137
|
-
|
|
138
|
-
|
|
213
|
+
return a[83] !== R || a[84] !== z || a[85] !== Q ? ($ = /* @__PURE__ */ jsxs("div", { children: [
|
|
214
|
+
R,
|
|
215
|
+
z,
|
|
139
216
|
Q
|
|
140
|
-
] }),
|
|
217
|
+
] }), a[83] = R, a[84] = z, a[85] = Q, a[86] = $) : $ = a[86], $;
|
|
141
218
|
};
|
|
142
|
-
function _temp(
|
|
143
|
-
return
|
|
219
|
+
function _temp(e) {
|
|
220
|
+
return {
|
|
221
|
+
...e,
|
|
222
|
+
id: e.type
|
|
223
|
+
};
|
|
224
|
+
}
|
|
225
|
+
function _temp2(e) {
|
|
226
|
+
return !e;
|
|
144
227
|
}
|
|
145
|
-
function
|
|
228
|
+
function _temp3(e) {
|
|
146
229
|
return /* @__PURE__ */ jsx(SelectItem, {
|
|
147
|
-
value:
|
|
148
|
-
children:
|
|
149
|
-
},
|
|
230
|
+
value: e.blockName,
|
|
231
|
+
children: e.title ?? e.blockName
|
|
232
|
+
}, e.blockName);
|
|
150
233
|
}
|
|
151
234
|
export { CreateWorkspace_default as default };
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { Button } from "../../../components/ui/button.js";
|
|
2
|
+
import { Label } from "../../../components/ui/label.js";
|
|
3
|
+
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "../../../components/ui/select.js";
|
|
4
|
+
import { useMemo } from "react";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
import { Info, Loader2, Plus } from "lucide-react";
|
|
7
|
+
function EnvironmentSlotSelector({ slot: p, environments: m, selectedEnvironmentId: h, onSelect: g, onCreateEnvironment: _, isCreating: v, error: y }) {
|
|
8
|
+
let b = useMemo(() => m.filter((e) => p.type ? e.type === p.type : !0), [m, p.type]), x = b.length > 0;
|
|
9
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
10
|
+
className: "space-y-2",
|
|
11
|
+
children: [
|
|
12
|
+
/* @__PURE__ */ jsxs(Label, { children: [p.title ?? p.id, p.optional && /* @__PURE__ */ jsx("span", {
|
|
13
|
+
className: "text-muted-foreground ml-1 font-normal",
|
|
14
|
+
children: "(optional)"
|
|
15
|
+
})] }),
|
|
16
|
+
x ? /* @__PURE__ */ jsxs(Select, {
|
|
17
|
+
value: h,
|
|
18
|
+
onValueChange: g,
|
|
19
|
+
children: [/* @__PURE__ */ jsx(SelectTrigger, {
|
|
20
|
+
className: "w-full",
|
|
21
|
+
children: /* @__PURE__ */ jsx(SelectValue, { placeholder: "Select an environment" })
|
|
22
|
+
}), /* @__PURE__ */ jsxs(SelectContent, { children: [p.optional && /* @__PURE__ */ jsx(SelectItem, {
|
|
23
|
+
value: "__none__",
|
|
24
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
25
|
+
className: "text-muted-foreground",
|
|
26
|
+
children: "None"
|
|
27
|
+
})
|
|
28
|
+
}), b.map((e) => /* @__PURE__ */ jsx(SelectItem, {
|
|
29
|
+
value: e.id,
|
|
30
|
+
children: /* @__PURE__ */ jsxs("span", {
|
|
31
|
+
className: "flex items-center gap-2",
|
|
32
|
+
children: [e.name, e.local && /* @__PURE__ */ jsx("span", {
|
|
33
|
+
className: "bg-muted text-muted-foreground rounded px-1.5 py-0.5 text-[10px] font-medium",
|
|
34
|
+
children: "Local"
|
|
35
|
+
})]
|
|
36
|
+
})
|
|
37
|
+
}, e.id))] })]
|
|
38
|
+
}) : /* @__PURE__ */ jsxs("div", {
|
|
39
|
+
className: `flex items-center gap-3 rounded-md border border-dashed bg-background p-3 ${y ? "border-destructive" : ""}`,
|
|
40
|
+
children: [
|
|
41
|
+
/* @__PURE__ */ jsx(Info, { className: `h-4 w-4 shrink-0 ${y ? "text-destructive" : "text-muted-foreground"}` }),
|
|
42
|
+
/* @__PURE__ */ jsx("p", {
|
|
43
|
+
className: `text-sm flex-1 ${y ? "text-destructive" : "text-muted-foreground"}`,
|
|
44
|
+
children: "No matching environment available."
|
|
45
|
+
}),
|
|
46
|
+
_ && /* @__PURE__ */ jsxs(Button, {
|
|
47
|
+
type: "button",
|
|
48
|
+
size: "sm",
|
|
49
|
+
variant: "outline",
|
|
50
|
+
disabled: v,
|
|
51
|
+
onClick: () => _(),
|
|
52
|
+
children: [v ? /* @__PURE__ */ jsx(Loader2, { className: "mr-1.5 h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ jsx(Plus, { className: "mr-1.5 h-3.5 w-3.5" }), "Create"]
|
|
53
|
+
})
|
|
54
|
+
]
|
|
55
|
+
}),
|
|
56
|
+
y && /* @__PURE__ */ jsx("p", {
|
|
57
|
+
className: "text-sm text-destructive",
|
|
58
|
+
children: y
|
|
59
|
+
})
|
|
60
|
+
]
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
export { EnvironmentSlotSelector };
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { useStudio } from "../../../providers/StudioProvider.js";
|
|
2
|
+
import { useBatchDeletePipeline, useChildPipelines, useFilterPipelines } from "../../../hooks/usePipelines.js";
|
|
2
3
|
import { Badge } from "../../../components/ui/badge.js";
|
|
3
4
|
import CustomListView_default from "../../../components/lists/CustomListView.js";
|
|
4
5
|
import ErrorSnackbar_default from "../../../components/snackbars/ErrorSnackbar.js";
|
|
5
|
-
import {
|
|
6
|
+
import { require_enums } from "../../../packages/contracts/dist/enums/index.js";
|
|
6
7
|
import NewPipelineRunDialog_default from "./NewPipelineRunDialog.js";
|
|
7
8
|
import { c } from "react/compiler-runtime";
|
|
8
9
|
import React, { useEffect, useState } from "react";
|
|
@@ -10,8 +11,8 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
10
11
|
import { useQueryClient } from "@tanstack/react-query";
|
|
11
12
|
import { ChevronDown, ChevronRight, Loader2 } from "lucide-react";
|
|
12
13
|
import { format, formatDistanceToNow, isToday, isYesterday, parseISO } from "date-fns";
|
|
13
|
-
var ChildPipelineList = (e) => {
|
|
14
|
-
let n = c(15), { parentId:
|
|
14
|
+
var import_enums = require_enums(), ChildPipelineList = (e) => {
|
|
15
|
+
let n = c(15), { parentId: i, formatUpdatedTime: a, getPipelineStateColor: o, onChildClick: s } = e, { data: l, isPending: u } = useChildPipelines(i, !0);
|
|
15
16
|
if (u) {
|
|
16
17
|
let e;
|
|
17
18
|
return n[0] === Symbol.for("react.memo_cache_sentinel") ? (e = /* @__PURE__ */ jsx("div", {
|
|
@@ -30,12 +31,12 @@ var ChildPipelineList = (e) => {
|
|
|
30
31
|
}), n[3] = e) : e = n[3], e;
|
|
31
32
|
}
|
|
32
33
|
let p;
|
|
33
|
-
if (n[4] !== f || n[5] !==
|
|
34
|
+
if (n[4] !== f || n[5] !== a || n[6] !== o || n[7] !== s) {
|
|
34
35
|
let e;
|
|
35
|
-
n[9] !==
|
|
36
|
+
n[9] !== a || n[10] !== o || n[11] !== s ? (e = (e) => /* @__PURE__ */ jsxs("div", {
|
|
36
37
|
className: "hover:bg-muted/50 flex cursor-pointer items-center justify-between rounded px-2 py-1.5",
|
|
37
|
-
onClick: (
|
|
38
|
-
|
|
38
|
+
onClick: (n) => {
|
|
39
|
+
n.stopPropagation(), s(e.id);
|
|
39
40
|
},
|
|
40
41
|
children: [/* @__PURE__ */ jsxs("div", { children: [
|
|
41
42
|
/* @__PURE__ */ jsxs("p", {
|
|
@@ -53,59 +54,59 @@ var ChildPipelineList = (e) => {
|
|
|
53
54
|
}),
|
|
54
55
|
/* @__PURE__ */ jsx("p", {
|
|
55
56
|
className: "text-xs text-gray-400",
|
|
56
|
-
children:
|
|
57
|
+
children: a(e.updatedAt)
|
|
57
58
|
})
|
|
58
59
|
] }), /* @__PURE__ */ jsx(Badge, {
|
|
59
60
|
variant: "default",
|
|
60
61
|
className: o(e.status),
|
|
61
62
|
children: e.status
|
|
62
63
|
})]
|
|
63
|
-
}, e.id), n[9] =
|
|
64
|
+
}, e.id), n[9] = a, n[10] = o, n[11] = s, n[12] = e) : e = n[12], p = f.map(e), n[4] = f, n[5] = a, n[6] = o, n[7] = s, n[8] = p;
|
|
64
65
|
} else p = n[8];
|
|
65
66
|
let m;
|
|
66
67
|
return n[13] === p ? m = n[14] : (m = /* @__PURE__ */ jsx("div", {
|
|
67
68
|
className: "mt-4 border-t pt-3 pl-8",
|
|
68
69
|
children: p
|
|
69
70
|
}), n[13] = p, n[14] = m), m;
|
|
70
|
-
}, ExecutionTimeline_default = (
|
|
71
|
-
let
|
|
72
|
-
|
|
73
|
-
let [
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
let
|
|
77
|
-
return
|
|
71
|
+
}, ExecutionTimeline_default = (r) => {
|
|
72
|
+
let s = c(40), { workspace: u } = r, { router: h } = useStudio(), g = useQueryClient(), [_, v] = useState(0), [y, b] = useState(25), [x, S] = useState(!1), C;
|
|
73
|
+
s[0] === Symbol.for("react.memo_cache_sentinel") ? (C = /* @__PURE__ */ new Set(), s[0] = C) : C = s[0];
|
|
74
|
+
let [w, T] = useState(C), E;
|
|
75
|
+
s[1] === Symbol.for("react.memo_cache_sentinel") ? (E = (e, n) => {
|
|
76
|
+
n.stopPropagation(), T((n) => {
|
|
77
|
+
let r = new Set(n);
|
|
78
|
+
return r.has(e) ? r.delete(e) : r.add(e), r;
|
|
78
79
|
});
|
|
79
|
-
},
|
|
80
|
-
let
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
}, k = [
|
|
80
|
+
}, s[1] = E) : E = s[1];
|
|
81
|
+
let D = E, O, k;
|
|
82
|
+
s[2] === g ? (O = s[3], k = s[4]) : (O = () => {
|
|
83
|
+
g.invalidateQueries({ queryKey: ["pipelines"] });
|
|
84
|
+
}, k = [g], s[2] = g, s[3] = O, s[4] = k), useEffect(O, k);
|
|
84
85
|
let A = _temp, j;
|
|
85
|
-
|
|
86
|
-
workspaceId:
|
|
86
|
+
s[5] === u.id ? j = s[6] : (j = {
|
|
87
|
+
workspaceId: u.id,
|
|
87
88
|
parentId: null
|
|
88
|
-
},
|
|
89
|
-
let M = useFilterPipelines(void 0, j, "createdAt", "DESC",
|
|
90
|
-
|
|
89
|
+
}, s[5] = u.id, s[6] = j);
|
|
90
|
+
let M = useFilterPipelines(void 0, j, "createdAt", "DESC", _, y), N = useBatchDeletePipeline(), P;
|
|
91
|
+
s[7] === N ? P = s[8] : (P = (e) => {
|
|
91
92
|
N.mutate(e);
|
|
92
|
-
},
|
|
93
|
+
}, s[7] = N, s[8] = P);
|
|
93
94
|
let F = P, I;
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
},
|
|
95
|
+
s[9] === Symbol.for("react.memo_cache_sentinel") ? (I = () => {
|
|
96
|
+
S(!0);
|
|
97
|
+
}, s[9] = I) : I = s[9];
|
|
97
98
|
let L = I, R;
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
},
|
|
99
|
+
s[10] === Symbol.for("react.memo_cache_sentinel") ? (R = () => {
|
|
100
|
+
S(!1);
|
|
101
|
+
}, s[10] = R) : R = s[10];
|
|
101
102
|
let z = R, B;
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
},
|
|
103
|
+
s[11] === h ? B = s[12] : (B = (e) => {
|
|
104
|
+
h.navigateToPipeline(e);
|
|
105
|
+
}, s[11] = h, s[12] = B);
|
|
105
106
|
let V = B, H = _temp2, U;
|
|
106
|
-
|
|
107
|
+
s[13] === M.data?.data ? U = s[14] : (U = M.data?.data ?? [], s[13] = M.data?.data, s[14] = U);
|
|
107
108
|
let W = U, G = M.data?.total ?? 0, K;
|
|
108
|
-
|
|
109
|
+
s[15] !== w || s[16] !== V ? (K = (e) => /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsxs("div", {
|
|
109
110
|
className: "flex items-center justify-between space-x-3",
|
|
110
111
|
children: [/* @__PURE__ */ jsxs("div", { children: [
|
|
111
112
|
/* @__PURE__ */ jsxs("h3", {
|
|
@@ -122,10 +123,10 @@ var ChildPipelineList = (e) => {
|
|
|
122
123
|
children: e.blockName
|
|
123
124
|
}),
|
|
124
125
|
e.hasChildren > 0 && /* @__PURE__ */ jsxs("button", {
|
|
125
|
-
onClick: (
|
|
126
|
+
onClick: (n) => D(e.id, n),
|
|
126
127
|
className: "hover:bg-muted mt-2 flex items-center gap-1 rounded px-1.5 py-0.5 text-xs text-gray-400",
|
|
127
128
|
children: [
|
|
128
|
-
|
|
129
|
+
w.has(e.id) ? /* @__PURE__ */ jsx(ChevronDown, { className: "h-3 w-3" }) : /* @__PURE__ */ jsx(ChevronRight, { className: "h-3 w-3" }),
|
|
129
130
|
e.hasChildren,
|
|
130
131
|
" sub ",
|
|
131
132
|
e.hasChildren === 1 ? "execution" : "executions"
|
|
@@ -142,63 +143,63 @@ var ChildPipelineList = (e) => {
|
|
|
142
143
|
children: A(e.updatedAt)
|
|
143
144
|
})]
|
|
144
145
|
})]
|
|
145
|
-
}), e.hasChildren > 0 &&
|
|
146
|
+
}), e.hasChildren > 0 && w.has(e.id) && /* @__PURE__ */ jsx(ChildPipelineList, {
|
|
146
147
|
parentId: e.id,
|
|
147
148
|
formatUpdatedTime: A,
|
|
148
|
-
|
|
149
|
+
getPipelineStateColor: H,
|
|
149
150
|
onChildClick: V
|
|
150
|
-
})] }),
|
|
151
|
+
})] }), s[15] = w, s[16] = V, s[17] = K) : K = s[17];
|
|
151
152
|
let q = K, J;
|
|
152
|
-
|
|
153
|
+
s[18] === M.error ? J = s[19] : (J = /* @__PURE__ */ jsx(ErrorSnackbar_default, { error: M.error }), s[18] = M.error, s[19] = J);
|
|
153
154
|
let Y;
|
|
154
|
-
|
|
155
|
+
s[20] === M.isPending ? Y = s[21] : (Y = M.isPending ? /* @__PURE__ */ jsx("div", {
|
|
155
156
|
className: "flex items-center justify-center py-8",
|
|
156
157
|
children: /* @__PURE__ */ jsx(Loader2, { className: "h-8 w-8 animate-spin" })
|
|
157
|
-
}) : "",
|
|
158
|
+
}) : "", s[20] = M.isPending, s[21] = Y);
|
|
158
159
|
let X = M.error ?? null, Z;
|
|
159
|
-
|
|
160
|
+
s[22] !== M.isPending || s[23] !== F || s[24] !== V || s[25] !== _ || s[26] !== W || s[27] !== q || s[28] !== y || s[29] !== X || s[30] !== G ? (Z = /* @__PURE__ */ jsx(CustomListView_default, {
|
|
160
161
|
loading: M.isPending,
|
|
161
162
|
error: X,
|
|
162
163
|
items: W,
|
|
163
164
|
totalItems: G,
|
|
164
165
|
onClick: V,
|
|
165
166
|
handleNew: L,
|
|
166
|
-
setPage:
|
|
167
|
-
setRowsPerPage:
|
|
168
|
-
page:
|
|
169
|
-
rowsPerPage:
|
|
167
|
+
setPage: v,
|
|
168
|
+
setRowsPerPage: b,
|
|
169
|
+
page: _,
|
|
170
|
+
rowsPerPage: y,
|
|
170
171
|
enableBatchActions: !0,
|
|
171
172
|
batchDelete: F,
|
|
172
173
|
itemRenderer: q,
|
|
173
174
|
newButtonLabel: "Run"
|
|
174
|
-
}),
|
|
175
|
+
}), s[22] = M.isPending, s[23] = F, s[24] = V, s[25] = _, s[26] = W, s[27] = q, s[28] = y, s[29] = X, s[30] = G, s[31] = Z) : Z = s[31];
|
|
175
176
|
let Q;
|
|
176
|
-
|
|
177
|
-
isOpen:
|
|
178
|
-
onOpenChange:
|
|
179
|
-
workspace:
|
|
177
|
+
s[32] !== x || s[33] !== u ? (Q = /* @__PURE__ */ jsx(NewPipelineRunDialog_default, {
|
|
178
|
+
isOpen: x,
|
|
179
|
+
onOpenChange: S,
|
|
180
|
+
workspace: u,
|
|
180
181
|
onSuccess: z
|
|
181
|
-
}),
|
|
182
|
+
}), s[32] = x, s[33] = u, s[34] = Q) : Q = s[34];
|
|
182
183
|
let $;
|
|
183
|
-
return
|
|
184
|
+
return s[35] !== J || s[36] !== Y || s[37] !== Z || s[38] !== Q ? ($ = /* @__PURE__ */ jsxs("div", { children: [
|
|
184
185
|
J,
|
|
185
186
|
Y,
|
|
186
187
|
Z,
|
|
187
188
|
Q
|
|
188
|
-
] }),
|
|
189
|
+
] }), s[35] = J, s[36] = Y, s[37] = Z, s[38] = Q, s[39] = $) : $ = s[39], $;
|
|
189
190
|
};
|
|
190
191
|
function _temp(e) {
|
|
191
|
-
let
|
|
192
|
-
return isToday(
|
|
192
|
+
let n = parseISO(e);
|
|
193
|
+
return isToday(n) ? formatDistanceToNow(n, { addSuffix: !0 }) : isYesterday(n) ? `Yesterday at ${format(n, "h:mm a")}` : format(n, "MMM d, yyyy h:mm a");
|
|
193
194
|
}
|
|
194
195
|
function _temp2(e) {
|
|
195
196
|
switch (e) {
|
|
196
|
-
case
|
|
197
|
-
case
|
|
198
|
-
case
|
|
199
|
-
case
|
|
200
|
-
case
|
|
201
|
-
case
|
|
197
|
+
case import_enums.PipelineState.Completed: return "bg-green-600";
|
|
198
|
+
case import_enums.PipelineState.Paused: return "bg-yellow-600";
|
|
199
|
+
case import_enums.PipelineState.Failed: return "bg-red-600";
|
|
200
|
+
case import_enums.PipelineState.Canceled:
|
|
201
|
+
case import_enums.PipelineState.Pending:
|
|
202
|
+
case import_enums.PipelineState.Running: return "bg-black";
|
|
202
203
|
}
|
|
203
204
|
}
|
|
204
205
|
export { ExecutionTimeline_default as default };
|