Skip to content

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

TypeScript

chore(frontend): merge current dev subscription flow

Josué9a417fe36306
diff --cc control-ui/components/CodexSubscriptionHub/index.tsx
index 8bbbd1484,91cf4da38..977b12cbd
--- a/control-ui/components/CodexSubscriptionHub/index.tsx
+++ b/control-ui/components/CodexSubscriptionHub/index.tsx
@@@ -1,9 -1,9 +1,10 @@@
'use client'
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'
+import { DataTable, TableHeaderCell, useTableSort } from '@clerum/frontend-table-system'
import { copyTextToClipboard } from '@lib/clipboard'
import {
+ CODEX_DEVICE_VERIFICATION_URI,
type CodexSubscriptionConnectionView,
createCodexSubscriptionConnection,
listCodexConnectionModels,
@@@ -106,18 -130,16 +131,25 @@@ export function CodexSubscriptionHub()
[grantLabel(row), row.connectionKey, row.status].join(' ').toLowerCase().includes(q)
)
}, [connections, searchQuery])
+ const subscriptionSort = useTableSort<CodexSubscriptionConnectionView, 'name' | 'status'>({
+ rows: filtered,
+ defaultKey: 'name',
+ identity: row => row.connectionKey,
+ accessors: {
+ name: grantLabel,
+ status: row => statusLabel(mapConnectionStatus(row.status)),
+ },
+ })
+ // Create makes the grant with the typed display name and starts the device
+ // sign-in right away — by the time the operator approves the code, the
+ // catalog is already synced server-side (connect handshake) and the models
+ // grid is populated.
+ // Create is its own phase: once the grant exists, nothing below may report
+ // "creation failed" — later failures (table refresh, sign-in) are reported
+ // as their own partial outcomes, and sign-in always gets a chance to start.
async function handleCreate() {
- const displayName = createName.trim()
+ const displayName = editName.trim()
if (!displayName) {
setError('Subscription name is required.')
return
@@@ -446,24 -494,27 +516,25 @@@
<td>
<span className={statusTagClass(mapped)}>{statusLabel(mapped)}</span>
</td>
- <td style={{ textAlign: 'right' }}>
- <div style={{ display: 'inline-flex', gap: '0.35rem' }}>
- <RowActionsMenu
- ariaLabel={`Actions for ChatGPT subscription ${grantLabel(row)}`}
- horizontalTrigger
- actions={[
- {
- key: 'update',
- label: 'Update',
- onClick: () => void openEdit(row),
- },
- {
- key: 'delete',
- label: busyKey === row.connectionKey ? 'Deleting…' : 'Delete',
- danger: true,
- disabled: busyKey === row.connectionKey,
- onClick: () => void handleRevoke(row),
- },
- ]}
- />
- </div>
+ <td className="cu-table__cell-actions">
+ <RowActionsMenu
+ ariaLabel={`Actions for ChatGPT subscription ${grantLabel(row)}`}
++ horizontalTrigger
+ actions={[
+ {
- key: 'edit',
- label: 'Edit',
++ key: 'update',
++ label: 'Update',
+ onClick: () => void openEdit(row),
+ },
+ {
+ key: 'delete',
+ label: busyKey === row.connectionKey ? 'Deleting…' : 'Delete',
+ danger: true,
+ disabled: busyKey === row.connectionKey,
+ onClick: () => void handleRevoke(row),
+ },
+ ]}
+ />
</td>
</tr>
)
diff --cc control-ui/components/__tests__/CodexSubscriptionHub.test.tsx
index b3ad1b8f7,4196260cb..cd023961b
--- a/control-ui/components/__tests__/CodexSubscriptionHub.test.tsx
+++ b/control-ui/components/__tests__/CodexSubscriptionHub.test.tsx
@@@ -357,43 -233,18 +233,47 @@@ describe('CodexSubscriptionHub', () =>
expect(screen.getByRole('menuitem', { name: 'Delete' })).toBeInTheDocument()
})
- it('renders the ChatGPT verification link from the pencil Sign in path', async () => {
++ it('renders the ChatGPT verification link from the Update sign-in path', async () => {
++ vi.stubGlobal(
++ 'open',
++ vi.fn(() => ({}))
++ )
+ vi.mocked(startCodexDeviceConnect).mockResolvedValue({
+ userCode: 'WXYZ-9876',
+ verificationUri: 'https://auth.openai.com/codex/device',
- intervalSeconds: 0.001,
++ intervalSeconds: 0.3,
+ state: 'state-pencil',
+ intent: 'reconnect',
+ })
+ render(
+ <ToastProvider>
+ <CodexSubscriptionHub />
+ </ToastProvider>
+ )
+ fireEvent.click(
+ await screen.findByRole('button', { name: 'Actions for ChatGPT subscription Team A' })
+ )
- fireEvent.click(screen.getByRole('menuitem', { name: 'Edit' }))
++ fireEvent.click(screen.getByRole('menuitem', { name: 'Update' }))
+ fireEvent.click(await screen.findByRole('button', { name: 'Sign in with ChatGPT' }))
+ const link = await screen.findByTestId('codex-device-verification-link')
+ expect(link).toHaveAttribute('href', 'https://auth.openai.com/codex/device')
+ expect(link.getAttribute('rel') ?? '').toContain('noopener')
+ expect(link.getAttribute('rel') ?? '').toContain('noreferrer')
- expect(screen.getByTestId('codex-device-code').closest('[role="status"]')).toHaveTextContent(
- 'WXYZ-9876'
- )
- expect(screen.getByRole('button', { name: 'Update subscription' })).toBeInTheDocument()
- expect(screen.queryByRole('button', { name: 'Saving…' })).not.toBeInTheDocument()
++ expect(screen.getByTestId('codex-device-code')).toHaveTextContent('WXYZ-9876')
+ })
+
- it('opens the grant modal for Sign in and default model without a Sync catalog control', async () => {
+ it('opens the grant modal for reconnect and model toggles without binding hosts', async () => {
vi.mocked(startCodexDeviceConnect).mockResolvedValue({
userCode: 'ABCD-1234',
- verificationUri: 'https://auth.openai.com/codex/device',
+ verificationUri: CODEX_DEVICE_VERIFICATION_URI,
intervalSeconds: 1,
state: 'state-1',
- intent: 'connect',
+ intent: 'reconnect',
})
+ vi.mocked(patchCodexCatalogModel).mockResolvedValue([
+ { model: 'gpt-5.1', enabled: true, stale: false },
+ { model: 'gpt-5.3-codex', enabled: true, stale: false },
+ ])
vi.mocked(patchCodexSubscriptionConnection).mockResolvedValue(
connection({ connectionKey: 'codex-aaa', displayName: 'Team A', defaultModel: 'gpt-5.1' })
)
diff --cc control-ui/package-lock.json
index 197b7305a,a7870870c..3fb10a157
--- a/control-ui/package-lock.json
+++ b/control-ui/package-lock.json
@@@ -1,15 -1,14 +1,15 @@@
{
"name": "clerum-control-ui",
- "version": "0.1.500",
- "version": "0.1.484",
++ "version": "0.1.501",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "clerum-control-ui",
- "version": "0.1.500",
- "version": "0.1.484",
++ "version": "0.1.501",
"dependencies": {
"@clerum/display-field": "file:../packages/display-field",
+ "@clerum/frontend-table-system": "file:../packages/frontend-table-system",
"@clerum/llm-providers": "file:../packages/llm-providers",
"@clerum/workflow-recipe-capability-policy": "file:../packages/workflow-recipe-capability-policy",
"@uiw/react-md-editor": "^4.1.0",
diff --cc control-ui/package.json
index 063a94fb9,ddc3b5e54..70d3d9f73
--- a/control-ui/package.json
+++ b/control-ui/package.json
@@@ -1,6 -1,6 +1,6 @@@
{
"name": "clerum-control-ui",
- "version": "0.1.500",
- "version": "0.1.484",
++ "version": "0.1.501",
"private": true,
"scripts": {
"dev": "NEXT_IGNORE_INCORRECT_LOCKFILE=1 next dev",