mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-08 15:28:25 +00:00
Update SecretListView.tsx
This commit is contained in:
+15
-12
@@ -85,6 +85,7 @@ export const SecretListView = ({
|
|||||||
type: SecretType,
|
type: SecretType,
|
||||||
key: string,
|
key: string,
|
||||||
{
|
{
|
||||||
|
secretValueHidden,
|
||||||
value,
|
value,
|
||||||
comment,
|
comment,
|
||||||
reminderRepeatDays,
|
reminderRepeatDays,
|
||||||
@@ -97,6 +98,7 @@ export const SecretListView = ({
|
|||||||
secretMetadata,
|
secretMetadata,
|
||||||
isRotatedSecret
|
isRotatedSecret
|
||||||
}: Partial<{
|
}: Partial<{
|
||||||
|
secretValueHidden: boolean;
|
||||||
value: string;
|
value: string;
|
||||||
comment: string;
|
comment: string;
|
||||||
reminderRepeatDays: number | null;
|
reminderRepeatDays: number | null;
|
||||||
@@ -123,6 +125,15 @@ export const SecretListView = ({
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (operation === "update") {
|
if (operation === "update") {
|
||||||
|
let secretValue = value;
|
||||||
|
|
||||||
|
if (
|
||||||
|
secretValueHidden &&
|
||||||
|
(value === HIDDEN_SECRET_VALUE_API_MASK || value === HIDDEN_SECRET_VALUE)
|
||||||
|
) {
|
||||||
|
secretValue = undefined;
|
||||||
|
}
|
||||||
|
|
||||||
await updateSecretV3({
|
await updateSecretV3({
|
||||||
environment,
|
environment,
|
||||||
workspaceId,
|
workspaceId,
|
||||||
@@ -130,7 +141,7 @@ export const SecretListView = ({
|
|||||||
secretKey: key,
|
secretKey: key,
|
||||||
...(!isRotatedSecret && {
|
...(!isRotatedSecret && {
|
||||||
newSecretName: newKey,
|
newSecretName: newKey,
|
||||||
secretValue: value || ""
|
secretValue: secretValueHidden ? secretValue : secretValue || ""
|
||||||
}),
|
}),
|
||||||
type,
|
type,
|
||||||
tagIds: tags,
|
tagIds: tags,
|
||||||
@@ -235,17 +246,8 @@ export const SecretListView = ({
|
|||||||
|
|
||||||
// shared secret change
|
// shared secret change
|
||||||
if (!isSharedSecUnchanged && !personalAction) {
|
if (!isSharedSecUnchanged && !personalAction) {
|
||||||
let secretValue = value;
|
|
||||||
|
|
||||||
if (
|
|
||||||
secretValueHidden &&
|
|
||||||
(value === HIDDEN_SECRET_VALUE_API_MASK || value === HIDDEN_SECRET_VALUE)
|
|
||||||
) {
|
|
||||||
secretValue = undefined;
|
|
||||||
}
|
|
||||||
|
|
||||||
await handleSecretOperation("update", SecretType.Shared, oldKey, {
|
await handleSecretOperation("update", SecretType.Shared, oldKey, {
|
||||||
value: secretValue,
|
value,
|
||||||
tags: tagIds,
|
tags: tagIds,
|
||||||
comment,
|
comment,
|
||||||
reminderRepeatDays,
|
reminderRepeatDays,
|
||||||
@@ -255,7 +257,8 @@ export const SecretListView = ({
|
|||||||
newKey: hasKeyChanged ? key : undefined,
|
newKey: hasKeyChanged ? key : undefined,
|
||||||
skipMultilineEncoding: modSecret.skipMultilineEncoding,
|
skipMultilineEncoding: modSecret.skipMultilineEncoding,
|
||||||
secretMetadata,
|
secretMetadata,
|
||||||
isRotatedSecret: orgSecret.isRotatedSecret
|
isRotatedSecret: orgSecret.isRotatedSecret,
|
||||||
|
secretValueHidden
|
||||||
});
|
});
|
||||||
if (cb) cb();
|
if (cb) cb();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user