Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

remove actions from data source context menu

Matheus Nogueiraf9325df5b7f0
diff --git a/frontend/src/pages/secret-scanning/SecretScanningDataSourcesPage/components/SecretScanningDataSourceRow.tsx b/frontend/src/pages/secret-scanning/SecretScanningDataSourcesPage/components/SecretScanningDataSourceRow.tsx
index 8cce92ffc7..880dd5cae4 100644
--- a/frontend/src/pages/secret-scanning/SecretScanningDataSourcesPage/components/SecretScanningDataSourceRow.tsx
+++ b/frontend/src/pages/secret-scanning/SecretScanningDataSourcesPage/components/SecretScanningDataSourceRow.tsx
@@ -1,14 +1,6 @@
import { useNavigate } from "@tanstack/react-router";
import { formatDistanceToNowStrict } from "date-fns";
-import {
- CopyIcon,
- MoreHorizontalIcon,
- PauseIcon,
- PencilIcon,
- PlayIcon,
- ScanSearchIcon,
- TrashIcon
-} from "lucide-react";
+import { CopyIcon, MoreHorizontalIcon, PencilIcon, TrashIcon } from "lucide-react";
import { createNotification } from "@app/components/notifications";
import { ProjectPermissionCan } from "@app/components/permissions";
@@ -41,32 +33,22 @@ import { DataSourceStatusBadge } from "../../components/DataSourceStatusBadge";
type Props = {
dataSource: TSecretScanningDataSourceWithDetails;
onDelete: (dataSource: TSecretScanningDataSourceWithDetails) => void;
- onTriggerScan: (dataSource: TSecretScanningDataSourceWithDetails) => void;
- onToggleEnableAutoScan: (dataSource: TSecretScanningDataSourceWithDetails) => void;
onEdit: (dataSource: TSecretScanningDataSourceWithDetails) => void;
};
-export const SecretScanningDataSourceRow = ({
- dataSource,
- onDelete,
- onEdit,
- onTriggerScan,
- onToggleEnableAutoScan
-}: Props) => {
+export const SecretScanningDataSourceRow = ({ dataSource, onDelete, onEdit }: Props) => {
const navigate = useNavigate();
const { currentOrg } = useOrganization();
const {
id,
name,
description,
- isScanNewCommitsEnabled,
type,
unresolvedFindings,
resourceCount,
lastScannedAt,
lastScanStatus,
- lastScanStatusMessage,
- isDisconnected
+ lastScanStatusMessage
} = dataSource;
const sourceDetails = SECRET_SCANNING_DATA_SOURCE_MAP[type];
const resourceDescription = RESOURCE_DESCRIPTION_HELPER[type];
@@ -120,7 +102,13 @@ export const SecretScanningDataSourceRow = ({
{resourceCount === 1 ? resourceDescription.singularTitle : resourceDescription.pluralTitle}
</TableCell>
<TableCell>
- {lastScannedAt ? (unresolvedFindings ?? 0) : <span className="text-muted">-</span>}
+ {lastScannedAt ? (
+ <span className={unresolvedFindings ? "text-danger" : undefined}>
+ {unresolvedFindings ?? 0}
+ </span>
+ ) : (
+ <span className="text-muted">-</span>
+ )}
</TableCell>
<TableCell>{renderLastScan()}</TableCell>
<TableCell>
@@ -138,38 +126,15 @@ export const SecretScanningDataSourceRow = ({
<CopyIcon />
Copy Data Source ID
</DropdownMenuItem>
- <ProjectPermissionCan
- I={ProjectPermissionSecretScanningDataSourceActions.TriggerScans}
- a={ProjectPermissionSub.SecretScanningDataSources}
- >
- {(isAllowed: boolean) => (
- <DropdownMenuItem
- isDisabled={!isAllowed || isDisconnected}
- onClick={() => onTriggerScan(dataSource)}
- >
- <ScanSearchIcon />
- Trigger Scan
- </DropdownMenuItem>
- )}
- </ProjectPermissionCan>
<ProjectPermissionCan
I={ProjectPermissionSecretScanningDataSourceActions.Edit}
a={ProjectPermissionSub.SecretScanningDataSources}
>
{(isAllowed: boolean) => (
- <>
- <DropdownMenuItem
- isDisabled={!isAllowed}
- onClick={() => onToggleEnableAutoScan(dataSource)}
- >
- {isScanNewCommitsEnabled ? <PauseIcon /> : <PlayIcon />}
- {isScanNewCommitsEnabled ? "Disable" : "Enable"} Scan New Commits
- </DropdownMenuItem>
- <DropdownMenuItem isDisabled={!isAllowed} onClick={() => onEdit(dataSource)}>
- <PencilIcon />
- Edit Data Source
- </DropdownMenuItem>
- </>
+ <DropdownMenuItem isDisabled={!isAllowed} onClick={() => onEdit(dataSource)}>
+ <PencilIcon />
+ Edit Data Source
+ </DropdownMenuItem>
)}
</ProjectPermissionCan>
<DropdownMenuSeparator />
diff --git a/frontend/src/pages/secret-scanning/SecretScanningDataSourcesPage/components/SecretScanningDataSourcesSection.tsx b/frontend/src/pages/secret-scanning/SecretScanningDataSourcesPage/components/SecretScanningDataSourcesSection.tsx
index 542532112a..793c8a792a 100644
--- a/frontend/src/pages/secret-scanning/SecretScanningDataSourcesPage/components/SecretScanningDataSourcesSection.tsx
+++ b/frontend/src/pages/secret-scanning/SecretScanningDataSourcesPage/components/SecretScanningDataSourcesSection.tsx
@@ -3,7 +3,6 @@ import { ChevronDownIcon, DatabaseIcon, FilterIcon, PlusIcon, SearchIcon } from
import { twMerge } from "tailwind-merge";
import { SecretScanningUpgradeIntent, UpgradeGate } from "@app/components/license/UpgradeGate";
-import { createNotification } from "@app/components/notifications";
import { ProjectPermissionCan } from "@app/components/permissions";
import {
CreateSecretScanningDataSourceSheet,
@@ -53,11 +52,8 @@ import { OrderByDirection } from "@app/hooks/api/generic/types";
import {
SecretScanningDataSource,
SecretScanningScanStatus,
- TSecretScanningDataSource,
TSecretScanningDataSourceWithDetails,
- useListSecretScanningDataSources,
- useTriggerSecretScanningDataSource,
- useUpdateSecretScanningDataSource
+ useListSecretScanningDataSources
} from "@app/hooks/api/secretScanningV2";
import { SecretScanningDataSourceRow } from "./SecretScanningDataSourceRow";
@@ -120,9 +116,6 @@ export const SecretScanningDataSourcesSection = () => {
);
const isLoading = subscription.secretScanning && isPending;
- const triggerDataSourceScan = useTriggerSecretScanningDataSource();
- const updateDataSource = useUpdateSecretScanningDataSource();
-
const [typeFilter, setTypeFilter] = useState<SecretScanningDataSource[]>([]);
const {
@@ -203,35 +196,6 @@ export const SecretScanningDataSourcesSection = () => {
);
};
- const handleToggleEnableAutoScan = async (dataSource: TSecretScanningDataSource) => {
- const isScanNewCommitsEnabled = !dataSource.isScanNewCommitsEnabled;
-
- await updateDataSource.mutateAsync({
- dataSourceId: dataSource.id,
- type: dataSource.type,
- isScanNewCommitsEnabled,
- projectId: dataSource.projectId
- });
-
- createNotification({
- text: `Scanning new commits ${isScanNewCommitsEnabled ? "enabled" : "disabled"} for "${dataSource.name}"`,
- type: "success"
- });
- };
-
- const handleTriggerScan = async (dataSource: TSecretScanningDataSource) => {
- await triggerDataSourceScan.mutateAsync({
- dataSourceId: dataSource.id,
- type: dataSource.type,
- projectId: dataSource.projectId
- });
-
- createNotification({
- text: `Scan triggered for "${dataSource.name}"`,
- type: "success"
- });
- };
-
const renderEmpty = () => {
if (dataSources.length) {
return (
@@ -382,8 +346,6 @@ export const SecretScanningDataSourcesSection = () => {
dataSource={dataSource}
onDelete={(ds) => handlePopUpOpen("deleteDataSource", ds)}
onEdit={(ds) => handlePopUpOpen("editDataSource", ds)}
- onTriggerScan={handleTriggerScan}
- onToggleEnableAutoScan={handleToggleEnableAutoScan}
/>
))}
</TableBody>