mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-15 12:38:36 +00:00
Merge remote-tracking branch 'origin/main' into feat/add-render-app-connection-and-secret-sync
This commit is contained in:
+14
@@ -0,0 +1,14 @@
|
||||
import { TFlyioSync } from "@app/hooks/api/secretSyncs/types/flyio-sync";
|
||||
|
||||
import { getSecretSyncDestinationColValues } from "../helpers";
|
||||
import { SecretSyncTableCell } from "../SecretSyncTableCell";
|
||||
|
||||
type Props = {
|
||||
secretSync: TFlyioSync;
|
||||
};
|
||||
|
||||
export const FlyioSyncDestinationCol = ({ secretSync }: Props) => {
|
||||
const { primaryText, secondaryText } = getSecretSyncDestinationColValues(secretSync);
|
||||
|
||||
return <SecretSyncTableCell primaryText={primaryText} secondaryText={secondaryText} />;
|
||||
};
|
||||
+3
@@ -8,6 +8,7 @@ import { AzureDevOpsSyncDestinationCol } from "./AzureDevOpsSyncDestinationCol";
|
||||
import { AzureKeyVaultDestinationSyncCol } from "./AzureKeyVaultDestinationSyncCol";
|
||||
import { CamundaSyncDestinationCol } from "./CamundaSyncDestinationCol";
|
||||
import { DatabricksSyncDestinationCol } from "./DatabricksSyncDestinationCol";
|
||||
import { FlyioSyncDestinationCol } from "./FlyioSyncDestinationCol";
|
||||
import { GcpSyncDestinationCol } from "./GcpSyncDestinationCol";
|
||||
import { GitHubSyncDestinationCol } from "./GitHubSyncDestinationCol";
|
||||
import { HCVaultSyncDestinationCol } from "./HCVaultSyncDestinationCol";
|
||||
@@ -61,6 +62,8 @@ export const SecretSyncDestinationCol = ({ secretSync }: Props) => {
|
||||
return <AzureDevOpsSyncDestinationCol secretSync={secretSync} />;
|
||||
case SecretSync.Render:
|
||||
return <RenderSyncDestinationCol secretSync={secretSync} />;
|
||||
case SecretSync.Flyio:
|
||||
return <FlyioSyncDestinationCol secretSync={secretSync} />;
|
||||
default:
|
||||
throw new Error(
|
||||
`Unhandled Secret Sync Destination Col: ${(secretSync as TSecretSync).destination}`
|
||||
|
||||
+14
-5
@@ -1,4 +1,5 @@
|
||||
import { useCallback, useMemo } from "react";
|
||||
import { subject } from "@casl/ability";
|
||||
import {
|
||||
faBan,
|
||||
faCalendarCheck,
|
||||
@@ -117,6 +118,14 @@ export const SecretSyncRow = ({
|
||||
|
||||
const destinationDetails = SECRET_SYNC_MAP[destination];
|
||||
|
||||
const permissionSubject =
|
||||
environment && folder
|
||||
? subject(ProjectPermissionSub.SecretSyncs, {
|
||||
environment: environment.slug,
|
||||
secretPath: folder.path
|
||||
})
|
||||
: ProjectPermissionSub.SecretSyncs;
|
||||
|
||||
return (
|
||||
<Tr
|
||||
onClick={() =>
|
||||
@@ -264,7 +273,7 @@ export const SecretSyncRow = ({
|
||||
</DropdownMenuItem>
|
||||
<ProjectPermissionCan
|
||||
I={ProjectPermissionSecretSyncActions.SyncSecrets}
|
||||
a={ProjectPermissionSub.SecretSyncs}
|
||||
a={permissionSubject}
|
||||
>
|
||||
{(isAllowed: boolean) => (
|
||||
<DropdownMenuItem
|
||||
@@ -295,7 +304,7 @@ export const SecretSyncRow = ({
|
||||
{syncOption?.canImportSecrets && (
|
||||
<ProjectPermissionCan
|
||||
I={ProjectPermissionSecretSyncActions.ImportSecrets}
|
||||
a={ProjectPermissionSub.SecretSyncs}
|
||||
a={permissionSubject}
|
||||
>
|
||||
{(isAllowed: boolean) => (
|
||||
<DropdownMenuItem
|
||||
@@ -326,7 +335,7 @@ export const SecretSyncRow = ({
|
||||
)}
|
||||
<ProjectPermissionCan
|
||||
I={ProjectPermissionSecretSyncActions.RemoveSecrets}
|
||||
a={ProjectPermissionSub.SecretSyncs}
|
||||
a={permissionSubject}
|
||||
>
|
||||
{(isAllowed: boolean) => (
|
||||
<DropdownMenuItem
|
||||
@@ -356,7 +365,7 @@ export const SecretSyncRow = ({
|
||||
</ProjectPermissionCan>
|
||||
<ProjectPermissionCan
|
||||
I={ProjectPermissionSecretSyncActions.Edit}
|
||||
a={ProjectPermissionSub.SecretSyncs}
|
||||
a={permissionSubject}
|
||||
>
|
||||
{(isAllowed: boolean) => (
|
||||
<DropdownMenuItem
|
||||
@@ -373,7 +382,7 @@ export const SecretSyncRow = ({
|
||||
</ProjectPermissionCan>
|
||||
<ProjectPermissionCan
|
||||
I={ProjectPermissionSecretSyncActions.Delete}
|
||||
a={ProjectPermissionSub.SecretSyncs}
|
||||
a={permissionSubject}
|
||||
>
|
||||
{(isAllowed: boolean) => (
|
||||
<DropdownMenuItem
|
||||
|
||||
+4
@@ -120,6 +120,10 @@ export const getSecretSyncDestinationColValues = (secretSync: TSecretSync) => {
|
||||
primaryText = destinationConfig.serviceName ?? destinationConfig.serviceId;
|
||||
secondaryText = "Service";
|
||||
break;
|
||||
case SecretSync.Flyio:
|
||||
primaryText = destinationConfig.appId;
|
||||
secondaryText = "App ID";
|
||||
break;
|
||||
default:
|
||||
throw new Error(`Unhandled Destination Col Values ${destination}`);
|
||||
}
|
||||
|
||||
@@ -96,6 +96,10 @@ import { SecretOverviewSecretRotationRow } from "@app/pages/secret-manager/Overv
|
||||
|
||||
import { CreateDynamicSecretForm } from "../SecretDashboardPage/components/ActionBar/CreateDynamicSecretForm";
|
||||
import { FolderForm } from "../SecretDashboardPage/components/ActionBar/FolderForm";
|
||||
import {
|
||||
HIDDEN_SECRET_VALUE,
|
||||
HIDDEN_SECRET_VALUE_API_MASK
|
||||
} from "../SecretDashboardPage/components/SecretListView/SecretItem";
|
||||
import { CreateSecretForm } from "./components/CreateSecretForm";
|
||||
import { FolderBreadCrumbs } from "./components/FolderBreadCrumbs";
|
||||
import { SecretOverviewDynamicSecretRow } from "./components/SecretOverviewDynamicSecretRow";
|
||||
@@ -509,15 +513,25 @@ export const OverviewPage = () => {
|
||||
env: string,
|
||||
key: string,
|
||||
value: string,
|
||||
secretValueHidden: boolean,
|
||||
type = SecretType.Shared
|
||||
) => {
|
||||
let secretValue: string | undefined = value;
|
||||
|
||||
if (
|
||||
secretValueHidden &&
|
||||
(value === HIDDEN_SECRET_VALUE_API_MASK || value === HIDDEN_SECRET_VALUE)
|
||||
) {
|
||||
secretValue = undefined;
|
||||
}
|
||||
|
||||
try {
|
||||
const result = await updateSecretV3({
|
||||
environment: env,
|
||||
workspaceId,
|
||||
secretPath,
|
||||
secretKey: key,
|
||||
secretValue: value,
|
||||
secretValue,
|
||||
type
|
||||
});
|
||||
|
||||
|
||||
+4
-1
@@ -50,6 +50,7 @@ type Props = {
|
||||
env: string,
|
||||
key: string,
|
||||
value: string,
|
||||
secretValueHidden: boolean,
|
||||
type?: SecretType,
|
||||
secretId?: string
|
||||
) => Promise<void>;
|
||||
@@ -147,6 +148,7 @@ export const SecretEditRow = ({
|
||||
environment,
|
||||
secretName,
|
||||
value,
|
||||
secretValueHidden,
|
||||
isOverride ? SecretType.Personal : SecretType.Shared,
|
||||
secretId
|
||||
);
|
||||
@@ -166,6 +168,7 @@ export const SecretEditRow = ({
|
||||
environment,
|
||||
secretName,
|
||||
secretValue,
|
||||
secretValueHidden,
|
||||
isOverride ? SecretType.Personal : SecretType.Shared,
|
||||
secretId
|
||||
);
|
||||
@@ -257,7 +260,7 @@ export const SecretEditRow = ({
|
||||
>
|
||||
{(isAllowed) => (
|
||||
<div>
|
||||
<Tooltip content="save">
|
||||
<Tooltip content="Save">
|
||||
<IconButton
|
||||
variant="plain"
|
||||
ariaLabel="submit-value"
|
||||
|
||||
+3
-1
@@ -24,6 +24,7 @@ import { useToggle } from "@app/hooks";
|
||||
import { SecretType, SecretV3RawSanitized } from "@app/hooks/api/secrets/types";
|
||||
import { WorkspaceEnv } from "@app/hooks/api/types";
|
||||
import { getExpandedRowStyle } from "@app/pages/secret-manager/OverviewPage/components/utils";
|
||||
import { HIDDEN_SECRET_VALUE } from "@app/pages/secret-manager/SecretDashboardPage/components/SecretListView/SecretItem";
|
||||
|
||||
import { SecretEditRow } from "./SecretEditRow";
|
||||
import SecretRenameRow from "./SecretRenameRow";
|
||||
@@ -40,6 +41,7 @@ type Props = {
|
||||
env: string,
|
||||
key: string,
|
||||
value: string,
|
||||
secretValueHidden: boolean,
|
||||
type?: SecretType,
|
||||
secretId?: string
|
||||
) => Promise<void>;
|
||||
@@ -96,7 +98,7 @@ export const SecretOverviewTableRow = ({
|
||||
);
|
||||
|
||||
if (secret?.secretValueHidden && !secret?.valueOverride) {
|
||||
return canEditSecretValue ? "******" : "";
|
||||
return canEditSecretValue ? HIDDEN_SECRET_VALUE : "";
|
||||
}
|
||||
return secret?.valueOverride || secret?.value || importedSecret?.secret?.value || "";
|
||||
};
|
||||
|
||||
+61
-20
@@ -11,6 +11,7 @@ import {
|
||||
faKey
|
||||
} from "@fortawesome/free-solid-svg-icons";
|
||||
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
||||
import { twMerge } from "tailwind-merge";
|
||||
|
||||
import { SecretInput, Tag, Tooltip } from "@app/components/v2";
|
||||
import { CommitType, SecretV3Raw, TSecretApprovalSecChange, WsTag } from "@app/hooks/api/types";
|
||||
@@ -105,21 +106,41 @@ export const SecretApprovalRequestChangeItem = ({
|
||||
</span>
|
||||
) : (
|
||||
<div className="relative">
|
||||
{secretVersion?.secretValueHidden && (
|
||||
<div className="absolute left-1 top-1/2 z-50 -translate-y-1/2">
|
||||
<Tooltip
|
||||
position="right"
|
||||
content="You do not have access to view the old secret value."
|
||||
>
|
||||
<FontAwesomeIcon
|
||||
className="pl-2 text-mineshaft-300"
|
||||
size="sm"
|
||||
icon={faEyeSlash}
|
||||
/>
|
||||
</Tooltip>
|
||||
</div>
|
||||
)}
|
||||
<SecretInput
|
||||
isReadOnly
|
||||
isVisible={isOldSecretValueVisible}
|
||||
valueAlwaysHidden={secretVersion?.secretValueHidden}
|
||||
value={secretVersion?.secretValue}
|
||||
containerClassName="text-bunker-300 hover:border-primary-400/50 border border-mineshaft-600 bg-bunker-700 px-2 py-1.5"
|
||||
containerClassName={twMerge(
|
||||
"border border-mineshaft-600 bg-bunker-700 py-1.5 text-bunker-300 hover:border-primary-400/50",
|
||||
secretVersion?.secretValueHidden ? "pl-8 pr-2" : "px-2"
|
||||
)}
|
||||
/>
|
||||
<div
|
||||
className="absolute right-1 top-1"
|
||||
onClick={() => setIsOldSecretValueVisible(!isOldSecretValueVisible)}
|
||||
>
|
||||
<FontAwesomeIcon
|
||||
icon={isOldSecretValueVisible ? faEyeSlash : faEye}
|
||||
className="cursor-pointer rounded-md border border-mineshaft-500 bg-mineshaft-800 p-1.5 text-mineshaft-300 hover:bg-mineshaft-700"
|
||||
/>
|
||||
</div>
|
||||
{!secretVersion?.secretValueHidden && (
|
||||
<div
|
||||
className="absolute right-1 top-1"
|
||||
onClick={() => setIsOldSecretValueVisible(!isOldSecretValueVisible)}
|
||||
>
|
||||
<FontAwesomeIcon
|
||||
icon={isOldSecretValueVisible ? faEyeSlash : faEye}
|
||||
className="cursor-pointer rounded-md border border-mineshaft-500 bg-mineshaft-800 p-1.5 text-mineshaft-300 hover:bg-mineshaft-700"
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
@@ -211,21 +232,41 @@ export const SecretApprovalRequestChangeItem = ({
|
||||
</span>
|
||||
) : (
|
||||
<div className="relative">
|
||||
{newVersion?.secretValueHidden && (
|
||||
<div className="absolute left-1 top-1/2 z-50 -translate-y-1/2">
|
||||
<Tooltip
|
||||
position="right"
|
||||
content="You do not have access to view the new secret value."
|
||||
>
|
||||
<FontAwesomeIcon
|
||||
className="pl-2 text-mineshaft-300"
|
||||
size="sm"
|
||||
icon={faEyeSlash}
|
||||
/>
|
||||
</Tooltip>
|
||||
</div>
|
||||
)}
|
||||
<SecretInput
|
||||
isReadOnly
|
||||
valueAlwaysHidden={newVersion?.secretValueHidden}
|
||||
isVisible={isNewSecretValueVisible}
|
||||
value={newVersion?.secretValue}
|
||||
containerClassName="text-bunker-300 hover:border-primary-400/50 border border-mineshaft-600 bg-bunker-700 px-2 py-1.5"
|
||||
containerClassName={twMerge(
|
||||
"border border-mineshaft-600 bg-bunker-700 py-1.5 text-bunker-300 hover:border-primary-400/50",
|
||||
newVersion?.secretValueHidden ? "pl-8 pr-2" : "px-2"
|
||||
)}
|
||||
/>
|
||||
<div
|
||||
className="absolute right-1 top-1"
|
||||
onClick={() => setIsNewSecretValueVisible(!isNewSecretValueVisible)}
|
||||
>
|
||||
<FontAwesomeIcon
|
||||
icon={isNewSecretValueVisible ? faEyeSlash : faEye}
|
||||
className="cursor-pointer rounded-md border border-mineshaft-500 bg-mineshaft-800 p-1.5 text-mineshaft-300 hover:bg-mineshaft-700"
|
||||
/>
|
||||
</div>
|
||||
{!newVersion?.secretValueHidden && (
|
||||
<div
|
||||
className="absolute right-1 top-1"
|
||||
onClick={() => setIsNewSecretValueVisible(!isNewSecretValueVisible)}
|
||||
>
|
||||
<FontAwesomeIcon
|
||||
icon={isNewSecretValueVisible ? faEyeSlash : faEye}
|
||||
className="cursor-pointer rounded-md border border-mineshaft-500 bg-mineshaft-800 p-1.5 text-mineshaft-300 hover:bg-mineshaft-700"
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
+4
-1
@@ -62,6 +62,7 @@ import { hasSecretReadValueOrDescribePermission } from "@app/lib/fn/permission";
|
||||
import { camelCaseToSpaces } from "@app/lib/fn/string";
|
||||
|
||||
import { CreateReminderForm } from "./CreateReminderForm";
|
||||
import { HIDDEN_SECRET_VALUE } from "./SecretItem";
|
||||
import { formSchema, SecretActionType, TFormSchema } from "./SecretListView.utils";
|
||||
|
||||
type Props = {
|
||||
@@ -897,7 +898,9 @@ export const SecretDetailSidebar = ({
|
||||
</button>
|
||||
</div>
|
||||
<span className="group-[.show-value]:hidden">
|
||||
{secretValueHidden ? "******" : secretValue?.replace(/./g, "*")}
|
||||
{secretValueHidden
|
||||
? HIDDEN_SECRET_VALUE
|
||||
: secretValue?.replace(/./g, "*")}
|
||||
<button
|
||||
type="button"
|
||||
className="ml-1 cursor-pointer"
|
||||
|
||||
+1
@@ -59,6 +59,7 @@ import {
|
||||
import { CollapsibleSecretImports } from "./CollapsibleSecretImports";
|
||||
|
||||
export const HIDDEN_SECRET_VALUE = "******";
|
||||
export const HIDDEN_SECRET_VALUE_API_MASK = "<hidden-by-infisical>";
|
||||
|
||||
type Props = {
|
||||
secret: SecretV3RawSanitized;
|
||||
|
||||
+16
-4
@@ -20,7 +20,7 @@ import { AddShareSecretModal } from "@app/pages/organization/SecretSharingPage/c
|
||||
import { useSelectedSecretActions, useSelectedSecrets } from "../../SecretMainPage.store";
|
||||
import { CollapsibleSecretImports } from "./CollapsibleSecretImports";
|
||||
import { SecretDetailSidebar } from "./SecretDetailSidebar";
|
||||
import { SecretItem } from "./SecretItem";
|
||||
import { HIDDEN_SECRET_VALUE, HIDDEN_SECRET_VALUE_API_MASK, SecretItem } from "./SecretItem";
|
||||
import { FontAwesomeSpriteSymbols } from "./SecretListView.utils";
|
||||
|
||||
type Props = {
|
||||
@@ -85,6 +85,7 @@ export const SecretListView = ({
|
||||
type: SecretType,
|
||||
key: string,
|
||||
{
|
||||
secretValueHidden,
|
||||
value,
|
||||
comment,
|
||||
reminderRepeatDays,
|
||||
@@ -97,6 +98,7 @@ export const SecretListView = ({
|
||||
secretMetadata,
|
||||
isRotatedSecret
|
||||
}: Partial<{
|
||||
secretValueHidden: boolean;
|
||||
value: string;
|
||||
comment: string;
|
||||
reminderRepeatDays: number | null;
|
||||
@@ -123,6 +125,15 @@ export const SecretListView = ({
|
||||
}
|
||||
|
||||
if (operation === "update") {
|
||||
let secretValue = value;
|
||||
|
||||
if (
|
||||
secretValueHidden &&
|
||||
(value === HIDDEN_SECRET_VALUE_API_MASK || value === HIDDEN_SECRET_VALUE)
|
||||
) {
|
||||
secretValue = undefined;
|
||||
}
|
||||
|
||||
await updateSecretV3({
|
||||
environment,
|
||||
workspaceId,
|
||||
@@ -130,7 +141,7 @@ export const SecretListView = ({
|
||||
secretKey: key,
|
||||
...(!isRotatedSecret && {
|
||||
newSecretName: newKey,
|
||||
secretValue: value || ""
|
||||
secretValue: secretValueHidden ? secretValue : secretValue || ""
|
||||
}),
|
||||
type,
|
||||
tagIds: tags,
|
||||
@@ -168,7 +179,7 @@ export const SecretListView = ({
|
||||
},
|
||||
cb?: () => void
|
||||
) => {
|
||||
const { key: oldKey } = orgSecret;
|
||||
const { key: oldKey, secretValueHidden } = orgSecret;
|
||||
const {
|
||||
key,
|
||||
value,
|
||||
@@ -246,7 +257,8 @@ export const SecretListView = ({
|
||||
newKey: hasKeyChanged ? key : undefined,
|
||||
skipMultilineEncoding: modSecret.skipMultilineEncoding,
|
||||
secretMetadata,
|
||||
isRotatedSecret: orgSecret.isRotatedSecret
|
||||
isRotatedSecret: orgSecret.isRotatedSecret,
|
||||
secretValueHidden
|
||||
});
|
||||
if (cb) cb();
|
||||
}
|
||||
|
||||
+15
-6
@@ -1,4 +1,5 @@
|
||||
import { useCallback } from "react";
|
||||
import { subject } from "@casl/ability";
|
||||
import {
|
||||
faBan,
|
||||
faCheck,
|
||||
@@ -63,7 +64,7 @@ export const SecretSyncActionTriggers = ({ secretSync }: Props) => {
|
||||
const triggerSyncSecrets = useTriggerSecretSyncSyncSecrets();
|
||||
const updateSync = useUpdateSecretSync();
|
||||
|
||||
const { destination } = secretSync;
|
||||
const { destination, environment, folder } = secretSync;
|
||||
|
||||
const destinationName = SECRET_SYNC_MAP[destination].name;
|
||||
const { syncOption } = useSecretSyncOption(destination);
|
||||
@@ -128,6 +129,14 @@ export const SecretSyncActionTriggers = ({ secretSync }: Props) => {
|
||||
}
|
||||
};
|
||||
|
||||
const permissionSubject =
|
||||
environment && folder
|
||||
? subject(ProjectPermissionSub.SecretSyncs, {
|
||||
environment: environment.slug,
|
||||
secretPath: folder.path
|
||||
})
|
||||
: ProjectPermissionSub.SecretSyncs;
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className="ml-auto mt-4 flex flex-wrap items-center justify-end gap-2">
|
||||
@@ -157,7 +166,7 @@ export const SecretSyncActionTriggers = ({ secretSync }: Props) => {
|
||||
<div>
|
||||
<ProjectPermissionCan
|
||||
I={ProjectPermissionSecretSyncActions.SyncSecrets}
|
||||
a={ProjectPermissionSub.SecretSyncs}
|
||||
a={permissionSubject}
|
||||
>
|
||||
{(isAllowed: boolean) => (
|
||||
<Button
|
||||
@@ -194,7 +203,7 @@ export const SecretSyncActionTriggers = ({ secretSync }: Props) => {
|
||||
{syncOption?.canImportSecrets && (
|
||||
<ProjectPermissionCan
|
||||
I={ProjectPermissionSecretSyncActions.ImportSecrets}
|
||||
a={ProjectPermissionSub.SecretSyncs}
|
||||
a={permissionSubject}
|
||||
>
|
||||
{(isAllowed: boolean) => (
|
||||
<DropdownMenuItem
|
||||
@@ -222,7 +231,7 @@ export const SecretSyncActionTriggers = ({ secretSync }: Props) => {
|
||||
)}
|
||||
<ProjectPermissionCan
|
||||
I={ProjectPermissionSecretSyncActions.RemoveSecrets}
|
||||
a={ProjectPermissionSub.SecretSyncs}
|
||||
a={permissionSubject}
|
||||
>
|
||||
{(isAllowed: boolean) => (
|
||||
<DropdownMenuItem
|
||||
@@ -249,7 +258,7 @@ export const SecretSyncActionTriggers = ({ secretSync }: Props) => {
|
||||
</ProjectPermissionCan>
|
||||
<ProjectPermissionCan
|
||||
I={ProjectPermissionSecretSyncActions.Edit}
|
||||
a={ProjectPermissionSub.SecretSyncs}
|
||||
a={permissionSubject}
|
||||
>
|
||||
{(isAllowed: boolean) => (
|
||||
<DropdownMenuItem
|
||||
@@ -267,7 +276,7 @@ export const SecretSyncActionTriggers = ({ secretSync }: Props) => {
|
||||
</ProjectPermissionCan>
|
||||
<ProjectPermissionCan
|
||||
I={ProjectPermissionSecretSyncActions.Delete}
|
||||
a={ProjectPermissionSub.SecretSyncs}
|
||||
a={permissionSubject}
|
||||
>
|
||||
{(isAllowed: boolean) => (
|
||||
<DropdownMenuItem
|
||||
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
import { GenericFieldLabel } from "@app/components/secret-syncs";
|
||||
import { TFlyioSync } from "@app/hooks/api/secretSyncs/types/flyio-sync";
|
||||
|
||||
type Props = {
|
||||
secretSync: TFlyioSync;
|
||||
};
|
||||
|
||||
export const FlyioSyncDestinationSection = ({ secretSync }: Props) => {
|
||||
const {
|
||||
destinationConfig: { appId }
|
||||
} = secretSync;
|
||||
|
||||
return <GenericFieldLabel label="App ID">{appId}</GenericFieldLabel>;
|
||||
};
|
||||
+15
-5
@@ -1,4 +1,5 @@
|
||||
import { ReactNode } from "react";
|
||||
import { subject } from "@casl/ability";
|
||||
import { faEdit } from "@fortawesome/free-solid-svg-icons";
|
||||
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
||||
|
||||
@@ -18,6 +19,7 @@ import { AzureDevOpsSyncDestinationSection } from "./AzureDevOpsSyncDestinationS
|
||||
import { AzureKeyVaultSyncDestinationSection } from "./AzureKeyVaultSyncDestinationSection";
|
||||
import { CamundaSyncDestinationSection } from "./CamundaSyncDestinationSection";
|
||||
import { DatabricksSyncDestinationSection } from "./DatabricksSyncDestinationSection";
|
||||
import { FlyioSyncDestinationSection } from "./FlyioSyncDestinationSection";
|
||||
import { GcpSyncDestinationSection } from "./GcpSyncDestinationSection";
|
||||
import { GitHubSyncDestinationSection } from "./GitHubSyncDestinationSection";
|
||||
import { HCVaultSyncDestinationSection } from "./HCVaultSyncDestinationSection";
|
||||
@@ -35,7 +37,7 @@ type Props = {
|
||||
};
|
||||
|
||||
export const SecretSyncDestinationSection = ({ secretSync, onEditDestination }: Props) => {
|
||||
const { destination, connection } = secretSync;
|
||||
const { destination, connection, folder, environment } = secretSync;
|
||||
|
||||
const app = APP_CONNECTION_MAP[connection.app].name;
|
||||
|
||||
@@ -97,18 +99,26 @@ export const SecretSyncDestinationSection = ({ secretSync, onEditDestination }:
|
||||
case SecretSync.Render:
|
||||
DestinationComponents = <RenderSyncDestinationSection secretSync={secretSync} />;
|
||||
break;
|
||||
case SecretSync.Flyio:
|
||||
DestinationComponents = <FlyioSyncDestinationSection secretSync={secretSync} />;
|
||||
break;
|
||||
default:
|
||||
throw new Error(`Unhandled Destination Section components: ${destination}`);
|
||||
}
|
||||
|
||||
const permissionSubject =
|
||||
environment && folder
|
||||
? subject(ProjectPermissionSub.SecretSyncs, {
|
||||
environment: environment.slug,
|
||||
secretPath: folder.path
|
||||
})
|
||||
: ProjectPermissionSub.SecretSyncs;
|
||||
|
||||
return (
|
||||
<div className="flex w-full flex-col gap-3 rounded-lg border border-mineshaft-600 bg-mineshaft-900 px-4 py-3">
|
||||
<div className="flex items-center justify-between border-b border-mineshaft-400 pb-2">
|
||||
<h3 className="font-semibold text-mineshaft-100">Destination Configuration</h3>
|
||||
<ProjectPermissionCan
|
||||
I={ProjectPermissionSecretSyncActions.Edit}
|
||||
a={ProjectPermissionSub.SecretSyncs}
|
||||
>
|
||||
<ProjectPermissionCan I={ProjectPermissionSecretSyncActions.Edit} a={permissionSubject}>
|
||||
{(isAllowed) => (
|
||||
<IconButton
|
||||
variant="plain"
|
||||
|
||||
+12
-5
@@ -1,4 +1,5 @@
|
||||
import { useMemo } from "react";
|
||||
import { subject } from "@casl/ability";
|
||||
import { faEdit } from "@fortawesome/free-solid-svg-icons";
|
||||
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
||||
import { format } from "date-fns";
|
||||
@@ -16,7 +17,8 @@ type Props = {
|
||||
};
|
||||
|
||||
export const SecretSyncDetailsSection = ({ secretSync, onEditDetails }: Props) => {
|
||||
const { syncStatus, lastSyncMessage, lastSyncedAt, name, description } = secretSync;
|
||||
const { syncStatus, lastSyncMessage, lastSyncedAt, name, description, environment, folder } =
|
||||
secretSync;
|
||||
|
||||
const failureMessage = useMemo(() => {
|
||||
if (syncStatus === SecretSyncStatus.Failed) {
|
||||
@@ -32,14 +34,19 @@ export const SecretSyncDetailsSection = ({ secretSync, onEditDetails }: Props) =
|
||||
return null;
|
||||
}, [syncStatus, lastSyncMessage]);
|
||||
|
||||
const permissionSubject =
|
||||
environment && folder
|
||||
? subject(ProjectPermissionSub.SecretSyncs, {
|
||||
environment: environment.slug,
|
||||
secretPath: folder.path
|
||||
})
|
||||
: ProjectPermissionSub.SecretSyncs;
|
||||
|
||||
return (
|
||||
<div className="flex w-full flex-col gap-3 rounded-lg border border-mineshaft-600 bg-mineshaft-900 px-4 py-3">
|
||||
<div className="flex items-center justify-between border-b border-mineshaft-400 pb-2">
|
||||
<h3 className="font-semibold text-mineshaft-100">Details</h3>
|
||||
<ProjectPermissionCan
|
||||
I={ProjectPermissionSecretSyncActions.Edit}
|
||||
a={ProjectPermissionSub.SecretSyncs}
|
||||
>
|
||||
<ProjectPermissionCan I={ProjectPermissionSecretSyncActions.Edit} a={permissionSubject}>
|
||||
{(isAllowed) => (
|
||||
<IconButton
|
||||
variant="plain"
|
||||
|
||||
+14
-5
@@ -1,4 +1,5 @@
|
||||
import { ReactNode } from "react";
|
||||
import { subject } from "@casl/ability";
|
||||
import { faEdit } from "@fortawesome/free-solid-svg-icons";
|
||||
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
||||
|
||||
@@ -21,7 +22,9 @@ type Props = {
|
||||
export const SecretSyncOptionsSection = ({ secretSync, onEditOptions }: Props) => {
|
||||
const {
|
||||
destination,
|
||||
syncOptions: { initialSyncBehavior, disableSecretDeletion, keySchema }
|
||||
syncOptions: { initialSyncBehavior, disableSecretDeletion, keySchema },
|
||||
environment,
|
||||
folder
|
||||
} = secretSync;
|
||||
|
||||
let AdditionalSyncOptionsComponent: ReactNode;
|
||||
@@ -53,21 +56,27 @@ export const SecretSyncOptionsSection = ({ secretSync, onEditOptions }: Props) =
|
||||
case SecretSync.OCIVault:
|
||||
case SecretSync.OnePass:
|
||||
case SecretSync.Render:
|
||||
case SecretSync.Flyio:
|
||||
AdditionalSyncOptionsComponent = null;
|
||||
break;
|
||||
default:
|
||||
throw new Error(`Unhandled Destination Review Fields: ${destination}`);
|
||||
}
|
||||
|
||||
const permissionSubject =
|
||||
environment && folder
|
||||
? subject(ProjectPermissionSub.SecretSyncs, {
|
||||
environment: environment.slug,
|
||||
secretPath: folder.path
|
||||
})
|
||||
: ProjectPermissionSub.SecretSyncs;
|
||||
|
||||
return (
|
||||
<div>
|
||||
<div className="flex w-full flex-col gap-3 rounded-lg border border-mineshaft-600 bg-mineshaft-900 px-4 py-3">
|
||||
<div className="flex items-center justify-between border-b border-mineshaft-400 pb-2">
|
||||
<h3 className="font-semibold text-mineshaft-100">Sync Options</h3>
|
||||
<ProjectPermissionCan
|
||||
I={ProjectPermissionSecretSyncActions.Edit}
|
||||
a={ProjectPermissionSub.SecretSyncs}
|
||||
>
|
||||
<ProjectPermissionCan I={ProjectPermissionSecretSyncActions.Edit} a={permissionSubject}>
|
||||
{(isAllowed) => (
|
||||
<IconButton
|
||||
variant="plain"
|
||||
|
||||
+10
-4
@@ -1,3 +1,4 @@
|
||||
import { subject } from "@casl/ability";
|
||||
import { faEdit, faTriangleExclamation } from "@fortawesome/free-solid-svg-icons";
|
||||
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
||||
|
||||
@@ -16,6 +17,14 @@ type Props = {
|
||||
export const SecretSyncSourceSection = ({ secretSync, onEditSource }: Props) => {
|
||||
const { folder, environment } = secretSync;
|
||||
|
||||
const permissionSubject =
|
||||
environment && folder
|
||||
? subject(ProjectPermissionSub.SecretSyncs, {
|
||||
environment: environment.slug,
|
||||
secretPath: folder.path
|
||||
})
|
||||
: ProjectPermissionSub.SecretSyncs;
|
||||
|
||||
return (
|
||||
<div>
|
||||
<div className="flex w-full flex-col gap-3 rounded-lg border border-mineshaft-600 bg-mineshaft-900 px-4 py-3">
|
||||
@@ -35,10 +44,7 @@ export const SecretSyncSourceSection = ({ secretSync, onEditSource }: Props) =>
|
||||
</div>
|
||||
</Tooltip>
|
||||
)}
|
||||
<ProjectPermissionCan
|
||||
I={ProjectPermissionSecretSyncActions.Edit}
|
||||
a={ProjectPermissionSub.SecretSyncs}
|
||||
>
|
||||
<ProjectPermissionCan I={ProjectPermissionSecretSyncActions.Edit} a={permissionSubject}>
|
||||
{(isAllowed) => (
|
||||
<IconButton
|
||||
variant="plain"
|
||||
|
||||
Reference in New Issue
Block a user