@ultrst-armada/floks 2.0.4 → 2.0.7
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/.krusbl-release-attestation.json +3 -3
- package/package.json +3 -3
- package/packages/canvas-ui/dist/authoring/authoringOperations.d.ts +41 -0
- package/packages/canvas-ui/dist/authoring/authoringOperations.test.d.ts +1 -0
- package/packages/canvas-ui/dist/authoring/index.d.ts +1 -0
- package/packages/canvas-ui/dist/authoring/index.js +17 -3
- package/packages/canvas-ui/dist/{chunk-TS7P3WWH.js → chunk-CI4C6DJR.js} +108 -24
- package/packages/canvas-ui/dist/index.js +25 -11
- package/packages/canvas-ui/package.json +2 -2
- package/packages/ui/dist/chunk-2YP2RPJY.js +54 -0
- package/packages/ui/dist/{chunk-4GMTEWLE.js → chunk-6EYOJ4DD.js} +2 -2
- package/packages/ui/dist/{chunk-DZTJJOLR.js → chunk-DEKSKDSF.js} +26 -13
- package/packages/ui/dist/{chunk-HWYGCCRL.js → chunk-FA6GHJKU.js} +2 -2
- package/packages/ui/dist/{chunk-OMNGRMJY.js → chunk-FVOZFKV7.js} +601 -534
- package/packages/ui/dist/{chunk-G5CYPT3P.js → chunk-IYBFDSTU.js} +93 -9
- package/packages/ui/dist/{chunk-GOUFV3B4.js → chunk-RLM72WKL.js} +1 -1
- package/packages/ui/dist/components/auth/index.js +3 -3
- package/packages/ui/dist/components/graph/index.js +3 -3
- package/packages/ui/dist/components/tiles/index.js +2 -2
- package/packages/ui/dist/components/workspace/GoogleDriveWorkspacePicker.d.ts +2 -2
- package/packages/ui/dist/components/workspace/WorkspaceCreateDialog.backblaze.test.d.ts +1 -0
- package/packages/ui/dist/components/workspace/WorkspaceCreateDialog.d.ts +45 -12
- package/packages/ui/dist/components/workspace/WorkspaceCreateDialog.kloks-service.test.d.ts +1 -0
- package/packages/ui/dist/components/workspace/WorkspaceGate.d.ts +3 -1
- package/packages/ui/dist/components/workspace/WorkspaceTilesMenu.d.ts +1 -1
- package/packages/ui/dist/components/workspace/index.d.ts +0 -3
- package/packages/ui/dist/components/workspace/index.js +3 -9
- package/packages/ui/dist/frnl/frnlPage.d.ts +30 -0
- package/packages/ui/dist/frnl/frnlTabWindow.d.ts +21 -0
- package/packages/ui/dist/frnl/index.d.ts +3 -1
- package/packages/ui/dist/frnl/index.js +7 -3
- package/packages/ui/dist/frnl/store.d.ts +7 -18
- package/packages/ui/dist/frnl/store.js +3 -1
- package/packages/ui/dist/index.js +11 -13
- package/packages/ui/package.json +2 -2
- package/packages/ui/dist/chunk-B4XTM5TI.js +0 -25
- package/packages/ui/dist/components/workspace/SrklBackblazeTile.d.ts +0 -27
- package/packages/ui/dist/components/workspace/StorageOptionTiles.d.ts +0 -27
- package/packages/ui/dist/components/workspace/StoragePresetTile.d.ts +0 -8
|
@@ -1,254 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
2
|
TilesMenu
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-DEKSKDSF.js";
|
|
4
4
|
import {
|
|
5
5
|
useFloksFrnlStore
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
|
|
8
|
-
// src/components/workspace/StoragePresetTile.tsx
|
|
9
|
-
import { HardDrive, CheckCircle2 } from "lucide-react";
|
|
10
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
11
|
-
var StoragePresetTile = ({ conn, isSelected, onSelect }) => {
|
|
12
|
-
return /* @__PURE__ */ jsxs(
|
|
13
|
-
"div",
|
|
14
|
-
{
|
|
15
|
-
onClick: () => onSelect(conn),
|
|
16
|
-
className: `p-3 border-2 rounded transition-all font-mono select-none cursor-pointer flex items-center justify-between ${isSelected ? "border-emerald-500 bg-emerald-500/10 shadow-[0_0_15px_rgba(16,185,129,0.2)]" : "border-[var(--skipo-border-color)] bg-[var(--skipo-bg)] hover:border-emerald-500/60"}`,
|
|
17
|
-
children: [
|
|
18
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2.5", children: [
|
|
19
|
-
/* @__PURE__ */ jsx("div", { className: `p-1.5 rounded border ${isSelected ? "bg-emerald-500 text-black border-emerald-500" : "bg-[var(--skipo-surface)] text-emerald-400 border-[var(--skipo-border-color)]"}`, children: /* @__PURE__ */ jsx(HardDrive, { size: 16 }) }),
|
|
20
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
21
|
-
/* @__PURE__ */ jsx("span", { className: "text-xs font-black uppercase text-[var(--skipo-text)] block", children: conn.label || conn.localFolderName || "Local Workstation Vault" }),
|
|
22
|
-
/* @__PURE__ */ jsxs("span", { className: "text-[10px] text-[var(--skipo-text-muted)] block", children: [
|
|
23
|
-
"Directory: ./",
|
|
24
|
-
conn.localFolderName || "workspace",
|
|
25
|
-
" (Deterministic local storage)"
|
|
26
|
-
] })
|
|
27
|
-
] })
|
|
28
|
-
] }),
|
|
29
|
-
/* @__PURE__ */ jsx("div", { className: "flex items-center gap-1.5", children: isSelected && /* @__PURE__ */ jsxs("span", { className: "text-[9px] font-black uppercase px-2 py-0.5 border border-emerald-500/50 bg-emerald-500/20 text-emerald-300 rounded flex items-center gap-1", children: [
|
|
30
|
-
/* @__PURE__ */ jsx(CheckCircle2, { size: 10 }),
|
|
31
|
-
" SELECTED"
|
|
32
|
-
] }) })
|
|
33
|
-
]
|
|
34
|
-
}
|
|
35
|
-
);
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
// src/components/workspace/SrklBackblazeTile.tsx
|
|
39
|
-
import { useState, useEffect } from "react";
|
|
40
|
-
import { Cloud, CheckCircle2 as CheckCircle22, RefreshCw } from "lucide-react";
|
|
41
|
-
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
42
|
-
var SrklBackblazeTile = ({
|
|
43
|
-
account,
|
|
44
|
-
selectedBucketName,
|
|
45
|
-
isSelectedAccount,
|
|
46
|
-
onSelectBucket,
|
|
47
|
-
userId,
|
|
48
|
-
storageService
|
|
49
|
-
}) => {
|
|
50
|
-
const [buckets, setBuckets] = useState([]);
|
|
51
|
-
const [loading, setLoading] = useState(false);
|
|
52
|
-
const fetchBuckets = async () => {
|
|
53
|
-
setLoading(true);
|
|
54
|
-
try {
|
|
55
|
-
if (storageService?.listBackblazeBuckets) {
|
|
56
|
-
const res2 = await storageService.listBackblazeBuckets(account.id, userId || "");
|
|
57
|
-
if (Array.isArray(res2) && res2.length > 0) {
|
|
58
|
-
setBuckets(res2);
|
|
59
|
-
return;
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
const creds = account.credentials || account.metadata?.credentials || {};
|
|
63
|
-
const keyId = creds.keyId || creds.b2KeyId || "";
|
|
64
|
-
const applicationKey = creds.applicationKey || creds.b2ApplicationKey || "";
|
|
65
|
-
const defaultBucket = creds.bucketName || "ultrst-apps";
|
|
66
|
-
const res = await fetch("/api/srkl/backblaze/buckets", {
|
|
67
|
-
method: "POST",
|
|
68
|
-
headers: { "Content-Type": "application/json" },
|
|
69
|
-
body: JSON.stringify({ accountId: account.id, keyId, applicationKey, userId, bucketName: defaultBucket })
|
|
70
|
-
});
|
|
71
|
-
const data = await res.json().catch(() => ({}));
|
|
72
|
-
if (data.success && Array.isArray(data.buckets)) {
|
|
73
|
-
setBuckets(data.buckets);
|
|
74
|
-
} else {
|
|
75
|
-
setBuckets([{ bucketId: "default", bucketName: defaultBucket }]);
|
|
76
|
-
}
|
|
77
|
-
} catch {
|
|
78
|
-
setBuckets([{ bucketId: "default", bucketName: "ultrst-apps" }]);
|
|
79
|
-
} finally {
|
|
80
|
-
setLoading(false);
|
|
81
|
-
}
|
|
82
|
-
};
|
|
83
|
-
useEffect(() => {
|
|
84
|
-
fetchBuckets();
|
|
85
|
-
}, [account.id]);
|
|
86
|
-
return /* @__PURE__ */ jsxs2("div", { className: `p-3 border-2 rounded transition-all font-mono select-none ${isSelectedAccount ? "border-amber-400 bg-amber-400/10 shadow-[0_0_15px_rgba(251,191,36,0.2)]" : "border-[var(--skipo-border-color)] bg-[var(--skipo-bg)] hover:border-amber-400/60"}`, children: [
|
|
87
|
-
/* @__PURE__ */ jsxs2("div", { className: "flex items-center justify-between pb-2 border-b border-[var(--skipo-border-color)]/60", children: [
|
|
88
|
-
/* @__PURE__ */ jsxs2("div", { className: "flex items-center gap-2", children: [
|
|
89
|
-
/* @__PURE__ */ jsx2(Cloud, { size: 16, className: "text-amber-400" }),
|
|
90
|
-
/* @__PURE__ */ jsx2("span", { className: "text-xs font-black uppercase text-[var(--skipo-text)] truncate max-w-[180px]", children: account.name })
|
|
91
|
-
] }),
|
|
92
|
-
/* @__PURE__ */ jsx2(
|
|
93
|
-
"button",
|
|
94
|
-
{
|
|
95
|
-
type: "button",
|
|
96
|
-
onClick: fetchBuckets,
|
|
97
|
-
disabled: loading,
|
|
98
|
-
className: "p-1 text-[var(--skipo-text-muted)] hover:text-amber-300 rounded cursor-pointer",
|
|
99
|
-
title: "Refresh buckets",
|
|
100
|
-
children: /* @__PURE__ */ jsx2(RefreshCw, { size: 11, className: loading ? "animate-spin text-amber-400" : "" })
|
|
101
|
-
}
|
|
102
|
-
)
|
|
103
|
-
] }),
|
|
104
|
-
/* @__PURE__ */ jsxs2("div", { className: "mt-2 space-y-1.5", children: [
|
|
105
|
-
/* @__PURE__ */ jsx2("span", { className: "text-[9px] font-bold uppercase text-[var(--skipo-text-muted)] block", children: "Select Target B2 Bucket:" }),
|
|
106
|
-
/* @__PURE__ */ jsx2("div", { className: "flex flex-wrap gap-1.5", children: buckets.map((b) => {
|
|
107
|
-
const bName = b.bucketName || b.name || "ultrst-apps";
|
|
108
|
-
const isSelected = isSelectedAccount && selectedBucketName === bName;
|
|
109
|
-
return /* @__PURE__ */ jsxs2(
|
|
110
|
-
"button",
|
|
111
|
-
{
|
|
112
|
-
type: "button",
|
|
113
|
-
onClick: () => onSelectBucket(account, bName),
|
|
114
|
-
className: `px-2 py-1 text-[10px] font-bold rounded flex items-center gap-1 border transition-all cursor-pointer ${isSelected ? "border-amber-400 bg-amber-400 text-black shadow-sm font-black" : "border-[var(--skipo-border-color)] bg-[var(--skipo-surface)] hover:border-amber-400/80 text-[var(--skipo-text)]"}`,
|
|
115
|
-
children: [
|
|
116
|
-
isSelected && /* @__PURE__ */ jsx2(CheckCircle22, { size: 10 }),
|
|
117
|
-
/* @__PURE__ */ jsx2("span", { children: bName })
|
|
118
|
-
]
|
|
119
|
-
},
|
|
120
|
-
b.bucketId || bName
|
|
121
|
-
);
|
|
122
|
-
}) })
|
|
123
|
-
] })
|
|
124
|
-
] });
|
|
125
|
-
};
|
|
126
|
-
|
|
127
|
-
// src/components/workspace/StorageOptionTiles.tsx
|
|
128
|
-
import { useState as useState2, useEffect as useEffect2, useCallback } from "react";
|
|
129
|
-
import { HardDrive as HardDrive2, Cloud as Cloud2, RefreshCw as RefreshCw2 } from "lucide-react";
|
|
130
|
-
import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
131
|
-
var StorageOptionTiles = ({
|
|
132
|
-
currentUser,
|
|
133
|
-
userId,
|
|
134
|
-
selectedConnectionId,
|
|
135
|
-
storageService,
|
|
136
|
-
onSelectStorage
|
|
137
|
-
}) => {
|
|
138
|
-
const [activeId, setActiveId] = useState2(selectedConnectionId || "local_default");
|
|
139
|
-
const [selectedBucket, setSelectedBucket] = useState2("");
|
|
140
|
-
const [srklAccounts, setSrklAccounts] = useState2([]);
|
|
141
|
-
const [loadingSrkl, setLoadingSrkl] = useState2(false);
|
|
142
|
-
const effectiveUserId = currentUser?.id || userId || "";
|
|
143
|
-
const fetchSrklAccounts = useCallback(async () => {
|
|
144
|
-
if (!effectiveUserId) return;
|
|
145
|
-
setLoadingSrkl(true);
|
|
146
|
-
try {
|
|
147
|
-
if (storageService?.listBackblazeAccounts) {
|
|
148
|
-
const accs = await storageService.listBackblazeAccounts(effectiveUserId);
|
|
149
|
-
if (Array.isArray(accs) && accs.length > 0) {
|
|
150
|
-
setSrklAccounts(accs);
|
|
151
|
-
return;
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
const uId = encodeURIComponent(effectiveUserId);
|
|
155
|
-
const res = await fetch(`/api/srkl/accounts?service=backblaze&userId=${uId}`);
|
|
156
|
-
const data = await res.json().catch(() => ({}));
|
|
157
|
-
if (data.success && Array.isArray(data.accounts)) {
|
|
158
|
-
setSrklAccounts(data.accounts);
|
|
159
|
-
}
|
|
160
|
-
} catch {
|
|
161
|
-
} finally {
|
|
162
|
-
setLoadingSrkl(false);
|
|
163
|
-
}
|
|
164
|
-
}, [effectiveUserId, storageService]);
|
|
165
|
-
useEffect2(() => {
|
|
166
|
-
fetchSrklAccounts();
|
|
167
|
-
}, [fetchSrklAccounts]);
|
|
168
|
-
const handleSelectLocal = (conn) => {
|
|
169
|
-
setActiveId(conn.id);
|
|
170
|
-
setSelectedBucket("");
|
|
171
|
-
onSelectStorage({
|
|
172
|
-
provider: "local_fs",
|
|
173
|
-
connectionId: conn.id,
|
|
174
|
-
localFolderName: conn.localFolderName || "Local-Vault",
|
|
175
|
-
localFolderKey: conn.localFolderKey
|
|
176
|
-
});
|
|
177
|
-
};
|
|
178
|
-
const handleSelectSrklBucket = (account, bucketName) => {
|
|
179
|
-
setActiveId(account.id);
|
|
180
|
-
setSelectedBucket(bucketName);
|
|
181
|
-
const creds = account.credentials || {};
|
|
182
|
-
onSelectStorage({
|
|
183
|
-
provider: "backblaze_b2",
|
|
184
|
-
connectionId: account.id,
|
|
185
|
-
b2BucketName: bucketName,
|
|
186
|
-
b2Endpoint: creds.endpoint,
|
|
187
|
-
b2Region: creds.region || "us-east-005"
|
|
188
|
-
});
|
|
189
|
-
};
|
|
190
|
-
const defaultLocalConn = {
|
|
191
|
-
id: "local_default",
|
|
192
|
-
label: "Local Workstation Vault",
|
|
193
|
-
localFolderName: "Local-Vault",
|
|
194
|
-
provider: "local_fs"
|
|
195
|
-
};
|
|
196
|
-
return /* @__PURE__ */ jsxs3("div", { className: "space-y-4 font-mono select-none", children: [
|
|
197
|
-
/* @__PURE__ */ jsxs3("div", { className: "space-y-2", children: [
|
|
198
|
-
/* @__PURE__ */ jsxs3("span", { className: "text-[9px] font-black uppercase text-[var(--skipo-text-muted)] flex items-center gap-1", children: [
|
|
199
|
-
/* @__PURE__ */ jsx3(HardDrive2, { size: 11 }),
|
|
200
|
-
" 1. Local Filesystem (Workstation Vault)"
|
|
201
|
-
] }),
|
|
202
|
-
/* @__PURE__ */ jsx3(
|
|
203
|
-
StoragePresetTile,
|
|
204
|
-
{
|
|
205
|
-
conn: defaultLocalConn,
|
|
206
|
-
isSelected: activeId === defaultLocalConn.id && !selectedBucket,
|
|
207
|
-
onSelect: handleSelectLocal
|
|
208
|
-
}
|
|
209
|
-
)
|
|
210
|
-
] }),
|
|
211
|
-
/* @__PURE__ */ jsxs3("div", { className: "space-y-2 pt-1 border-t border-[var(--skipo-border-color)]/60", children: [
|
|
212
|
-
/* @__PURE__ */ jsxs3("div", { className: "flex items-center justify-between", children: [
|
|
213
|
-
/* @__PURE__ */ jsxs3("span", { className: "text-[9px] font-black uppercase text-amber-300 flex items-center gap-1", children: [
|
|
214
|
-
/* @__PURE__ */ jsx3(Cloud2, { size: 11 }),
|
|
215
|
-
" 2. Backblaze B2 (Federated from SRKL)"
|
|
216
|
-
] }),
|
|
217
|
-
/* @__PURE__ */ jsx3(
|
|
218
|
-
"button",
|
|
219
|
-
{
|
|
220
|
-
type: "button",
|
|
221
|
-
onClick: fetchSrklAccounts,
|
|
222
|
-
disabled: loadingSrkl,
|
|
223
|
-
className: "p-1 rounded text-[var(--skipo-text-muted)] hover:text-amber-300 cursor-pointer",
|
|
224
|
-
title: "Refresh SRKL Accounts",
|
|
225
|
-
children: /* @__PURE__ */ jsx3(RefreshCw2, { size: 11, className: loadingSrkl ? "animate-spin text-amber-300" : "" })
|
|
226
|
-
}
|
|
227
|
-
)
|
|
228
|
-
] }),
|
|
229
|
-
srklAccounts.length === 0 && !loadingSrkl && /* @__PURE__ */ jsx3("div", { className: "p-3 border border-dashed border-[var(--skipo-border-color)] text-[11px] text-[var(--skipo-text-muted)] rounded", children: "No Backblaze B2 accounts linked in your SRKL profile. Configure Backblaze in SRKL to pick buckets here." }),
|
|
230
|
-
srklAccounts.map((account) => /* @__PURE__ */ jsx3(
|
|
231
|
-
SrklBackblazeTile,
|
|
232
|
-
{
|
|
233
|
-
account,
|
|
234
|
-
selectedBucketName: selectedBucket,
|
|
235
|
-
isSelectedAccount: account.id === activeId,
|
|
236
|
-
onSelectBucket: handleSelectSrklBucket,
|
|
237
|
-
userId: effectiveUserId,
|
|
238
|
-
storageService
|
|
239
|
-
},
|
|
240
|
-
account.id
|
|
241
|
-
))
|
|
242
|
-
] })
|
|
243
|
-
] });
|
|
244
|
-
};
|
|
6
|
+
} from "./chunk-2YP2RPJY.js";
|
|
245
7
|
|
|
246
8
|
// src/components/workspace/WorkspaceStorageReadonlyPanel.tsx
|
|
247
|
-
import { useState
|
|
248
|
-
import { Lock, Cloud
|
|
249
|
-
import { jsx
|
|
9
|
+
import { useState } from "react";
|
|
10
|
+
import { Lock, Cloud, HardDrive, ShieldCheck, Copy, Check } from "lucide-react";
|
|
11
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
250
12
|
var WorkspaceStorageReadonlyPanel = ({ workspace }) => {
|
|
251
|
-
const [copied, setCopied] =
|
|
13
|
+
const [copied, setCopied] = useState(false);
|
|
252
14
|
const isB2 = workspace.storageProvider === "backblaze_b2";
|
|
253
15
|
const target = isB2 ? workspace.b2BucketName || "ultrst-apps" : workspace.localFolderName || workspace.name;
|
|
254
16
|
const handleCopy = () => {
|
|
@@ -256,27 +18,27 @@ var WorkspaceStorageReadonlyPanel = ({ workspace }) => {
|
|
|
256
18
|
setCopied(true);
|
|
257
19
|
setTimeout(() => setCopied(false), 2e3);
|
|
258
20
|
};
|
|
259
|
-
return /* @__PURE__ */
|
|
260
|
-
/* @__PURE__ */
|
|
261
|
-
/* @__PURE__ */
|
|
262
|
-
/* @__PURE__ */
|
|
263
|
-
/* @__PURE__ */
|
|
21
|
+
return /* @__PURE__ */ jsxs("div", { className: "space-y-3 font-mono select-none", children: [
|
|
22
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between pb-1 border-b border-[var(--skipo-border-color)]", children: [
|
|
23
|
+
/* @__PURE__ */ jsxs("span", { className: "text-[10px] font-black uppercase text-[var(--skipo-text)] flex items-center gap-1.5", children: [
|
|
24
|
+
/* @__PURE__ */ jsx(Lock, { size: 12, className: "text-amber-400" }),
|
|
25
|
+
/* @__PURE__ */ jsx("span", { children: "CONNECTED STORAGE VAULT" })
|
|
264
26
|
] }),
|
|
265
|
-
/* @__PURE__ */
|
|
27
|
+
/* @__PURE__ */ jsx("span", { className: "text-[9px] px-2 py-0.5 border border-amber-500/50 bg-amber-500/10 text-amber-300 font-bold rounded", children: "READ ONLY \xB7 LOCKED PRIMARY" })
|
|
266
28
|
] }),
|
|
267
|
-
/* @__PURE__ */
|
|
268
|
-
/* @__PURE__ */
|
|
269
|
-
/* @__PURE__ */
|
|
270
|
-
/* @__PURE__ */
|
|
271
|
-
/* @__PURE__ */
|
|
272
|
-
/* @__PURE__ */
|
|
273
|
-
/* @__PURE__ */
|
|
29
|
+
/* @__PURE__ */ jsxs("div", { className: "p-3.5 border-2 border-[var(--skipo-border-color)] bg-[var(--skipo-bg)] rounded-lg space-y-2.5", children: [
|
|
30
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
|
|
31
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
32
|
+
/* @__PURE__ */ jsx("div", { className: "p-2 rounded border border-[var(--skipo-border-color)] bg-[var(--skipo-surface)] text-[var(--skipo-accent)]", children: isB2 ? /* @__PURE__ */ jsx(Cloud, { size: 18, className: "text-amber-400" }) : /* @__PURE__ */ jsx(HardDrive, { size: 18 }) }),
|
|
33
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
34
|
+
/* @__PURE__ */ jsx("span", { className: "text-xs font-black uppercase text-[var(--skipo-text)] block", children: isB2 ? "Backblaze B2 Cloud Vault" : "Local Workstation Vault" }),
|
|
35
|
+
/* @__PURE__ */ jsxs("span", { className: "text-[10px] text-[var(--skipo-text-muted)] block", children: [
|
|
274
36
|
"Target: ",
|
|
275
37
|
target
|
|
276
38
|
] })
|
|
277
39
|
] })
|
|
278
40
|
] }),
|
|
279
|
-
/* @__PURE__ */
|
|
41
|
+
/* @__PURE__ */ jsxs(
|
|
280
42
|
"button",
|
|
281
43
|
{
|
|
282
44
|
type: "button",
|
|
@@ -284,45 +46,45 @@ var WorkspaceStorageReadonlyPanel = ({ workspace }) => {
|
|
|
284
46
|
className: "px-2 py-1 text-[10px] border border-[var(--skipo-border-color)] bg-[var(--skipo-surface)] hover:border-[var(--skipo-accent)] text-[var(--skipo-text)] rounded flex items-center gap-1 cursor-pointer",
|
|
285
47
|
title: "Copy target",
|
|
286
48
|
children: [
|
|
287
|
-
copied ? /* @__PURE__ */
|
|
288
|
-
/* @__PURE__ */
|
|
49
|
+
copied ? /* @__PURE__ */ jsx(Check, { size: 11, className: "text-emerald-400" }) : /* @__PURE__ */ jsx(Copy, { size: 11 }),
|
|
50
|
+
/* @__PURE__ */ jsx("span", { children: copied ? "COPIED" : "COPY" })
|
|
289
51
|
]
|
|
290
52
|
}
|
|
291
53
|
)
|
|
292
54
|
] }),
|
|
293
|
-
/* @__PURE__ */
|
|
294
|
-
/* @__PURE__ */
|
|
295
|
-
/* @__PURE__ */
|
|
296
|
-
/* @__PURE__ */
|
|
55
|
+
/* @__PURE__ */ jsxs("div", { className: "border border-[var(--skipo-border-color)]/70 rounded bg-[var(--skipo-surface)] divide-y divide-[var(--skipo-border-color)]/60 text-[10px]", children: [
|
|
56
|
+
/* @__PURE__ */ jsxs("div", { className: "px-3 py-1.5 flex justify-between", children: [
|
|
57
|
+
/* @__PURE__ */ jsx("span", { className: "text-[var(--skipo-text-muted)]", children: "Storage Provider:" }),
|
|
58
|
+
/* @__PURE__ */ jsx("span", { className: "font-bold text-white uppercase font-mono", children: workspace.storageProvider || "local_fs" })
|
|
297
59
|
] }),
|
|
298
|
-
/* @__PURE__ */
|
|
299
|
-
/* @__PURE__ */
|
|
300
|
-
/* @__PURE__ */
|
|
60
|
+
/* @__PURE__ */ jsxs("div", { className: "px-3 py-1.5 flex justify-between", children: [
|
|
61
|
+
/* @__PURE__ */ jsx("span", { className: "text-[var(--skipo-text-muted)]", children: "Canonical Vault Path:" }),
|
|
62
|
+
/* @__PURE__ */ jsx("span", { className: "font-mono text-emerald-400 truncate max-w-[240px]", children: workspace.workspacePath || target })
|
|
301
63
|
] })
|
|
302
64
|
] })
|
|
303
65
|
] }),
|
|
304
|
-
/* @__PURE__ */
|
|
305
|
-
/* @__PURE__ */
|
|
306
|
-
/* @__PURE__ */
|
|
307
|
-
/* @__PURE__ */
|
|
66
|
+
/* @__PURE__ */ jsxs("div", { className: "p-2.5 border border-dashed border-[var(--skipo-border-color)] bg-[var(--skipo-surface)]/50 rounded text-[10px] text-[var(--skipo-text-muted)] leading-relaxed space-y-1", children: [
|
|
67
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1 text-[var(--skipo-text)] font-bold", children: [
|
|
68
|
+
/* @__PURE__ */ jsx(ShieldCheck, { size: 12, className: "text-emerald-400" }),
|
|
69
|
+
/* @__PURE__ */ jsx("span", { children: "Storage Immutability Protocol:" })
|
|
308
70
|
] }),
|
|
309
|
-
/* @__PURE__ */
|
|
71
|
+
/* @__PURE__ */ jsx("p", { children: "Primary storage cannot be mutated post-creation. Add secondary redundant clones below to replicate and back up files across cloud buckets and local disks." })
|
|
310
72
|
] })
|
|
311
73
|
] });
|
|
312
74
|
};
|
|
313
75
|
|
|
314
76
|
// src/components/workspace/WorkspaceSecondaryClonesPanel.tsx
|
|
315
|
-
import { useState as
|
|
316
|
-
import { RefreshCw
|
|
317
|
-
import { jsx as
|
|
77
|
+
import { useState as useState2 } from "react";
|
|
78
|
+
import { RefreshCw, Trash2, Plus, ShieldCheck as ShieldCheck2, Cloud as Cloud2, HardDrive as HardDrive2 } from "lucide-react";
|
|
79
|
+
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
318
80
|
var WorkspaceSecondaryClonesPanel = ({ workspace, onClonesUpdated, onClose }) => {
|
|
319
|
-
const [clones, setClones] =
|
|
320
|
-
const [syncing, setSyncing] =
|
|
321
|
-
const [addingClone, setAddingClone] =
|
|
322
|
-
const [newLabel, setNewLabel] =
|
|
323
|
-
const [newBucket, setNewBucket] =
|
|
324
|
-
const [newProvider, setNewProvider] =
|
|
325
|
-
const [statusMsg, setStatusMsg] =
|
|
81
|
+
const [clones, setClones] = useState2(workspace.secondaryClones || []);
|
|
82
|
+
const [syncing, setSyncing] = useState2(null);
|
|
83
|
+
const [addingClone, setAddingClone] = useState2(false);
|
|
84
|
+
const [newLabel, setNewLabel] = useState2("");
|
|
85
|
+
const [newBucket, setNewBucket] = useState2("");
|
|
86
|
+
const [newProvider, setNewProvider] = useState2("backblaze_b2");
|
|
87
|
+
const [statusMsg, setStatusMsg] = useState2(null);
|
|
326
88
|
const handleSync = async (cloneId) => {
|
|
327
89
|
setSyncing(cloneId || "all");
|
|
328
90
|
try {
|
|
@@ -380,72 +142,72 @@ var WorkspaceSecondaryClonesPanel = ({ workspace, onClonesUpdated, onClose }) =>
|
|
|
380
142
|
setStatusMsg(`\u26A0 Error: ${err.message}`);
|
|
381
143
|
}
|
|
382
144
|
};
|
|
383
|
-
return /* @__PURE__ */
|
|
384
|
-
/* @__PURE__ */
|
|
385
|
-
/* @__PURE__ */
|
|
386
|
-
/* @__PURE__ */
|
|
387
|
-
/* @__PURE__ */
|
|
145
|
+
return /* @__PURE__ */ jsxs2("div", { className: "space-y-3 font-mono pt-3 border-t border-[var(--skipo-border-color)]", children: [
|
|
146
|
+
/* @__PURE__ */ jsxs2("div", { className: "flex items-center justify-between", children: [
|
|
147
|
+
/* @__PURE__ */ jsxs2("div", { className: "flex items-center gap-1.5", children: [
|
|
148
|
+
/* @__PURE__ */ jsx2(ShieldCheck2, { size: 14, className: "text-sky-400" }),
|
|
149
|
+
/* @__PURE__ */ jsxs2("span", { className: "text-[11px] font-black uppercase text-[var(--skipo-text)]", children: [
|
|
388
150
|
"CLONES (",
|
|
389
151
|
clones.length,
|
|
390
152
|
")"
|
|
391
153
|
] })
|
|
392
154
|
] }),
|
|
393
|
-
/* @__PURE__ */
|
|
394
|
-
clones.length > 0 && /* @__PURE__ */
|
|
395
|
-
/* @__PURE__ */
|
|
155
|
+
/* @__PURE__ */ jsxs2("div", { className: "flex items-center gap-2", children: [
|
|
156
|
+
clones.length > 0 && /* @__PURE__ */ jsxs2("button", { type: "button", disabled: Boolean(syncing), onClick: () => handleSync(), className: "px-2 py-1 text-[9px] font-bold border border-sky-500/50 bg-sky-500/20 text-sky-300 rounded flex items-center gap-1", children: [
|
|
157
|
+
/* @__PURE__ */ jsx2(RefreshCw, { size: 10, className: syncing === "all" ? "animate-spin" : "" }),
|
|
396
158
|
" SYNC ALL"
|
|
397
159
|
] }),
|
|
398
|
-
/* @__PURE__ */
|
|
399
|
-
/* @__PURE__ */
|
|
160
|
+
/* @__PURE__ */ jsxs2("button", { type: "button", onClick: () => setAddingClone(!addingClone), className: "px-2 py-1 text-[9px] font-bold border rounded flex items-center gap-1", children: [
|
|
161
|
+
/* @__PURE__ */ jsx2(Plus, { size: 10 }),
|
|
400
162
|
" ADD"
|
|
401
163
|
] }),
|
|
402
|
-
onClose && /* @__PURE__ */
|
|
164
|
+
onClose && /* @__PURE__ */ jsx2("button", { type: "button", onClick: onClose, className: "px-2 py-1 text-[9px] border rounded", children: "BACK" })
|
|
403
165
|
] })
|
|
404
166
|
] }),
|
|
405
|
-
statusMsg && /* @__PURE__ */
|
|
406
|
-
clones.length > 0 ? /* @__PURE__ */
|
|
407
|
-
/* @__PURE__ */
|
|
408
|
-
/* @__PURE__ */
|
|
409
|
-
c.provider === "backblaze_b2" ? /* @__PURE__ */
|
|
167
|
+
statusMsg && /* @__PURE__ */ jsx2("div", { className: "p-2 border border-sky-500/40 bg-sky-950/20 text-[10px] text-sky-200 rounded", children: statusMsg }),
|
|
168
|
+
clones.length > 0 ? /* @__PURE__ */ jsx2("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-2", children: clones.map((c) => /* @__PURE__ */ jsxs2("div", { className: "p-2 border border-sky-500/30 rounded flex flex-col justify-between", children: [
|
|
169
|
+
/* @__PURE__ */ jsxs2("div", { className: "flex items-center justify-between", children: [
|
|
170
|
+
/* @__PURE__ */ jsxs2("span", { className: "text-[11px] font-bold flex items-center gap-1", children: [
|
|
171
|
+
c.provider === "backblaze_b2" ? /* @__PURE__ */ jsx2(Cloud2, { size: 11, className: "text-amber-400" }) : /* @__PURE__ */ jsx2(HardDrive2, { size: 11, className: "text-emerald-400" }),
|
|
410
172
|
" ",
|
|
411
173
|
c.label
|
|
412
174
|
] }),
|
|
413
|
-
/* @__PURE__ */
|
|
175
|
+
/* @__PURE__ */ jsx2("button", { type: "button", onClick: () => handleDelete(c.id), className: "text-red-400 p-1", children: /* @__PURE__ */ jsx2(Trash2, { size: 10 }) })
|
|
414
176
|
] }),
|
|
415
|
-
/* @__PURE__ */
|
|
177
|
+
/* @__PURE__ */ jsxs2("div", { className: "text-[9px] text-[var(--skipo-text-muted)] truncate", children: [
|
|
416
178
|
"Target: ",
|
|
417
179
|
c.b2BucketName || c.localFolderName || "Backup"
|
|
418
180
|
] }),
|
|
419
|
-
/* @__PURE__ */
|
|
420
|
-
/* @__PURE__ */
|
|
421
|
-
/* @__PURE__ */
|
|
422
|
-
/* @__PURE__ */
|
|
181
|
+
/* @__PURE__ */ jsxs2("div", { className: "pt-1 flex items-center justify-between", children: [
|
|
182
|
+
/* @__PURE__ */ jsx2("span", { className: "text-[8px] font-bold uppercase text-sky-300", children: c.status || "CONNECTED" }),
|
|
183
|
+
/* @__PURE__ */ jsxs2("button", { type: "button", disabled: Boolean(syncing), onClick: () => handleSync(c.id), className: "px-2 py-0.5 text-[9px] border rounded", children: [
|
|
184
|
+
/* @__PURE__ */ jsx2(RefreshCw, { size: 9, className: syncing === c.id ? "animate-spin" : "" }),
|
|
423
185
|
" SYNC"
|
|
424
186
|
] })
|
|
425
187
|
] })
|
|
426
|
-
] }, c.id)) }) : /* @__PURE__ */
|
|
427
|
-
addingClone && /* @__PURE__ */
|
|
428
|
-
/* @__PURE__ */
|
|
429
|
-
/* @__PURE__ */
|
|
430
|
-
/* @__PURE__ */
|
|
431
|
-
/* @__PURE__ */
|
|
188
|
+
] }, c.id)) }) : /* @__PURE__ */ jsx2("div", { className: "p-2 border border-dashed text-[10px] text-center text-[var(--skipo-text-muted)]", children: "No secondary clones configured." }),
|
|
189
|
+
addingClone && /* @__PURE__ */ jsxs2("form", { onSubmit: handleAdd, className: "p-3 border rounded space-y-2", children: [
|
|
190
|
+
/* @__PURE__ */ jsx2("input", { type: "text", required: true, value: newLabel, onChange: (e) => setNewLabel(e.target.value), placeholder: "Clone Label", className: "w-full border rounded px-2 py-1 text-xs bg-transparent" }),
|
|
191
|
+
/* @__PURE__ */ jsxs2("select", { value: newProvider, onChange: (e) => setNewProvider(e.target.value), className: "w-full border rounded px-2 py-1 text-xs bg-transparent", children: [
|
|
192
|
+
/* @__PURE__ */ jsx2("option", { value: "backblaze_b2", children: "Backblaze B2" }),
|
|
193
|
+
/* @__PURE__ */ jsx2("option", { value: "local_fs", children: "Local Disk Folder" })
|
|
432
194
|
] }),
|
|
433
|
-
newProvider === "backblaze_b2" && /* @__PURE__ */
|
|
434
|
-
/* @__PURE__ */
|
|
435
|
-
/* @__PURE__ */
|
|
436
|
-
/* @__PURE__ */
|
|
195
|
+
newProvider === "backblaze_b2" && /* @__PURE__ */ jsx2("input", { type: "text", value: newBucket, onChange: (e) => setNewBucket(e.target.value), placeholder: "Bucket Name", className: "w-full border rounded px-2 py-1 text-xs bg-transparent" }),
|
|
196
|
+
/* @__PURE__ */ jsxs2("div", { className: "flex justify-end gap-2", children: [
|
|
197
|
+
/* @__PURE__ */ jsx2("button", { type: "button", onClick: () => setAddingClone(false), className: "px-2 py-1 text-[9px] border rounded", children: "CANCEL" }),
|
|
198
|
+
/* @__PURE__ */ jsx2("button", { type: "submit", className: "px-2 py-1 text-[9px] font-bold bg-sky-500 text-black rounded", children: "SAVE" })
|
|
437
199
|
] })
|
|
438
200
|
] })
|
|
439
201
|
] });
|
|
440
202
|
};
|
|
441
203
|
|
|
442
204
|
// src/components/workspace/WorkspaceCreateDialog.tsx
|
|
443
|
-
import { useEffect as
|
|
444
|
-
import { HardDrive as
|
|
205
|
+
import { useEffect as useEffect2, useMemo, useState as useState4 } from "react";
|
|
206
|
+
import { HardDrive as HardDrive3, Loader2 } from "lucide-react";
|
|
445
207
|
|
|
446
208
|
// src/components/workspace/GoogleDriveWorkspacePicker.tsx
|
|
447
|
-
import { useCallback
|
|
448
|
-
import { jsx as
|
|
209
|
+
import { useCallback, useEffect, useState as useState3 } from "react";
|
|
210
|
+
import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
449
211
|
function getErrorCode(error) {
|
|
450
212
|
if (!error || typeof error !== "object") return "";
|
|
451
213
|
const candidate = error;
|
|
@@ -480,13 +242,13 @@ function GoogleDriveWorkspacePicker({
|
|
|
480
242
|
onSelectFolder,
|
|
481
243
|
selectedFolder
|
|
482
244
|
}) {
|
|
483
|
-
const [connecting, setConnecting] =
|
|
484
|
-
const [loading, setLoading] =
|
|
485
|
-
const [folders, setFolders] =
|
|
486
|
-
const [folderPath, setFolderPath] =
|
|
487
|
-
const [error, setError] =
|
|
488
|
-
const [status, setStatus] =
|
|
489
|
-
const loadFolders =
|
|
245
|
+
const [connecting, setConnecting] = useState3(false);
|
|
246
|
+
const [loading, setLoading] = useState3(false);
|
|
247
|
+
const [folders, setFolders] = useState3([]);
|
|
248
|
+
const [folderPath, setFolderPath] = useState3([]);
|
|
249
|
+
const [error, setError] = useState3(null);
|
|
250
|
+
const [status, setStatus] = useState3(null);
|
|
251
|
+
const loadFolders = useCallback(async (connectionId, parentFolderId) => {
|
|
490
252
|
if (!listGoogleDriveFolders) {
|
|
491
253
|
setFolders([]);
|
|
492
254
|
setError("Google Drive folder browsing is not configured for this storage service.");
|
|
@@ -495,7 +257,7 @@ function GoogleDriveWorkspacePicker({
|
|
|
495
257
|
setLoading(true);
|
|
496
258
|
setError(null);
|
|
497
259
|
try {
|
|
498
|
-
const items = await listGoogleDriveFolders(connectionId, parentFolderId);
|
|
260
|
+
const items = await listGoogleDriveFolders(connectionId, parentFolderId, userId);
|
|
499
261
|
setFolders(Array.isArray(items) ? items.filter((item) => item && typeof item.id === "string" && typeof item.name === "string") : []);
|
|
500
262
|
} catch (reason) {
|
|
501
263
|
setFolders([]);
|
|
@@ -503,8 +265,8 @@ function GoogleDriveWorkspacePicker({
|
|
|
503
265
|
} finally {
|
|
504
266
|
setLoading(false);
|
|
505
267
|
}
|
|
506
|
-
}, [listGoogleDriveFolders]);
|
|
507
|
-
|
|
268
|
+
}, [listGoogleDriveFolders, userId]);
|
|
269
|
+
useEffect(() => {
|
|
508
270
|
setFolderPath([]);
|
|
509
271
|
setFolders([]);
|
|
510
272
|
setError(null);
|
|
@@ -521,7 +283,11 @@ function GoogleDriveWorkspacePicker({
|
|
|
521
283
|
setStatus(null);
|
|
522
284
|
try {
|
|
523
285
|
const connected = await connectGoogleDrive(userId);
|
|
524
|
-
if (!connected
|
|
286
|
+
if (!connected) {
|
|
287
|
+
setStatus("Google Drive authorization started. Complete the Google sign-in to return to workspace creation.");
|
|
288
|
+
return;
|
|
289
|
+
}
|
|
290
|
+
if (typeof connected.id !== "string" || !connected.id || connected.id === "google_drive") {
|
|
525
291
|
throw new Error("The Google Drive authorization service returned an invalid connection.");
|
|
526
292
|
}
|
|
527
293
|
onConnected(connected);
|
|
@@ -539,7 +305,7 @@ function GoogleDriveWorkspacePicker({
|
|
|
539
305
|
setLoading(true);
|
|
540
306
|
setError(null);
|
|
541
307
|
try {
|
|
542
|
-
const items = await listGoogleDriveFolders?.(connection.id, folder.id);
|
|
308
|
+
const items = await listGoogleDriveFolders?.(connection.id, folder.id, userId);
|
|
543
309
|
setFolders(Array.isArray(items) ? items : []);
|
|
544
310
|
setFolderPath((current) => [...current, { id: folder.id, name: folder.name }]);
|
|
545
311
|
} catch (reason) {
|
|
@@ -555,7 +321,7 @@ function GoogleDriveWorkspacePicker({
|
|
|
555
321
|
setLoading(true);
|
|
556
322
|
setError(null);
|
|
557
323
|
try {
|
|
558
|
-
const items = await listGoogleDriveFolders?.(connection.id, parentFolderId);
|
|
324
|
+
const items = await listGoogleDriveFolders?.(connection.id, parentFolderId, userId);
|
|
559
325
|
setFolders(Array.isArray(items) ? items : []);
|
|
560
326
|
setFolderPath(nextPath);
|
|
561
327
|
} catch (reason) {
|
|
@@ -571,29 +337,29 @@ function GoogleDriveWorkspacePicker({
|
|
|
571
337
|
setStatus(`\u201C${current.name}\u201D selected as the workspace storage root.`);
|
|
572
338
|
};
|
|
573
339
|
if (!connection) {
|
|
574
|
-
return /* @__PURE__ */
|
|
575
|
-
/* @__PURE__ */
|
|
576
|
-
error && /* @__PURE__ */
|
|
577
|
-
status && /* @__PURE__ */
|
|
578
|
-
/* @__PURE__ */
|
|
340
|
+
return /* @__PURE__ */ jsxs3("section", { "aria-label": "Google Drive connection", className: "space-y-2 border p-3", children: [
|
|
341
|
+
/* @__PURE__ */ jsx3("p", { className: "text-xs", children: "Connect your Google account to browse and select a Drive folder. Google handles sign-in and authorization; Floks never asks for your Google password." }),
|
|
342
|
+
error && /* @__PURE__ */ jsx3("p", { role: "alert", className: "text-xs text-red-300", children: error }),
|
|
343
|
+
status && /* @__PURE__ */ jsx3("p", { role: "status", className: "text-xs", children: status }),
|
|
344
|
+
/* @__PURE__ */ jsx3(
|
|
579
345
|
"button",
|
|
580
346
|
{
|
|
581
347
|
type: "button",
|
|
582
348
|
onClick: handleConnect,
|
|
583
|
-
disabled: connecting,
|
|
349
|
+
disabled: connecting || !connectGoogleDrive,
|
|
584
350
|
className: "border px-3 py-2 text-xs font-bold disabled:opacity-50",
|
|
585
|
-
children: connecting ? "Connecting to Google\u2026" : "Connect Google Drive"
|
|
351
|
+
children: connecting ? "Connecting to Google\u2026" : connectGoogleDrive ? "Connect Google Drive" : "Google Drive authorization unavailable"
|
|
586
352
|
}
|
|
587
353
|
)
|
|
588
354
|
] });
|
|
589
355
|
}
|
|
590
|
-
return /* @__PURE__ */
|
|
591
|
-
/* @__PURE__ */
|
|
592
|
-
/* @__PURE__ */
|
|
593
|
-
/* @__PURE__ */
|
|
594
|
-
/* @__PURE__ */
|
|
356
|
+
return /* @__PURE__ */ jsxs3("section", { "aria-label": "Google Drive folder picker", className: "space-y-2 border p-3", children: [
|
|
357
|
+
/* @__PURE__ */ jsxs3("div", { className: "flex flex-wrap items-center justify-between gap-2", children: [
|
|
358
|
+
/* @__PURE__ */ jsxs3("div", { className: "min-w-0", children: [
|
|
359
|
+
/* @__PURE__ */ jsx3("p", { className: "text-xs font-bold", children: "Google Drive connected" }),
|
|
360
|
+
/* @__PURE__ */ jsx3("p", { className: "truncate text-[10px] opacity-70", children: connection.googleEmail || connection.label || connection.name || connection.id })
|
|
595
361
|
] }),
|
|
596
|
-
/* @__PURE__ */
|
|
362
|
+
/* @__PURE__ */ jsx3(
|
|
597
363
|
"button",
|
|
598
364
|
{
|
|
599
365
|
type: "button",
|
|
@@ -604,25 +370,25 @@ function GoogleDriveWorkspacePicker({
|
|
|
604
370
|
}
|
|
605
371
|
)
|
|
606
372
|
] }),
|
|
607
|
-
folderPath.length > 0 && /* @__PURE__ */
|
|
608
|
-
/* @__PURE__ */
|
|
609
|
-
/* @__PURE__ */
|
|
373
|
+
folderPath.length > 0 && /* @__PURE__ */ jsxs3("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
374
|
+
/* @__PURE__ */ jsx3("button", { type: "button", onClick: goBack, disabled: loading, className: "border px-2 py-1 text-[10px] disabled:opacity-50", children: "Back" }),
|
|
375
|
+
/* @__PURE__ */ jsxs3("span", { className: "min-w-0 truncate text-[10px] opacity-70", children: [
|
|
610
376
|
"My Drive / ",
|
|
611
377
|
folderPath.map((entry) => entry.name).join(" / ")
|
|
612
378
|
] }),
|
|
613
|
-
/* @__PURE__ */
|
|
379
|
+
/* @__PURE__ */ jsx3("button", { type: "button", onClick: selectCurrentFolder, disabled: loading, className: "ml-auto border px-2 py-1 text-[10px] font-bold disabled:opacity-50", children: "Use this folder" })
|
|
614
380
|
] }),
|
|
615
|
-
error && /* @__PURE__ */
|
|
616
|
-
status && /* @__PURE__ */
|
|
617
|
-
selectedFolder && /* @__PURE__ */
|
|
381
|
+
error && /* @__PURE__ */ jsx3("p", { role: "alert", className: "text-xs text-red-300", children: error }),
|
|
382
|
+
status && /* @__PURE__ */ jsx3("p", { role: "status", className: "text-xs", children: status }),
|
|
383
|
+
selectedFolder && /* @__PURE__ */ jsxs3("p", { className: "text-[10px]", children: [
|
|
618
384
|
"Selected workspace root: ",
|
|
619
|
-
/* @__PURE__ */
|
|
385
|
+
/* @__PURE__ */ jsx3("strong", { children: selectedFolder.name })
|
|
620
386
|
] }),
|
|
621
|
-
loading ? /* @__PURE__ */
|
|
622
|
-
/* @__PURE__ */
|
|
623
|
-
/* @__PURE__ */
|
|
624
|
-
/* @__PURE__ */
|
|
625
|
-
/* @__PURE__ */
|
|
387
|
+
loading ? /* @__PURE__ */ jsx3("p", { role: "status", className: "text-xs opacity-70", children: "Loading Google Drive folders\u2026" }) : folders.length === 0 ? /* @__PURE__ */ jsx3("p", { className: "text-xs opacity-70", children: "No folders are available at this location." }) : /* @__PURE__ */ jsx3("ul", { className: "max-h-48 space-y-1 overflow-y-auto", children: folders.map((folder) => /* @__PURE__ */ jsxs3("li", { className: "flex items-center justify-between gap-2 border-b py-1", children: [
|
|
388
|
+
/* @__PURE__ */ jsx3("span", { className: "min-w-0 truncate text-xs", children: folder.name }),
|
|
389
|
+
/* @__PURE__ */ jsxs3("span", { className: "flex shrink-0 gap-1", children: [
|
|
390
|
+
/* @__PURE__ */ jsx3("button", { type: "button", onClick: () => void openFolder(folder), disabled: loading, className: "border px-2 py-1 text-[10px] disabled:opacity-50", children: "Open" }),
|
|
391
|
+
/* @__PURE__ */ jsx3("button", { type: "button", onClick: () => {
|
|
626
392
|
onSelectFolder(folder);
|
|
627
393
|
setStatus(`\u201C${folder.name}\u201D selected as the workspace storage root.`);
|
|
628
394
|
}, disabled: loading, className: "border px-2 py-1 text-[10px] font-bold disabled:opacity-50", children: "Select" })
|
|
@@ -632,7 +398,7 @@ function GoogleDriveWorkspacePicker({
|
|
|
632
398
|
}
|
|
633
399
|
|
|
634
400
|
// src/components/workspace/WorkspaceCreateDialog.tsx
|
|
635
|
-
import { jsx as
|
|
401
|
+
import { Fragment, jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
636
402
|
var LOCAL_STORAGE_OPTION = {
|
|
637
403
|
id: "local_fs",
|
|
638
404
|
provider: "local_fs",
|
|
@@ -705,7 +471,7 @@ function buildWorkspaceCreateInput(name, description, option) {
|
|
|
705
471
|
};
|
|
706
472
|
}
|
|
707
473
|
var defaultWorkspaceStorageService = Object.freeze({});
|
|
708
|
-
function createKloksWorkspaceStorageService(invoker
|
|
474
|
+
function createKloksWorkspaceStorageService(invoker) {
|
|
709
475
|
const mapStorageConnection = (connection) => {
|
|
710
476
|
if (!connection || typeof connection.id !== "string" || typeof connection.provider !== "string") return null;
|
|
711
477
|
return {
|
|
@@ -717,20 +483,96 @@ function createKloksWorkspaceStorageService(invoker, googleDrive) {
|
|
|
717
483
|
localFolderName: connection.localFolderName,
|
|
718
484
|
b2BucketName: connection.b2BucketName,
|
|
719
485
|
googleEmail: connection.googleEmail,
|
|
486
|
+
googleAccountId: connection.googleAccountId,
|
|
720
487
|
googleRootFolderId: connection.googleRootFolderId,
|
|
721
488
|
googleRootFolderName: connection.googleRootFolderName
|
|
722
489
|
};
|
|
723
490
|
};
|
|
491
|
+
const listStorageConnections = async (userId) => {
|
|
492
|
+
const result = await invoker.invoke("kloks.backend.storage", "getConnections", { userId });
|
|
493
|
+
const storedConnections = Array.isArray(result) ? result : Array.isArray(result?.connections) ? result.connections : [];
|
|
494
|
+
return storedConnections.map(mapStorageConnection).filter((item) => Boolean(item));
|
|
495
|
+
};
|
|
724
496
|
return {
|
|
725
|
-
|
|
726
|
-
const result = await invoker.invoke("kloks.
|
|
727
|
-
const
|
|
728
|
-
return
|
|
497
|
+
listStorageProviderCapabilities: async (userId) => {
|
|
498
|
+
const result = await invoker.invoke("kloks.backend.storage", "getProviderCapabilities", { userId });
|
|
499
|
+
const capabilities = Array.isArray(result) ? result : Array.isArray(result?.providers) ? result.providers : [];
|
|
500
|
+
return capabilities.filter(
|
|
501
|
+
(item) => item && typeof item.id === "string" && typeof item.displayName === "string"
|
|
502
|
+
);
|
|
729
503
|
},
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
504
|
+
listStorageConnections,
|
|
505
|
+
testBackblazeCredentials: async (input) => {
|
|
506
|
+
const result = await invoker.invoke("kloks.backend.storage", "testBackblazeCredentials", { ...input });
|
|
507
|
+
return result;
|
|
508
|
+
},
|
|
509
|
+
createBackblazeConnection: async (userId, input) => {
|
|
510
|
+
const result = await invoker.invoke("kloks.backend.storage", "createBackblazeConnection", {
|
|
511
|
+
userId,
|
|
512
|
+
...input
|
|
513
|
+
});
|
|
514
|
+
const connection = result?.connection || result;
|
|
515
|
+
if (!connection || typeof connection.id !== "string") {
|
|
516
|
+
throw new Error("Kloks did not return a valid Backblaze storage connection.");
|
|
517
|
+
}
|
|
518
|
+
return {
|
|
519
|
+
id: connection.id,
|
|
520
|
+
name: String(connection.label || connection.name || connection.id),
|
|
521
|
+
provider: String(connection.provider || "backblaze_b2")
|
|
522
|
+
};
|
|
523
|
+
},
|
|
524
|
+
connectGoogleDrive: async (userId) => {
|
|
525
|
+
if (typeof window === "undefined") {
|
|
526
|
+
throw new Error("Google Drive authorization can only start in a browser.");
|
|
527
|
+
}
|
|
528
|
+
const result = await invoker.invoke("kloks.backend.storage", "createGoogleDriveAuthorizationRequest", {
|
|
529
|
+
userId,
|
|
530
|
+
returnTo: window.location.href,
|
|
531
|
+
callbackOrigin: window.location.origin
|
|
532
|
+
});
|
|
533
|
+
const authorizationUrl = result?.authorizationUrl;
|
|
534
|
+
if (typeof authorizationUrl !== "string") {
|
|
535
|
+
throw new Error("Kloks did not return a Google Drive authorization URL.");
|
|
536
|
+
}
|
|
537
|
+
const parsed = new URL(authorizationUrl);
|
|
538
|
+
if (parsed.origin !== "https://accounts.google.com") {
|
|
539
|
+
throw new Error("Kloks returned an untrusted Google Drive authorization destination.");
|
|
540
|
+
}
|
|
541
|
+
window.location.assign(parsed.toString());
|
|
542
|
+
},
|
|
543
|
+
listGoogleDriveFolders: async (connectionId, parentFolderId, userId = "") => {
|
|
544
|
+
const result = await invoker.invoke("kloks.backend.storage", "listGoogleDriveFolders", {
|
|
545
|
+
userId,
|
|
546
|
+
connectionId,
|
|
547
|
+
parentFolderId
|
|
548
|
+
});
|
|
549
|
+
return Array.isArray(result) ? result : Array.isArray(result?.folders) ? result.folders : [];
|
|
550
|
+
},
|
|
551
|
+
getGoogleDriveAccountIdentity: async (userId, connectionId) => {
|
|
552
|
+
const result = await invoker.invoke("kloks.backend.storage", "getGoogleDriveAccountIdentity", {
|
|
553
|
+
userId,
|
|
554
|
+
connectionId
|
|
555
|
+
});
|
|
556
|
+
if (typeof result?.accountId !== "string" || !result.accountId) {
|
|
557
|
+
throw new Error("Kloks did not return an authenticated Google Drive account identity.");
|
|
558
|
+
}
|
|
559
|
+
return {
|
|
560
|
+
accountId: result.accountId,
|
|
561
|
+
...typeof result.email === "string" ? { email: result.email } : {}
|
|
562
|
+
};
|
|
563
|
+
},
|
|
564
|
+
selectGoogleDriveRootFolder: async (userId, connectionId, folderId) => {
|
|
565
|
+
const result = await invoker.invoke("kloks.backend.storage", "selectGoogleDriveRootFolder", {
|
|
566
|
+
userId,
|
|
567
|
+
connectionId,
|
|
568
|
+
folderId
|
|
569
|
+
});
|
|
570
|
+
const folder = result?.folder || result;
|
|
571
|
+
if (!folder || typeof folder.id !== "string" || typeof folder.name !== "string") {
|
|
572
|
+
throw new Error("Kloks did not confirm the selected Google Drive workspace root.");
|
|
573
|
+
}
|
|
574
|
+
return folder;
|
|
575
|
+
}
|
|
734
576
|
};
|
|
735
577
|
}
|
|
736
578
|
function WorkspaceCreateDialog({
|
|
@@ -741,29 +583,35 @@ function WorkspaceCreateDialog({
|
|
|
741
583
|
storageOptions,
|
|
742
584
|
storageService = defaultWorkspaceStorageService,
|
|
743
585
|
visibility,
|
|
586
|
+
googleDriveConnectionId,
|
|
744
587
|
onClose,
|
|
745
588
|
onSubmit
|
|
746
589
|
}) {
|
|
747
|
-
const [loadedOptions, setLoadedOptions] =
|
|
748
|
-
const [
|
|
749
|
-
const [
|
|
750
|
-
const [
|
|
751
|
-
const [
|
|
752
|
-
const [
|
|
753
|
-
const [
|
|
754
|
-
const [
|
|
755
|
-
const [
|
|
756
|
-
const [
|
|
757
|
-
const [
|
|
758
|
-
const [
|
|
759
|
-
const [
|
|
760
|
-
const [
|
|
761
|
-
const [
|
|
762
|
-
const [
|
|
763
|
-
const [
|
|
764
|
-
const [
|
|
590
|
+
const [loadedOptions, setLoadedOptions] = useState4([]);
|
|
591
|
+
const [providerCapabilities, setProviderCapabilities] = useState4([]);
|
|
592
|
+
const [connectedDriveOption, setConnectedDriveOption] = useState4(null);
|
|
593
|
+
const [connectedBackblazeOption, setConnectedBackblazeOption] = useState4(null);
|
|
594
|
+
const [googleDriveFolder, setGoogleDriveFolder] = useState4(null);
|
|
595
|
+
const [verifiedGoogleDriveConnectionId, setVerifiedGoogleDriveConnectionId] = useState4(null);
|
|
596
|
+
const [name, setName] = useState4("");
|
|
597
|
+
const [description, setDescription] = useState4("");
|
|
598
|
+
const [localFolderName, setLocalFolderName] = useState4("");
|
|
599
|
+
const [selectedStorageId, setSelectedStorageId] = useState4("local_fs");
|
|
600
|
+
const [defaultStorageApplied, setDefaultStorageApplied] = useState4(false);
|
|
601
|
+
const [backblazeMode, setBackblazeMode] = useState4(false);
|
|
602
|
+
const [newBackblazeLabel, setNewBackblazeLabel] = useState4("");
|
|
603
|
+
const [newBackblazeKeyId, setNewBackblazeKeyId] = useState4("");
|
|
604
|
+
const [newBackblazeApplicationKey, setNewBackblazeApplicationKey] = useState4("");
|
|
605
|
+
const [newBackblazeBuckets, setNewBackblazeBuckets] = useState4([]);
|
|
606
|
+
const [newBackblazeBucketName, setNewBackblazeBucketName] = useState4("");
|
|
607
|
+
const [backblazeCredentialsTested, setBackblazeCredentialsTested] = useState4(false);
|
|
608
|
+
const [testingBackblazeCredentials, setTestingBackblazeCredentials] = useState4(false);
|
|
609
|
+
const [savingBackblazeConnection, setSavingBackblazeConnection] = useState4(false);
|
|
610
|
+
const [loadingStorage, setLoadingStorage] = useState4(false);
|
|
611
|
+
const [submitting, setSubmitting] = useState4(false);
|
|
612
|
+
const [error, setError] = useState4(null);
|
|
765
613
|
const effectiveUserId = userId || currentUser?.id || "system";
|
|
766
|
-
|
|
614
|
+
useEffect2(() => {
|
|
767
615
|
if (!open) return;
|
|
768
616
|
setName("");
|
|
769
617
|
setDescription("");
|
|
@@ -772,14 +620,67 @@ function WorkspaceCreateDialog({
|
|
|
772
620
|
setSelectedStorageId("local_fs");
|
|
773
621
|
setDefaultStorageApplied(false);
|
|
774
622
|
setBackblazeMode(false);
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
623
|
+
setNewBackblazeLabel("");
|
|
624
|
+
setNewBackblazeKeyId("");
|
|
625
|
+
setNewBackblazeApplicationKey("");
|
|
626
|
+
setNewBackblazeBuckets([]);
|
|
627
|
+
setNewBackblazeBucketName("");
|
|
628
|
+
setBackblazeCredentialsTested(false);
|
|
779
629
|
setConnectedDriveOption(null);
|
|
630
|
+
setConnectedBackblazeOption(null);
|
|
780
631
|
setGoogleDriveFolder(null);
|
|
632
|
+
setVerifiedGoogleDriveConnectionId(null);
|
|
781
633
|
}, [open]);
|
|
782
|
-
|
|
634
|
+
useEffect2(() => {
|
|
635
|
+
if (!open || !storageService.listStorageProviderCapabilities) return;
|
|
636
|
+
let active = true;
|
|
637
|
+
storageService.listStorageProviderCapabilities(effectiveUserId).then((items) => {
|
|
638
|
+
if (active) setProviderCapabilities(Array.isArray(items) ? items : []);
|
|
639
|
+
}).catch((reason) => {
|
|
640
|
+
if (active) setError(reason instanceof Error ? reason.message : "Unable to load storage provider capabilities.");
|
|
641
|
+
});
|
|
642
|
+
return () => {
|
|
643
|
+
active = false;
|
|
644
|
+
};
|
|
645
|
+
}, [open, effectiveUserId, storageService]);
|
|
646
|
+
useEffect2(() => {
|
|
647
|
+
if (!open || !googleDriveConnectionId) return;
|
|
648
|
+
const exists = (storageOptions ?? loadedOptions).some((option) => option.id === googleDriveConnectionId);
|
|
649
|
+
if (exists) {
|
|
650
|
+
setSelectedStorageId(googleDriveConnectionId);
|
|
651
|
+
setBackblazeMode(false);
|
|
652
|
+
}
|
|
653
|
+
}, [open, googleDriveConnectionId, storageOptions, loadedOptions]);
|
|
654
|
+
useEffect2(() => {
|
|
655
|
+
if (!open || !storageService.getGoogleDriveAccountIdentity) return;
|
|
656
|
+
const connection = (storageOptions ?? loadedOptions).find(
|
|
657
|
+
(option) => option.id === selectedStorageId && option.provider === "google_drive"
|
|
658
|
+
) || (connectedDriveOption?.id === selectedStorageId ? connectedDriveOption : void 0);
|
|
659
|
+
if (!connection) {
|
|
660
|
+
setVerifiedGoogleDriveConnectionId(null);
|
|
661
|
+
return;
|
|
662
|
+
}
|
|
663
|
+
let active = true;
|
|
664
|
+
setVerifiedGoogleDriveConnectionId(null);
|
|
665
|
+
storageService.getGoogleDriveAccountIdentity(effectiveUserId, connection.id).then((identity) => {
|
|
666
|
+
if (!active) return;
|
|
667
|
+
setConnectedDriveOption({
|
|
668
|
+
...connection,
|
|
669
|
+
googleAccountId: identity.accountId,
|
|
670
|
+
googleEmail: identity.email || connection.googleEmail
|
|
671
|
+
});
|
|
672
|
+
setVerifiedGoogleDriveConnectionId(connection.id);
|
|
673
|
+
}).catch((reason) => {
|
|
674
|
+
if (active) {
|
|
675
|
+
setVerifiedGoogleDriveConnectionId(null);
|
|
676
|
+
setError(reason instanceof Error ? reason.message : "Unable to verify the Google Drive account identity.");
|
|
677
|
+
}
|
|
678
|
+
});
|
|
679
|
+
return () => {
|
|
680
|
+
active = false;
|
|
681
|
+
};
|
|
682
|
+
}, [open, selectedStorageId, storageOptions, loadedOptions, connectedDriveOption, effectiveUserId, storageService]);
|
|
683
|
+
useEffect2(() => {
|
|
783
684
|
if (!open || storageOptions) return;
|
|
784
685
|
let active = true;
|
|
785
686
|
const listConnections = storageService.listStorageConnections;
|
|
@@ -803,7 +704,7 @@ function WorkspaceCreateDialog({
|
|
|
803
704
|
}, [open, effectiveUserId, storageOptions, storageService]);
|
|
804
705
|
const availableOptions = useMemo(() => {
|
|
805
706
|
const supplied = storageOptions ?? loadedOptions;
|
|
806
|
-
const providerOrder = visibility?.storagePolicy?.providers ?? visibility?.availableStorageProviders ??
|
|
707
|
+
const providerOrder = visibility?.storagePolicy?.providers ?? visibility?.availableStorageProviders ?? providerCapabilities.map((capability) => capability.id);
|
|
807
708
|
const hidden = new Set(visibility?.hiddenStorageProviders || []);
|
|
808
709
|
const enabled = supplied.filter(
|
|
809
710
|
(option) => option && option.enabled !== false && typeof option.id === "string" && !hidden.has(option.provider)
|
|
@@ -816,23 +717,33 @@ function WorkspaceCreateDialog({
|
|
|
816
717
|
...forProvider(provider),
|
|
817
718
|
...connectedDriveOption && connectedDriveOption.enabled !== false ? [connectedDriveOption] : []
|
|
818
719
|
].filter((option, index, items) => items.findIndex((candidate) => candidate.id === option.id) === index);
|
|
819
|
-
|
|
720
|
+
const capability = providerCapabilities.find((item) => item.id === provider);
|
|
721
|
+
const canAuthorize = Boolean(capability?.enabled && capability.canCreateConnection);
|
|
722
|
+
const label = canAuthorize ? "Connect Google Drive" : "Google Drive authorization unavailable";
|
|
723
|
+
return connections.length > 0 ? connections : [{ id: "google_drive", provider: "google_drive", label }];
|
|
820
724
|
}
|
|
821
725
|
if (provider === "backblaze_b2") {
|
|
822
|
-
const connections =
|
|
823
|
-
|
|
726
|
+
const connections = [
|
|
727
|
+
...forProvider(provider),
|
|
728
|
+
...connectedBackblazeOption ? [connectedBackblazeOption] : []
|
|
729
|
+
].filter((option, index, items) => items.findIndex((candidate) => candidate.id === option.id) === index);
|
|
730
|
+
const capability = providerCapabilities.find((item) => item.id === provider);
|
|
731
|
+
return [
|
|
732
|
+
...connections,
|
|
733
|
+
...capability?.enabled && capability.canCreateConnection ? [{ id: "backblaze_external", provider: "backblaze_b2", label: "Add or choose a Backblaze account" }] : []
|
|
734
|
+
];
|
|
824
735
|
}
|
|
825
736
|
return forProvider(provider);
|
|
826
737
|
});
|
|
827
|
-
}, [storageOptions, loadedOptions, connectedDriveOption, visibility]);
|
|
828
|
-
|
|
738
|
+
}, [storageOptions, loadedOptions, connectedDriveOption, connectedBackblazeOption, visibility, providerCapabilities]);
|
|
739
|
+
useEffect2(() => {
|
|
829
740
|
if (!open || loadingStorage || defaultStorageApplied) return;
|
|
830
741
|
const primary = availableOptions.find((option) => option.role === "primary") || availableOptions.find((option) => option.provider !== "local_fs" && option.id !== "google_drive");
|
|
831
742
|
const preferred = primary || availableOptions[0];
|
|
832
743
|
if (preferred) setSelectedStorageId(preferred.id);
|
|
833
744
|
setDefaultStorageApplied(true);
|
|
834
745
|
}, [open, loadingStorage, availableOptions, defaultStorageApplied]);
|
|
835
|
-
|
|
746
|
+
useEffect2(() => {
|
|
836
747
|
if (!open) return;
|
|
837
748
|
const selectedStillExists = backblazeMode || availableOptions.some((option) => option.id === selectedStorageId);
|
|
838
749
|
if (!selectedStillExists) {
|
|
@@ -842,44 +753,117 @@ function WorkspaceCreateDialog({
|
|
|
842
753
|
}, [open, availableOptions, selectedStorageId, backblazeMode]);
|
|
843
754
|
if (!open) return null;
|
|
844
755
|
const selectedOption = availableOptions.find((option) => option.id === selectedStorageId) || availableOptions[0] || NO_STORAGE_OPTION;
|
|
756
|
+
const googleDriveCapability = providerCapabilities.find((capability) => capability.id === "google_drive");
|
|
757
|
+
const backblazeCapability = providerCapabilities.find((capability) => capability.id === "backblaze_b2");
|
|
758
|
+
const canCreateBackblazeConnection = Boolean(backblazeCapability?.enabled && backblazeCapability.canCreateConnection);
|
|
759
|
+
const canAuthorizeGoogleDrive = Boolean(googleDriveCapability?.enabled && googleDriveCapability.canCreateConnection);
|
|
845
760
|
const googleDriveConnection = selectedOption.provider === "google_drive" && selectedOption.id !== "google_drive" ? selectedOption : void 0;
|
|
846
761
|
const hiddenFields = new Set(visibility?.hiddenFields || []);
|
|
847
762
|
const userName = currentUser?.username || currentUser?.name || currentUser?.email?.split("@")[0] || "user";
|
|
848
763
|
const folderPreview = formatWorkspaceFolderPreview(appName, userName, name || "workspace");
|
|
849
|
-
const handleSelectBackblaze =
|
|
764
|
+
const handleSelectBackblaze = () => {
|
|
850
765
|
setBackblazeMode(true);
|
|
851
766
|
setSelectedStorageId("backblaze_external");
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
767
|
+
beginAddBackblazeAccount();
|
|
768
|
+
};
|
|
769
|
+
const beginAddBackblazeAccount = () => {
|
|
770
|
+
setNewBackblazeLabel("");
|
|
771
|
+
setNewBackblazeKeyId("");
|
|
772
|
+
setNewBackblazeApplicationKey("");
|
|
773
|
+
setNewBackblazeBuckets([]);
|
|
774
|
+
setNewBackblazeBucketName("");
|
|
775
|
+
setBackblazeCredentialsTested(false);
|
|
776
|
+
setError(null);
|
|
777
|
+
};
|
|
778
|
+
const cancelAddBackblazeAccount = () => {
|
|
779
|
+
setBackblazeMode(false);
|
|
780
|
+
setSelectedStorageId("backblaze_external");
|
|
781
|
+
setNewBackblazeLabel("");
|
|
782
|
+
setNewBackblazeKeyId("");
|
|
783
|
+
setNewBackblazeApplicationKey("");
|
|
784
|
+
setNewBackblazeBuckets([]);
|
|
785
|
+
setNewBackblazeBucketName("");
|
|
786
|
+
setBackblazeCredentialsTested(false);
|
|
855
787
|
setError(null);
|
|
856
|
-
|
|
857
|
-
|
|
788
|
+
};
|
|
789
|
+
const testNewBackblazeCredentials = async () => {
|
|
790
|
+
if (!storageService.testBackblazeCredentials) {
|
|
791
|
+
setError("Backblaze credential validation is not configured for this storage service.");
|
|
858
792
|
return;
|
|
859
793
|
}
|
|
860
|
-
|
|
794
|
+
if (!newBackblazeKeyId.trim() || !newBackblazeApplicationKey.trim()) {
|
|
795
|
+
setError("Enter the Backblaze Key ID and Application Key before testing.");
|
|
796
|
+
return;
|
|
797
|
+
}
|
|
798
|
+
setTestingBackblazeCredentials(true);
|
|
799
|
+
setError(null);
|
|
800
|
+
setBackblazeCredentialsTested(false);
|
|
801
|
+
setNewBackblazeBuckets([]);
|
|
802
|
+
setNewBackblazeBucketName("");
|
|
861
803
|
try {
|
|
862
|
-
const
|
|
863
|
-
|
|
804
|
+
const result = await storageService.testBackblazeCredentials({
|
|
805
|
+
keyId: newBackblazeKeyId.trim(),
|
|
806
|
+
applicationKey: newBackblazeApplicationKey.trim()
|
|
807
|
+
});
|
|
808
|
+
if (!result.success) {
|
|
809
|
+
throw new Error(result.error || "Backblaze credentials could not be validated.");
|
|
810
|
+
}
|
|
811
|
+
if (!Array.isArray(result.buckets) || result.buckets.length === 0) {
|
|
812
|
+
throw new Error("The Backblaze credentials are valid but no accessible buckets were discovered.");
|
|
813
|
+
}
|
|
814
|
+
setNewBackblazeBuckets(result.buckets);
|
|
815
|
+
setBackblazeCredentialsTested(true);
|
|
816
|
+
setNewBackblazeBucketName(result.buckets.length === 1 ? String(result.buckets[0].bucketName || result.buckets[0].name || "") : "");
|
|
864
817
|
} catch (reason) {
|
|
865
|
-
setError(reason instanceof Error ? reason.message : "
|
|
818
|
+
setError(reason instanceof Error ? reason.message : "Backblaze credential validation failed.");
|
|
866
819
|
} finally {
|
|
867
|
-
|
|
820
|
+
setTestingBackblazeCredentials(false);
|
|
868
821
|
}
|
|
869
822
|
};
|
|
870
|
-
const
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
823
|
+
const saveNewBackblazeConnection = async () => {
|
|
824
|
+
if (!storageService.createBackblazeConnection) {
|
|
825
|
+
setError("Creating Backblaze connections is not configured for this storage service.");
|
|
826
|
+
return;
|
|
827
|
+
}
|
|
828
|
+
if (!backblazeCredentialsTested) {
|
|
829
|
+
setError("Test the Backblaze credentials before saving this connection.");
|
|
830
|
+
return;
|
|
831
|
+
}
|
|
832
|
+
if (!newBackblazeBucketName) {
|
|
833
|
+
setError("Select an accessible bucket before saving this connection.");
|
|
834
|
+
return;
|
|
835
|
+
}
|
|
836
|
+
setSavingBackblazeConnection(true);
|
|
837
|
+
setError(null);
|
|
876
838
|
try {
|
|
877
|
-
const
|
|
878
|
-
|
|
839
|
+
const saved = await storageService.createBackblazeConnection(effectiveUserId, {
|
|
840
|
+
label: newBackblazeLabel.trim() || void 0,
|
|
841
|
+
keyId: newBackblazeKeyId.trim(),
|
|
842
|
+
applicationKey: newBackblazeApplicationKey.trim(),
|
|
843
|
+
bucketName: newBackblazeBucketName
|
|
844
|
+
});
|
|
845
|
+
if (!saved || !saved.id) throw new Error("Kloks did not return a saved Backblaze connection.");
|
|
846
|
+
const savedOption = {
|
|
847
|
+
id: saved.id,
|
|
848
|
+
name: saved.name || newBackblazeLabel.trim() || "Backblaze B2",
|
|
849
|
+
label: saved.name || newBackblazeLabel.trim() || "Backblaze B2",
|
|
850
|
+
provider: saved.provider || "backblaze_b2",
|
|
851
|
+
b2BucketName: newBackblazeBucketName,
|
|
852
|
+
bucketName: newBackblazeBucketName
|
|
853
|
+
};
|
|
854
|
+
setConnectedBackblazeOption(savedOption);
|
|
855
|
+
setSelectedStorageId(savedOption.id);
|
|
856
|
+
setBackblazeMode(false);
|
|
857
|
+
setNewBackblazeLabel("");
|
|
858
|
+
setNewBackblazeKeyId("");
|
|
859
|
+
setNewBackblazeApplicationKey("");
|
|
860
|
+
setNewBackblazeBuckets([]);
|
|
861
|
+
setNewBackblazeBucketName("");
|
|
862
|
+
setBackblazeCredentialsTested(false);
|
|
879
863
|
} catch (reason) {
|
|
880
|
-
setError(reason instanceof Error ? reason.message : "
|
|
864
|
+
setError(reason instanceof Error ? reason.message : "Unable to save the Backblaze connection.");
|
|
881
865
|
} finally {
|
|
882
|
-
|
|
866
|
+
setSavingBackblazeConnection(false);
|
|
883
867
|
}
|
|
884
868
|
};
|
|
885
869
|
const submit = async (event) => {
|
|
@@ -888,8 +872,8 @@ function WorkspaceCreateDialog({
|
|
|
888
872
|
setError("Workspace name is required.");
|
|
889
873
|
return;
|
|
890
874
|
}
|
|
891
|
-
if (backblazeMode
|
|
892
|
-
setError("
|
|
875
|
+
if (backblazeMode || selectedStorageId === "backblaze_external") {
|
|
876
|
+
setError("Save the tested Backblaze connection before creating the workspace.");
|
|
893
877
|
return;
|
|
894
878
|
}
|
|
895
879
|
if (!backblazeMode && !availableOptions.some((option) => option.id === selectedStorageId)) {
|
|
@@ -900,18 +884,25 @@ function WorkspaceCreateDialog({
|
|
|
900
884
|
setError("Connect Google Drive and select a folder for this workspace.");
|
|
901
885
|
return;
|
|
902
886
|
}
|
|
903
|
-
if (
|
|
887
|
+
if (selectedOption.provider === "google_drive" && verifiedGoogleDriveConnectionId !== googleDriveConnection?.id) {
|
|
888
|
+
setError("Verify the authenticated Google Drive account before creating this workspace.");
|
|
889
|
+
return;
|
|
890
|
+
}
|
|
891
|
+
if (loadingStorage || testingBackblazeCredentials || savingBackblazeConnection || submitting) return;
|
|
904
892
|
setSubmitting(true);
|
|
905
893
|
setError(null);
|
|
906
894
|
try {
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
895
|
+
if (selectedOption.provider === "google_drive" && googleDriveFolder) {
|
|
896
|
+
if (!googleDriveConnection || !storageService.selectGoogleDriveRootFolder) {
|
|
897
|
+
throw new Error("Google Drive root selection is not configured through the canonical Kloks storage service.");
|
|
898
|
+
}
|
|
899
|
+
await storageService.selectGoogleDriveRootFolder(
|
|
900
|
+
effectiveUserId,
|
|
901
|
+
googleDriveConnection.id,
|
|
902
|
+
googleDriveFolder.id
|
|
903
|
+
);
|
|
904
|
+
}
|
|
905
|
+
const option = selectedOption.provider === "local_fs" ? { ...selectedOption, localFolderName: localFolderName.trim() || selectedOption.localFolderName || name.trim() } : selectedOption.provider === "google_drive" && googleDriveFolder ? {
|
|
915
906
|
...selectedOption,
|
|
916
907
|
googleRootFolderId: googleDriveFolder.id,
|
|
917
908
|
googleRootFolderName: googleDriveFolder.name
|
|
@@ -929,7 +920,7 @@ function WorkspaceCreateDialog({
|
|
|
929
920
|
const border = "var(--skipo-border-color, var(--color-border, #383838))";
|
|
930
921
|
const accent = "var(--skipo-accent, var(--color-accent, #d4af37))";
|
|
931
922
|
const muted = "var(--skipo-text-muted, var(--color-text-muted, #999))";
|
|
932
|
-
return /* @__PURE__ */
|
|
923
|
+
return /* @__PURE__ */ jsx4("div", { className: "fixed inset-0 z-[70] flex items-center justify-center bg-black/75 p-4 backdrop-blur-sm", role: "presentation", children: /* @__PURE__ */ jsxs4(
|
|
933
924
|
"form",
|
|
934
925
|
{
|
|
935
926
|
onSubmit: submit,
|
|
@@ -937,18 +928,18 @@ function WorkspaceCreateDialog({
|
|
|
937
928
|
className: "w-full max-w-xl max-h-[90vh] overflow-y-auto border-2 p-5 font-mono shadow-[7px_7px_0px_var(--skipo-border-color,var(--color-border,#383838))]",
|
|
938
929
|
style: { backgroundColor: surface, borderColor: border },
|
|
939
930
|
children: [
|
|
940
|
-
/* @__PURE__ */
|
|
941
|
-
/* @__PURE__ */
|
|
942
|
-
/* @__PURE__ */
|
|
943
|
-
/* @__PURE__ */
|
|
931
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex items-center justify-between gap-3 border-b pb-3", style: { borderColor: border }, children: [
|
|
932
|
+
/* @__PURE__ */ jsxs4("div", { children: [
|
|
933
|
+
/* @__PURE__ */ jsx4("h2", { className: "text-sm font-black uppercase", children: "Create Workspace" }),
|
|
934
|
+
/* @__PURE__ */ jsx4("p", { className: "mt-1 text-[10px]", style: { color: muted }, children: "Create an isolated workspace and select its persistent storage." })
|
|
944
935
|
] }),
|
|
945
|
-
/* @__PURE__ */
|
|
936
|
+
/* @__PURE__ */ jsx4(HardDrive3, { size: 18, style: { color: accent } })
|
|
946
937
|
] }),
|
|
947
|
-
error && /* @__PURE__ */
|
|
948
|
-
/* @__PURE__ */
|
|
949
|
-
/* @__PURE__ */
|
|
950
|
-
/* @__PURE__ */
|
|
951
|
-
/* @__PURE__ */
|
|
938
|
+
error && /* @__PURE__ */ jsx4("div", { role: "alert", className: "mt-3 border border-red-500 p-2 text-xs text-red-300", children: error }),
|
|
939
|
+
/* @__PURE__ */ jsxs4("div", { className: "mt-4 space-y-3", children: [
|
|
940
|
+
/* @__PURE__ */ jsxs4("label", { className: "block space-y-1", children: [
|
|
941
|
+
/* @__PURE__ */ jsx4("span", { className: "text-[10px] font-black uppercase", children: "Workspace Name *" }),
|
|
942
|
+
/* @__PURE__ */ jsx4(
|
|
952
943
|
"input",
|
|
953
944
|
{
|
|
954
945
|
"aria-label": "Workspace name",
|
|
@@ -962,9 +953,9 @@ function WorkspaceCreateDialog({
|
|
|
962
953
|
}
|
|
963
954
|
)
|
|
964
955
|
] }),
|
|
965
|
-
!hiddenFields.has("description") && /* @__PURE__ */
|
|
966
|
-
/* @__PURE__ */
|
|
967
|
-
/* @__PURE__ */
|
|
956
|
+
!hiddenFields.has("description") && /* @__PURE__ */ jsxs4("label", { className: "block space-y-1", children: [
|
|
957
|
+
/* @__PURE__ */ jsx4("span", { className: "text-[10px] font-black uppercase", children: "Description" }),
|
|
958
|
+
/* @__PURE__ */ jsx4(
|
|
968
959
|
"textarea",
|
|
969
960
|
{
|
|
970
961
|
"aria-label": "Workspace description",
|
|
@@ -977,9 +968,9 @@ function WorkspaceCreateDialog({
|
|
|
977
968
|
}
|
|
978
969
|
)
|
|
979
970
|
] }),
|
|
980
|
-
/* @__PURE__ */
|
|
981
|
-
/* @__PURE__ */
|
|
982
|
-
/* @__PURE__ */
|
|
971
|
+
/* @__PURE__ */ jsxs4("div", { className: "space-y-1", children: [
|
|
972
|
+
/* @__PURE__ */ jsx4("label", { htmlFor: "floks-workspace-storage", className: "block text-[10px] font-black uppercase", children: "Persistent Storage" }),
|
|
973
|
+
/* @__PURE__ */ jsx4("div", { className: "flex gap-2", children: /* @__PURE__ */ jsx4(
|
|
983
974
|
"select",
|
|
984
975
|
{
|
|
985
976
|
id: "floks-workspace-storage",
|
|
@@ -997,64 +988,122 @@ function WorkspaceCreateDialog({
|
|
|
997
988
|
disabled: loadingStorage || submitting,
|
|
998
989
|
className: "h-10 min-w-0 flex-1 border px-2 text-xs",
|
|
999
990
|
style: { backgroundColor: background, borderColor: border },
|
|
1000
|
-
children: availableOptions.map((option) => /* @__PURE__ */
|
|
991
|
+
children: availableOptions.map((option) => /* @__PURE__ */ jsx4("option", { value: option.id, children: providerLabel(option) + " \u2014 " + (option.label || option.name || option.id) }, option.id))
|
|
1001
992
|
}
|
|
1002
993
|
) }),
|
|
1003
|
-
!hiddenFields.has("backblaze") && backblazeMode && /* @__PURE__ */
|
|
1004
|
-
/* @__PURE__ */
|
|
1005
|
-
/* @__PURE__ */
|
|
1006
|
-
/* @__PURE__ */
|
|
1007
|
-
|
|
994
|
+
!hiddenFields.has("backblaze") && backblazeMode && /* @__PURE__ */ jsx4("div", { className: "mt-3 space-y-3 border-t pt-3", style: { borderColor: border }, children: /* @__PURE__ */ jsxs4("div", { className: "space-y-2 border p-3", style: { borderColor: border, backgroundColor: background }, children: [
|
|
995
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex items-center justify-between gap-2", children: [
|
|
996
|
+
/* @__PURE__ */ jsx4("span", { className: "text-[10px] font-black uppercase", children: "Add Backblaze B2 connection" }),
|
|
997
|
+
/* @__PURE__ */ jsx4("button", { type: "button", onClick: cancelAddBackblazeAccount, disabled: testingBackblazeCredentials || savingBackblazeConnection, className: "text-[10px] underline", children: "Cancel" })
|
|
998
|
+
] }),
|
|
999
|
+
/* @__PURE__ */ jsxs4("label", { className: "block space-y-1", children: [
|
|
1000
|
+
/* @__PURE__ */ jsx4("span", { className: "text-[10px] font-black uppercase", children: "Account label" }),
|
|
1001
|
+
/* @__PURE__ */ jsx4(
|
|
1002
|
+
"input",
|
|
1008
1003
|
{
|
|
1009
|
-
"aria-label": "Backblaze account",
|
|
1010
|
-
value:
|
|
1011
|
-
onChange: (event) =>
|
|
1012
|
-
|
|
1013
|
-
className: "h-9 w-full border px-
|
|
1014
|
-
style: { backgroundColor:
|
|
1015
|
-
children: [
|
|
1016
|
-
/* @__PURE__ */ jsx7("option", { value: "", children: "Select Backblaze account" }),
|
|
1017
|
-
backblazeAccounts.map((account) => /* @__PURE__ */ jsx7("option", { value: account.id, children: account.name }, account.id))
|
|
1018
|
-
]
|
|
1004
|
+
"aria-label": "Backblaze account label",
|
|
1005
|
+
value: newBackblazeLabel,
|
|
1006
|
+
onChange: (event) => setNewBackblazeLabel(event.target.value),
|
|
1007
|
+
placeholder: "Production B2 account",
|
|
1008
|
+
className: "h-9 w-full border px-3 text-xs",
|
|
1009
|
+
style: { backgroundColor: surface, borderColor: border }
|
|
1019
1010
|
}
|
|
1020
|
-
)
|
|
1021
|
-
loadingBackblazeAccounts && /* @__PURE__ */ jsx7("span", { className: "text-[10px]", style: { color: muted }, children: "Loading Backblaze accounts\u2026" })
|
|
1011
|
+
)
|
|
1022
1012
|
] }),
|
|
1023
|
-
/* @__PURE__ */
|
|
1024
|
-
/* @__PURE__ */
|
|
1025
|
-
/* @__PURE__ */
|
|
1026
|
-
"
|
|
1013
|
+
/* @__PURE__ */ jsxs4("label", { className: "block space-y-1", children: [
|
|
1014
|
+
/* @__PURE__ */ jsx4("span", { className: "text-[10px] font-black uppercase", children: "B2 Key ID" }),
|
|
1015
|
+
/* @__PURE__ */ jsx4(
|
|
1016
|
+
"input",
|
|
1027
1017
|
{
|
|
1028
|
-
"aria-label": "Backblaze
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
const bucketName = bucket.bucketName || bucket.name || "";
|
|
1038
|
-
return /* @__PURE__ */ jsx7("option", { value: bucketName, children: bucketName }, bucket.bucketId || bucket.id || bucketName);
|
|
1039
|
-
})
|
|
1040
|
-
]
|
|
1018
|
+
"aria-label": "Backblaze Key ID",
|
|
1019
|
+
autoComplete: "off",
|
|
1020
|
+
value: newBackblazeKeyId,
|
|
1021
|
+
onChange: (event) => {
|
|
1022
|
+
setNewBackblazeKeyId(event.target.value);
|
|
1023
|
+
setBackblazeCredentialsTested(false);
|
|
1024
|
+
},
|
|
1025
|
+
className: "h-9 w-full border px-3 text-xs",
|
|
1026
|
+
style: { backgroundColor: surface, borderColor: border }
|
|
1041
1027
|
}
|
|
1042
|
-
)
|
|
1043
|
-
|
|
1028
|
+
)
|
|
1029
|
+
] }),
|
|
1030
|
+
/* @__PURE__ */ jsxs4("label", { className: "block space-y-1", children: [
|
|
1031
|
+
/* @__PURE__ */ jsx4("span", { className: "text-[10px] font-black uppercase", children: "Application Key" }),
|
|
1032
|
+
/* @__PURE__ */ jsx4(
|
|
1033
|
+
"input",
|
|
1034
|
+
{
|
|
1035
|
+
"aria-label": "Backblaze Application Key",
|
|
1036
|
+
type: "password",
|
|
1037
|
+
autoComplete: "new-password",
|
|
1038
|
+
value: newBackblazeApplicationKey,
|
|
1039
|
+
onChange: (event) => {
|
|
1040
|
+
setNewBackblazeApplicationKey(event.target.value);
|
|
1041
|
+
setBackblazeCredentialsTested(false);
|
|
1042
|
+
},
|
|
1043
|
+
className: "h-9 w-full border px-3 text-xs",
|
|
1044
|
+
style: { backgroundColor: surface, borderColor: border }
|
|
1045
|
+
}
|
|
1046
|
+
)
|
|
1047
|
+
] }),
|
|
1048
|
+
/* @__PURE__ */ jsx4(
|
|
1049
|
+
"button",
|
|
1050
|
+
{
|
|
1051
|
+
type: "button",
|
|
1052
|
+
onClick: () => void testNewBackblazeCredentials(),
|
|
1053
|
+
disabled: testingBackblazeCredentials || savingBackblazeConnection || !newBackblazeKeyId.trim() || !newBackblazeApplicationKey.trim(),
|
|
1054
|
+
className: "h-9 border px-3 text-xs font-bold disabled:opacity-50",
|
|
1055
|
+
style: { borderColor: border },
|
|
1056
|
+
children: testingBackblazeCredentials ? "Testing credentials\u2026" : "Test B2 credentials"
|
|
1057
|
+
}
|
|
1058
|
+
),
|
|
1059
|
+
backblazeCredentialsTested && /* @__PURE__ */ jsxs4(Fragment, { children: [
|
|
1060
|
+
/* @__PURE__ */ jsx4("p", { role: "status", className: "text-[10px] text-emerald-400", children: "Credentials verified. Select the bucket to associate with this account." }),
|
|
1061
|
+
/* @__PURE__ */ jsxs4("label", { className: "block space-y-1", children: [
|
|
1062
|
+
/* @__PURE__ */ jsx4("span", { className: "text-[10px] font-black uppercase", children: "Accessible bucket" }),
|
|
1063
|
+
/* @__PURE__ */ jsxs4(
|
|
1064
|
+
"select",
|
|
1065
|
+
{
|
|
1066
|
+
"aria-label": "New Backblaze bucket",
|
|
1067
|
+
value: newBackblazeBucketName,
|
|
1068
|
+
onChange: (event) => setNewBackblazeBucketName(event.target.value),
|
|
1069
|
+
disabled: savingBackblazeConnection,
|
|
1070
|
+
className: "h-9 w-full border px-2 text-xs",
|
|
1071
|
+
style: { backgroundColor: surface, borderColor: border },
|
|
1072
|
+
children: [
|
|
1073
|
+
/* @__PURE__ */ jsx4("option", { value: "", children: "Select bucket" }),
|
|
1074
|
+
newBackblazeBuckets.map((bucket) => {
|
|
1075
|
+
const bucketName = bucket.bucketName || bucket.name || "";
|
|
1076
|
+
return /* @__PURE__ */ jsx4("option", { value: bucketName, children: bucketName }, bucket.bucketId || bucket.id || bucketName);
|
|
1077
|
+
})
|
|
1078
|
+
]
|
|
1079
|
+
}
|
|
1080
|
+
)
|
|
1081
|
+
] }),
|
|
1082
|
+
/* @__PURE__ */ jsx4(
|
|
1083
|
+
"button",
|
|
1084
|
+
{
|
|
1085
|
+
type: "button",
|
|
1086
|
+
onClick: () => void saveNewBackblazeConnection(),
|
|
1087
|
+
disabled: savingBackblazeConnection || !newBackblazeBucketName,
|
|
1088
|
+
className: "h-9 px-3 text-xs font-bold text-black disabled:opacity-50",
|
|
1089
|
+
style: { backgroundColor: accent },
|
|
1090
|
+
children: savingBackblazeConnection ? "Saving connection\u2026" : "Save account and use it"
|
|
1091
|
+
}
|
|
1092
|
+
)
|
|
1044
1093
|
] })
|
|
1045
|
-
] }),
|
|
1046
|
-
loadingStorage ? /* @__PURE__ */
|
|
1047
|
-
/* @__PURE__ */
|
|
1094
|
+
] }) }),
|
|
1095
|
+
loadingStorage ? /* @__PURE__ */ jsxs4("p", { className: "flex items-center gap-2 text-[10px]", style: { color: muted }, children: [
|
|
1096
|
+
/* @__PURE__ */ jsx4(Loader2, { size: 12, className: "animate-spin" }),
|
|
1048
1097
|
" Loading storage connections\u2026"
|
|
1049
|
-
] }) : availableOptions.length === 0 ? /* @__PURE__ */
|
|
1098
|
+
] }) : availableOptions.length === 0 ? /* @__PURE__ */ jsx4("p", { className: "text-[10px]", style: { color: muted }, children: "This application has not enabled a workspace storage provider." }) : /* @__PURE__ */ jsx4("p", { className: "text-[10px]", style: { color: muted }, children: "Choose from the storage providers explicitly enabled by this application." })
|
|
1050
1099
|
] }),
|
|
1051
|
-
selectedOption.provider === "google_drive" && /* @__PURE__ */
|
|
1100
|
+
selectedOption.provider === "google_drive" && /* @__PURE__ */ jsx4(
|
|
1052
1101
|
GoogleDriveWorkspacePicker,
|
|
1053
1102
|
{
|
|
1054
1103
|
userId: effectiveUserId,
|
|
1055
1104
|
connection: googleDriveConnection,
|
|
1056
|
-
connectGoogleDrive: storageService.connectGoogleDrive,
|
|
1057
|
-
listGoogleDriveFolders: storageService.listGoogleDriveFolders,
|
|
1105
|
+
connectGoogleDrive: canAuthorizeGoogleDrive ? storageService.connectGoogleDrive : void 0,
|
|
1106
|
+
listGoogleDriveFolders: storageService.listGoogleDriveFolders ? (connectionId, parentFolderId) => storageService.listGoogleDriveFolders(connectionId, parentFolderId, effectiveUserId) : void 0,
|
|
1058
1107
|
selectedFolder: googleDriveFolder,
|
|
1059
1108
|
onConnected: (connection) => {
|
|
1060
1109
|
if (connection.provider !== "google_drive") {
|
|
@@ -1069,9 +1118,9 @@ function WorkspaceCreateDialog({
|
|
|
1069
1118
|
onSelectFolder: setGoogleDriveFolder
|
|
1070
1119
|
}
|
|
1071
1120
|
),
|
|
1072
|
-
selectedOption.provider === "local_fs" && !hiddenFields.has("localFolderName") && /* @__PURE__ */
|
|
1073
|
-
/* @__PURE__ */
|
|
1074
|
-
/* @__PURE__ */
|
|
1121
|
+
selectedOption.provider === "local_fs" && !hiddenFields.has("localFolderName") && /* @__PURE__ */ jsxs4("label", { className: "block space-y-1", children: [
|
|
1122
|
+
/* @__PURE__ */ jsx4("span", { className: "text-[10px] font-black uppercase", children: "Local Folder Name" }),
|
|
1123
|
+
/* @__PURE__ */ jsx4(
|
|
1075
1124
|
"input",
|
|
1076
1125
|
{
|
|
1077
1126
|
"aria-label": "Local folder name",
|
|
@@ -1083,17 +1132,17 @@ function WorkspaceCreateDialog({
|
|
|
1083
1132
|
}
|
|
1084
1133
|
)
|
|
1085
1134
|
] }),
|
|
1086
|
-
!hiddenFields.has("canonicalFolderPreview") && /* @__PURE__ */
|
|
1087
|
-
/* @__PURE__ */
|
|
1088
|
-
/* @__PURE__ */
|
|
1089
|
-
/* @__PURE__ */
|
|
1135
|
+
!hiddenFields.has("canonicalFolderPreview") && /* @__PURE__ */ jsxs4("div", { className: "border p-3", style: { borderColor: border, backgroundColor: background }, children: [
|
|
1136
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex items-center justify-between gap-2", children: [
|
|
1137
|
+
/* @__PURE__ */ jsx4("span", { className: "text-[10px] font-black uppercase", style: { color: accent }, children: "Canonical Workspace Folder" }),
|
|
1138
|
+
/* @__PURE__ */ jsx4("span", { className: "text-[9px] uppercase", style: { color: muted }, children: "Ecosystem Standard" })
|
|
1090
1139
|
] }),
|
|
1091
|
-
/* @__PURE__ */
|
|
1140
|
+
/* @__PURE__ */ jsx4("code", { className: "mt-1 block truncate text-xs font-bold text-emerald-400", children: folderPreview })
|
|
1092
1141
|
] })
|
|
1093
1142
|
] }),
|
|
1094
|
-
/* @__PURE__ */
|
|
1095
|
-
/* @__PURE__ */
|
|
1096
|
-
/* @__PURE__ */
|
|
1143
|
+
/* @__PURE__ */ jsxs4("div", { className: "mt-5 flex justify-end gap-2 border-t pt-3", style: { borderColor: border }, children: [
|
|
1144
|
+
/* @__PURE__ */ jsx4("button", { type: "button", onClick: onClose, disabled: submitting, className: "h-9 border px-3 text-xs", style: { borderColor: border }, children: "Cancel" }),
|
|
1145
|
+
/* @__PURE__ */ jsx4("button", { type: "submit", disabled: submitting || loadingStorage || testingBackblazeCredentials || savingBackblazeConnection || !availableOptions.length || !name.trim(), className: "h-9 px-4 text-xs font-black uppercase text-black disabled:opacity-50", style: { backgroundColor: accent }, children: submitting ? "Creating\u2026" : "Create Workspace" })
|
|
1097
1146
|
] })
|
|
1098
1147
|
]
|
|
1099
1148
|
}
|
|
@@ -1101,12 +1150,12 @@ function WorkspaceCreateDialog({
|
|
|
1101
1150
|
}
|
|
1102
1151
|
|
|
1103
1152
|
// src/components/workspace/WorkspaceTilesMenu.tsx
|
|
1104
|
-
import { useId, useMemo as useMemo2, useState as
|
|
1105
|
-
import { FolderOpen, HardDrive as
|
|
1153
|
+
import { useEffect as useEffect3, useId, useMemo as useMemo2, useState as useState5 } from "react";
|
|
1154
|
+
import { FolderOpen, HardDrive as HardDrive4, Cloud as Cloud3, LogOut } from "lucide-react";
|
|
1106
1155
|
import { defineFrnlComponent } from "@ultrst-armada/frnlts";
|
|
1107
1156
|
import { useFrnlComponent } from "@ultrst-armada/frnlts/react";
|
|
1108
|
-
import { Fragment, jsx as
|
|
1109
|
-
var WORKSPACE_TILES_MENU_REQUIRED_SERVICES = ["auth", "workspace", "storage"
|
|
1157
|
+
import { Fragment as Fragment2, jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1158
|
+
var WORKSPACE_TILES_MENU_REQUIRED_SERVICES = ["auth", "workspace", "storage"];
|
|
1110
1159
|
var workspaceTilesMenuDefinition = defineFrnlComponent({
|
|
1111
1160
|
name: "workspaceTilesMenu",
|
|
1112
1161
|
states: {
|
|
@@ -1136,7 +1185,24 @@ function WorkspaceTilesMenu({
|
|
|
1136
1185
|
const effectiveUserId = userId || currentUser?.id || "system";
|
|
1137
1186
|
const generated = useId().replace(/[:/]/g, "");
|
|
1138
1187
|
const componentId = `workspaceTilesMenu.${generated}`;
|
|
1139
|
-
const [creating, setCreating] =
|
|
1188
|
+
const [creating, setCreating] = useState5(false);
|
|
1189
|
+
const [googleDriveConnectionId, setGoogleDriveConnectionId] = useState5();
|
|
1190
|
+
useEffect3(() => {
|
|
1191
|
+
if (typeof window === "undefined") return;
|
|
1192
|
+
const url = new URL(window.location.href);
|
|
1193
|
+
const connected = url.searchParams.get("googleDriveConnected") === "1";
|
|
1194
|
+
const failed = url.searchParams.get("googleDriveError") === "1";
|
|
1195
|
+
const connectionId = url.searchParams.get("googleDriveConnectionId") || void 0;
|
|
1196
|
+
if (connected || failed) {
|
|
1197
|
+
setCreating(true);
|
|
1198
|
+
setGoogleDriveConnectionId(connectionId);
|
|
1199
|
+
url.searchParams.delete("googleDriveConnected");
|
|
1200
|
+
url.searchParams.delete("googleDriveError");
|
|
1201
|
+
url.searchParams.delete("googleDriveConnectionId");
|
|
1202
|
+
url.searchParams.delete("googleDriveErrorCode");
|
|
1203
|
+
window.history.replaceState(window.history.state, "", url.toString());
|
|
1204
|
+
}
|
|
1205
|
+
}, []);
|
|
1140
1206
|
const handlers = useMemo2(() => ({
|
|
1141
1207
|
"workspaceTilesMenu.idle.select": (value) => onSelectWorkspace(value),
|
|
1142
1208
|
"workspaceTilesMenu.idle.create": () => setCreating(true),
|
|
@@ -1150,12 +1216,12 @@ function WorkspaceTilesMenu({
|
|
|
1150
1216
|
properties: { activeWorkspaceId, workspaceCount: workspaces.length },
|
|
1151
1217
|
handlers
|
|
1152
1218
|
});
|
|
1153
|
-
return /* @__PURE__ */
|
|
1154
|
-
/* @__PURE__ */
|
|
1155
|
-
/* @__PURE__ */
|
|
1219
|
+
return /* @__PURE__ */ jsxs5("section", { id: componentId, "data-frnl-component": "workspaceTilesMenu", "data-frnl-state": frnl.state, className: "space-y-3", children: [
|
|
1220
|
+
/* @__PURE__ */ jsx5("div", { className: "flex justify-end gap-2", children: onLogout && /* @__PURE__ */ jsxs5("button", { type: "button", onClick: () => frnl.events.logout(void 0), className: "h-8 px-3 border border-red-500/60 text-red-300 text-[10px] font-black flex items-center gap-1", children: [
|
|
1221
|
+
/* @__PURE__ */ jsx5(LogOut, { size: 12 }),
|
|
1156
1222
|
" LOGOUT"
|
|
1157
1223
|
] }) }),
|
|
1158
|
-
/* @__PURE__ */
|
|
1224
|
+
/* @__PURE__ */ jsx5(
|
|
1159
1225
|
TilesMenu,
|
|
1160
1226
|
{
|
|
1161
1227
|
id: componentId + ".tiles",
|
|
@@ -1167,27 +1233,27 @@ function WorkspaceTilesMenu({
|
|
|
1167
1233
|
createLabel: "NEW WORKSPACE",
|
|
1168
1234
|
onSelect: (ws) => frnl.events.select(ws),
|
|
1169
1235
|
onCreate: () => frnl.events.create(void 0),
|
|
1170
|
-
renderTile: (ws, selected) => /* @__PURE__ */
|
|
1171
|
-
/* @__PURE__ */
|
|
1172
|
-
ws.storageProvider === "backblaze_b2" ? /* @__PURE__ */
|
|
1236
|
+
renderTile: (ws, selected) => /* @__PURE__ */ jsxs5(Fragment2, { children: [
|
|
1237
|
+
/* @__PURE__ */ jsxs5("div", { className: "flex items-center gap-2 text-xs font-black uppercase", children: [
|
|
1238
|
+
ws.storageProvider === "backblaze_b2" ? /* @__PURE__ */ jsx5(Cloud3, { size: 14 }) : /* @__PURE__ */ jsx5(HardDrive4, { size: 14 }),
|
|
1173
1239
|
ws.title || ws.name || "Workspace"
|
|
1174
1240
|
] }),
|
|
1175
|
-
/* @__PURE__ */
|
|
1176
|
-
/* @__PURE__ */
|
|
1177
|
-
/* @__PURE__ */
|
|
1241
|
+
/* @__PURE__ */ jsx5("p", { className: "mt-2 text-[11px] text-[var(--skipo-text-muted)]", children: ws.description }),
|
|
1242
|
+
/* @__PURE__ */ jsxs5("div", { className: `mt-2 text-[10px] ${selected || ws.id === activeWorkspaceId ? "text-[var(--skipo-accent)]" : "text-[var(--skipo-text-muted)]"}`, children: [
|
|
1243
|
+
/* @__PURE__ */ jsx5(FolderOpen, { size: 11, className: "inline mr-1" }),
|
|
1178
1244
|
ws.workspacePath ?? ws.b2BucketName ?? ws.localFolderName ?? ws.id
|
|
1179
1245
|
] })
|
|
1180
1246
|
] })
|
|
1181
1247
|
}
|
|
1182
1248
|
),
|
|
1183
|
-
/* @__PURE__ */
|
|
1249
|
+
/* @__PURE__ */ jsx5(WorkspaceCreateDialog, { open: creating, userId: effectiveUserId, currentUser, appName, storageOptions, storageService, visibility, googleDriveConnectionId, onClose: () => setCreating(false), onSubmit: onCreateWorkspace })
|
|
1184
1250
|
] });
|
|
1185
1251
|
}
|
|
1186
1252
|
|
|
1187
1253
|
// src/components/workspace/WorkspaceGate.tsx
|
|
1188
1254
|
import { useMemo as useMemo3 } from "react";
|
|
1189
1255
|
import { LogOut as LogOut2, ArrowLeft } from "lucide-react";
|
|
1190
|
-
import { jsx as
|
|
1256
|
+
import { jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1191
1257
|
var WorkspaceGate = ({
|
|
1192
1258
|
workspaces,
|
|
1193
1259
|
activeWorkspaceId,
|
|
@@ -1196,6 +1262,8 @@ var WorkspaceGate = ({
|
|
|
1196
1262
|
appName = "Workspaces",
|
|
1197
1263
|
appSubtitle = "WORKSPACE VAULT GATEWAY \u2022 ISOLATION ENFORCED (LAW L6)",
|
|
1198
1264
|
storageService,
|
|
1265
|
+
storageOptions,
|
|
1266
|
+
visibility,
|
|
1199
1267
|
onSelectWorkspace,
|
|
1200
1268
|
onCreateWorkspace,
|
|
1201
1269
|
onUpdateWorkspace,
|
|
@@ -1223,45 +1291,45 @@ var WorkspaceGate = ({
|
|
|
1223
1291
|
}));
|
|
1224
1292
|
}, [workspaces]);
|
|
1225
1293
|
const effectiveUserId = userId || currentUser?.id || "system";
|
|
1226
|
-
return /* @__PURE__ */
|
|
1294
|
+
return /* @__PURE__ */ jsx6(
|
|
1227
1295
|
"div",
|
|
1228
1296
|
{
|
|
1229
1297
|
className: "min-h-screen h-screen w-screen bg-[var(--skipo-bg,#0b0e17)] text-[var(--skipo-text,#f8fafc)] font-mono p-6 sm:p-8 flex flex-col items-center justify-center overflow-auto",
|
|
1230
1298
|
style: { minHeight: "100vh", height: "100vh", width: "100vw" },
|
|
1231
|
-
children: /* @__PURE__ */
|
|
1232
|
-
/* @__PURE__ */
|
|
1233
|
-
/* @__PURE__ */
|
|
1234
|
-
/* @__PURE__ */
|
|
1235
|
-
/* @__PURE__ */
|
|
1299
|
+
children: /* @__PURE__ */ jsxs6("div", { className: "w-full max-w-4xl my-auto", children: [
|
|
1300
|
+
/* @__PURE__ */ jsxs6("header", { className: "mb-6 flex items-center justify-between border-b border-[var(--skipo-border-color,#1e293b)] pb-4", children: [
|
|
1301
|
+
/* @__PURE__ */ jsxs6("div", { children: [
|
|
1302
|
+
/* @__PURE__ */ jsx6("h1", { className: "text-2xl font-black tracking-wider text-[var(--skipo-accent,#f59e0b)] uppercase", children: appName }),
|
|
1303
|
+
/* @__PURE__ */ jsx6("p", { className: "text-xs text-[var(--skipo-text-muted,#94a3b8)] font-mono tracking-tight mt-0.5", children: appSubtitle })
|
|
1236
1304
|
] }),
|
|
1237
|
-
/* @__PURE__ */
|
|
1238
|
-
canClose && onClose && /* @__PURE__ */
|
|
1305
|
+
/* @__PURE__ */ jsxs6("div", { className: "flex items-center gap-2", children: [
|
|
1306
|
+
canClose && onClose && /* @__PURE__ */ jsxs6(
|
|
1239
1307
|
"button",
|
|
1240
1308
|
{
|
|
1241
1309
|
type: "button",
|
|
1242
1310
|
onClick: onClose,
|
|
1243
1311
|
className: "h-8 px-3 border border-[var(--skipo-border-color,#1e293b)] hover:border-[var(--skipo-accent,#f59e0b)] text-[var(--skipo-text-muted)] hover:text-[var(--skipo-text)] text-[10px] font-black flex items-center gap-1.5 transition-colors",
|
|
1244
1312
|
children: [
|
|
1245
|
-
/* @__PURE__ */
|
|
1313
|
+
/* @__PURE__ */ jsx6(ArrowLeft, { size: 13 }),
|
|
1246
1314
|
" BACK TO APP"
|
|
1247
1315
|
]
|
|
1248
1316
|
}
|
|
1249
1317
|
),
|
|
1250
|
-
onLogout && /* @__PURE__ */
|
|
1318
|
+
onLogout && /* @__PURE__ */ jsxs6(
|
|
1251
1319
|
"button",
|
|
1252
1320
|
{
|
|
1253
1321
|
type: "button",
|
|
1254
1322
|
onClick: onLogout,
|
|
1255
1323
|
className: "h-8 px-3 border border-red-500/60 hover:bg-red-950/20 text-red-300 text-[10px] font-black flex items-center gap-1.5 transition-colors",
|
|
1256
1324
|
children: [
|
|
1257
|
-
/* @__PURE__ */
|
|
1325
|
+
/* @__PURE__ */ jsx6(LogOut2, { size: 12 }),
|
|
1258
1326
|
" LOGOUT"
|
|
1259
1327
|
]
|
|
1260
1328
|
}
|
|
1261
1329
|
)
|
|
1262
1330
|
] })
|
|
1263
1331
|
] }),
|
|
1264
|
-
/* @__PURE__ */
|
|
1332
|
+
/* @__PURE__ */ jsx6(
|
|
1265
1333
|
WorkspaceTilesMenu,
|
|
1266
1334
|
{
|
|
1267
1335
|
workspaces: normalizedWorkspaces,
|
|
@@ -1270,6 +1338,8 @@ var WorkspaceGate = ({
|
|
|
1270
1338
|
currentUser,
|
|
1271
1339
|
appName,
|
|
1272
1340
|
storageService,
|
|
1341
|
+
storageOptions,
|
|
1342
|
+
visibility,
|
|
1273
1343
|
onSelectWorkspace,
|
|
1274
1344
|
onCreateWorkspace: onCreateWorkspace || (() => {
|
|
1275
1345
|
}),
|
|
@@ -1285,9 +1355,6 @@ var WorkspaceGate = ({
|
|
|
1285
1355
|
};
|
|
1286
1356
|
|
|
1287
1357
|
export {
|
|
1288
|
-
StoragePresetTile,
|
|
1289
|
-
SrklBackblazeTile,
|
|
1290
|
-
StorageOptionTiles,
|
|
1291
1358
|
WorkspaceStorageReadonlyPanel,
|
|
1292
1359
|
WorkspaceSecondaryClonesPanel,
|
|
1293
1360
|
describeGoogleDriveError,
|