mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-14 13:22:08 +00:00
Requested changes
This commit is contained in:
@@ -5,6 +5,7 @@ import { useNotificationContext } from "@app/components/context/Notifications/No
|
||||
import { useProjectPermission } from "@app/context";
|
||||
import { useGetUpgradeProjectStatus, useUpgradeProject } from "@app/hooks/api";
|
||||
import { Workspace } from "@app/hooks/api/types";
|
||||
import { ProjectVersion } from "@app/hooks/api/workspace/types";
|
||||
|
||||
import { Alert } from "../Alert";
|
||||
import { Button } from "../Button";
|
||||
@@ -55,7 +56,7 @@ export const UpgradeProjectAlert = ({ project }: UpgradeProjectAlertProps): JSX.
|
||||
let interval: NodeJS.Timeout | null = null;
|
||||
|
||||
if (membership.role === "admin") {
|
||||
if (project.version === "v1") {
|
||||
if (project.version === ProjectVersion.V1) {
|
||||
getLatestProjectStatus();
|
||||
}
|
||||
|
||||
@@ -72,7 +73,7 @@ export const UpgradeProjectAlert = ({ project }: UpgradeProjectAlertProps): JSX.
|
||||
}
|
||||
|
||||
interval = setInterval(() => {
|
||||
if (project.version === "v1") {
|
||||
if (project.version === ProjectVersion.V1) {
|
||||
getLatestProjectStatus();
|
||||
}
|
||||
}, 5_000);
|
||||
@@ -92,7 +93,7 @@ export const UpgradeProjectAlert = ({ project }: UpgradeProjectAlertProps): JSX.
|
||||
(currentStatus === null && statusIsLoading)) &&
|
||||
projectStatus?.status !== "FAILED";
|
||||
|
||||
if (project.version !== "v1") return null;
|
||||
if (project.version !== ProjectVersion.V1) return null;
|
||||
if (membership.role !== "admin") return null;
|
||||
|
||||
return (
|
||||
|
||||
@@ -1,9 +1,14 @@
|
||||
export enum ProjectVersion {
|
||||
V1 = 1,
|
||||
V2 = 2
|
||||
}
|
||||
|
||||
export type Workspace = {
|
||||
__v: number;
|
||||
id: string;
|
||||
name: string;
|
||||
orgId: string;
|
||||
version: "v1" | "v2";
|
||||
version: ProjectVersion;
|
||||
upgradeStatus: string | null;
|
||||
autoCapitalization: boolean;
|
||||
environments: WorkspaceEnv[];
|
||||
|
||||
@@ -17,6 +17,7 @@ import {
|
||||
useUpdateBotActiveStatus
|
||||
} from "@app/hooks/api";
|
||||
import { IntegrationAuth } from "@app/hooks/api/types";
|
||||
import { ProjectVersion } from "@app/hooks/api/workspace/types";
|
||||
|
||||
import { CloudIntegrationSection } from "./components/CloudIntegrationSection";
|
||||
import { FrameworkIntegrationSection } from "./components/FrameworkIntegrationSection";
|
||||
@@ -92,7 +93,7 @@ export const IntegrationsPage = withProjectPermission(
|
||||
isIntegrationsAuthorizedEmpty &&
|
||||
isIntegrationsEmpty
|
||||
) {
|
||||
if (bot?.id && currentWorkspace?.version === "v1")
|
||||
if (bot?.id && currentWorkspace?.version === ProjectVersion.V1)
|
||||
updateBotActiveStatusSync({
|
||||
isActive: false,
|
||||
botId: bot.id,
|
||||
@@ -113,7 +114,7 @@ export const IntegrationsPage = withProjectPermission(
|
||||
if (!selectedCloudIntegration) return;
|
||||
|
||||
try {
|
||||
if (bot && !bot.isActive && currentWorkspace?.version === "v1") {
|
||||
if (bot && !bot.isActive && currentWorkspace?.version === ProjectVersion.V1) {
|
||||
const botKey = generateBotKey(bot.publicKey, latestWsKey!);
|
||||
await updateBotActiveStatus({
|
||||
workspaceId,
|
||||
|
||||
@@ -55,6 +55,7 @@ import {
|
||||
useUploadWsKey
|
||||
} from "@app/hooks/api";
|
||||
import { ProjectMembershipRole } from "@app/hooks/api/roles/types";
|
||||
import { ProjectVersion } from "@app/hooks/api/workspace/types";
|
||||
|
||||
const addMemberFormSchema = z.object({
|
||||
orgMembershipId: z.string().trim()
|
||||
@@ -117,14 +118,14 @@ export const MemberListTab = () => {
|
||||
if (!orgUser) return;
|
||||
|
||||
try {
|
||||
if (currentWorkspace.version === "v1") {
|
||||
if (currentWorkspace.version === ProjectVersion.V1) {
|
||||
await addUserToWorkspace({
|
||||
workspaceId,
|
||||
userPrivateKey,
|
||||
decryptKey: wsKey,
|
||||
members: [{ orgMembershipId, userPublicKey: orgUser.user.publicKey }]
|
||||
});
|
||||
} else if (currentWorkspace.version === "v2") {
|
||||
} else if (currentWorkspace.version === ProjectVersion.V2) {
|
||||
await addUserToWorkspaceNonE2EE({
|
||||
projectId: workspaceId,
|
||||
emails: [orgUser.user.email]
|
||||
|
||||
@@ -40,6 +40,7 @@ import {
|
||||
useGetUserWsKey,
|
||||
useUpdateSecretV3
|
||||
} from "@app/hooks/api";
|
||||
import { ProjectVersion } from "@app/hooks/api/workspace/types";
|
||||
|
||||
import { FolderBreadCrumbs } from "./components/FolderBreadCrumbs";
|
||||
import { ProjectIndexSecretsSection } from "./components/ProjectIndexSecretsSection";
|
||||
@@ -317,7 +318,9 @@ export const SecretOverviewPage = () => {
|
||||
</p>
|
||||
</div>
|
||||
|
||||
{currentWorkspace?.version === "v1" && <UpgradeProjectAlert project={currentWorkspace} />}
|
||||
{currentWorkspace?.version === ProjectVersion.V1 && (
|
||||
<UpgradeProjectAlert project={currentWorkspace} />
|
||||
)}
|
||||
<div className="mt-8 flex items-center justify-between">
|
||||
<FolderBreadCrumbs secretPath={secretPath} onResetSearch={handleResetSearch} />
|
||||
<div className="w-80">
|
||||
|
||||
+2
-1
@@ -6,6 +6,7 @@ import {
|
||||
import { Alert, AlertDescription, Checkbox } from "@app/components/v2";
|
||||
import { ProjectPermissionActions, ProjectPermissionSub, useWorkspace } from "@app/context";
|
||||
import { useGetUserWsKey, useGetWorkspaceBot, useUpdateBotActiveStatus } from "@app/hooks/api";
|
||||
import { ProjectVersion } from "@app/hooks/api/workspace/types";
|
||||
|
||||
export const E2EESection = () => {
|
||||
const { currentWorkspace } = useWorkspace();
|
||||
@@ -78,7 +79,7 @@ export const E2EESection = () => {
|
||||
|
||||
if (!currentWorkspace) return null;
|
||||
|
||||
return bot && currentWorkspace.version === "v1" ? (
|
||||
return bot && currentWorkspace.version === ProjectVersion.V1 ? (
|
||||
<div className="mb-6 rounded-lg border border-mineshaft-600 bg-mineshaft-900 p-4">
|
||||
<p className="mb-3 text-xl font-semibold">End-to-End Encryption</p>
|
||||
<p className="mb-8 text-gray-400">
|
||||
|
||||
Reference in New Issue
Block a user