Skip to content

Commit 700a6ea

Browse files
authored
feat: enable canceling deployments (#2545)
* Add canceledAt to the deployment db schema * Expose an api endpoint to cancel deployments * Show the canceled status description in the dashboard * Enable canceling deployments from the dashboard * Show cancelation reason in the deployment details * Make verifyProjectMembership a function for consistency * Apply some good 🐰 suggestions
1 parent cc94d12 commit 700a6ea

File tree

13 files changed

+526
-121
lines changed

13 files changed

+526
-121
lines changed

apps/webapp/app/components/runs/v3/DeploymentStatus.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ export const deploymentStatuses: WorkerDeploymentStatus[] = [
137137
"DEPLOYED",
138138
"FAILED",
139139
"TIMED_OUT",
140+
"CANCELED",
140141
];
141142

142143
export function deploymentStatusDescription(status: WorkerDeploymentStatus): string {

apps/webapp/app/components/runs/v3/RollbackDeploymentDialog.tsx

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

apps/webapp/app/presenters/v3/DeploymentPresenter.server.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,9 @@ export class DeploymentPresenter {
103103
deployedAt: true,
104104
createdAt: true,
105105
startedAt: true,
106+
installedAt: true,
107+
canceledAt: true,
108+
canceledReason: true,
106109
git: true,
107110
promotions: {
108111
select: {
@@ -147,8 +150,11 @@ export class DeploymentPresenter {
147150
status: deployment.status,
148151
createdAt: deployment.createdAt,
149152
startedAt: deployment.startedAt,
153+
installedAt: deployment.installedAt,
150154
builtAt: deployment.builtAt,
151155
deployedAt: deployment.deployedAt,
156+
canceledAt: deployment.canceledAt,
157+
canceledReason: deployment.canceledReason,
152158
tasks: deployment.worker?.tasks,
153159
label: deployment.promotions?.[0]?.label,
154160
environment: {

apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.deployments.$deploymentParam/route.tsx

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,22 @@ export default function Page() {
158158
/>
159159
</Property.Value>
160160
</Property.Item>
161+
{deployment.canceledAt && (
162+
<Property.Item>
163+
<Property.Label>Canceled at</Property.Label>
164+
<Property.Value>
165+
<>
166+
<DateTimeAccurate date={deployment.canceledAt} /> UTC
167+
</>
168+
</Property.Value>
169+
</Property.Item>
170+
)}
171+
{deployment.canceledReason && (
172+
<Property.Item>
173+
<Property.Label>Cancelation reason</Property.Label>
174+
<Property.Value>{deployment.canceledReason}</Property.Value>
175+
</Property.Item>
176+
)}
161177
<Property.Item>
162178
<Property.Label>Tasks</Property.Label>
163179
<Property.Value>{deployment.tasks ? deployment.tasks.length : "–"}</Property.Value>
@@ -200,6 +216,18 @@ export default function Page() {
200216
)}
201217
</Property.Value>
202218
</Property.Item>
219+
<Property.Item>
220+
<Property.Label>Installed at</Property.Label>
221+
<Property.Value>
222+
{deployment.installedAt ? (
223+
<>
224+
<DateTimeAccurate date={deployment.installedAt} /> UTC
225+
</>
226+
) : (
227+
"–"
228+
)}
229+
</Property.Value>
230+
</Property.Item>
203231
<Property.Item>
204232
<Property.Label>Built at</Property.Label>
205233
<Property.Value>

0 commit comments

Comments
 (0)