-
Notifications
You must be signed in to change notification settings - Fork 424
Com 20 gcp azure #158
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Com 20 gcp azure #158
Changes from all commits
5112bfd
4dfddb3
7553952
bc186c5
69606af
195268d
54c0490
b41f40d
63a0d95
fd29e51
b037037
b7b3242
cc550f1
122fa66
50115cd
40ea7bd
6a0b3a6
953035f
2d312b8
12c1ad5
93fdd1f
984256b
7a30baa
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,34 +4,22 @@ import { Card, CardContent, CardHeader, CardTitle } from "@bubba/ui/card"; | |
| import { useI18n } from "@/locales/client"; | ||
| import { useTest } from "../../hooks/useTest"; | ||
| import { Skeleton } from "@bubba/ui/skeleton"; | ||
| import { AlertCircle, CheckCircle2, Clock, Info, XCircle, User as UserIcon } from "lucide-react"; | ||
| import { AlertCircle, User as UserIcon } from "lucide-react"; | ||
| import { Alert, AlertDescription, AlertTitle } from "@bubba/ui/alert"; | ||
| import { Label } from "@bubba/ui/label"; | ||
| import { Tabs, TabsContent, TabsList, TabsTrigger } from "@bubba/ui/tabs"; | ||
| import { Badge } from "@bubba/ui/badge"; | ||
| import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@bubba/ui/table"; | ||
| import { AssigneeSection } from "./AssigneeSection"; | ||
| import { TestComment } from "./TestComments"; | ||
| import { unstable_cache } from "next/cache"; | ||
| import { db } from "@bubba/db"; | ||
| import type { Test } from "../../types"; | ||
| import type { User } from "@bubba/db/types"; | ||
|
|
||
| interface CloudTestDetailsProps { | ||
| testId: string; | ||
| users: User[]; | ||
| } | ||
|
|
||
| const getUsers = unstable_cache( | ||
| async (organizationId: string) => { | ||
| const users = await db.user.findMany({ | ||
| where: { organizationId: organizationId }, | ||
| }); | ||
|
|
||
| return users; | ||
| }, | ||
| ["users-cache"], | ||
| ); | ||
|
|
||
| export function TestDetails({ testId, users }: CloudTestDetailsProps) { | ||
| const t = useI18n(); | ||
| const { cloudTest, isLoading, error, mutate } = useTest(testId); | ||
|
|
@@ -85,9 +73,9 @@ export function TestDetails({ testId, users }: CloudTestDetailsProps) { | |
| // Format the test status for display with appropriate badge color | ||
| const getStatusBadge = (status: string) => { | ||
| switch(status.toUpperCase()) { | ||
| case "ACTIVE": | ||
| case "PASSED": | ||
| return <Badge className="bg-green-500">{status}</Badge>; | ||
| case "DRAFT": | ||
| case "IN_PROGRESS": | ||
| return <Badge className="bg-yellow-500">{status}</Badge>; | ||
|
Comment on lines
+76
to
79
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Verification agent 🧩 Analysis chainVerify status name changes across the application You've changed status names from "ACTIVE" to "PASSED" and "DRAFT" to "IN_PROGRESS", which makes them more descriptive. However, ensure these changes are consistent across the application to prevent potential bugs. 🏁 Script executed: #!/bin/bash
# Check for references to the old status names (ACTIVE, DRAFT) in the codebase
echo "Searching for references to old status names..."
rg -i "('|\")ACTIVE('|\")" --type tsx --type ts
rg -i "('|\")DRAFT('|\")" --type tsx --type tsLength of output: 267 Action: Update verification script for old status name references The initial script encountered a file type error due to unrecognized TSX files. To ensure consistency of the status updates (i.e. no lingering references to "ACTIVE" or "DRAFT"), please run the revised script below that adds TSX support: Once you verify that these searches return no references, you can be confident that the status name changes are consistent across the application. 🏁 Script executed: #!/bin/bash
# Extend ripgrep to recognize TSX files and search for references to old status names
rg --type-add 'tsx:*.tsx' -i "('|\")ACTIVE('|\")" --type tsx --type ts || echo "No references to 'ACTIVE' found."
rg --type-add 'tsx:*.tsx' -i "('|\")DRAFT('|\")" --type tsx --type ts || echo "No references to 'DRAFT' found."Length of output: 6207 Action: Ensure Consistent Status Naming Across the Codebase The test file update in
Please review these areas and confirm whether the renaming should be propagated application-wide. If a consistent status naming scheme is intended, update the affected files accordingly to prevent potential bugs. |
||
| case "FAILED": | ||
| return <Badge className="bg-red-500">{status}</Badge>; | ||
|
|
@@ -96,6 +84,11 @@ export function TestDetails({ testId, users }: CloudTestDetailsProps) { | |
| } | ||
| }; | ||
|
|
||
| // Check if resources exist and have items | ||
| const hasResources = cloudTest.resultDetails?.Resources && cloudTest.resultDetails.Resources.length > 0; | ||
| // Set default tab based on resources availability | ||
| const defaultTab = hasResources ? "resources" : "raw-log"; | ||
|
|
||
| // // Helper function to get the appropriate icon for test run status | ||
| // const getRunStatusIcon = (status: string, result: string | null) => { | ||
| // if (status === "COMPLETED") { | ||
|
|
@@ -161,18 +154,19 @@ export function TestDetails({ testId, users }: CloudTestDetailsProps) { | |
| </CardContent> | ||
| </Card> | ||
|
|
||
| <Tabs defaultValue="resources"> | ||
| <Tabs defaultValue={defaultTab}> | ||
| <TabsList> | ||
| <TabsTrigger value="resources">Resources</TabsTrigger> | ||
| {hasResources && <TabsTrigger value="resources">Resources</TabsTrigger>} | ||
| <TabsTrigger value="raw-log">Raw Log</TabsTrigger> | ||
| </TabsList> | ||
|
|
||
| <TabsContent value="resources" className="mt-6"> | ||
| <Card> | ||
| <CardHeader> | ||
| <CardTitle>Resources</CardTitle> | ||
| </CardHeader> | ||
| <CardContent> | ||
| {hasResources && ( | ||
| <TabsContent value="resources" className="mt-6"> | ||
| <Card> | ||
| <CardHeader> | ||
| <CardTitle>Resources</CardTitle> | ||
| </CardHeader> | ||
| <CardContent> | ||
| <Table> | ||
| <TableHeader> | ||
| <TableRow> | ||
|
|
@@ -184,7 +178,7 @@ export function TestDetails({ testId, users }: CloudTestDetailsProps) { | |
| </TableHeader> | ||
| <TableBody> | ||
| {cloudTest.resultDetails?.Resources.map((resource: any) => ( | ||
| <TableRow key="{resource.id}"> | ||
| <TableRow key={resource.Id}> | ||
| <TableCell> | ||
| <div className="flex items-center gap-2"> | ||
| {resource.Id} | ||
|
|
@@ -210,9 +204,10 @@ export function TestDetails({ testId, users }: CloudTestDetailsProps) { | |
| ))} | ||
| </TableBody> | ||
| </Table> | ||
| </CardContent> | ||
| </Card> | ||
| </TabsContent> | ||
| </CardContent> | ||
| </Card> | ||
| </TabsContent> | ||
| )} | ||
|
|
||
| <TabsContent value="raw-log" className="mt-6"> | ||
| <Card> | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Verification agent
🧩 Analysis chain
Assess query performance with indexing.
Counting results by label can be expensive for large data. Ensure that your database schema has appropriate indexes on
labelto maintain performance at scale. If necessary, create a composite index for(organizationId, label).🏁 Script executed:
Length of output: 86271
Performance Improvement Suggestion: Indexing for Count Queries
It appears that the migration file for the organization integration results (specifically,
packages/db/prisma/migrations/20250227185651_add_organization_integration_results/migration.sql) currently creates indexes for theorganizationId(and related columns) but does not include an index on thelabelfield. Since the code performs count queries filtering by bothorganizationIdandlabel(e.g., counting tests with"INFO","LOW", etc.), this could lead to performance issues on large datasets.labelcolumn or a composite index on(organizationId, label)to improve performance and scalability.