Skip to content

feat(web): add copy actions for upstreams and model aliases - #495

Open
yyyr-p wants to merge 2 commits into
Menci:mainfrom
yyyr-p:feat/upstream-copy-button
Open

feat(web): add copy actions for upstreams and model aliases#495
yyyr-p wants to merge 2 commits into
Menci:mainfrom
yyyr-p:feat/upstream-copy-button

Conversation

@yyyr-p

@yyyr-p yyyr-p commented Aug 20, 2026

Copy link
Copy Markdown
Collaborator

Summary

Both list pages gain a copy action next to edit, so a working upstream or model alias can be duplicated without recreating every field by hand.

Upstreams open a new /dashboard/providers/upstreams/:id/copy route that reuses the existing editor in create mode, seeded from the source record with a fresh id, a {{name}} copy name, and a distinct hue. structuredClone isolates every nested field so editing the copy can't mutate the source.

The credential is the one field that isn't a straight copy, and it follows the provider kind:

Kind On copy
custom (API key), azure, ollama Carry the stored key over through the editor's "leave blank to keep" contract — the secret field stays blank and on save the source's key is kept without re-entering it.
copilot, codex, claude-code Reset to the blueprint shape; OAuth tokens are minted by the exchange and aren't valid as a second grant, so carrying them would ship a dead credential.

Model aliases reuse the existing dialog in a new copy mode that seeds from the source with a {{name}} copy name but saves through the create endpoint, producing a second alias rather than overwriting. The dialog's mode (create | edit | copy) replaces the old record ? edit : create boolean so duplicate detection and the save target can tell the three apart.

New en and zh-Hans strings carry the copy labels, name suffix, dialog title, and document title (the two locales stay structurally equivalent); routes.ts registers the route and document-title-sync maps its path to the title.

Test Plan

  • pnpm run verify — every stage passes except five tests that fail identically on the feature commit before this PR (copilot-device-flow_test.tsx ×4 and oauth-authorize-url_test.tsx ×1, all timing/poll-count expected 1, received 0), so they are pre-existing and unrelated to this change.

yyyr-p added 2 commits August 18, 2026 16:41
Drop the opening sentence that restates what the copy route and loader
already show; keep the non-obvious credential rationale (API-key providers
keep the stored key via the blank-secret contract; OAuth providers reset to
the blueprint shape because their tokens are minted by the exchange).
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