@loopstack/loopstack-studio 0.32.0 → 0.34.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/index.js +4 -1
- package/dist/api/workflows.js +1 -0
- package/dist/app/EnvironmentEmbedRoot.js +22 -24
- package/dist/components/loopstack-elements/link.js +64 -56
- package/dist/components/messages/CompletionMessagePaper.js +25 -29
- package/dist/events/sse-client-events.js +2 -0
- package/dist/features/dashboard/AppLauncher.js +111 -64
- package/dist/features/documents/DocumentRenderer.js +42 -42
- package/dist/features/documents/renderers/LinkMessageRenderer.js +10 -10
- package/dist/features/feature-registry/FeatureRegistryProvider.js +15 -17
- package/dist/features/feature-registry/available-features.js +3 -2
- package/dist/features/feature-registry/index.js +1 -1
- package/dist/features/file-explorer/api/files.js +8 -3
- package/dist/features/file-explorer/components/FileExplorerPanel.js +64 -43
- package/dist/features/file-explorer/file-explorer-feature.js +15 -7
- package/dist/features/file-explorer/hooks/useFileExplorer.js +31 -29
- package/dist/features/file-explorer/index.js +1 -1
- package/dist/features/file-explorer/providers/FileExplorerProvider.js +77 -77
- package/dist/features/git/components/WorkbenchGitPanel.js +1 -1
- package/dist/features/secrets/components/WorkbenchSecretsPanel.js +1 -1
- package/dist/features/workbench/Workbench.js +16 -16
- package/dist/features/workbench/components/NewRunDialog.js +1 -1
- package/dist/features/workbench/components/WorkbenchIconSidebar.js +1 -1
- package/dist/features/workbench/components/WorkbenchSidebarShell.js +3 -3
- package/dist/features/workbench/index.js +1 -1
- package/dist/features/workspaces/Workspaces.js +1 -1
- package/dist/hooks/index.js +2 -2
- package/dist/hooks/query-keys.js +39 -32
- package/dist/hooks/useSecrets.js +9 -45
- package/dist/hooks/useWorkflows.js +73 -61
- package/dist/index.d.ts +39 -13
- package/dist/index.js +8 -8
- package/dist/loopstack-studio.css +1 -1
- package/dist/pages/EmbedWorkbenchPage.js +46 -40
- package/dist/pages/WorkbenchPage.js +50 -45
- package/dist/pages/WorkspacePage.js +39 -25
- package/dist/pages/WorkspaceRunsPage.js +34 -26
- package/dist/providers/InvalidationEventsProvider.js +22 -20
- package/package.json +2 -2
package/dist/api/index.js
CHANGED
|
@@ -17,7 +17,10 @@ function createApi(f) {
|
|
|
17
17
|
dashboard: createDashboardApi(f),
|
|
18
18
|
documents: createDocumentsApi(f),
|
|
19
19
|
environments: createEnvironmentsApi(f),
|
|
20
|
-
files:
|
|
20
|
+
files: {
|
|
21
|
+
local: createFilesApi(f, "local"),
|
|
22
|
+
remote: createFilesApi(f, "remote")
|
|
23
|
+
},
|
|
21
24
|
git: createGitApi(f),
|
|
22
25
|
processor: createProcessorApi(f),
|
|
23
26
|
secrets: createSecretsApi(f),
|
package/dist/api/workflows.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
function createWorkflowsApi(e) {
|
|
2
2
|
return {
|
|
3
3
|
getById: (t) => e.get(`/api/v1/workflows/${t.id}`).then((e) => e.data),
|
|
4
|
+
getStatusById: (t) => e.get(`/api/v1/workflows/${t.id}/status`).then((e) => e.data),
|
|
4
5
|
getAll: (t) => e.get("/api/v1/workflows", { params: t }).then((e) => e.data),
|
|
5
6
|
create: (t) => e.post("/api/v1/workflows", t.workflowCreateDto).then((e) => e.data),
|
|
6
7
|
update: (t) => e.put(`/api/v1/workflows/${t.id}`, t.workflowUpdateDto).then((e) => e.data),
|
|
@@ -2,36 +2,34 @@ import { StudioProvider } from "../providers/StudioProvider.js";
|
|
|
2
2
|
import { SseProvider } from "../providers/SseProvider.js";
|
|
3
3
|
import { InvalidationEventsProvider } from "../providers/InvalidationEventsProvider.js";
|
|
4
4
|
import { useRouter } from "../routing/LocalRouter.js";
|
|
5
|
-
import { FeatureRegistryProvider } from "../features/feature-registry/FeatureRegistryProvider.js";
|
|
6
|
-
import "../features/feature-registry/index.js";
|
|
7
5
|
import LocalHealthCheck_default from "../features/health/LocalHealthCheck.js";
|
|
8
6
|
import { QueryProvider } from "../providers/QueryProvider.js";
|
|
9
7
|
import { c } from "react/compiler-runtime";
|
|
10
8
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
11
9
|
import { Outlet, useSearchParams } from "react-router-dom";
|
|
12
10
|
function EnvironmentEmbedRoot() {
|
|
13
|
-
let
|
|
14
|
-
|
|
15
|
-
let
|
|
16
|
-
|
|
17
|
-
let
|
|
18
|
-
|
|
11
|
+
let f = c(14), [p] = useSearchParams(), m;
|
|
12
|
+
f[0] === p ? m = f[1] : (m = p.get("url") ?? "http://localhost:3080", f[0] = p, f[1] = m);
|
|
13
|
+
let h = m, g;
|
|
14
|
+
f[2] === p ? g = f[3] : (g = p.get("name") ?? "Preview Environment", f[2] = p, f[3] = g);
|
|
15
|
+
let _ = g, v;
|
|
16
|
+
f[4] !== _ || f[5] !== h ? (v = {
|
|
19
17
|
id: "preview-env",
|
|
20
|
-
name:
|
|
21
|
-
url:
|
|
22
|
-
},
|
|
23
|
-
let
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}) }),
|
|
18
|
+
name: _,
|
|
19
|
+
url: h
|
|
20
|
+
}, f[4] = _, f[5] = h, f[6] = v) : v = f[6];
|
|
21
|
+
let y = v, b = useRouter(y.id, "/embed/env"), x, S, C, w;
|
|
22
|
+
f[7] === Symbol.for("react.memo_cache_sentinel") ? (x = /* @__PURE__ */ jsx(LocalHealthCheck_default, {}), S = /* @__PURE__ */ jsx(SseProvider, {}), C = /* @__PURE__ */ jsx(InvalidationEventsProvider, {}), w = /* @__PURE__ */ jsx(Outlet, {}), f[7] = x, f[8] = S, f[9] = C, f[10] = w) : (x = f[7], S = f[8], C = f[9], w = f[10]);
|
|
23
|
+
let T;
|
|
24
|
+
return f[11] !== y || f[12] !== b ? (T = /* @__PURE__ */ jsx(QueryProvider, { children: /* @__PURE__ */ jsxs(StudioProvider, {
|
|
25
|
+
router: b,
|
|
26
|
+
environment: y,
|
|
27
|
+
children: [
|
|
28
|
+
x,
|
|
29
|
+
S,
|
|
30
|
+
C,
|
|
31
|
+
w
|
|
32
|
+
]
|
|
33
|
+
}) }), f[11] = y, f[12] = b, f[13] = T) : T = f[13], T;
|
|
36
34
|
}
|
|
37
35
|
export { EnvironmentEmbedRoot as default };
|
|
@@ -3,114 +3,122 @@ import { useStudio } from "../../providers/StudioProvider.js";
|
|
|
3
3
|
import { cn } from "../../lib/utils.js";
|
|
4
4
|
import { Tooltip, TooltipContent, TooltipTrigger } from "../ui/tooltip.js";
|
|
5
5
|
import { c } from "react/compiler-runtime";
|
|
6
|
-
import { useEffect, useState } from "react";
|
|
6
|
+
import { useEffect, useRef, useState } from "react";
|
|
7
7
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
8
|
import { ChevronDownIcon, ChevronUpIcon, ExternalLinkIcon, FolderClosedIcon, FolderOpenIcon } from "lucide-react";
|
|
9
9
|
var EMBED_RESIZE_MESSAGE_TYPE = "loopstack:embed:resize", statusColorMap = {
|
|
10
10
|
pending: "text-muted-foreground",
|
|
11
11
|
success: "text-green-600",
|
|
12
12
|
failure: "text-red-600"
|
|
13
|
-
}, WORKFLOW_HREF_PATTERN = /^\/workflows\/([a-zA-Z0-9_-]+)$/, link_default = (
|
|
14
|
-
let
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
}, WORKFLOW_HREF_PATTERN = /^\/workflows\/([a-zA-Z0-9_-]+)$/, link_default = (u) => {
|
|
14
|
+
let d = c(61), { className: f, href: p, label: m, status: h, embed: g, defaultExpanded: _ } = u, v = h === void 0 ? "pending" : h, { router: y } = useStudio(), [b, x] = useState(_ ?? !1), [S, C] = useState(0), w = useRef(_ !== void 0), T, E;
|
|
15
|
+
d[0] === _ ? (T = d[1], E = d[2]) : (T = () => {
|
|
16
|
+
w.current || _ === void 0 || (x(_), w.current = !0);
|
|
17
|
+
}, E = [_], d[0] = _, d[1] = T, d[2] = E), useEffect(T, E);
|
|
18
|
+
let D;
|
|
19
|
+
d[3] !== p || d[4] !== m ? (D = m || (() => {
|
|
20
|
+
if (!p) return "";
|
|
17
21
|
try {
|
|
18
|
-
return new URL(
|
|
22
|
+
return new URL(p).hostname.replace("www.", "");
|
|
19
23
|
} catch {
|
|
20
|
-
return
|
|
24
|
+
return p;
|
|
21
25
|
}
|
|
22
|
-
})(),
|
|
23
|
-
let
|
|
24
|
-
|
|
25
|
-
let
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
26
|
+
})(), d[3] = p, d[4] = m, d[5] = D) : D = d[5];
|
|
27
|
+
let O = D, k, A;
|
|
28
|
+
d[6] !== g || d[7] !== p || d[8] !== y ? (A = p?.match(WORKFLOW_HREF_PATTERN)?.[1] ?? null, k = g === !0 && A != null ? y.getEmbedWorkflow(A) : null, d[6] = g, d[7] = p, d[8] = y, d[9] = k, d[10] = A) : (k = d[9], A = d[10]);
|
|
29
|
+
let j = k, M, N;
|
|
30
|
+
d[11] === v ? (M = d[12], N = d[13]) : (M = () => {
|
|
31
|
+
(v === "success" || v === "failure") && x(!1);
|
|
32
|
+
}, N = [v], d[11] = v, d[12] = M, d[13] = N), useEffect(M, N);
|
|
33
|
+
let P, F;
|
|
34
|
+
d[14] !== b || d[15] !== A ? (P = () => {
|
|
35
|
+
if (!A || !b) return;
|
|
36
|
+
let e = (e) => {
|
|
37
|
+
if (e.origin !== window.location.origin) return;
|
|
38
|
+
let s = e.data;
|
|
39
|
+
if (s?.type !== EMBED_RESIZE_MESSAGE_TYPE || s?.workflowId !== A) return;
|
|
40
|
+
let l = s?.height;
|
|
41
|
+
typeof l == "number" && l > 0 && C(l);
|
|
34
42
|
};
|
|
35
|
-
return window.addEventListener("message",
|
|
36
|
-
}, F = [
|
|
43
|
+
return window.addEventListener("message", e), () => window.removeEventListener("message", e);
|
|
44
|
+
}, F = [A, b], d[14] = b, d[15] = A, d[16] = P, d[17] = F) : (P = d[16], F = d[17]), useEffect(P, F);
|
|
37
45
|
let I;
|
|
38
|
-
|
|
46
|
+
d[18] === f ? I = d[19] : (I = cn("not-prose flex w-full cursor-pointer flex-col", f), d[18] = f, d[19] = I);
|
|
39
47
|
let L;
|
|
40
|
-
|
|
41
|
-
let R = statusColorMap[
|
|
42
|
-
|
|
48
|
+
d[20] === j ? L = d[21] : (L = () => j && x(_temp), d[20] = j, d[21] = L);
|
|
49
|
+
let R = statusColorMap[v], z;
|
|
50
|
+
d[22] === R ? z = d[23] : (z = cn("flex shrink-0 items-center", R), d[22] = R, d[23] = z);
|
|
43
51
|
let B;
|
|
44
|
-
|
|
52
|
+
d[24] === b ? B = d[25] : (B = jsx(b ? FolderOpenIcon : FolderClosedIcon, { className: "size-4" }), d[24] = b, d[25] = B);
|
|
45
53
|
let V;
|
|
46
|
-
|
|
54
|
+
d[26] !== z || d[27] !== B ? (V = /* @__PURE__ */ jsx(TooltipTrigger, {
|
|
47
55
|
asChild: !0,
|
|
48
56
|
children: /* @__PURE__ */ jsx("span", {
|
|
49
57
|
className: z,
|
|
50
58
|
children: B
|
|
51
59
|
})
|
|
52
|
-
}),
|
|
53
|
-
let H =
|
|
54
|
-
|
|
60
|
+
}), d[26] = z, d[27] = B, d[28] = V) : V = d[28];
|
|
61
|
+
let H = b ? "Collapse" : "Expand", U;
|
|
62
|
+
d[29] === H ? U = d[30] : (U = /* @__PURE__ */ jsx(TooltipContent, {
|
|
55
63
|
side: "top",
|
|
56
64
|
children: H
|
|
57
|
-
}),
|
|
65
|
+
}), d[29] = H, d[30] = U);
|
|
58
66
|
let W;
|
|
59
|
-
|
|
60
|
-
let G =
|
|
61
|
-
|
|
67
|
+
d[31] !== V || d[32] !== U ? (W = /* @__PURE__ */ jsxs(Tooltip, { children: [V, U] }), d[31] = V, d[32] = U, d[33] = W) : W = d[33];
|
|
68
|
+
let G = b ? "font-medium" : "text-muted-foreground", K;
|
|
69
|
+
d[34] === G ? K = d[35] : (K = cn("min-w-0 flex-1 truncate text-sm", G), d[34] = G, d[35] = K);
|
|
62
70
|
let q;
|
|
63
|
-
|
|
71
|
+
d[36] !== O || d[37] !== K ? (q = /* @__PURE__ */ jsx("span", {
|
|
64
72
|
className: K,
|
|
65
|
-
children:
|
|
66
|
-
}),
|
|
73
|
+
children: O
|
|
74
|
+
}), d[36] = O, d[37] = K, d[38] = q) : q = d[38];
|
|
67
75
|
let J;
|
|
68
|
-
|
|
69
|
-
href:
|
|
76
|
+
d[39] === p ? J = d[40] : (J = p && /* @__PURE__ */ jsx("a", {
|
|
77
|
+
href: p,
|
|
70
78
|
target: "_blank",
|
|
71
79
|
rel: "noopener noreferrer",
|
|
72
80
|
onClick: _temp2,
|
|
73
81
|
className: "text-muted-foreground hover:text-foreground flex items-center justify-center transition-colors",
|
|
74
82
|
children: /* @__PURE__ */ jsx(ExternalLinkIcon, { className: "size-3.5" })
|
|
75
|
-
}),
|
|
83
|
+
}), d[39] = p, d[40] = J);
|
|
76
84
|
let Y;
|
|
77
|
-
|
|
85
|
+
d[41] !== j || d[42] !== b ? (Y = j && jsx(b ? ChevronUpIcon : ChevronDownIcon, { className: "text-muted-foreground size-3.5" }), d[41] = j, d[42] = b, d[43] = Y) : Y = d[43];
|
|
78
86
|
let X;
|
|
79
|
-
|
|
87
|
+
d[44] !== J || d[45] !== Y ? (X = /* @__PURE__ */ jsxs("div", {
|
|
80
88
|
className: "flex shrink-0 items-center gap-1",
|
|
81
89
|
children: [J, Y]
|
|
82
|
-
}),
|
|
90
|
+
}), d[44] = J, d[45] = Y, d[46] = X) : X = d[46];
|
|
83
91
|
let Z;
|
|
84
|
-
|
|
92
|
+
d[47] !== W || d[48] !== q || d[49] !== X ? (Z = /* @__PURE__ */ jsxs("div", {
|
|
85
93
|
className: "flex w-full items-center gap-1.5 py-1",
|
|
86
94
|
children: [
|
|
87
95
|
W,
|
|
88
96
|
q,
|
|
89
97
|
X
|
|
90
98
|
]
|
|
91
|
-
}),
|
|
99
|
+
}), d[47] = W, d[48] = q, d[49] = X, d[50] = Z) : Z = d[50];
|
|
92
100
|
let Q;
|
|
93
|
-
|
|
101
|
+
d[51] !== O || d[52] !== j || d[53] !== b || d[54] !== S ? (Q = b && j && /* @__PURE__ */ jsx("div", {
|
|
94
102
|
className: "mt-2 border-t",
|
|
95
103
|
children: /* @__PURE__ */ jsx("iframe", {
|
|
96
|
-
src:
|
|
104
|
+
src: j,
|
|
97
105
|
className: "w-full overflow-hidden border-0",
|
|
98
|
-
style: { height: `${
|
|
106
|
+
style: { height: `${S}px` },
|
|
99
107
|
scrolling: "no",
|
|
100
|
-
title:
|
|
108
|
+
title: O
|
|
101
109
|
})
|
|
102
|
-
}),
|
|
110
|
+
}), d[51] = O, d[52] = j, d[53] = b, d[54] = S, d[55] = Q) : Q = d[55];
|
|
103
111
|
let $;
|
|
104
|
-
return
|
|
112
|
+
return d[56] !== I || d[57] !== L || d[58] !== Z || d[59] !== Q ? ($ = /* @__PURE__ */ jsxs("div", {
|
|
105
113
|
className: I,
|
|
106
114
|
onClick: L,
|
|
107
115
|
children: [Z, Q]
|
|
108
|
-
}),
|
|
116
|
+
}), d[56] = I, d[57] = L, d[58] = Z, d[59] = Q, d[60] = $) : $ = d[60], $;
|
|
109
117
|
};
|
|
110
|
-
function _temp(
|
|
111
|
-
return !
|
|
118
|
+
function _temp(e) {
|
|
119
|
+
return !e;
|
|
112
120
|
}
|
|
113
|
-
function _temp2(
|
|
114
|
-
return
|
|
121
|
+
function _temp2(e) {
|
|
122
|
+
return e.stopPropagation();
|
|
115
123
|
}
|
|
116
124
|
export { link_default as default };
|
|
@@ -4,7 +4,7 @@ import { c } from "react/compiler-runtime";
|
|
|
4
4
|
import React from "react";
|
|
5
5
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
6
|
var CompletionMessagePaper_default = (s) => {
|
|
7
|
-
let l = c(
|
|
7
|
+
let l = c(33), { role: u, children: d, timestamp: f, metadata: p, fullWidth: m, className: h } = s, g = m === void 0 ? !1 : m, _;
|
|
8
8
|
l[0] === Symbol.for("react.memo_cache_sentinel") ? (_ = {
|
|
9
9
|
system: {
|
|
10
10
|
color: "#efb108",
|
|
@@ -58,46 +58,42 @@ var CompletionMessagePaper_default = (s) => {
|
|
|
58
58
|
}), l[15] = b, l[16] = p, l[17] = A) : A = l[17];
|
|
59
59
|
let j = g ? "w-full" : "w-auto", M;
|
|
60
60
|
l[18] === j ? M = l[19] : (M = cn("relative max-w-full px-6 py-4 wrap-break-word shadow-none", j), l[18] = j, l[19] = M);
|
|
61
|
-
let N
|
|
62
|
-
l[20] ===
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
children: F
|
|
72
|
-
}), l[24] = P, l[25] = F, l[26] = I) : I = l[26];
|
|
73
|
-
let L;
|
|
74
|
-
l[27] !== M || l[28] !== I ? (L = /* @__PURE__ */ jsx(Card, {
|
|
61
|
+
let N;
|
|
62
|
+
l[20] === d ? N = l[21] : (N = /* @__PURE__ */ jsx("div", {
|
|
63
|
+
className: "text-foreground leading-relaxed wrap-break-word whitespace-pre-wrap",
|
|
64
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
65
|
+
className: "message-content",
|
|
66
|
+
children: d
|
|
67
|
+
})
|
|
68
|
+
}), l[20] = d, l[21] = N);
|
|
69
|
+
let P;
|
|
70
|
+
l[22] !== M || l[23] !== N ? (P = /* @__PURE__ */ jsx(Card, {
|
|
75
71
|
className: M,
|
|
76
|
-
children:
|
|
77
|
-
}), l[
|
|
78
|
-
let
|
|
79
|
-
l[
|
|
72
|
+
children: N
|
|
73
|
+
}), l[22] = M, l[23] = N, l[24] = P) : P = l[24];
|
|
74
|
+
let F;
|
|
75
|
+
l[25] !== k || l[26] !== A || l[27] !== P || l[28] !== E ? (F = /* @__PURE__ */ jsxs("div", {
|
|
80
76
|
className: E,
|
|
81
77
|
children: [
|
|
82
78
|
k,
|
|
83
79
|
A,
|
|
84
|
-
|
|
80
|
+
P
|
|
85
81
|
]
|
|
86
|
-
}), l[
|
|
87
|
-
let
|
|
88
|
-
return l[
|
|
82
|
+
}), l[25] = k, l[26] = A, l[27] = P, l[28] = E, l[29] = F) : F = l[29];
|
|
83
|
+
let I;
|
|
84
|
+
return l[30] !== F || l[31] !== C ? (I = /* @__PURE__ */ jsx("div", {
|
|
89
85
|
className: C,
|
|
90
|
-
children:
|
|
91
|
-
}), l[
|
|
86
|
+
children: F
|
|
87
|
+
}), l[30] = F, l[31] = C, l[32] = I) : I = l[32], I;
|
|
92
88
|
};
|
|
93
|
-
function _temp(
|
|
94
|
-
return
|
|
89
|
+
function _temp(t) {
|
|
90
|
+
return t.toLocaleTimeString([], {
|
|
95
91
|
hour: "2-digit",
|
|
96
92
|
minute: "2-digit"
|
|
97
93
|
});
|
|
98
94
|
}
|
|
99
|
-
function _temp2(
|
|
100
|
-
let [a, o] =
|
|
95
|
+
function _temp2(t) {
|
|
96
|
+
let [a, o] = t;
|
|
101
97
|
return /* @__PURE__ */ jsxs("div", {
|
|
102
98
|
className: "text-muted-foreground font-mono text-xs",
|
|
103
99
|
children: [
|
|
@@ -2,6 +2,8 @@ const SseClientEvents = {
|
|
|
2
2
|
WORKFLOW_CREATED: "workflow.created",
|
|
3
3
|
WORKFLOW_UPDATED: "workflow.updated",
|
|
4
4
|
DOCUMENT_CREATED: "document.created",
|
|
5
|
+
SECRET_UPSERTED: "secret.upserted",
|
|
6
|
+
SECRET_DELETED: "secret.deleted",
|
|
5
7
|
SSE_CONNECTED: "sse.connected",
|
|
6
8
|
LLM_RESPONSE_START: "llm.response.start",
|
|
7
9
|
LLM_RESPONSE_TEXT_DELTA: "llm.response.text_delta",
|
|
@@ -1,84 +1,131 @@
|
|
|
1
1
|
import { useStudio } from "../../providers/StudioProvider.js";
|
|
2
|
+
import { useFilterWorkspaces } from "../../hooks/useWorkspaces.js";
|
|
2
3
|
import { useComponentOverrides } from "../../providers/ComponentOverridesProvider.js";
|
|
3
4
|
import { Button } from "../../components/ui/button.js";
|
|
4
5
|
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "../../components/ui/card.js";
|
|
5
6
|
import { Dialog, DialogContent } from "../../components/ui/dialog.js";
|
|
6
7
|
import CreateWorkspace_default from "../workspaces/components/CreateWorkspace.js";
|
|
8
|
+
import { AVAILABLE_FEATURES } from "../feature-registry/available-features.js";
|
|
7
9
|
import { c } from "react/compiler-runtime";
|
|
8
10
|
import { useMemo, useState } from "react";
|
|
9
11
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
10
12
|
import { Link } from "react-router-dom";
|
|
11
|
-
import { Boxes, FolderOpen, Plus } from "lucide-react";
|
|
12
|
-
function
|
|
13
|
-
let S =
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
19
|
-
let
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
13
|
+
import { Boxes, FolderOpen, Plus, Server } from "lucide-react";
|
|
14
|
+
function getCapabilityIcons(e) {
|
|
15
|
+
let S = [];
|
|
16
|
+
for (let C of e.extensions?.environments ?? []) S.push({
|
|
17
|
+
key: `env:${C.id}`,
|
|
18
|
+
Icon: Server,
|
|
19
|
+
label: C.title ?? C.id
|
|
20
|
+
});
|
|
21
|
+
for (let C of e.features) {
|
|
22
|
+
if (C.enabled === !1) continue;
|
|
23
|
+
let e = AVAILABLE_FEATURES[C.id];
|
|
24
|
+
e?.sidebarPanel && S.push({
|
|
25
|
+
key: `feature:${e.id}`,
|
|
26
|
+
Icon: e.sidebarPanel.icon,
|
|
27
|
+
label: e.sidebarPanel.label
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
return S;
|
|
31
|
+
}
|
|
32
|
+
function AppLauncher(w) {
|
|
33
|
+
let T = c(30), { apps: E } = w, { CreateWorkspace: D } = useComponentOverrides(), O = D ?? CreateWorkspace_default, { router: k } = useStudio(), [A, j] = useState(null), M;
|
|
34
|
+
T[0] === Symbol.for("react.memo_cache_sentinel") ? (M = {}, T[0] = M) : M = T[0];
|
|
35
|
+
let N = useFilterWorkspaces(void 0, M, "id", "DESC", 0, 1e3), P;
|
|
36
|
+
if (T[1] !== N.data?.data) {
|
|
37
|
+
P = {};
|
|
38
|
+
for (let e of N.data?.data ?? []) P[e.appName] = (P[e.appName] ?? 0) + 1;
|
|
39
|
+
T[1] = N.data?.data, T[2] = P;
|
|
40
|
+
} else P = T[2];
|
|
41
|
+
let F = P, I;
|
|
42
|
+
T[3] === A ? I = T[4] : (I = A ? [{
|
|
43
|
+
appName: A.appName,
|
|
44
|
+
title: A.title,
|
|
45
|
+
environments: A.extensions?.environments ?? []
|
|
46
|
+
}] : [], T[3] = A, T[4] = I);
|
|
47
|
+
let L = I, R;
|
|
48
|
+
T[5] === k ? R = T[6] : (R = (e) => {
|
|
49
|
+
j(null), e && k.navigateToWorkspace(e.id);
|
|
50
|
+
}, T[5] = k, T[6] = R);
|
|
51
|
+
let z = R, B;
|
|
52
|
+
if (T[7] !== E || T[8] !== k || T[9] !== F) {
|
|
25
53
|
let e;
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
className: "flex
|
|
30
|
-
children: [/* @__PURE__ */
|
|
31
|
-
className: "
|
|
32
|
-
children:
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
54
|
+
T[11] !== k || T[12] !== F ? (e = (e) => {
|
|
55
|
+
let S = getCapabilityIcons(e), C = F[e.appName] ?? 0;
|
|
56
|
+
return /* @__PURE__ */ jsxs(Card, {
|
|
57
|
+
className: "flex flex-col",
|
|
58
|
+
children: [/* @__PURE__ */ jsxs(CardHeader, { children: [/* @__PURE__ */ jsxs("div", {
|
|
59
|
+
className: "flex items-start justify-between gap-2",
|
|
60
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
61
|
+
className: "flex items-center gap-2",
|
|
62
|
+
children: [/* @__PURE__ */ jsx(Boxes, { className: "text-muted-foreground h-5 w-5" }), /* @__PURE__ */ jsx(CardTitle, {
|
|
63
|
+
className: "text-base",
|
|
64
|
+
children: e.title
|
|
65
|
+
})]
|
|
66
|
+
}), S.length > 0 && /* @__PURE__ */ jsx("div", {
|
|
67
|
+
className: "text-muted-foreground flex shrink-0 items-center gap-1",
|
|
68
|
+
children: S.map(_temp)
|
|
69
|
+
})]
|
|
70
|
+
}), e.description && /* @__PURE__ */ jsx(CardDescription, { children: e.description })] }), /* @__PURE__ */ jsx(CardContent, {
|
|
71
|
+
className: "mt-auto",
|
|
72
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
73
|
+
className: "flex gap-2",
|
|
74
|
+
children: C > 0 ? /* @__PURE__ */ jsx(Button, {
|
|
75
|
+
variant: "ghost",
|
|
76
|
+
size: "sm",
|
|
77
|
+
className: "flex-1",
|
|
78
|
+
asChild: !0,
|
|
79
|
+
children: /* @__PURE__ */ jsxs(Link, {
|
|
80
|
+
to: `${k.getWorkspaces()}?appName=${encodeURIComponent(e.appName)}`,
|
|
81
|
+
children: [/* @__PURE__ */ jsx(FolderOpen, { className: "mr-1 h-4 w-4" }), "View Workspaces"]
|
|
82
|
+
})
|
|
83
|
+
}) : /* @__PURE__ */ jsxs(Button, {
|
|
84
|
+
variant: "outline",
|
|
85
|
+
size: "sm",
|
|
86
|
+
className: "flex-1",
|
|
87
|
+
onClick: () => j(e),
|
|
88
|
+
children: [/* @__PURE__ */ jsx(Plus, { className: "mr-1 h-4 w-4" }), "Configure"]
|
|
89
|
+
})
|
|
44
90
|
})
|
|
45
|
-
}), /* @__PURE__ */ jsxs(Button, {
|
|
46
|
-
variant: "outline",
|
|
47
|
-
size: "sm",
|
|
48
|
-
className: "flex-1",
|
|
49
|
-
onClick: () => O(e),
|
|
50
|
-
children: [/* @__PURE__ */ jsx(Plus, { className: "mr-1 h-4 w-4" }), "Create Workspace"]
|
|
51
91
|
})]
|
|
52
|
-
})
|
|
53
|
-
},
|
|
54
|
-
} else
|
|
55
|
-
let
|
|
56
|
-
|
|
92
|
+
}, e.appName);
|
|
93
|
+
}, T[11] = k, T[12] = F, T[13] = e) : e = T[13], B = E.map(e), T[7] = E, T[8] = k, T[9] = F, T[10] = B;
|
|
94
|
+
} else B = T[10];
|
|
95
|
+
let V;
|
|
96
|
+
T[14] === B ? V = T[15] : (V = /* @__PURE__ */ jsx("div", {
|
|
57
97
|
className: "mb-8",
|
|
58
98
|
children: /* @__PURE__ */ jsx("div", {
|
|
59
99
|
className: "grid grid-cols-1 gap-4 md:grid-cols-2 lg:grid-cols-3",
|
|
60
|
-
children:
|
|
100
|
+
children: B
|
|
61
101
|
})
|
|
62
|
-
}),
|
|
63
|
-
let
|
|
64
|
-
|
|
65
|
-
let
|
|
66
|
-
|
|
67
|
-
types:
|
|
68
|
-
onSuccess:
|
|
69
|
-
}),
|
|
70
|
-
let
|
|
71
|
-
|
|
102
|
+
}), T[14] = B, T[15] = V);
|
|
103
|
+
let H = !!A, U;
|
|
104
|
+
T[16] === Symbol.for("react.memo_cache_sentinel") ? (U = (e) => !e && j(null), T[16] = U) : U = T[16];
|
|
105
|
+
let W;
|
|
106
|
+
T[17] !== O || T[18] !== L || T[19] !== z || T[20] !== A ? (W = A && /* @__PURE__ */ jsx(O, {
|
|
107
|
+
types: L,
|
|
108
|
+
onSuccess: z
|
|
109
|
+
}), T[17] = O, T[18] = L, T[19] = z, T[20] = A, T[21] = W) : W = T[21];
|
|
110
|
+
let G;
|
|
111
|
+
T[22] === W ? G = T[23] : (G = /* @__PURE__ */ jsx(DialogContent, {
|
|
72
112
|
className: "max-w-2xl",
|
|
73
|
-
children:
|
|
74
|
-
}),
|
|
75
|
-
let
|
|
76
|
-
|
|
77
|
-
open:
|
|
78
|
-
onOpenChange:
|
|
79
|
-
children:
|
|
80
|
-
}),
|
|
81
|
-
let
|
|
82
|
-
return
|
|
113
|
+
children: W
|
|
114
|
+
}), T[22] = W, T[23] = G);
|
|
115
|
+
let K;
|
|
116
|
+
T[24] !== H || T[25] !== G ? (K = /* @__PURE__ */ jsx(Dialog, {
|
|
117
|
+
open: H,
|
|
118
|
+
onOpenChange: U,
|
|
119
|
+
children: G
|
|
120
|
+
}), T[24] = H, T[25] = G, T[26] = K) : K = T[26];
|
|
121
|
+
let q;
|
|
122
|
+
return T[27] !== K || T[28] !== V ? (q = /* @__PURE__ */ jsxs(Fragment$1, { children: [V, K] }), T[27] = K, T[28] = V, T[29] = q) : q = T[29], q;
|
|
123
|
+
}
|
|
124
|
+
function _temp(e) {
|
|
125
|
+
let { key: S, Icon: C } = e;
|
|
126
|
+
return /* @__PURE__ */ jsx("span", {
|
|
127
|
+
className: "inline-flex h-6 w-6 items-center justify-center",
|
|
128
|
+
children: /* @__PURE__ */ jsx(C, { className: "h-4 w-4" })
|
|
129
|
+
}, S);
|
|
83
130
|
}
|
|
84
131
|
export { AppLauncher as default };
|