Skip to content

Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure

TypeScript

feat: restyle subscription edit modal to match Models & creds flow

Miguelon Peluchonb0f84b148f72
diff --git a/control-ui/app/hosts/[name]/page.tsx b/control-ui/app/hosts/[name]/page.tsx
index 3ea5644ba..70599301b 100644
--- a/control-ui/app/hosts/[name]/page.tsx
+++ b/control-ui/app/hosts/[name]/page.tsx
@@ -1248,7 +1248,7 @@ export default function HostDetailsPage() {
onClick={() => void cancelModelEdit()}
disabled={busy}
>
- Cancel model changes
+ Cancel
</button>
<button
type="button"
@@ -1263,7 +1263,7 @@ export default function HostDetailsPage() {
!codexModels.includes(modelNameDraft.trim())))
}
>
- {busy ? 'Saving…' : 'Save model configuration'}
+ {busy ? 'Saving…' : 'Save'}
</button>
</div>
</>
diff --git a/control-ui/components/CodexSubscriptionHub/index.tsx b/control-ui/components/CodexSubscriptionHub/index.tsx
index 6cc3c56c1..606c5e1ff 100644
--- a/control-ui/components/CodexSubscriptionHub/index.tsx
+++ b/control-ui/components/CodexSubscriptionHub/index.tsx
@@ -33,6 +33,7 @@ import { IconKey } from '../Sidebar/icons'
import { TablePanelHeader } from '../TablePanelHeader'
import { useToast } from '../Toast'
import { IconPencil, IconRefresh, IconX } from '../icons'
+import { CheckboxField } from '../ui'
function grantLabel(row: CodexSubscriptionConnectionView): string {
return row.displayName || row.connectionKey
@@ -536,7 +537,7 @@ export function CodexSubscriptionHub() {
<IconX width={18} height={18} />
</button>
</div>
- <div className="cu-form-stack" style={{ maxWidth: '100%' }}>
+ <div className="cu-form-stack cu-form-stack--wide" style={{ maxWidth: '100%' }}>
{error ? <div className="cu-banner cu-banner--error">{error}</div> : null}
<div className="cu-field">
<label htmlFor="codex-edit-name">Name</label>
@@ -547,72 +548,113 @@ export function CodexSubscriptionHub() {
disabled={Boolean(busyKey)}
/>
</div>
- <div className="cu-field">
- <span className="cu-field__label">Status</span>
- <span className={statusTagClass(uiStatus)}>{statusLabel(uiStatus)}</span>
- </div>
- <div>
- <button
- type="button"
- className="cu-btn cu-btn--ghost cu-btn--sm"
- onClick={() => void handleConnect(editing)}
- disabled={Boolean(busyKey)}
- >
- Sign in with ChatGPT
- </button>{' '}
- <button
- type="button"
- className="cu-btn cu-btn--ghost cu-btn--sm"
- onClick={() => void handleSync(editing)}
- disabled={Boolean(busyKey) || editing.status !== 'connected'}
- >
- Sync catalog
- </button>
- </div>
- {userCode ? (
- <p data-testid="codex-device-code">
- Enter {userCode}
- {verificationUri ? ` at ${verificationUri}` : ''}
- </p>
- ) : null}
- {editModels.length > 0 ? (
- <fieldset className="cu-field">
- <legend className="cu-field__label">Enabled models</legend>
- {editModels.map(model => (
- <label key={model.model} className="cu-field" style={{ display: 'block' }}>
- <input
- type="checkbox"
- checked={model.enabled}
- disabled={Boolean(busyKey) || model.stale}
- onChange={e =>
- void handleToggleModel(editing, model.model, e.target.checked)
- }
- />{' '}
- {model.model}
- {model.stale ? ' (stale)' : ''}
- </label>
- ))}
- </fieldset>
- ) : null}
- <div className="cu-field">
- <label htmlFor="codex-edit-default">Default model</label>
- <SelectionDropdown
- id="codex-edit-default"
- value={editDefault ? [editDefault] : []}
- options={offeredDefaults.map(model => ({
- value: model,
- label: model,
- icon: <LlmProviderIcon provider="codex-subscription" label={model} />,
- }))}
- placeholder={offeredDefaults.length === 0 ? 'No enabled models' : 'Select model…'}
- searchPlaceholder="Search models…"
- selectionLabel="model"
- multiple={false}
- showSelectedChips={false}
- disabled={Boolean(busyKey) || offeredDefaults.length === 0}
- onChange={next => setEditDefault(next[0] ?? '')}
- />
- </div>
+ <section className="cu-llm-config" aria-label="Subscription configuration">
+ <div className="cu-llm-config__block">
+ <div className="cu-llm-config__block-head">
+ <span className="cu-llm-config__block-title">ChatGPT sign-in</span>
+ <span className={statusTagClass(uiStatus)}>{statusLabel(uiStatus)}</span>
+ </div>
+ <p className="cu-field__hint" style={{ margin: 0 }}>
+ Agents authorize through this subscription&apos;s ChatGPT grant. Reconnect if
+ the grant expired, or sync to refresh the model catalog.
+ </p>
+ <div className="cu-form-inline">
+ <button
+ type="button"
+ className="cu-btn cu-btn--ghost cu-btn--sm"
+ onClick={() => void handleConnect(editing)}
+ disabled={Boolean(busyKey)}
+ >
+ Sign in with ChatGPT
+ </button>
+ <button
+ type="button"
+ className="cu-btn cu-btn--ghost cu-btn--sm"
+ onClick={() => void handleSync(editing)}
+ disabled={Boolean(busyKey) || editing.status !== 'connected'}
+ >
+ Sync catalog
+ </button>
+ </div>
+ {userCode ? (
+ <p
+ className="cu-field__hint"
+ data-testid="codex-device-code"
+ style={{ margin: 0 }}
+ >
+ Enter {userCode}
+ {verificationUri ? ` at ${verificationUri}` : ''}
+ </p>
+ ) : null}
+ </div>
+ {editModels.length > 0 ? (
+ <div className="cu-llm-config__block">
+ <div className="cu-llm-config__block-head">
+ <span className="cu-llm-config__block-title">Enabled models</span>
+ <span className="cu-llm-config__block-tag cu-llm-config__block-tag--muted">
+ {editModels.filter(model => model.enabled && !model.stale).length} of{' '}
+ {editModels.length} enabled
+ </span>
+ </div>
+ <div className="cu-llm-config__model-row">
+ {editModels.map(model => (
+ <CheckboxField
+ key={model.model}
+ checked={model.enabled}
+ disabled={Boolean(busyKey) || model.stale}
+ label={
+ <span className="cu-px-provider">
+ <LlmProviderIcon provider="codex-subscription" label={model.model} />
+ {model.model}
+ </span>
+ }
+ description={
+ model.stale ? 'No longer in the ChatGPT catalog.' : undefined
+ }
+ onChange={e =>
+ void handleToggleModel(editing, model.model, e.target.checked)
+ }
+ />
+ ))}
+ </div>
+ <span className="cu-field__hint">
+ Synced from the ChatGPT catalog. Disabled models are not offered to agents.
+ </span>
+ </div>
+ ) : null}
+ <div className="cu-llm-config__block">
+ <div className="cu-llm-config__block-head">
+ <span className="cu-llm-config__block-title">Primary model</span>
+ <span className="cu-llm-config__block-tag cu-llm-config__block-tag--muted">
+ Optional
+ </span>
+ </div>
+ <div className="cu-field">
+ <label htmlFor="codex-edit-default">Default model</label>
+ <SelectionDropdown
+ id="codex-edit-default"
+ value={editDefault ? [editDefault] : []}
+ options={offeredDefaults.map(model => ({
+ value: model,
+ label: model,
+ icon: <LlmProviderIcon provider="codex-subscription" label={model} />,
+ }))}
+ placeholder={
+ offeredDefaults.length === 0 ? 'No enabled models' : 'Select model…'
+ }
+ searchPlaceholder="Search models…"
+ selectionLabel="model"
+ multiple={false}
+ showSelectedChips={false}
+ disabled={Boolean(busyKey) || offeredDefaults.length === 0}
+ onChange={next => setEditDefault(next[0] ?? '')}
+ />
+ <span className="cu-field__hint">
+ Preselected for new chats; agents can pick any enabled model.
+ </span>
+ </div>
+ </div>
+ </section>
</div>
<div className="cu-modal-panel__foot">
<button
diff --git a/control-ui/components/__tests__/HostDetailsPage.conflict.test.tsx b/control-ui/components/__tests__/HostDetailsPage.conflict.test.tsx
index 2a8f4d169..841ac780f 100644
--- a/control-ui/components/__tests__/HostDetailsPage.conflict.test.tsx
+++ b/control-ui/components/__tests__/HostDetailsPage.conflict.test.tsx
@@ -335,10 +335,10 @@ describe('HostDetailsPage current model and credential flow', () => {
fireEvent.click(screen.getByRole('button', { name: 'Edit' }))
expect(screen.getByRole('region', { name: 'LLM configuration' })).toBeInTheDocument()
- expect(screen.getByRole('button', { name: 'Save model configuration' })).toBeInTheDocument()
+ expect(screen.getByRole('button', { name: 'Save' })).toBeInTheDocument()
expect(screen.queryByRole('button', { name: 'Update secret' })).not.toBeInTheDocument()
- fireEvent.click(screen.getByRole('button', { name: 'Save model configuration' }))
+ fireEvent.click(screen.getByRole('button', { name: 'Save' }))
await waitFor(() =>
expect(api.apiSend).toHaveBeenCalledWith('PUT', '/api/v1/admin/hosts/foo', expect.any(Object))
@@ -373,13 +373,11 @@ describe('HostDetailsPage current model and credential flow', () => {
screen.getByLabelText('Current model', { selector: '#llm-primary-model' })
).toHaveTextContent('gpt-5.4')
- fireEvent.click(screen.getByRole('button', { name: 'Cancel model changes' }))
+ fireEvent.click(screen.getByRole('button', { name: 'Cancel' }))
expect(await screen.findByText('gpt-4.1')).toBeInTheDocument()
await waitFor(() => expect(api.getHostDetailBundle).toHaveBeenCalledTimes(2))
- expect(
- screen.queryByRole('button', { name: 'Save model configuration' })
- ).not.toBeInTheDocument()
+ expect(screen.queryByRole('button', { name: 'Save' })).not.toBeInTheDocument()
expect(
(api.apiSend as unknown as ReturnType<typeof vi.fn>).mock.calls.some(
args => args[0] === 'PUT' && args[1] === '/api/v1/admin/hosts/foo'
@@ -412,13 +410,13 @@ describe('HostDetailsPage current model and credential flow', () => {
fireEvent.click(screen.getByRole('button', { name: 'Edit' }))
fireEvent.click(screen.getByLabelText('Current model', { selector: '#llm-primary-model' }))
fireEvent.click(await screen.findByRole('option', { name: 'gpt-5.4' }))
- fireEvent.click(screen.getByRole('button', { name: 'Save model configuration' }))
+ fireEvent.click(screen.getByRole('button', { name: 'Save' }))
expect(await screen.findByText('model save failed')).toBeInTheDocument()
expect(
screen.getByLabelText('Current model', { selector: '#llm-primary-model' })
).toHaveTextContent('gpt-5.4')
- expect(screen.getByRole('button', { name: 'Save model configuration' })).toBeInTheDocument()
+ expect(screen.getByRole('button', { name: 'Save' })).toBeInTheDocument()
expect(screen.queryByText('Model configuration saved.')).not.toBeInTheDocument()
const payload = findHostPutPayload() as {
@@ -475,13 +473,11 @@ describe('HostDetailsPage current model and credential flow', () => {
fireEvent.click(screen.getByRole('button', { name: 'Edit' }))
fireEvent.click(screen.getByLabelText('Current model', { selector: '#llm-primary-model' }))
fireEvent.click(await screen.findByRole('option', { name: 'gpt-5.4' }))
- fireEvent.click(screen.getByRole('button', { name: 'Save model configuration' }))
+ fireEvent.click(screen.getByRole('button', { name: 'Save' }))
expect(await screen.findByText('Model configuration saved.')).toBeInTheDocument()
expect(await screen.findByText('gpt-4.1')).toBeInTheDocument()
- expect(
- screen.queryByRole('button', { name: 'Save model configuration' })
- ).not.toBeInTheDocument()
+ expect(screen.queryByRole('button', { name: 'Save' })).not.toBeInTheDocument()
const payload = findHostPutPayload() as {
metadata?: { resourceVersion?: string }
@@ -570,7 +566,7 @@ describe('HostDetailsPage current model and credential flow', () => {
fireEvent.click(screen.getByRole('button', { name: 'Edit' }))
fireEvent.click(screen.getByRole('button', { name: 'LLM Secret' }))
fireEvent.click(screen.getByRole('option', { name: /openai-secret-b/ }))
- fireEvent.click(screen.getByRole('button', { name: 'Save model configuration' }))
+ fireEvent.click(screen.getByRole('button', { name: 'Save' }))
await waitFor(() =>
expect(api.apiSend).toHaveBeenCalledWith('PUT', '/api/v1/admin/hosts/foo', expect.any(Object))
@@ -627,7 +623,7 @@ describe('HostDetailsPage cross-tab draft preservation', () => {
fireEvent.click(screen.getByRole('button', { name: 'Edit' }))
// Keep the existing static-credentials secret. Emptying it now fails
// closed (Codex broker chains omit secretRef; OpenAI still requires one).
- fireEvent.click(screen.getByRole('button', { name: 'Save model configuration' }))
+ fireEvent.click(screen.getByRole('button', { name: 'Save' }))
expect(await screen.findByText('Model configuration saved.')).toBeInTheDocument()
navigateToTab(view, 'overview')
@@ -655,8 +651,8 @@ describe('HostDetailsPage cross-tab draft preservation', () => {
expect(screen.getByLabelText('Credential')).toBeInTheDocument()
expect(screen.queryByText('Secret reference')).not.toBeInTheDocument()
expect(screen.queryByRole('radio', { name: /ChatGPT subscription/i })).not.toBeInTheDocument()
- expect(screen.getByRole('button', { name: 'Save model configuration' })).toBeDisabled()
- fireEvent.click(screen.getByRole('button', { name: 'Save model configuration' }))
+ expect(screen.getByRole('button', { name: 'Save' })).toBeDisabled()
+ fireEvent.click(screen.getByRole('button', { name: 'Save' }))
expect(api.apiSend).not.toHaveBeenCalledWith(
'PUT',
diff --git a/control-ui/components/__tests__/HostDetailsPage.identity.test.tsx b/control-ui/components/__tests__/HostDetailsPage.identity.test.tsx
index 19260058e..94698937b 100644
--- a/control-ui/components/__tests__/HostDetailsPage.identity.test.tsx
+++ b/control-ui/components/__tests__/HostDetailsPage.identity.test.tsx
@@ -277,9 +277,7 @@ describe('HostDetailsPage identity integration', () => {
expect(screen.queryByText('Secret reference')).not.toBeInTheDocument()
expect(screen.queryByText('Broker-backed — no LLM secret required')).not.toBeInTheDocument()
expect(screen.queryByRole('button', { name: 'Save' })).not.toBeInTheDocument()
- expect(
- screen.queryByRole('button', { name: 'Save model configuration' })
- ).not.toBeInTheDocument()
+ expect(screen.queryByRole('button', { name: 'Save' })).not.toBeInTheDocument()
})
it('opens Advanced on the Hooks sub-tab', async () => {
@@ -409,8 +407,8 @@ describe('HostDetailsPage identity integration', () => {
fireEvent.click(screen.getByRole('button', { name: 'Edit' }))
expect(screen.getByLabelText('Credential')).toBeInTheDocument()
expect(screen.queryByRole('radio', { name: /ChatGPT subscription/i })).not.toBeInTheDocument()
- expect(screen.getByRole('button', { name: 'Save model configuration' })).toBeDisabled()
- fireEvent.click(screen.getByRole('button', { name: 'Save model configuration' }))
+ expect(screen.getByRole('button', { name: 'Save' })).toBeDisabled()
+ fireEvent.click(screen.getByRole('button', { name: 'Save' }))
expect(api.apiSend).not.toHaveBeenCalledWith(
'PUT',
'/api/v1/admin/hosts/foo',
diff --git a/control-ui/package-lock.json b/control-ui/package-lock.json
index c6c1e8790..ce4b311a3 100644
--- a/control-ui/package-lock.json
+++ b/control-ui/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "clerum-control-ui",
- "version": "0.1.476",
+ "version": "0.1.477",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "clerum-control-ui",
- "version": "0.1.476",
+ "version": "0.1.477",
"dependencies": {
"@clerum/display-field": "file:../packages/display-field",
"@clerum/llm-providers": "file:../packages/llm-providers",
diff --git a/control-ui/package.json b/control-ui/package.json
index bcf1f477a..18018e778 100644
--- a/control-ui/package.json
+++ b/control-ui/package.json
@@ -1,6 +1,6 @@
{
"name": "clerum-control-ui",
- "version": "0.1.476",
+ "version": "0.1.477",
"private": true,
"scripts": {
"dev": "NEXT_IGNORE_INCORRECT_LOCKFILE=1 next dev",