Skip to content

Com 20 updated table#176

Merged
7yntax merged 13 commits intomainfrom
COM-20-Updated-Table
Mar 23, 2025
Merged

Com 20 updated table#176
7yntax merged 13 commits intomainfrom
COM-20-Updated-Table

Conversation

@7yntax
Copy link
Copy Markdown
Contributor

@7yntax 7yntax commented Mar 23, 2025

Summary by CodeRabbit

  • New Features

    • Enhanced tests dashboard with dynamic filtering, updated pagination controls, and an improved table view for streamlined test management.
    • Added a new filter toolbar that supports dynamic search and easy refresh, offering a smoother user experience.
  • Bug Fixes

    • Resolved an issue with provider label formatting so that the Microsoft Azure label displays consistently regardless of input case.
  • Documentation

    • Introduced a new Integrations section in the documentation, now featuring dedicated guides for AWS, Azure, GCP, and Deel.

@linear
Copy link
Copy Markdown

linear bot commented Mar 23, 2025

COM-20 Cloud Tests

@vercel
Copy link
Copy Markdown

vercel bot commented Mar 23, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
app ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 23, 2025 4:27pm
comp-portal ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 23, 2025 4:27pm

@CLAassistant
Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 23, 2025

Walkthrough

The changes adjust how test data is filtered, displayed, and managed. Conditional logic in test details now uses a case‐insensitive comparison for Azure. The filtering and pagination parameters have been renamed (e.g., from “provider” to “severity” and “per_page” to “pageSize”) and logging added. Several components and hooks have been updated or newly introduced—including a new tests table, filter toolbar, and table context provider—while obsolete components and files have been removed. Additionally, integration documentation for AWS, Azure, Deel, and GCP has been added.

Changes

File(s) Change Summary
apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/tests/all/components/TestDetails.tsx Modified conditional formatting to use case‑insensitive check for Azure provider label.
apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/tests/all/actions/getTests.ts Renamed parameters: replaced provider with severity and per_page with pageSize; added logging and updated filtering logic.
apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/tests/all/components/TestsList.tsx Simplified props and search logic; replaced skeleton loading with a Loading component and enhanced error messaging.
apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/tests/all/components/TestsListSkeleton.tsx Removed obsolete component for skeleton loading.
apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/tests/all/components/table/TestsTable.tsx
apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/tests/all/components/table/columns.tsx
apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/tests/all/components/table/empty-states.tsx
apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/tests/all/components/table/filter-toolbar.tsx
apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/tests/all/components/table/filterCategories.tsx
apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/tests/all/components/table/filterConfigs.tsx
apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/tests/all/components/table/loading.tsx
Introduced a new TestsTable component with updated column definitions, filtering, and pagination. Added new files for filter toolbar, categories, and filter configurations; adjusted visibility and layout of table cells.
apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/tests/all/hooks/useTests.ts
apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/tests/all/hooks/useTestsTableContext.tsx
apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/tests/all/hooks/use-compliance-scores.ts
Updated useTests hook to accept a search parameter and use severity filtering; introduced a new context and hook (TestsTableContext/useTestsTable) for managing table state.
apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/tests/all/page.tsx
apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/tests/all/types/index.ts
Removed dependency on server-provided column headers and updated type definitions to include severity and pageSize.
(Multiple files in apps/app/src/components/tables/tests/) Removed obsolete table components and pagination logic (data-table-pagination.tsx, data-table.tsx, filter-toolbar.tsx, server-columns.tsx, and columns definitions) that are no longer in use.
packages/docs/docs.json
packages/docs/integrations/*.mdx
Added a new “Integrations” tab with guides for AWS, Azure, Deel, and GCP, expanding the documentation structure.
packages/integrations/src/azure/src/index.ts Modified compliance data fetching so that the Status value is transformed to uppercase.

Sequence Diagram(s)

sequenceDiagram
  participant U as User
  participant FT as FilterToolbar
  participant TC as TestsTableContext
  participant HT as useTests Hook
  participant API as Backend API
  participant TT as TestsTable

  U->>FT: Enters search / toggles filter
  FT->>TC: Updates filter state (search, severity, status)
  TC->>HT: Triggers data fetch with new parameters
  HT->>API: Request filtered test data
  API-->>HT: Return test data
  HT-->>TC: Update context state with results
  TC->>TT: Render updated table view
Loading

Poem

I'm a little rabbit, hopping through code so neat,
Skipping through filters and tables with every beat.
I nibble on changes, both big and small,
From new hooks to docs, I wonder at them all.
With a twitch of my nose, I cheer each line—
CodeRabbit delights when the fixes align!
🐰💻 hops on in with a joyful design!

✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@7yntax 7yntax merged commit 92a66ba into main Mar 23, 2025
4 of 7 checks passed
Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

🧹 Nitpick comments (23)
apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/tests/all/components/table/empty-states.tsx (1)

9-27: Consider extracting common empty state UI patterns.

Both NoTests and NoResults components share similar UI structures (centered layout, icon, title, description). You might consider creating a base EmptyState component to reduce duplication and ensure consistent styling across empty states.

+ interface EmptyStateProps {
+   icon?: React.ReactNode;
+   title: string;
+   description: string;
+   actions?: React.ReactNode;
+   className?: string;
+ }
+
+ function EmptyState({ icon, title, description, actions, className }: EmptyStateProps) {
+   return (
+     <div className={cn("mt-24 flex items-center justify-center", className)}>
+       <div className="flex flex-col items-center">
+         {icon || <CloudOff className="mb-4 h-12 w-12 text-muted-foreground" />}
+         <div className="text-center mb-6 space-y-2">
+           <h2 className="font-medium text-lg">{title}</h2>
+           <p className="text-muted-foreground text-sm">{description}</p>
+         </div>
+         {actions}
+       </div>
+     </div>
+   );
+ }

Then you could simplify both components:

export function NoTests() {
  const t = useI18n();
  
  return (
    <EmptyState
      title={t("tests.empty.no_tests.title")}
      description={t("tests.empty.no_tests.description")}
      actions={<EmployeeInviteSheet />}
      className="absolute w-full top-0 left-0 z-20"
    />
  );
}

Also applies to: 29-60

packages/docs/integrations/aws.mdx (1)

20-23: Duplicate Header in "Configuration Steps"
There is a duplicate "### Configuration Steps" header at lines 20 and 22. Please remove the redundant header (suggest removing the one at line 22) to streamline the document.

-### Configuration Steps
packages/docs/integrations/azure.mdx (2)

53-62: Role Assignment Instructions Need Minor Grammatical Adjustment.
In the step “Assign access to: User, group, or service principal” (line 60), consider removing the colon or rephrasing it (for example, "Assign access for User, group, or service principal") for improved readability.

🧰 Tools
🪛 LanguageTool

[typographical] ~60-~60: Do not use a colon (:) before a series that is introduced by a preposition (‘to’). Remove the colon or add a noun or a noun phrase after the preposition.
Context: ...hanced visibility) - Assign access to: User, group, or service principal ...

(RP_COLON)


120-132: Troubleshooting Section: Minor Language Correction.
At line 131, consider adding the article "the" before "secret" to read: "Ensure the service principal hasn't expired and the secret is valid."

🧰 Tools
🪛 LanguageTool

[uncategorized] ~131-~131: You might be missing the article “the” here.
Context: ...he service principal hasn't expired and secret is valid ### Support For additional a...

(AI_EN_LECTOR_MISSING_DETERMINER_THE)

apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/tests/all/types/index.ts (1)

64-76: Consider making TestSeverity more type-safe

The TestSeverity type includes null as a valid option. Consider whether having a distinct string value like "UNKNOWN" or "NONE" might be more type-safe than allowing null. This would make the code less prone to null reference errors.

Also, the createdAt field accepts both string and Date types. Consider standardizing to a single type and handling conversions when needed.

- export type TestSeverity = "INFO" | "LOW" | "MEDIUM" | "HIGH" | "CRITICAL" | null;
+ export type TestSeverity = "INFO" | "LOW" | "MEDIUM" | "HIGH" | "CRITICAL" | "UNKNOWN";

interface TestRow {
  id: string;
  severity: TestSeverity;
  result: TestResult;
  title: string;
  provider: string;
-  createdAt: string | Date; // Allow both string and Date to handle different data formats
+  createdAt: Date; // Standardize on Date and convert strings when needed
  assignedUser: {
    id: string;
    name: string | null;
    image: string | null;
  } | null;
}
apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/tests/all/actions/getTests.ts (1)

20-26: Added logging for improved debugging

Added logging statements for search parameters, which will help with debugging and understanding the function's behavior during execution.

Consider using a structured logging approach or removing these logs before production deployment to avoid console noise.

-    console.log("--------------------------------");
-    console.log("search", search);
-    console.log("severity", severity);
-    console.log("status", status);
-    console.log("page", page);
-    console.log("pageSize", pageSize);
-    console.log("--------------------------------");
+    // Use structured logging or conditional logging based on environment
+    if (process.env.NODE_ENV !== 'production') {
+      console.log({
+        search,
+        severity,
+        status,
+        page,
+        pageSize
+      });
+    }
apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/tests/all/hooks/useTests.ts (2)

61-66: Clarify the purpose of the tests formatting transformation.

The current implementation creates a new object with the same createdAt property without any transformation. If the intention is to ensure createdAt is a string (as suggested by the comment), this should be more explicit.

  // Format the tests to match the TestRow type
  const formattedTests = data?.tests.map(test => ({
    ...test,
    // Convert Date to string for use in components if needed
-   createdAt: test.createdAt
+   createdAt: typeof test.createdAt === 'string' 
+     ? test.createdAt 
+     : new Date(test.createdAt).toISOString()
  })) || [];

This explicitly converts createdAt to a string if it isn't already one, which aligns with the comment's intent.


39-39: Consider validating the search parameter.

The search parameter is now passed as an argument rather than being extracted from the URL, but there's no validation to handle cases where it might be unexpectedly null or an empty string.

-export function useTests(search: string | undefined) {
+export function useTests(search?: string) {
  const searchParams = useSearchParams();
+  const normalizedSearch = search?.trim() || '';
  const severity = searchParams.get("severity") || undefined;
  // ... rest of the function

  } = useSWR<TestsResponse, AppError>(
-   ["tests", { search, severity, status, page, pageSize }],
-   () => fetchTests({ search, severity, status, page, pageSize }),
+   ["tests", { search: normalizedSearch, severity, status, page, pageSize }],
+   () => fetchTests({ search: normalizedSearch, severity, status, page, pageSize }),

This ensures that the search parameter is always a string and trims any whitespace.

apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/tests/all/components/table/columns.tsx (4)

14-17: Consider using distinct colors for INFO and LOW severity levels.

Both "INFO" and "LOW" severity badges use the same bg-muted-foreground class, which may make it difficult for users to distinguish between these different severity levels at a glance.

    case "INFO":
-      return <Badge className="bg-muted-foreground">{severity}</Badge>;
+      return <Badge className="bg-slate-400">{severity}</Badge>;
    case "LOW":
      return <Badge className="bg-muted-foreground">{severity}</Badge>;

42-45: Improve type safety in getProviderLogo function.

The current implementation has potential type safety issues when accessing the integration logo.

const getProviderLogo = (provider: string): string => {
  const integration = integrations.find((i) => i.id === provider);
-  return typeof integration?.logo === 'string' ? integration.logo : '';
+  return integration && typeof integration.logo === 'string' ? integration.logo : '';
};

115-122: Add error handling for invalid dates.

The code assumes that row.original.createdAt will always be convertible to a valid Date object, but this may not always be the case.

const date = new Date(row.original.createdAt);
+const isValidDate = !isNaN(date.getTime());
return (
  <div className="text-muted-foreground">
-    {date.toLocaleDateString("en-US", {
+    {isValidDate ? date.toLocaleDateString("en-US", {
      year: "numeric",
      month: "short",
      day: "numeric",
-    })}
+    }) : "Invalid date"}
  </div>
);

75-81: Improve accessibility of clickable title.

The current button implementation could be enhanced with more explicit accessibility attributes.

<button
  type="button"
  className="text-left hover:underline"
  onClick={() => handleRowClick(row.original.id)}
+  aria-label={`View details for ${title}`}
>
  <span className="truncate">{title}</span>
</button>
apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/tests/all/components/TestsList.tsx (3)

10-10: Pass the search parameter dynamically.

The code passes an empty string as a static parameter to the useTests hook. Consider making this parameter dynamic or clarify the intention.

- const { tests, isLoading, error } = useTests('');
+ // Using empty string intentionally as search state is managed by TestsTableProvider
+ const { tests, isLoading, error } = useTests('');

27-27: Add a more descriptive empty state check.

The current empty check could be more explicit about checking if the tests array exists before checking its length.

- if (tests.length === 0) {
+ if (!tests || tests.length === 0) {

18-22: Add retry functionality for error state.

Consider adding a retry button when there's an error loading tests to improve user experience.

<div className="space-y-4">
  <h2 className="text-xl font-semibold">Tests</h2>
  <div className="border p-4 rounded-md bg-red-50 text-red-800">
    Error loading tests: {error.message}
+   <button 
+     className="ml-2 px-3 py-1 bg-red-100 text-red-800 rounded-md hover:bg-red-200" 
+     onClick={() => window.location.reload()}
+   >
+     Retry
+   </button>
  </div>
</div>
apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/tests/all/hooks/useTestsTableContext.tsx (3)

79-84: Use React's cleanup pattern for setTimeout.

The current implementation using setTimeout doesn't follow React's cleanup pattern, which could lead to potential memory leaks.

// Track when loading changes
useEffect(() => {
  if (isLoading === false) {
    // Small delay to ensure UI transitions properly
-   setTimeout(() => {
+   const timer = setTimeout(() => {
      initialLoadCompleted.current = true;
      setIsSearching(false);
    }, 50);
+   return () => clearTimeout(timer);
  }
}, [isLoading]);

63-64: Remove unused variables.

The variables currentPage and currentPageSize are defined but never used in the component.

- const currentPage = Number.parseInt(page, 10);
- const currentPageSize = Number.parseInt(pageSize, 10);

99-101: Enhance active filters check with search condition.

The current implementation only considers severity and status for active filters, but not the search term.

// Check if any filters are active
const hasActiveFilters = useMemo(() => {
- return severity !== null || status !== null;
+ return severity !== null || status !== null || !!search;
}, [severity, status, search]);
apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/tests/all/components/table/filter-toolbar.tsx (1)

28-40: Consider separating page reload from success notification

The current implementation reloads the entire page on successful test refresh, which might disrupt the user experience. Consider using a more targeted approach to refresh only the necessary data.

export function refreshTests = useAction(refreshTestsAction, {
  onSuccess: () => {
    toast.success(t("tests.actions.refresh_success"));
-   window.location.reload();
+   // Instead of full page reload, consider:
+   // 1. Use a context-based approach to refresh just the tests data
+   // 2. Trigger a refetch action that updates the state
  },
  onError: () => {
    toast.error(t("tests.actions.refresh_error"));
  },
});
apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/tests/all/components/table/TestsTable.tsx (3)

38-46: Consider avoiding full page reload on refresh

Similar to the filter-toolbar component, this component also performs a full page reload on successful test refresh, which might disrupt the user experience.

const refreshTests = useAction(refreshTestsAction, {
  onSuccess: () => {
    toast.success(t("tests.actions.refresh_success"));
-   window.location.reload();
+   // Consider a more targeted refresh approach:
+   // 1. Refetch only the tests data
+   // 2. Update the state through context
  },
  onError: () => {
    toast.error(t("tests.actions.refresh_error"));
  },
});

52-60: Clean filter category configuration with unnecessary verbosity

The filter categories configuration looks good but has some unnecessary verbosity in property assignments.

const filterCategories = getFilterCategories({
  status,
  setStatus,
- severity: severity,
- setSeverity: setSeverity,
+ severity,
+ setSeverity,
  setPage,
});

48-50: Consider using router.push instead of router.replace for navigation

Using router.replace for row click navigation will replace the current history entry, which might not be the expected behavior if users want to use the back button to return to the table view.

const handleRowClick = (testId: string) => {
-  router.replace(`/${orgId}/tests/all/${testId}`);
+  router.push(`/${orgId}/tests/all/${testId}`);
};
apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/tests/all/components/table/filterCategories.tsx (1)

13-44: Well-implemented filter categories generator with proper state management.

The getFilterCategories function effectively maps the predefined filters to UI-ready objects with the correct checked state and onChange handlers. I particularly appreciate:

  1. The use of the spread operator to maintain existing filter properties
  2. The conditional logic in onChange that properly toggles filters
  3. Resetting the page to "1" when filters change to ensure consistent pagination

This implementation follows React best practices for filter state management.

Consider adding JSDoc comments to document the function's purpose and return value. Also, if this function is called frequently in a parent component, consider wrapping it with useMemo for optimization.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between eb9df88 and 3a95960.

📒 Files selected for processing (29)
  • apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/tests/all/[testId]/components/TestDetails.tsx (1 hunks)
  • apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/tests/all/actions/getTests.ts (5 hunks)
  • apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/tests/all/components/TestsList.tsx (1 hunks)
  • apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/tests/all/components/TestsListSkeleton.tsx (0 hunks)
  • apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/tests/all/components/table/TestsTable.tsx (1 hunks)
  • apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/tests/all/components/table/columns.tsx (1 hunks)
  • apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/tests/all/components/table/data-table-header.tsx (3 hunks)
  • apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/tests/all/components/table/empty-states.tsx (1 hunks)
  • apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/tests/all/components/table/filter-toolbar.tsx (1 hunks)
  • apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/tests/all/components/table/filterCategories.tsx (1 hunks)
  • apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/tests/all/components/table/filterConfigs.tsx (1 hunks)
  • apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/tests/all/components/table/loading.tsx (2 hunks)
  • apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/tests/all/hooks/useTests.ts (1 hunks)
  • apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/tests/all/hooks/useTestsTableContext.tsx (1 hunks)
  • apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/tests/all/page.tsx (2 hunks)
  • apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/tests/all/types/index.ts (3 hunks)
  • apps/app/src/components/tables/tests/columns.tsx (0 hunks)
  • apps/app/src/components/tables/tests/data-table-pagination.tsx (0 hunks)
  • apps/app/src/components/tables/tests/data-table.tsx (0 hunks)
  • apps/app/src/components/tables/tests/filter-toolbar.tsx (0 hunks)
  • apps/app/src/components/tables/tests/server-columns.tsx (0 hunks)
  • apps/app/src/hooks/use-compliance-scores.ts (1 hunks)
  • packages/docs/docs.json (1 hunks)
  • packages/docs/integrations/aws.mdx (1 hunks)
  • packages/docs/integrations/azure.mdx (1 hunks)
  • packages/docs/integrations/deel.mdx (1 hunks)
  • packages/docs/integrations/gcp.mdx (1 hunks)
  • packages/docs/integrations/index.mdx (1 hunks)
  • packages/integrations/src/azure/src/index.ts (1 hunks)
💤 Files with no reviewable changes (6)
  • apps/app/src/components/tables/tests/server-columns.tsx
  • apps/app/src/components/tables/tests/columns.tsx
  • apps/app/src/components/tables/tests/data-table-pagination.tsx
  • apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/tests/all/components/TestsListSkeleton.tsx
  • apps/app/src/components/tables/tests/filter-toolbar.tsx
  • apps/app/src/components/tables/tests/data-table.tsx
🧰 Additional context used
🧬 Code Definitions (6)
apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/tests/all/page.tsx (1)
apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/tests/all/components/TestsList.tsx (1)
  • TestsList (9-43)
apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/tests/all/components/table/TestsTable.tsx (3)
apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/tests/all/hooks/useTestsTableContext.tsx (1)
  • useTestsTable (146-156)
apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/tests/all/components/table/filterCategories.tsx (1)
  • getFilterCategories (13-44)
apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/tests/all/components/table/columns.tsx (1)
  • getColumns (47-149)
apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/tests/all/components/table/columns.tsx (1)
apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/tests/all/types/index.ts (3)
  • TestSeverity (62-62)
  • TestResult (61-61)
  • TestRow (64-76)
apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/tests/all/components/TestsList.tsx (5)
apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/tests/all/hooks/useTests.ts (1)
  • useTests (39-75)
apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/tests/all/components/table/loading.tsx (1)
  • Loading (11-63)
apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/tests/all/components/table/empty-states.tsx (1)
  • NoTests (9-27)
apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/tests/all/hooks/useTestsTableContext.tsx (1)
  • TestsTableProvider (47-144)
apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/tests/all/components/table/TestsTable.tsx (1)
  • TestsTable (14-103)
apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/tests/all/components/table/filterCategories.tsx (1)
apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/tests/all/components/table/filterConfigs.tsx (2)
  • STATUS_FILTERS (3-19)
  • SEVERITY_FILTERS (21-47)
apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/tests/all/hooks/useTestsTableContext.tsx (1)
apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/tests/all/hooks/useTests.ts (1)
  • useTests (39-75)
🪛 LanguageTool
packages/docs/integrations/azure.mdx

[typographical] ~60-~60: Do not use a colon (:) before a series that is introduced by a preposition (‘to’). Remove the colon or add a noun or a noun phrase after the preposition.
Context: ...hanced visibility) - Assign access to: User, group, or service principal ...

(RP_COLON)


[uncategorized] ~131-~131: You might be missing the article “the” here.
Context: ...he service principal hasn't expired and secret is valid ### Support For additional a...

(AI_EN_LECTOR_MISSING_DETERMINER_THE)

🔇 Additional comments (68)
apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/tests/all/components/table/loading.tsx (3)

11-11: Improved function signature

The function signature has been cleaned up by removing the unnecessary trailing semicolon, which aligns with common TypeScript style conventions.


23-31: Enhanced cell dimensions for better content display

The cell widths have been increased from 50px to 100px, and the skeleton width has been adjusted from 15px to 50px. These changes provide more appropriate space for the content and improve the loading state visualization.


38-38: Improved responsive design for better mobile experience

The responsive breakpoint has been changed from sm to md for table cells, meaning these columns will only be visible on medium-sized screens and larger. This improves the mobile experience by reducing clutter on smaller screens.

Also applies to: 43-43, 48-48

apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/tests/all/components/table/empty-states.tsx (3)

29-29: Improved type safety for hasFilters parameter.

Making hasFilters a required parameter ensures that consumers of this component must explicitly provide this value, preventing potential runtime issues from undefined values.


9-27: LGTM: NoTests component implementation.

The component appropriately displays a user-friendly message when no tests are available, with proper internationalization support and clear visual hierarchy.


7-8: Import organization looks good.

The import for EmployeeInviteSheet is properly positioned with other imports at the top of the file, maintaining good code organization.

packages/docs/docs.json (1)

37-51: New "Integrations" Tab Added – Verify Navigation Integrity
The new tab with "tab": "Integrations" and its nested group "Integrations Guides" (with pages for integrations) is correctly structured and consistent with the existing navigation. Please verify that the links (e.g., "integrations/index", "integrations/deel", etc.) resolve properly in the documentation build process.

packages/docs/integrations/index.mdx (2)

1-4: Front Matter Verification
The YAML front matter is correctly set with the title "Integrations" and description "Comp AI Integration Guide". Ensure that these values match the intended navigation and display settings in the documentation.


6-21: Overall Document Structure – New Integrations Guide
This new file clearly outlines the supported integrations. The sections "Supported Integrations," "Deel Integration," and "Cloud Provider Integrations" are well organized. Verify that all internal links (e.g., to setup instructions) correspond to existing pages.

packages/docs/integrations/deel.mdx (2)

1-4: Front Matter Verification
The front matter with title "Deel Integration" and description "Sync employee data from Deel to Comp AI" is correctly formatted. This sets the proper context for the document.


6-71: Comprehensive Integration Guide Content
The document is well structured with clear sections on setup, configuration, data synchronization, and troubleshooting. The step-by-step guide is easy to follow, and the table detailing imported data fields is clear. Consider linking to additional resources (or screenshots) if available to augment the guide.

packages/docs/integrations/aws.mdx (2)

1-4: Front Matter and Title Verification
The YAML front matter with title "AWS Integration" and description "Connect AWS to Comp AI for cloud security testing" is correct.


6-99: AWS Integration Content Review
The file provides a detailed and comprehensive guide for AWS integration—including prerequisites, configuration steps, and capabilities. Ensure that all IAM policies and the recommended configuration details are up-to-date with AWS best practices.

packages/docs/integrations/gcp.mdx (3)

1-4: Front Matter and Title Verification
The front matter with title "GCP Integration" and description "Connect Google Cloud Platform to Comp AI for cloud security testing" is correctly formatted.


6-37: GCP Setup and Configuration Clarity
The setup process and configuration steps are clearly described with separate options for service account and Terraform-based integration. Verify that any referenced Terraform modules or additional resources are available for users.


39-104: Comprehensive GCP Integration Documentation
The sections on capabilities, compliance frameworks, managing access, and troubleshooting are well documented and provide clear guidance. The support section correctly refers to GCP integration.

packages/docs/integrations/azure.mdx (13)

1-4: Front Matter Structure Looks Good.
The YAML front matter clearly sets the title and description for the Azure integration documentation.


6-8: Introductory Section is Clear.
The header and introductory paragraph concisely introduce the purpose of the documentation.


10-19: Prerequisites and Setup Process.
This section effectively outlines the necessary prerequisites with an ordered list, ensuring users know what is required before proceeding.


24-26: Azure Portal Login Instructions are Clear.
The instructions for logging into the Azure portal, including the appropriate link, are well-stated and user friendly.


27-33: Microsoft Defender for Cloud Setup Guidelines.
The steps for enabling Microsoft Defender for Cloud, including waiting for provisioning, are comprehensive and easy to follow.


34-40: Azure AD Application Registration.
The registration process for a new application in Azure AD is clearly detailed, providing necessary options such as app naming and account type selection.


41-45: Retrieving Client and Tenant IDs.
The instructions for copying the Client ID and Tenant ID from the app's Overview page are straightforward and clear.


46-52: Client Secret Creation Steps are Well Defined.
Clear guidance is provided on creating and copying the client secret immediately, which is crucial since it cannot be viewed again later.


63-72: Connecting Azure to Comp AI is Well Documented.
The step-by-step guide for connecting Azure to Comp AI—including entering the necessary credentials—is clear and detailed.


74-89: Security Tests and Capabilities Table is Structured Well.
The table neatly outlines the various security assessments performed by the integration, making it easy for users to understand the capabilities at a glance.


90-100: Compliance Frameworks Section is Concise and Informative.
Listing the compliance frameworks provides users with a quick understanding of the standards the integration checks against.


101-119: Managing Access Section is Thorough.
This section clearly delineates what permissions the Azure application/service principal has and further clarifies the limitations, maintaining transparency about the integration's capabilities.


133-139: Support Section is Clear and Concise.
The support instructions are well-organized, providing multiple helpful resources such as a knowledge base, a support email, and a Discord community link.

apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/tests/all/types/index.ts (4)

25-25: Schema parameter renamed from per_page to pageSize

The parameter has been renamed from per_page to pageSize, which improves naming consistency with conventional pagination APIs. This is a breaking change that will affect API consumers.


61-62: Good addition of strongly typed enums

The addition of proper type definitions for TestResult and TestSeverity improves type safety throughout the application.


78-85: Well-structured TestsTableProps interface

The TestsTableProps interface is well-defined with clear property types and appropriate optionality.


22-22:

Details

❓ Verification inconclusive

Schema parameter renamed from provider to severity

The parameter has been renamed from provider to severity, which aligns well with the rest of the changes in this PR. This is a breaking change that affects API consumers.


🏁 Script executed:

#!/bin/bash
# Check if there are any remaining instances of using "provider" as a filter parameter
rg -A 2 -B 2 "provider:\s*z\.string\(\)\.optional\(\)" --glob "*.ts" --glob "*.tsx"

Length of output: 85


Provider to Severity Schema Update – Please Manually Verify Remaining References

  • The schema parameter has been successfully renamed from provider to severity (see the code snippet:
      severity: z.string().optional(),
    in apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/tests/all/types/index.ts at line 22).
  • An initial search for the pattern "provider:\s*z\.string\(\)\.optional\(\)" produced no output, which suggests that the change is complete. However, the absence of results (i.e., a low-quality inference) means it’s prudent to manually verify that no lingering references to provider exist elsewhere in the codebase.

Please ensure a manual confirmation on this breaking change for all API consumers.

packages/integrations/src/azure/src/index.ts (1)

151-151: Improved case normalization for Azure compliance status

Converting state to uppercase ensures consistency in status values, which is important for reliable comparisons elsewhere in the application. This complements the change in TestDetails.tsx that now uses case-insensitive comparison for Azure.

apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/tests/all/[testId]/components/TestDetails.tsx (1)

69-69: Fixed Azure provider case comparison

Changed the comparison from case-sensitive "AZURE" to case-insensitive "azure", which ensures proper provider label display regardless of the case used in the provider value. This complements the Azure integration change that now normalizes state values to uppercase.

apps/app/src/hooks/use-compliance-scores.ts (1)

55-55:

Details

✅ Verification successful

Updated useTests hook call with required parameter

The call to useTests() has been updated to include an empty string parameter, aligning with changes to the hook's interface. This ensures compatibility with the updated hook signature while maintaining the same functionality.


🏁 Script executed:

#!/bin/bash
# Check the updated signature of the useTests hook to confirm this change is correct
rg -A 5 "export function useTests" --glob "*.ts" --glob "*.tsx"

Length of output: 1639


Verified Update: Correct useTests Hook Parameter Usage

The use of useTests('') now correctly aligns with the updated hook signature (export function useTests(search: string | undefined) { ... }). No further changes are required.

apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/tests/all/page.tsx (2)

23-23: LGTM: Simplification of TestsList component usage

The component is now being rendered without props, which aligns with the updated implementation in TestsList.tsx that no longer requires the columnHeaders prop and internally handles data fetching via the useTests hook.


40-41: Removed empty lines

These empty lines were removed, which helps with code cleanliness.

apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/tests/all/components/table/filterConfigs.tsx (2)

1-19: Well-structured status filters with clear visual indicators

The STATUS_FILTERS array provides a clear definition of test statuses with appropriate icons from lucide-react, making the UI more intuitive. The use of as const ensures type safety by making the array read-only.


21-47: Well-defined severity filters with consistent styling

The SEVERITY_FILTERS array provides a comprehensive set of severity levels with visual indicators. Each severity has a distinct color, which helps with quick identification in the UI.

apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/tests/all/components/table/data-table-header.tsx (12)

48-48: Improved dependency array in useCallback

The dependency array now correctly includes all dependencies used in the callback function, which prevents potential stale closure issues.


62-63: Enhanced visibility of table headers

Removed the hidden md:table-cell class, making the severity header visible on medium-sized screens and larger, which improves the user experience.


66-67: Updated sort query parameter from "status" to "severity"

Changed the sorting parameter from "status" to "severity", which aligns with the changes in the data model and filtering capabilities.


76-77: Enhanced visibility of result header

Removed the hidden md:table-cell class, making the result header visible on medium-sized screens and larger.


90-91: Enhanced visibility of title header

Removed the hidden md:table-cell class, making the title header visible on medium-sized screens and larger.


97-98: Improved code formatting for better readability

Removed unnecessary parentheses around the arrow icons for sorting, which improves code readability without changing functionality.


104-105: Enhanced visibility of provider header

Removed the hidden md:table-cell class, making the provider header visible on medium-sized screens and larger.


111-112: Improved code formatting for better readability

Removed unnecessary parentheses around the arrow icons for sorting for the provider column.


118-119: Enhanced visibility of createdAt header

Removed the hidden md:table-cell class, making the createdAt header visible on medium-sized screens and larger.


125-126: Improved code formatting for better readability

Removed unnecessary parentheses around the arrow icons for sorting for the createdAt column.


132-133: Enhanced visibility of assignedUser header

Removed the hidden md:table-cell class, making the assignedUser header visible on medium-sized screens and larger.


139-140: Improved code formatting for better readability

Removed unnecessary parentheses around the arrow icons for sorting for the assignedUser column.

apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/tests/all/actions/getTests.ts (5)

17-17: Updated parameter names for consistency

Changed parameter extraction from parsedInput, replacing provider with severity and per_page with pageSize for better naming consistency across the codebase.


36-36: Updated pagination calculation

Updated the pagination calculation to use pageSize instead of per_page, which aligns with the parameter naming changes.


61-62: Enhanced filtering capabilities

Updated the condition for status to use an object with equals and mode properties, and added a new condition for severity to filter results based on its value. These changes improve the filtering capabilities of the function and align with the Prisma query API.


82-82: Updated pagination parameter

Updated the take parameter to use pageSize instead of per_page, which aligns with the parameter naming changes.


106-107: Consistent filtering in count query

Updated the filtering conditions in the count query to match those in the main query, ensuring consistent results. This includes updating the condition for status and adding a new condition for severity.

apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/tests/all/hooks/useTests.ts (3)

39-45: Function signature and parameter extraction updated correctly.

The changes to the useTests hook signature and parameter extraction are appropriate. The hook now accepts a search parameter and properly extracts severity (formerly provider) and pageSize (formerly per_page) from the search parameters.


47-59: SWR configuration updated correctly for new parameters.

The SWR key and fetch function parameters have been properly updated to include severity instead of provider and to use the pageSize parameter.


68-74: Return object updated with appropriate values.

The return object now includes formattedTests instead of raw data and revalidateTests instead of isMutating, which is appropriate for the updated functionality.

apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/tests/all/components/table/filter-toolbar.tsx (4)

42-57: Well-implemented query string helper

The createQueryString function is well-implemented with proper handling of null values and memoization using useCallback, which helps with performance optimization.


61-70: Good use of debouncing and transitions

Using debouncing for the search input and wrapping the router navigation in a transition reduces unnecessary API calls and prevents UI jank during updates.


75-85: Conditional rendering based on isEmpty prop

The component correctly handles the isEmpty prop to conditionally render the search input, making it flexible for different use cases.


89-102: Clean implementation of the clear button

The clear button implementation is clean and effective, providing users with an easy way to reset their search and navigate back to the base view.

apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/tests/all/components/table/TestsTable.tsx (2)

62-73: Well-implemented conditional pagination calculation

The pagination calculation is well-implemented with a defensive approach, only calculating values when the total is defined. This prevents potential errors from undefined values.


75-101: Comprehensive DataTable configuration

The DataTable configuration is comprehensive, covering all necessary aspects of the table functionality including data loading, pagination, search, filters, and actions. The props are well-structured and clearly defined.

apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/tests/all/components/table/filterCategories.tsx (2)

1-4: LGTM! Good use of client-side directive and clean imports.

The "use client" directive is correctly placed at the top of the file, indicating this is a React Client Component. The imports are clean and specific, bringing in only what's needed from the filterConfigs file.


5-11: Well-structured TypeScript interface with appropriate types.

The FilterCategoriesProps interface is well-defined with clear typing for each property. Using string | null for filter values is appropriate since filters can be unselected.

Comment on lines +100 to +104
### Support

For additional assistance with your Azure integration:

1. Check our [Knowledge Base](https://help.trycomp.ai/azure-integration)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Incorrect Support Section Text
The support section mistakenly refers to "Azure integration" instead of "AWS integration." Update the text accordingly to avoid confusion.

-For additional assistance with your Azure integration:
+For additional assistance with your AWS integration:
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
### Support
For additional assistance with your Azure integration:
1. Check our [Knowledge Base](https://help.trycomp.ai/azure-integration)
### Support
For additional assistance with your AWS integration:
1. Check our [Knowledge Base](https://help.trycomp.ai/azure-integration)

Comment on lines +20 to +23
### Configuration Steps

### Configuration Steps

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Duplicate Section Heading Detected.
The "### Configuration Steps" heading appears twice (lines 20 and 22). Consider removing one instance to enhance clarity and avoid redundancy.

setPageSize: (value: string) => void;

// Data
tests: any[] | undefined;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Replace any[] with a more specific type.

Using any[] for the tests array lacks type safety. Consider using a more specific type based on your test data structure.

- tests: any[] | undefined;
+ tests: TestRow[] | undefined;

Don't forget to import the TestRow type at the top of the file:

import type { TestRow } from "../../types";

Comment on lines +89 to +95
if (tests && isSearching) {
// If we have data, ensure isSearching is eventually set to false
const timer = setTimeout(() => {
setIsSearching(false);
}, 100);
return () => clearTimeout(timer);
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Add error handling for race conditions.

The effect that resets isSearching when tests data changes could behave unexpectedly if multiple data fetches occur in quick succession.

// Additional safety reset for isSearching when data changes
useEffect(() => {
- if (tests && isSearching) {
+ if (tests && isSearching) {
    // If we have data, ensure isSearching is eventually set to false
    const timer = setTimeout(() => {
      setIsSearching(false);
    }, 100);
    return () => clearTimeout(timer);
  }
}, [tests, isSearching]);

Consider adding a more robust approach with a request identifier to track and cancel outdated requests.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if (tests && isSearching) {
// If we have data, ensure isSearching is eventually set to false
const timer = setTimeout(() => {
setIsSearching(false);
}, 100);
return () => clearTimeout(timer);
}
useEffect(() => {
if (tests && isSearching) {
// If we have data, ensure isSearching is eventually set to false
const timer = setTimeout(() => {
setIsSearching(false);
}, 100);
return () => clearTimeout(timer);
}
}, [tests, isSearching]);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants