-
Notifications
You must be signed in to change notification settings - Fork 11
fix: Group triggers by target in release ui #204
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
Conversation
WalkthroughThe pull request introduces significant updates to the Changes
Possibly related PRs
Suggested reviewers
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Other keywords and placeholders
Documentation and Community
|
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.
Actionable comments posted: 1
🧹 Outside diff range and nitpick comments (2)
apps/webservice/src/app/[workspaceSlug]/systems/[systemSlug]/deployments/[deploymentSlug]/releases/[versionId]/TargetReleaseTable.tsx (2)
193-201: Refactor duplicated code for displaying external IDs.The code for rendering the external IDs is duplicated. Consider extracting it into a reusable component or function to improve maintainability and reduce code duplication.
Also applies to: 295-303
205-223: Refactor duplicated code for rendering links.The logic for displaying the links is duplicated in multiple places. Refactoring this into a reusable component will enhance readability and maintainability.
Also applies to: 306-325
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
📒 Files selected for processing (1)
apps/webservice/src/app/[workspaceSlug]/systems/[systemSlug]/deployments/[deploymentSlug]/releases/[versionId]/TargetReleaseTable.tsx(9 hunks)
🧰 Additional context used
🪛 Biome
apps/webservice/src/app/[workspaceSlug]/systems/[systemSlug]/deployments/[deploymentSlug]/releases/[versionId]/TargetReleaseTable.tsx
[error] 259-362: Avoid using unnecessary Fragment.
A fragment is redundant if it contains only one child, or if it is the child of a html element, and is not a keyed fragment.
Unsafe fix: Remove the Fragment
(lint/complexity/noUselessFragments)
| <> | ||
| {triggers.map((trigger, idx) => { | ||
| if (idx === 0) return null; | ||
| const linksMetadata = trigger.job.metadata.find( | ||
| (m) => m.key === String(ReservedMetadataKey.Links), | ||
| )?.value; | ||
|
|
||
| const links = | ||
| linksMetadata != null | ||
| ? (JSON.parse(linksMetadata) as Record< | ||
| string, | ||
| string | ||
| >) | ||
| : null; | ||
|
|
||
| return ( | ||
| <TableRow | ||
| key={trigger.id} | ||
| className="cursor-pointer border-none" | ||
| onClick={() => setJobId(trigger.job.id)} | ||
| > | ||
| <TableCell className="p-0"> | ||
| <div className="pl-5"> | ||
| <div className="h-10 border-l border-neutral-700/50" /> | ||
| </div> | ||
| </TableCell> | ||
| <TableCell> | ||
| <div className="flex items-center gap-1"> | ||
| <JobTableStatusIcon | ||
| status={trigger.job.status} | ||
| /> | ||
| {capitalCase(trigger.job.status)} | ||
| </div> | ||
| </TableCell> | ||
| <TableCell>{trigger.type}</TableCell> | ||
| <TableCell> | ||
| {trigger.job.externalId != null ? ( | ||
| <code className="font-mono text-xs"> | ||
| {trigger.job.externalId} | ||
| </code> | ||
| ) : ( | ||
| <span className="text-sm text-muted-foreground"> | ||
| No external ID | ||
| </span> | ||
| )} | ||
| </TableCell> | ||
| <TableCell onClick={(e) => e.stopPropagation()}> | ||
| {links != null && ( | ||
| <div className="flex items-center gap-1"> | ||
| {Object.entries(links).map(([label, url]) => ( | ||
| <Link | ||
| key={label} | ||
| href={url} | ||
| target="_blank" | ||
| rel="noopener noreferrer" | ||
| className={buttonVariants({ | ||
| variant: "secondary", | ||
| size: "sm", | ||
| className: "gap-1", | ||
| })} | ||
| > | ||
| <IconExternalLink className="h-4 w-4" /> | ||
| {label} | ||
| </Link> | ||
| ))} | ||
| </div> | ||
| )} | ||
| </TableCell> | ||
| <TableCell> | ||
| <Badge | ||
| variant="secondary" | ||
| className="flex-shrink-0 text-xs text-muted-foreground hover:bg-secondary" | ||
| > | ||
| {formatDistanceToNowStrict(trigger.createdAt, { | ||
| addSuffix: true, | ||
| })} | ||
| </Badge> | ||
| </TableCell> | ||
| <TableCell onClick={(e) => e.stopPropagation()}> | ||
| <div className="flex justify-end"> | ||
| <JobDropdownMenu | ||
| release={release} | ||
| deploymentName={deploymentName} | ||
| target={trigger.target} | ||
| environmentId={trigger.environmentId} | ||
| job={{ | ||
| id: trigger.job.id, | ||
| status: trigger.job.status, | ||
| }} | ||
| > | ||
| <Button | ||
| variant="ghost" | ||
| size="icon" | ||
| className="h-6 w-6" | ||
| > | ||
| <IconDots className="h-4 w-4" /> | ||
| </Button> | ||
| </JobDropdownMenu> | ||
| </div> | ||
| </TableCell> | ||
| </TableRow> | ||
| ); | ||
| })} | ||
| </> |
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.
🛠️ Refactor suggestion
Remove unnecessary fragment in CollapsibleContent.
The fragment (<> ... </>) wrapping the child elements inside <CollapsibleContent asChild> is unnecessary and can be removed to simplify the code.
Apply this diff to remove the redundant fragment:
<CollapsibleContent asChild>
- <>
{triggers.map((trigger, idx) => {
if (idx === 0) return null;
// ... rest of the code ...
})}
- </>
</CollapsibleContent>Committable suggestion skipped: line range outside the PR's diff.
🧰 Tools
🪛 Biome
[error] 259-362: Avoid using unnecessary Fragment.
A fragment is redundant if it contains only one child, or if it is the child of a html element, and is not a keyed fragment.
Unsafe fix: Remove the Fragment
(lint/complexity/noUselessFragments)
Summary by CodeRabbit
New Features
TargetReleaseTablecomponent to better manage and display job triggers associated with releases.Bug Fixes
Refactor