@coffre/ui 0.9.0 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/{audit-sentence-JrQIUq6j.js → audit-sentence-Bjhg00cn.js} +73 -6
- package/dist/chunks/audit-sentence-Bjhg00cn.js.map +1 -0
- package/dist/chunks/{connected-apps-Dr8UgjK7.js → connected-apps-CZI7xxUq.js} +2 -2
- package/dist/chunks/{connected-apps-Dr8UgjK7.js.map → connected-apps-CZI7xxUq.js.map} +1 -1
- package/dist/chunks/{delete-place-CQCDHkne.js → delete-place-D3UQGl3b.js} +3 -3
- package/dist/chunks/{delete-place-CQCDHkne.js.map → delete-place-D3UQGl3b.js.map} +1 -1
- package/dist/chunks/{directory-XcSbDRJv.js → directory-CyHmxYP-.js} +9 -7
- package/dist/chunks/directory-CyHmxYP-.js.map +1 -0
- package/dist/chunks/{grants-CmdZjKYU.js → grants-CEIdNqJU.js} +4 -4
- package/dist/chunks/{grants-CmdZjKYU.js.map → grants-CEIdNqJU.js.map} +1 -1
- package/dist/chunks/{offboarding-CrgwaetA.js → offboarding-CvGgTmHi.js} +2 -2
- package/dist/chunks/{offboarding-CrgwaetA.js.map → offboarding-CvGgTmHi.js.map} +1 -1
- package/dist/chunks/{personal-tokens-Dvl1FktE.js → personal-tokens-BX97oX4a.js} +2 -2
- package/dist/chunks/{personal-tokens-Dvl1FktE.js.map → personal-tokens-BX97oX4a.js.map} +1 -1
- package/dist/chunks/{principal-page-bOaEYWJB.js → principal-page-Bp2O8kIW.js} +92 -76
- package/dist/chunks/principal-page-Bp2O8kIW.js.map +1 -0
- package/dist/chunks/{project-page-BI--vjt3.js → project-page-CUXV4FDR.js} +2 -2
- package/dist/chunks/{project-page-BI--vjt3.js.map → project-page-CUXV4FDR.js.map} +1 -1
- package/dist/chunks/protected-YYW3U-Sq.js +22 -0
- package/dist/chunks/protected-YYW3U-Sq.js.map +1 -0
- package/dist/chunks/{queries-epz4MIuW.js → queries-DEOPOpsT.js} +27 -3
- package/dist/chunks/queries-DEOPOpsT.js.map +1 -0
- package/dist/chunks/{references-DImfw0cz.js → references-DsXkt064.js} +3 -3
- package/dist/chunks/{references-DImfw0cz.js.map → references-DsXkt064.js.map} +1 -1
- package/dist/chunks/{role-field-C1KhNaIR.js → role-field-CCUeZd1a.js} +8 -5
- package/dist/chunks/role-field-CCUeZd1a.js.map +1 -0
- package/dist/chunks/{use-action-BB-RcHo1.js → use-action-COW-XFw8.js} +2 -2
- package/dist/chunks/{use-action-BB-RcHo1.js.map → use-action-COW-XFw8.js.map} +1 -1
- package/dist/chunks/{use-change-BY6KPmnJ.js → use-change-hfqE7baE.js} +217 -100
- package/dist/chunks/use-change-hfqE7baE.js.map +1 -0
- package/dist/chunks/use-roles-C_Tj5wBH.js +224 -0
- package/dist/chunks/use-roles-C_Tj5wBH.js.map +1 -0
- package/dist/chunks/{use-shell-C_NmvCt_.js → use-shell-DBLG80kk.js} +2 -2
- package/dist/chunks/{use-shell-C_NmvCt_.js.map → use-shell-DBLG80kk.js.map} +1 -1
- package/dist/index.d.ts +8 -3
- package/dist/index.js +25 -11
- package/dist/index.js.map +1 -1
- package/dist/pages/account.js +6 -6
- package/dist/pages/audit.js +2 -2
- package/dist/pages/environment.js +251 -111
- package/dist/pages/environment.js.map +1 -1
- package/dist/pages/login.js +1 -1
- package/dist/pages/project-access.js +78 -45
- package/dist/pages/project-access.js.map +1 -1
- package/dist/pages/project-environments.js +77 -28
- package/dist/pages/project-environments.js.map +1 -1
- package/dist/pages/project-settings.js +6 -6
- package/dist/pages/project.js +1 -1
- package/dist/pages/projects.js +23 -11
- package/dist/pages/projects.js.map +1 -1
- package/dist/pages/service-account.js +19 -12
- package/dist/pages/service-account.js.map +1 -1
- package/dist/pages/service-accounts.js +4 -4
- package/dist/pages/settings.js +580 -8
- package/dist/pages/settings.js.map +1 -1
- package/dist/pages/unregistered.js +1 -1
- package/dist/pages/user.js +5 -5
- package/dist/pages/users.js +4 -4
- package/package.json +3 -3
- package/src/components/directory.tsx +5 -2
- package/src/components/grants.tsx +1 -1
- package/src/components/principal-page.tsx +38 -23
- package/src/components/protected.tsx +17 -0
- package/src/components/role-editor.tsx +582 -0
- package/src/components/role-field.tsx +7 -3
- package/src/components/scope-picker.tsx +19 -9
- package/src/components/shell.tsx +7 -1
- package/src/lib/access-plan.ts +35 -36
- package/src/lib/audit-sentences.ts +75 -9
- package/src/lib/changes.ts +46 -8
- package/src/lib/project-access.ts +4 -78
- package/src/lib/queries.ts +16 -0
- package/src/lib/roles.ts +201 -0
- package/src/lib/row-reads.ts +12 -0
- package/src/lib/secret-edit-batch.ts +147 -56
- package/src/lib/sensitivity.ts +50 -0
- package/src/lib/service-setup.ts +20 -8
- package/src/lib/use-roles.ts +17 -0
- package/src/pages/environment.tsx +264 -101
- package/src/pages/project-access.tsx +49 -19
- package/src/pages/project-environments.tsx +62 -3
- package/src/pages/projects.tsx +3 -1
- package/src/pages/settings.tsx +2 -0
- package/src/parity.ts +41 -4
- package/src/shared/models.ts +2 -9
- package/src/styles/globals.css +322 -25
- package/dist/chunks/audit-sentence-JrQIUq6j.js.map +0 -1
- package/dist/chunks/directory-XcSbDRJv.js.map +0 -1
- package/dist/chunks/principal-page-bOaEYWJB.js.map +0 -1
- package/dist/chunks/queries-epz4MIuW.js.map +0 -1
- package/dist/chunks/role-field-C1KhNaIR.js.map +0 -1
- package/dist/chunks/use-change-BY6KPmnJ.js.map +0 -1
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
import { E as isActiveAccessibleEnvironment, i as keys, t as affects, v as queries, w as canRevealSecrets } from "../chunks/queries-
|
|
1
|
+
import { E as isActiveAccessibleEnvironment, i as keys, t as affects, v as queries, w as canRevealSecrets } from "../chunks/queries-DEOPOpsT.js";
|
|
2
2
|
import { a as ErrorLine, c as Notice, d as Tip, g as createCopier, h as breakAfterUnderscores, i as EmptyState, l as Spinner, n as ConfirmDialog, o as MenuPopup, r as CopyButton, s as Modal, t as ConfirmButton, u as Timestamp } from "../chunks/ui-2kwXXfrX.js";
|
|
3
3
|
import { i as SecretReadOnly } from "../chunks/affordances-Dtyha68j.js";
|
|
4
4
|
import { $ as SlashCircle, A as History, D as Generate, E as Folder, G as Plus, H as MoreHorizontal, J as Search, L as Lock, M as Key, S as Clock, T as EyeOff, W as Pencil, Z as Shuffle, _ as Check, g as ArrowRight, h as Archive, i as PageHeader, k as Hash, n as ClosedDoor, nt as Trash, o as failureMessage, p as AlertCircle, q as RotateBack, rt as Upload, st as X, t as Card, tt as Terminal, u as useCoffre, w as Eye, x as ChevronsUpDown, y as ChevronDown } from "../chunks/page-JTORvh-N.js";
|
|
5
5
|
import { a as rowClass, i as RowPending, r as RowFailure } from "../chunks/row-state-BsIHspy4.js";
|
|
6
|
-
import { t as useShell } from "../chunks/use-shell-
|
|
7
|
-
import { B as
|
|
6
|
+
import { t as useShell } from "../chunks/use-shell-DBLG80kk.js";
|
|
7
|
+
import { A as restoreSecret, B as valueEdit, G as stricter, H as SENSITIVITIES, I as companionsOf, J as regenerateWaits, K as waitsForValue, L as hasSecretEditConflict, P as saveSecrets, R as madeSensitive, S as moveSecret, T as regenerateSecret, U as levelsIn, V as LEVELS, W as markable, Y as regeneratedKeys, _ as forkKey, a as UnsavedEdits, i as changeOptions, k as restoreMissing, m as dismissMissing, n as useChangeStatus, q as liveGeneration, r as changeKey, s as archiveSecret, t as useChange, x as missingList, z as secretChangeFor } from "../chunks/use-change-hfqE7baE.js";
|
|
8
8
|
import { i as secretKeyProblem, n as folderProblem } from "../chunks/validation-DiHIwZRA.js";
|
|
9
9
|
import { t as pageRoute } from "../chunks/page-route-Drfw7lmn.js";
|
|
10
|
-
import { t as useAction } from "../chunks/use-action-
|
|
10
|
+
import { t as useAction } from "../chunks/use-action-COW-XFw8.js";
|
|
11
|
+
import { t as ProtectedTag } from "../chunks/protected-YYW3U-Sq.js";
|
|
11
12
|
import { n as FolderRow, r as MoveToFolder, t as FolderMenu } from "../chunks/folders-Dw240WMJ.js";
|
|
12
13
|
import { t as MultiCombobox } from "../chunks/multi-combobox-CsIXihuc.js";
|
|
13
|
-
import { i as ReferenceValue, n as LentReferences, o as archiveBlockers, r as MakeReference, t as ArchiveBlocked } from "../chunks/references-
|
|
14
|
+
import { i as ReferenceValue, n as LentReferences, o as archiveBlockers, r as MakeReference, t as ArchiveBlocked } from "../chunks/references-DsXkt064.js";
|
|
14
15
|
import { useEffect, useId, useReducer, useRef, useState } from "react";
|
|
15
16
|
import { Link, useNavigate } from "@tanstack/react-router";
|
|
16
17
|
import { toast } from "sonner";
|
|
@@ -72,6 +73,17 @@ function rowReads(state, action) {
|
|
|
72
73
|
function revealToggleDisabled(state, shown) {
|
|
73
74
|
return shown === null && state.revealing;
|
|
74
75
|
}
|
|
76
|
+
/**
|
|
77
|
+
* The value an edit starts from: a plain one as listed, one the caller reads
|
|
78
|
+
* as `read` opens it, or none, the editor opening empty to replace it: a
|
|
79
|
+
* sensitive value, a parent's they do not read, or a read refused or failed,
|
|
80
|
+
* whose reason the row says. It always opens: writing a value takes no read
|
|
81
|
+
* of the one it replaces.
|
|
82
|
+
*/
|
|
83
|
+
async function valueToEdit(row, read) {
|
|
84
|
+
if (row.value !== null) return row.value;
|
|
85
|
+
return row.readable ? read() : null;
|
|
86
|
+
}
|
|
75
87
|
//#endregion
|
|
76
88
|
//#region src/lib/secret-order.ts
|
|
77
89
|
/**
|
|
@@ -731,10 +743,11 @@ function EnvironmentPage() {
|
|
|
731
743
|
keys: result.keys,
|
|
732
744
|
parents: result.parents ?? [],
|
|
733
745
|
personal: result.personal != null,
|
|
746
|
+
guarded: result.protected,
|
|
734
747
|
rotateAfterDays: result.rotateAfterDays
|
|
735
748
|
}, `${project}/${environment}`);
|
|
736
749
|
}
|
|
737
|
-
function EnvironmentLedger({ project, environment, permissions, keys: keys$1, parents, personal, rotateAfterDays }) {
|
|
750
|
+
function EnvironmentLedger({ project, environment, permissions, keys: keys$1, parents, personal, guarded, rotateAfterDays }) {
|
|
738
751
|
const coffre = useCoffre();
|
|
739
752
|
const queryClient = useQueryClient();
|
|
740
753
|
const { principal } = useShell();
|
|
@@ -792,6 +805,15 @@ function EnvironmentLedger({ project, environment, permissions, keys: keys$1, pa
|
|
|
792
805
|
const [changes, setChanges] = useState({});
|
|
793
806
|
const [editing, setEditing] = useState(() => /* @__PURE__ */ new Set());
|
|
794
807
|
const [saveError, setSaveError] = useState(null);
|
|
808
|
+
const [hiding, setHiding] = useState(null);
|
|
809
|
+
function confirmingSensitive(drafts, changes, go) {
|
|
810
|
+
const keys = madeSensitive(active, drafts, changes);
|
|
811
|
+
if (keys.length === 0) go();
|
|
812
|
+
else setHiding({
|
|
813
|
+
keys,
|
|
814
|
+
go
|
|
815
|
+
});
|
|
816
|
+
}
|
|
795
817
|
const [query, setQuery] = useState(Route.useSearch().filter ?? "");
|
|
796
818
|
const [sort, setSort] = useState({
|
|
797
819
|
by: "key",
|
|
@@ -806,6 +828,7 @@ function EnvironmentLedger({ project, environment, permissions, keys: keys$1, pa
|
|
|
806
828
|
const canWrite = permissions.includes("secret.write");
|
|
807
829
|
const canArchive = permissions.includes("secret.archive");
|
|
808
830
|
const canReveal = canRevealSecrets(permissions);
|
|
831
|
+
const canList = canReveal || permissions.includes("secret.use");
|
|
809
832
|
const active = byFolder(keys$1.filter((entry) => !entry.archived)).flatMap(([, entries]) => entries);
|
|
810
833
|
const folders = foldersOf(active);
|
|
811
834
|
const heldHere = (entry) => entry.parent === null || entry.parent.state === "overridden";
|
|
@@ -853,8 +876,9 @@ function EnvironmentLedger({ project, environment, permissions, keys: keys$1, pa
|
|
|
853
876
|
];
|
|
854
877
|
const unnamed = pendingNames.some((name) => name === "");
|
|
855
878
|
const invalid = pendingNames.some((name) => name !== "" && secretKeyProblem(name) !== null);
|
|
879
|
+
const waiting = changedEntries.find((entry) => waitsForValue(entry, secretChangeFor(changes, entry.key)));
|
|
856
880
|
const pendingCount = drafts.length + changedEntries.length;
|
|
857
|
-
const ready = pendingCount > 0 && !unnamed && !invalid && !hasConflict;
|
|
881
|
+
const ready = pendingCount > 0 && !unnamed && !invalid && !hasConflict && waiting === void 0;
|
|
858
882
|
function patchChange(entry, patch) {
|
|
859
883
|
setChanges((current) => {
|
|
860
884
|
const next = {
|
|
@@ -865,7 +889,7 @@ function EnvironmentLedger({ project, environment, permissions, keys: keys$1, pa
|
|
|
865
889
|
},
|
|
866
890
|
...patch
|
|
867
891
|
};
|
|
868
|
-
if (next.key !== entry.key || next.value !== null || next.archived) return {
|
|
892
|
+
if (next.key !== entry.key || next.value !== null || next.sensitivity !== void 0 || next.archived) return {
|
|
869
893
|
...current,
|
|
870
894
|
[entry.key]: next
|
|
871
895
|
};
|
|
@@ -879,20 +903,24 @@ function EnvironmentLedger({ project, environment, permissions, keys: keys$1, pa
|
|
|
879
903
|
*/
|
|
880
904
|
function saveRow(key) {
|
|
881
905
|
const change = secretChangeFor(changes, key);
|
|
882
|
-
dropChange(key);
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
906
|
+
if (change === void 0) return dropChange(key);
|
|
907
|
+
confirmingSensitive([], { [key]: change }, () => {
|
|
908
|
+
dropChange(key);
|
|
909
|
+
sendAlone({
|
|
910
|
+
active,
|
|
911
|
+
drafts: [],
|
|
912
|
+
changes: { [key]: change }
|
|
913
|
+
});
|
|
888
914
|
});
|
|
889
915
|
}
|
|
890
916
|
function saveDraft(draft) {
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
917
|
+
confirmingSensitive([draft], {}, () => {
|
|
918
|
+
setDrafts((rows) => rows.filter((row) => row.id !== draft.id));
|
|
919
|
+
sendAlone({
|
|
920
|
+
active,
|
|
921
|
+
drafts: [draft],
|
|
922
|
+
changes: {}
|
|
923
|
+
});
|
|
896
924
|
});
|
|
897
925
|
}
|
|
898
926
|
/** Whether one row's change could go alone: named, well named, and clashing with nothing. */
|
|
@@ -902,7 +930,7 @@ function EnvironmentLedger({ project, environment, permissions, keys: keys$1, pa
|
|
|
902
930
|
...Object.values(changes).flatMap((change) => change.archived ? [] : [change.key.trim()]),
|
|
903
931
|
...companionsOf(active, drafts, changes).map((companion) => companion.key.trim())
|
|
904
932
|
];
|
|
905
|
-
return (drafts.length > 0 || Object.keys(changes).length > 0) && names.every((name) => name !== "" && secretKeyProblem(name) === null) && !hasSecretEditConflict(active, drafts, changes);
|
|
933
|
+
return (drafts.length > 0 || Object.keys(changes).length > 0) && names.every((name) => name !== "" && secretKeyProblem(name) === null) && !hasSecretEditConflict(active, drafts, changes) && !active.some((entry) => waitsForValue(entry, secretChangeFor(changes, entry.key)));
|
|
906
934
|
}
|
|
907
935
|
function sendAlone(batch) {
|
|
908
936
|
setSaveError(null);
|
|
@@ -932,7 +960,8 @@ function EnvironmentLedger({ project, environment, permissions, keys: keys$1, pa
|
|
|
932
960
|
setDrafts((rows) => [...rows, {
|
|
933
961
|
id: nextDraftId.current++,
|
|
934
962
|
key,
|
|
935
|
-
value: ""
|
|
963
|
+
value: "",
|
|
964
|
+
sensitivity: "secret"
|
|
936
965
|
}]);
|
|
937
966
|
}
|
|
938
967
|
function discardAll() {
|
|
@@ -962,6 +991,9 @@ function EnvironmentLedger({ project, environment, permissions, keys: keys$1, pa
|
|
|
962
991
|
*/
|
|
963
992
|
function saveChanges() {
|
|
964
993
|
if (!ready) return;
|
|
994
|
+
confirmingSensitive(drafts, changes, sendChanges);
|
|
995
|
+
}
|
|
996
|
+
function sendChanges() {
|
|
965
997
|
const batch = {
|
|
966
998
|
active,
|
|
967
999
|
drafts,
|
|
@@ -1039,13 +1071,11 @@ function EnvironmentLedger({ project, environment, permissions, keys: keys$1, pa
|
|
|
1039
1071
|
what: "archived"
|
|
1040
1072
|
};
|
|
1041
1073
|
const renamed = change.key.trim() !== entry.key;
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
what: withCompanion(`→ ${change.key.trim()}, new value`, change.companion)
|
|
1045
|
-
};
|
|
1074
|
+
const level = change.sensitivity === void 0 || change.sensitivity === entry.sensitivity ? null : change.sensitivity;
|
|
1075
|
+
const written = change.value === null ? level === null ? null : `made ${level}` : withCompanion(level === null ? "new value" : `new value, ${level}`, change.companion);
|
|
1046
1076
|
if (renamed) return {
|
|
1047
1077
|
key: entry.key,
|
|
1048
|
-
what: `→ ${change.key.trim()}`
|
|
1078
|
+
what: written === null ? `→ ${change.key.trim()}` : `→ ${change.key.trim()}, ${written}`
|
|
1049
1079
|
};
|
|
1050
1080
|
if (entry.parent !== null && entry.parent.state !== "overridden") return {
|
|
1051
1081
|
key: entry.key,
|
|
@@ -1053,10 +1083,10 @@ function EnvironmentLedger({ project, environment, permissions, keys: keys$1, pa
|
|
|
1053
1083
|
};
|
|
1054
1084
|
return {
|
|
1055
1085
|
key: entry.key,
|
|
1056
|
-
what:
|
|
1086
|
+
what: written ?? "new value"
|
|
1057
1087
|
};
|
|
1058
1088
|
})];
|
|
1059
|
-
const problem = unnamed ? null : hasConflict ? "Two pending edits would end up with the same name. Secret names are unique in an environment." : invalid ? "Names are letters, digits and underscores, and cannot start with a digit." : null;
|
|
1089
|
+
const problem = unnamed ? null : hasConflict ? "Two pending edits would end up with the same name. Secret names are unique in an environment." : invalid ? "Names are letters, digits and underscores, and cannot start with a digit." : waiting !== void 0 ? `${waiting.key} waits for its value: type it again.` : null;
|
|
1060
1090
|
const needle = query.trim().toLowerCase();
|
|
1061
1091
|
const listed = sortKeys(needle === "" ? active : active.filter((entry) => entry.key.toLowerCase().includes(needle)), sort);
|
|
1062
1092
|
const columns = 6;
|
|
@@ -1064,11 +1094,12 @@ function EnvironmentLedger({ project, environment, permissions, keys: keys$1, pa
|
|
|
1064
1094
|
/* @__PURE__ */ jsx(PageHeader, {
|
|
1065
1095
|
tile: project,
|
|
1066
1096
|
title: environment,
|
|
1097
|
+
aside: guarded && /* @__PURE__ */ jsx(ProtectedTag, {}),
|
|
1067
1098
|
actions: personal ? /* @__PURE__ */ jsx(DeletePersonal, {
|
|
1068
1099
|
project,
|
|
1069
1100
|
environment,
|
|
1070
1101
|
of: parents[0]
|
|
1071
|
-
}) : principal?.type === "user" &&
|
|
1102
|
+
}) : principal?.type === "user" && canList && /* @__PURE__ */ jsxs(Link, {
|
|
1072
1103
|
className: "btn btn-sm",
|
|
1073
1104
|
to: "/projects/$project/$environment",
|
|
1074
1105
|
params: {
|
|
@@ -1099,7 +1130,7 @@ function EnvironmentLedger({ project, environment, permissions, keys: keys$1, pa
|
|
|
1099
1130
|
parents[0]
|
|
1100
1131
|
]
|
|
1101
1132
|
}),
|
|
1102
|
-
": what you set here
|
|
1133
|
+
": what you set here is yours alone, while you read or use ",
|
|
1103
1134
|
parents[0],
|
|
1104
1135
|
"; the rest is ",
|
|
1105
1136
|
parents[0],
|
|
@@ -1265,6 +1296,7 @@ function EnvironmentLedger({ project, environment, permissions, keys: keys$1, pa
|
|
|
1265
1296
|
canWrite,
|
|
1266
1297
|
canArchive,
|
|
1267
1298
|
canReveal,
|
|
1299
|
+
canList,
|
|
1268
1300
|
folders,
|
|
1269
1301
|
onMove: (folder) => move({
|
|
1270
1302
|
key: entry.key,
|
|
@@ -1335,6 +1367,26 @@ function EnvironmentLedger({ project, environment, permissions, keys: keys$1, pa
|
|
|
1335
1367
|
onSave: saveChanges
|
|
1336
1368
|
})]
|
|
1337
1369
|
}),
|
|
1370
|
+
/* @__PURE__ */ jsx(ConfirmDialog, {
|
|
1371
|
+
open: hiding !== null,
|
|
1372
|
+
onOpenChange: (open) => !open && setHiding(null),
|
|
1373
|
+
title: hiding?.keys.length === 1 ? /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
1374
|
+
"Make ",
|
|
1375
|
+
/* @__PURE__ */ jsx("span", {
|
|
1376
|
+
className: "mono",
|
|
1377
|
+
children: hiding.keys[0]
|
|
1378
|
+
}),
|
|
1379
|
+
" sensitive?"
|
|
1380
|
+
] }) : `Make ${hiding?.keys.length ?? 0} keys sensitive?`,
|
|
1381
|
+
body: `${hiding !== null && hiding.keys.length > 1 ? `${hiding.keys.join(", ")}: n` : "N"}obody, Owners included, will see ${hiding?.keys.length === 1 ? "this value" : "these values"} again. Apps use ${hiding?.keys.length === 1 ? "it" : "them"} through the proxy; service accounts still read ${hiding?.keys.length === 1 ? "it" : "them"}.`,
|
|
1382
|
+
confirmLabel: "Make sensitive",
|
|
1383
|
+
destructive: false,
|
|
1384
|
+
onConfirm: () => {
|
|
1385
|
+
const go = hiding?.go;
|
|
1386
|
+
setHiding(null);
|
|
1387
|
+
go?.();
|
|
1388
|
+
}
|
|
1389
|
+
}),
|
|
1338
1390
|
canWrite && /* @__PURE__ */ jsxs("div", {
|
|
1339
1391
|
className: "table-actions",
|
|
1340
1392
|
children: [
|
|
@@ -1409,7 +1461,7 @@ function EnvironmentLedger({ project, environment, permissions, keys: keys$1, pa
|
|
|
1409
1461
|
environment,
|
|
1410
1462
|
entry,
|
|
1411
1463
|
canArchive,
|
|
1412
|
-
|
|
1464
|
+
canList,
|
|
1413
1465
|
status: status(entry.key),
|
|
1414
1466
|
onRestore: () => restoreSecretKey(entry.key),
|
|
1415
1467
|
onDismiss: dismiss
|
|
@@ -1702,7 +1754,7 @@ function useSecondsLeft(reveal) {
|
|
|
1702
1754
|
if (reveal === null) return 0;
|
|
1703
1755
|
return Math.max(0, Math.ceil(REVEAL_TTL_SECONDS - (now - reveal.at) / 1e3));
|
|
1704
1756
|
}
|
|
1705
|
-
function SecretRow({ number, project, environment, entry, generated, busy, onRegenerate, rotateAfterDays, change, editing, canWrite, canArchive, canReveal, folders, onMove, lent, environments, status, disabled, onDismiss, columns, onFork, onEdit, onPatch, onUndo, onSave, versionOf, saveReady, onMarkArchive, personal }) {
|
|
1757
|
+
function SecretRow({ number, project, environment, entry, generated, busy, onRegenerate, rotateAfterDays, change, editing, canWrite, canArchive, canReveal, canList, folders, onMove, lent, environments, status, disabled, onDismiss, columns, onFork, onEdit, onPatch, onUndo, onSave, versionOf, saveReady, onMarkArchive, personal }) {
|
|
1706
1758
|
const [reads, dispatch] = useReducer(rowReads, noReads);
|
|
1707
1759
|
const { reveal, revealing, error, copyError } = reads;
|
|
1708
1760
|
const setReveal = (next) => dispatch({
|
|
@@ -1719,23 +1771,24 @@ function SecretRow({ number, project, environment, entry, generated, busy, onReg
|
|
|
1719
1771
|
const [archiveBlocked, setArchiveBlocked] = useState(false);
|
|
1720
1772
|
const blockers = archiveBlockers(`${project}/${environment}/${entry.key}`, lent);
|
|
1721
1773
|
const { run: act, error: actError } = useAction();
|
|
1774
|
+
const [hiding, setHiding] = useState(false);
|
|
1722
1775
|
const { reference, parent } = entry;
|
|
1723
1776
|
const inherited = parent?.state === "inherited";
|
|
1724
1777
|
const removed = parent?.state === "removed";
|
|
1725
1778
|
const overridden = parent?.state === "overridden";
|
|
1726
1779
|
const own = !inherited && !removed;
|
|
1727
|
-
const
|
|
1728
|
-
const canRead =
|
|
1780
|
+
const sensitive = entry.sensitivity === "sensitive";
|
|
1781
|
+
const canRead = entry.readable;
|
|
1729
1782
|
const readVersion = reference === null ? entry.version : reference.version;
|
|
1730
1783
|
const readFrom = `${inherited ? parent.from : "."}:${reference?.source ?? ""}`;
|
|
1731
1784
|
const holderPath = `${project}/${environment}/${entry.key}`;
|
|
1732
1785
|
const rowPlain = entry.value !== null;
|
|
1733
|
-
const
|
|
1734
|
-
const
|
|
1786
|
+
const rowLevel = entry.sensitivity;
|
|
1787
|
+
const level = change.sensitivity ?? rowLevel ?? "secret";
|
|
1788
|
+
const loosening = !(personal && inherited) && rowLevel !== null && stricter(rowLevel, level);
|
|
1735
1789
|
const from = () => ({
|
|
1736
1790
|
start: editBase?.value ?? "",
|
|
1737
|
-
|
|
1738
|
-
startedAt
|
|
1791
|
+
level: rowLevel
|
|
1739
1792
|
});
|
|
1740
1793
|
const [base, setBase] = useState(null);
|
|
1741
1794
|
const shown = revealIsCurrent(reveal, readVersion, readFrom) ? reveal : null;
|
|
@@ -1809,31 +1862,41 @@ function SecretRow({ number, project, environment, entry, generated, busy, onReg
|
|
|
1809
1862
|
const [focusName, setFocusName] = useState(false);
|
|
1810
1863
|
async function startEdit({ name = false } = {}) {
|
|
1811
1864
|
setFocusName(name);
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1865
|
+
setOpening(entry.value === null && canRead);
|
|
1866
|
+
const value = await valueToEdit(entry, () => readValue({ show: false }));
|
|
1867
|
+
setOpening(false);
|
|
1868
|
+
if (value !== null) setBase({
|
|
1869
|
+
value,
|
|
1815
1870
|
version: readVersion,
|
|
1816
1871
|
from: readFrom,
|
|
1817
1872
|
at: Date.now()
|
|
1818
1873
|
});
|
|
1819
|
-
else if (canRead) {
|
|
1820
|
-
setOpening(true);
|
|
1821
|
-
const value = await readValue({ show: false });
|
|
1822
|
-
setOpening(false);
|
|
1823
|
-
if (value === null) return;
|
|
1824
|
-
setBase({
|
|
1825
|
-
value,
|
|
1826
|
-
version: readVersion,
|
|
1827
|
-
from: readFrom,
|
|
1828
|
-
at: Date.now()
|
|
1829
|
-
});
|
|
1830
|
-
}
|
|
1831
1874
|
setReveal(null);
|
|
1832
1875
|
onEdit();
|
|
1833
1876
|
}
|
|
1877
|
+
function chooseLevel(next) {
|
|
1878
|
+
if (entry.sensitivity === null || next === entry.sensitivity) return;
|
|
1879
|
+
if (stricter(entry.sensitivity, next)) {
|
|
1880
|
+
setFocusName(false);
|
|
1881
|
+
setReveal(null);
|
|
1882
|
+
onEdit();
|
|
1883
|
+
onPatch({ sensitivity: next });
|
|
1884
|
+
} else if (next === "sensitive") setHiding(true);
|
|
1885
|
+
else mark(next);
|
|
1886
|
+
}
|
|
1887
|
+
function mark(next) {
|
|
1888
|
+
setReveal(null);
|
|
1889
|
+
act(() => coffre.secrets.set(`${project}/${environment}`, { [entry.key]: { sensitivity: next } }), {
|
|
1890
|
+
affects: affects.secrets({
|
|
1891
|
+
project,
|
|
1892
|
+
environment
|
|
1893
|
+
}),
|
|
1894
|
+
onSuccess: () => toast.success(`Made ${entry.key} ${next}`)
|
|
1895
|
+
});
|
|
1896
|
+
}
|
|
1834
1897
|
const leaving = change.archived;
|
|
1835
1898
|
const renamed = change.key !== entry.key;
|
|
1836
|
-
const valueChanged = change.value !== null;
|
|
1899
|
+
const valueChanged = change.value !== null || change.sensitivity !== void 0;
|
|
1837
1900
|
const keyProblem = editing ? secretKeyProblem(change.key.trim()) : null;
|
|
1838
1901
|
const state = leaving ? " is-leaving" : editing && (renamed || valueChanged) ? " is-changed" : shown !== null ? " is-revealed" : removed ? " is-removed" : inherited ? " is-inherited" : "";
|
|
1839
1902
|
const version = entry.version ?? 0;
|
|
@@ -1877,9 +1940,17 @@ function SecretRow({ number, project, environment, entry, generated, busy, onReg
|
|
|
1877
1940
|
generated !== null && /* @__PURE__ */ jsx(RecipeMark, { generated }),
|
|
1878
1941
|
rowPlain && /* @__PURE__ */ jsx("span", {
|
|
1879
1942
|
className: "tag",
|
|
1880
|
-
title:
|
|
1943
|
+
title: levelsIn(personal && own).plain.hint,
|
|
1881
1944
|
children: "Plain"
|
|
1882
1945
|
}),
|
|
1946
|
+
sensitive && /* @__PURE__ */ jsxs("span", {
|
|
1947
|
+
className: "tag",
|
|
1948
|
+
title: levelsIn(personal && own).sensitive.hint,
|
|
1949
|
+
children: [/* @__PURE__ */ jsx(Lock, {
|
|
1950
|
+
size: 11,
|
|
1951
|
+
"aria-hidden": true
|
|
1952
|
+
}), "Sensitive"]
|
|
1953
|
+
}),
|
|
1883
1954
|
leaving && /* @__PURE__ */ jsx("span", {
|
|
1884
1955
|
className: "tag tag-red",
|
|
1885
1956
|
children: "Will be archived"
|
|
@@ -1914,13 +1985,20 @@ function SecretRow({ number, project, environment, entry, generated, busy, onReg
|
|
|
1914
1985
|
children: [
|
|
1915
1986
|
/* @__PURE__ */ jsx(ValueField, {
|
|
1916
1987
|
label: `New value for ${entry.key}`,
|
|
1917
|
-
value: change.value ?? editBase?.value ?? "",
|
|
1918
|
-
start: editBase?.value,
|
|
1919
|
-
placeholder:
|
|
1920
|
-
plain:
|
|
1988
|
+
value: change.value ?? (loosening ? "" : editBase?.value ?? ""),
|
|
1989
|
+
start: loosening ? void 0 : editBase?.value,
|
|
1990
|
+
placeholder: loosening ? "Its value, typed again" : editBase !== null ? "Value" : sensitive ? "Type a new value" : error !== null ? "New value; the current one could not be read" : canRead ? "New value" : "New value; the current one is hidden from you",
|
|
1991
|
+
plain: level === "plain",
|
|
1921
1992
|
disabled,
|
|
1922
1993
|
autoFocus: !focusName,
|
|
1923
|
-
onChange: (value) => onPatch(
|
|
1994
|
+
onChange: (value) => onPatch({
|
|
1995
|
+
...valueEdit(from(), {
|
|
1996
|
+
value,
|
|
1997
|
+
sensitivity: level
|
|
1998
|
+
}),
|
|
1999
|
+
companion: void 0,
|
|
2000
|
+
recipe: void 0
|
|
2001
|
+
}),
|
|
1924
2002
|
onEscape: onUndo,
|
|
1925
2003
|
generate: {
|
|
1926
2004
|
name: change.key,
|
|
@@ -1930,18 +2008,29 @@ function SecretRow({ number, project, environment, entry, generated, busy, onReg
|
|
|
1930
2008
|
value,
|
|
1931
2009
|
companion,
|
|
1932
2010
|
recipe,
|
|
1933
|
-
plain:
|
|
2011
|
+
sensitivity: level === "plain" ? "secret" : level
|
|
1934
2012
|
})
|
|
1935
2013
|
}
|
|
1936
2014
|
}),
|
|
1937
|
-
|
|
1938
|
-
|
|
2015
|
+
/* @__PURE__ */ jsx(SensitivityField, {
|
|
2016
|
+
name: change.key.trim() === "" ? entry.key : change.key.trim(),
|
|
2017
|
+
value: level,
|
|
2018
|
+
levels: levelsIn(personal),
|
|
1939
2019
|
disabled,
|
|
1940
|
-
|
|
2020
|
+
onChange: (next) => onPatch({
|
|
2021
|
+
...valueEdit(from(), {
|
|
2022
|
+
value: change.value,
|
|
2023
|
+
sensitivity: next
|
|
2024
|
+
}),
|
|
2025
|
+
...next === "plain" ? {
|
|
2026
|
+
companion: void 0,
|
|
2027
|
+
recipe: void 0
|
|
2028
|
+
} : {}
|
|
2029
|
+
})
|
|
1941
2030
|
}),
|
|
1942
|
-
|
|
2031
|
+
waitsForValue(entry, change) && /* @__PURE__ */ jsx("span", {
|
|
1943
2032
|
className: "edit-note",
|
|
1944
|
-
children: "Type its value: a
|
|
2033
|
+
children: loosening ? "Making it visible takes a new value: type it again." : "Type its value: only a value of its own here is marked."
|
|
1945
2034
|
}),
|
|
1946
2035
|
/* @__PURE__ */ jsx(CompanionNote, {
|
|
1947
2036
|
companion: change.companion,
|
|
@@ -1992,7 +2081,7 @@ function SecretRow({ number, project, environment, entry, generated, busy, onReg
|
|
|
1992
2081
|
children: "Not served here"
|
|
1993
2082
|
}) : reference !== null ? /* @__PURE__ */ jsx(ReferenceValue, { reference }) : /* @__PURE__ */ jsx("span", {
|
|
1994
2083
|
className: "mask",
|
|
1995
|
-
"aria-label": "Hidden",
|
|
2084
|
+
"aria-label": sensitive ? "Never shown" : "Hidden",
|
|
1996
2085
|
children: "••••••••••••"
|
|
1997
2086
|
})
|
|
1998
2087
|
}), status.state !== "pending" && /* @__PURE__ */ jsx("div", {
|
|
@@ -2081,7 +2170,7 @@ function SecretRow({ number, project, environment, entry, generated, busy, onReg
|
|
|
2081
2170
|
}),
|
|
2082
2171
|
/* @__PURE__ */ jsx("td", {
|
|
2083
2172
|
className: "col-actions",
|
|
2084
|
-
children: status.state === "pending" ? /* @__PURE__ */ jsx(RowPending, { status }) : !removed && (
|
|
2173
|
+
children: status.state === "pending" ? /* @__PURE__ */ jsx(RowPending, { status }) : !removed && (canList || canWrite && !editing && !leaving || canArchive && !leaving && own && !overridden) && /* @__PURE__ */ jsxs(Menu.Root, { children: [/* @__PURE__ */ jsx(Menu.Trigger, {
|
|
2085
2174
|
className: "act act-icon act-quiet",
|
|
2086
2175
|
"aria-label": `More for ${entry.key}`,
|
|
2087
2176
|
disabled,
|
|
@@ -2090,7 +2179,7 @@ function SecretRow({ number, project, environment, entry, generated, busy, onReg
|
|
|
2090
2179
|
align: "end",
|
|
2091
2180
|
children: [
|
|
2092
2181
|
/* @__PURE__ */ jsx(SecretReadOnly, {
|
|
2093
|
-
canReveal:
|
|
2182
|
+
canReveal: canList && own,
|
|
2094
2183
|
children: /* @__PURE__ */ jsxs(Menu.Item, {
|
|
2095
2184
|
className: "menu-item",
|
|
2096
2185
|
onClick: () => setHistoryOpen((open) => !open),
|
|
@@ -2153,6 +2242,28 @@ function SecretRow({ number, project, environment, entry, generated, busy, onReg
|
|
|
2153
2242
|
onClick: () => setBreaking(holderPath),
|
|
2154
2243
|
children: [/* @__PURE__ */ jsx(SlashCircle, { size: 14 }), "Break reference…"]
|
|
2155
2244
|
}),
|
|
2245
|
+
canWrite && !editing && !leaving && markable(entry) && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Menu.Separator, { className: "menu-sep" }), /* @__PURE__ */ jsxs(Menu.RadioGroup, {
|
|
2246
|
+
value: entry.sensitivity,
|
|
2247
|
+
onValueChange: (next) => chooseLevel(next),
|
|
2248
|
+
children: [/* @__PURE__ */ jsx(Menu.GroupLabel, {
|
|
2249
|
+
className: "menu-label",
|
|
2250
|
+
children: "Who sees it"
|
|
2251
|
+
}), SENSITIVITIES.map((each) => /* @__PURE__ */ jsxs(Menu.RadioItem, {
|
|
2252
|
+
value: each,
|
|
2253
|
+
className: "menu-item menu-item-level",
|
|
2254
|
+
closeOnClick: true,
|
|
2255
|
+
children: [/* @__PURE__ */ jsxs("span", {
|
|
2256
|
+
className: "menu-item-text",
|
|
2257
|
+
children: [levelsIn(personal)[each].label, /* @__PURE__ */ jsx("span", {
|
|
2258
|
+
className: "menu-item-hint",
|
|
2259
|
+
children: levelsIn(personal)[each].hint
|
|
2260
|
+
})]
|
|
2261
|
+
}), /* @__PURE__ */ jsx(Menu.RadioItemIndicator, {
|
|
2262
|
+
className: "menu-check",
|
|
2263
|
+
children: /* @__PURE__ */ jsx(Check, { size: 14 })
|
|
2264
|
+
})]
|
|
2265
|
+
}, each))]
|
|
2266
|
+
})] }),
|
|
2156
2267
|
canArchive && !leaving && own && !overridden && /* @__PURE__ */ jsxs(Fragment$1, { children: [(canReveal || canWrite) && /* @__PURE__ */ jsx(Menu.Separator, { className: "menu-sep" }), /* @__PURE__ */ jsxs(Menu.Item, {
|
|
2157
2268
|
className: "menu-item menu-item-danger",
|
|
2158
2269
|
onClick: () => {
|
|
@@ -2215,6 +2326,22 @@ function SecretRow({ number, project, environment, entry, generated, busy, onReg
|
|
|
2215
2326
|
confirmDisabled: blockers.length > 0,
|
|
2216
2327
|
onConfirm: onMarkArchive
|
|
2217
2328
|
}),
|
|
2329
|
+
/* @__PURE__ */ jsx(ConfirmDialog, {
|
|
2330
|
+
open: hiding,
|
|
2331
|
+
onOpenChange: setHiding,
|
|
2332
|
+
title: /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
2333
|
+
"Make ",
|
|
2334
|
+
/* @__PURE__ */ jsx("span", {
|
|
2335
|
+
className: "mono",
|
|
2336
|
+
children: entry.key
|
|
2337
|
+
}),
|
|
2338
|
+
" sensitive?"
|
|
2339
|
+
] }),
|
|
2340
|
+
body: "Nobody, Owners included, will see this value again. Apps use it through the proxy; service accounts still read it.",
|
|
2341
|
+
confirmLabel: "Make sensitive",
|
|
2342
|
+
destructive: false,
|
|
2343
|
+
onConfirm: () => mark("sensitive")
|
|
2344
|
+
}),
|
|
2218
2345
|
/* @__PURE__ */ jsx(ConfirmDialog, {
|
|
2219
2346
|
open: breaking !== null,
|
|
2220
2347
|
onOpenChange: (open) => !open && setBreaking(null),
|
|
@@ -2250,7 +2377,7 @@ function SecretRow({ number, project, environment, entry, generated, busy, onReg
|
|
|
2250
2377
|
folders,
|
|
2251
2378
|
onMove
|
|
2252
2379
|
}),
|
|
2253
|
-
historyOpen &&
|
|
2380
|
+
historyOpen && canList && /* @__PURE__ */ jsx("tr", {
|
|
2254
2381
|
className: "detail-row",
|
|
2255
2382
|
children: /* @__PURE__ */ jsx("td", {
|
|
2256
2383
|
colSpan: columns,
|
|
@@ -2414,12 +2541,7 @@ function Standing({ project, secretKey, parent }) {
|
|
|
2414
2541
|
});
|
|
2415
2542
|
case "removed": return /* @__PURE__ */ jsxs("span", {
|
|
2416
2543
|
className: "tag tag-outline",
|
|
2417
|
-
children: [
|
|
2418
|
-
"removed · ",
|
|
2419
|
-
from,
|
|
2420
|
-
" ",
|
|
2421
|
-
parent.held ? "has it" : "dropped it"
|
|
2422
|
-
]
|
|
2544
|
+
children: ["removed here · ", parent.held ? /* @__PURE__ */ jsxs(Fragment$1, { children: ["not inherited from ", from] }) : /* @__PURE__ */ jsxs(Fragment$1, { children: [from, " dropped it too"] })]
|
|
2423
2545
|
});
|
|
2424
2546
|
case "overridden": return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs("span", {
|
|
2425
2547
|
className: "tag tag-outline",
|
|
@@ -2513,35 +2635,46 @@ function Written({ entry, rotateAfterDays }) {
|
|
|
2513
2635
|
});
|
|
2514
2636
|
}
|
|
2515
2637
|
/**
|
|
2638
|
+
* Who sees the value being written, loosest first, and beside it what the
|
|
2639
|
+
* level pointed at, or else the one chosen, means. Native radios: the arrow
|
|
2640
|
+
* keys move the choice, and a screen reader hears one group of three.
|
|
2641
|
+
*/
|
|
2642
|
+
function SensitivityField({ name, value, levels, disabled, onChange }) {
|
|
2643
|
+
const id = useId();
|
|
2644
|
+
const [pointed, setPointed] = useState(null);
|
|
2645
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
2646
|
+
className: "edit-note sensitivity-field",
|
|
2647
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
2648
|
+
className: "segmented segmented-sm",
|
|
2649
|
+
role: "radiogroup",
|
|
2650
|
+
"aria-label": `Who sees ${name}`,
|
|
2651
|
+
"aria-describedby": `${id}-hint`,
|
|
2652
|
+
children: SENSITIVITIES.map((level) => /* @__PURE__ */ jsxs("label", {
|
|
2653
|
+
onPointerEnter: () => setPointed(level),
|
|
2654
|
+
onPointerLeave: () => setPointed(null),
|
|
2655
|
+
children: [/* @__PURE__ */ jsx("input", {
|
|
2656
|
+
type: "radio",
|
|
2657
|
+
className: "visually-hidden",
|
|
2658
|
+
name: id,
|
|
2659
|
+
value: level,
|
|
2660
|
+
checked: value === level,
|
|
2661
|
+
disabled,
|
|
2662
|
+
onChange: () => onChange(level)
|
|
2663
|
+
}), levels[level].label]
|
|
2664
|
+
}, level))
|
|
2665
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
2666
|
+
id: `${id}-hint`,
|
|
2667
|
+
children: levels[pointed ?? value].hint
|
|
2668
|
+
})]
|
|
2669
|
+
});
|
|
2670
|
+
}
|
|
2671
|
+
/**
|
|
2516
2672
|
* A secret being typed, sitting in the table where it will end up.
|
|
2517
2673
|
*
|
|
2518
2674
|
* This replaced a separate "Add a secret" form. The form made you look away
|
|
2519
2675
|
* from the list to add to it, and only ever accepted one key at a time; a row
|
|
2520
2676
|
* in place accepts as many as you want to queue.
|
|
2521
2677
|
*/
|
|
2522
|
-
/**
|
|
2523
|
-
* Whether the value being written is plain, no secret: an account's id,
|
|
2524
|
-
* which whoever reads the environment then sees as it is, and its apps get
|
|
2525
|
-
* as it is under stand-ins. Off, it is a secret, as every value is unless
|
|
2526
|
-
* this says otherwise.
|
|
2527
|
-
*/
|
|
2528
|
-
function PlainToggle({ plain, disabled, onToggle }) {
|
|
2529
|
-
return /* @__PURE__ */ jsxs("span", {
|
|
2530
|
-
className: "edit-note",
|
|
2531
|
-
children: [/* @__PURE__ */ jsxs("button", {
|
|
2532
|
-
type: "button",
|
|
2533
|
-
className: "act plain-toggle",
|
|
2534
|
-
"aria-pressed": plain,
|
|
2535
|
-
disabled,
|
|
2536
|
-
onClick: onToggle,
|
|
2537
|
-
children: [/* @__PURE__ */ jsx("span", {
|
|
2538
|
-
className: "plain-toggle-box",
|
|
2539
|
-
"aria-hidden": true,
|
|
2540
|
-
children: plain && /* @__PURE__ */ jsx(Check, { size: 11 })
|
|
2541
|
-
}), "Plain value"]
|
|
2542
|
-
}), plain && "shown to whoever reads this environment"]
|
|
2543
|
-
});
|
|
2544
|
-
}
|
|
2545
2678
|
function DraftRow({ draft, existingVersion, disabled, onChange, onRemove, onSave, versionOf, saveReady, personal }) {
|
|
2546
2679
|
const [touched, setTouched] = useState(false);
|
|
2547
2680
|
const trimmed = draft.key.trim();
|
|
@@ -2593,7 +2726,7 @@ function DraftRow({ draft, existingVersion, disabled, onChange, onRemove, onSave
|
|
|
2593
2726
|
/* @__PURE__ */ jsx(ValueField, {
|
|
2594
2727
|
label: `Value for ${trimmed === "" ? "the new secret" : trimmed}`,
|
|
2595
2728
|
value: draft.value,
|
|
2596
|
-
plain: draft.
|
|
2729
|
+
plain: draft.sensitivity === "plain",
|
|
2597
2730
|
placeholder: "Value",
|
|
2598
2731
|
disabled,
|
|
2599
2732
|
onChange: (value) => onChange({
|
|
@@ -2611,18 +2744,20 @@ function DraftRow({ draft, existingVersion, disabled, onChange, onRemove, onSave
|
|
|
2611
2744
|
value,
|
|
2612
2745
|
companion,
|
|
2613
2746
|
recipe,
|
|
2614
|
-
plain:
|
|
2747
|
+
sensitivity: draft.sensitivity === "plain" ? "secret" : draft.sensitivity
|
|
2615
2748
|
})
|
|
2616
2749
|
}
|
|
2617
2750
|
}),
|
|
2618
|
-
|
|
2619
|
-
|
|
2751
|
+
/* @__PURE__ */ jsx(SensitivityField, {
|
|
2752
|
+
name: trimmed === "" ? "the new secret" : trimmed,
|
|
2753
|
+
value: draft.sensitivity,
|
|
2754
|
+
levels: levelsIn(personal),
|
|
2620
2755
|
disabled,
|
|
2621
|
-
|
|
2622
|
-
|
|
2756
|
+
onChange: (sensitivity) => onChange(sensitivity === "plain" ? {
|
|
2757
|
+
sensitivity,
|
|
2623
2758
|
companion: void 0,
|
|
2624
2759
|
recipe: void 0
|
|
2625
|
-
})
|
|
2760
|
+
} : { sensitivity })
|
|
2626
2761
|
}),
|
|
2627
2762
|
/* @__PURE__ */ jsx(CompanionNote, {
|
|
2628
2763
|
companion: draft.companion,
|
|
@@ -2678,7 +2813,7 @@ function DraftRow({ draft, existingVersion, disabled, onChange, onRemove, onSave
|
|
|
2678
2813
|
]
|
|
2679
2814
|
});
|
|
2680
2815
|
}
|
|
2681
|
-
function ArchivedRow({ number, project, environment, entry, canArchive,
|
|
2816
|
+
function ArchivedRow({ number, project, environment, entry, canArchive, canList, status: state, onRestore, onDismiss }) {
|
|
2682
2817
|
const [historyOpen, setHistoryOpen] = useState(false);
|
|
2683
2818
|
return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
2684
2819
|
/* @__PURE__ */ jsxs("tr", {
|
|
@@ -2711,7 +2846,7 @@ function ArchivedRow({ number, project, environment, entry, canArchive, canRevea
|
|
|
2711
2846
|
}),
|
|
2712
2847
|
/* @__PURE__ */ jsx("td", {
|
|
2713
2848
|
className: "col-actions",
|
|
2714
|
-
children: state.state === "pending" ? /* @__PURE__ */ jsx(RowPending, { status: state }) : (
|
|
2849
|
+
children: state.state === "pending" ? /* @__PURE__ */ jsx(RowPending, { status: state }) : (canList || canArchive) && /* @__PURE__ */ jsx("div", {
|
|
2715
2850
|
className: "acts",
|
|
2716
2851
|
children: /* @__PURE__ */ jsxs(Menu.Root, { children: [/* @__PURE__ */ jsx(Menu.Trigger, {
|
|
2717
2852
|
className: "act act-icon act-quiet",
|
|
@@ -2720,13 +2855,13 @@ function ArchivedRow({ number, project, environment, entry, canArchive, canRevea
|
|
|
2720
2855
|
}), /* @__PURE__ */ jsxs(MenuPopup, {
|
|
2721
2856
|
align: "end",
|
|
2722
2857
|
children: [/* @__PURE__ */ jsx(SecretReadOnly, {
|
|
2723
|
-
canReveal,
|
|
2858
|
+
canReveal: canList,
|
|
2724
2859
|
children: /* @__PURE__ */ jsxs(Menu.Item, {
|
|
2725
2860
|
className: "menu-item",
|
|
2726
2861
|
onClick: () => setHistoryOpen((open) => !open),
|
|
2727
2862
|
children: [/* @__PURE__ */ jsx(History, { size: 14 }), historyOpen ? "Hide history" : "Version history"]
|
|
2728
2863
|
})
|
|
2729
|
-
}), canArchive && /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
2864
|
+
}), canArchive && /* @__PURE__ */ jsxs(Fragment$1, { children: [canList && /* @__PURE__ */ jsx(Menu.Separator, { className: "menu-sep" }), /* @__PURE__ */ jsxs(Menu.Item, {
|
|
2730
2865
|
className: "menu-item",
|
|
2731
2866
|
onClick: onRestore,
|
|
2732
2867
|
children: [/* @__PURE__ */ jsx(RotateBack, { size: 14 }), "Restore"]
|
|
@@ -2845,7 +2980,12 @@ function VersionHistory({ project, environment, secretKey, currentVersion, canWr
|
|
|
2845
2980
|
version.current && /* @__PURE__ */ jsx("span", {
|
|
2846
2981
|
className: "tag tag-blue",
|
|
2847
2982
|
children: "Current"
|
|
2848
|
-
})
|
|
2983
|
+
}),
|
|
2984
|
+
version.sensitivity !== "secret" && /* @__PURE__ */ jsxs(Fragment$1, { children: [" ", /* @__PURE__ */ jsx("span", {
|
|
2985
|
+
className: "tag",
|
|
2986
|
+
title: LEVELS[version.sensitivity].hint,
|
|
2987
|
+
children: LEVELS[version.sensitivity].label
|
|
2988
|
+
})] })
|
|
2849
2989
|
]
|
|
2850
2990
|
}),
|
|
2851
2991
|
/* @__PURE__ */ jsx("td", {
|