@loopstack/loopstack-studio 0.21.3 → 0.23.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.
Files changed (126) hide show
  1. package/dist/api/auth.js +10 -0
  2. package/dist/api/client.js +13 -0
  3. package/dist/api/config.js +10 -0
  4. package/dist/api/dashboard.js +4 -0
  5. package/dist/api/documents.js +7 -0
  6. package/dist/api/index.js +24 -0
  7. package/dist/api/namespaces.js +7 -0
  8. package/dist/api/pipelines.js +13 -0
  9. package/dist/api/processor.js +4 -0
  10. package/dist/api/workflows.js +8 -0
  11. package/dist/api/workspaces.js +12 -0
  12. package/dist/app/EnvironmentEmbedRoot.js +35 -0
  13. package/dist/components/data-table/DataTableFilters.js +74 -63
  14. package/dist/components/feedback/ErrorBoundary.js +43 -0
  15. package/dist/components/{LoadingCentered.js → feedback/LoadingCentered.js} +1 -1
  16. package/dist/components/feedback/index.js +5 -0
  17. package/dist/components/index.js +6 -3
  18. package/dist/components/layout/MainLayout.js +36 -17
  19. package/dist/components/layout/StudioSidebar.js +165 -0
  20. package/dist/components/page/PageBreadcrumbs.js +1 -1
  21. package/dist/components/ui/sidebar.js +359 -359
  22. package/dist/components/ui-widgets/UiActions.js +22 -15
  23. package/dist/components/ui-widgets/UiWidget.js +31 -26
  24. package/dist/components/ui-widgets/widgets/AiPromptInput.js +27 -27
  25. package/dist/components/ui-widgets/widgets/ButtonFullWidth.js +12 -12
  26. package/dist/components/ui-widgets/widgets/SandboxRun.js +33 -0
  27. package/dist/components/ui-widgets/widgets/SubmitButton.js +11 -11
  28. package/dist/features/code-explorer/CodeExplorer.js +4 -67
  29. package/dist/features/code-explorer/components/CodeExplorerTree.js +3 -41
  30. package/dist/features/code-explorer/components/CodeExplorerTreeNode.js +4 -80
  31. package/dist/features/code-explorer/components/FileContentViewer.js +1 -0
  32. package/dist/features/code-explorer/components/FileTabsBar.js +1 -1
  33. package/dist/features/code-explorer/index.js +4 -0
  34. package/dist/features/code-explorer/utils/fileIcons.js +4 -7
  35. package/dist/features/debug/components/ConfigFlowViewer.js +1 -1
  36. package/dist/features/debug/components/PipelineFlowViewer.js +1 -1
  37. package/dist/features/debug/index.js +3 -0
  38. package/dist/features/documents/DocumentRenderer.js +53 -0
  39. package/dist/features/{workbench → documents}/components/DocumentItem.js +1 -1
  40. package/dist/features/documents/components/DocumentList.js +40 -0
  41. package/dist/features/{workbench → documents}/components/DocumentMetadataPills.js +2 -2
  42. package/dist/features/{workbench/components → documents}/document-details/DocumentDetails.js +3 -3
  43. package/dist/features/{workbench/components → documents}/document-details/PromptDetails.js +3 -3
  44. package/dist/features/documents/index.js +4 -0
  45. package/dist/features/{workbench/components/document-renderer → documents/renderers}/AiMessage.js +5 -5
  46. package/dist/features/{workbench/components/document-renderer → documents/renderers}/DocumentDebugRenderer.js +1 -1
  47. package/dist/features/{workbench/components/document-renderer → documents/renderers}/DocumentFormRenderer.js +9 -8
  48. package/dist/features/{workbench/components/document-renderer → documents/renderers}/DocumentMessageRenderer.js +1 -1
  49. package/dist/features/{workbench/components/document-renderer → documents/renderers}/ErrorMessageRenderer.js +1 -1
  50. package/dist/features/{workbench/components/document-renderer → documents/renderers}/LinkMessageRenderer.js +1 -1
  51. package/dist/features/{workbench/components/document-renderer → documents/renderers}/MarkdownMessageRenderer.js +2 -2
  52. package/dist/features/{workbench/components/document-renderer → documents/renderers}/PlainMessageRenderer.js +1 -1
  53. package/dist/features/health/index.js +1 -0
  54. package/dist/features/oauth/OAuthPromptRenderer.js +1 -1
  55. package/dist/features/runs/Runs.js +197 -0
  56. package/dist/features/workbench/NavigationItems.js +29 -29
  57. package/dist/features/workbench/Workbench.js +100 -78
  58. package/dist/features/workbench/WorkflowItem.js +63 -58
  59. package/dist/features/workbench/WorkflowList.js +62 -82
  60. package/dist/features/workbench/components/NewRunDialog.js +329 -0
  61. package/dist/features/workbench/components/WorkbenchFloatingPanel.js +88 -0
  62. package/dist/features/workbench/components/WorkbenchFlowPanel.js +49 -0
  63. package/dist/features/workbench/components/WorkbenchIconSidebar.js +68 -0
  64. package/dist/features/workbench/components/WorkbenchPreviewPanel.js +128 -0
  65. package/dist/features/workbench/components/WorkflowForms.js +7 -6
  66. package/dist/features/workbench/components/WorkflowHistoryItem.js +74 -69
  67. package/dist/features/workbench/components/buttons/WorkflowButtons.js +78 -61
  68. package/dist/features/workbench/hooks/useWorkflowData.js +49 -0
  69. package/dist/features/workbench/hooks/useWorkflowListState.js +50 -0
  70. package/dist/features/workbench/index.js +8 -0
  71. package/dist/features/workbench/providers/WorkbenchLayoutProvider.js +76 -0
  72. package/dist/features/workspaces/Workspaces.js +2 -2
  73. package/dist/features/workspaces/components/CreateWorkspace.js +165 -82
  74. package/dist/features/workspaces/components/EnvironmentSlotSelector.js +63 -0
  75. package/dist/features/workspaces/components/ExecutionTimeline.js +70 -69
  76. package/dist/features/workspaces/components/PipelineForm.js +4 -4
  77. package/dist/features/workspaces/index.js +3 -0
  78. package/dist/hooks/index.js +3 -0
  79. package/dist/hooks/query-keys.js +138 -0
  80. package/dist/hooks/useApi.js +9 -33
  81. package/dist/hooks/useAuth.js +37 -56
  82. package/dist/hooks/useConfig.js +27 -33
  83. package/dist/hooks/useDashboard.js +9 -16
  84. package/dist/hooks/useDebounce.js +8 -17
  85. package/dist/hooks/useDocuments.js +7 -16
  86. package/dist/hooks/useFiles.js +24 -42
  87. package/dist/hooks/useNamespaces.js +7 -16
  88. package/dist/hooks/usePipelines.js +141 -174
  89. package/dist/hooks/useProcessor.js +11 -17
  90. package/dist/hooks/useWorkflows.js +51 -89
  91. package/dist/hooks/useWorkspaces.js +97 -129
  92. package/dist/index.d.ts +364 -50
  93. package/dist/index.js +21 -6
  94. package/dist/packages/contracts/dist/enums/index.js +25 -0
  95. package/dist/packages/contracts/dist/enums/pipeline-state.js +10 -0
  96. package/dist/packages/contracts/dist/enums/registry.enum.js +20 -0
  97. package/dist/packages/contracts/dist/enums/sort-order.enum.js +10 -0
  98. package/dist/packages/contracts/dist/enums/user-type.enum.js +10 -0
  99. package/dist/packages/contracts/dist/enums/workflow-state.enum.js +10 -0
  100. package/dist/pages/DashboardPage.js +1 -1
  101. package/dist/pages/DebugPage.js +12 -14
  102. package/dist/pages/DebugWorkflowDetailsPage.js +2 -2
  103. package/dist/pages/DebugWorkflowsPage.js +3 -4
  104. package/dist/pages/EmbedWorkbenchPage.js +7 -5
  105. package/dist/pages/PipelineDebugPage.js +7 -6
  106. package/dist/pages/PreviewWorkbenchPage.js +419 -0
  107. package/dist/pages/RunsListPage.js +64 -0
  108. package/dist/pages/RunsPage.js +49 -0
  109. package/dist/pages/StudioLandingPage.js +146 -0
  110. package/dist/pages/WorkbenchPage.js +78 -53
  111. package/dist/pages/WorkspacePage.js +1 -1
  112. package/dist/providers/InvalidationEventsProvider.js +15 -17
  113. package/dist/providers/QueryProvider.js +21 -0
  114. package/dist/providers/StudioProvider.js +2 -2
  115. package/dist/routing/LocalRouter.js +20 -7
  116. package/dist/services/createApiClient.js +4 -10
  117. package/dist/services/index.js +1 -1
  118. package/package.json +2 -3
  119. package/dist/features/workbench/components/DocumentList.js +0 -40
  120. package/dist/features/workbench/components/DocumentRenderer.js +0 -54
  121. package/dist/features/workbench/components/WorkbenchSidebar.js +0 -109
  122. package/dist/features/workbench/providers/WorkbenchContextProvider.js +0 -3
  123. /package/dist/components/{content → feedback}/ErrorAlert.js +0 -0
  124. /package/dist/components/{snackbars → feedback}/ErrorSnackbar.js +0 -0
  125. /package/dist/components/{snackbars → feedback}/Snackbar.js +0 -0
  126. /package/dist/features/{workbench/components/document-renderer → documents/renderers}/AiMessageContent.js +0 -0
@@ -1,151 +1,234 @@
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";
4
5
  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
- import ErrorSnackbar_default from "../../../components/snackbars/ErrorSnackbar.js";
8
+ import ErrorSnackbar_default from "../../../components/feedback/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 = (h) => {
14
- let g = c(52), { types: _, workspace: v, onSuccess: y } = h, b = useCreateWorkspace(), x = useUpdateWorkspace(), [S, C] = useState(_[0]?.blockName ?? ""), [w, T] = useState(v?.isFavourite ?? !1), E;
15
- g[0] === _[0]?.blockName ? E = g[1] : (E = () => {
16
- C(_[0]?.blockName ?? "");
17
- }, g[0] = _[0]?.blockName, g[1] = E);
18
- let D;
19
- g[2] === _ ? D = g[3] : (D = [_], g[2] = _, g[3] = D), useEffect(E, D);
20
- let O;
21
- g[4] === Symbol.for("react.memo_cache_sentinel") ? (O = (t) => {
22
- C(t);
23
- }, g[4] = O) : O = g[4];
24
- let k = O, A;
25
- g[5] !== w || g[6] !== y || g[7] !== x || g[8] !== v ? (A = (t) => {
26
- t.preventDefault();
27
- let m = new FormData(t.currentTarget).get("name");
28
- !m || !v || x.mutate({
29
- id: v.id,
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: m,
32
- isFavourite: w
98
+ title: t,
99
+ isFavourite: p,
100
+ environments: P()
33
101
  }
34
102
  }, { onSuccess: () => {
35
- y();
103
+ l();
36
104
  } });
37
- }, g[5] = w, g[6] = y, g[7] = x, g[8] = v, g[9] = A) : A = g[9];
38
- let j = A, M;
39
- g[10] !== b || g[11] !== w || g[12] !== y || g[13] !== S ? (M = (t) => {
40
- t.preventDefault();
41
- let m = new FormData(t.currentTarget).get("name");
42
- S && b.mutate({ workspaceCreateDto: {
43
- title: m || void 0,
44
- blockName: S,
45
- isFavourite: w || void 0
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"), y();
116
+ console.log("closing"), l();
48
117
  } });
49
- }, g[10] = b, g[11] = w, g[12] = y, g[13] = S, g[14] = M) : M = g[14];
50
- let N = M, P = b.isPending || x.isPending, F;
51
- g[15] === b.error ? F = g[16] : (F = /* @__PURE__ */ jsx(ErrorSnackbar_default, { error: b.error }), g[15] = b.error, g[16] = F);
52
- let I;
53
- g[17] === x.error ? I = g[18] : (I = /* @__PURE__ */ jsx(ErrorSnackbar_default, { error: x.error }), g[17] = x.error, g[18] = I);
54
- let L = v ? "Edit" : "Add", R;
55
- g[19] === L ? R = g[20] : (R = /* @__PURE__ */ jsx(DialogHeader, {
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: [L, " Workspace"]
128
+ children: [De, " Workspace"]
60
129
  })
61
- }), g[19] = L, g[20] = R);
62
- let z = v ? j : N, B;
63
- g[21] === Symbol.for("react.memo_cache_sentinel") ? (B = /* @__PURE__ */ jsx(Label, {
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
- }), g[21] = B) : B = g[21];
67
- let V = v?.title ?? "", H;
68
- g[22] === V ? H = g[23] : (H = /* @__PURE__ */ jsx(Input, {
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: V,
140
+ defaultValue: ke,
72
141
  placeholder: "Enter workspace name (optional)",
73
142
  autoFocus: !0
74
- }), g[22] = V, g[23] = H);
143
+ }), a[51] = ke, a[52] = H);
75
144
  let U;
76
- g[24] === Symbol.for("react.memo_cache_sentinel") ? (U = () => T(_temp), g[24] = U) : U = g[24];
77
- let W = `h-4 w-4 ${w ? "fill-yellow-400 text-yellow-400" : "text-muted-foreground"}`, G;
78
- g[25] === W ? G = g[26] : (G = /* @__PURE__ */ jsx(Button, {
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
- }), g[25] = W, g[26] = G);
154
+ }), a[54] = W, a[55] = G);
86
155
  let K;
87
- g[27] !== H || g[28] !== G ? (K = /* @__PURE__ */ jsxs("div", {
156
+ a[56] !== H || a[57] !== G ? (K = /* @__PURE__ */ jsxs("div", {
88
157
  className: "space-y-2",
89
- children: [B, /* @__PURE__ */ jsxs("div", {
158
+ children: [V, /* @__PURE__ */ jsxs("div", {
90
159
  className: "flex items-center gap-2",
91
160
  children: [H, G]
92
161
  })]
93
- }), g[27] = H, g[28] = G, g[29] = K) : K = g[29];
162
+ }), a[56] = H, a[57] = G, a[58] = K) : K = a[58];
94
163
  let q;
95
- g[30] !== _ || g[31] !== v || g[32] !== S ? (q = !v && _.length > 1 && /* @__PURE__ */ jsxs("div", {
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: S,
103
- onValueChange: k,
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: _.map(_temp2) })]
177
+ }), /* @__PURE__ */ jsx(SelectContent, { children: o.map(_temp3) })]
109
178
  })]
110
- }), g[30] = _, g[31] = v, g[32] = S, g[33] = q) : q = g[33];
179
+ }), a[59] = o, a[60] = s, a[61] = f, a[62] = q) : q = a[62];
111
180
  let J;
112
- g[34] === P ? J = g[35] : (J = P && /* @__PURE__ */ jsx(Loader2, { className: "mr-2 h-4 w-4 animate-spin" }), g[34] = P, g[35] = J);
113
- let Y = v ? "Save" : "Create", X;
114
- g[36] !== P || g[37] !== J || g[38] !== Y ? (X = /* @__PURE__ */ jsxs(Button, {
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: P,
118
- children: [J, Y]
119
- }), g[36] = P, g[37] = J, g[38] = Y, g[39] = X) : X = g[39];
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
- g[40] !== z || g[41] !== K || g[42] !== q || g[43] !== X ? (Z = /* @__PURE__ */ jsxs("form", {
122
- onSubmit: z,
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
- }), g[40] = z, g[41] = K, g[42] = q, g[43] = X, g[44] = Z) : Z = g[44];
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
- g[45] !== Z || g[46] !== R ? (Q = /* @__PURE__ */ jsxs("div", {
208
+ a[80] !== B || a[81] !== Z ? (Q = /* @__PURE__ */ jsxs("div", {
132
209
  className: "mb-4",
133
- children: [R, Z]
134
- }), g[45] = Z, g[46] = R, g[47] = Q) : Q = g[47];
210
+ children: [B, Z]
211
+ }), a[80] = B, a[81] = Z, a[82] = Q) : Q = a[82];
135
212
  let $;
136
- return g[48] !== Q || g[49] !== F || g[50] !== I ? ($ = /* @__PURE__ */ jsxs("div", { children: [
137
- F,
138
- I,
213
+ return a[83] !== R || a[84] !== z || a[85] !== Q ? ($ = /* @__PURE__ */ jsxs("div", { children: [
214
+ R,
215
+ z,
139
216
  Q
140
- ] }), g[48] = Q, g[49] = F, g[50] = I, g[51] = $) : $ = g[51], $;
217
+ ] }), a[83] = R, a[84] = z, a[85] = Q, a[86] = $) : $ = a[86], $;
141
218
  };
142
- function _temp(t) {
143
- return !t;
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 _temp2(t) {
228
+ function _temp3(e) {
146
229
  return /* @__PURE__ */ jsx(SelectItem, {
147
- value: t.blockName,
148
- children: t.title ?? t.blockName
149
- }, t.blockName);
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
- import ErrorSnackbar_default from "../../../components/snackbars/ErrorSnackbar.js";
5
- import { useBatchDeletePipeline, useChildPipelines, useFilterPipelines } from "../../../hooks/usePipelines.js";
5
+ import ErrorSnackbar_default from "../../../components/feedback/ErrorSnackbar.js";
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: r, formatUpdatedTime: i, getPipelineStatusColor: o, onChildClick: s } = e, { data: l, isPending: u } = useChildPipelines(r, !0);
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] !== i || n[6] !== o || n[7] !== s) {
34
+ if (n[4] !== f || n[5] !== a || n[6] !== o || n[7] !== s) {
34
35
  let e;
35
- n[9] !== i || n[10] !== o || n[11] !== s ? (e = (e) => /* @__PURE__ */ jsxs("div", {
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: (t) => {
38
- t.stopPropagation(), s(e.id);
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: i(e.updatedAt)
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] = i, n[10] = o, n[11] = s, n[12] = e) : e = n[12], p = f.map(e), n[4] = f, n[5] = i, n[6] = o, n[7] = s, n[8] = p;
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 = (a) => {
71
- let l = c(40), { workspace: h } = a, { router: g } = useStudio(), _ = useQueryClient(), [v, y] = useState(0), [b, x] = useState(25), [S, C] = useState(!1), w;
72
- l[0] === Symbol.for("react.memo_cache_sentinel") ? (w = /* @__PURE__ */ new Set(), l[0] = w) : w = l[0];
73
- let [T, E] = useState(w), D;
74
- l[1] === Symbol.for("react.memo_cache_sentinel") ? (D = (e, t) => {
75
- t.stopPropagation(), E((t) => {
76
- let n = new Set(t);
77
- return n.has(e) ? n.delete(e) : n.add(e), n;
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
- }, l[1] = D) : D = l[1];
80
- let se = D, O, k;
81
- l[2] === _ ? (O = l[3], k = l[4]) : (O = () => {
82
- _.invalidateQueries({ queryKey: ["pipelines"] });
83
- }, k = [_], l[2] = _, l[3] = O, l[4] = k), useEffect(O, 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
- l[5] === h.id ? j = l[6] : (j = {
86
- workspaceId: h.id,
86
+ s[5] === u.id ? j = s[6] : (j = {
87
+ workspaceId: u.id,
87
88
  parentId: null
88
- }, l[5] = h.id, l[6] = j);
89
- let M = useFilterPipelines(void 0, j, "createdAt", "DESC", v, b), N = useBatchDeletePipeline(), P;
90
- l[7] === N ? P = l[8] : (P = (e) => {
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
- }, l[7] = N, l[8] = P);
93
+ }, s[7] = N, s[8] = P);
93
94
  let F = P, I;
94
- l[9] === Symbol.for("react.memo_cache_sentinel") ? (I = () => {
95
- C(!0);
96
- }, l[9] = I) : I = l[9];
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
- l[10] === Symbol.for("react.memo_cache_sentinel") ? (R = () => {
99
- C(!1);
100
- }, l[10] = R) : R = l[10];
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
- l[11] === g ? B = l[12] : (B = (e) => {
103
- g.navigateToPipeline(e);
104
- }, l[11] = g, l[12] = B);
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
- l[13] === M.data?.data ? U = l[14] : (U = M.data?.data ?? [], l[13] = M.data?.data, l[14] = U);
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
- l[15] !== T || l[16] !== V ? (K = (e) => /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsxs("div", {
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: (t) => se(e.id, t),
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
- T.has(e.id) ? /* @__PURE__ */ jsx(ChevronDown, { className: "h-3 w-3" }) : /* @__PURE__ */ jsx(ChevronRight, { className: "h-3 w-3" }),
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 && T.has(e.id) && /* @__PURE__ */ jsx(ChildPipelineList, {
146
+ }), e.hasChildren > 0 && w.has(e.id) && /* @__PURE__ */ jsx(ChildPipelineList, {
146
147
  parentId: e.id,
147
148
  formatUpdatedTime: A,
148
- getPipelineStatusColor: H,
149
+ getPipelineStateColor: H,
149
150
  onChildClick: V
150
- })] }), l[15] = T, l[16] = V, l[17] = K) : K = l[17];
151
+ })] }), s[15] = w, s[16] = V, s[17] = K) : K = s[17];
151
152
  let q = K, J;
152
- l[18] === M.error ? J = l[19] : (J = /* @__PURE__ */ jsx(ErrorSnackbar_default, { error: M.error }), l[18] = M.error, l[19] = J);
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
- l[20] === M.isPending ? Y = l[21] : (Y = M.isPending ? /* @__PURE__ */ jsx("div", {
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
- }) : "", l[20] = M.isPending, l[21] = Y);
158
+ }) : "", s[20] = M.isPending, s[21] = Y);
158
159
  let X = M.error ?? null, Z;
159
- l[22] !== M.isPending || l[23] !== F || l[24] !== V || l[25] !== v || l[26] !== W || l[27] !== q || l[28] !== b || l[29] !== X || l[30] !== G ? (Z = /* @__PURE__ */ jsx(CustomListView_default, {
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: y,
167
- setRowsPerPage: x,
168
- page: v,
169
- rowsPerPage: b,
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
- }), l[22] = M.isPending, l[23] = F, l[24] = V, l[25] = v, l[26] = W, l[27] = q, l[28] = b, l[29] = X, l[30] = G, l[31] = Z) : Z = l[31];
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
- l[32] !== S || l[33] !== h ? (Q = /* @__PURE__ */ jsx(NewPipelineRunDialog_default, {
177
- isOpen: S,
178
- onOpenChange: C,
179
- workspace: h,
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
- }), l[32] = S, l[33] = h, l[34] = Q) : Q = l[34];
182
+ }), s[32] = x, s[33] = u, s[34] = Q) : Q = s[34];
182
183
  let $;
183
- return l[35] !== J || l[36] !== Y || l[37] !== Z || l[38] !== Q ? ($ = /* @__PURE__ */ jsxs("div", { children: [
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
- ] }), l[35] = J, l[36] = Y, l[37] = Z, l[38] = Q, l[39] = $) : $ = l[39], $;
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 t = parseISO(e);
192
- return isToday(t) ? formatDistanceToNow(t, { addSuffix: !0 }) : isYesterday(t) ? `Yesterday at ${format(t, "h:mm a")}` : format(t, "MMM d, yyyy h:mm a");
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 "completed": return "bg-green-600";
197
- case "paused": return "bg-yellow-600";
198
- case "failed": return "bg-red-600";
199
- case "canceled":
200
- case "pending":
201
- case "running": return "bg-black";
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 };