@burdenoff/microfe-security 2026.625.1 → 2026.626.1
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/security/components/PageLayout.js +35 -18
- package/dist/security/components/PageLayout.js.map +1 -1
- package/dist/security/components/SecurityScoreCard.js +11 -10
- package/dist/security/components/SecurityScoreCard.js.map +1 -1
- package/dist/security/components/VaultCard.js +8 -1
- package/dist/security/components/VaultCard.js.map +1 -1
- package/dist/security/components/ui.js +7 -15
- package/dist/security/components/ui.js.map +1 -1
- package/dist/security/pages/AccessReviewPage.js +129 -98
- package/dist/security/pages/AccessReviewPage.js.map +1 -1
- package/dist/security/pages/AuditLogPage.js +69 -62
- package/dist/security/pages/AuditLogPage.js.map +1 -1
- package/dist/security/pages/ImportExportPage.js +23 -17
- package/dist/security/pages/ImportExportPage.js.map +1 -1
- package/dist/security/pages/ProviderDetailPage.js +193 -173
- package/dist/security/pages/ProviderDetailPage.js.map +1 -1
- package/dist/security/pages/ProvidersPage.js +59 -56
- package/dist/security/pages/ProvidersPage.js.map +1 -1
- package/dist/security/pages/SecretCreatePage.js +76 -70
- package/dist/security/pages/SecretCreatePage.js.map +1 -1
- package/dist/security/pages/SecretDetailPage.js +325 -290
- package/dist/security/pages/SecretDetailPage.js.map +1 -1
- package/dist/security/pages/SecurityDashboardPage.js +107 -68
- package/dist/security/pages/SecurityDashboardPage.js.map +1 -1
- package/dist/security/pages/SharedWithMePage.js +48 -44
- package/dist/security/pages/SharedWithMePage.js.map +1 -1
- package/dist/security/pages/VaultCreatePage.js +65 -58
- package/dist/security/pages/VaultCreatePage.js.map +1 -1
- package/dist/security/pages/VaultDetailPage.js +225 -196
- package/dist/security/pages/VaultDetailPage.js.map +1 -1
- package/dist/security/pages/VaultSettingsPage.js +224 -205
- package/dist/security/pages/VaultSettingsPage.js.map +1 -1
- package/dist/security/pages/VaultsDashboardPage.js +100 -93
- package/dist/security/pages/VaultsDashboardPage.js.map +1 -1
- package/package.json +2 -2
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { useSecurity as e } from "../providers/SecurityProvider.js";
|
|
2
2
|
import { PageLayout as t } from "../components/PageLayout.js";
|
|
3
|
-
import { Badge as n, Button as r, Card as i,
|
|
4
|
-
import { useGetVaults as
|
|
5
|
-
import { useVaultIntegrations as
|
|
6
|
-
import { getProviderTypeInfo as
|
|
7
|
-
import { useState as
|
|
8
|
-
import { useNavigate as
|
|
9
|
-
import { jsx as
|
|
10
|
-
import { AlertTriangle as
|
|
11
|
-
import { GlassCard as S } from "@burdenoff/fe-libs/ui";
|
|
3
|
+
import { Badge as n, Button as r, Card as i, Select as a } from "../components/ui.js";
|
|
4
|
+
import { useGetVaults as o } from "../hooks/useVaultQueries.js";
|
|
5
|
+
import { useVaultIntegrations as s } from "../hooks/useProviderQueries.js";
|
|
6
|
+
import { getProviderTypeInfo as c } from "../constants/providers.js";
|
|
7
|
+
import { useState as l } from "react";
|
|
8
|
+
import { useNavigate as u } from "react-router-dom";
|
|
9
|
+
import { jsx as d, jsxs as f } from "react/jsx-runtime";
|
|
10
|
+
import { AlertTriangle as p, CheckCircle as m, Clock as h, Cloud as g, Loader2 as _, RefreshCw as v, XCircle as y } from "lucide-react";
|
|
11
|
+
import { GlassCard as b, IllustratedEmptyState as x, PagePurpose as S } from "@burdenoff/fe-libs/ui";
|
|
12
12
|
//#region src/security/pages/ProvidersPage.tsx
|
|
13
13
|
function C() {
|
|
14
|
-
let { basePath: C = "/", navigate: w } = e(), T =
|
|
14
|
+
let { basePath: C = "/", navigate: w } = e(), T = u(), [E, D] = l(""), { data: O, loading: k } = o(void 0, { limit: 100 }), A = O?.getVaults?.items ?? [], { data: j, loading: M, error: N, refetch: P } = s(E || void 0), F = j?.getVaultIntegrations?.items ?? [], I = (e) => {
|
|
15
15
|
w ? w(e) : T(e);
|
|
16
16
|
}, L = [{
|
|
17
17
|
value: "",
|
|
@@ -23,128 +23,131 @@ function C() {
|
|
|
23
23
|
connected: {
|
|
24
24
|
label: "Connected",
|
|
25
25
|
variant: "success",
|
|
26
|
-
icon:
|
|
26
|
+
icon: m
|
|
27
27
|
},
|
|
28
28
|
disconnected: {
|
|
29
29
|
label: "Disconnected",
|
|
30
30
|
variant: "outline",
|
|
31
|
-
icon:
|
|
31
|
+
icon: y
|
|
32
32
|
},
|
|
33
33
|
error: {
|
|
34
34
|
label: "Error",
|
|
35
35
|
variant: "destructive",
|
|
36
|
-
icon:
|
|
36
|
+
icon: p
|
|
37
37
|
},
|
|
38
38
|
syncing: {
|
|
39
39
|
label: "Syncing",
|
|
40
40
|
variant: "warning",
|
|
41
|
-
icon:
|
|
41
|
+
icon: v
|
|
42
42
|
}
|
|
43
43
|
};
|
|
44
|
-
return /* @__PURE__ */
|
|
44
|
+
return /* @__PURE__ */ d(t, {
|
|
45
45
|
title: "Providers",
|
|
46
46
|
description: "Connect external secret management providers.",
|
|
47
47
|
breadcrumbs: [{
|
|
48
48
|
label: "Security",
|
|
49
49
|
path: C
|
|
50
50
|
}, { label: "Providers" }],
|
|
51
|
-
children: /* @__PURE__ */
|
|
51
|
+
children: /* @__PURE__ */ f("div", {
|
|
52
52
|
className: "space-y-6",
|
|
53
53
|
children: [
|
|
54
|
-
/* @__PURE__ */
|
|
55
|
-
|
|
54
|
+
/* @__PURE__ */ d(S, {
|
|
55
|
+
icon: /* @__PURE__ */ d(g, { className: "size-4" }),
|
|
56
|
+
children: "Providers connect a vault to an external secret manager (such as a cloud secrets store) so credentials stay in sync automatically instead of being copied by hand. Pick a vault to see which providers it is connected to, when each last synced, and whether any syncs failed."
|
|
57
|
+
}),
|
|
58
|
+
/* @__PURE__ */ d(b, {
|
|
59
|
+
treatment: "glass",
|
|
60
|
+
glow: !0,
|
|
56
61
|
className: "p-4",
|
|
57
|
-
children: /* @__PURE__ */
|
|
62
|
+
children: /* @__PURE__ */ d("p", {
|
|
58
63
|
className: "text-sm text-text-secondary",
|
|
59
64
|
children: "Provider sync infrastructure is available, but guided provider onboarding is still being finalized. Existing connections can be reviewed here."
|
|
60
65
|
})
|
|
61
66
|
}),
|
|
62
|
-
/* @__PURE__ */
|
|
67
|
+
/* @__PURE__ */ d("div", {
|
|
63
68
|
className: "max-w-sm",
|
|
64
|
-
children: /* @__PURE__ */
|
|
69
|
+
children: /* @__PURE__ */ d(a, {
|
|
65
70
|
label: "Vault",
|
|
66
71
|
value: E,
|
|
67
72
|
onChange: D,
|
|
68
73
|
options: L
|
|
69
74
|
})
|
|
70
75
|
}),
|
|
71
|
-
!E && !k && /* @__PURE__ */
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
children: "Select a vault to view its provider integrations."
|
|
76
|
-
})]
|
|
76
|
+
!E && !k && /* @__PURE__ */ d(x, {
|
|
77
|
+
illustration: "empty-generic",
|
|
78
|
+
title: "Select a vault",
|
|
79
|
+
description: "Choose a vault above to view and manage its provider integrations."
|
|
77
80
|
}),
|
|
78
|
-
k && /* @__PURE__ */
|
|
81
|
+
k && /* @__PURE__ */ d("div", {
|
|
79
82
|
className: "flex items-center justify-center py-16",
|
|
80
|
-
children: /* @__PURE__ */
|
|
83
|
+
children: /* @__PURE__ */ d(_, { className: "size-8 animate-spin text-primary" })
|
|
81
84
|
}),
|
|
82
|
-
E && M && /* @__PURE__ */
|
|
85
|
+
E && M && /* @__PURE__ */ d("div", {
|
|
83
86
|
className: "flex items-center justify-center py-16",
|
|
84
|
-
children: /* @__PURE__ */
|
|
87
|
+
children: /* @__PURE__ */ d(_, { className: "size-8 animate-spin text-primary" })
|
|
85
88
|
}),
|
|
86
|
-
E && N && /* @__PURE__ */
|
|
89
|
+
E && N && /* @__PURE__ */ d(i, {
|
|
87
90
|
className: "p-6",
|
|
88
|
-
children: /* @__PURE__ */
|
|
91
|
+
children: /* @__PURE__ */ f("div", {
|
|
89
92
|
className: "flex items-start gap-4",
|
|
90
|
-
children: [/* @__PURE__ */
|
|
91
|
-
/* @__PURE__ */
|
|
93
|
+
children: [/* @__PURE__ */ d(p, { className: "size-6 text-status-error-text" }), /* @__PURE__ */ f("div", { children: [
|
|
94
|
+
/* @__PURE__ */ d("h3", {
|
|
92
95
|
className: "font-semibold text-status-error-text",
|
|
93
96
|
children: "Failed to load providers"
|
|
94
97
|
}),
|
|
95
|
-
/* @__PURE__ */
|
|
98
|
+
/* @__PURE__ */ d("p", {
|
|
96
99
|
className: "text-sm text-text-secondary mt-1",
|
|
97
100
|
children: N.message
|
|
98
101
|
}),
|
|
99
|
-
/* @__PURE__ */
|
|
102
|
+
/* @__PURE__ */ f(r, {
|
|
100
103
|
variant: "outline",
|
|
101
104
|
size: "sm",
|
|
102
105
|
className: "mt-3",
|
|
103
106
|
onClick: () => P(),
|
|
104
|
-
children: [/* @__PURE__ */
|
|
107
|
+
children: [/* @__PURE__ */ d(v, { className: "size-4" }), "Retry"]
|
|
105
108
|
})
|
|
106
109
|
] })]
|
|
107
110
|
})
|
|
108
111
|
}),
|
|
109
|
-
E && !M && !N && F.length > 0 && /* @__PURE__ */
|
|
112
|
+
E && !M && !N && F.length > 0 && /* @__PURE__ */ d("div", {
|
|
110
113
|
className: "grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4",
|
|
111
114
|
children: F.map((e) => {
|
|
112
|
-
let t =
|
|
113
|
-
return /* @__PURE__ */
|
|
115
|
+
let t = c(e.providerType), r = R[e.status ?? "disconnected"] ?? R.disconnected, a = r.icon;
|
|
116
|
+
return /* @__PURE__ */ f(i, {
|
|
114
117
|
onClick: () => I(`${C}/providers/${E}/${e.id}`),
|
|
115
118
|
className: "p-5",
|
|
116
|
-
children: [/* @__PURE__ */
|
|
119
|
+
children: [/* @__PURE__ */ f("div", {
|
|
117
120
|
className: "flex items-start justify-between mb-3",
|
|
118
|
-
children: [/* @__PURE__ */
|
|
121
|
+
children: [/* @__PURE__ */ f("div", {
|
|
119
122
|
className: "flex items-center gap-3",
|
|
120
|
-
children: [/* @__PURE__ */
|
|
123
|
+
children: [/* @__PURE__ */ d("div", {
|
|
121
124
|
className: "p-2 rounded-lg bg-action-primary-bg/10",
|
|
122
|
-
children: /* @__PURE__ */
|
|
123
|
-
}), /* @__PURE__ */
|
|
125
|
+
children: /* @__PURE__ */ d(g, { className: "size-5 text-primary" })
|
|
126
|
+
}), /* @__PURE__ */ f("div", { children: [/* @__PURE__ */ d("h3", {
|
|
124
127
|
className: "font-bold text-text-primary",
|
|
125
128
|
children: e.displayName || t.label
|
|
126
|
-
}), /* @__PURE__ */
|
|
129
|
+
}), /* @__PURE__ */ d("p", {
|
|
127
130
|
className: "text-xs text-text-secondary",
|
|
128
131
|
children: t.label
|
|
129
132
|
})] })]
|
|
130
|
-
}), /* @__PURE__ */
|
|
133
|
+
}), /* @__PURE__ */ f(n, {
|
|
131
134
|
variant: r.variant,
|
|
132
135
|
className: "text-[10px] uppercase font-bold",
|
|
133
|
-
children: [/* @__PURE__ */
|
|
136
|
+
children: [/* @__PURE__ */ d(a, { className: "size-3" }), r.label]
|
|
134
137
|
})]
|
|
135
|
-
}), /* @__PURE__ */
|
|
138
|
+
}), /* @__PURE__ */ f("div", {
|
|
136
139
|
className: "flex items-center gap-4 text-xs text-text-secondary pt-3 border-t border-border-subtle/40 mt-3",
|
|
137
|
-
children: [e.syncEnabled ? /* @__PURE__ */
|
|
140
|
+
children: [e.syncEnabled ? /* @__PURE__ */ f("span", {
|
|
138
141
|
className: "bg-bg-sunken px-1.5 py-0.5 rounded",
|
|
139
142
|
children: [
|
|
140
143
|
"Sync: ",
|
|
141
144
|
e.syncIntervalMinutes,
|
|
142
145
|
"m"
|
|
143
146
|
]
|
|
144
|
-
}) : null, e.lastSyncAt ? /* @__PURE__ */
|
|
147
|
+
}) : null, e.lastSyncAt ? /* @__PURE__ */ f("span", {
|
|
145
148
|
className: "flex items-center gap-1",
|
|
146
|
-
children: [/* @__PURE__ */
|
|
147
|
-
}) : /* @__PURE__ */
|
|
149
|
+
children: [/* @__PURE__ */ d(h, { className: "size-3" }), new Date(e.lastSyncAt).toLocaleDateString()]
|
|
150
|
+
}) : /* @__PURE__ */ d("span", {
|
|
148
151
|
className: "italic opacity-60",
|
|
149
152
|
children: "Never synced"
|
|
150
153
|
})]
|
|
@@ -152,8 +155,8 @@ function C() {
|
|
|
152
155
|
}, e.id);
|
|
153
156
|
})
|
|
154
157
|
}),
|
|
155
|
-
E && !M && !N && F.length === 0 && /* @__PURE__ */
|
|
156
|
-
|
|
158
|
+
E && !M && !N && F.length === 0 && /* @__PURE__ */ d(x, {
|
|
159
|
+
illustration: "empty-generic",
|
|
157
160
|
title: "No providers connected",
|
|
158
161
|
description: "Provider onboarding is being finalized. Existing connections will appear here when configured."
|
|
159
162
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProvidersPage.js","names":[],"sources":["../../../src/security/pages/ProvidersPage.tsx"],"sourcesContent":["import { useState } from 'react';\nimport { useNavigate } from 'react-router-dom';\nimport {\n Cloud,\n Loader2,\n AlertTriangle,\n RefreshCw,\n CheckCircle,\n XCircle,\n Clock,\n Lock,\n} from 'lucide-react';\nimport { PageLayout } from '../components/PageLayout';\nimport { GlassCard } from '@burdenoff/fe-libs/ui';\nimport { Button, Card, Badge, EmptyState, Select } from '../components/ui';\nimport { useVaultIntegrations } from '../hooks/useProviderQueries';\nimport { useGetVaults } from '../hooks/useVaultQueries';\nimport { useSecurity } from '../providers/SecurityProvider';\nimport { getProviderTypeInfo } from '../constants/providers';\nimport type { ProviderType, ProviderStatus } from '../types';\n\nexport function ProvidersPage() {\n const { basePath = '/', navigate: shellNavigate } = useSecurity();\n const routerNavigate = useNavigate();\n const [selectedVaultId, setSelectedVaultId] = useState('');\n\n const { data: vaultsData, loading: vaultsLoading } = useGetVaults(undefined, { limit: 100 });\n const vaults = vaultsData?.getVaults?.items ?? [];\n\n const { data, loading, error, refetch } = useVaultIntegrations(selectedVaultId || undefined);\n const providers = data?.getVaultIntegrations?.items ?? [];\n\n const handleNavigate = (path: string) => {\n if (shellNavigate) {\n shellNavigate(path);\n } else {\n routerNavigate(path);\n }\n };\n\n const vaultOptions = [\n { value: '', label: 'Select a vault...' },\n ...vaults.map((v: Record<string, unknown>) => ({\n value: v.id as string,\n label: v.name as string,\n })),\n ];\n\n const statusConfig: Record<\n string,\n {\n label: string;\n variant: 'success' | 'destructive' | 'warning' | 'outline';\n icon: typeof CheckCircle;\n }\n > = {\n connected: { label: 'Connected', variant: 'success', icon: CheckCircle },\n disconnected: { label: 'Disconnected', variant: 'outline', icon: XCircle },\n error: { label: 'Error', variant: 'destructive', icon: AlertTriangle },\n syncing: { label: 'Syncing', variant: 'warning', icon: RefreshCw },\n };\n\n return (\n <PageLayout\n title=\"Providers\"\n description=\"Connect external secret management providers.\"\n breadcrumbs={[{ label: 'Security', path: basePath }, { label: 'Providers' }]}\n >\n <div className=\"space-y-6\">\n <GlassCard treatment=\"insight\" className=\"p-4\">\n <p className=\"text-sm text-text-secondary\">\n Provider sync infrastructure is available, but guided provider onboarding is still being\n finalized. Existing connections can be reviewed here.\n </p>\n </GlassCard>\n\n {/* Vault selector */}\n <div className=\"max-w-sm\">\n <Select\n label=\"Vault\"\n value={selectedVaultId}\n onChange={setSelectedVaultId}\n options={vaultOptions}\n />\n </div>\n\n {!selectedVaultId && !vaultsLoading && (\n <Card className=\"p-8 text-center\">\n <Lock className=\"size-10 text-text-secondary mx-auto mb-3\" />\n <p className=\"text-sm text-text-secondary\">\n Select a vault to view its provider integrations.\n </p>\n </Card>\n )}\n\n {vaultsLoading && (\n <div className=\"flex items-center justify-center py-16\">\n <Loader2 className=\"size-8 animate-spin text-primary\" />\n </div>\n )}\n\n {selectedVaultId && loading && (\n <div className=\"flex items-center justify-center py-16\">\n <Loader2 className=\"size-8 animate-spin text-primary\" />\n </div>\n )}\n\n {selectedVaultId && error && (\n <Card className=\"p-6\">\n <div className=\"flex items-start gap-4\">\n <AlertTriangle className=\"size-6 text-status-error-text\" />\n <div>\n <h3 className=\"font-semibold text-status-error-text\">Failed to load providers</h3>\n <p className=\"text-sm text-text-secondary mt-1\">{error.message}</p>\n <Button variant=\"outline\" size=\"sm\" className=\"mt-3\" onClick={() => refetch()}>\n <RefreshCw className=\"size-4\" />\n Retry\n </Button>\n </div>\n </div>\n </Card>\n )}\n\n {selectedVaultId && !loading && !error && providers.length > 0 && (\n <div className=\"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4\">\n {providers.map((provider: any) => {\n const typeInfo = getProviderTypeInfo(provider.providerType as ProviderType);\n const status =\n statusConfig[(provider.status as string) ?? 'disconnected'] ??\n statusConfig.disconnected;\n const StatusIcon = status.icon;\n\n return (\n <Card\n key={provider.id}\n onClick={() =>\n handleNavigate(`${basePath}/providers/${selectedVaultId}/${provider.id}`)\n }\n className=\"p-5\"\n >\n <div className=\"flex items-start justify-between mb-3\">\n <div className=\"flex items-center gap-3\">\n <div className=\"p-2 rounded-lg bg-action-primary-bg/10\">\n <Cloud className=\"size-5 text-primary\" />\n </div>\n <div>\n <h3 className=\"font-bold text-text-primary\">\n {provider.displayName || typeInfo.label}\n </h3>\n <p className=\"text-xs text-text-secondary\">{typeInfo.label}</p>\n </div>\n </div>\n <Badge variant={status.variant} className=\"text-[10px] uppercase font-bold\">\n <StatusIcon className=\"size-3\" />\n {status.label}\n </Badge>\n </div>\n\n <div className=\"flex items-center gap-4 text-xs text-text-secondary pt-3 border-t border-border-subtle/40 mt-3\">\n {provider.syncEnabled ? (\n <span className=\"bg-bg-sunken px-1.5 py-0.5 rounded\">\n Sync: {provider.syncIntervalMinutes}m\n </span>\n ) : null}\n {provider.lastSyncAt ? (\n <span className=\"flex items-center gap-1\">\n <Clock className=\"size-3\" />\n {new Date(provider.lastSyncAt).toLocaleDateString()}\n </span>\n ) : (\n <span className=\"italic opacity-60\">Never synced</span>\n )}\n </div>\n </Card>\n );\n })}\n </div>\n )}\n\n {selectedVaultId && !loading && !error && providers.length === 0 && (\n <EmptyState\n icon={<Cloud className=\"size-12\" />}\n title=\"No providers connected\"\n description=\"Provider onboarding is being final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;UAAK,WAAU;oBACb,kBAAC,GAAD,EAAO,WAAU,uBAAwB,CAAA;UACrC,CAAA,EACN,kBAAC,OAAD,EAAA,UAAA,CACE,kBAAC,MAAD;UAAI,WAAU;oBACX,EAAS,eAAe,EAAS;UAC/B,CAAA,EACL,kBAAC,KAAD;UAAG,WAAU;oBAA+B,EAAS;UAAU,CAAA,CAC3D,EAAA,CAAA,CACF;YACN,kBAAC,GAAD;SAAO,SAAS,EAAO;SAAS,WAAU;mBAA1C,CACE,kBAAC,GAAD,EAAY,WAAU,UAAW,CAAA,EAChC,EAAO,MACF;WACJ;WAEN,kBAAC,OAAD;QAAK,WAAU;kBAAf,CACG,EAAS,cACR,kBAAC,QAAD;SAAM,WAAU;mBAAhB;UAAqD;UAC5C,EAAS;UAAoB;UAC/B;aACL,MACH,EAAS,aACR,kBAAC,QAAD;SAAM,WAAU;mBAAhB,CACE,kBAAC,GAAD,EAAO,WAAU,UAAW,CAAA,EAC3B,IAAI,KAAK,EAAS,WAAW,CAAC,oBAAoB,CAC9C;aAEP,kBAAC,QAAD;SAAM,WAAU;mBAAoB;SAAmB,CAAA,CAErD;UACD;SAvCA,EAAS,GAuCT;OAET;KACE,CAAA;IAGL,KAAmB,CAAC,KAAW,CAAC,KAAS,EAAU,WAAW,KAC7D,kBAAC,GAAD;KACE,MAAM,kBAAC,GAAD,EAAO,WAAU,WAAY,CAAA;KACnC,OAAM;KACN,aAAY;KACZ,CAAA;IAEA;;EACK,CAAA"}
|
|
1
|
+
{"version":3,"file":"ProvidersPage.js","names":[],"sources":["../../../src/security/pages/ProvidersPage.tsx"],"sourcesContent":["import { useState } from 'react';\nimport { useNavigate } from 'react-router-dom';\nimport {\n Cloud,\n Loader2,\n AlertTriangle,\n RefreshCw,\n CheckCircle,\n XCircle,\n Clock,\n} from 'lucide-react';\nimport { PageLayout } from '../components/PageLayout';\nimport { GlassCard, IllustratedEmptyState, PagePurpose } from '@burdenoff/fe-libs/ui';\nimport { Button, Card, Badge, Select } from '../components/ui';\nimport { useVaultIntegrations } from '../hooks/useProviderQueries';\nimport { useGetVaults } from '../hooks/useVaultQueries';\nimport { useSecurity } from '../providers/SecurityProvider';\nimport { getProviderTypeInfo } from '../constants/providers';\nimport type { ProviderType, ProviderStatus } from '../types';\n\nexport function ProvidersPage() {\n const { basePath = '/', navigate: shellNavigate } = useSecurity();\n const routerNavigate = useNavigate();\n const [selectedVaultId, setSelectedVaultId] = useState('');\n\n const { data: vaultsData, loading: vaultsLoading } = useGetVaults(undefined, { limit: 100 });\n const vaults = vaultsData?.getVaults?.items ?? [];\n\n const { data, loading, error, refetch } = useVaultIntegrations(selectedVaultId || undefined);\n const providers = data?.getVaultIntegrations?.items ?? [];\n\n const handleNavigate = (path: string) => {\n if (shellNavigate) {\n shellNavigate(path);\n } else {\n routerNavigate(path);\n }\n };\n\n const vaultOptions = [\n { value: '', label: 'Select a vault...' },\n ...vaults.map((v: Record<string, unknown>) => ({\n value: v.id as string,\n label: v.name as string,\n })),\n ];\n\n const statusConfig: Record<\n string,\n {\n label: string;\n variant: 'success' | 'destructive' | 'warning' | 'outline';\n icon: typeof CheckCircle;\n }\n > = {\n connected: { label: 'Connected', variant: 'success', icon: CheckCircle },\n disconnected: { label: 'Disconnected', variant: 'outline', icon: XCircle },\n error: { label: 'Error', variant: 'destructive', icon: AlertTriangle },\n syncing: { label: 'Syncing', variant: 'warning', icon: RefreshCw },\n };\n\n return (\n <PageLayout\n title=\"Providers\"\n description=\"Connect external secret management providers.\"\n breadcrumbs={[{ label: 'Security', path: basePath }, { label: 'Providers' }]}\n >\n <div className=\"space-y-6\">\n <PagePurpose icon={<Cloud className=\"size-4\" />}>\n Providers connect a vault to an external secret manager (such as a cloud secrets store) so\n credentials stay in sync automatically instead of being copied by hand. Pick a vault to see\n which providers it is connected to, when each last synced, and whether any syncs failed.\n </PagePurpose>\n\n {/* Single emphasis zone — the current state of provider onboarding. */}\n <GlassCard treatment=\"glass\" glow className=\"p-4\">\n <p className=\"text-sm text-text-secondary\">\n Provider sync infrastructure is available, but guided provider onboarding is still being\n finalized. Existing connections can be reviewed here.\n </p>\n </GlassCard>\n\n {/* Vault selector */}\n <div className=\"max-w-sm\">\n <Select\n label=\"Vault\"\n value={selectedVaultId}\n onChange={setSelectedVaultId}\n options={vaultOptions}\n />\n </div>\n\n {!selectedVaultId && !vaultsLoading && (\n <IllustratedEmptyState\n illustration=\"empty-generic\"\n title=\"Select a vault\"\n description=\"Choose a vault above to view and manage its provider integrations.\"\n />\n )}\n\n {vaultsLoading && (\n <div className=\"flex items-center justify-center py-16\">\n <Loader2 className=\"size-8 animate-spin text-primary\" />\n </div>\n )}\n\n {selectedVaultId && loading && (\n <div className=\"flex items-center justify-center py-16\">\n <Loader2 className=\"size-8 animate-spin text-primary\" />\n </div>\n )}\n\n {selectedVaultId && error && (\n <Card className=\"p-6\">\n <div className=\"flex items-start gap-4\">\n <AlertTriangle className=\"size-6 text-status-error-text\" />\n <div>\n <h3 className=\"font-semibold text-status-error-text\">Failed to load providers</h3>\n <p className=\"text-sm text-text-secondary mt-1\">{error.message}</p>\n <Button variant=\"outline\" size=\"sm\" className=\"mt-3\" onClick={() => refetch()}>\n <RefreshCw className=\"size-4\" />\n Retry\n </Button>\n </div>\n </div>\n </Card>\n )}\n\n {selectedVaultId && !loading && !error && providers.length > 0 && (\n <div className=\"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4\">\n {providers.map((provider: any) => {\n const typeInfo = getProviderTypeInfo(provider.providerType as ProviderType);\n const status =\n statusConfig[(provider.status as string) ?? 'disconnected'] ??\n statusConfig.disconnected;\n const StatusIcon = status.icon;\n\n return (\n <Card\n key={provider.id}\n onClick={() =>\n handleNavigate(`${basePath}/providers/${selectedVaultId}/${provider.id}`)\n }\n className=\"p-5\"\n >\n <div className=\"flex items-start justify-between mb-3\">\n <div className=\"flex items-center gap-3\">\n <div className=\"p-2 rounded-lg bg-action-primary-bg/10\">\n <Cloud className=\"size-5 text-primary\" />\n </div>\n <div>\n <h3 className=\"font-bold text-text-primary\">\n {provider.displayName || typeInfo.label}\n </h3>\n <p className=\"text-xs text-text-secondary\">{typeInfo.label}</p>\n </div>\n </div>\n <Badge variant={status.variant} className=\"text-[10px] uppercase font-bold\">\n <StatusIcon className=\"size-3\" />\n {status.label}\n </Badge>\n </div>\n\n <div className=\"flex items-center gap-4 text-xs text-text-secondary pt-3 border-t border-border-subtle/40 mt-3\">\n {provider.syncEnabled ? (\n <span className=\"bg-bg-sunken px-1.5 py-0.5 rounded\">\n Sync: {provider.syncIntervalMinutes}m\n </span>\n ) : null}\n {provider.lastSyncAt ? (\n <span className=\"flex items-center gap-1\">\n <Clock className=\"size-3\" />\n {new Date(provider.lastSyncAt).toLocaleDateString()}\n </span>\n ) : (\n <span className=\"italic opacity-60\">Never synced</span>\n )}\n </div>\n </Card>\n );\n })}\n </div>\n )}\n\n {selectedVaultId && !loading && !error && providers.length === 0 && (\n <IllustratedEmptyState\n illustration=\"empty-generic\"\n title=\"No providers connected\"\n description=\"Provider onboarding is being finalized. Existing connections will appear here when configured.\"\n />\n )}\n </div>\n </PageLayout>\n );\n}\n"],"mappings":";;;;;;;;;;;;AAoBA,SAAgB,IAAgB;CAC9B,IAAM,EAAE,cAAW,KAAK,UAAU,MAAkB,GAAa,EAC3D,IAAiB,GAAa,EAC9B,CAAC,GAAiB,KAAsB,EAAS,GAAG,EAEpD,EAAE,MAAM,GAAY,SAAS,MAAkB,EAAa,KAAA,GAAW,EAAE,OAAO,KAAK,CAAC,EACtF,IAAS,GAAY,WAAW,SAAS,EAAE,EAE3C,EAAE,SAAM,YAAS,UAAO,eAAY,EAAqB,KAAmB,KAAA,EAAU,EACtF,IAAY,GAAM,sBAAsB,SAAS,EAAE,EAEnD,KAAkB,MAAiB;AACvC,EAAI,IACF,EAAc,EAAK,GAEnB,EAAe,EAAK;IAIlB,IAAe,CACnB;EAAE,OAAO;EAAI,OAAO;EAAqB,EACzC,GAAG,EAAO,KAAK,OAAgC;EAC7C,O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AO,WAAU,UAAW,CAAA,EAC3B,IAAI,KAAK,EAAS,WAAW,CAAC,oBAAoB,CAC9C;aAEP,kBAAC,QAAD;SAAM,WAAU;mBAAoB;SAAmB,CAAA,CAErD;UACD;SAvCA,EAAS,GAuCT;OAET;KACE,CAAA;IAGL,KAAmB,CAAC,KAAW,CAAC,KAAS,EAAU,WAAW,KAC7D,kBAAC,GAAD;KACE,cAAa;KACb,OAAM;KACN,aAAY;KACZ,CAAA;IAEA;;EACK,CAAA"}
|
|
@@ -10,151 +10,157 @@ import { SecurityPermissionGuard as u } from "../components/SecurityPermissionGu
|
|
|
10
10
|
import { useState as d } from "react";
|
|
11
11
|
import { useNavigate as f, useParams as p } from "react-router-dom";
|
|
12
12
|
import { jsx as m, jsxs as h } from "react/jsx-runtime";
|
|
13
|
-
import { AlertTriangle as g, ArrowLeft as _, Info as v,
|
|
14
|
-
import { GlassCard as
|
|
15
|
-
import { useI18n as
|
|
13
|
+
import { AlertTriangle as g, ArrowLeft as _, Info as v, KeyRound as y, Loader2 as b, Save as x, ShieldCheck as S } from "lucide-react";
|
|
14
|
+
import { GlassCard as C, PagePurpose as w, ShowMore as T } from "@burdenoff/fe-libs/ui";
|
|
15
|
+
import { useI18n as E } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
|
|
16
16
|
//#region src/security/pages/SecretCreatePage.tsx
|
|
17
|
-
function
|
|
17
|
+
function D(e) {
|
|
18
18
|
return e instanceof Error && ("graphQLErrors" in e || "networkError" in e || "clientErrors" in e);
|
|
19
19
|
}
|
|
20
|
-
function
|
|
21
|
-
let { vaultId:
|
|
22
|
-
|
|
23
|
-
},
|
|
24
|
-
|
|
20
|
+
function O() {
|
|
21
|
+
let { vaultId: O } = p(), { basePath: k = "/", navigate: A } = e(), j = f(), { t: M } = E(), N = (e, t, n) => i(M, e, t, n), [P, { loading: F }] = o(), { emit: I } = a(), [L, R] = d("CREDENTIAL"), [z, B] = d(""), [V, H] = d(""), [U, W] = d(""), [G, K] = d([]), [q, J] = d(null), Y = (e) => {
|
|
22
|
+
A ? A(e) : j(e);
|
|
23
|
+
}, X = () => {
|
|
24
|
+
Y(`${k}/vaults/${O}`);
|
|
25
25
|
};
|
|
26
26
|
return /* @__PURE__ */ m(u, {
|
|
27
27
|
permission: "secret:create",
|
|
28
|
-
children: /* @__PURE__ */
|
|
29
|
-
title:
|
|
30
|
-
description:
|
|
28
|
+
children: /* @__PURE__ */ h(t, {
|
|
29
|
+
title: N("security.secretCreate.title", "Add New Secret"),
|
|
30
|
+
description: N("security.secretCreate.description", "Store a new credential, API key, or sensitive text securely."),
|
|
31
31
|
breadcrumbs: [
|
|
32
32
|
{
|
|
33
|
-
label:
|
|
34
|
-
path:
|
|
33
|
+
label: N("security.common.breadcrumbs.security", "Security"),
|
|
34
|
+
path: k
|
|
35
35
|
},
|
|
36
36
|
{
|
|
37
|
-
label:
|
|
38
|
-
path: `${
|
|
37
|
+
label: N("security.common.breadcrumbs.vault", "Vault"),
|
|
38
|
+
path: `${k}/vaults/${O}`
|
|
39
39
|
},
|
|
40
|
-
{ label:
|
|
40
|
+
{ label: N("security.secretCreate.breadcrumb", "New Secret") }
|
|
41
41
|
],
|
|
42
42
|
actions: /* @__PURE__ */ h(n, {
|
|
43
43
|
variant: "outline",
|
|
44
44
|
size: "sm",
|
|
45
|
-
onClick:
|
|
46
|
-
"aria-label":
|
|
47
|
-
children: [/* @__PURE__ */ m(_, { className: "size-4" }),
|
|
45
|
+
onClick: X,
|
|
46
|
+
"aria-label": N("security.secretCreate.actions.backToVault", "Back to Vault"),
|
|
47
|
+
children: [/* @__PURE__ */ m(_, { className: "size-4" }), N("security.secretCreate.actions.backToVault", "Back to Vault")]
|
|
48
48
|
}),
|
|
49
|
-
children: /* @__PURE__ */
|
|
49
|
+
children: [/* @__PURE__ */ m(w, {
|
|
50
|
+
icon: /* @__PURE__ */ m(y, { className: "size-4" }),
|
|
51
|
+
className: "mb-6",
|
|
52
|
+
children: N("security.secretCreate.purpose", "Store a single credential — an API key, password, token or any sensitive text — inside this vault. Pick the right type so it is displayed and handled correctly, give it a clear name, and paste the value. The value is encrypted immediately and is only ever shown again when an authorized user explicitly reveals it.")
|
|
53
|
+
}), /* @__PURE__ */ h("div", {
|
|
50
54
|
className: "grid grid-cols-1 lg:grid-cols-3 gap-8",
|
|
51
55
|
children: [/* @__PURE__ */ m("div", {
|
|
52
56
|
className: "lg:col-span-2",
|
|
53
|
-
children: /* @__PURE__ */ h(
|
|
54
|
-
|
|
57
|
+
children: /* @__PURE__ */ h(C, {
|
|
58
|
+
treatment: "glass",
|
|
59
|
+
glow: !0,
|
|
60
|
+
className: "p-6",
|
|
55
61
|
children: [
|
|
56
62
|
/* @__PURE__ */ m(l, {
|
|
57
|
-
type:
|
|
58
|
-
onTypeChange:
|
|
59
|
-
name:
|
|
60
|
-
onNameChange:
|
|
61
|
-
value:
|
|
62
|
-
onValueChange:
|
|
63
|
-
description:
|
|
64
|
-
onDescriptionChange:
|
|
65
|
-
labels:
|
|
66
|
-
onLabelsChange:
|
|
63
|
+
type: L,
|
|
64
|
+
onTypeChange: R,
|
|
65
|
+
name: z,
|
|
66
|
+
onNameChange: B,
|
|
67
|
+
value: V,
|
|
68
|
+
onValueChange: H,
|
|
69
|
+
description: U,
|
|
70
|
+
onDescriptionChange: W,
|
|
71
|
+
labels: G,
|
|
72
|
+
onLabelsChange: K
|
|
67
73
|
}),
|
|
68
|
-
|
|
74
|
+
q && /* @__PURE__ */ h("div", {
|
|
69
75
|
className: "mt-6 p-3 rounded-md bg-status-error-bg/10 text-status-error-text text-sm border border-status-error-border/20 flex items-start gap-2",
|
|
70
|
-
children: [/* @__PURE__ */ m(g, { className: "size-4 shrink-0 mt-0.5" }),
|
|
76
|
+
children: [/* @__PURE__ */ m(g, { className: "size-4 shrink-0 mt-0.5" }), q]
|
|
71
77
|
}),
|
|
72
78
|
/* @__PURE__ */ h("div", {
|
|
73
79
|
className: "flex justify-end gap-3 mt-8 pt-6 border-t border-border-subtle/60",
|
|
74
80
|
children: [/* @__PURE__ */ m(n, {
|
|
75
81
|
variant: "outline",
|
|
76
|
-
onClick:
|
|
77
|
-
disabled:
|
|
78
|
-
"aria-label":
|
|
79
|
-
children:
|
|
82
|
+
onClick: X,
|
|
83
|
+
disabled: F,
|
|
84
|
+
"aria-label": N("security.secretCreate.actions.cancel", "Cancel"),
|
|
85
|
+
children: N("security.secretCreate.actions.cancel", "Cancel")
|
|
80
86
|
}), /* @__PURE__ */ h(n, {
|
|
81
87
|
onClick: async () => {
|
|
82
|
-
if (s("light"), !
|
|
83
|
-
|
|
88
|
+
if (s("light"), !z.trim()) {
|
|
89
|
+
J(N("security.secretCreate.error.nameRequired", "Name is required."));
|
|
84
90
|
return;
|
|
85
91
|
}
|
|
86
|
-
if (!
|
|
87
|
-
|
|
92
|
+
if (!V.trim()) {
|
|
93
|
+
J(N("security.secretCreate.error.valueRequired", "Value is required."));
|
|
88
94
|
return;
|
|
89
95
|
}
|
|
90
|
-
|
|
96
|
+
J(null);
|
|
91
97
|
try {
|
|
92
|
-
let e = await
|
|
93
|
-
vaultId:
|
|
94
|
-
name:
|
|
95
|
-
key:
|
|
96
|
-
value:
|
|
97
|
-
type:
|
|
98
|
-
description:
|
|
99
|
-
tags:
|
|
98
|
+
let e = await P({ variables: { input: {
|
|
99
|
+
vaultId: O ?? "",
|
|
100
|
+
name: z.trim(),
|
|
101
|
+
key: z.trim().toLowerCase().replace(/\s+/g, "_").replace(/[^a-z0-9_]/g, ""),
|
|
102
|
+
value: V.trim(),
|
|
103
|
+
type: L,
|
|
104
|
+
description: U.trim() || void 0,
|
|
105
|
+
tags: G.length > 0 ? G : void 0
|
|
100
106
|
} } });
|
|
101
107
|
if (e.error) {
|
|
102
|
-
|
|
108
|
+
J(e.error.message ?? N("security.secretCreate.error.createFailed", "Failed to create secret")), c("error");
|
|
103
109
|
return;
|
|
104
110
|
}
|
|
105
111
|
if (e.data?.createSecret?.id) {
|
|
106
|
-
|
|
112
|
+
I("secret.created", {
|
|
107
113
|
secretId: e.data.createSecret.id,
|
|
108
|
-
vaultId:
|
|
109
|
-
}), c("success"),
|
|
114
|
+
vaultId: O
|
|
115
|
+
}), c("success"), X();
|
|
110
116
|
return;
|
|
111
117
|
}
|
|
112
|
-
|
|
118
|
+
J(N("security.secretCreate.error.createFailed", "Failed to create secret")), c("error");
|
|
113
119
|
} catch (e) {
|
|
114
|
-
|
|
120
|
+
J(D(e) ? e.message : N("security.secretCreate.error.createFailed", "Failed to create secret")), c("error");
|
|
115
121
|
}
|
|
116
122
|
},
|
|
117
|
-
disabled:
|
|
118
|
-
children: [
|
|
123
|
+
disabled: F || !z.trim() || !V.trim(),
|
|
124
|
+
children: [F ? /* @__PURE__ */ m(b, { className: "size-4 animate-spin" }) : /* @__PURE__ */ m(x, { className: "size-4" }), F ? N("security.secretCreate.actions.creating", "Creating...") : N("security.secretCreate.actions.createSecret", "Create Secret")]
|
|
119
125
|
})]
|
|
120
126
|
})
|
|
121
127
|
]
|
|
122
128
|
})
|
|
123
129
|
}), /* @__PURE__ */ h("div", {
|
|
124
130
|
className: "space-y-6",
|
|
125
|
-
children: [/* @__PURE__ */ h(
|
|
131
|
+
children: [/* @__PURE__ */ h(C, {
|
|
126
132
|
treatment: "insight",
|
|
127
133
|
className: "p-6",
|
|
128
134
|
children: [/* @__PURE__ */ h("h3", {
|
|
129
135
|
className: "text-sm font-bold text-primary flex items-center gap-2 mb-3 uppercase tracking-wider",
|
|
130
|
-
children: [/* @__PURE__ */ m(
|
|
136
|
+
children: [/* @__PURE__ */ m(S, { className: "size-4" }), N("security.secretCreate.secureStorage.title", "Secure Storage")]
|
|
131
137
|
}), /* @__PURE__ */ m("p", {
|
|
132
138
|
className: "text-xs text-text-secondary leading-relaxed",
|
|
133
|
-
children:
|
|
139
|
+
children: N("security.secretCreate.secureStorage.description", "Your secret will be encrypted using a vault-specific key derived from the master encryption system. Once saved, the plain-text value is never shown unless explicitly revealed by an authorized user.")
|
|
134
140
|
})]
|
|
135
141
|
}), /* @__PURE__ */ h(r, {
|
|
136
142
|
className: "p-6",
|
|
137
143
|
children: [/* @__PURE__ */ h("h3", {
|
|
138
144
|
className: "text-sm font-bold text-text-primary flex items-center gap-2 mb-3",
|
|
139
|
-
children: [/* @__PURE__ */ m(v, { className: "size-4 text-text-secondary" }),
|
|
140
|
-
}), /* @__PURE__ */ m(
|
|
145
|
+
children: [/* @__PURE__ */ m(v, { className: "size-4 text-text-secondary" }), N("security.secretCreate.namingTips.title", "Naming Tips")]
|
|
146
|
+
}), /* @__PURE__ */ m(T, {
|
|
141
147
|
collapsedHeight: 64,
|
|
142
148
|
children: /* @__PURE__ */ h("ul", {
|
|
143
149
|
className: "text-xs text-text-secondary space-y-2 list-disc pl-4",
|
|
144
150
|
children: [
|
|
145
|
-
/* @__PURE__ */ m("li", { children:
|
|
146
|
-
/* @__PURE__ */ m("li", { children:
|
|
147
|
-
/* @__PURE__ */ m("li", { children:
|
|
151
|
+
/* @__PURE__ */ m("li", { children: N("security.secretCreate.namingTips.productionDb", "Use descriptive names like Production Database URL") }),
|
|
152
|
+
/* @__PURE__ */ m("li", { children: N("security.secretCreate.namingTips.autoKey", "A unique key will be automatically generated from the name") }),
|
|
153
|
+
/* @__PURE__ */ m("li", { children: N("security.secretCreate.namingTips.labels", "You can add labels to group secrets by environment or project") })
|
|
148
154
|
]
|
|
149
155
|
})
|
|
150
156
|
})]
|
|
151
157
|
})]
|
|
152
158
|
})]
|
|
153
|
-
})
|
|
159
|
+
})]
|
|
154
160
|
})
|
|
155
161
|
});
|
|
156
162
|
}
|
|
157
163
|
//#endregion
|
|
158
|
-
export {
|
|
164
|
+
export { O as SecretCreatePage };
|
|
159
165
|
|
|
160
166
|
//# sourceMappingURL=SecretCreatePage.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SecretCreatePage.js","names":[],"sources":["../../../src/security/pages/SecretCreatePage.tsx"],"sourcesContent":["import { useState } from 'react';\nimport { useParams, useNavigate } from 'react-router-dom';\nimport { Save, ArrowLeft, Loader2, ShieldCheck, Info, AlertTriangle } from 'lucide-react';\nimport { GlassCard, ShowMore } from '@burdenoff/fe-libs/ui';\nimport { PageLayout } from '../components/PageLayout';\nimport { SecretFormFields } from '../components/SecretFormFields';\nimport { Button, Card } from '../components/ui';\nimport { useCreateSecret } from '../hooks/useSecretQueries';\nimport { useSecurityEventEmitter } from '../hooks/useSecurityEventEmitter';\nimport { useSecurity } from '../providers/SecurityProvider';\nimport { SecurityPermissionGuard } from '../components/SecurityPermissionGuard';\nimport { cn } from '../utils/cn';\nimport { useI18n } from '@burdenoff/fe-libs/shared/providers/shell/I18nProvider';\nimport { translateWithFallback } from '../utils/i18n';\nimport type { SecretType } from '../types';\nimport { nativeImpact, nativeNotify } from '../../utils/nativeBridge';\n\n/**\n * Detect Apollo-shaped errors structurally (works across Apollo v3 and v4).\n * Apollo errors carry `graphQLErrors`, `networkError`, or `clientErrors` —\n * those messages are already shaped for client display. Other thrown Errors\n * fall through to the generic translation to avoid leaking internal details.\n */\nfunction isApolloError(err: unknown): err is Error {\n return (\n err instanceof Error &&\n ('graphQLErrors' in err || 'networkError' in err || 'clientErrors' in err)\n );\n}\n\nexport function SecretCreatePage() {\n const { vaultId } = useParams<{ vaultId: string }>();\n const { basePath = '/', navigate: shellNavigate } = useSecurity();\n const routerNavigate = useNavigate();\n const { t } = useI18n();\n const tx = (key: string, fallback: string, params?: Record<string, string | number>) =>\n translateWithFallback(t, key, fallback, params);\n\n const [createSecret, { loading: creating }] = useCreateSecret();\n const { emit } = useSecurityEventEmitter();\n\n const [type, setType] = useState<SecretType>('CREDENTIAL');\n const [name, setName] = useState('');\n const [value, setValue] = useState('');\n const [description, setDescription] = useState('');\n const [labels, setLabels] = useState<string[]>([]);\n const [error, setError] = useState<string | null>(null);\n\n const handleNavigate = (path: string) => {\n if (shellNavigate) {\n shellNavigate(path);\n } else {\n routerNavigate(path);\n }\n };\n\n const handleBack = () => {\n handleNavigate(`${basePath}/vaults/${vaultId}`);\n };\n\n const handleSave = async () => {\n void nativeImpact('light');\n if (!name.trim()) {\n setError(tx('security.secretCreate.error.nameRequired', 'Name is required.'));\n return;\n }\n if (!value.trim()) {\n setError(tx('security.secretCreate.error.valueRequired', 'Value is required.'));\n return;\n }\n\n setError(null);\n\n try {\n const result = await createSecret({\n variables: {\n input: {\n vaultId: vaultId ?? '',\n name: name.trim(),\n key: name\n .trim()\n .toLowerCase()\n .replace(/\\s+/g, '_')\n .replace(/[^a-z0-9_]/g, ''),\n value: value.trim(),\n type,\n description: description.trim() || undefined,\n tags: labels.length > 0 ? labels : undefined,\n },\n },\n });\n // Apollo v4 exposes a single aggregated `error` on the mutation result.\n if (result.error) {\n setError(\n result.error.message ??\n tx('security.secretCreate.error.createFailed', 'Failed to create secret')\n );\n void nativeNotify('error');\n return;\n }\n\n if (result.data?.createSecret?.id) {\n emit('secret.created', { secretId: result.data.createSecret.id, vaultId });\n void nativeNotify('success');\n handleBack();\n return;\n }\n\n // No data and no errors — surface a generic failure rather than navigate away silently.\n setError(tx('security.secretCreate.error.createFailed', 'Failed to create secret'));\n void nativeNotify('error');\n } catch (err) {\n // Only surface raw error messages that come from Apollo — those are\n // already shaped for client consumption. Anything else falls back to\n // the generic translation to avoid leaking internal details into the UI.\n setError(\n isApolloError(err)\n ? err.message\n : tx('security.secretCreate.error.createFailed', 'Failed to create secret')\n );\n void nativeNotify('error');\n }\n };\n\n return (\n <SecurityPermissionGuard permission=\"secret:create\">\n <PageLayout\n title={tx('security.secretCreate.title', 'Add New Secret')}\n description={tx(\n 'security.secretCreate.description',\n 'Store a new credential, API key, or sensitive text securely.'\n )}\n breadcrumbs={[\n { label: tx('security.common.breadcrumbs.security', 'Security'), path: basePath },\n {\n label: tx('security.common.breadcrumbs.vault', 'Vault'),\n path: `${basePath}/vaults/${vaultId}`,\n },\n { label: tx('security.secretCreate.breadcrumb', 'New Secret') },\n ]}\n actions={\n <Button\n variant=\"outline\"\n size=\"sm\"\n onClick={handleBack}\n aria-label={tx('security.secretCreate.actions.backToVault', 'Back to Vault')}\n >\n <ArrowLeft className=\"size-4\" />\n {tx('security.secretCreate.actions.backToVault', 'Back to Vault')}\n </Button>\n }\n >\n <div className=\"grid grid-cols-1 lg:grid-cols-3 gap-8\">\n <div className=\"lg:col-span-2\">\n <Card className=\"p-6 shadow-md border-border-subtle/60\">\n <SecretFormFields\n type={type}\n onTypeChange={setType}\n name={name}\n onNameChange={setName}\n value={value}\n onValueChange={setValue}\n description={description}\n onDescriptionChange={setDescription}\n labels={labels}\n onLabelsChange={setLabels}\n />\n\n {error && (\n <div className=\"mt-6 p-3 rounded-md bg-status-error-bg/10 text-status-error-text text-sm border border-status-error-border/20 flex items-start gap-2\">\n <AlertTriangle className=\"size-4 shrink-0 mt-0.5\" />\n {error}\n </div>\n )}\n\n <div className=\"flex justify-end gap-3 mt-8 pt-6 border-t border-border-subtle/60\">\n <Button\n variant=\"outline\"\n onClick={handleBack}\n disabled={creating}\n aria-label={tx('security.secretCreate.actions.cancel', 'Cancel')}\n >\n {tx('security.secretCreate.actions.cancel', 'Cancel')}\n </Button>\n <Button onClick={handleSave} disabled={creating || !name.trim() || !value.trim()}>\n {creating ? (\n <Loader2 className=\"size-4 animate-spin\" />\n ) : (\n <Save className=\"size-4\" />\n )}\n {creating\n ? tx('security.secretCreate.actions.creating', 'Creating...')\n : tx('security.secretCreate.actions.createSecret', 'Create Secret')}\n </Button>\n </div>\n </Card>\n </div>\n\n <div className=\"space-y-6\">\n <GlassCard treatment=\"insight\" className=\"p-6\">\n <h3 className=\"text-sm font-bold text-primary flex items-center gap-2 mb-3 uppercase tracking-wider\">\n <ShieldCheck className=\"size-4\" />\n {tx('security.secretCreate.secureStorage.title', 'Secure Storage')}\n </h3>\n <p className=\"text-xs text-text-secondary leading-relaxed\">\n {tx(\n 'security.secretCreate.secureStorage.description',\n 'Your secret will be encrypted using a vault-specific key derived from the master encryption system. Once saved, the plain-text value is never shown unless explicitly revealed by an authorized user.'\n )}\n </p>\n </GlassCard>\n\n <Card className=\"p-6\">\n <h3 className=\"text-sm font-bold text-text-primary flex items-center gap-2 mb-3\">\n <Info className=\"size-4 text-text-secondary\" />\n {tx('security.secretCreate.namingTips.title', 'Naming Tips')}\n </h3>\n <ShowMore collapsedHeight={64}>\n <ul className=\"text-xs text-text-secondary space-y-2 list-disc pl-4\">\n <li>\n {tx(\n 'security.secretCreate.namingTips.productionDb',\n 'Use descriptive names like Production Database URL'\n )}\n </li>\n <li>\n {tx(\n 'security.secretCreate.namingTips.autoKey',\n 'A unique key will be automatically generated from the name'\n )}\n </li>\n <li>\n {tx(\n 'security.secretCreate.namingTips.labels',\n 'You can add labels to group secrets by environment or project'\n )}\n </li>\n </ul>\n </ShowMore>\n </Card>\n </div>\n </div>\n </PageLayout>\n </SecurityPermissionGuard>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAuBA,SAAS,EAAc,GAA4B;AACjD,QACE,aAAe,UACd,mBAAmB,KAAO,kBAAkB,KAAO,kBAAkB;;AAI1E,SAAgB,IAAmB;CACjC,IAAM,EAAE,eAAY,GAAgC,EAC9C,EAAE,cAAW,KAAK,UAAU,MAAkB,GAAa,EAC3D,IAAiB,GAAa,EAC9B,EAAE,SAAM,GAAS,EACjB,KAAM,GAAa,GAAkB,MACzC,EAAsB,GAAG,GAAK,GAAU,EAAO,EAE3C,CAAC,GAAc,EAAE,SAAS,OAAc,GAAiB,EACzD,EAAE,YAAS,GAAyB,EAEpC,CAAC,GAAM,KAAW,EAAqB,aAAa,EACpD,CAAC,GAAM,KAAW,EAAS,GAAG,EAC9B,CAAC,GAAO,KAAY,EAAS,GAAG,EAChC,CAAC,GAAa,KAAkB,EAAS,GAAG,EAC5C,CAAC,GAAQ,KAAa,EAAmB,EAAE,CAAC,EAC5C,CAAC,GAAO,KAAY,EAAwB,KAAK,EAEjD,KAAkB,MAAiB;AACvC,EAAI,IACF,EAAc,EAAK,GAEnB,EAAe,EAAK;IAIlB,UAAmB;AACvB,I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C/D;UACL,kBAAC,KAAD;OAAG,WAAU;iBACV,EACC,mDACA,wMACD;OACC,CAAA,CACM;SAEZ,kBAAC,GAAD;MAAM,WAAU;gBAAhB,CACE,kBAAC,MAAD;OAAI,WAAU;iBAAd,CACE,kBAAC,GAAD,EAAM,WAAU,8BAA+B,CAAA,EAC9C,EAAG,0CAA0C,cAAc,CACzD;UACL,kBAAC,GAAD;OAAU,iBAAiB;iBACzB,kBAAC,MAAD;QAAI,WAAU;kBAAd;SACE,kBAAC,MAAD,EAAA,UACG,EACC,iDACA,qDACD,EACE,CAAA;SACL,kBAAC,MAAD,EAAA,UACG,EACC,4CACA,6DACD,EACE,CAAA;SACL,kBAAC,MAAD,EAAA,UACG,EACC,2CACA,gEACD,EACE,CAAA;SACF;;OACI,CAAA,CACN;QACH;OACF;;GACK,CAAA;EACW,CAAA"}
|
|
1
|
+
{"version":3,"file":"SecretCreatePage.js","names":[],"sources":["../../../src/security/pages/SecretCreatePage.tsx"],"sourcesContent":["import { useState } from 'react';\nimport { useParams, useNavigate } from 'react-router-dom';\nimport { Save, ArrowLeft, Loader2, ShieldCheck, Info, AlertTriangle, KeyRound } from 'lucide-react';\nimport { GlassCard, ShowMore, PagePurpose } from '@burdenoff/fe-libs/ui';\nimport { PageLayout } from '../components/PageLayout';\nimport { SecretFormFields } from '../components/SecretFormFields';\nimport { Button, Card } from '../components/ui';\nimport { useCreateSecret } from '../hooks/useSecretQueries';\nimport { useSecurityEventEmitter } from '../hooks/useSecurityEventEmitter';\nimport { useSecurity } from '../providers/SecurityProvider';\nimport { SecurityPermissionGuard } from '../components/SecurityPermissionGuard';\nimport { cn } from '../utils/cn';\nimport { useI18n } from '@burdenoff/fe-libs/shared/providers/shell/I18nProvider';\nimport { translateWithFallback } from '../utils/i18n';\nimport type { SecretType } from '../types';\nimport { nativeImpact, nativeNotify } from '../../utils/nativeBridge';\n\n/**\n * Detect Apollo-shaped errors structurally (works across Apollo v3 and v4).\n * Apollo errors carry `graphQLErrors`, `networkError`, or `clientErrors` —\n * those messages are already shaped for client display. Other thrown Errors\n * fall through to the generic translation to avoid leaking internal details.\n */\nfunction isApolloError(err: unknown): err is Error {\n return (\n err instanceof Error &&\n ('graphQLErrors' in err || 'networkError' in err || 'clientErrors' in err)\n );\n}\n\nexport function SecretCreatePage() {\n const { vaultId } = useParams<{ vaultId: string }>();\n const { basePath = '/', navigate: shellNavigate } = useSecurity();\n const routerNavigate = useNavigate();\n const { t } = useI18n();\n const tx = (key: string, fallback: string, params?: Record<string, string | number>) =>\n translateWithFallback(t, key, fallback, params);\n\n const [createSecret, { loading: creating }] = useCreateSecret();\n const { emit } = useSecurityEventEmitter();\n\n const [type, setType] = useState<SecretType>('CREDENTIAL');\n const [name, setName] = useState('');\n const [value, setValue] = useState('');\n const [description, setDescription] = useState('');\n const [labels, setLabels] = useState<string[]>([]);\n const [error, setError] = useState<string | null>(null);\n\n const handleNavigate = (path: string) => {\n if (shellNavigate) {\n shellNavigate(path);\n } else {\n routerNavigate(path);\n }\n };\n\n const handleBack = () => {\n handleNavigate(`${basePath}/vaults/${vaultId}`);\n };\n\n const handleSave = async () => {\n void nativeImpact('light');\n if (!name.trim()) {\n setError(tx('security.secretCreate.error.nameRequired', 'Name is required.'));\n return;\n }\n if (!value.trim()) {\n setError(tx('security.secretCreate.error.valueRequired', 'Value is required.'));\n return;\n }\n\n setError(null);\n\n try {\n const result = await createSecret({\n variables: {\n input: {\n vaultId: vaultId ?? '',\n name: name.trim(),\n key: name\n .trim()\n .toLowerCase()\n .replace(/\\s+/g, '_')\n .replace(/[^a-z0-9_]/g, ''),\n value: value.trim(),\n type,\n description: description.trim() || undefined,\n tags: labels.length > 0 ? labels : undefined,\n },\n },\n });\n // Apollo v4 exposes a single aggregated `error` on the mutation result.\n if (result.error) {\n setError(\n result.error.message ??\n tx('security.secretCreate.error.createFailed', 'Failed to create secret')\n );\n void nativeNotify('error');\n return;\n }\n\n if (result.data?.createSecret?.id) {\n emit('secret.created', { secretId: result.data.createSecret.id, vaultId });\n void nativeNotify('success');\n handleBack();\n return;\n }\n\n // No data and no errors — surface a generic failure rather than navigate away silently.\n setError(tx('security.secretCreate.error.createFailed', 'Failed to create secret'));\n void nativeNotify('error');\n } catch (err) {\n // Only surface raw error messages that come from Apollo — those are\n // already shaped for client consumption. Anything else falls back to\n // the generic translation to avoid leaking internal details into the UI.\n setError(\n isApolloError(err)\n ? err.message\n : tx('security.secretCreate.error.createFailed', 'Failed to create secret')\n );\n void nativeNotify('error');\n }\n };\n\n return (\n <SecurityPermissionGuard permission=\"secret:create\">\n <PageLayout\n title={tx('security.secretCreate.title', 'Add New Secret')}\n description={tx(\n 'security.secretCreate.description',\n 'Store a new credential, API key, or sensitive text securely.'\n )}\n breadcrumbs={[\n { label: tx('security.common.breadcrumbs.security', 'Security'), path: basePath },\n {\n label: tx('security.common.breadcrumbs.vault', 'Vault'),\n path: `${basePath}/vaults/${vaultId}`,\n },\n { label: tx('security.secretCreate.breadcrumb', 'New Secret') },\n ]}\n actions={\n <Button\n variant=\"outline\"\n size=\"sm\"\n onClick={handleBack}\n aria-label={tx('security.secretCreate.actions.backToVault', 'Back to Vault')}\n >\n <ArrowLeft className=\"size-4\" />\n {tx('security.secretCreate.actions.backToVault', 'Back to Vault')}\n </Button>\n }\n >\n <PagePurpose icon={<KeyRound className=\"size-4\" />} className=\"mb-6\">\n {tx(\n 'security.secretCreate.purpose',\n 'Store a single credential — an API key, password, token or any sensitive text — inside this vault. Pick the right type so it is displayed and handled correctly, give it a clear name, and paste the value. The value is encrypted immediately and is only ever shown again when an authorized user explicitly reveals it.'\n )}\n </PagePurpose>\n\n <div className=\"grid grid-cols-1 lg:grid-cols-3 gap-8\">\n <div className=\"lg:col-span-2\">\n {/* Single emphasis zone — the create form. */}\n <GlassCard treatment=\"glass\" glow className=\"p-6\">\n <SecretFormFields\n type={type}\n onTypeChange={setType}\n name={name}\n onNameChange={setName}\n value={value}\n onValueChange={setValue}\n description={description}\n onDescriptionChange={setDescription}\n labels={labels}\n onLabelsChange={setLabels}\n />\n\n {error && (\n <div className=\"mt-6 p-3 rounded-md bg-status-error-bg/10 text-status-error-text text-sm border border-status-error-border/20 flex items-start gap-2\">\n <AlertTriangle className=\"size-4 shrink-0 mt-0.5\" />\n {error}\n </div>\n )}\n\n <div className=\"flex justify-end gap-3 mt-8 pt-6 border-t border-border-subtle/60\">\n <Button\n variant=\"outline\"\n onClick={handleBack}\n disabled={creating}\n aria-label={tx('security.secretCreate.actions.cancel', 'Cancel')}\n >\n {tx('security.secretCreate.actions.cancel', 'Cancel')}\n </Button>\n <Button onClick={handleSave} disabled={creating || !name.trim() || !value.trim()}>\n {creating ? (\n <Loader2 className=\"size-4 animate-spin\" />\n ) : (\n <Save className=\"size-4\" />\n )}\n {creating\n ? tx('security.secretCreate.actions.creating', 'Creating...')\n : tx('security.secretCreate.actions.createSecret', 'Create Secret')}\n </Button>\n </div>\n </GlassCard>\n </div>\n\n <div className=\"space-y-6\">\n <GlassCard treatment=\"insight\" className=\"p-6\">\n <h3 className=\"text-sm font-bold text-primary flex items-center gap-2 mb-3 uppercase tracking-wider\">\n <ShieldCheck className=\"size-4\" />\n {tx('security.secretCreate.secureStorage.title', 'Secure Storage')}\n </h3>\n <p className=\"text-xs text-text-secondary leading-relaxed\">\n {tx(\n 'security.secretCreate.secureStorage.description',\n 'Your secret will be encrypted using a vault-specific key derived from the master encryption system. Once saved, the plain-text value is never shown unless explicitly revealed by an authorized user.'\n )}\n </p>\n </GlassCard>\n\n <Card className=\"p-6\">\n <h3 className=\"text-sm font-bold text-text-primary flex items-center gap-2 mb-3\">\n <Info className=\"size-4 text-text-secondary\" />\n {tx('security.secretCreate.namingTips.title', 'Naming Tips')}\n </h3>\n <ShowMore collapsedHeight={64}>\n <ul className=\"text-xs text-text-secondary space-y-2 list-disc pl-4\">\n <li>\n {tx(\n 'security.secretCreate.namingTips.productionDb',\n 'Use descriptive names like Production Database URL'\n )}\n </li>\n <li>\n {tx(\n 'security.secretCreate.namingTips.autoKey',\n 'A unique key will be automatically generated from the name'\n )}\n </li>\n <li>\n {tx(\n 'security.secretCreate.namingTips.labels',\n 'You can add labels to group secrets by environment or project'\n )}\n </li>\n </ul>\n </ShowMore>\n </Card>\n </div>\n </div>\n </PageLayout>\n </SecurityPermissionGuard>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAuBA,SAAS,EAAc,GAA4B;AACjD,QACE,aAAe,UACd,mBAAmB,KAAO,kBAAkB,KAAO,kBAAkB;;AAI1E,SAAgB,IAAmB;CACjC,IAAM,EAAE,eAAY,GAAgC,EAC9C,EAAE,cAAW,KAAK,UAAU,MAAkB,GAAa,EAC3D,IAAiB,GAAa,EAC9B,EAAE,SAAM,GAAS,EACjB,KAAM,GAAa,GAAkB,MACzC,EAAsB,GAAG,GAAK,GAAU,EAAO,EAE3C,CAAC,GAAc,EAAE,SAAS,OAAc,GAAiB,EACzD,EAAE,YAAS,GAAyB,EAEpC,CAAC,GAAM,KAAW,EAAqB,aAAa,EACpD,CAAC,GAAM,KAAW,EAAS,GAAG,EAC9B,CAAC,GAAO,KAAY,EAAS,GAAG,EAChC,CAAC,GAAa,KAAkB,EAAS,GAAG,EAC5C,CAAC,GAAQ,KAAa,EAAmB,EAAE,CAAC,EAC5C,CAAC,GAAO,KAAY,EAAwB,KAAK,EAEjD,KAAkB,MAAiB;AACvC,EAAI,IACF,EAAc,EAAK,GAEnB,EAAe,EAAK;IAIlB,UAAmB;AACvB,IAAe,GAAG,EAAS,UAAU,IAAU;;AAmEjD,QACE,kBAAC,GAAD;EAAyB,YAAW;YAClC,kBAAC,GAAD;GACE,OAAO,EAAG,+BAA+B,iBAAiB;GAC1D,aAAa,EACX,qCACA,+DACD;GACD,aAAa;IACX;KAAE,OAAO,EAAG,wCAAwC,WAAW;KAAE,MAAM;KAAU;IACjF;KACE,OAAO,EAAG,qCAAqC,QAAQ;KACvD,MAAM,GAAG,EAAS,UAAU;KAC7B;IACD,EAAE,OAAO,EAAG,oCAAoC,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