Skip to content

feat(tui): contexts CRUD end-to-end - #22

Open
lvlcn-t wants to merge 1 commit into
feat/tui-crud-tenantsfrom
feat/tui-crud-contexts
Open

feat(tui): contexts CRUD end-to-end#22
lvlcn-t wants to merge 1 commit into
feat/tui-crud-tenantsfrom
feat/tui-crud-contexts

Conversation

@lvlcn-t

@lvlcn-t lvlcn-t commented Jul 21, 2026

Copy link
Copy Markdown
Owner

What

PR 3 of the TUI CRUD series (stacked on #21). Adds create, edit,
rename, and delete for contexts.

Note

Based on feat/tui-crud-tenants (#21). Review #20 and #21 first.

Changes

  • ContextsTab binds n/e/r/ctrl+d and emits the matching actions.
  • contextForm collects name, tenant, credential, and subscription.
    Tenant and credential are validated against existing entries (their
    names shown as placeholders); on edit the name is locked read-only.
  • Dispatch maps intent to CreateContext/UpdateContext/RenameContext/
    DeleteContext. Edit updates in place; deleting the active context
    warns in the status line (DeleteResult.WasActive).
  • Extracted shared form-field key constants; entryName() reads an item's
    config name without the list display marker (contexts render a ●/○
    marker in their title).

Testing

  • Context flow tests: create (incl. unknown-tenant validation rejection),
    in-place edit, rename, delete.
  • Full go test -race ./... and pre-commit green; tui never imports
    cmd.

Next

Credentials (type-driven form) in PR 4.

Third PR in the TUI CRUD series. Adds create, edit, rename, and delete for
contexts, reusing the intent API and the create/edit/rename/delete flow
established for tenants.

- ContextsTab binds n (new), e (edit), r (rename), ctrl+d (delete) and
  emits the matching TabActions.
- contextForm collects name, tenant, credential, and subscription. Tenant
  and credential are validated against existing entries (their names are
  shown as placeholders); on edit the name is locked read-only.
- Dispatch maps intent to CreateContext/UpdateContext/RenameContext/
  DeleteContext. Edit updates in place (name locked); delete of the active
  context warns in the status line.
- Shared form-field keys are extracted to constants (fieldName, fieldID,
  fieldTenant, fieldCredential, fieldSubscription); entryName() reads an
  item's config name without the list display marker.

Tests drive the Tabs model on the contexts tab through create (incl.
unknown-tenant validation rejection), in-place edit, rename, and delete.

Signed-off-by: lvlcn-t <75443136+lvlcn-t@users.noreply.github.com>
@github-actions

Copy link
Copy Markdown

File Coverage
All files 61%
az/azconfig.go 66%
az/client.go 0%
az/client.go 0%
az/commands.go 0%
az/secrets.go 0%
az/secrets.go 15%
cmd/context_view.go 85%
cmd/current.go 80%
cmd/delete_context.go 71%
cmd/get.go 56%
cmd/list.go 46%
cmd/output_flags.go 85%
cmd/rename_context.go 69%
cmd/set_context.go 69%
cmd/set_credential.go 97%
cmd/set_credential.go 80%
cmd/set_tenant.go 95%
cmd/set_tenant.go 57%
cmd/use.go 47%
cmd/view.go 95%
cmd/view.go 48%
config/config.go 91%
config/credential.go 0%
config/credential.go 0%
config/credential.go 64%
config/credential.go 48%
config/keyvault.go 14%
config/loader.go 82%
config/loader.go 79%
config/store.go 69%
config/writer.go 69%
contexts/contexts.go 92%
contexts/contexts.go 82%
internal/gendemo/main.go 0%
internal/gendoc/main.go 0%
keyvault/azure.go 0%
keyvault/azure.go 0%
keyvault/keyvault.go 75%
login/login.go 76%
main.go 0%
output/printer.go 79%
semver/version.go 94%
tui/app.go 0%
tui/app.go 0%
tui/tui.go 0%
tui/details/viewer.go 0%
tui/form/form.go 93%
tui/keys/builder.go 80%
tui/keys/keys.go 66%
tui/splash/splash.go 0%
tui/splash/splash.go 0%
tui/state/state.go 71%
tui/styles/azure_renderer.go 33%
tui/styles/azure_renderer.go 8%
tui/tabs/browse.go 56%
tui/tabs/confirm.go 36%
tui/tabs/context_item.go 0%
tui/tabs/contexts.go 49%
tui/tabs/credential_items.go 0%
tui/tabs/list_builder.go 83%
tui/tabs/tab.go 70%
tui/tabs/tabs.go 88%
tui/tabs/tabs.go 54%
tui/tabs/tenant_items.go 0%
wif/factory/factory.go 0%
wif/oauth2/browser.go 0%
wif/oauth2/browser_linux.go 0%
wif/oauth2/cache.go 76%
wif/oauth2/cache.go 79%
wif/oauth2/oauth2.go 25%
wif/oauth2/oauth2.go 59%
wif/options.go 20%

Minimum allowed coverage is 70%

Generated by 🐒 cobertura-action against 56163b1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant