Skip to content

Commit 9edfbae

Browse files
committed
fix: remove stale approval/rejected statuses, extract shared ctrl client
- Remove awaiting_approval and rejected from deployment statuses, filters, and status badge configs (no longer used — authorization is handled via GitHub Check Runs, not deployment status) - Remove deployment.approve and deployment.reject audit log events - Delete unused duplicate deployment-status-badge.tsx in table components - Fix broken page.tsx referencing undefined awaitingApproval/rejected vars - Extract createCtrlClient helper to deduplicate identical ctrl client creation boilerplate across 9 trpc router files
1 parent 9d2a6d5 commit 9edfbae

File tree

16 files changed

+50
-380
lines changed

16 files changed

+50
-380
lines changed

web/apps/dashboard/app/(app)/[workspaceSlug]/projects/[projectId]/(overview)/deployments/[deploymentId]/page.tsx

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,7 @@ export default function DeploymentOverview() {
3636
return (
3737
<ProjectContentWrapper centered>
3838
<DeploymentInfo statusOverride={derivedStatus} />
39-
{awaitingApproval ? (
40-
<div key="awaiting-approval" className="animate-fade-slide-in">
41-
<DeploymentApprovalBanner />
42-
</div>
43-
) : rejected ? (
44-
<div key="rejected" className="animate-fade-slide-in">
45-
<DeploymentRejectedBanner />
46-
</div>
47-
) : ready ? (
39+
{ready ? (
4840
<div key="ready" className="flex flex-col gap-5 animate-fade-slide-in">
4941
<DeploymentDomainsCard />
5042
<DeploymentNetworkSection />

web/apps/dashboard/app/(app)/[workspaceSlug]/projects/[projectId]/(overview)/deployments/components/table/components/deployment-status-badge.tsx

Lines changed: 0 additions & 121 deletions
This file was deleted.

web/apps/dashboard/app/(app)/[workspaceSlug]/projects/[projectId]/(overview)/deployments/filters.schema.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,10 @@ import { z } from "zod";
1010

1111
// Define grouped statuses for client filtering
1212
const GROUPED_DEPLOYMENT_STATUSES = [
13-
"awaiting_approval",
1413
"pending",
1514
"deploying", // represents all deploying states
1615
"ready",
1716
"failed",
18-
"rejected",
1917
] as const;
2018

2119
const DEPLOYMENT_ENVIRONMENTS = ["production", "preview"] as const;
@@ -46,7 +44,7 @@ export const deploymentListFilterFieldConfig: FilterFieldConfigs = {
4644
if (value === "completed") {
4745
return "bg-success-9";
4846
}
49-
if (value === "failed" || value === "rejected") {
47+
if (value === "failed") {
5048
return "bg-error-9";
5149
}
5250
if (value === "pending") {
@@ -81,8 +79,6 @@ export const deploymentListFilterFieldConfig: FilterFieldConfigs = {
8179
// Mapping function to expand grouped statuses to actual statuses
8280
export const expandGroupedStatus = (groupedStatus: GroupedDeploymentStatus): DeploymentStatus[] => {
8381
switch (groupedStatus) {
84-
case "awaiting_approval":
85-
return ["awaiting_approval"];
8682
case "pending":
8783
return ["pending"];
8884
case "deploying":
@@ -91,8 +87,6 @@ export const expandGroupedStatus = (groupedStatus: GroupedDeploymentStatus): Dep
9187
return ["ready"];
9288
case "failed":
9389
return ["failed"];
94-
case "rejected":
95-
return ["rejected"];
9690
default:
9791
throw new Error(`Unknown grouped status: ${groupedStatus}`);
9892
}

web/apps/dashboard/app/(app)/[workspaceSlug]/projects/[projectId]/components/deployment-status-badge.tsx

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,6 @@ type StatusConfig = {
2424
};
2525

2626
const statusConfigs: Record<DeploymentStatus, StatusConfig> = {
27-
awaiting_approval: {
28-
icon: LayerFront,
29-
label: "Awaiting Approval",
30-
bgColor: "bg-warningA-3",
31-
textColor: "text-warningA-11",
32-
iconColor: "text-warning-11",
33-
},
3427
pending: {
3528
icon: LayerFront,
3629
label: "Pending",
@@ -92,13 +85,6 @@ const statusConfigs: Record<DeploymentStatus, StatusConfig> = {
9285
textColor: "text-errorA-11",
9386
iconColor: "text-error-11",
9487
},
95-
rejected: {
96-
icon: CircleWarning,
97-
label: "Rejected",
98-
bgColor: "bg-errorA-3",
99-
textColor: "text-errorA-11",
100-
iconColor: "text-error-11",
101-
},
10288
};
10389

10490
type DeploymentStatusBadgeProps = {
Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
export const DEPLOYMENT_STATUSES = [
2-
"awaiting_approval",
32
"pending",
43
"starting",
54
"building",
@@ -8,7 +7,6 @@ export const DEPLOYMENT_STATUSES = [
87
"finalizing",
98
"ready",
109
"failed",
11-
"rejected",
1210
] as const;
1311

1412
export type DeploymentStatus = (typeof DEPLOYMENT_STATUSES)[number];
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import { env } from "@/lib/env";
2+
import type { DescService } from "@bufbuild/protobuf";
3+
import { type Client, createClient } from "@connectrpc/connect";
4+
import { createConnectTransport } from "@connectrpc/connect-web";
5+
import { TRPCError } from "@trpc/server";
6+
7+
export function createCtrlClient<T extends DescService>(service: T): Client<T> {
8+
const { CTRL_URL, CTRL_API_KEY } = env();
9+
if (!CTRL_URL || !CTRL_API_KEY) {
10+
throw new TRPCError({
11+
code: "PRECONDITION_FAILED",
12+
message: "ctrl service is not configured",
13+
});
14+
}
15+
16+
return createClient(
17+
service,
18+
createConnectTransport({
19+
baseUrl: CTRL_URL,
20+
interceptors: [
21+
(next) => (req) => {
22+
req.header.set("Authorization", `Bearer ${CTRL_API_KEY}`);
23+
return next(req);
24+
},
25+
],
26+
}),
27+
);
28+
}

web/apps/dashboard/lib/trpc/routers/deploy/custom-domains/add.ts

Lines changed: 3 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
import { CustomDomainService } from "@/gen/proto/ctrl/v1/custom_domain_pb";
2+
import { createCtrlClient } from "@/lib/ctrl-client";
23
import { db } from "@/lib/db";
3-
import { env } from "@/lib/env";
44
import { ratelimit, withRatelimit, workspaceProcedure } from "@/lib/trpc/trpc";
5-
import { Code, ConnectError, createClient } from "@connectrpc/connect";
6-
import { createConnectTransport } from "@connectrpc/connect-web";
5+
import { Code, ConnectError } from "@connectrpc/connect";
76
import { TRPCError } from "@trpc/server";
87
import { z } from "zod";
98

@@ -17,13 +16,7 @@ export const addCustomDomain = workspaceProcedure
1716
}),
1817
)
1918
.mutation(async ({ input, ctx }) => {
20-
const { CTRL_URL, CTRL_API_KEY } = env();
21-
if (!CTRL_URL || !CTRL_API_KEY) {
22-
throw new TRPCError({
23-
code: "PRECONDITION_FAILED",
24-
message: "ctrl service is not configured",
25-
});
26-
}
19+
const ctrl = createCtrlClient(CustomDomainService);
2720

2821
// Verify project belongs to workspace
2922
const project = await db.query.projects.findFirst({
@@ -60,19 +53,6 @@ export const addCustomDomain = workspaceProcedure
6053

6154
const appId = environment.appId;
6255

63-
const ctrl = createClient(
64-
CustomDomainService,
65-
createConnectTransport({
66-
baseUrl: CTRL_URL,
67-
interceptors: [
68-
(next) => (req) => {
69-
req.header.set("Authorization", `Bearer ${CTRL_API_KEY}`);
70-
return next(req);
71-
},
72-
],
73-
}),
74-
);
75-
7656
try {
7757
const response = await ctrl.addCustomDomain({
7858
workspaceId: ctx.workspace.id,

web/apps/dashboard/lib/trpc/routers/deploy/custom-domains/delete.ts

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
import { CustomDomainService } from "@/gen/proto/ctrl/v1/custom_domain_pb";
2+
import { createCtrlClient } from "@/lib/ctrl-client";
23
import { db } from "@/lib/db";
3-
import { env } from "@/lib/env";
44
import { ratelimit, withRatelimit, workspaceProcedure } from "@/lib/trpc/trpc";
5-
import { createClient } from "@connectrpc/connect";
6-
import { createConnectTransport } from "@connectrpc/connect-web";
75
import { TRPCError } from "@trpc/server";
86
import { z } from "zod";
97

@@ -16,13 +14,7 @@ export const deleteCustomDomain = workspaceProcedure
1614
}),
1715
)
1816
.mutation(async ({ input, ctx }) => {
19-
const { CTRL_URL, CTRL_API_KEY } = env();
20-
if (!CTRL_URL || !CTRL_API_KEY) {
21-
throw new TRPCError({
22-
code: "PRECONDITION_FAILED",
23-
message: "ctrl service is not configured",
24-
});
25-
}
17+
const ctrl = createCtrlClient(CustomDomainService);
2618

2719
// Verify project belongs to workspace
2820
const project = await db.query.projects.findFirst({
@@ -60,19 +52,6 @@ export const deleteCustomDomain = workspaceProcedure
6052
});
6153
}
6254

63-
const ctrl = createClient(
64-
CustomDomainService,
65-
createConnectTransport({
66-
baseUrl: CTRL_URL,
67-
interceptors: [
68-
(next) => (req) => {
69-
req.header.set("Authorization", `Bearer ${CTRL_API_KEY}`);
70-
return next(req);
71-
},
72-
],
73-
}),
74-
);
75-
7655
try {
7756
await ctrl.deleteCustomDomain({
7857
workspaceId: ctx.workspace.id,

web/apps/dashboard/lib/trpc/routers/deploy/custom-domains/retry.ts

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
import { CustomDomainService } from "@/gen/proto/ctrl/v1/custom_domain_pb";
2+
import { createCtrlClient } from "@/lib/ctrl-client";
23
import { db } from "@/lib/db";
3-
import { env } from "@/lib/env";
44
import { ratelimit, withRatelimit, workspaceProcedure } from "@/lib/trpc/trpc";
5-
import { createClient } from "@connectrpc/connect";
6-
import { createConnectTransport } from "@connectrpc/connect-web";
75
import { TRPCError } from "@trpc/server";
86
import { z } from "zod";
97

@@ -16,13 +14,7 @@ export const retryVerification = workspaceProcedure
1614
}),
1715
)
1816
.mutation(async ({ input, ctx }) => {
19-
const { CTRL_URL, CTRL_API_KEY } = env();
20-
if (!CTRL_URL || !CTRL_API_KEY) {
21-
throw new TRPCError({
22-
code: "PRECONDITION_FAILED",
23-
message: "ctrl service is not configured",
24-
});
25-
}
17+
const ctrl = createCtrlClient(CustomDomainService);
2618

2719
// Verify project belongs to workspace
2820
const project = await db.query.projects.findFirst({
@@ -60,19 +52,6 @@ export const retryVerification = workspaceProcedure
6052
});
6153
}
6254

63-
const ctrl = createClient(
64-
CustomDomainService,
65-
createConnectTransport({
66-
baseUrl: CTRL_URL,
67-
interceptors: [
68-
(next) => (req) => {
69-
req.header.set("Authorization", `Bearer ${CTRL_API_KEY}`);
70-
return next(req);
71-
},
72-
],
73-
}),
74-
);
75-
7655
try {
7756
const response = await ctrl.retryVerification({
7857
workspaceId: ctx.workspace.id,

0 commit comments

Comments
 (0)