refactor: extract DeploymentStatus to shared location by ogzhanolguncu ยท Pull Request #5264 ยท unkeyed/unkey
Caution
Review failed
Pull request was closed or merged during review
๐ Walkthrough
Walkthrough
Deployment status values and types were centralized into a new module. The old local DeploymentStatusBadge was removed and replaced by a single, refactored badge component at a higher-level path using a data-driven config. Zod schemas, imports, and UI code were updated to use the shared status constant/type. A compound-duration formatter was added.
Changes
| Cohort / File(s) | Summary |
|---|---|
Centralized status module web/apps/dashboard/lib/collections/deploy/deployment-status.ts, web/apps/dashboard/lib/collections/index.ts |
Introduce and export DEPLOYMENT_STATUSES tuple and DeploymentStatus type; re-export both from collections index. |
DeploymentStatusBadge relocated & refactored web/apps/dashboard/app/(app)/[workspaceSlug]/projects/[projectId]/components/deployment-status-badge.tsx, web/apps/dashboard/app/(app)/[workspaceSlug]/projects/[projectId]/(overview)/deployments/components/table/components/deployment-status-badge.tsx |
Removed the old deep-path badge file and added a single higher-level badge implementation using a statusConfigs map (icon, label, colors, optional animation); new component requires status prop and validates config at runtime. |
Schema & collection updates web/apps/dashboard/lib/collections/deploy/deployments.ts |
Replaced inline z.enum([...]) status list with z.enum(DEPLOYMENT_STATUSES) to use centralized status values. |
UI import/path/type adjustments web/apps/dashboard/app/(app)/[workspaceSlug]/projects/[projectId]/(overview)/deployments/filters.schema.ts, .../components/table/components/domain_list.tsx, .../components/table/deployments-list.tsx, .../deployment-info.tsx |
Switched local status/heavy imports to use the centralized DeploymentStatus/DEPLOYMENT_STATUSES; updated import path for DeploymentStatusBadge where applicable. |
Deployment status derivation / utils web/apps/dashboard/app/(app)/[workspaceSlug]/projects/[projectId]/(overview)/deployments/[deploymentId]/deployment-utils.ts, .../page.tsx |
Added shared deriveStatusFromSteps(steps, fallback) and isDeploymentStatus guard; replaced local helper usage with import of shared implementation in page. |
Live deployment UI changes web/apps/dashboard/app/(app)/[workspaceSlug]/projects/new/steps/deployment-live.tsx, .../(deployment-progress)/deployment-progress.tsx, .../(deployment-progress)/deployment-step.tsx |
Added TRPC steps fetching in deployment-live and pass stepsData/statusOverride to child components; changed now initializer to Date.now reference; switched duration formatting to new formatter with null guards. |
Metric formatter web/apps/dashboard/lib/utils/metric-formatters.ts |
Added formatCompoundDuration(ms: number) to produce two-unit compound duration strings (ms, s, m s, h m). |
Misc UI styling web/apps/dashboard/components/navigation/sidebar/product-switcher.tsx |
Minor style and spacing adjustments for product-switcher buttons and dropdown items; icon size and color token updates. |
Estimated code review effort
๐ฏ 3 (Moderate) | โฑ๏ธ ~25 minutes
Possibly related PRs
- refactor: deployment overview page v2 #4804 โ Introduces the centralized DeploymentStatusBadge referenced by this change; directly related to badge relocation and implementation.
- fix: ui inconsistencies #5167 โ Overlaps on deployment UI, status handling, and deriveStatusFromSteps/deployment-utils changes; strongly related to the consolidated status and badge refactor.
๐ฅ Pre-merge checks | โ 1 | โ 2
โ Failed checks (2 warnings)
| Check name | Status | Explanation | Resolution |
|---|---|---|---|
| Description check | โ ๏ธ Warning | The PR description is incomplete. It lacks the 'Type of change' section, proper issue reference, and detailed testing instructions required by the template. | Add the 'Type of change' checkbox section, reference the associated issue, and provide detailed testing steps beyond 'make a deployment' (e.g., test specific UI interactions, verify no console errors). |
| Docstring Coverage | โ ๏ธ Warning | Docstring coverage is 14.29% which is insufficient. The required threshold is 80.00%. | Write docstrings for the functions missing them to satisfy the coverage threshold. |
โ Passed checks (1 passed)
| Check name | Status | Explanation |
|---|---|---|
| Title check | โ Passed | The title accurately describes the main refactoring work: extracting DeploymentStatus to a shared location for reuse across multiple components. |
โ๏ธ Tip: You can configure your own custom pre-merge checks in the settings.
โจ Finishing Touches
- ๐ Generate docstrings (stacked PR)
- ๐ Generate docstrings (commit on current branch)
๐งช Generate unit tests (beta)
- Create PR with unit tests
- Post copyable unit tests in a comment
- Commit unit tests in branch
deployment-status-shared
Comment @coderabbitai help to get the list of available commands and usage tips.