@burdenoff/microfe-security 2026.1113.1 → 2026.1113.2
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/ActivityTimeline.js +42 -41
- package/dist/security/components/ActivityTimeline.js.map +1 -1
- package/dist/security/components/BulkActionBar.d.ts +2 -0
- package/dist/security/components/BulkActionBar.js +93 -81
- package/dist/security/components/BulkActionBar.js.map +1 -1
- package/dist/security/components/BulkPickerDialogs.d.ts +30 -0
- package/dist/security/components/BulkPickerDialogs.js +136 -0
- package/dist/security/components/BulkPickerDialogs.js.map +1 -0
- package/dist/security/components/SavedValuesMoreMenu.d.ts +12 -0
- package/dist/security/components/SavedValuesMoreMenu.js +63 -0
- package/dist/security/components/SavedValuesMoreMenu.js.map +1 -0
- package/dist/security/components/SecretFormFields.js +162 -114
- package/dist/security/components/SecretFormFields.js.map +1 -1
- package/dist/security/components/SecretRow.d.ts +2 -0
- package/dist/security/components/SecretRow.js +41 -40
- package/dist/security/components/SecretRow.js.map +1 -1
- package/dist/security/components/SecretShareDialog.js +1 -1
- package/dist/security/components/SecretShareDialog.js.map +1 -1
- package/dist/security/components/VaultFormFields.js +100 -55
- package/dist/security/components/VaultFormFields.js.map +1 -1
- package/dist/security/components/ui.d.ts +1 -0
- package/dist/security/components/ui.js +2 -1
- package/dist/security/components/ui.js.map +1 -1
- package/dist/security/hooks/useActorLabel.d.ts +9 -0
- package/dist/security/hooks/useActorLabel.js +18 -0
- package/dist/security/hooks/useActorLabel.js.map +1 -0
- package/dist/security/hooks/useDebouncedValue.d.ts +2 -0
- package/dist/security/hooks/useDebouncedValue.js +12 -0
- package/dist/security/hooks/useDebouncedValue.js.map +1 -0
- package/dist/security/hooks/useSecurityVariant.d.ts +7 -0
- package/dist/security/hooks/useSecurityVariant.js +9 -0
- package/dist/security/hooks/useSecurityVariant.js.map +1 -0
- package/dist/security/index.d.ts +1 -1
- package/dist/security/pages/AccessReviewPage.js +77 -76
- package/dist/security/pages/AccessReviewPage.js.map +1 -1
- package/dist/security/pages/AuditLogPage.js +58 -44
- package/dist/security/pages/AuditLogPage.js.map +1 -1
- package/dist/security/pages/ImportExportPage.js +1 -1
- package/dist/security/pages/ImportExportPage.js.map +1 -1
- package/dist/security/pages/SecretCreatePage.js +85 -85
- package/dist/security/pages/SecretCreatePage.js.map +1 -1
- package/dist/security/pages/SecretDetailPage.js +339 -273
- package/dist/security/pages/SecretDetailPage.js.map +1 -1
- package/dist/security/pages/VaultCreatePage.js +59 -56
- package/dist/security/pages/VaultCreatePage.js.map +1 -1
- package/dist/security/pages/VaultDetailPage.js +218 -162
- package/dist/security/pages/VaultDetailPage.js.map +1 -1
- package/dist/security/pages/VaultLandingPage.js +48 -35
- package/dist/security/pages/VaultLandingPage.js.map +1 -1
- package/dist/security/pages/VaultSettingsPage.js +331 -266
- package/dist/security/pages/VaultSettingsPage.js.map +1 -1
- package/dist/security/pages/VaultsDashboardPage.js +231 -161
- package/dist/security/pages/VaultsDashboardPage.js.map +1 -1
- package/dist/security/providers/SecurityProvider.js +24 -20
- package/dist/security/providers/SecurityProvider.js.map +1 -1
- package/dist/security/providers/securityContext.d.ts +3 -0
- package/dist/security/providers/securityContext.js +6 -0
- package/dist/security/providers/securityContext.js.map +1 -0
- package/dist/security/routes/SecurityAdminRoutes.js +3 -3
- package/dist/security/routes/SecurityAdminRoutes.js.map +1 -1
- package/dist/security/routes/SecurityRoutes.js +3 -3
- package/dist/security/routes/SecurityRoutes.js.map +1 -1
- package/dist/security/routes/SecurityUserRoutes.js +1 -1
- package/dist/security/routes/SecurityUserRoutes.js.map +1 -1
- package/dist/security/translations/en.d.ts +57 -0
- package/dist/security/translations/en.js +69 -10
- package/dist/security/translations/en.js.map +1 -1
- package/dist/security/types/index.d.ts +13 -0
- package/dist/security/utils/formInputs.d.ts +49 -0
- package/dist/security/utils/formInputs.js +27 -0
- package/dist/security/utils/formInputs.js.map +1 -0
- package/dist/security/utils/landingTabs.d.ts +9 -0
- package/dist/security/utils/landingTabs.js +16 -0
- package/dist/security/utils/landingTabs.js.map +1 -0
- package/dist/security/utils/rotationStatus.d.ts +12 -0
- package/dist/security/utils/rotationStatus.js +8 -0
- package/dist/security/utils/rotationStatus.js.map +1 -0
- package/package.json +2 -2
|
@@ -1,63 +1,64 @@
|
|
|
1
1
|
import { cn as e } from "../utils/cn.js";
|
|
2
2
|
import { useTr as t } from "../hooks/useTr.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { useActorLabel as n } from "../hooks/useActorLabel.js";
|
|
4
|
+
import { jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
5
|
+
import { Activity as a, Edit2 as o, Eye as s, Lock as c, Plus as l, RefreshCw as u, Trash2 as d, Unlock as f, UserMinus as p, UserPlus as m } from "lucide-react";
|
|
5
6
|
// src/security/components/ActivityTimeline.tsx
|
|
6
|
-
var
|
|
7
|
+
var h = {
|
|
7
8
|
"vault.created": {
|
|
8
|
-
icon:
|
|
9
|
+
icon: l,
|
|
9
10
|
color: "text-status-success-text bg-status-success-bg-subtle"
|
|
10
11
|
},
|
|
11
12
|
"vault.updated": {
|
|
12
|
-
icon:
|
|
13
|
+
icon: o,
|
|
13
14
|
color: "text-status-info-text bg-status-info-bg-subtle"
|
|
14
15
|
},
|
|
15
16
|
"vault.deleted": {
|
|
16
|
-
icon:
|
|
17
|
+
icon: d,
|
|
17
18
|
color: "text-status-error-text bg-status-error-bg-subtle"
|
|
18
19
|
},
|
|
19
20
|
"vault.locked": {
|
|
20
|
-
icon:
|
|
21
|
+
icon: c,
|
|
21
22
|
color: "text-status-warning-text bg-status-warning-bg-subtle"
|
|
22
23
|
},
|
|
23
24
|
"vault.unlocked": {
|
|
24
|
-
icon:
|
|
25
|
+
icon: f,
|
|
25
26
|
color: "text-status-success-text bg-status-success-bg-subtle"
|
|
26
27
|
},
|
|
27
28
|
"secret.created": {
|
|
28
|
-
icon:
|
|
29
|
+
icon: l,
|
|
29
30
|
color: "text-status-success-text bg-status-success-bg-subtle"
|
|
30
31
|
},
|
|
31
32
|
"secret.updated": {
|
|
32
|
-
icon:
|
|
33
|
+
icon: o,
|
|
33
34
|
color: "text-status-info-text bg-status-info-bg-subtle"
|
|
34
35
|
},
|
|
35
36
|
"secret.deleted": {
|
|
36
|
-
icon:
|
|
37
|
+
icon: d,
|
|
37
38
|
color: "text-status-error-text bg-status-error-bg-subtle"
|
|
38
39
|
},
|
|
39
40
|
"secret.accessed": {
|
|
40
|
-
icon:
|
|
41
|
+
icon: s,
|
|
41
42
|
color: "text-accent-purple bg-accent-purple-subtle"
|
|
42
43
|
},
|
|
43
44
|
"secret.rotated": {
|
|
44
|
-
icon:
|
|
45
|
+
icon: u,
|
|
45
46
|
color: "text-accent-cyan bg-accent-cyan-subtle"
|
|
46
47
|
},
|
|
47
48
|
"member.added": {
|
|
48
|
-
icon:
|
|
49
|
+
icon: m,
|
|
49
50
|
color: "text-status-success-text bg-status-success-bg-subtle"
|
|
50
51
|
},
|
|
51
52
|
"member.removed": {
|
|
52
|
-
icon:
|
|
53
|
+
icon: p,
|
|
53
54
|
color: "text-status-error-text bg-status-error-bg-subtle"
|
|
54
55
|
}
|
|
55
56
|
};
|
|
56
|
-
function
|
|
57
|
+
function g(e, t) {
|
|
57
58
|
let n = /* @__PURE__ */ new Date(), r = new Date(e), i = n.getTime() - r.getTime(), a = Math.floor(i / 6e4), o = Math.floor(a / 60), s = Math.floor(o / 24);
|
|
58
59
|
return a < 1 ? t("security.activityTimeline.justNow", "just now") : a < 60 ? t("security.activityTimeline.minutesAgo", "{{count}}m ago", { count: a }) : o < 24 ? t("security.activityTimeline.hoursAgo", "{{count}}h ago", { count: o }) : s < 7 ? t("security.activityTimeline.daysAgo", "{{count}}d ago", { count: s }) : r.toLocaleDateString();
|
|
59
60
|
}
|
|
60
|
-
var
|
|
61
|
+
var _ = (e) => ({
|
|
61
62
|
"vault.created": "activityTimeline.action.vaultCreated",
|
|
62
63
|
"vault.updated": "activityTimeline.action.vaultUpdated",
|
|
63
64
|
"vault.deleted": "activityTimeline.action.vaultDeleted",
|
|
@@ -70,49 +71,49 @@ var g = (e) => ({
|
|
|
70
71
|
"secret.rotated": "activityTimeline.action.secretRotated",
|
|
71
72
|
"member.added": "activityTimeline.action.memberAdded",
|
|
72
73
|
"member.removed": "activityTimeline.action.memberRemoved"
|
|
73
|
-
})[e] ?? e,
|
|
74
|
-
let
|
|
75
|
-
return /* @__PURE__ */
|
|
76
|
-
className: e("relative",
|
|
77
|
-
children: [/* @__PURE__ */
|
|
74
|
+
})[e] ?? e, v = ({ entries: o, className: s }) => {
|
|
75
|
+
let c = n(), l = t();
|
|
76
|
+
return /* @__PURE__ */ i("div", {
|
|
77
|
+
className: e("relative", s),
|
|
78
|
+
children: [/* @__PURE__ */ r("div", { className: "absolute left-4 top-2 bottom-2 w-px bg-border" }), /* @__PURE__ */ r("div", {
|
|
78
79
|
className: "space-y-4",
|
|
79
|
-
children:
|
|
80
|
-
let
|
|
81
|
-
icon:
|
|
80
|
+
children: o.map((t) => {
|
|
81
|
+
let n = t.action, o = h[n] ?? {
|
|
82
|
+
icon: a,
|
|
82
83
|
color: "text-text-secondary bg-bg-sunken"
|
|
83
|
-
},
|
|
84
|
-
return /* @__PURE__ */
|
|
84
|
+
}, s = o.icon, u = _(n);
|
|
85
|
+
return /* @__PURE__ */ i("div", {
|
|
85
86
|
className: "relative flex items-start gap-3 pl-1",
|
|
86
|
-
children: [/* @__PURE__ */
|
|
87
|
+
children: [/* @__PURE__ */ r("div", {
|
|
87
88
|
className: e("relative z-10 p-1.5 rounded-full shrink-0", o.color),
|
|
88
|
-
children: /* @__PURE__ */
|
|
89
|
-
}), /* @__PURE__ */
|
|
89
|
+
children: /* @__PURE__ */ r(s, { className: "size-3" })
|
|
90
|
+
}), /* @__PURE__ */ i("div", {
|
|
90
91
|
className: "flex-1 min-w-0 pt-0.5",
|
|
91
|
-
children: [/* @__PURE__ */
|
|
92
|
+
children: [/* @__PURE__ */ i("p", {
|
|
92
93
|
className: "text-sm text-text-primary",
|
|
93
94
|
children: [
|
|
94
|
-
/* @__PURE__ */
|
|
95
|
-
className: "font-medium",
|
|
96
|
-
children: t.actorId
|
|
95
|
+
/* @__PURE__ */ r("span", {
|
|
96
|
+
className: "font-medium break-all",
|
|
97
|
+
children: c(t.actorId)
|
|
97
98
|
}),
|
|
98
99
|
" ",
|
|
99
|
-
/* @__PURE__ */
|
|
100
|
+
/* @__PURE__ */ r("span", {
|
|
100
101
|
className: "text-text-secondary",
|
|
101
|
-
children:
|
|
102
|
+
children: l(`security.${u}`, n.replace(".", " "))
|
|
102
103
|
}),
|
|
103
|
-
t.entityId ? /* @__PURE__ */
|
|
104
|
+
t.entityId ? /* @__PURE__ */ i("span", {
|
|
104
105
|
className: "font-medium",
|
|
105
106
|
children: [
|
|
106
107
|
" ",
|
|
107
|
-
t.entityType ? String(t.entityType) :
|
|
108
|
+
t.entityType ? String(t.entityType) : l("security.activityTimeline.resource", "resource"),
|
|
108
109
|
":",
|
|
109
110
|
String(t.entityId)
|
|
110
111
|
]
|
|
111
112
|
}) : null
|
|
112
113
|
]
|
|
113
|
-
}), /* @__PURE__ */
|
|
114
|
+
}), /* @__PURE__ */ r("p", {
|
|
114
115
|
className: "text-xs text-text-secondary mt-0.5",
|
|
115
|
-
children:
|
|
116
|
+
children: g(t.timestamp, l)
|
|
116
117
|
})]
|
|
117
118
|
})]
|
|
118
119
|
}, t.id);
|
|
@@ -120,6 +121,6 @@ var g = (e) => ({
|
|
|
120
121
|
})]
|
|
121
122
|
});
|
|
122
123
|
};
|
|
123
|
-
export {
|
|
124
|
+
export { v as ActivityTimeline };
|
|
124
125
|
|
|
125
126
|
//# sourceMappingURL=ActivityTimeline.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActivityTimeline.js","names":["actionIconMap","Plus","Edit2","Trash2","Lock","Unlock","Eye","RefreshCw","UserPlus","UserMinus","formatRelativeTime","now","date","dateStr","diffMs","diffMins","diffHours","diffDays","tr","actionTranslationKey","action","ActivityTimeline","useTr","cn","className","entries","entry","config","Activity","Icon","actionKey"],"sources":["../../../src/security/components/ActivityTimeline.tsx"],"sourcesContent":["import type { FC } from 'react';\nimport {\n Lock,\n Unlock,\n Plus,\n Edit2,\n Trash2,\n Eye,\n RefreshCw,\n UserPlus,\n UserMinus,\n Activity,\n} from 'lucide-react';\nimport { cn } from '../utils/cn';\nimport { useTr } from '../hooks/useTr';\n\ninterface ActivityTimelineProps {\n entries: Array<Record<string, unknown>>;\n className?: string;\n}\n\nconst actionIconMap: Record<string, { icon: typeof Activity; color: string }> = {\n 'vault.created': { icon: Plus, color: 'text-status-success-text bg-status-success-bg-subtle' },\n 'vault.updated': { icon: Edit2, color: 'text-status-info-text bg-status-info-bg-subtle' },\n 'vault.deleted': { icon: Trash2, color: 'text-status-error-text bg-status-error-bg-subtle' },\n 'vault.locked': { icon: Lock, color: 'text-status-warning-text bg-status-warning-bg-subtle' },\n 'vault.unlocked': { icon: Unlock, color: 'text-status-success-text bg-status-success-bg-subtle' },\n 'secret.created': { icon: Plus, color: 'text-status-success-text bg-status-success-bg-subtle' },\n 'secret.updated': { icon: Edit2, color: 'text-status-info-text bg-status-info-bg-subtle' },\n 'secret.deleted': { icon: Trash2, color: 'text-status-error-text bg-status-error-bg-subtle' },\n 'secret.accessed': { icon: Eye, color: 'text-accent-purple bg-accent-purple-subtle' },\n 'secret.rotated': { icon: RefreshCw, color: 'text-accent-cyan bg-accent-cyan-subtle' },\n 'member.added': { icon: UserPlus, color: 'text-status-success-text bg-status-success-bg-subtle' },\n 'member.removed': { icon: UserMinus, color: 'text-status-error-text bg-status-error-bg-subtle' },\n};\n\nfunction formatRelativeTime(dateStr: string, tr: ReturnType<typeof useTr>): string {\n const now = new Date();\n const date = new Date(dateStr);\n const diffMs = now.getTime() - date.getTime();\n const diffMins = Math.floor(diffMs / 60000);\n const diffHours = Math.floor(diffMins / 60);\n const diffDays = Math.floor(diffHours / 24);\n\n if (diffMins < 1) return tr('security.activityTimeline.justNow', 'just now');\n if (diffMins < 60)\n return tr('security.activityTimeline.minutesAgo', '{{count}}m ago', { count: diffMins });\n if (diffHours < 24)\n return tr('security.activityTimeline.hoursAgo', '{{count}}h ago', { count: diffHours });\n if (diffDays < 7)\n return tr('security.activityTimeline.daysAgo', '{{count}}d ago', { count: diffDays });\n return date.toLocaleDateString();\n}\n\nconst actionTranslationKey = (action: string): string => {\n const map: Record<string, string> = {\n 'vault.created': 'activityTimeline.action.vaultCreated',\n 'vault.updated': 'activityTimeline.action.vaultUpdated',\n 'vault.deleted': 'activityTimeline.action.vaultDeleted',\n 'vault.locked': 'activityTimeline.action.vaultLocked',\n 'vault.unlocked': 'activityTimeline.action.vaultUnlocked',\n 'secret.created': 'activityTimeline.action.secretCreated',\n 'secret.updated': 'activityTimeline.action.secretUpdated',\n 'secret.deleted': 'activityTimeline.action.secretDeleted',\n 'secret.accessed': 'activityTimeline.action.secretAccessed',\n 'secret.rotated': 'activityTimeline.action.secretRotated',\n 'member.added': 'activityTimeline.action.memberAdded',\n 'member.removed': 'activityTimeline.action.memberRemoved',\n };\n return map[action] ?? action;\n};\n\n/**\n * Vertical timeline of recent audit activity events.\n */\nexport const ActivityTimeline: FC<ActivityTimelineProps> = ({ entries, className }) => {\n const tr = useTr();\n\n return (\n <div className={cn('relative', className)}>\n {/* Vertical line */}\n <div className=\"absolute left-4 top-2 bottom-2 w-px bg-border\" />\n\n <div className=\"space-y-4\">\n {entries.map((entry) => {\n const action = entry.action as string;\n const config = actionIconMap[action] ?? {\n icon: Activity,\n color: 'text-text-secondary bg-bg-sunken',\n };\n const Icon = config.icon;\n const actionKey = actionTranslationKey(action);\n\n return (\n <div key={entry.id as string} className=\"relative flex items-start gap-3 pl-1\">\n {/* Timeline dot */}\n <div className={cn('relative z-10 p-1.5 rounded-full shrink-0', config.color)}>\n <Icon className=\"size-3\" />\n </div>\n\n {/* Content */}\n <div className=\"flex-1 min-w-0 pt-0.5\">\n <p className=\"text-sm text-text-primary\">\n <span className=\"font-medium\"
|
|
1
|
+
{"version":3,"file":"ActivityTimeline.js","names":["actionIconMap","Plus","Edit2","Trash2","Lock","Unlock","Eye","RefreshCw","UserPlus","UserMinus","formatRelativeTime","now","date","dateStr","diffMs","diffMins","diffHours","diffDays","tr","actionTranslationKey","action","ActivityTimeline","actorLabel","useActorLabel","useTr","cn","className","entries","entry","config","Activity","Icon","actionKey"],"sources":["../../../src/security/components/ActivityTimeline.tsx"],"sourcesContent":["import type { FC } from 'react';\nimport {\n Lock,\n Unlock,\n Plus,\n Edit2,\n Trash2,\n Eye,\n RefreshCw,\n UserPlus,\n UserMinus,\n Activity,\n} from 'lucide-react';\nimport { cn } from '../utils/cn';\nimport { useTr } from '../hooks/useTr';\nimport { useActorLabel } from '../hooks/useActorLabel';\n\ninterface ActivityTimelineProps {\n entries: Array<Record<string, unknown>>;\n className?: string;\n}\n\nconst actionIconMap: Record<string, { icon: typeof Activity; color: string }> = {\n 'vault.created': { icon: Plus, color: 'text-status-success-text bg-status-success-bg-subtle' },\n 'vault.updated': { icon: Edit2, color: 'text-status-info-text bg-status-info-bg-subtle' },\n 'vault.deleted': { icon: Trash2, color: 'text-status-error-text bg-status-error-bg-subtle' },\n 'vault.locked': { icon: Lock, color: 'text-status-warning-text bg-status-warning-bg-subtle' },\n 'vault.unlocked': { icon: Unlock, color: 'text-status-success-text bg-status-success-bg-subtle' },\n 'secret.created': { icon: Plus, color: 'text-status-success-text bg-status-success-bg-subtle' },\n 'secret.updated': { icon: Edit2, color: 'text-status-info-text bg-status-info-bg-subtle' },\n 'secret.deleted': { icon: Trash2, color: 'text-status-error-text bg-status-error-bg-subtle' },\n 'secret.accessed': { icon: Eye, color: 'text-accent-purple bg-accent-purple-subtle' },\n 'secret.rotated': { icon: RefreshCw, color: 'text-accent-cyan bg-accent-cyan-subtle' },\n 'member.added': { icon: UserPlus, color: 'text-status-success-text bg-status-success-bg-subtle' },\n 'member.removed': { icon: UserMinus, color: 'text-status-error-text bg-status-error-bg-subtle' },\n};\n\nfunction formatRelativeTime(dateStr: string, tr: ReturnType<typeof useTr>): string {\n const now = new Date();\n const date = new Date(dateStr);\n const diffMs = now.getTime() - date.getTime();\n const diffMins = Math.floor(diffMs / 60000);\n const diffHours = Math.floor(diffMins / 60);\n const diffDays = Math.floor(diffHours / 24);\n\n if (diffMins < 1) return tr('security.activityTimeline.justNow', 'just now');\n if (diffMins < 60)\n return tr('security.activityTimeline.minutesAgo', '{{count}}m ago', { count: diffMins });\n if (diffHours < 24)\n return tr('security.activityTimeline.hoursAgo', '{{count}}h ago', { count: diffHours });\n if (diffDays < 7)\n return tr('security.activityTimeline.daysAgo', '{{count}}d ago', { count: diffDays });\n return date.toLocaleDateString();\n}\n\nconst actionTranslationKey = (action: string): string => {\n const map: Record<string, string> = {\n 'vault.created': 'activityTimeline.action.vaultCreated',\n 'vault.updated': 'activityTimeline.action.vaultUpdated',\n 'vault.deleted': 'activityTimeline.action.vaultDeleted',\n 'vault.locked': 'activityTimeline.action.vaultLocked',\n 'vault.unlocked': 'activityTimeline.action.vaultUnlocked',\n 'secret.created': 'activityTimeline.action.secretCreated',\n 'secret.updated': 'activityTimeline.action.secretUpdated',\n 'secret.deleted': 'activityTimeline.action.secretDeleted',\n 'secret.accessed': 'activityTimeline.action.secretAccessed',\n 'secret.rotated': 'activityTimeline.action.secretRotated',\n 'member.added': 'activityTimeline.action.memberAdded',\n 'member.removed': 'activityTimeline.action.memberRemoved',\n };\n return map[action] ?? action;\n};\n\n/**\n * Vertical timeline of recent audit activity events.\n */\nexport const ActivityTimeline: FC<ActivityTimelineProps> = ({ entries, className }) => {\n const actorLabel = useActorLabel();\n const tr = useTr();\n\n return (\n <div className={cn('relative', className)}>\n {/* Vertical line */}\n <div className=\"absolute left-4 top-2 bottom-2 w-px bg-border\" />\n\n <div className=\"space-y-4\">\n {entries.map((entry) => {\n const action = entry.action as string;\n const config = actionIconMap[action] ?? {\n icon: Activity,\n color: 'text-text-secondary bg-bg-sunken',\n };\n const Icon = config.icon;\n const actionKey = actionTranslationKey(action);\n\n return (\n <div key={entry.id as string} className=\"relative flex items-start gap-3 pl-1\">\n {/* Timeline dot */}\n <div className={cn('relative z-10 p-1.5 rounded-full shrink-0', config.color)}>\n <Icon className=\"size-3\" />\n </div>\n\n {/* Content */}\n <div className=\"flex-1 min-w-0 pt-0.5\">\n <p className=\"text-sm text-text-primary\">\n <span className=\"font-medium break-all\">\n {actorLabel(entry.actorId as string)}\n </span>{' '}\n <span className=\"text-text-secondary\">\n {tr(`security.${actionKey}`, action.replace('.', ' '))}\n </span>\n {entry.entityId ? (\n <span className=\"font-medium\">\n {' '}\n {entry.entityType\n ? String(entry.entityType)\n : tr('security.activityTimeline.resource', 'resource')}\n :{String(entry.entityId)}\n </span>\n ) : null}\n </p>\n <p className=\"text-xs text-text-secondary mt-0.5\">\n {formatRelativeTime(entry.timestamp as string, tr)}\n </p>\n </div>\n </div>\n );\n })}\n </div>\n </div>\n );\n};\n"],"mappings":"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"}
|
|
@@ -2,6 +2,8 @@ import { FC } from 'react';
|
|
|
2
2
|
interface BulkActionBarProps {
|
|
3
3
|
vaultId: string;
|
|
4
4
|
className?: string;
|
|
5
|
+
/** Labels already used in the vault, suggested by the Label picker. */
|
|
6
|
+
labelSuggestions?: readonly string[];
|
|
5
7
|
}
|
|
6
8
|
export declare const BulkActionBar: FC<BulkActionBarProps>;
|
|
7
9
|
export {};
|
|
@@ -4,90 +4,102 @@ import { useBulkSecretOperations as r } from "../hooks/useBulkSecretOperations.j
|
|
|
4
4
|
import { useSecurityEventEmitter as i } from "../hooks/useSecurityEventEmitter.js";
|
|
5
5
|
import { useSecurityStore as a } from "../store/securityStore.js";
|
|
6
6
|
import { ConfirmDialog as o } from "./ConfirmDialog.js";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
7
|
+
import { BulkLabelDialog as s, BulkMoveDialog as c } from "./BulkPickerDialogs.js";
|
|
8
|
+
import { useTr as l } from "../hooks/useTr.js";
|
|
9
|
+
import { useState as u } from "react";
|
|
10
|
+
import { usePermission as d } from "@burdenoff/fe-libs/shared/providers/shell";
|
|
11
|
+
import { Fragment as f, jsx as p, jsxs as m } from "react/jsx-runtime";
|
|
12
|
+
import { FolderInput as h, Loader2 as g, Tag as _, Trash2 as v, X as y } from "lucide-react";
|
|
12
13
|
// src/security/components/BulkActionBar.tsx
|
|
13
|
-
var
|
|
14
|
-
let
|
|
15
|
-
return
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
14
|
+
var b = ({ vaultId: b, className: x, labelSuggestions: S }) => {
|
|
15
|
+
let C = l(), w = a((e) => e.selectedSecretIds.length), T = a((e) => e.clearSecretSelection), { bulkDeleteSecrets: E, bulkMoveSecrets: D, bulkLabelSecrets: O, loading: k } = r(), { emit: A } = i(), j = d("secret:delete"), M = d("secret:update"), [N, P] = u(!1), [F, I] = u(!1), [L, R] = u(!1);
|
|
16
|
+
return w === 0 ? null : /* @__PURE__ */ m(f, { children: [
|
|
17
|
+
/* @__PURE__ */ m("div", {
|
|
18
|
+
className: e("flex items-center justify-between gap-3 px-4 py-3 rounded-lg", "bg-action-primary-bg/5 border border-primary/20", "animate-in slide-in-from-bottom-2 duration-200", x),
|
|
19
|
+
children: [/* @__PURE__ */ m("div", {
|
|
20
|
+
className: "flex items-center gap-2",
|
|
21
|
+
children: [/* @__PURE__ */ p(t, {
|
|
22
|
+
variant: "default",
|
|
23
|
+
children: C("security.bulkActionBar.selected", "{{count}} selected", { count: w })
|
|
24
|
+
}), /* @__PURE__ */ p("button", {
|
|
25
|
+
type: "button",
|
|
26
|
+
onClick: T,
|
|
27
|
+
className: "p-1 rounded hover:bg-accent text-text-secondary",
|
|
28
|
+
title: C("security.bulkActionBar.clearSelection", "Clear selection"),
|
|
29
|
+
"aria-label": C("security.bulkActionBar.clearSelection", "Clear selection"),
|
|
30
|
+
children: /* @__PURE__ */ p(y, { className: "size-4" })
|
|
31
|
+
})]
|
|
32
|
+
}), /* @__PURE__ */ m("div", {
|
|
33
|
+
className: "flex items-center gap-2",
|
|
34
|
+
children: [
|
|
35
|
+
k && /* @__PURE__ */ p(g, { className: "size-4 animate-spin text-text-secondary" }),
|
|
36
|
+
M && /* @__PURE__ */ m(n, {
|
|
37
|
+
variant: "outline",
|
|
38
|
+
size: "sm",
|
|
39
|
+
disabled: k,
|
|
40
|
+
onClick: () => I(!0),
|
|
41
|
+
children: [/* @__PURE__ */ p(_, { className: "size-3.5" }), C("security.bulkActionBar.label", "Label")]
|
|
42
|
+
}),
|
|
43
|
+
M && /* @__PURE__ */ m(n, {
|
|
44
|
+
variant: "outline",
|
|
45
|
+
size: "sm",
|
|
46
|
+
disabled: k,
|
|
47
|
+
onClick: () => R(!0),
|
|
48
|
+
children: [/* @__PURE__ */ p(h, { className: "size-3.5" }), C("security.bulkActionBar.move", "Move")]
|
|
49
|
+
}),
|
|
50
|
+
j && /* @__PURE__ */ m(n, {
|
|
51
|
+
variant: "destructive",
|
|
52
|
+
size: "sm",
|
|
53
|
+
disabled: k,
|
|
54
|
+
onClick: () => P(!0),
|
|
55
|
+
children: [/* @__PURE__ */ p(v, { className: "size-3.5" }), C("security.bulkActionBar.delete", "Delete")]
|
|
56
|
+
})
|
|
57
|
+
]
|
|
29
58
|
})]
|
|
30
|
-
}), /* @__PURE__ */ f("div", {
|
|
31
|
-
className: "flex items-center gap-2",
|
|
32
|
-
children: [
|
|
33
|
-
E && /* @__PURE__ */ d(m, { className: "size-4 animate-spin text-text-secondary" }),
|
|
34
|
-
k && /* @__PURE__ */ f(n, {
|
|
35
|
-
variant: "outline",
|
|
36
|
-
size: "sm",
|
|
37
|
-
disabled: E,
|
|
38
|
-
onClick: () => {
|
|
39
|
-
let e = prompt(b("security.bulkActionBar.labelPrompt", "Enter label to apply:"));
|
|
40
|
-
if (e) {
|
|
41
|
-
let t = a.getState().selectedSecretIds;
|
|
42
|
-
T(t, e), S();
|
|
43
|
-
}
|
|
44
|
-
},
|
|
45
|
-
children: [/* @__PURE__ */ d(h, { className: "size-3.5" }), b("security.bulkActionBar.label", "Label")]
|
|
46
|
-
}),
|
|
47
|
-
k && /* @__PURE__ */ f(n, {
|
|
48
|
-
variant: "outline",
|
|
49
|
-
size: "sm",
|
|
50
|
-
disabled: E,
|
|
51
|
-
onClick: () => {
|
|
52
|
-
let e = prompt(b("security.bulkActionBar.movePrompt", "Enter target vault ID:"));
|
|
53
|
-
if (e) {
|
|
54
|
-
let t = a.getState().selectedSecretIds;
|
|
55
|
-
w(t, e), t.forEach((e) => D("secret.updated", {
|
|
56
|
-
secretId: e,
|
|
57
|
-
vaultId: v
|
|
58
|
-
})), S();
|
|
59
|
-
}
|
|
60
|
-
},
|
|
61
|
-
children: [/* @__PURE__ */ d(p, { className: "size-3.5" }), b("security.bulkActionBar.move", "Move")]
|
|
62
|
-
}),
|
|
63
|
-
O && /* @__PURE__ */ f(n, {
|
|
64
|
-
variant: "destructive",
|
|
65
|
-
size: "sm",
|
|
66
|
-
disabled: E,
|
|
67
|
-
onClick: () => j(!0),
|
|
68
|
-
children: [/* @__PURE__ */ d(g, { className: "size-3.5" }), b("security.bulkActionBar.delete", "Delete")]
|
|
69
|
-
})
|
|
70
|
-
]
|
|
71
|
-
})]
|
|
72
|
-
}), /* @__PURE__ */ d(o, {
|
|
73
|
-
isOpen: A,
|
|
74
|
-
onClose: () => j(!1),
|
|
75
|
-
onConfirm: async () => {
|
|
76
|
-
let e = a.getState().selectedSecretIds;
|
|
77
|
-
await C(e), e.forEach((e) => D("secret.deleted", {
|
|
78
|
-
secretId: e,
|
|
79
|
-
vaultId: v
|
|
80
|
-
})), j(!1), S();
|
|
81
|
-
},
|
|
82
|
-
title: b("security.bulkActionBar.deleteConfirm.title", "Delete Selected Secrets"),
|
|
83
|
-
description: b("security.bulkActionBar.deleteConfirm.description", "Are you sure you want to delete {{count}} selected secret{{suffix}}? This action cannot be undone.", {
|
|
84
|
-
count: x,
|
|
85
|
-
suffix: x === 1 ? "" : "s"
|
|
86
59
|
}),
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
60
|
+
/* @__PURE__ */ p(s, {
|
|
61
|
+
isOpen: F,
|
|
62
|
+
onClose: () => I(!1),
|
|
63
|
+
selectedCount: w,
|
|
64
|
+
suggestions: S,
|
|
65
|
+
onApply: async (e) => {
|
|
66
|
+
let t = a.getState().selectedSecretIds;
|
|
67
|
+
await O(t, e), I(!1), T();
|
|
68
|
+
}
|
|
69
|
+
}),
|
|
70
|
+
/* @__PURE__ */ p(c, {
|
|
71
|
+
isOpen: L,
|
|
72
|
+
onClose: () => R(!1),
|
|
73
|
+
currentVaultId: b,
|
|
74
|
+
selectedCount: w,
|
|
75
|
+
onMove: async (e) => {
|
|
76
|
+
let t = a.getState().selectedSecretIds;
|
|
77
|
+
await D(t, e), t.forEach((e) => A("secret.updated", {
|
|
78
|
+
secretId: e,
|
|
79
|
+
vaultId: b
|
|
80
|
+
})), R(!1), T();
|
|
81
|
+
}
|
|
82
|
+
}),
|
|
83
|
+
/* @__PURE__ */ p(o, {
|
|
84
|
+
isOpen: N,
|
|
85
|
+
onClose: () => P(!1),
|
|
86
|
+
onConfirm: async () => {
|
|
87
|
+
let e = a.getState().selectedSecretIds;
|
|
88
|
+
await E(e), e.forEach((e) => A("secret.deleted", {
|
|
89
|
+
secretId: e,
|
|
90
|
+
vaultId: b
|
|
91
|
+
})), P(!1), T();
|
|
92
|
+
},
|
|
93
|
+
title: C("security.bulkActionBar.deleteConfirm.title", "Delete Selected Secrets"),
|
|
94
|
+
description: C("security.bulkActionBar.deleteConfirm.description", "Are you sure you want to delete {{count}} selected secret{{suffix}}? This action cannot be undone.", {
|
|
95
|
+
count: w,
|
|
96
|
+
suffix: w === 1 ? "" : "s"
|
|
97
|
+
}),
|
|
98
|
+
confirmLabel: C("security.bulkActionBar.deleteConfirm.confirm", "Delete All"),
|
|
99
|
+
variant: "destructive"
|
|
100
|
+
})
|
|
101
|
+
] });
|
|
90
102
|
};
|
|
91
|
-
export {
|
|
103
|
+
export { b as BulkActionBar };
|
|
92
104
|
|
|
93
105
|
//# sourceMappingURL=BulkActionBar.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BulkActionBar.js","names":["_Fragment","BulkActionBar","tr","useTr","selectedCount","useSecurityStore","s","clearSelection","useBulkSecretOperations","useSecurityEventEmitter","canDeleteSecret","usePermission","canUpdateSecret","showDeleteConfirm","setShowDeleteConfirm","useState","Fragment","cn","className","Badge","X","loading","Loader2","Button","
|
|
1
|
+
{"version":3,"file":"BulkActionBar.js","names":["_Fragment","BulkActionBar","tr","useTr","selectedCount","useSecurityStore","s","clearSelection","useBulkSecretOperations","useSecurityEventEmitter","canDeleteSecret","usePermission","canUpdateSecret","showDeleteConfirm","setShowDeleteConfirm","useState","showLabelPicker","setShowLabelPicker","showMovePicker","setShowMovePicker","Fragment","cn","className","Badge","X","loading","Loader2","Button","Tag","FolderInput","Trash2","BulkLabelDialog","labelSuggestions","selectedIds","bulkLabelSecrets","label","BulkMoveDialog","vaultId","bulkMoveSecrets","targetId","emit","id","ConfirmDialog","bulkDeleteSecrets"],"sources":["../../../src/security/components/BulkActionBar.tsx"],"sourcesContent":["import type { FC } from 'react';\nimport { useState } from 'react';\nimport { Trash2, FolderInput, Tag, X, Loader2 } from 'lucide-react';\nimport { cn } from '../utils/cn';\nimport { Button, Badge } from './ui';\nimport { useBulkSecretOperations } from '../hooks/useBulkSecretOperations';\nimport { useSecurityEventEmitter } from '../hooks/useSecurityEventEmitter';\nimport { useSecurityStore } from '../store/securityStore';\nimport { ConfirmDialog } from './ConfirmDialog';\nimport { BulkLabelDialog, BulkMoveDialog } from './BulkPickerDialogs';\nimport { usePermission } from '@burdenoff/fe-libs/shared/providers/shell';\nimport { useTr } from '../hooks/useTr';\n\ninterface BulkActionBarProps {\n vaultId: string;\n className?: string;\n /** Labels already used in the vault, suggested by the Label picker. */\n labelSuggestions?: readonly string[];\n}\n\nexport const BulkActionBar: FC<BulkActionBarProps> = ({ vaultId, className, labelSuggestions }) => {\n const tr = useTr();\n\n const selectedCount = useSecurityStore((s) => s.selectedSecretIds.length);\n const clearSelection = useSecurityStore((s) => s.clearSecretSelection);\n const { bulkDeleteSecrets, bulkMoveSecrets, bulkLabelSecrets, loading } =\n useBulkSecretOperations();\n const { emit } = useSecurityEventEmitter();\n\n const canDeleteSecret = usePermission('secret:delete');\n const canUpdateSecret = usePermission('secret:update');\n\n const [showDeleteConfirm, setShowDeleteConfirm] = useState(false);\n const [showLabelPicker, setShowLabelPicker] = useState(false);\n const [showMovePicker, setShowMovePicker] = useState(false);\n\n if (selectedCount === 0) return null;\n\n return (\n <>\n <div\n className={cn(\n 'flex items-center justify-between gap-3 px-4 py-3 rounded-lg',\n 'bg-action-primary-bg/5 border border-primary/20',\n 'animate-in slide-in-from-bottom-2 duration-200',\n className\n )}\n >\n <div className=\"flex items-center gap-2\">\n <Badge variant=\"default\">\n {tr('security.bulkActionBar.selected', '{{count}} selected', { count: selectedCount })}\n </Badge>\n <button\n type=\"button\"\n onClick={clearSelection}\n className=\"p-1 rounded hover:bg-accent text-text-secondary\"\n title={tr('security.bulkActionBar.clearSelection', 'Clear selection')}\n aria-label={tr('security.bulkActionBar.clearSelection', 'Clear selection')}\n >\n <X className=\"size-4\" />\n </button>\n </div>\n\n <div className=\"flex items-center gap-2\">\n {loading && <Loader2 className=\"size-4 animate-spin text-text-secondary\" />}\n\n {canUpdateSecret && (\n <Button\n variant=\"outline\"\n size=\"sm\"\n disabled={loading}\n onClick={() => setShowLabelPicker(true)}\n >\n <Tag className=\"size-3.5\" />\n {tr('security.bulkActionBar.label', 'Label')}\n </Button>\n )}\n\n {canUpdateSecret && (\n <Button\n variant=\"outline\"\n size=\"sm\"\n disabled={loading}\n onClick={() => setShowMovePicker(true)}\n >\n <FolderInput className=\"size-3.5\" />\n {tr('security.bulkActionBar.move', 'Move')}\n </Button>\n )}\n\n {canDeleteSecret && (\n <Button\n variant=\"destructive\"\n size=\"sm\"\n disabled={loading}\n onClick={() => setShowDeleteConfirm(true)}\n >\n <Trash2 className=\"size-3.5\" />\n {tr('security.bulkActionBar.delete', 'Delete')}\n </Button>\n )}\n </div>\n </div>\n\n <BulkLabelDialog\n isOpen={showLabelPicker}\n onClose={() => setShowLabelPicker(false)}\n selectedCount={selectedCount}\n suggestions={labelSuggestions}\n onApply={async (label) => {\n const selectedIds = useSecurityStore.getState().selectedSecretIds;\n // Keep the selection when the change fails, so it can be retried.\n await bulkLabelSecrets(selectedIds, label);\n setShowLabelPicker(false);\n clearSelection();\n }}\n />\n\n <BulkMoveDialog\n isOpen={showMovePicker}\n onClose={() => setShowMovePicker(false)}\n currentVaultId={vaultId}\n selectedCount={selectedCount}\n onMove={async (targetId) => {\n const selectedIds = useSecurityStore.getState().selectedSecretIds;\n // Keep the selection when the move fails, so it can be retried.\n await bulkMoveSecrets(selectedIds, targetId);\n selectedIds.forEach((id) => emit('secret.updated', { secretId: id, vaultId }));\n setShowMovePicker(false);\n clearSelection();\n }}\n />\n\n <ConfirmDialog\n isOpen={showDeleteConfirm}\n onClose={() => setShowDeleteConfirm(false)}\n onConfirm={async () => {\n const selectedIds = useSecurityStore.getState().selectedSecretIds;\n await bulkDeleteSecrets(selectedIds);\n selectedIds.forEach((id) => emit('secret.deleted', { secretId: id, vaultId }));\n setShowDeleteConfirm(false);\n clearSelection();\n }}\n title={tr('security.bulkActionBar.deleteConfirm.title', 'Delete Selected Secrets')}\n description={tr(\n 'security.bulkActionBar.deleteConfirm.description',\n 'Are you sure you want to delete {{count}} selected secret{{suffix}}? This action cannot be undone.',\n { count: selectedCount, suffix: selectedCount !== 1 ? 's' : '' }\n )}\n confirmLabel={tr('security.bulkActionBar.deleteConfirm.confirm', 'Delete All')}\n variant=\"destructive\"\n />\n </>\n );\n};\n"],"mappings":"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"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
interface BulkLabelDialogProps {
|
|
3
|
+
isOpen: boolean;
|
|
4
|
+
onClose: () => void;
|
|
5
|
+
/** Resolves when applied; a rejection keeps the dialog open with an error. */
|
|
6
|
+
onApply: (label: string) => Promise<void>;
|
|
7
|
+
selectedCount: number;
|
|
8
|
+
/** Labels already used in this vault, offered as suggestions. */
|
|
9
|
+
suggestions?: readonly string[];
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Label picker for the bulk bar. Replaces the browser `prompt()` the bulk
|
|
13
|
+
* Label action used: same mutation, now a real dialog with suggestions.
|
|
14
|
+
*/
|
|
15
|
+
export declare const BulkLabelDialog: FC<BulkLabelDialogProps>;
|
|
16
|
+
interface BulkMoveDialogProps {
|
|
17
|
+
isOpen: boolean;
|
|
18
|
+
onClose: () => void;
|
|
19
|
+
/** Resolves when moved; a rejection keeps the dialog open with an error. */
|
|
20
|
+
onMove: (targetVaultId: string) => Promise<void>;
|
|
21
|
+
/** The vault the items are in now; it is not offered as a target. */
|
|
22
|
+
currentVaultId: string;
|
|
23
|
+
selectedCount: number;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Vault picker for the bulk bar. Replaces the browser `prompt()` that asked
|
|
27
|
+
* for a raw target vault ID: same mutation, now a list of vault names.
|
|
28
|
+
*/
|
|
29
|
+
export declare const BulkMoveDialog: FC<BulkMoveDialogProps>;
|
|
30
|
+
export {};
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { Button as e, Input as t, Select as n } from "./ui.js";
|
|
2
|
+
import { useGetVaultsQuery as r } from "../../generated/wspace-operations.js";
|
|
3
|
+
import { useTr as i } from "../hooks/useTr.js";
|
|
4
|
+
import { useId as a, useState as o } from "react";
|
|
5
|
+
import { jsx as s, jsxs as c } from "react/jsx-runtime";
|
|
6
|
+
import { FolderInput as l, Tag as u } from "lucide-react";
|
|
7
|
+
import { ResponsiveDialog as d, ResponsiveDialogContent as f, ResponsiveDialogDescription as p, ResponsiveDialogHeader as m, ResponsiveDialogTitle as h } from "@burdenoff/fe-libs/ui";
|
|
8
|
+
// src/security/components/BulkPickerDialogs.tsx
|
|
9
|
+
var g = ({ isOpen: n, onClose: r, onApply: l, selectedCount: g, suggestions: _ = [] }) => {
|
|
10
|
+
let v = i(), y = a(), [b, x] = o(""), [S, C] = o(!1), [w, T] = o(!1), E = () => {
|
|
11
|
+
x(""), T(!1), r();
|
|
12
|
+
};
|
|
13
|
+
return /* @__PURE__ */ s(d, {
|
|
14
|
+
open: n,
|
|
15
|
+
onOpenChange: (e) => !e && E(),
|
|
16
|
+
children: /* @__PURE__ */ c(f, {
|
|
17
|
+
className: "max-w-md",
|
|
18
|
+
children: [/* @__PURE__ */ c(m, { children: [/* @__PURE__ */ s(h, { children: v("security.bulkActionBar.labelDialog.title", "Add a label") }), /* @__PURE__ */ s(p, { children: v("security.bulkActionBar.labelDialog.description", "The label is added to the {{count}} selected items.", { count: g }) })] }), /* @__PURE__ */ c("form", {
|
|
19
|
+
onSubmit: async (e) => {
|
|
20
|
+
e.preventDefault();
|
|
21
|
+
let t = b.trim();
|
|
22
|
+
if (t) {
|
|
23
|
+
C(!0), T(!1);
|
|
24
|
+
try {
|
|
25
|
+
await l(t), x("");
|
|
26
|
+
} catch {
|
|
27
|
+
T(!0);
|
|
28
|
+
} finally {
|
|
29
|
+
C(!1);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
className: "space-y-4",
|
|
34
|
+
children: [
|
|
35
|
+
/* @__PURE__ */ s(t, {
|
|
36
|
+
id: "bulk-label",
|
|
37
|
+
label: v("security.bulkActionBar.labelDialog.field", "Label"),
|
|
38
|
+
value: b,
|
|
39
|
+
onChange: (e) => x(e.target.value),
|
|
40
|
+
list: _.length > 0 ? y : void 0,
|
|
41
|
+
autoFocus: !0,
|
|
42
|
+
required: !0
|
|
43
|
+
}),
|
|
44
|
+
_.length > 0 && /* @__PURE__ */ s("datalist", {
|
|
45
|
+
id: y,
|
|
46
|
+
children: _.map((e) => /* @__PURE__ */ s("option", { value: e }, e))
|
|
47
|
+
}),
|
|
48
|
+
w && /* @__PURE__ */ s("p", {
|
|
49
|
+
role: "alert",
|
|
50
|
+
className: "text-sm text-status-error-text",
|
|
51
|
+
children: v("security.bulkActionBar.failed", "That did not work. Try again.")
|
|
52
|
+
}),
|
|
53
|
+
/* @__PURE__ */ c("div", {
|
|
54
|
+
className: "flex justify-end gap-2",
|
|
55
|
+
children: [/* @__PURE__ */ s(e, {
|
|
56
|
+
type: "button",
|
|
57
|
+
variant: "outline",
|
|
58
|
+
onClick: E,
|
|
59
|
+
children: v("security.common.actions.cancel", "Cancel")
|
|
60
|
+
}), /* @__PURE__ */ c(e, {
|
|
61
|
+
type: "submit",
|
|
62
|
+
disabled: !b.trim() || S,
|
|
63
|
+
children: [/* @__PURE__ */ s(u, { className: "size-4" }), v("security.bulkActionBar.labelDialog.apply", "Add label")]
|
|
64
|
+
})]
|
|
65
|
+
})
|
|
66
|
+
]
|
|
67
|
+
})]
|
|
68
|
+
})
|
|
69
|
+
});
|
|
70
|
+
}, _ = ({ isOpen: t, onClose: a, onMove: u, currentVaultId: g, selectedCount: _ }) => {
|
|
71
|
+
let v = i(), [y, b] = o(""), [x, S] = o(!1), [C, w] = o(!1), { data: T, loading: E } = r({
|
|
72
|
+
variables: { pagination: { limit: 100 } },
|
|
73
|
+
skip: !t,
|
|
74
|
+
fetchPolicy: "network-only"
|
|
75
|
+
}), D = (T?.getVaults?.items ?? []).filter((e) => e.id !== g), O = () => {
|
|
76
|
+
b(""), w(!1), a();
|
|
77
|
+
}, k = async () => {
|
|
78
|
+
S(!0), w(!1);
|
|
79
|
+
try {
|
|
80
|
+
await u(y), b("");
|
|
81
|
+
} catch {
|
|
82
|
+
w(!0);
|
|
83
|
+
} finally {
|
|
84
|
+
S(!1);
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
return /* @__PURE__ */ s(d, {
|
|
88
|
+
open: t,
|
|
89
|
+
onOpenChange: (e) => !e && O(),
|
|
90
|
+
children: /* @__PURE__ */ c(f, {
|
|
91
|
+
className: "max-w-md",
|
|
92
|
+
children: [/* @__PURE__ */ c(m, { children: [/* @__PURE__ */ s(h, { children: v("security.bulkActionBar.moveDialog.title", "Move to another vault") }), /* @__PURE__ */ s(p, { children: v("security.bulkActionBar.moveDialog.description", "The {{count}} selected items move to the vault you pick.", { count: _ }) })] }), /* @__PURE__ */ c("div", {
|
|
93
|
+
className: "space-y-4",
|
|
94
|
+
children: [
|
|
95
|
+
!E && D.length === 0 ? /* @__PURE__ */ s("p", {
|
|
96
|
+
className: "text-sm text-text-secondary",
|
|
97
|
+
children: v("security.bulkActionBar.moveDialog.none", "There is no other vault to move to.")
|
|
98
|
+
}) : /* @__PURE__ */ s(n, {
|
|
99
|
+
label: v("security.bulkActionBar.moveDialog.field", "Vault"),
|
|
100
|
+
value: y,
|
|
101
|
+
onChange: b,
|
|
102
|
+
options: [{
|
|
103
|
+
value: "",
|
|
104
|
+
label: E ? v("security.bulkActionBar.moveDialog.loading", "Loading vaults…") : v("security.bulkActionBar.moveDialog.placeholder", "Choose a vault")
|
|
105
|
+
}, ...D.map((e) => ({
|
|
106
|
+
value: e.id,
|
|
107
|
+
label: e.name
|
|
108
|
+
}))]
|
|
109
|
+
}),
|
|
110
|
+
C && /* @__PURE__ */ s("p", {
|
|
111
|
+
role: "alert",
|
|
112
|
+
className: "text-sm text-status-error-text",
|
|
113
|
+
children: v("security.bulkActionBar.failed", "That did not work. Try again.")
|
|
114
|
+
}),
|
|
115
|
+
/* @__PURE__ */ c("div", {
|
|
116
|
+
className: "flex justify-end gap-2",
|
|
117
|
+
children: [/* @__PURE__ */ s(e, {
|
|
118
|
+
type: "button",
|
|
119
|
+
variant: "outline",
|
|
120
|
+
onClick: O,
|
|
121
|
+
children: v("security.common.actions.cancel", "Cancel")
|
|
122
|
+
}), /* @__PURE__ */ c(e, {
|
|
123
|
+
type: "button",
|
|
124
|
+
disabled: !y || x,
|
|
125
|
+
onClick: () => void k(),
|
|
126
|
+
children: [/* @__PURE__ */ s(l, { className: "size-4" }), v("security.bulkActionBar.moveDialog.apply", "Move")]
|
|
127
|
+
})]
|
|
128
|
+
})
|
|
129
|
+
]
|
|
130
|
+
})]
|
|
131
|
+
})
|
|
132
|
+
});
|
|
133
|
+
};
|
|
134
|
+
export { g as BulkLabelDialog, _ as BulkMoveDialog };
|
|
135
|
+
|
|
136
|
+
//# sourceMappingURL=BulkPickerDialogs.js.map
|