@burdenoff/microfe-security 2026.624.1 → 2026.625.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/ConfirmDialog.js +28 -37
- package/dist/security/components/ConfirmDialog.js.map +1 -1
- package/dist/security/components/ImportWizard.js +81 -88
- package/dist/security/components/ImportWizard.js.map +1 -1
- package/dist/security/components/SecretShareDialog.js +75 -86
- package/dist/security/components/SecretShareDialog.js.map +1 -1
- package/dist/security/components/SecurityScoreCard.js +21 -20
- package/dist/security/components/SecurityScoreCard.js.map +1 -1
- package/dist/security/components/VaultShareDialog.js +26 -40
- package/dist/security/components/VaultShareDialog.js.map +1 -1
- package/dist/security/components/ui.js +2 -2
- package/dist/security/components/ui.js.map +1 -1
- package/dist/security/pages/AccessReviewPage.js +52 -67
- package/dist/security/pages/AccessReviewPage.js.map +1 -1
- package/dist/security/pages/ProviderDetailPage.js +122 -142
- package/dist/security/pages/ProviderDetailPage.js.map +1 -1
- package/dist/security/pages/ProvidersPage.js +118 -113
- package/dist/security/pages/ProvidersPage.js.map +1 -1
- package/dist/security/pages/SecretCreatePage.js +73 -68
- package/dist/security/pages/SecretCreatePage.js.map +1 -1
- package/dist/security/pages/SecretDetailPage.js +240 -253
- package/dist/security/pages/SecretDetailPage.js.map +1 -1
- package/dist/security/pages/SecurityDashboardPage.js +89 -85
- package/dist/security/pages/SecurityDashboardPage.js.map +1 -1
- package/dist/security/pages/VaultDetailPage.js +137 -183
- package/dist/security/pages/VaultDetailPage.js.map +1 -1
- package/dist/security/pages/VaultShareViewer.js +61 -59
- package/dist/security/pages/VaultShareViewer.js.map +1 -1
- package/dist/security/pages/VaultsDashboardPage.js +66 -64
- package/dist/security/pages/VaultsDashboardPage.js.map +1 -1
- package/package.json +2 -2
|
@@ -8,17 +8,18 @@ import { useState as u } from "react";
|
|
|
8
8
|
import { useNavigate as d } from "react-router-dom";
|
|
9
9
|
import { jsx as f, jsxs as p } from "react/jsx-runtime";
|
|
10
10
|
import { AlertTriangle as m, CheckCircle as h, Clock as g, Cloud as _, Loader2 as v, Lock as y, RefreshCw as b, XCircle as x } from "lucide-react";
|
|
11
|
+
import { GlassCard as S } from "@burdenoff/fe-libs/ui";
|
|
11
12
|
//#region src/security/pages/ProvidersPage.tsx
|
|
12
|
-
function
|
|
13
|
-
let { basePath:
|
|
14
|
-
|
|
15
|
-
},
|
|
13
|
+
function C() {
|
|
14
|
+
let { basePath: C = "/", navigate: w } = e(), T = d(), [E, D] = u(""), { data: O, loading: k } = s(void 0, { limit: 100 }), A = O?.getVaults?.items ?? [], { data: j, loading: M, error: N, refetch: P } = c(E || void 0), F = j?.getVaultIntegrations?.items ?? [], I = (e) => {
|
|
15
|
+
w ? w(e) : T(e);
|
|
16
|
+
}, L = [{
|
|
16
17
|
value: "",
|
|
17
18
|
label: "Select a vault..."
|
|
18
|
-
}, ...
|
|
19
|
+
}, ...A.map((e) => ({
|
|
19
20
|
value: e.id,
|
|
20
21
|
label: e.name
|
|
21
|
-
}))],
|
|
22
|
+
}))], R = {
|
|
22
23
|
connected: {
|
|
23
24
|
label: "Connected",
|
|
24
25
|
variant: "success",
|
|
@@ -40,123 +41,127 @@ function S() {
|
|
|
40
41
|
icon: b
|
|
41
42
|
}
|
|
42
43
|
};
|
|
43
|
-
return /* @__PURE__ */
|
|
44
|
+
return /* @__PURE__ */ f(t, {
|
|
44
45
|
title: "Providers",
|
|
45
46
|
description: "Connect external secret management providers.",
|
|
46
47
|
breadcrumbs: [{
|
|
47
48
|
label: "Security",
|
|
48
|
-
path:
|
|
49
|
+
path: C
|
|
49
50
|
}, { label: "Providers" }],
|
|
50
|
-
children:
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
51
|
+
children: /* @__PURE__ */ p("div", {
|
|
52
|
+
className: "space-y-6",
|
|
53
|
+
children: [
|
|
54
|
+
/* @__PURE__ */ f(S, {
|
|
55
|
+
treatment: "insight",
|
|
56
|
+
className: "p-4",
|
|
57
|
+
children: /* @__PURE__ */ f("p", {
|
|
58
|
+
className: "text-sm text-text-secondary",
|
|
59
|
+
children: "Provider sync infrastructure is available, but guided provider onboarding is still being finalized. Existing connections can be reviewed here."
|
|
60
|
+
})
|
|
61
|
+
}),
|
|
62
|
+
/* @__PURE__ */ f("div", {
|
|
63
|
+
className: "max-w-sm",
|
|
64
|
+
children: /* @__PURE__ */ f(o, {
|
|
65
|
+
label: "Vault",
|
|
66
|
+
value: E,
|
|
67
|
+
onChange: D,
|
|
68
|
+
options: L
|
|
69
|
+
})
|
|
70
|
+
}),
|
|
71
|
+
!E && !k && /* @__PURE__ */ p(i, {
|
|
72
|
+
className: "p-8 text-center",
|
|
73
|
+
children: [/* @__PURE__ */ f(y, { className: "size-10 text-text-secondary mx-auto mb-3" }), /* @__PURE__ */ f("p", {
|
|
74
|
+
className: "text-sm text-text-secondary",
|
|
75
|
+
children: "Select a vault to view its provider integrations."
|
|
76
|
+
})]
|
|
77
|
+
}),
|
|
78
|
+
k && /* @__PURE__ */ f("div", {
|
|
79
|
+
className: "flex items-center justify-center py-16",
|
|
80
|
+
children: /* @__PURE__ */ f(v, { className: "size-8 animate-spin text-primary" })
|
|
81
|
+
}),
|
|
82
|
+
E && M && /* @__PURE__ */ f("div", {
|
|
83
|
+
className: "flex items-center justify-center py-16",
|
|
84
|
+
children: /* @__PURE__ */ f(v, { className: "size-8 animate-spin text-primary" })
|
|
85
|
+
}),
|
|
86
|
+
E && N && /* @__PURE__ */ f(i, {
|
|
87
|
+
className: "p-6",
|
|
88
|
+
children: /* @__PURE__ */ p("div", {
|
|
89
|
+
className: "flex items-start gap-4",
|
|
90
|
+
children: [/* @__PURE__ */ f(m, { className: "size-6 text-status-error-text" }), /* @__PURE__ */ p("div", { children: [
|
|
91
|
+
/* @__PURE__ */ f("h3", {
|
|
92
|
+
className: "font-semibold text-status-error-text",
|
|
93
|
+
children: "Failed to load providers"
|
|
94
|
+
}),
|
|
95
|
+
/* @__PURE__ */ f("p", {
|
|
96
|
+
className: "text-sm text-text-secondary mt-1",
|
|
97
|
+
children: N.message
|
|
98
|
+
}),
|
|
99
|
+
/* @__PURE__ */ p(r, {
|
|
100
|
+
variant: "outline",
|
|
101
|
+
size: "sm",
|
|
102
|
+
className: "mt-3",
|
|
103
|
+
onClick: () => P(),
|
|
104
|
+
children: [/* @__PURE__ */ f(b, { className: "size-4" }), "Retry"]
|
|
105
|
+
})
|
|
106
|
+
] })]
|
|
107
|
+
})
|
|
108
|
+
}),
|
|
109
|
+
E && !M && !N && F.length > 0 && /* @__PURE__ */ f("div", {
|
|
110
|
+
className: "grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4",
|
|
111
|
+
children: F.map((e) => {
|
|
112
|
+
let t = l(e.providerType), r = R[e.status ?? "disconnected"] ?? R.disconnected, a = r.icon;
|
|
113
|
+
return /* @__PURE__ */ p(i, {
|
|
114
|
+
onClick: () => I(`${C}/providers/${E}/${e.id}`),
|
|
115
|
+
className: "p-5",
|
|
114
116
|
children: [/* @__PURE__ */ p("div", {
|
|
115
|
-
className: "flex items-
|
|
116
|
-
children: [/* @__PURE__ */
|
|
117
|
-
className: "
|
|
118
|
-
children: /* @__PURE__ */ f(
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
children:
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
className: "
|
|
135
|
-
children: [
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
117
|
+
className: "flex items-start justify-between mb-3",
|
|
118
|
+
children: [/* @__PURE__ */ p("div", {
|
|
119
|
+
className: "flex items-center gap-3",
|
|
120
|
+
children: [/* @__PURE__ */ f("div", {
|
|
121
|
+
className: "p-2 rounded-lg bg-action-primary-bg/10",
|
|
122
|
+
children: /* @__PURE__ */ f(_, { className: "size-5 text-primary" })
|
|
123
|
+
}), /* @__PURE__ */ p("div", { children: [/* @__PURE__ */ f("h3", {
|
|
124
|
+
className: "font-bold text-text-primary",
|
|
125
|
+
children: e.displayName || t.label
|
|
126
|
+
}), /* @__PURE__ */ f("p", {
|
|
127
|
+
className: "text-xs text-text-secondary",
|
|
128
|
+
children: t.label
|
|
129
|
+
})] })]
|
|
130
|
+
}), /* @__PURE__ */ p(n, {
|
|
131
|
+
variant: r.variant,
|
|
132
|
+
className: "text-[10px] uppercase font-bold",
|
|
133
|
+
children: [/* @__PURE__ */ f(a, { className: "size-3" }), r.label]
|
|
134
|
+
})]
|
|
135
|
+
}), /* @__PURE__ */ p("div", {
|
|
136
|
+
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__ */ p("span", {
|
|
138
|
+
className: "bg-bg-sunken px-1.5 py-0.5 rounded",
|
|
139
|
+
children: [
|
|
140
|
+
"Sync: ",
|
|
141
|
+
e.syncIntervalMinutes,
|
|
142
|
+
"m"
|
|
143
|
+
]
|
|
144
|
+
}) : null, e.lastSyncAt ? /* @__PURE__ */ p("span", {
|
|
145
|
+
className: "flex items-center gap-1",
|
|
146
|
+
children: [/* @__PURE__ */ f(g, { className: "size-3" }), new Date(e.lastSyncAt).toLocaleDateString()]
|
|
147
|
+
}) : /* @__PURE__ */ f("span", {
|
|
148
|
+
className: "italic opacity-60",
|
|
149
|
+
children: "Never synced"
|
|
150
|
+
})]
|
|
146
151
|
})]
|
|
147
|
-
})
|
|
148
|
-
}
|
|
152
|
+
}, e.id);
|
|
153
|
+
})
|
|
154
|
+
}),
|
|
155
|
+
E && !M && !N && F.length === 0 && /* @__PURE__ */ f(a, {
|
|
156
|
+
icon: /* @__PURE__ */ f(_, { className: "size-12" }),
|
|
157
|
+
title: "No providers connected",
|
|
158
|
+
description: "Provider onboarding is being finalized. Existing connections will appear here when configured."
|
|
149
159
|
})
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
icon: /* @__PURE__ */ f(_, { className: "size-12" }),
|
|
153
|
-
title: "No providers connected",
|
|
154
|
-
description: "Provider onboarding is being finalized. Existing connections will appear here when configured."
|
|
155
|
-
})
|
|
156
|
-
]
|
|
160
|
+
]
|
|
161
|
+
})
|
|
157
162
|
});
|
|
158
163
|
}
|
|
159
164
|
//#endregion
|
|
160
|
-
export {
|
|
165
|
+
export { C as ProvidersPage };
|
|
161
166
|
|
|
162
167
|
//# sourceMappingURL=ProvidersPage.js.map
|
|
@@ -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 { 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 <Card className=\"p-4 bg-bg-sunken/20 border-border-subtle/50\">\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 </Card>\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 finalized. Existing connections will appear here when configured.\"\n />\n )}\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,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AAS,WAAW,CAAC,oBAAoB,CAC9C;YAEP,kBAAC,QAAD;QAAM,WAAU;kBAAoB;QAAmB,CAAA,CAErD;SACD;QAvCA,EAAS,GAuCT;MAET;IACE,CAAA;GAGP,KAAmB,CAAC,KAAW,CAAC,KAAS,EAAU,WAAW,KAC7D,kBAAC,GAAD;IACE,MAAM,kBAAC,GAAD,EAAO,WAAU,WAAY,CAAA;IACnC,OAAM;IACN,aAAY;IACZ,CAAA;GAEO"}
|
|
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 finalized. Existing connections will appear here when configured.\"\n />\n )}\n </div>\n </PageLayout>\n );\n}\n"],"mappings":";;;;;;;;;;;;AAqBA,SAAgB,IAAgB;CAC9B,IAAM,EAAE,cAAW,KAAK,UAAU,MAAk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,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"}
|
|
@@ -11,39 +11,40 @@ 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
13
|
import { AlertTriangle as g, ArrowLeft as _, Info as v, Loader2 as y, Save as b, ShieldCheck as x } from "lucide-react";
|
|
14
|
-
import {
|
|
14
|
+
import { GlassCard as S, ShowMore as C } from "@burdenoff/fe-libs/ui";
|
|
15
|
+
import { useI18n as w } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
|
|
15
16
|
//#region src/security/pages/SecretCreatePage.tsx
|
|
16
|
-
function
|
|
17
|
+
function T(e) {
|
|
17
18
|
return e instanceof Error && ("graphQLErrors" in e || "networkError" in e || "clientErrors" in e);
|
|
18
19
|
}
|
|
19
|
-
function
|
|
20
|
-
let { vaultId:
|
|
21
|
-
|
|
22
|
-
},
|
|
23
|
-
|
|
20
|
+
function E() {
|
|
21
|
+
let { vaultId: E } = p(), { basePath: D = "/", navigate: O } = e(), k = f(), { t: A } = w(), j = (e, t, n) => i(A, e, t, n), [M, { loading: N }] = o(), { emit: P } = a(), [F, I] = d("CREDENTIAL"), [L, R] = d(""), [z, B] = d(""), [V, H] = d(""), [U, W] = d([]), [G, K] = d(null), q = (e) => {
|
|
22
|
+
O ? O(e) : k(e);
|
|
23
|
+
}, J = () => {
|
|
24
|
+
q(`${D}/vaults/${E}`);
|
|
24
25
|
};
|
|
25
26
|
return /* @__PURE__ */ m(u, {
|
|
26
27
|
permission: "secret:create",
|
|
27
28
|
children: /* @__PURE__ */ m(t, {
|
|
28
|
-
title:
|
|
29
|
-
description:
|
|
29
|
+
title: j("security.secretCreate.title", "Add New Secret"),
|
|
30
|
+
description: j("security.secretCreate.description", "Store a new credential, API key, or sensitive text securely."),
|
|
30
31
|
breadcrumbs: [
|
|
31
32
|
{
|
|
32
|
-
label:
|
|
33
|
-
path:
|
|
33
|
+
label: j("security.common.breadcrumbs.security", "Security"),
|
|
34
|
+
path: D
|
|
34
35
|
},
|
|
35
36
|
{
|
|
36
|
-
label:
|
|
37
|
-
path: `${
|
|
37
|
+
label: j("security.common.breadcrumbs.vault", "Vault"),
|
|
38
|
+
path: `${D}/vaults/${E}`
|
|
38
39
|
},
|
|
39
|
-
{ label:
|
|
40
|
+
{ label: j("security.secretCreate.breadcrumb", "New Secret") }
|
|
40
41
|
],
|
|
41
42
|
actions: /* @__PURE__ */ h(n, {
|
|
42
43
|
variant: "outline",
|
|
43
44
|
size: "sm",
|
|
44
|
-
onClick:
|
|
45
|
-
"aria-label":
|
|
46
|
-
children: [/* @__PURE__ */ m(_, { className: "size-4" }),
|
|
45
|
+
onClick: J,
|
|
46
|
+
"aria-label": j("security.secretCreate.actions.backToVault", "Back to Vault"),
|
|
47
|
+
children: [/* @__PURE__ */ m(_, { className: "size-4" }), j("security.secretCreate.actions.backToVault", "Back to Vault")]
|
|
47
48
|
}),
|
|
48
49
|
children: /* @__PURE__ */ h("div", {
|
|
49
50
|
className: "grid grid-cols-1 lg:grid-cols-3 gap-8",
|
|
@@ -53,95 +54,99 @@ function w() {
|
|
|
53
54
|
className: "p-6 shadow-md border-border-subtle/60",
|
|
54
55
|
children: [
|
|
55
56
|
/* @__PURE__ */ m(l, {
|
|
56
|
-
type:
|
|
57
|
-
onTypeChange:
|
|
58
|
-
name:
|
|
59
|
-
onNameChange:
|
|
60
|
-
value:
|
|
61
|
-
onValueChange:
|
|
62
|
-
description:
|
|
63
|
-
onDescriptionChange:
|
|
64
|
-
labels:
|
|
65
|
-
onLabelsChange:
|
|
57
|
+
type: F,
|
|
58
|
+
onTypeChange: I,
|
|
59
|
+
name: L,
|
|
60
|
+
onNameChange: R,
|
|
61
|
+
value: z,
|
|
62
|
+
onValueChange: B,
|
|
63
|
+
description: V,
|
|
64
|
+
onDescriptionChange: H,
|
|
65
|
+
labels: U,
|
|
66
|
+
onLabelsChange: W
|
|
66
67
|
}),
|
|
67
|
-
|
|
68
|
+
G && /* @__PURE__ */ h("div", {
|
|
68
69
|
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",
|
|
69
|
-
children: [/* @__PURE__ */ m(g, { className: "size-4 shrink-0 mt-0.5" }),
|
|
70
|
+
children: [/* @__PURE__ */ m(g, { className: "size-4 shrink-0 mt-0.5" }), G]
|
|
70
71
|
}),
|
|
71
72
|
/* @__PURE__ */ h("div", {
|
|
72
73
|
className: "flex justify-end gap-3 mt-8 pt-6 border-t border-border-subtle/60",
|
|
73
74
|
children: [/* @__PURE__ */ m(n, {
|
|
74
75
|
variant: "outline",
|
|
75
|
-
onClick:
|
|
76
|
-
disabled:
|
|
77
|
-
"aria-label":
|
|
78
|
-
children:
|
|
76
|
+
onClick: J,
|
|
77
|
+
disabled: N,
|
|
78
|
+
"aria-label": j("security.secretCreate.actions.cancel", "Cancel"),
|
|
79
|
+
children: j("security.secretCreate.actions.cancel", "Cancel")
|
|
79
80
|
}), /* @__PURE__ */ h(n, {
|
|
80
81
|
onClick: async () => {
|
|
81
|
-
if (s("light"), !
|
|
82
|
-
|
|
82
|
+
if (s("light"), !L.trim()) {
|
|
83
|
+
K(j("security.secretCreate.error.nameRequired", "Name is required."));
|
|
83
84
|
return;
|
|
84
85
|
}
|
|
85
|
-
if (!
|
|
86
|
-
|
|
86
|
+
if (!z.trim()) {
|
|
87
|
+
K(j("security.secretCreate.error.valueRequired", "Value is required."));
|
|
87
88
|
return;
|
|
88
89
|
}
|
|
89
|
-
|
|
90
|
+
K(null);
|
|
90
91
|
try {
|
|
91
|
-
let e = await
|
|
92
|
-
vaultId:
|
|
93
|
-
name:
|
|
94
|
-
key:
|
|
95
|
-
value:
|
|
96
|
-
type:
|
|
97
|
-
description:
|
|
98
|
-
tags:
|
|
92
|
+
let e = await M({ variables: { input: {
|
|
93
|
+
vaultId: E ?? "",
|
|
94
|
+
name: L.trim(),
|
|
95
|
+
key: L.trim().toLowerCase().replace(/\s+/g, "_").replace(/[^a-z0-9_]/g, ""),
|
|
96
|
+
value: z.trim(),
|
|
97
|
+
type: F,
|
|
98
|
+
description: V.trim() || void 0,
|
|
99
|
+
tags: U.length > 0 ? U : void 0
|
|
99
100
|
} } });
|
|
100
101
|
if (e.error) {
|
|
101
|
-
|
|
102
|
+
K(e.error.message ?? j("security.secretCreate.error.createFailed", "Failed to create secret")), c("error");
|
|
102
103
|
return;
|
|
103
104
|
}
|
|
104
105
|
if (e.data?.createSecret?.id) {
|
|
105
|
-
|
|
106
|
+
P("secret.created", {
|
|
106
107
|
secretId: e.data.createSecret.id,
|
|
107
|
-
vaultId:
|
|
108
|
-
}), c("success"),
|
|
108
|
+
vaultId: E
|
|
109
|
+
}), c("success"), J();
|
|
109
110
|
return;
|
|
110
111
|
}
|
|
111
|
-
|
|
112
|
+
K(j("security.secretCreate.error.createFailed", "Failed to create secret")), c("error");
|
|
112
113
|
} catch (e) {
|
|
113
|
-
|
|
114
|
+
K(T(e) ? e.message : j("security.secretCreate.error.createFailed", "Failed to create secret")), c("error");
|
|
114
115
|
}
|
|
115
116
|
},
|
|
116
|
-
disabled:
|
|
117
|
-
children: [
|
|
117
|
+
disabled: N || !L.trim() || !z.trim(),
|
|
118
|
+
children: [N ? /* @__PURE__ */ m(y, { className: "size-4 animate-spin" }) : /* @__PURE__ */ m(b, { className: "size-4" }), N ? j("security.secretCreate.actions.creating", "Creating...") : j("security.secretCreate.actions.createSecret", "Create Secret")]
|
|
118
119
|
})]
|
|
119
120
|
})
|
|
120
121
|
]
|
|
121
122
|
})
|
|
122
123
|
}), /* @__PURE__ */ h("div", {
|
|
123
124
|
className: "space-y-6",
|
|
124
|
-
children: [/* @__PURE__ */ h(
|
|
125
|
-
|
|
125
|
+
children: [/* @__PURE__ */ h(S, {
|
|
126
|
+
treatment: "insight",
|
|
127
|
+
className: "p-6",
|
|
126
128
|
children: [/* @__PURE__ */ h("h3", {
|
|
127
129
|
className: "text-sm font-bold text-primary flex items-center gap-2 mb-3 uppercase tracking-wider",
|
|
128
|
-
children: [/* @__PURE__ */ m(x, { className: "size-4" }),
|
|
130
|
+
children: [/* @__PURE__ */ m(x, { className: "size-4" }), j("security.secretCreate.secureStorage.title", "Secure Storage")]
|
|
129
131
|
}), /* @__PURE__ */ m("p", {
|
|
130
132
|
className: "text-xs text-text-secondary leading-relaxed",
|
|
131
|
-
children:
|
|
133
|
+
children: j("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.")
|
|
132
134
|
})]
|
|
133
135
|
}), /* @__PURE__ */ h(r, {
|
|
134
|
-
className: "p-6
|
|
136
|
+
className: "p-6",
|
|
135
137
|
children: [/* @__PURE__ */ h("h3", {
|
|
136
138
|
className: "text-sm font-bold text-text-primary flex items-center gap-2 mb-3",
|
|
137
|
-
children: [/* @__PURE__ */ m(v, { className: "size-4 text-text-secondary" }),
|
|
138
|
-
}), /* @__PURE__ */
|
|
139
|
-
|
|
140
|
-
children:
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
139
|
+
children: [/* @__PURE__ */ m(v, { className: "size-4 text-text-secondary" }), j("security.secretCreate.namingTips.title", "Naming Tips")]
|
|
140
|
+
}), /* @__PURE__ */ m(C, {
|
|
141
|
+
collapsedHeight: 64,
|
|
142
|
+
children: /* @__PURE__ */ h("ul", {
|
|
143
|
+
className: "text-xs text-text-secondary space-y-2 list-disc pl-4",
|
|
144
|
+
children: [
|
|
145
|
+
/* @__PURE__ */ m("li", { children: j("security.secretCreate.namingTips.productionDb", "Use descriptive names like Production Database URL") }),
|
|
146
|
+
/* @__PURE__ */ m("li", { children: j("security.secretCreate.namingTips.autoKey", "A unique key will be automatically generated from the name") }),
|
|
147
|
+
/* @__PURE__ */ m("li", { children: j("security.secretCreate.namingTips.labels", "You can add labels to group secrets by environment or project") })
|
|
148
|
+
]
|
|
149
|
+
})
|
|
145
150
|
})]
|
|
146
151
|
})]
|
|
147
152
|
})]
|
|
@@ -150,6 +155,6 @@ function w() {
|
|
|
150
155
|
});
|
|
151
156
|
}
|
|
152
157
|
//#endregion
|
|
153
|
-
export {
|
|
158
|
+
export { E as SecretCreatePage };
|
|
154
159
|
|
|
155
160
|
//# 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 { 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 <Card className=\"p-6 bg-action-primary-bg/5 border-primary/10 shadow-sm\">\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 </Card>\n\n <Card className=\"p-6 border-border-subtle/60 shadow-sm\">\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 <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 </Card>\n </div>\n </div>\n </PageLayout>\n </SecurityPermissionGuard>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;AAsBA,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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,8BAA+B,CAAA,EAC9C,EAAG,0CAA0C,cAAc,CACzD;UACL,kBAAC,MAAD;OAAI,WAAU;iBAAd;QACE,kBAAC,MAAD,EAAA,UACG,EACC,iDACA,qDACD,EACE,CAAA;QACL,kBAAC,MAAD,EAAA,UACG,EACC,4CACA,6DACD,EACE,CAAA;QACL,kBAAC,MAAD,EAAA,UACG,EACC,2CACA,gEACD,EACE,CAAA;QACF;SACA;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 } 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,E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