diff --git a/apps/preview-deployer-web/src/PreviewDeployerApp.test.tsx b/apps/preview-deployer-web/src/PreviewDeployerApp.test.tsx
index 21f2b900d..4a366fdaa 100644
--- a/apps/preview-deployer-web/src/PreviewDeployerApp.test.tsx
+++ b/apps/preview-deployer-web/src/PreviewDeployerApp.test.tsx
@@ -27,7 +27,7 @@ beforeEach(() => {
vi.mocked(api.searchBranches).mockResolvedValue([]);
vi.mocked(api.searchCommits).mockResolvedValue([]);
vi.mocked(api.createDeployment).mockResolvedValue({
- id: 'preview-1',
+ id: null,
branch: 'master',
status: 'queued',
health: 'pending',
@@ -35,7 +35,7 @@ beforeEach(() => {
updatedAt: '2026-08-15T00:00:00Z',
});
vi.mocked(api.uninstallDeployment).mockResolvedValue({
- id: 'preview-1',
+ id: '1',
branch: 'master',
status: 'uninstalling',
health: 'pending',
@@ -83,7 +83,7 @@ test('submits a branch with an optional commit hash', async () => {
test('shows health and web url, then confirms uninstall', async () => {
vi.mocked(api.listDeployments).mockResolvedValue([
{
- id: 'preview-2',
+ id: '42',
branch: 'feature/demo',
resolvedCommit: '1234567890abcdef',
status: 'running',
@@ -98,6 +98,7 @@ test('shows health and web url, then confirms uninstall', async () => {
expect(await screen.findByText('健康')).toBeTruthy();
expect(screen.getByText('端口 8400')).toBeTruthy();
+ expect(screen.getByText('构建 #42')).toBeTruthy();
expect(
screen.getByRole('link', { name: /打开 Web/u }).getAttribute('href'),
).toBe('http://192.168.35.82:8400');
@@ -107,7 +108,7 @@ test('shows health and web url, then confirms uninstall', async () => {
fireEvent.click(screen.getByRole('button', { name: '确认卸载' }));
await waitFor(() => {
- expect(api.uninstallDeployment).toHaveBeenCalledWith('preview-2');
+ expect(api.uninstallDeployment).toHaveBeenCalledWith('42');
});
});
diff --git a/apps/preview-deployer-web/src/PreviewDeployerApp.tsx b/apps/preview-deployer-web/src/PreviewDeployerApp.tsx
index 45f7e7d80..ec5e30773 100644
--- a/apps/preview-deployer-web/src/PreviewDeployerApp.tsx
+++ b/apps/preview-deployer-web/src/PreviewDeployerApp.tsx
@@ -289,6 +289,9 @@ export function PreviewDeployerApp() {
return;
}
const deployment = pendingUninstall;
+ if (!deployment.id) {
+ return;
+ }
setPendingUninstall(null);
setUninstallingId(deployment.id);
setError('');
@@ -676,7 +679,10 @@ export function PreviewDeployerApp() {
{deployments.map((deployment) => (
setPendingUninstall(deployment)}
@@ -774,6 +780,9 @@ function DeploymentCard({
{deployment.webPort ? (
端口 {deployment.webPort}
) : null}
+
+ 构建 #{deployment.id || '待分配'}
+
@@ -811,7 +820,7 @@ function DeploymentCard({
构建详情
) : null}
- {canUninstall ? (
+ {canUninstall && deployment.id ? (