mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-06 09:26:47 +00:00
fix: resolved project deletion not working for secret scanning on missing plan
This commit is contained in:
@@ -1,15 +1,10 @@
|
|||||||
import { useEffect } from "react";
|
|
||||||
import { Helmet } from "react-helmet";
|
import { Helmet } from "react-helmet";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { faLock } from "@fortawesome/free-solid-svg-icons";
|
|
||||||
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
|
||||||
|
|
||||||
import { UpgradePlanModal } from "@app/components/license/UpgradePlanModal";
|
|
||||||
import { ProjectPermissionCan } from "@app/components/permissions";
|
import { ProjectPermissionCan } from "@app/components/permissions";
|
||||||
import { PageHeader, Tab, TabList, TabPanel, Tabs } from "@app/components/v2";
|
import { PageHeader, Tab, TabList, TabPanel, Tabs } from "@app/components/v2";
|
||||||
import { ProjectPermissionSub, useSubscription } from "@app/context";
|
import { ProjectPermissionSub } from "@app/context";
|
||||||
import { ProjectPermissionSecretScanningConfigActions } from "@app/context/ProjectPermissionContext/types";
|
import { ProjectPermissionSecretScanningConfigActions } from "@app/context/ProjectPermissionContext/types";
|
||||||
import { usePopUp } from "@app/hooks";
|
|
||||||
import { ProjectGeneralTab } from "@app/pages/project/SettingsPage/components/ProjectGeneralTab";
|
import { ProjectGeneralTab } from "@app/pages/project/SettingsPage/components/ProjectGeneralTab";
|
||||||
|
|
||||||
import { ProjectScanningConfigTab } from "./components/ProjectScanningConfigTab";
|
import { ProjectScanningConfigTab } from "./components/ProjectScanningConfigTab";
|
||||||
@@ -17,39 +12,6 @@ import { ProjectScanningConfigTab } from "./components/ProjectScanningConfigTab"
|
|||||||
export const SettingsPage = () => {
|
export const SettingsPage = () => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
|
||||||
const { subscription } = useSubscription();
|
|
||||||
|
|
||||||
const { popUp, handlePopUpOpen, handlePopUpToggle } = usePopUp(["upgradePlan"] as const);
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
if (!subscription.secretScanning) {
|
|
||||||
handlePopUpOpen("upgradePlan");
|
|
||||||
}
|
|
||||||
}, [subscription.secretScanning]);
|
|
||||||
|
|
||||||
if (!subscription.secretScanning) {
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
<div className="container mx-auto flex h-full items-center justify-center">
|
|
||||||
<div className="flex items-end space-x-12 rounded-md bg-mineshaft-800 p-16 text-bunker-300">
|
|
||||||
<div>
|
|
||||||
<FontAwesomeIcon icon={faLock} size="6x" />
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<div className="mb-2 text-4xl font-medium">Access Restricted</div>
|
|
||||||
<div className="text-sm">Upgrade your plan to access Secret Scanning</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<UpgradePlanModal
|
|
||||||
isOpen={popUp.upgradePlan.isOpen}
|
|
||||||
onOpenChange={(isOpen) => handlePopUpToggle("upgradePlan", isOpen)}
|
|
||||||
text="Secret Scanning is not available on your current plan."
|
|
||||||
/>
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="flex h-full w-full justify-center bg-bunker-800 text-white">
|
<div className="flex h-full w-full justify-center bg-bunker-800 text-white">
|
||||||
<Helmet>
|
<Helmet>
|
||||||
|
|||||||
+22
-2
@@ -1,17 +1,37 @@
|
|||||||
import { faBan } from "@fortawesome/free-solid-svg-icons";
|
import { faBan } from "@fortawesome/free-solid-svg-icons";
|
||||||
|
|
||||||
import { ContentLoader, EmptyState } from "@app/components/v2";
|
import { ContentLoader, EmptyState } from "@app/components/v2";
|
||||||
import { useWorkspace } from "@app/context";
|
import { useSubscription, useWorkspace } from "@app/context";
|
||||||
import { useGetSecretScanningConfig } from "@app/hooks/api/secretScanningV2";
|
import { useGetSecretScanningConfig } from "@app/hooks/api/secretScanningV2";
|
||||||
|
|
||||||
import { SecretScanningConfigForm } from "./SecretScanningConfigForm";
|
import { SecretScanningConfigForm } from "./SecretScanningConfigForm";
|
||||||
|
|
||||||
export const ProjectScanningConfigTab = () => {
|
export const ProjectScanningConfigTab = () => {
|
||||||
const { currentWorkspace } = useWorkspace();
|
const { currentWorkspace } = useWorkspace();
|
||||||
|
const { subscription } = useSubscription();
|
||||||
const { data: config, isPending: isConfigPending } = useGetSecretScanningConfig(
|
const { data: config, isPending: isConfigPending } = useGetSecretScanningConfig(
|
||||||
currentWorkspace.id
|
currentWorkspace.id,
|
||||||
|
{ enabled: subscription.secretScanning }
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (!subscription.secretScanning) {
|
||||||
|
return (
|
||||||
|
<div className="flex h-full w-full items-center justify-center px-20">
|
||||||
|
<EmptyState
|
||||||
|
className="rounded-md text-center"
|
||||||
|
icon={faBan}
|
||||||
|
title={
|
||||||
|
<span>
|
||||||
|
Your current plan doesn't support Secret Scanning.
|
||||||
|
<br /> Please contact Infisical Support or reach out through our Slack channel for
|
||||||
|
assistance.
|
||||||
|
</span>
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
if (isConfigPending) {
|
if (isConfigPending) {
|
||||||
return (
|
return (
|
||||||
<div className="flex h-full w-full items-center justify-center">
|
<div className="flex h-full w-full items-center justify-center">
|
||||||
|
|||||||
Reference in New Issue
Block a user