Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 0 additions & 29 deletions gui/src/pages/Providers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import { useT } from "../i18n/shared";
import { formatProviderDisplayName } from "../provider-icons";
import { useProviderAccountPools } from "../hooks/useProviderAccountPools";
import { useCodexAccountPool } from "../hooks/useCodexAccountPool";
import { useJsonConfigEditor } from "../hooks/useJsonConfigEditor";
import { useKeyedClientResource } from "../client-resource";
import { readSessionListCache } from "../session-list-cache";
import type { ProvidersConfig } from "./providers-shared";
Expand Down Expand Up @@ -143,18 +142,6 @@ export default function Providers({ apiBase }: { apiBase: string }) {
switchAccount, switchApiKey, removeApiKey, addApiKeyValue, editCredentialAlias,
removeAccount, activeAccountNeedsReauth,
} = pools;
const jsonEditor = useJsonConfigEditor({
apiBase, config,
notify,
fetchConfig, fetchProviderQuotas, onSaved: () => setModelsRefreshToken(n => n + 1),
t: t as unknown as Parameters<typeof useJsonConfigEditor>[0]["t"],
});
const {
draft, setDraft, jsonEditorOpen, jsonSaving, jsonLeaveOpen,
saveConfig, openJsonEditor, discardJsonEditor, requestCloseJsonEditor, restoreJsonEditor,
jsonIsDirty, setJsonLeaveOpen,
} = jsonEditor;

useEffect(() => {
// Deferred by a microtask, not a timer. A timer had to be cancelled in cleanup, so navigating
// away within the same tick dropped both requests with nothing to retry them and the page came
Expand Down Expand Up @@ -274,17 +261,6 @@ export default function Providers({ apiBase }: { apiBase: string }) {
selectedName={workspaceSelected}
onSelect={setWorkspaceSelected}
onAddProvider={intent => { setAddIntent(intent ?? null); setAdding(true); }}
onEditConfig={openJsonEditor}
jsonEditor={{
open: jsonEditorOpen,
draft,
isDirty: jsonIsDirty,
onDraftChange: setDraft,
onSave: () => saveConfig(),
onClose: requestCloseJsonEditor,
onRestore: restoreJsonEditor,
}}
jsonSaving={jsonSaving}
modelsRefreshToken={modelsRefreshToken}
activeAccountNeedsReauth={activeAccountNeedsReauth}
quotaRefreshEpoch={quotaRefresh.epoch}
Expand Down Expand Up @@ -350,8 +326,6 @@ export default function Providers({ apiBase }: { apiBase: string }) {
? Object.entries(config.providers).find(([name, provider]) => name !== removeConfirmName && provider.disabled !== true)?.[0] ?? null
: null}
codexLoginOpen={codexLoginOpen}
jsonLeaveOpen={jsonLeaveOpen}
jsonSaving={jsonSaving}
oauthTosPending={oauthTosPending}
onCloseAdd={() => {
if (busy) void cancelLoginOAuth(busy);
Expand Down Expand Up @@ -382,9 +356,6 @@ export default function Providers({ apiBase }: { apiBase: string }) {
}}
onCancelRemove={() => setRemoveConfirmName(null)}
onConfirmRemove={() => { void confirmRemoveProvider(removeConfirmName); }}
onCancelJsonLeave={() => { if (!jsonSaving) setJsonLeaveOpen(false); }}
onDiscardJson={discardJsonEditor}
onSaveJson={() => { void saveConfig(); }}
onCancelOauthTos={() => setOauthTosPending(null)}
onContinueOauthTos={() => {
const pending = oauthTosPending;
Expand Down
9 changes: 9 additions & 0 deletions gui/tests/providers-json-editor-disabled.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { expect, test } from "bun:test";

test("Providers does not expose the disabled full-config save flow", async () => {
const source = await Bun.file(new URL("../src/pages/Providers.tsx", import.meta.url)).text();

expect(source).not.toContain("useJsonConfigEditor");
expect(source).not.toContain("onEditConfig=");
expect(source).not.toContain("jsonEditor=");
});
Loading