---
id: w5/m8/t004
title: Create-database dialog (plan from catalog) + delete with confirm
worker: worker5
status: done
estimate: 60m
depends_on: [w5/m8/t003]
---

## Objective

Wire the write half of the page: a create-database flow (name, plan picked from the postgres-family tier catalog, version, diskSizeGB, public) calling `createDatabase`, and a delete action with an explicit cascade-warning confirm calling `deleteDatabase`, with the list converging as the operator reconciles.

## Context

- Create body fields per `docs/ADR006-bex-api.md`: `name`, `plan`, `version`, `diskSizeGB`, `public` (REST `POST /v1/postgres`; GraphQL `createDatabase` mirrors it).
- Plan options come from t002's postgres-family catalog read — radio cards or select per the t001 Render capture; no prices (Metronome's, per the w1/m8 decision).
- Delete cascades CNPG Cluster + PVC + route — the confirm must say data is destroyed; use the repo's `AlertDialog` idiom (w5/m7's picker confirm, m4's suspend confirm).
- After create, poll/refetch until the new row converges to ready (m4's lifecycle-convergence pattern).

## Steps

1. Create dialog/form with validated fields; plan options from the catalog hook; submit → `createDatabase` → toast → list refetch/poll to ready.
2. Row/detail delete action → cascade-warning `AlertDialog` → `deleteDatabase` → toast → row removed.
3. In-flight disabling on both mutations; error toasts surface API messages.

## Files

- `dashboard/src/features/databases/components/` (create dialog, delete action)
- `dashboard/src/features/databases/hooks/` (create/delete mutation hooks)
- locales (en/zh)

## Acceptance criteria

- [ ] Create produces a `Database` CR and the row converges to ready in the UI without a manual refresh.
- [ ] Delete requires an explicit cascade-warning confirm and removes the row; both actions disabled in flight.
- [ ] Plan options sourced from the catalog query — no tier list hardcoded in the frontend.

## Out of scope

- Suspend/resume or any deferred database verb; connection-info UI (t005).
