feat(dashboard): unify upstream edit/create Fetch button UX#228
Merged
Conversation
- fix: getUpstream now returns modelsCache (was missing from single-record GET, only present in list/create/update — the Models Cache section in the edit page never appeared until a save had happened) - Fetch button in Custom/Ollama config panels is no longer create-only; edit mode gets the same in-flight preview UX as new upstream - listDraftModels fills apiKey from stored secret when the operator didn't retype it (edit mode), matching save()'s "empty means keep" semantics so the preview doesn't hit an unauthenticated upstream - listDraftModels reloads the store + reflects fresh modelsCache back into draft on success, replacing the removed Refresh now button - ModelsCacheStatus is now a passive info panel (last fetched / last error) with no button — Fetch owns the re-fetch action - unify fetchedOllamaModels into upstreamModels so autoForActive doesn't branch on isCreate for ollama
…ializer getUpstream inlined the same modelsCache + codexQuota projection serializeForResponse already owned, differing only in the redacted-vs- full serializer choice. Widen the helper to take the base serializer as an argument (defaulting to upstreamRecordToJson so list/create/update callers stay put) and let getUpstream pass upstreamRecordToFullJson. Response envelope is byte-identical.
…stomConfig listDraftModels open-coded the per-kind builder dispatch and the edit-mode stored-secret fallback, mixing form-draft-to-wire-shape policy into a Vue setup function whose primary job is UI orchestration. Move both into customConfig.ts alongside buildCustomConfigCore: the new buildListModelsPreviewConfig handles the dispatch and the fallback, and buildOllamaConfig moves next to it so save() and the preview share one wire-shape projection for ollama.
…lt dispatch listDraftModels and fetchUpstreamModels both branched on draft.kind to route the response into fetchedRaw (custom) or upstreamModels (else). Fold the two identical tails into one closure so a future kind or slot change only lives in one place.
- drop stale 'operator-driven refresh' caller reference in fetchUpstreamModels - align OllamaConfigPanel top comment + fetchStatus JSDoc with sibling panels
Three comment-only edits on UpstreamEditPage.vue after the applyListModelsResult extract-refactor: - Drop the comment above applyListModelsResult: the routing rationale is already carried by the ListModelsResult type comment directly above the helper and by the autoForActive comment further down. - Trim the fetchUpstreamModels comment: drop the custom-vs-projected routing paragraph (the extracted helper now owns that routing) and the trailing "surfaces error on upstreamModelsError" line (pure restatement of the adjacent assignment). - Shrink the fetchedRaw declaration comment to a 3-line role hint pointing at customAutoModelsFromDraft; the why-two-refs story stays discoverable via the autoForActive comment.
Round 1 moved buildOllamaConfig out of UpstreamEditPage.vue into the wire-shape module next to buildCustomConfigCore; Azure's counterpart stayed local. Move it too so the two-of-three post-Round-1 split collapses onto one pattern — every editable-provider save-shape projection lives in customConfig.ts, UpstreamEditPage only dispatches.
Convention: comments never reference callers. Rewrite the projection comment to explain the baseSerialize parameter caller-agnostically — same WHY, no enumeration of consumer sites.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
getUpstreamhandler to includemodelsCachein the initial edit-page load. Previously onlylist/create/updatewent throughserializeForResponse(which attachesmodelsCache+codex_quota);getUpstreaminlined a projection without them, so the Models Cache panel stayed empty until the first Save. Fixed by parametrizingserializeForResponseover the base serializer and routinggetUpstreamthrough it withupstreamRecordToFullJson.save()treats an empty apiKey via backend patch-omit semantics.ModelsCacheStatusinto an info-only panel (no button, no emit). The per-provider Fetch button is now the single re-fetch entry point; the cache panel is a passive reflection of the SWR row.buildOllamaConfig/buildAzureConfig/buildListModelsPreviewConfignow live incustomConfig.tsalongsidebuildCustomConfigCore, so form-draft-to-wire-shape projection has one home.applyListModelsResultclosure factors out the custom-vs-projected fetch-result dispatch that used to be duplicated betweenlistDraftModelsandfetchUpstreamModels.Test plan