mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-21 15:28:12 +00:00
Merge branch 'heads/main' into ENG-3630
This commit is contained in:
@@ -25,10 +25,11 @@ import {
|
||||
ProjectPermissionActions,
|
||||
ProjectPermissionDynamicSecretActions,
|
||||
ProjectPermissionSub,
|
||||
useProjectPermission,
|
||||
useWorkspace
|
||||
useProject,
|
||||
useProjectPermission
|
||||
} from "@app/context";
|
||||
import {
|
||||
ProjectPermissionCommitsActions,
|
||||
ProjectPermissionSecretActions,
|
||||
ProjectPermissionSecretRotationActions
|
||||
} from "@app/context/ProjectPermissionContext/types";
|
||||
@@ -49,10 +50,10 @@ import { useGetProjectSecretsDetails } from "@app/hooks/api/dashboard";
|
||||
import { DashboardSecretsOrderBy } from "@app/hooks/api/dashboard/types";
|
||||
import { useGetFolderCommitsCount } from "@app/hooks/api/folderCommits";
|
||||
import { OrderByDirection } from "@app/hooks/api/generic/types";
|
||||
import { ProjectVersion } from "@app/hooks/api/projects/types";
|
||||
import { PendingAction } from "@app/hooks/api/secretFolders/types";
|
||||
import { useCreateCommit } from "@app/hooks/api/secrets/mutations";
|
||||
import { SecretV3RawSanitized } from "@app/hooks/api/types";
|
||||
import { ProjectVersion } from "@app/hooks/api/workspace/types";
|
||||
import { usePathAccessPolicies } from "@app/hooks/usePathAccessPolicies";
|
||||
import { useResizableColWidth } from "@app/hooks/useResizableColWidth";
|
||||
import { hasSecretReadValueOrDescribePermission } from "@app/lib/fn/permission";
|
||||
@@ -93,7 +94,7 @@ const LOADER_TEXT = [
|
||||
];
|
||||
|
||||
const Page = () => {
|
||||
const { currentWorkspace } = useWorkspace();
|
||||
const { currentProject } = useProject();
|
||||
const navigate = useNavigate({
|
||||
from: ROUTE_PATHS.SecretManager.SecretDashboardPage.path
|
||||
});
|
||||
@@ -106,7 +107,7 @@ const Page = () => {
|
||||
});
|
||||
|
||||
const { permission } = useProjectPermission();
|
||||
const { mutateAsync: createCommit } = useCreateCommit();
|
||||
const { mutateAsync: createCommit, isPending: isCommitPending } = useCreateCommit();
|
||||
|
||||
const tableRef = useRef<HTMLTableElement>(null);
|
||||
|
||||
@@ -141,15 +142,15 @@ const Page = () => {
|
||||
] as const);
|
||||
|
||||
// env slug
|
||||
const workspaceId = currentWorkspace?.id || "";
|
||||
const projectSlug = currentWorkspace?.slug || "";
|
||||
const projectId = currentProject?.id || "";
|
||||
const projectSlug = currentProject?.slug || "";
|
||||
const secretPath = (routerQueryParams.secretPath as string) || "/";
|
||||
|
||||
useEffect(() => {
|
||||
if (isBatchMode && workspaceId && environment && secretPath) {
|
||||
loadPendingChanges({ workspaceId, environment, secretPath });
|
||||
if (isBatchMode && projectId && environment && secretPath) {
|
||||
loadPendingChanges({ projectId, environment, secretPath });
|
||||
}
|
||||
}, [isBatchMode, workspaceId, environment, secretPath, loadPendingChanges]);
|
||||
}, [isBatchMode, projectId, environment, secretPath, loadPendingChanges]);
|
||||
|
||||
const canReadSecret = hasSecretReadValueOrDescribePermission(
|
||||
permission,
|
||||
@@ -213,6 +214,11 @@ const Page = () => {
|
||||
ProjectPermissionSub.SecretRollback
|
||||
);
|
||||
|
||||
const canReadCommits = permission.can(
|
||||
ProjectPermissionCommitsActions.Read,
|
||||
ProjectPermissionSub.Commits
|
||||
);
|
||||
|
||||
const defaultFilterState = {
|
||||
tags: {},
|
||||
searchFilter: (routerQueryParams.search as string) || "",
|
||||
@@ -234,7 +240,7 @@ const Page = () => {
|
||||
const { togglePopUp } = usePopUpAction();
|
||||
|
||||
useEffect(() => {
|
||||
if (!currentWorkspace?.environments.find((env) => env.slug === environment)) {
|
||||
if (!currentProject?.environments.find((env) => env.slug === environment)) {
|
||||
createNotification({
|
||||
text: "No environment found with given slug",
|
||||
type: "error"
|
||||
@@ -242,11 +248,11 @@ const Page = () => {
|
||||
navigate({
|
||||
to: "/projects/secret-management/$projectId/overview",
|
||||
params: {
|
||||
projectId: workspaceId
|
||||
projectId
|
||||
}
|
||||
});
|
||||
}
|
||||
}, [currentWorkspace, environment]);
|
||||
}, [currentProject, environment]);
|
||||
|
||||
const isResourceTypeFiltered = Object.values(filter.include).some(Boolean);
|
||||
const {
|
||||
@@ -256,7 +262,7 @@ const Page = () => {
|
||||
isFetched
|
||||
} = useGetProjectSecretsDetails({
|
||||
environment,
|
||||
projectId: workspaceId,
|
||||
projectId,
|
||||
secretPath,
|
||||
offset,
|
||||
limit,
|
||||
@@ -310,7 +316,7 @@ const Page = () => {
|
||||
|
||||
// fetch imported secrets to show user the overriden ones
|
||||
const { data: importedSecrets } = useGetImportedSecretsSingleEnv({
|
||||
projectId: workspaceId,
|
||||
projectId,
|
||||
environment,
|
||||
path: secretPath,
|
||||
options: {
|
||||
@@ -320,13 +326,13 @@ const Page = () => {
|
||||
|
||||
// fetch tags
|
||||
const { data: tags } = useGetWsTags(
|
||||
permission.can(ProjectPermissionActions.Read, ProjectPermissionSub.Tags) ? workspaceId : ""
|
||||
permission.can(ProjectPermissionActions.Read, ProjectPermissionSub.Tags) ? projectId : ""
|
||||
);
|
||||
|
||||
const { pathPolicies, hasPathPolicies } = usePathAccessPolicies({ secretPath, environment });
|
||||
|
||||
const { data: boardPolicy } = useGetSecretApprovalPolicyOfABoard({
|
||||
workspaceId,
|
||||
projectId,
|
||||
environment,
|
||||
secretPath
|
||||
});
|
||||
@@ -335,7 +341,7 @@ const Page = () => {
|
||||
const handleCreateCommit = async (changes: PendingChanges, message: string) => {
|
||||
try {
|
||||
await createCommit({
|
||||
workspaceId,
|
||||
projectId,
|
||||
environment,
|
||||
secretPath,
|
||||
pendingChanges: changes,
|
||||
@@ -362,7 +368,7 @@ const Page = () => {
|
||||
fetchNextPage: fetchNextSnapshotList,
|
||||
hasNextPage: hasNextSnapshotListPage
|
||||
} = useGetWorkspaceSnapshotList({
|
||||
workspaceId,
|
||||
projectId,
|
||||
directory: secretPath,
|
||||
environment,
|
||||
isPaused: !popUp.snapshots.isOpen || !canDoReadRollback,
|
||||
@@ -375,9 +381,9 @@ const Page = () => {
|
||||
isFetching: isFolderCommitsCountFetching
|
||||
} = useGetFolderCommitsCount({
|
||||
directory: secretPath,
|
||||
workspaceId,
|
||||
projectId,
|
||||
environment,
|
||||
isPaused: !canDoReadRollback
|
||||
isPaused: !canReadCommits
|
||||
});
|
||||
|
||||
const {
|
||||
@@ -385,13 +391,13 @@ const Page = () => {
|
||||
isPending: isSnapshotCountLoading,
|
||||
isFetching: isSnapshotCountFetching
|
||||
} = useGetWsSnapshotCount({
|
||||
workspaceId,
|
||||
projectId,
|
||||
environment,
|
||||
directory: secretPath,
|
||||
isPaused: !canDoReadRollback
|
||||
});
|
||||
|
||||
const isPITEnabled = !currentWorkspace?.showSnapshotsLegacy;
|
||||
const isPITEnabled = !currentProject?.showSnapshotsLegacy;
|
||||
|
||||
const changesCount = useMemo(() => {
|
||||
return isPITEnabled ? folderCommitsCount : snapshotCount;
|
||||
@@ -410,7 +416,7 @@ const Page = () => {
|
||||
navigate({
|
||||
to: "/projects/secret-management/$projectId/commits/$environment/$folderId",
|
||||
params: {
|
||||
projectId: workspaceId,
|
||||
projectId,
|
||||
folderId,
|
||||
environment
|
||||
},
|
||||
@@ -641,7 +647,7 @@ const Page = () => {
|
||||
? change.tags?.map((tag) => ({
|
||||
id: tag.id,
|
||||
slug: tag.slug,
|
||||
projectId: workspaceId,
|
||||
projectId,
|
||||
createdAt: new Date().toISOString(),
|
||||
updatedAt: new Date().toISOString(),
|
||||
__v: 0
|
||||
@@ -728,7 +734,7 @@ const Page = () => {
|
||||
const mergedSecrets = getMergedSecretsWithPending();
|
||||
const mergedFolders = getMergedFoldersWithPending();
|
||||
|
||||
if (!(currentWorkspace?.version === ProjectVersion.V3))
|
||||
if (!(currentProject?.version === ProjectVersion.V3))
|
||||
return (
|
||||
<div className="flex h-full w-full flex-col items-center justify-center px-6 text-mineshaft-50 dark:[color-scheme:dark]">
|
||||
<SecretV2MigrationSection />
|
||||
@@ -788,8 +794,6 @@ const Page = () => {
|
||||
<>
|
||||
<ActionBar
|
||||
environment={environment}
|
||||
workspaceId={workspaceId}
|
||||
projectSlug={projectSlug}
|
||||
secretPath={secretPath}
|
||||
isVisible={isVisible}
|
||||
isBatchMode={isBatchMode}
|
||||
@@ -951,7 +955,7 @@ const Page = () => {
|
||||
secretImports={imports}
|
||||
isFetching={isDetailsFetching}
|
||||
environment={environment}
|
||||
workspaceId={workspaceId}
|
||||
projectId={projectId}
|
||||
secretPath={secretPath}
|
||||
importedSecrets={importedSecrets}
|
||||
/>
|
||||
@@ -960,7 +964,7 @@ const Page = () => {
|
||||
<FolderListView
|
||||
folders={mergedFolders}
|
||||
environment={environment}
|
||||
workspaceId={workspaceId}
|
||||
projectId={projectId}
|
||||
secretPath={secretPath}
|
||||
onNavigateToFolder={handleResetFilter}
|
||||
canNavigate={isFetched}
|
||||
@@ -984,7 +988,7 @@ const Page = () => {
|
||||
tags={tags}
|
||||
isVisible={isVisible}
|
||||
environment={environment}
|
||||
workspaceId={workspaceId}
|
||||
projectId={projectId}
|
||||
secretPath={secretPath}
|
||||
isProtectedBranch={isProtectedBranch}
|
||||
importedBy={importedBy}
|
||||
@@ -995,9 +999,9 @@ const Page = () => {
|
||||
<CommitForm
|
||||
onCommit={handleCreateCommit}
|
||||
environment={environment}
|
||||
workspaceId={workspaceId}
|
||||
projectId={projectId}
|
||||
secretPath={secretPath}
|
||||
isCommitting={false}
|
||||
isCommitting={isCommitPending}
|
||||
/>
|
||||
)}
|
||||
{noAccessSecretCount > 0 && <SecretNoAccessListView count={noAccessSecretCount} />}
|
||||
@@ -1046,9 +1050,9 @@ const Page = () => {
|
||||
>
|
||||
<CreateSecretForm
|
||||
environment={environment}
|
||||
workspaceId={workspaceId}
|
||||
projectId={projectId}
|
||||
secretPath={secretPath}
|
||||
autoCapitalize={currentWorkspace?.autoCapitalization}
|
||||
autoCapitalize={currentProject?.autoCapitalization}
|
||||
isProtectedBranch={isProtectedBranch}
|
||||
isBatchMode={isBatchMode}
|
||||
/>
|
||||
@@ -1067,10 +1071,10 @@ const Page = () => {
|
||||
)}
|
||||
<SecretDropzone
|
||||
environment={environment}
|
||||
workspaceId={workspaceId}
|
||||
projectId={projectId}
|
||||
secretPath={secretPath}
|
||||
isSmaller={isNotEmpty}
|
||||
environments={currentWorkspace?.environments}
|
||||
environments={currentProject?.environments}
|
||||
isProtectedBranch={isProtectedBranch}
|
||||
/>
|
||||
<PitDrawer
|
||||
@@ -1088,7 +1092,7 @@ const Page = () => {
|
||||
<SnapshotView
|
||||
snapshotId={snapshotId || ""}
|
||||
environment={environment}
|
||||
workspaceId={workspaceId}
|
||||
projectId={projectId}
|
||||
secretPath={secretPath}
|
||||
secrets={secrets}
|
||||
folders={folders}
|
||||
|
||||
@@ -97,7 +97,7 @@ export interface PendingChanges {
|
||||
|
||||
// Context interface for batch operations
|
||||
export interface BatchContext {
|
||||
workspaceId: string;
|
||||
projectId: string;
|
||||
environment: string;
|
||||
secretPath: string;
|
||||
}
|
||||
@@ -257,8 +257,8 @@ type BatchModeState = {
|
||||
};
|
||||
};
|
||||
|
||||
const generateContextKey = (workspaceId: string, environment: string, secretPath: string) => {
|
||||
return `${workspaceId}_${environment}_${secretPath}`;
|
||||
const generateContextKey = (projectId: string, environment: string, secretPath: string) => {
|
||||
return `${projectId}_${environment}_${secretPath}`;
|
||||
};
|
||||
|
||||
const createBatchModeStore: StateCreator<CombinedState, [], [], BatchModeState> = (set, get) => ({
|
||||
@@ -272,7 +272,7 @@ const createBatchModeStore: StateCreator<CombinedState, [], [], BatchModeState>
|
||||
addPendingChange: (change: PendingChange, context: BatchContext) =>
|
||||
set((state) => {
|
||||
const contextKey = generateContextKey(
|
||||
context.workspaceId,
|
||||
context.projectId,
|
||||
context.environment,
|
||||
context.secretPath
|
||||
);
|
||||
@@ -551,7 +551,7 @@ const createBatchModeStore: StateCreator<CombinedState, [], [], BatchModeState>
|
||||
const currentChanges =
|
||||
contextKey ===
|
||||
generateContextKey(
|
||||
state.currentContext?.workspaceId || context.workspaceId,
|
||||
state.currentContext?.projectId || context.projectId,
|
||||
state.currentContext?.environment || context.environment,
|
||||
state.currentContext?.secretPath || context.secretPath
|
||||
)
|
||||
@@ -568,7 +568,7 @@ const createBatchModeStore: StateCreator<CombinedState, [], [], BatchModeState>
|
||||
removePendingChange: (changeId: string, resourceType: string, context: BatchContext) =>
|
||||
set((state) => {
|
||||
const contextKey = generateContextKey(
|
||||
context.workspaceId,
|
||||
context.projectId,
|
||||
context.environment,
|
||||
context.secretPath
|
||||
);
|
||||
@@ -593,7 +593,7 @@ const createBatchModeStore: StateCreator<CombinedState, [], [], BatchModeState>
|
||||
state.currentContext &&
|
||||
contextKey ===
|
||||
generateContextKey(
|
||||
state.currentContext.workspaceId,
|
||||
state.currentContext.projectId,
|
||||
state.currentContext.environment,
|
||||
state.currentContext.secretPath
|
||||
);
|
||||
@@ -606,7 +606,7 @@ const createBatchModeStore: StateCreator<CombinedState, [], [], BatchModeState>
|
||||
|
||||
loadPendingChanges: (context) => {
|
||||
const contextKey = generateContextKey(
|
||||
context.workspaceId,
|
||||
context.projectId,
|
||||
context.environment,
|
||||
context.secretPath
|
||||
);
|
||||
@@ -626,7 +626,7 @@ const createBatchModeStore: StateCreator<CombinedState, [], [], BatchModeState>
|
||||
|
||||
clearAllPendingChanges: (context) => {
|
||||
const contextKey = generateContextKey(
|
||||
context.workspaceId,
|
||||
context.projectId,
|
||||
context.environment,
|
||||
context.secretPath
|
||||
);
|
||||
@@ -641,7 +641,7 @@ const createBatchModeStore: StateCreator<CombinedState, [], [], BatchModeState>
|
||||
state.currentContext &&
|
||||
contextKey ===
|
||||
generateContextKey(
|
||||
state.currentContext.workspaceId,
|
||||
state.currentContext.projectId,
|
||||
state.currentContext.environment,
|
||||
state.currentContext.secretPath
|
||||
);
|
||||
|
||||
+22
-29
@@ -55,9 +55,9 @@ import {
|
||||
ProjectPermissionActions,
|
||||
ProjectPermissionDynamicSecretActions,
|
||||
ProjectPermissionSub,
|
||||
useProject,
|
||||
useProjectPermission,
|
||||
useSubscription,
|
||||
useWorkspace
|
||||
useSubscription
|
||||
} from "@app/context";
|
||||
import {
|
||||
ProjectPermissionCommitsActions,
|
||||
@@ -109,9 +109,6 @@ type TSecOverwriteOpt = { update: TParsedEnv; create: TParsedEnv };
|
||||
type Props = {
|
||||
// switch the secrets type as it gets decrypted after api call
|
||||
environment: string;
|
||||
// @depreciated will be moving all these details to zustand
|
||||
workspaceId: string;
|
||||
projectSlug: string;
|
||||
secretPath?: string;
|
||||
filter: Filter;
|
||||
tags?: WsTag[];
|
||||
@@ -142,8 +139,6 @@ type Props = {
|
||||
|
||||
export const ActionBar = ({
|
||||
environment,
|
||||
workspaceId,
|
||||
projectSlug,
|
||||
secretPath = "/",
|
||||
filter,
|
||||
tags = [],
|
||||
@@ -164,6 +159,7 @@ export const ActionBar = ({
|
||||
hasPathPolicies,
|
||||
onClearFilters
|
||||
}: Props) => {
|
||||
const { projectId, currentProject } = useProject();
|
||||
const { handlePopUpOpen, handlePopUpToggle, handlePopUpClose, popUp } = usePopUp([
|
||||
"addFolder",
|
||||
"addDynamicSecret",
|
||||
@@ -196,7 +192,6 @@ export const ActionBar = ({
|
||||
const { reset: resetSelectedSecret } = useSelectedSecretActions();
|
||||
const isMultiSelectActive = Boolean(Object.keys(selectedSecrets).length);
|
||||
|
||||
const { currentWorkspace } = useWorkspace();
|
||||
const { permission } = useProjectPermission();
|
||||
|
||||
const handleFolderCreate = async (folderName: string, description: string | null) => {
|
||||
@@ -214,7 +209,7 @@ export const ActionBar = ({
|
||||
};
|
||||
|
||||
addPendingChange(pendingFolderCreate, {
|
||||
workspaceId,
|
||||
projectId,
|
||||
environment,
|
||||
secretPath
|
||||
});
|
||||
@@ -227,7 +222,7 @@ export const ActionBar = ({
|
||||
name: folderName,
|
||||
path: secretPath,
|
||||
environment,
|
||||
projectId: workspaceId,
|
||||
projectId,
|
||||
description
|
||||
});
|
||||
handlePopUpClose("addFolder");
|
||||
@@ -247,7 +242,7 @@ export const ActionBar = ({
|
||||
const handleSecretDownload = async () => {
|
||||
try {
|
||||
const { secrets: localSecrets, imports: localImportedSecrets } = await fetchProjectSecrets({
|
||||
workspaceId,
|
||||
projectId,
|
||||
expandSecretReferences: true,
|
||||
includeImports: true,
|
||||
environment,
|
||||
@@ -317,7 +312,7 @@ export const ActionBar = ({
|
||||
try {
|
||||
await deleteBatchSecretV3({
|
||||
secretPath,
|
||||
workspaceId,
|
||||
projectId,
|
||||
environment,
|
||||
secrets: bulkDeletedSecrets.map(({ key }) => ({ secretKey: key, type: SecretType.Shared }))
|
||||
});
|
||||
@@ -348,13 +343,12 @@ export const ActionBar = ({
|
||||
try {
|
||||
const secretsToMove = Object.values(selectedSecrets);
|
||||
const { isDestinationUpdated, isSourceUpdated } = await moveSecrets({
|
||||
projectSlug,
|
||||
shouldOverwrite,
|
||||
sourceEnvironment: environment,
|
||||
sourceSecretPath: secretPath,
|
||||
destinationEnvironment,
|
||||
destinationSecretPath,
|
||||
projectId: workspaceId,
|
||||
projectId,
|
||||
secretIds: secretsToMove.map((sec) => sec.id)
|
||||
});
|
||||
|
||||
@@ -448,7 +442,7 @@ export const ActionBar = ({
|
||||
const { secrets: batchSecrets } = await fetchDashboardProjectSecretsByKeys({
|
||||
secretPath: normalizedPath,
|
||||
environment,
|
||||
projectId: workspaceId,
|
||||
projectId,
|
||||
keys: batch
|
||||
});
|
||||
|
||||
@@ -566,7 +560,7 @@ export const ActionBar = ({
|
||||
name: folderName,
|
||||
path: parentPath,
|
||||
environment,
|
||||
projectId: workspaceId
|
||||
projectId
|
||||
});
|
||||
|
||||
createdFolders.add(fullPath);
|
||||
@@ -598,7 +592,7 @@ export const ActionBar = ({
|
||||
Object.entries(groupedCreateSecrets).map(([path, secrets]) =>
|
||||
createSecretBatch({
|
||||
secretPath: path,
|
||||
workspaceId,
|
||||
projectId,
|
||||
environment,
|
||||
secrets
|
||||
})
|
||||
@@ -628,7 +622,7 @@ export const ActionBar = ({
|
||||
Object.entries(groupedUpdateSecrets).map(([path, secrets]) =>
|
||||
updateSecretBatch({
|
||||
secretPath: path,
|
||||
workspaceId,
|
||||
projectId,
|
||||
environment,
|
||||
secrets
|
||||
})
|
||||
@@ -638,13 +632,12 @@ export const ActionBar = ({
|
||||
|
||||
// Invalidate appropriate queries to refresh UI
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: secretKeys.getProjectSecret({ workspaceId, environment, secretPath })
|
||||
queryKey: secretKeys.getProjectSecret({ projectId, environment, secretPath })
|
||||
});
|
||||
queryClient.invalidateQueries({});
|
||||
dashboardKeys.getDashboardSecrets({ projectId, secretPath });
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: dashboardKeys.getDashboardSecrets({ projectId: workspaceId, secretPath })
|
||||
});
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: secretApprovalRequestKeys.count({ workspaceId })
|
||||
queryKey: secretApprovalRequestKeys.count({ projectId })
|
||||
});
|
||||
|
||||
// Close the modal and show notification
|
||||
@@ -677,8 +670,8 @@ export const ActionBar = ({
|
||||
className="w-2/5"
|
||||
value={filter.searchFilter}
|
||||
onChange={onSearchChange}
|
||||
environments={[currentWorkspace.environments.find((env) => env.slug === environment)!]}
|
||||
projectId={workspaceId}
|
||||
environments={[currentProject.environments.find((env) => env.slug === environment)!]}
|
||||
projectId={projectId}
|
||||
tags={tags}
|
||||
/>
|
||||
<div>
|
||||
@@ -1134,8 +1127,8 @@ export const ActionBar = ({
|
||||
{/* all the side triggers from actions like modals etc */}
|
||||
<CreateSecretImportForm
|
||||
environment={environment}
|
||||
workspaceId={workspaceId}
|
||||
secretPath={secretPath}
|
||||
projectId={projectId}
|
||||
onUpgradePlan={() => handlePopUpOpen("upgradePlan")}
|
||||
isOpen={popUp.addSecretImport.isOpen}
|
||||
onClose={() => handlePopUpClose("addSecretImport")}
|
||||
@@ -1144,7 +1137,7 @@ export const ActionBar = ({
|
||||
<CreateDynamicSecretForm
|
||||
isOpen={popUp.addDynamicSecret.isOpen}
|
||||
onToggle={(isOpen) => handlePopUpToggle("addDynamicSecret", isOpen)}
|
||||
projectSlug={projectSlug}
|
||||
projectSlug={currentProject.slug}
|
||||
environments={[{ slug: environment, name: environment, id: "not-used" }]}
|
||||
secretPath={secretPath}
|
||||
isSingleEnvironmentMode
|
||||
@@ -1190,8 +1183,8 @@ export const ActionBar = ({
|
||||
onToggle={(isOpen) => handlePopUpToggle("replicateFolder", isOpen)}
|
||||
onParsedEnv={handleParsedEnvMultiFolder}
|
||||
environment={environment}
|
||||
environments={currentWorkspace.environments}
|
||||
workspaceId={workspaceId}
|
||||
environments={currentProject.environments}
|
||||
projectId={projectId}
|
||||
secretPath={secretPath}
|
||||
/>
|
||||
{subscription && (
|
||||
|
||||
+2
-2
@@ -19,7 +19,7 @@ import {
|
||||
} from "@app/components/v2";
|
||||
import { useCreateDynamicSecret } from "@app/hooks/api";
|
||||
import { DynamicSecretProviders } from "@app/hooks/api/dynamicSecret/types";
|
||||
import { WorkspaceEnv } from "@app/hooks/api/types";
|
||||
import { ProjectEnv } from "@app/hooks/api/types";
|
||||
|
||||
const formSchema = z.object({
|
||||
provider: z.object({
|
||||
@@ -63,7 +63,7 @@ type Props = {
|
||||
onCancel: () => void;
|
||||
secretPath: string;
|
||||
projectSlug: string;
|
||||
environments: WorkspaceEnv[];
|
||||
environments: ProjectEnv[];
|
||||
isSingleEnvironmentMode?: boolean;
|
||||
};
|
||||
|
||||
|
||||
+2
-2
@@ -21,7 +21,7 @@ import {
|
||||
DynamicSecretAwsIamCredentialType,
|
||||
DynamicSecretProviders
|
||||
} from "@app/hooks/api/dynamicSecret/types";
|
||||
import { WorkspaceEnv } from "@app/hooks/api/types";
|
||||
import { ProjectEnv } from "@app/hooks/api/types";
|
||||
|
||||
import { MetadataForm } from "../../DynamicSecretListView/MetadataForm";
|
||||
|
||||
@@ -122,7 +122,7 @@ type Props = {
|
||||
onCancel: () => void;
|
||||
secretPath: string;
|
||||
projectSlug: string;
|
||||
environments: WorkspaceEnv[];
|
||||
environments: ProjectEnv[];
|
||||
isSingleEnvironmentMode?: boolean;
|
||||
};
|
||||
|
||||
|
||||
+2
-2
@@ -18,7 +18,7 @@ import { Tooltip } from "@app/components/v2/Tooltip";
|
||||
import { useCreateDynamicSecret } from "@app/hooks/api";
|
||||
import { useGetDynamicSecretProviderData } from "@app/hooks/api/dynamicSecret/queries";
|
||||
import { DynamicSecretProviders } from "@app/hooks/api/dynamicSecret/types";
|
||||
import { WorkspaceEnv } from "@app/hooks/api/types";
|
||||
import { ProjectEnv } from "@app/hooks/api/types";
|
||||
|
||||
const formSchema = z.object({
|
||||
selectedUsers: z.array(
|
||||
@@ -66,7 +66,7 @@ type Props = {
|
||||
onCancel: () => void;
|
||||
secretPath: string;
|
||||
projectSlug: string;
|
||||
environments: WorkspaceEnv[];
|
||||
environments: ProjectEnv[];
|
||||
isSingleEnvironmentMode?: boolean;
|
||||
};
|
||||
|
||||
|
||||
+2
-2
@@ -19,7 +19,7 @@ import {
|
||||
} from "@app/components/v2";
|
||||
import { useCreateDynamicSecret } from "@app/hooks/api";
|
||||
import { DynamicSecretProviders } from "@app/hooks/api/dynamicSecret/types";
|
||||
import { WorkspaceEnv } from "@app/hooks/api/types";
|
||||
import { ProjectEnv } from "@app/hooks/api/types";
|
||||
import { slugSchema } from "@app/lib/schemas";
|
||||
|
||||
const formSchema = z.object({
|
||||
@@ -66,7 +66,7 @@ type Props = {
|
||||
onCancel: () => void;
|
||||
secretPath: string;
|
||||
projectSlug: string;
|
||||
environments: WorkspaceEnv[];
|
||||
environments: ProjectEnv[];
|
||||
isSingleEnvironmentMode?: boolean;
|
||||
};
|
||||
|
||||
|
||||
+2
-2
@@ -24,7 +24,7 @@ import {
|
||||
} from "@app/components/v2";
|
||||
import { useCreateDynamicSecret } from "@app/hooks/api";
|
||||
import { DynamicSecretProviders } from "@app/hooks/api/dynamicSecret/types";
|
||||
import { WorkspaceEnv } from "@app/hooks/api/types";
|
||||
import { ProjectEnv } from "@app/hooks/api/types";
|
||||
import { slugSchema } from "@app/lib/schemas";
|
||||
|
||||
// Component for managing scopes and collections within a bucket
|
||||
@@ -265,7 +265,7 @@ type Props = {
|
||||
onCancel: () => void;
|
||||
secretPath: string;
|
||||
projectSlug: string;
|
||||
environments: WorkspaceEnv[];
|
||||
environments: ProjectEnv[];
|
||||
isSingleEnvironmentMode?: boolean;
|
||||
};
|
||||
|
||||
|
||||
+2
-2
@@ -24,7 +24,7 @@ import { AnimatePresence, motion } from "framer-motion";
|
||||
|
||||
import { Modal, ModalContent } from "@app/components/v2";
|
||||
import { DynamicSecretProviders } from "@app/hooks/api/dynamicSecret/types";
|
||||
import { WorkspaceEnv } from "@app/hooks/api/types";
|
||||
import { ProjectEnv } from "@app/hooks/api/types";
|
||||
|
||||
import { AwsElastiCacheInputForm } from "./AwsElastiCacheInputForm";
|
||||
import { AwsIamInputForm } from "./AwsIamInputForm";
|
||||
@@ -51,7 +51,7 @@ type Props = {
|
||||
isOpen?: boolean;
|
||||
onToggle: (isOpen: boolean) => void;
|
||||
projectSlug: string;
|
||||
environments: WorkspaceEnv[];
|
||||
environments: ProjectEnv[];
|
||||
secretPath: string;
|
||||
isSingleEnvironmentMode?: boolean;
|
||||
};
|
||||
|
||||
+2
-2
@@ -20,7 +20,7 @@ import {
|
||||
} from "@app/components/v2";
|
||||
import { useCreateDynamicSecret } from "@app/hooks/api";
|
||||
import { DynamicSecretProviders } from "@app/hooks/api/dynamicSecret/types";
|
||||
import { WorkspaceEnv } from "@app/hooks/api/types";
|
||||
import { ProjectEnv } from "@app/hooks/api/types";
|
||||
import { slugSchema } from "@app/lib/schemas";
|
||||
|
||||
const authMethods = [
|
||||
@@ -87,7 +87,7 @@ type Props = {
|
||||
onCancel: () => void;
|
||||
secretPath: string;
|
||||
projectSlug: string;
|
||||
environments: WorkspaceEnv[];
|
||||
environments: ProjectEnv[];
|
||||
isSingleEnvironmentMode?: boolean;
|
||||
};
|
||||
|
||||
|
||||
+2
-2
@@ -8,7 +8,7 @@ import { createNotification } from "@app/components/notifications";
|
||||
import { Button, FilterableSelect, FormControl, Input } from "@app/components/v2";
|
||||
import { useCreateDynamicSecret } from "@app/hooks/api";
|
||||
import { DynamicSecretProviders } from "@app/hooks/api/dynamicSecret/types";
|
||||
import { WorkspaceEnv } from "@app/hooks/api/types";
|
||||
import { ProjectEnv } from "@app/hooks/api/types";
|
||||
|
||||
const validateTTL = (val: string, ctx: z.RefinementCtx) => {
|
||||
if (!val) return;
|
||||
@@ -49,7 +49,7 @@ type Props = {
|
||||
onCancel: () => void;
|
||||
secretPath: string;
|
||||
projectSlug: string;
|
||||
environments: WorkspaceEnv[];
|
||||
environments: ProjectEnv[];
|
||||
isSingleEnvironmentMode?: boolean;
|
||||
};
|
||||
|
||||
|
||||
+2
-2
@@ -16,7 +16,7 @@ import {
|
||||
} from "@app/components/v2";
|
||||
import { useCreateDynamicSecret } from "@app/hooks/api";
|
||||
import { DynamicSecretProviders } from "@app/hooks/api/dynamicSecret/types";
|
||||
import { WorkspaceEnv } from "@app/hooks/api/types";
|
||||
import { ProjectEnv } from "@app/hooks/api/types";
|
||||
|
||||
const formSchema = z.object({
|
||||
provider: z.object({
|
||||
@@ -44,7 +44,7 @@ type Props = {
|
||||
onCancel: () => void;
|
||||
secretPath: string;
|
||||
projectSlug: string;
|
||||
environments: WorkspaceEnv[];
|
||||
environments: ProjectEnv[];
|
||||
isSingleEnvironmentMode?: boolean;
|
||||
};
|
||||
|
||||
|
||||
+2
-2
@@ -28,7 +28,7 @@ import {
|
||||
DynamicSecretProviders,
|
||||
KubernetesDynamicSecretCredentialType
|
||||
} from "@app/hooks/api/dynamicSecret/types";
|
||||
import { WorkspaceEnv } from "@app/hooks/api/types";
|
||||
import { ProjectEnv } from "@app/hooks/api/types";
|
||||
import { slugSchema } from "@app/lib/schemas";
|
||||
|
||||
enum RoleType {
|
||||
@@ -150,7 +150,7 @@ type Props = {
|
||||
onCancel: () => void;
|
||||
secretPath: string;
|
||||
projectSlug: string;
|
||||
environments: WorkspaceEnv[];
|
||||
environments: ProjectEnv[];
|
||||
isSingleEnvironmentMode?: boolean;
|
||||
};
|
||||
|
||||
|
||||
+2
-2
@@ -16,7 +16,7 @@ import {
|
||||
} from "@app/components/v2";
|
||||
import { useCreateDynamicSecret } from "@app/hooks/api";
|
||||
import { DynamicSecretProviders } from "@app/hooks/api/dynamicSecret/types";
|
||||
import { WorkspaceEnv } from "@app/hooks/api/types";
|
||||
import { ProjectEnv } from "@app/hooks/api/types";
|
||||
import { slugSchema } from "@app/lib/schemas";
|
||||
|
||||
enum CredentialType {
|
||||
@@ -89,7 +89,7 @@ type Props = {
|
||||
onCancel: () => void;
|
||||
secretPath: string;
|
||||
projectSlug: string;
|
||||
environments: WorkspaceEnv[];
|
||||
environments: ProjectEnv[];
|
||||
isSingleEnvironmentMode?: boolean;
|
||||
};
|
||||
|
||||
|
||||
+2
-2
@@ -23,7 +23,7 @@ import {
|
||||
} from "@app/components/v2";
|
||||
import { useCreateDynamicSecret } from "@app/hooks/api";
|
||||
import { DynamicSecretProviders } from "@app/hooks/api/dynamicSecret/types";
|
||||
import { WorkspaceEnv } from "@app/hooks/api/types";
|
||||
import { ProjectEnv } from "@app/hooks/api/types";
|
||||
import { slugSchema } from "@app/lib/schemas";
|
||||
|
||||
const formSchema = z.object({
|
||||
@@ -77,7 +77,7 @@ type Props = {
|
||||
onCancel: () => void;
|
||||
secretPath: string;
|
||||
projectSlug: string;
|
||||
environments: WorkspaceEnv[];
|
||||
environments: ProjectEnv[];
|
||||
isSingleEnvironmentMode?: boolean;
|
||||
};
|
||||
|
||||
|
||||
+2
-2
@@ -18,7 +18,7 @@ import {
|
||||
} from "@app/components/v2";
|
||||
import { useCreateDynamicSecret } from "@app/hooks/api";
|
||||
import { DynamicSecretProviders } from "@app/hooks/api/dynamicSecret/types";
|
||||
import { WorkspaceEnv } from "@app/hooks/api/types";
|
||||
import { ProjectEnv } from "@app/hooks/api/types";
|
||||
import { slugSchema } from "@app/lib/schemas";
|
||||
|
||||
const formSchema = z.object({
|
||||
@@ -67,7 +67,7 @@ type Props = {
|
||||
onCancel: () => void;
|
||||
secretPath: string;
|
||||
projectSlug: string;
|
||||
environments: WorkspaceEnv[];
|
||||
environments: ProjectEnv[];
|
||||
isSingleEnvironmentMode?: boolean;
|
||||
};
|
||||
|
||||
|
||||
+2
-2
@@ -18,7 +18,7 @@ import {
|
||||
} from "@app/components/v2";
|
||||
import { useCreateDynamicSecret } from "@app/hooks/api";
|
||||
import { DynamicSecretProviders } from "@app/hooks/api/dynamicSecret/types";
|
||||
import { WorkspaceEnv } from "@app/hooks/api/types";
|
||||
import { ProjectEnv } from "@app/hooks/api/types";
|
||||
import { slugSchema } from "@app/lib/schemas";
|
||||
|
||||
const formSchema = z.object({
|
||||
@@ -71,7 +71,7 @@ type Props = {
|
||||
onCancel: () => void;
|
||||
secretPath: string;
|
||||
projectSlug: string;
|
||||
environments: WorkspaceEnv[];
|
||||
environments: ProjectEnv[];
|
||||
isSingleEnvironmentMode?: boolean;
|
||||
};
|
||||
|
||||
|
||||
+2
-2
@@ -19,7 +19,7 @@ import {
|
||||
} from "@app/components/v2";
|
||||
import { useCreateDynamicSecret } from "@app/hooks/api";
|
||||
import { DynamicSecretProviders } from "@app/hooks/api/dynamicSecret/types";
|
||||
import { WorkspaceEnv } from "@app/hooks/api/types";
|
||||
import { ProjectEnv } from "@app/hooks/api/types";
|
||||
import { slugSchema } from "@app/lib/schemas";
|
||||
|
||||
const formSchema = z.object({
|
||||
@@ -64,7 +64,7 @@ type Props = {
|
||||
onCancel: () => void;
|
||||
secretPath: string;
|
||||
projectSlug: string;
|
||||
environments: WorkspaceEnv[];
|
||||
environments: ProjectEnv[];
|
||||
isSingleEnvironmentMode?: boolean;
|
||||
};
|
||||
|
||||
|
||||
+2
-2
@@ -18,7 +18,7 @@ import {
|
||||
} from "@app/components/v2";
|
||||
import { useCreateDynamicSecret } from "@app/hooks/api";
|
||||
import { DynamicSecretProviders } from "@app/hooks/api/dynamicSecret/types";
|
||||
import { WorkspaceEnv } from "@app/hooks/api/types";
|
||||
import { ProjectEnv } from "@app/hooks/api/types";
|
||||
import { slugSchema } from "@app/lib/schemas";
|
||||
|
||||
const formSchema = z.object({
|
||||
@@ -62,7 +62,7 @@ type Props = {
|
||||
onCancel: () => void;
|
||||
secretPath: string;
|
||||
projectSlug: string;
|
||||
environments: WorkspaceEnv[];
|
||||
environments: ProjectEnv[];
|
||||
isSingleEnvironmentMode?: boolean;
|
||||
};
|
||||
|
||||
|
||||
+2
-2
@@ -19,7 +19,7 @@ import {
|
||||
} from "@app/components/v2";
|
||||
import { useCreateDynamicSecret } from "@app/hooks/api";
|
||||
import { DynamicSecretProviders } from "@app/hooks/api/dynamicSecret/types";
|
||||
import { WorkspaceEnv } from "@app/hooks/api/types";
|
||||
import { ProjectEnv } from "@app/hooks/api/types";
|
||||
import { slugSchema } from "@app/lib/schemas";
|
||||
|
||||
const formSchema = z.object({
|
||||
@@ -64,7 +64,7 @@ type Props = {
|
||||
onCancel: () => void;
|
||||
secretPath: string;
|
||||
projectSlug: string;
|
||||
environments: WorkspaceEnv[];
|
||||
environments: ProjectEnv[];
|
||||
isSingleEnvironmentMode?: boolean;
|
||||
};
|
||||
|
||||
|
||||
+2
-2
@@ -18,7 +18,7 @@ import {
|
||||
} from "@app/components/v2";
|
||||
import { useCreateDynamicSecret } from "@app/hooks/api";
|
||||
import { DynamicSecretProviders } from "@app/hooks/api/dynamicSecret/types";
|
||||
import { WorkspaceEnv } from "@app/hooks/api/types";
|
||||
import { ProjectEnv } from "@app/hooks/api/types";
|
||||
import { slugSchema } from "@app/lib/schemas";
|
||||
|
||||
const formSchema = z.object({
|
||||
@@ -62,7 +62,7 @@ type Props = {
|
||||
onCancel: () => void;
|
||||
secretPath: string;
|
||||
projectSlug: string;
|
||||
environments: WorkspaceEnv[];
|
||||
environments: ProjectEnv[];
|
||||
isSingleEnvironmentMode?: boolean;
|
||||
};
|
||||
|
||||
|
||||
+27
-3
@@ -19,6 +19,7 @@ import {
|
||||
SecretInput,
|
||||
Select,
|
||||
SelectItem,
|
||||
Switch,
|
||||
TextArea,
|
||||
Tooltip
|
||||
} from "@app/components/v2";
|
||||
@@ -28,7 +29,7 @@ import {
|
||||
} from "@app/context/OrgPermissionContext/types";
|
||||
import { gatewaysQueryKeys, useCreateDynamicSecret } from "@app/hooks/api";
|
||||
import { DynamicSecretProviders, SqlProviders } from "@app/hooks/api/dynamicSecret/types";
|
||||
import { WorkspaceEnv } from "@app/hooks/api/types";
|
||||
import { ProjectEnv } from "@app/hooks/api/types";
|
||||
import { slugSchema } from "@app/lib/schemas";
|
||||
|
||||
import { MetadataForm } from "../../DynamicSecretListView/MetadataForm";
|
||||
@@ -66,6 +67,7 @@ const formSchema = z.object({
|
||||
creationStatement: z.string().min(1),
|
||||
revocationStatement: z.string().min(1),
|
||||
renewStatement: z.string().optional(),
|
||||
sslEnabled: z.boolean().optional(),
|
||||
ca: z.string().optional(),
|
||||
gatewayId: z.string().optional()
|
||||
}),
|
||||
@@ -108,7 +110,7 @@ type Props = {
|
||||
onCancel: () => void;
|
||||
secretPath: string;
|
||||
projectSlug: string;
|
||||
environments: WorkspaceEnv[];
|
||||
environments: ProjectEnv[];
|
||||
isSingleEnvironmentMode?: boolean;
|
||||
};
|
||||
|
||||
@@ -200,6 +202,7 @@ export const SqlDatabaseInputForm = ({
|
||||
|
||||
const createDynamicSecret = useCreateDynamicSecret();
|
||||
const { data: gateways, isPending: isGatewaysLoading } = useQuery(gatewaysQueryKeys.list());
|
||||
const selectedClient = watch("provider.client");
|
||||
|
||||
const handleCreateDynamicSecret = async ({
|
||||
name,
|
||||
@@ -458,13 +461,34 @@ export const SqlDatabaseInputForm = ({
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
{selectedClient === SqlProviders.MsSQL && (
|
||||
<div className="mb-2 mt-2">
|
||||
<Controller
|
||||
control={control}
|
||||
name="provider.sslEnabled"
|
||||
render={({ field: { value, onChange }, fieldState: { error } }) => (
|
||||
<FormControl isError={Boolean(error?.message)} errorText={error?.message}>
|
||||
<Switch
|
||||
className="bg-mineshaft-400/50 shadow-inner data-[state=checked]:bg-green/80"
|
||||
id="sql-ds-ssl-enabled"
|
||||
thumbClassName="bg-mineshaft-800"
|
||||
isChecked={value}
|
||||
onCheckedChange={onChange}
|
||||
>
|
||||
Encrypt Connection (SSL)
|
||||
</Switch>
|
||||
</FormControl>
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
<Controller
|
||||
control={control}
|
||||
name="provider.ca"
|
||||
render={({ field, fieldState: { error } }) => (
|
||||
<FormControl
|
||||
isOptional
|
||||
label="CA(SSL)"
|
||||
label="CA (SSL)"
|
||||
isError={Boolean(error?.message)}
|
||||
errorText={error?.message}
|
||||
>
|
||||
|
||||
+2
-2
@@ -13,7 +13,7 @@ import {
|
||||
} from "@app/components/v2";
|
||||
import { useCreateDynamicSecret } from "@app/hooks/api";
|
||||
import { DynamicSecretProviders } from "@app/hooks/api/dynamicSecret/types";
|
||||
import { WorkspaceEnv } from "@app/hooks/api/types";
|
||||
import { ProjectEnv } from "@app/hooks/api/types";
|
||||
import { slugSchema } from "@app/lib/schemas";
|
||||
|
||||
enum ConfigType {
|
||||
@@ -66,7 +66,7 @@ type Props = {
|
||||
onCancel: () => void;
|
||||
secretPath: string;
|
||||
projectSlug: string;
|
||||
environments: WorkspaceEnv[];
|
||||
environments: ProjectEnv[];
|
||||
isSingleEnvironmentMode?: boolean;
|
||||
};
|
||||
|
||||
|
||||
+2
-2
@@ -27,7 +27,7 @@ import {
|
||||
} from "@app/context/OrgPermissionContext/types";
|
||||
import { gatewaysQueryKeys, useCreateDynamicSecret } from "@app/hooks/api";
|
||||
import { DynamicSecretProviders } from "@app/hooks/api/dynamicSecret/types";
|
||||
import { WorkspaceEnv } from "@app/hooks/api/types";
|
||||
import { ProjectEnv } from "@app/hooks/api/types";
|
||||
|
||||
const passwordRequirementsSchema = z
|
||||
.object({
|
||||
@@ -91,7 +91,7 @@ type Props = {
|
||||
onCancel: () => void;
|
||||
secretPath: string;
|
||||
projectSlug: string;
|
||||
environments: WorkspaceEnv[];
|
||||
environments: ProjectEnv[];
|
||||
isSingleEnvironmentMode?: boolean;
|
||||
};
|
||||
|
||||
|
||||
+6
-6
@@ -14,7 +14,7 @@ import {
|
||||
SelectItem
|
||||
} from "@app/components/v2";
|
||||
import { SecretPathInput } from "@app/components/v2/SecretPathInput";
|
||||
import { useSubscription, useWorkspace } from "@app/context";
|
||||
import { useProject, useSubscription } from "@app/context";
|
||||
import { useCreateSecretImport } from "@app/hooks/api";
|
||||
|
||||
const typeSchema = z.object({
|
||||
@@ -32,7 +32,7 @@ type TFormSchema = z.infer<typeof typeSchema>;
|
||||
|
||||
type Props = {
|
||||
environment: string;
|
||||
workspaceId: string;
|
||||
projectId: string;
|
||||
secretPath?: string;
|
||||
// modal props
|
||||
isOpen?: boolean;
|
||||
@@ -43,7 +43,7 @@ type Props = {
|
||||
|
||||
export const CreateSecretImportForm = ({
|
||||
environment,
|
||||
workspaceId,
|
||||
projectId,
|
||||
secretPath = "/",
|
||||
isOpen,
|
||||
onClose,
|
||||
@@ -57,8 +57,8 @@ export const CreateSecretImportForm = ({
|
||||
watch,
|
||||
formState: { isSubmitting }
|
||||
} = useForm<TFormSchema>({ resolver: zodResolver(typeSchema) });
|
||||
const { currentWorkspace } = useWorkspace();
|
||||
const environments = currentWorkspace?.environments || [];
|
||||
const { currentProject } = useProject();
|
||||
const environments = currentProject?.environments || [];
|
||||
const selectedEnvironment = watch("environment");
|
||||
const { subscription } = useSubscription();
|
||||
|
||||
@@ -77,7 +77,7 @@ export const CreateSecretImportForm = ({
|
||||
|
||||
await createSecretImport({
|
||||
environment,
|
||||
projectId: workspaceId,
|
||||
projectId,
|
||||
path: secretPath,
|
||||
isReplication,
|
||||
import: {
|
||||
|
||||
+3
-3
@@ -12,7 +12,7 @@ import {
|
||||
SelectItem
|
||||
} from "@app/components/v2";
|
||||
import { SecretPathInput } from "@app/components/v2/SecretPathInput";
|
||||
import { useWorkspace } from "@app/context";
|
||||
import { useProject } from "@app/context";
|
||||
import { UsePopUpState } from "@app/hooks/usePopUp";
|
||||
|
||||
type Props = {
|
||||
@@ -47,8 +47,8 @@ export const MoveSecretsModal = ({ popUp, handlePopUpToggle, onMoveApproved }: P
|
||||
formState: { isSubmitting }
|
||||
} = useForm<TFormSchema>({ resolver: zodResolver(formSchema) });
|
||||
|
||||
const { currentWorkspace } = useWorkspace();
|
||||
const environments = currentWorkspace?.environments || [];
|
||||
const { currentProject } = useProject();
|
||||
const environments = currentProject?.environments || [];
|
||||
const selectedEnvironment = watch("environment");
|
||||
|
||||
const handleFormSubmit = (data: TFormSchema) => {
|
||||
|
||||
+4
-4
@@ -48,7 +48,7 @@ type Props = {
|
||||
env: Record<string, Record<string, { value: string; comments: string[]; secretPath?: string }>>
|
||||
) => void;
|
||||
environments?: { name: string; slug: string }[];
|
||||
workspaceId: string;
|
||||
projectId: string;
|
||||
environment: string;
|
||||
secretPath: string;
|
||||
};
|
||||
@@ -64,7 +64,7 @@ type SecretStructure = {
|
||||
|
||||
export const ReplicateFolderFromBoard = ({
|
||||
environments = [],
|
||||
workspaceId,
|
||||
projectId,
|
||||
isOpen,
|
||||
onToggle,
|
||||
onParsedEnv
|
||||
@@ -82,14 +82,14 @@ export const ReplicateFolderFromBoard = ({
|
||||
const [debouncedEnvCopySecretPath] = useDebounce(envCopySecPath);
|
||||
|
||||
const { data: accessibleSecrets } = useGetAccessibleSecrets({
|
||||
projectId: workspaceId,
|
||||
projectId,
|
||||
secretPath: "/",
|
||||
environment: selectedEnvSlug.slug,
|
||||
recursive: true,
|
||||
filterByAction: shouldIncludeValues
|
||||
? ProjectPermissionSecretActions.ReadValue
|
||||
: ProjectPermissionSecretActions.DescribeSecret,
|
||||
options: { enabled: Boolean(workspaceId) && Boolean(selectedEnvSlug) && isOpen }
|
||||
options: { enabled: Boolean(projectId) && Boolean(selectedEnvSlug) && isOpen }
|
||||
});
|
||||
|
||||
const restructureSecrets = useMemo(() => {
|
||||
|
||||
+9
-11
@@ -25,14 +25,14 @@ interface CommitFormProps {
|
||||
onCommit: (changes: PendingChanges, commitMessage: string) => Promise<void>;
|
||||
isCommitting?: boolean;
|
||||
environment: string;
|
||||
workspaceId: string;
|
||||
projectId: string;
|
||||
secretPath: string;
|
||||
}
|
||||
|
||||
interface ResourceChangeProps {
|
||||
change: PendingChange;
|
||||
environment: string;
|
||||
workspaceId: string;
|
||||
projectId: string;
|
||||
secretPath: string;
|
||||
}
|
||||
|
||||
@@ -237,7 +237,7 @@ const RenderFolderChanges = ({ onDiscard, change }: RenderResourceProps) => {
|
||||
const ResourceChange: React.FC<ResourceChangeProps> = ({
|
||||
change,
|
||||
environment,
|
||||
workspaceId,
|
||||
projectId,
|
||||
secretPath
|
||||
}) => {
|
||||
const { removePendingChange } = useBatchModeActions();
|
||||
@@ -245,7 +245,7 @@ const ResourceChange: React.FC<ResourceChangeProps> = ({
|
||||
const handleDeletePending = useCallback(
|
||||
(changeType: string, id: string) => {
|
||||
removePendingChange(id, changeType, {
|
||||
workspaceId,
|
||||
projectId,
|
||||
environment,
|
||||
secretPath
|
||||
});
|
||||
@@ -272,7 +272,7 @@ export const CommitForm: React.FC<CommitFormProps> = ({
|
||||
onCommit,
|
||||
isCommitting = false,
|
||||
environment,
|
||||
workspaceId,
|
||||
projectId,
|
||||
secretPath
|
||||
}) => {
|
||||
const { isBatchMode, pendingChanges, totalChangesCount } = useBatchMode();
|
||||
@@ -291,7 +291,7 @@ export const CommitForm: React.FC<CommitFormProps> = ({
|
||||
}
|
||||
await onCommit(pendingChanges, commitMessage);
|
||||
clearAllPendingChanges({
|
||||
workspaceId,
|
||||
projectId,
|
||||
environment,
|
||||
secretPath
|
||||
});
|
||||
@@ -335,9 +335,7 @@ export const CommitForm: React.FC<CommitFormProps> = ({
|
||||
<div className="ml-6 mt-0.5 flex items-center gap-3">
|
||||
<Button
|
||||
size="sm"
|
||||
onClick={() =>
|
||||
clearAllPendingChanges({ workspaceId, environment, secretPath })
|
||||
}
|
||||
onClick={() => clearAllPendingChanges({ projectId, environment, secretPath })}
|
||||
isDisabled={totalChangesCount === 0}
|
||||
variant="outline_bg"
|
||||
className="px-4 hover:border-red/40 hover:bg-red/[0.1]"
|
||||
@@ -393,7 +391,7 @@ export const CommitForm: React.FC<CommitFormProps> = ({
|
||||
key={change.id}
|
||||
change={change}
|
||||
environment={environment}
|
||||
workspaceId={workspaceId}
|
||||
projectId={projectId}
|
||||
secretPath={secretPath}
|
||||
/>
|
||||
))}
|
||||
@@ -414,7 +412,7 @@ export const CommitForm: React.FC<CommitFormProps> = ({
|
||||
key={change.id}
|
||||
change={change}
|
||||
environment={environment}
|
||||
workspaceId={workspaceId}
|
||||
projectId={projectId}
|
||||
secretPath={secretPath}
|
||||
/>
|
||||
))}
|
||||
|
||||
+15
-15
@@ -38,7 +38,7 @@ import {
|
||||
Tooltip,
|
||||
Tr
|
||||
} from "@app/components/v2";
|
||||
import { useWorkspace } from "@app/context";
|
||||
import { useProject } from "@app/context";
|
||||
import {
|
||||
getUserTablePreference,
|
||||
PreferenceKey,
|
||||
@@ -49,7 +49,7 @@ import { useGetImportedSecretsAllEnvs } from "@app/hooks/api";
|
||||
import { useGetProjectSecretsOverview } from "@app/hooks/api/dashboard";
|
||||
import { DashboardSecretsOrderBy } from "@app/hooks/api/dashboard/types";
|
||||
import { OrderByDirection } from "@app/hooks/api/generic/types";
|
||||
import { WorkspaceEnv } from "@app/hooks/api/workspace/types";
|
||||
import { ProjectEnv } from "@app/hooks/api/projects/types";
|
||||
import { useResizableColWidth } from "@app/hooks/useResizableColWidth";
|
||||
import {
|
||||
useDynamicSecretOverview,
|
||||
@@ -89,10 +89,10 @@ const DEFAULT_FILTER_STATE = {
|
||||
const COL_WIDTH_OFFSET = 220;
|
||||
|
||||
export const CompareEnvironments = ({ secretPath }: Props) => {
|
||||
const { currentWorkspace } = useWorkspace();
|
||||
const compareEnvironmentsKey = `compare-environments-${currentWorkspace.id}`;
|
||||
const { currentProject } = useProject();
|
||||
const compareEnvironmentsKey = `compare-environments-${currentProject.id}`;
|
||||
|
||||
const [selectedEnvironments, setSelectedEnvironments] = useState<WorkspaceEnv[]>(() => {
|
||||
const [selectedEnvironments, setSelectedEnvironments] = useState<ProjectEnv[]>(() => {
|
||||
try {
|
||||
const storedEnvironments = JSON.parse(localStorage.getItem(compareEnvironmentsKey) ?? "[]");
|
||||
|
||||
@@ -104,12 +104,12 @@ export const CompareEnvironments = ({ secretPath }: Props) => {
|
||||
}
|
||||
});
|
||||
|
||||
return currentWorkspace.environments.filter((env) => potentialEnvs.includes(env.id));
|
||||
return currentProject.environments.filter((env) => potentialEnvs.includes(env.id));
|
||||
}
|
||||
} catch {
|
||||
// do nothing and proceed
|
||||
}
|
||||
return currentWorkspace.environments.slice(0, 2);
|
||||
return currentProject.environments.slice(0, 2);
|
||||
});
|
||||
|
||||
const [filter, setFilter] = useState<Filter>(DEFAULT_FILTER_STATE);
|
||||
@@ -133,7 +133,7 @@ export const CompareEnvironments = ({ secretPath }: Props) => {
|
||||
setUserTablePreference("secretCompareTable", PreferenceKey.PerPage, newPerPage);
|
||||
};
|
||||
|
||||
const workspaceId = currentWorkspace.id;
|
||||
const projectId = currentProject.id;
|
||||
const [searchFilter, setSearchFilter] = useState("");
|
||||
const [debouncedSearchFilter] = useDebounce(searchFilter);
|
||||
const [debouncedSelectedEnvironments] = useDebounce(selectedEnvironments);
|
||||
@@ -151,19 +151,19 @@ export const CompareEnvironments = ({ secretPath }: Props) => {
|
||||
getImportedSecretByKey,
|
||||
getEnvImportedSecretKeyCount
|
||||
} = useGetImportedSecretsAllEnvs({
|
||||
projectId: workspaceId,
|
||||
projectId,
|
||||
path: secretPath,
|
||||
environments: (currentWorkspace.environments || []).map(({ slug }) => slug)
|
||||
environments: (currentProject.environments || []).map(({ slug }) => slug)
|
||||
});
|
||||
|
||||
const compareEnvironments = selectedEnvironments.length
|
||||
? selectedEnvironments
|
||||
: currentWorkspace.environments;
|
||||
: currentProject.environments;
|
||||
|
||||
const isFilteredByResources = Object.values(filter).some(Boolean);
|
||||
const { isPending: isOverviewLoading, data: overview } = useGetProjectSecretsOverview(
|
||||
{
|
||||
projectId: workspaceId,
|
||||
projectId,
|
||||
environments: compareEnvironments.map((env) => env.slug),
|
||||
secretPath,
|
||||
orderDirection,
|
||||
@@ -579,12 +579,12 @@ export const CompareEnvironments = ({ secretPath }: Props) => {
|
||||
<FilterableSelect
|
||||
value={selectedEnvironments}
|
||||
onChange={(value) => {
|
||||
const selected = value as MultiValue<WorkspaceEnv>;
|
||||
const selected = value as MultiValue<ProjectEnv>;
|
||||
|
||||
setSelectedEnvironments((selected as WorkspaceEnv[]) ?? []);
|
||||
setSelectedEnvironments((selected as ProjectEnv[]) ?? []);
|
||||
}}
|
||||
placeholder="Leave blank to compare all environments"
|
||||
options={currentWorkspace.environments}
|
||||
options={currentProject.environments}
|
||||
getOptionValue={(option) => option.slug}
|
||||
getOptionLabel={(option) => option.name}
|
||||
isMulti
|
||||
|
||||
+2
-2
@@ -17,7 +17,7 @@ import {
|
||||
} from "@app/context/ProjectPermissionContext/types";
|
||||
import { useToggle } from "@app/hooks";
|
||||
import { SecretV3RawSanitized } from "@app/hooks/api/secrets/types";
|
||||
import { WorkspaceEnv } from "@app/hooks/api/types";
|
||||
import { ProjectEnv } from "@app/hooks/api/types";
|
||||
import { HIDDEN_SECRET_VALUE } from "@app/pages/secret-manager/SecretDashboardPage/components/SecretListView/SecretItem";
|
||||
|
||||
import { EnvironmentStatus, EnvironmentStatusCell, ResourceNameCell } from "../shared";
|
||||
@@ -32,7 +32,7 @@ type Props = {
|
||||
getImportedSecretByKey: (
|
||||
env: string,
|
||||
secretName: string
|
||||
) => { secret?: SecretV3RawSanitized; environmentInfo?: WorkspaceEnv } | undefined;
|
||||
) => { secret?: SecretV3RawSanitized; environmentInfo?: ProjectEnv } | undefined;
|
||||
colWidth: number;
|
||||
tableWidth: number;
|
||||
};
|
||||
|
||||
+7
-6
@@ -32,7 +32,7 @@ type TFormSchema = z.infer<typeof typeSchema>;
|
||||
|
||||
type Props = {
|
||||
environment: string;
|
||||
workspaceId: string;
|
||||
projectId: string;
|
||||
secretPath?: string;
|
||||
// modal props
|
||||
autoCapitalize?: boolean;
|
||||
@@ -42,7 +42,7 @@ type Props = {
|
||||
|
||||
export const CreateSecretForm = ({
|
||||
environment,
|
||||
workspaceId,
|
||||
projectId,
|
||||
secretPath = "/",
|
||||
autoCapitalize = true,
|
||||
isProtectedBranch = false,
|
||||
@@ -66,7 +66,7 @@ export const CreateSecretForm = ({
|
||||
const { permission } = useProjectPermission();
|
||||
const canReadTags = permission.can(ProjectPermissionActions.Read, ProjectPermissionSub.Tags);
|
||||
const { data: projectTags, isPending: isTagsLoading } = useGetWsTags(
|
||||
canReadTags ? workspaceId : ""
|
||||
canReadTags ? projectId : ""
|
||||
);
|
||||
|
||||
const secretKeyInputRef = useRef<HTMLInputElement>(null);
|
||||
@@ -80,7 +80,7 @@ export const CreateSecretForm = ({
|
||||
try {
|
||||
const parsedSlug = slugSchema.parse(slug);
|
||||
await createWsTag.mutateAsync({
|
||||
workspaceID: workspaceId,
|
||||
projectId,
|
||||
tagSlug: parsedSlug,
|
||||
tagColor: ""
|
||||
});
|
||||
@@ -106,7 +106,8 @@ export const CreateSecretForm = ({
|
||||
resourceType: "secret"
|
||||
};
|
||||
addPendingChange(pendingSecretCreate, {
|
||||
workspaceId,
|
||||
projectId,
|
||||
|
||||
environment,
|
||||
secretPath
|
||||
});
|
||||
@@ -116,7 +117,7 @@ export const CreateSecretForm = ({
|
||||
}
|
||||
await createSecretV3({
|
||||
environment,
|
||||
workspaceId,
|
||||
projectId,
|
||||
secretPath,
|
||||
secretKey: key,
|
||||
secretValue: value || "",
|
||||
|
||||
+25
-1
@@ -18,6 +18,7 @@ import {
|
||||
SecretInput,
|
||||
Select,
|
||||
SelectItem,
|
||||
Switch,
|
||||
TextArea,
|
||||
Tooltip
|
||||
} from "@app/components/v2";
|
||||
@@ -63,6 +64,7 @@ const formSchema = z.object({
|
||||
creationStatement: z.string().min(1),
|
||||
revocationStatement: z.string().min(1),
|
||||
renewStatement: z.string().optional(),
|
||||
sslEnabled: z.boolean().optional(),
|
||||
ca: z.string().optional(),
|
||||
gatewayId: z.string().optional().nullable()
|
||||
})
|
||||
@@ -151,6 +153,7 @@ export const EditDynamicSecretSqlProviderForm = ({
|
||||
});
|
||||
|
||||
const { data: gateways, isPending: isGatewaysLoading } = useQuery(gatewaysQueryKeys.list());
|
||||
const selectedClient = watch("inputs.client");
|
||||
|
||||
const updateDynamicSecret = useUpdateDynamicSecret();
|
||||
const selectedGatewayId = watch("inputs.gatewayId");
|
||||
@@ -407,13 +410,34 @@ export const EditDynamicSecretSqlProviderForm = ({
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
{selectedClient === SqlProviders.MsSQL && (
|
||||
<div className="mb-2 mt-2">
|
||||
<Controller
|
||||
control={control}
|
||||
name="inputs.sslEnabled"
|
||||
render={({ field: { value, onChange }, fieldState: { error } }) => (
|
||||
<FormControl isError={Boolean(error?.message)} errorText={error?.message}>
|
||||
<Switch
|
||||
className="bg-mineshaft-400/50 shadow-inner data-[state=checked]:bg-green/80"
|
||||
id="sql-ds-ssl-enabled"
|
||||
thumbClassName="bg-mineshaft-800"
|
||||
isChecked={Boolean(value)}
|
||||
onCheckedChange={onChange}
|
||||
>
|
||||
Encrypt Connection (SSL)
|
||||
</Switch>
|
||||
</FormControl>
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
<Controller
|
||||
control={control}
|
||||
name="inputs.ca"
|
||||
render={({ field, fieldState: { error } }) => (
|
||||
<FormControl
|
||||
isOptional
|
||||
label="CA(SSL)"
|
||||
label="CA (SSL)"
|
||||
isError={Boolean(error?.message)}
|
||||
errorText={error?.message}
|
||||
>
|
||||
|
||||
+18
-18
@@ -24,12 +24,12 @@ import { ROUTE_PATHS } from "@app/const/routes";
|
||||
import {
|
||||
ProjectPermissionActions,
|
||||
ProjectPermissionSub,
|
||||
useSubscription,
|
||||
useWorkspace
|
||||
useProject,
|
||||
useSubscription
|
||||
} from "@app/context";
|
||||
import { usePopUp } from "@app/hooks";
|
||||
import { workspaceKeys } from "@app/hooks/api";
|
||||
import { WorkspaceEnv } from "@app/hooks/api/workspace/types";
|
||||
import { projectKeys } from "@app/hooks/api";
|
||||
import { ProjectEnv } from "@app/hooks/api/projects/types";
|
||||
import { AddEnvironmentModal } from "@app/pages/secret-manager/SettingsPage/components/EnvironmentSection/AddEnvironmentModal";
|
||||
|
||||
import { CompareEnvironments } from "../CompareEnvironments";
|
||||
@@ -45,7 +45,7 @@ type Props = {
|
||||
const TABS_TO_SHOW = 5;
|
||||
|
||||
export const EnvironmentTabs = ({ secretPath }: Props) => {
|
||||
const { currentWorkspace } = useWorkspace();
|
||||
const { currentProject } = useProject();
|
||||
const currentEnv = useParams({
|
||||
from: ROUTE_PATHS.SecretManager.SecretDashboardPage.id,
|
||||
select: (el) => el.envSlug
|
||||
@@ -54,8 +54,8 @@ export const EnvironmentTabs = ({ secretPath }: Props) => {
|
||||
const { subscription } = useSubscription();
|
||||
|
||||
const isMoreEnvironmentsAllowed =
|
||||
subscription?.environmentLimit && currentWorkspace?.environments
|
||||
? currentWorkspace.environments.length < subscription.environmentLimit
|
||||
subscription?.environmentLimit && currentProject?.environments
|
||||
? currentProject.environments.length < subscription.environmentLimit
|
||||
: true;
|
||||
|
||||
const [isNavigating, setIsNavigating] = useState(false);
|
||||
@@ -68,20 +68,20 @@ export const EnvironmentTabs = ({ secretPath }: Props) => {
|
||||
"upgradePlan"
|
||||
] as const);
|
||||
|
||||
const selectedIndex = currentWorkspace.environments.findIndex((env) => env.slug === currentEnv);
|
||||
const selectedIndex = currentProject.environments.findIndex((env) => env.slug === currentEnv);
|
||||
|
||||
let tabEnvironments: WorkspaceEnv[];
|
||||
let dropdownEnvironments: WorkspaceEnv[];
|
||||
let tabEnvironments: ProjectEnv[];
|
||||
let dropdownEnvironments: ProjectEnv[];
|
||||
|
||||
if (selectedIndex < TABS_TO_SHOW) {
|
||||
tabEnvironments = currentWorkspace.environments.slice(0, TABS_TO_SHOW);
|
||||
dropdownEnvironments = currentWorkspace.environments.slice(TABS_TO_SHOW);
|
||||
tabEnvironments = currentProject.environments.slice(0, TABS_TO_SHOW);
|
||||
dropdownEnvironments = currentProject.environments.slice(TABS_TO_SHOW);
|
||||
} else {
|
||||
tabEnvironments = [
|
||||
...currentWorkspace.environments.slice(0, TABS_TO_SHOW - 1),
|
||||
currentWorkspace.environments[selectedIndex]
|
||||
...currentProject.environments.slice(0, TABS_TO_SHOW - 1),
|
||||
currentProject.environments[selectedIndex]
|
||||
];
|
||||
dropdownEnvironments = currentWorkspace.environments
|
||||
dropdownEnvironments = currentProject.environments
|
||||
.slice(TABS_TO_SHOW - 1)
|
||||
.filter((env) => env.slug !== currentEnv);
|
||||
}
|
||||
@@ -96,7 +96,7 @@ export const EnvironmentTabs = ({ secretPath }: Props) => {
|
||||
to: ROUTE_PATHS.SecretManager.SecretDashboardPage.path,
|
||||
params: {
|
||||
envSlug,
|
||||
projectId: currentWorkspace.id
|
||||
projectId: currentProject.id
|
||||
},
|
||||
search: (prev) => prev
|
||||
});
|
||||
@@ -199,7 +199,7 @@ export const EnvironmentTabs = ({ secretPath }: Props) => {
|
||||
</Tooltip>
|
||||
</Tab>
|
||||
)}
|
||||
{currentWorkspace.environments.length > 1 && (
|
||||
{currentProject.environments.length > 1 && (
|
||||
<Tab className="ml-auto" value={COMPARE_ENVIRONMENT_TAB}>
|
||||
<div className="flex items-center gap-x-2 whitespace-nowrap">
|
||||
<FontAwesomeIcon icon={faArrowRightArrowLeft} />
|
||||
@@ -232,7 +232,7 @@ export const EnvironmentTabs = ({ secretPath }: Props) => {
|
||||
onOpenChange={(isOpen) => handlePopUpToggle("createEnvironment", isOpen)}
|
||||
onComplete={async (env) => {
|
||||
await queryClient.refetchQueries({
|
||||
queryKey: workspaceKeys.getWorkspaceById(currentWorkspace.id)
|
||||
queryKey: projectKeys.getProjectById(currentProject.id)
|
||||
});
|
||||
handleSelect(env.slug);
|
||||
}}
|
||||
|
||||
+8
-8
@@ -33,7 +33,7 @@ import { FolderForm } from "../ActionBar/FolderForm";
|
||||
type Props = {
|
||||
folders?: TSecretFolder[];
|
||||
environment: string;
|
||||
workspaceId: string;
|
||||
projectId: string;
|
||||
secretPath?: string;
|
||||
onNavigateToFolder: (path: string) => void;
|
||||
canNavigate: boolean;
|
||||
@@ -42,7 +42,7 @@ type Props = {
|
||||
export const FolderListView = ({
|
||||
folders = [],
|
||||
environment,
|
||||
workspaceId,
|
||||
projectId,
|
||||
secretPath = "/",
|
||||
onNavigateToFolder,
|
||||
canNavigate
|
||||
@@ -89,7 +89,7 @@ export const FolderListView = ({
|
||||
};
|
||||
|
||||
addPendingChange(updatedCreate, {
|
||||
workspaceId,
|
||||
projectId,
|
||||
environment,
|
||||
secretPath
|
||||
});
|
||||
@@ -106,7 +106,7 @@ export const FolderListView = ({
|
||||
};
|
||||
|
||||
addPendingChange(updateChange, {
|
||||
workspaceId,
|
||||
projectId,
|
||||
environment,
|
||||
secretPath
|
||||
});
|
||||
@@ -121,7 +121,7 @@ export const FolderListView = ({
|
||||
name: newFolderName,
|
||||
path: secretPath,
|
||||
environment,
|
||||
projectId: workspaceId,
|
||||
projectId,
|
||||
description: newFolderDescription
|
||||
});
|
||||
handlePopUpClose("updateFolder");
|
||||
@@ -140,7 +140,7 @@ export const FolderListView = ({
|
||||
|
||||
const handleDeletePending = (id: string) => {
|
||||
removePendingChange(id, "folder", {
|
||||
workspaceId,
|
||||
projectId,
|
||||
environment,
|
||||
secretPath
|
||||
});
|
||||
@@ -161,7 +161,7 @@ export const FolderListView = ({
|
||||
};
|
||||
|
||||
addPendingChange(pendingFolderDelete, {
|
||||
workspaceId,
|
||||
projectId,
|
||||
environment,
|
||||
secretPath
|
||||
});
|
||||
@@ -174,7 +174,7 @@ export const FolderListView = ({
|
||||
folderId: folderData.id,
|
||||
path: secretPath,
|
||||
environment,
|
||||
projectId: workspaceId
|
||||
projectId
|
||||
});
|
||||
|
||||
handlePopUpClose("deleteFolder");
|
||||
|
||||
+4
-4
@@ -46,14 +46,14 @@ type Props = {
|
||||
onToggle: (isOpen: boolean) => void;
|
||||
onParsedEnv: (env: Record<string, { value: string; comments: string[] }>) => void;
|
||||
environments?: { name: string; slug: string }[];
|
||||
workspaceId: string;
|
||||
projectId: string;
|
||||
environment: string;
|
||||
secretPath: string;
|
||||
};
|
||||
|
||||
export const CopySecretsFromBoard = ({
|
||||
environments = [],
|
||||
workspaceId,
|
||||
projectId,
|
||||
environment,
|
||||
secretPath,
|
||||
isOpen,
|
||||
@@ -81,7 +81,7 @@ export const CopySecretsFromBoard = ({
|
||||
|
||||
const { data: accessibleSecrets, isPending: isAccessibleSecretsLoading } =
|
||||
useGetAccessibleSecrets({
|
||||
projectId: workspaceId,
|
||||
projectId,
|
||||
secretPath: debouncedEnvCopySecretPath,
|
||||
environment: selectedEnvSlug.slug,
|
||||
filterByAction: shouldIncludeValues
|
||||
@@ -89,7 +89,7 @@ export const CopySecretsFromBoard = ({
|
||||
: ProjectPermissionSecretActions.DescribeSecret,
|
||||
options: {
|
||||
enabled:
|
||||
Boolean(workspaceId) &&
|
||||
Boolean(projectId) &&
|
||||
Boolean(selectedEnvSlug) &&
|
||||
Boolean(debouncedEnvCopySecretPath) &&
|
||||
isOpen
|
||||
|
||||
+9
-9
@@ -53,7 +53,7 @@ type TSecOverwriteOpt = { update: TParsedEnv; create: TParsedEnv };
|
||||
type Props = {
|
||||
isSmaller: boolean;
|
||||
environments?: { name: string; slug: string }[];
|
||||
workspaceId: string;
|
||||
projectId: string;
|
||||
environment: string;
|
||||
secretPath: string;
|
||||
isProtectedBranch?: boolean;
|
||||
@@ -140,7 +140,7 @@ const MatrixImportModalTableRow = ({
|
||||
export const SecretDropzone = ({
|
||||
isSmaller,
|
||||
environments = [],
|
||||
workspaceId,
|
||||
projectId,
|
||||
environment,
|
||||
secretPath,
|
||||
isProtectedBranch = false
|
||||
@@ -196,7 +196,7 @@ export const SecretDropzone = ({
|
||||
const { secrets: existingSecrets } = await fetchDashboardProjectSecretsByKeys({
|
||||
secretPath,
|
||||
environment,
|
||||
projectId: workspaceId,
|
||||
projectId,
|
||||
keys: envSecretKeys
|
||||
});
|
||||
|
||||
@@ -334,7 +334,7 @@ export const SecretDropzone = ({
|
||||
if (Object.keys(create || {}).length) {
|
||||
await createSecretBatch({
|
||||
secretPath,
|
||||
workspaceId,
|
||||
projectId,
|
||||
environment,
|
||||
secrets: Object.entries(create).map(([secretKey, secData]) => ({
|
||||
type: SecretType.Shared,
|
||||
@@ -347,7 +347,7 @@ export const SecretDropzone = ({
|
||||
if (Object.keys(update || {}).length) {
|
||||
await updateSecretBatch({
|
||||
secretPath,
|
||||
workspaceId,
|
||||
projectId,
|
||||
environment,
|
||||
secrets: Object.entries(update).map(([secretKey, secData]) => ({
|
||||
type: SecretType.Shared,
|
||||
@@ -358,13 +358,13 @@ export const SecretDropzone = ({
|
||||
});
|
||||
}
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: secretKeys.getProjectSecret({ workspaceId, environment, secretPath })
|
||||
queryKey: secretKeys.getProjectSecret({ projectId, environment, secretPath })
|
||||
});
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: dashboardKeys.getDashboardSecrets({ projectId: workspaceId, secretPath })
|
||||
queryKey: dashboardKeys.getDashboardSecrets({ projectId, secretPath })
|
||||
});
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: secretApprovalRequestKeys.count({ workspaceId })
|
||||
queryKey: secretApprovalRequestKeys.count({ projectId })
|
||||
});
|
||||
handlePopUpClose("confirmUpload");
|
||||
createNotification({
|
||||
@@ -464,7 +464,7 @@ export const SecretDropzone = ({
|
||||
onParsedEnv={handleParsedEnv}
|
||||
environment={environment}
|
||||
environments={environments}
|
||||
workspaceId={workspaceId}
|
||||
projectId={projectId}
|
||||
secretPath={secretPath}
|
||||
isSmaller={isSmaller}
|
||||
/>
|
||||
|
||||
+3
-3
@@ -21,7 +21,7 @@ import { twMerge } from "tailwind-merge";
|
||||
import { createNotification } from "@app/components/notifications";
|
||||
import { ProjectPermissionCan } from "@app/components/permissions";
|
||||
import { EmptyState, IconButton, SecretInput, TableContainer, Tooltip } from "@app/components/v2";
|
||||
import { ProjectPermissionActions, ProjectPermissionSub, useWorkspace } from "@app/context";
|
||||
import { ProjectPermissionActions, ProjectPermissionSub, useProject } from "@app/context";
|
||||
import { useToggle } from "@app/hooks";
|
||||
import { useResyncSecretReplication } from "@app/hooks/api";
|
||||
import { TSecretImport } from "@app/hooks/api/types";
|
||||
@@ -82,7 +82,7 @@ export const SecretImportItem = ({
|
||||
lastReplicated,
|
||||
importEnv
|
||||
} = secretImport as TSecretImport;
|
||||
const { currentWorkspace } = useWorkspace();
|
||||
const { currentProject } = useProject();
|
||||
const [isExpanded, setIsExpanded] = useToggle();
|
||||
const { attributes, listeners, transform, transition, setNodeRef, isDragging } = useSortable({
|
||||
id
|
||||
@@ -118,7 +118,7 @@ export const SecretImportItem = ({
|
||||
id,
|
||||
environment,
|
||||
path: secretPath,
|
||||
projectId: currentWorkspace?.id || ""
|
||||
projectId: currentProject?.id || ""
|
||||
});
|
||||
createNotification({
|
||||
text: "Please refresh the dashboard to view changes",
|
||||
|
||||
+6
-6
@@ -18,7 +18,7 @@ import { usePopUp } from "@app/hooks";
|
||||
import { useDeleteSecretImport, useUpdateSecretImport } from "@app/hooks/api";
|
||||
import { ReservedFolders } from "@app/hooks/api/secretFolders/types";
|
||||
import { TSecretImport } from "@app/hooks/api/secretImports/types";
|
||||
import { SecretV3RawSanitized, WorkspaceEnv } from "@app/hooks/api/types";
|
||||
import { ProjectEnv, SecretV3RawSanitized } from "@app/hooks/api/types";
|
||||
import { formatReservedPaths } from "@app/lib/fn/string";
|
||||
|
||||
import { SecretImportItem } from "./SecretImportItem";
|
||||
@@ -26,7 +26,7 @@ import { SecretImportItem } from "./SecretImportItem";
|
||||
const SECRET_IN_DASHBOARD = "Present In Dashboard";
|
||||
|
||||
type TImportedSecrets = Array<{
|
||||
environmentInfo: WorkspaceEnv;
|
||||
environmentInfo: ProjectEnv;
|
||||
secretPath: string;
|
||||
folderId: string;
|
||||
secrets: SecretV3RawSanitized[];
|
||||
@@ -86,7 +86,7 @@ export const computeImportedSecretRows = (
|
||||
|
||||
type Props = {
|
||||
environment: string;
|
||||
workspaceId: string;
|
||||
projectId: string;
|
||||
secretPath?: string;
|
||||
secretImports?: TSecretImport[];
|
||||
isFetching?: boolean;
|
||||
@@ -98,7 +98,7 @@ type Props = {
|
||||
export const SecretImportListView = ({
|
||||
secretImports,
|
||||
environment,
|
||||
workspaceId,
|
||||
projectId,
|
||||
secretPath,
|
||||
importedSecrets,
|
||||
// secrets = [],
|
||||
@@ -132,7 +132,7 @@ export const SecretImportListView = ({
|
||||
const { id: secretImportId } = popUp.deleteSecretImport?.data as { id: string };
|
||||
try {
|
||||
await deleteSecretImport({
|
||||
projectId: workspaceId,
|
||||
projectId,
|
||||
environment,
|
||||
path: secretPath,
|
||||
id: secretImportId
|
||||
@@ -158,7 +158,7 @@ export const SecretImportListView = ({
|
||||
const newImportOrder = arrayMove(items, oldIndex, newIndex);
|
||||
setItems(newImportOrder);
|
||||
updateSecretImport({
|
||||
projectId: workspaceId,
|
||||
projectId,
|
||||
environment,
|
||||
path: secretPath,
|
||||
id: active.id as string,
|
||||
|
||||
+4
-4
@@ -4,7 +4,7 @@ import { faFileImport, faKey, faSync, faWarning } from "@fortawesome/free-solid-
|
||||
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
||||
|
||||
import { Table, TBody, Td, Th, THead, Tooltip, Tr } from "@app/components/v2";
|
||||
import { useWorkspace } from "@app/context";
|
||||
import { useProject } from "@app/context";
|
||||
import { UsedBySecretSyncs } from "@app/hooks/api/dashboard/types";
|
||||
|
||||
enum ItemType {
|
||||
@@ -44,7 +44,7 @@ export const CollapsibleSecretImports: React.FC<CollapsibleSecretImportsProps> =
|
||||
secretsToDelete,
|
||||
onlyReferences
|
||||
}) => {
|
||||
const { currentWorkspace } = useWorkspace();
|
||||
const { currentProject } = useProject();
|
||||
|
||||
const truncatePath = (path: string, maxLength = 24): string => {
|
||||
if (path.length <= maxLength) return path;
|
||||
@@ -62,7 +62,7 @@ export const CollapsibleSecretImports: React.FC<CollapsibleSecretImportsProps> =
|
||||
const handlePathClick = (item: FlatItem) => {
|
||||
if (item.type === ItemType.SecretSync) {
|
||||
window.open(
|
||||
`/secret-manager/${currentWorkspace.id}/integrations/secret-syncs/${item.destination}/${item.id}`,
|
||||
`/secret-manager/${currentProject.id}/integrations/secret-syncs/${item.destination}/${item.id}`,
|
||||
"_blank",
|
||||
"noopener,noreferrer"
|
||||
);
|
||||
@@ -78,7 +78,7 @@ export const CollapsibleSecretImports: React.FC<CollapsibleSecretImportsProps> =
|
||||
}
|
||||
const encodedPath = encodeURIComponent(pathToNavigate);
|
||||
window.open(
|
||||
`/secret-manager/${currentWorkspace.id}/secrets/${item.environment.slug}?secretPath=${encodedPath}`,
|
||||
`/secret-manager/${currentProject.id}/secrets/${item.environment.slug}?secretPath=${encodedPath}`,
|
||||
"_blank"
|
||||
);
|
||||
};
|
||||
|
||||
+7
-7
@@ -21,7 +21,7 @@ import {
|
||||
SelectItem,
|
||||
TextArea
|
||||
} from "@app/components/v2";
|
||||
import { useWorkspace } from "@app/context";
|
||||
import { useProject } from "@app/context";
|
||||
import { useGetWorkspaceUsers } from "@app/hooks/api";
|
||||
import { dashboardKeys } from "@app/hooks/api/dashboard/queries";
|
||||
import { useCreateReminder, useDeleteReminder } from "@app/hooks/api/reminders";
|
||||
@@ -52,7 +52,7 @@ interface ReminderFormProps {
|
||||
isOpen: boolean;
|
||||
reminderId?: string;
|
||||
onOpenChange: () => void;
|
||||
workspaceId: string;
|
||||
projectId: string;
|
||||
environment: string;
|
||||
secretPath: string;
|
||||
secretId: string;
|
||||
@@ -118,8 +118,8 @@ const useReminderForm = (reminderData?: Reminder) => {
|
||||
|
||||
// Custom hook for workspace members
|
||||
const useWorkspaceMembers = () => {
|
||||
const { currentWorkspace } = useWorkspace();
|
||||
const { data: members = [] } = useGetWorkspaceUsers(currentWorkspace?.id);
|
||||
const { currentProject } = useProject();
|
||||
const { data: members = [] } = useGetWorkspaceUsers(currentProject?.id);
|
||||
|
||||
const memberOptions = useMemo(
|
||||
(): RecipientOption[] =>
|
||||
@@ -137,7 +137,7 @@ const useWorkspaceMembers = () => {
|
||||
export const CreateReminderForm = ({
|
||||
isOpen,
|
||||
onOpenChange,
|
||||
workspaceId,
|
||||
projectId,
|
||||
environment,
|
||||
secretPath,
|
||||
secretId,
|
||||
@@ -185,12 +185,12 @@ export const CreateReminderForm = ({
|
||||
const invalidateQueries = () => {
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: dashboardKeys.getDashboardSecrets({
|
||||
projectId: workspaceId,
|
||||
projectId,
|
||||
secretPath
|
||||
})
|
||||
});
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: secretKeys.getProjectSecret({ workspaceId, environment, secretPath })
|
||||
queryKey: secretKeys.getProjectSecret({ projectId, environment, secretPath })
|
||||
});
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: reminderKeys.getReminder(secretId)
|
||||
|
||||
+13
-15
@@ -55,8 +55,8 @@ import { InfisicalSecretInput } from "@app/components/v2/InfisicalSecretInput";
|
||||
import {
|
||||
ProjectPermissionActions,
|
||||
ProjectPermissionSub,
|
||||
useProjectPermission,
|
||||
useWorkspace
|
||||
useProject,
|
||||
useProjectPermission
|
||||
} from "@app/context";
|
||||
import { ProjectPermissionSecretActions } from "@app/context/ProjectPermissionContext/types";
|
||||
import { getProjectBaseURL } from "@app/helpers/project";
|
||||
@@ -120,7 +120,7 @@ export const SecretDetailSidebar = ({
|
||||
] as const);
|
||||
|
||||
const { permission } = useProjectPermission();
|
||||
const { currentWorkspace } = useWorkspace();
|
||||
const { currentProject } = useProject();
|
||||
|
||||
const tagFields = useFieldArray({
|
||||
control,
|
||||
@@ -187,7 +187,7 @@ export const SecretDetailSidebar = ({
|
||||
});
|
||||
|
||||
const { data: secretAccessList, isPending } = useGetSecretAccessList({
|
||||
workspaceId: currentWorkspace.id,
|
||||
projectId: currentProject.id,
|
||||
environment,
|
||||
secretPath,
|
||||
secretKey
|
||||
@@ -252,9 +252,9 @@ export const SecretDetailSidebar = ({
|
||||
) => {
|
||||
switch (actorType) {
|
||||
case ActorType.USER:
|
||||
return `/projects/secret-management/${currentWorkspace.id}/members/${membershipId}`;
|
||||
return `/projects/secret-management/${currentProject.id}/members/${membershipId}`;
|
||||
case ActorType.IDENTITY:
|
||||
return `/projects/secret-management/${currentWorkspace.id}/identities/${actorId}`;
|
||||
return `/projects/secret-management/${currentProject.id}/identities/${actorId}`;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
@@ -367,16 +367,14 @@ export const SecretDetailSidebar = ({
|
||||
/>
|
||||
<Tooltip
|
||||
content={
|
||||
!currentWorkspace.secretSharing
|
||||
!currentProject.secretSharing
|
||||
? "This project does not allow secret sharing."
|
||||
: "You don't have permission to view the secret value."
|
||||
}
|
||||
isDisabled={!secret?.secretValueHidden && currentWorkspace.secretSharing}
|
||||
isDisabled={!secret?.secretValueHidden && currentProject.secretSharing}
|
||||
>
|
||||
<Button
|
||||
isDisabled={
|
||||
secret?.secretValueHidden || !currentWorkspace.secretSharing
|
||||
}
|
||||
isDisabled={secret?.secretValueHidden || !currentProject.secretSharing}
|
||||
className="px-2 py-[0.43rem] font-normal"
|
||||
variant="outline_bg"
|
||||
leftIcon={<FontAwesomeIcon icon={faShare} />}
|
||||
@@ -848,10 +846,10 @@ export const SecretDetailSidebar = ({
|
||||
>
|
||||
<Link
|
||||
to={
|
||||
`${getProjectBaseURL(currentWorkspace.type)}/members/$membershipId` as const
|
||||
`${getProjectBaseURL(currentProject.type)}/members/$membershipId` as const
|
||||
}
|
||||
params={{
|
||||
projectId: currentWorkspace.id,
|
||||
projectId: currentProject.id,
|
||||
membershipId: user.membershipId
|
||||
}}
|
||||
className="text-secondary/80 rounded-md border border-mineshaft-600 bg-mineshaft-700 px-1 py-0.5 text-sm hover:text-mineshaft-100"
|
||||
@@ -882,10 +880,10 @@ export const SecretDetailSidebar = ({
|
||||
>
|
||||
<Link
|
||||
to={
|
||||
`${getProjectBaseURL(currentWorkspace.type)}/identities/$identityId` as const
|
||||
`${getProjectBaseURL(currentProject.type)}/identities/$identityId` as const
|
||||
}
|
||||
params={{
|
||||
projectId: currentWorkspace.id,
|
||||
projectId: currentProject.id,
|
||||
identityId: identity.id
|
||||
}}
|
||||
className="text-secondary/80 rounded-md border border-mineshaft-600 bg-mineshaft-700 px-1 py-0.5 text-sm hover:text-mineshaft-100"
|
||||
|
||||
+9
-9
@@ -28,7 +28,7 @@ import {
|
||||
ProjectPermissionActions,
|
||||
ProjectPermissionSub,
|
||||
useProjectPermission,
|
||||
useWorkspace
|
||||
useProject
|
||||
} from "@app/context";
|
||||
import { usePopUp, useToggle } from "@app/hooks";
|
||||
import { SecretV3RawSanitized } from "@app/hooks/api/secrets/types";
|
||||
@@ -75,7 +75,7 @@ type Props = {
|
||||
onCreateTag: () => void;
|
||||
environment: string;
|
||||
secretPath: string;
|
||||
handleSecretShare: () => void;
|
||||
onShareSecret: (sec: SecretV3RawSanitized) => void;
|
||||
importedBy?: {
|
||||
environment: { name: string; slug: string };
|
||||
folders: {
|
||||
@@ -102,7 +102,7 @@ export const SecretItem = memo(
|
||||
onToggleSecretSelect,
|
||||
environment,
|
||||
secretPath,
|
||||
handleSecretShare,
|
||||
onShareSecret,
|
||||
importedBy,
|
||||
isPending,
|
||||
pendingAction,
|
||||
@@ -112,7 +112,7 @@ export const SecretItem = memo(
|
||||
"editSecret",
|
||||
"reminder"
|
||||
] as const);
|
||||
const { currentWorkspace } = useWorkspace();
|
||||
const { currentProject } = useProject();
|
||||
const { permission } = useProjectPermission();
|
||||
const { isRotatedSecret } = secret;
|
||||
const { removePendingChange } = useBatchModeActions();
|
||||
@@ -122,7 +122,7 @@ export const SecretItem = memo(
|
||||
|
||||
const handleDeletePending = (pendingSecret: SecretV3RawSanitized) => {
|
||||
removePendingChange(pendingSecret.id, "secret", {
|
||||
workspaceId: currentWorkspace.id,
|
||||
projectId: currentProject.id,
|
||||
environment,
|
||||
secretPath
|
||||
});
|
||||
@@ -393,7 +393,7 @@ export const SecretItem = memo(
|
||||
<Input
|
||||
autoComplete="off"
|
||||
isReadOnly={isReadOnly || isRotatedSecret}
|
||||
autoCapitalization={currentWorkspace?.autoCapitalization}
|
||||
autoCapitalization={currentProject?.autoCapitalization}
|
||||
variant="plain"
|
||||
isDisabled={isOverridden}
|
||||
placeholder={error?.message}
|
||||
@@ -677,12 +677,12 @@ export const SecretItem = memo(
|
||||
)}
|
||||
</ProjectPermissionCan>
|
||||
<IconButton
|
||||
isDisabled={secret.secretValueHidden || !currentWorkspace.secretSharing}
|
||||
isDisabled={secret.secretValueHidden || !currentProject.secretSharing}
|
||||
className="w-0 overflow-hidden p-0 group-hover:w-5"
|
||||
variant="plain"
|
||||
size="md"
|
||||
ariaLabel="share-secret"
|
||||
onClick={handleSecretShare}
|
||||
onClick={() => onShareSecret(secret)}
|
||||
>
|
||||
<Tooltip content="Share Secret">
|
||||
<FontAwesomeSymbol
|
||||
@@ -974,7 +974,7 @@ export const SecretItem = memo(
|
||||
<CreateReminderForm
|
||||
isOpen={popUp.reminder.isOpen}
|
||||
onOpenChange={() => handlePopUpToggle("reminder")}
|
||||
workspaceId={currentWorkspace.id}
|
||||
projectId={currentProject.id}
|
||||
environment={environment}
|
||||
secretPath={secretPath}
|
||||
secretId={secret?.id}
|
||||
|
||||
+63
-40
@@ -1,4 +1,4 @@
|
||||
import { useCallback } from "react";
|
||||
import { useCallback, useEffect, useRef } from "react";
|
||||
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
||||
import { useQueryClient } from "@tanstack/react-query";
|
||||
|
||||
@@ -37,7 +37,7 @@ import { FontAwesomeSpriteSymbols } from "./SecretListView.utils";
|
||||
type Props = {
|
||||
secrets?: SecretV3RawSanitized[];
|
||||
environment: string;
|
||||
workspaceId: string;
|
||||
projectId: string;
|
||||
secretPath?: string;
|
||||
tags?: WsTag[];
|
||||
isVisible?: boolean;
|
||||
@@ -57,7 +57,7 @@ type Props = {
|
||||
export const SecretListView = ({
|
||||
secrets = [],
|
||||
environment,
|
||||
workspaceId,
|
||||
projectId,
|
||||
secretPath = "/",
|
||||
tags: wsTags = [],
|
||||
isVisible,
|
||||
@@ -93,13 +93,18 @@ export const SecretListView = ({
|
||||
message:
|
||||
"You have unsaved changes. If you leave now, your work will be lost. Do you want to continue?",
|
||||
context: {
|
||||
workspaceId,
|
||||
projectId,
|
||||
environment,
|
||||
secretPath
|
||||
}
|
||||
});
|
||||
const { addPendingChange } = useBatchModeActions();
|
||||
|
||||
const pendingChangesRef = useRef(pendingChanges);
|
||||
useEffect(() => {
|
||||
pendingChangesRef.current = pendingChanges;
|
||||
}, [pendingChanges]);
|
||||
|
||||
const handleSecretOperation = async (
|
||||
operation: "create" | "update" | "delete",
|
||||
type: SecretType,
|
||||
@@ -135,7 +140,7 @@ export const SecretListView = ({
|
||||
if (operation === "delete") {
|
||||
await deleteSecretV3({
|
||||
environment,
|
||||
workspaceId,
|
||||
projectId,
|
||||
secretPath,
|
||||
secretKey: key,
|
||||
type,
|
||||
@@ -156,7 +161,7 @@ export const SecretListView = ({
|
||||
|
||||
await updateSecretV3({
|
||||
environment,
|
||||
workspaceId,
|
||||
projectId,
|
||||
secretPath,
|
||||
secretKey: key,
|
||||
...(!isRotatedSecret && {
|
||||
@@ -178,7 +183,7 @@ export const SecretListView = ({
|
||||
await createSecretV3(
|
||||
{
|
||||
environment,
|
||||
workspaceId,
|
||||
projectId,
|
||||
secretPath,
|
||||
secretKey: key,
|
||||
secretValue: value || "",
|
||||
@@ -332,12 +337,15 @@ export const SecretListView = ({
|
||||
};
|
||||
|
||||
addPendingChange(updatedCreate, {
|
||||
workspaceId,
|
||||
projectId,
|
||||
environment,
|
||||
secretPath
|
||||
});
|
||||
} else {
|
||||
const trueOriginalSecret = getTrueOriginalSecret(orgSecret, pendingChanges.secrets);
|
||||
const trueOriginalSecret = getTrueOriginalSecret(
|
||||
orgSecret,
|
||||
pendingChangesRef.current.secrets
|
||||
);
|
||||
|
||||
const updateChange: PendingSecretUpdate = {
|
||||
id: orgSecret.id,
|
||||
@@ -361,7 +369,7 @@ export const SecretListView = ({
|
||||
};
|
||||
|
||||
addPendingChange(updateChange, {
|
||||
workspaceId,
|
||||
projectId,
|
||||
environment,
|
||||
secretPath
|
||||
});
|
||||
@@ -392,27 +400,39 @@ export const SecretListView = ({
|
||||
}
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: dashboardKeys.getDashboardSecrets({
|
||||
projectId: workspaceId,
|
||||
projectId,
|
||||
secretPath
|
||||
})
|
||||
});
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: secretKeys.getProjectSecret({ workspaceId, environment, secretPath })
|
||||
queryKey: secretKeys.getProjectSecret({ projectId, environment, secretPath })
|
||||
});
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: secretSnapshotKeys.list({ workspaceId, environment, directory: secretPath })
|
||||
queryKey: secretSnapshotKeys.list({
|
||||
projectId,
|
||||
environment,
|
||||
directory: secretPath
|
||||
})
|
||||
});
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: secretSnapshotKeys.count({ workspaceId, environment, directory: secretPath })
|
||||
queryKey: secretSnapshotKeys.count({
|
||||
projectId,
|
||||
environment,
|
||||
directory: secretPath
|
||||
})
|
||||
});
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: commitKeys.count({ workspaceId, environment, directory: secretPath })
|
||||
queryKey: commitKeys.count({ projectId, environment, directory: secretPath })
|
||||
});
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: commitKeys.history({ workspaceId, environment, directory: secretPath })
|
||||
queryKey: commitKeys.history({
|
||||
projectId,
|
||||
environment,
|
||||
directory: secretPath
|
||||
})
|
||||
});
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: secretApprovalRequestKeys.count({ workspaceId })
|
||||
queryKey: secretApprovalRequestKeys.count({ projectId })
|
||||
});
|
||||
if (!isReminderEvent) {
|
||||
handlePopUpClose("secretDetail");
|
||||
@@ -442,15 +462,7 @@ export const SecretListView = ({
|
||||
});
|
||||
}
|
||||
},
|
||||
[
|
||||
environment,
|
||||
secretPath,
|
||||
isProtectedBranch,
|
||||
isBatchMode,
|
||||
workspaceId,
|
||||
addPendingChange,
|
||||
pendingChanges.secrets
|
||||
]
|
||||
[environment, secretPath, isProtectedBranch, isBatchMode, projectId, addPendingChange]
|
||||
);
|
||||
|
||||
const handleSecretDelete = useCallback(async () => {
|
||||
@@ -467,7 +479,7 @@ export const SecretListView = ({
|
||||
};
|
||||
|
||||
addPendingChange(deleteChange, {
|
||||
workspaceId,
|
||||
projectId,
|
||||
environment,
|
||||
secretPath
|
||||
});
|
||||
@@ -480,25 +492,33 @@ export const SecretListView = ({
|
||||
await handleSecretOperation("delete", SecretType.Shared, key, { secretId });
|
||||
// wrap this in another function and then reuse
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: dashboardKeys.getDashboardSecrets({ projectId: workspaceId, secretPath })
|
||||
queryKey: dashboardKeys.getDashboardSecrets({ projectId, secretPath })
|
||||
});
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: secretKeys.getProjectSecret({ workspaceId, environment, secretPath })
|
||||
queryKey: secretKeys.getProjectSecret({ projectId, environment, secretPath })
|
||||
});
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: secretSnapshotKeys.list({ workspaceId, environment, directory: secretPath })
|
||||
queryKey: secretSnapshotKeys.list({
|
||||
projectId,
|
||||
environment,
|
||||
directory: secretPath
|
||||
})
|
||||
});
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: secretSnapshotKeys.count({ workspaceId, environment, directory: secretPath })
|
||||
queryKey: secretSnapshotKeys.count({
|
||||
projectId,
|
||||
environment,
|
||||
directory: secretPath
|
||||
})
|
||||
});
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: commitKeys.count({ workspaceId, environment, directory: secretPath })
|
||||
queryKey: commitKeys.count({ projectId, environment, directory: secretPath })
|
||||
});
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: commitKeys.history({ workspaceId, environment, directory: secretPath })
|
||||
queryKey: commitKeys.history({ projectId, environment, directory: secretPath })
|
||||
});
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: secretApprovalRequestKeys.count({ workspaceId })
|
||||
queryKey: secretApprovalRequestKeys.count({ projectId })
|
||||
});
|
||||
handlePopUpClose("deleteSecret");
|
||||
handlePopUpClose("secretDetail");
|
||||
@@ -521,7 +541,7 @@ export const SecretListView = ({
|
||||
secretPath,
|
||||
isProtectedBranch,
|
||||
isBatchMode,
|
||||
workspaceId,
|
||||
projectId,
|
||||
addPendingChange
|
||||
]);
|
||||
|
||||
@@ -535,6 +555,13 @@ export const SecretListView = ({
|
||||
(sec: SecretV3RawSanitized) => handlePopUpOpen("secretDetail", sec),
|
||||
[]
|
||||
);
|
||||
const onShareSecret = useCallback(
|
||||
(sec: SecretV3RawSanitized) =>
|
||||
handlePopUpOpen("createSharedSecret", {
|
||||
value: sec.valueOverride ?? sec.value
|
||||
}),
|
||||
[]
|
||||
);
|
||||
|
||||
return (
|
||||
<>
|
||||
@@ -557,11 +584,7 @@ export const SecretListView = ({
|
||||
onDetailViewSecret={onDetailViewSecret}
|
||||
importedBy={importedBy}
|
||||
onCreateTag={onCreateTag}
|
||||
handleSecretShare={() =>
|
||||
handlePopUpOpen("createSharedSecret", {
|
||||
value: secret.valueOverride ?? secret.value
|
||||
})
|
||||
}
|
||||
onShareSecret={onShareSecret}
|
||||
isPending={secret.isPending}
|
||||
pendingAction={secret.pendingAction}
|
||||
/>
|
||||
|
||||
+3
-3
@@ -22,7 +22,7 @@ import { renderIcon, SecretItem, TDiffModes, TDiffView } from "./SecretItem";
|
||||
type Props = {
|
||||
snapshotId: string;
|
||||
environment: string;
|
||||
workspaceId: string;
|
||||
projectId: string;
|
||||
secretPath?: string;
|
||||
secrets?: SecretV3RawSanitized[];
|
||||
folders?: TSecretFolder[];
|
||||
@@ -43,7 +43,7 @@ const deepCompareSecrets = (lhs: SecretV3RawSanitized, rhs: SecretV3RawSanitized
|
||||
export const SnapshotView = ({
|
||||
snapshotId,
|
||||
environment,
|
||||
workspaceId,
|
||||
projectId,
|
||||
secretPath,
|
||||
secrets = [],
|
||||
folders = [],
|
||||
@@ -130,7 +130,7 @@ export const SnapshotView = ({
|
||||
}
|
||||
try {
|
||||
await performRollback({
|
||||
workspaceId,
|
||||
projectId,
|
||||
snapshotId: snapshotData.id,
|
||||
environment,
|
||||
directory: secretPath
|
||||
|
||||
@@ -10,7 +10,9 @@ import { SecretDashboardPage } from "./SecretDashboardPage";
|
||||
const SecretDashboardPageQueryParamsSchema = z.object({
|
||||
secretPath: z.string().catch("/"),
|
||||
search: z.string().catch(""),
|
||||
tags: z.string().catch("")
|
||||
tags: z.string().catch(""),
|
||||
connectionId: z.string().optional(),
|
||||
connectionName: z.string().optional()
|
||||
});
|
||||
export const Route = createFileRoute(
|
||||
"/_authenticate/_inject-org-details/_org-layout/projects/secret-management/$projectId/_secret-manager-layout/secrets/$envSlug"
|
||||
|
||||
Reference in New Issue
Block a user