fix(extensions): keep dashboard banner provider-aware
This commit is contained in:
parent
1ee139b66a
commit
7c21d14bdf
2 changed files with 91 additions and 0 deletions
|
|
@ -364,6 +364,12 @@ function isCheckingMultimodelStatus(
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function hasVisibleAuthenticatedMultimodelProvider(
|
||||||
|
visibleProviders: readonly CliProviderStatus[]
|
||||||
|
): boolean {
|
||||||
|
return visibleProviders.some((provider) => provider.authenticated);
|
||||||
|
}
|
||||||
|
|
||||||
const InstalledBanner = ({
|
const InstalledBanner = ({
|
||||||
cliStatus,
|
cliStatus,
|
||||||
cliStatusLoading,
|
cliStatusLoading,
|
||||||
|
|
@ -850,6 +856,13 @@ export const CliStatusBanner = (): React.JSX.Element | null => {
|
||||||
if (isCheckingMultimodelStatus(cliStatus, visibleCliProviders)) return 'info';
|
if (isCheckingMultimodelStatus(cliStatus, visibleCliProviders)) return 'info';
|
||||||
if (cliStatus.authStatusChecking) return 'info';
|
if (cliStatus.authStatusChecking) return 'info';
|
||||||
if (!cliStatus.installed) return 'error';
|
if (!cliStatus.installed) return 'error';
|
||||||
|
if (
|
||||||
|
isMultimodelRuntimeStatus(cliStatus) &&
|
||||||
|
visibleCliProviders.length > 0 &&
|
||||||
|
!hasVisibleAuthenticatedMultimodelProvider(visibleCliProviders)
|
||||||
|
) {
|
||||||
|
return 'warning';
|
||||||
|
}
|
||||||
if (cliStatus.installed && !cliStatus.authLoggedIn) return 'warning';
|
if (cliStatus.installed && !cliStatus.authLoggedIn) return 'warning';
|
||||||
if (cliStatus.updateAvailable) return 'info';
|
if (cliStatus.updateAvailable) return 'info';
|
||||||
return 'success';
|
return 'success';
|
||||||
|
|
|
||||||
|
|
@ -418,6 +418,84 @@ describe('CLI status visibility during completed install state', () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('keeps the dashboard banner in warning state when only hidden providers are authenticated', async () => {
|
||||||
|
vi.stubGlobal('IS_REACT_ACT_ENVIRONMENT', true);
|
||||||
|
storeState.cliInstallerState = 'idle';
|
||||||
|
storeState.cliStatus = createInstalledCliStatus({
|
||||||
|
flavor: 'agent_teams_orchestrator',
|
||||||
|
authLoggedIn: true,
|
||||||
|
showVersionDetails: false,
|
||||||
|
showBinaryPath: false,
|
||||||
|
supportsSelfUpdate: false,
|
||||||
|
providers: [
|
||||||
|
{
|
||||||
|
providerId: 'anthropic',
|
||||||
|
displayName: 'Anthropic',
|
||||||
|
supported: true,
|
||||||
|
authenticated: false,
|
||||||
|
authMethod: null,
|
||||||
|
verificationState: 'unknown',
|
||||||
|
statusMessage: 'Authentication required',
|
||||||
|
models: [],
|
||||||
|
canLoginFromUi: true,
|
||||||
|
capabilities: {
|
||||||
|
teamLaunch: true,
|
||||||
|
oneShot: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
providerId: 'codex',
|
||||||
|
displayName: 'Codex',
|
||||||
|
supported: true,
|
||||||
|
authenticated: false,
|
||||||
|
authMethod: null,
|
||||||
|
verificationState: 'unknown',
|
||||||
|
statusMessage: 'Authentication required',
|
||||||
|
models: [],
|
||||||
|
canLoginFromUi: true,
|
||||||
|
capabilities: {
|
||||||
|
teamLaunch: true,
|
||||||
|
oneShot: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
providerId: 'gemini',
|
||||||
|
displayName: 'Gemini',
|
||||||
|
supported: true,
|
||||||
|
authenticated: true,
|
||||||
|
authMethod: 'cli_oauth_personal',
|
||||||
|
verificationState: 'verified',
|
||||||
|
statusMessage: 'Resolved to CLI SDK',
|
||||||
|
models: [],
|
||||||
|
canLoginFromUi: true,
|
||||||
|
capabilities: {
|
||||||
|
teamLaunch: true,
|
||||||
|
oneShot: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
});
|
||||||
|
|
||||||
|
const host = document.createElement('div');
|
||||||
|
document.body.appendChild(host);
|
||||||
|
const root = createRoot(host);
|
||||||
|
|
||||||
|
await act(async () => {
|
||||||
|
root.render(React.createElement(CliStatusBanner));
|
||||||
|
await Promise.resolve();
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(host.textContent).toContain('Providers: 0/2 connected');
|
||||||
|
expect((host.firstElementChild as HTMLElement | null)?.getAttribute('style')).toContain(
|
||||||
|
'245, 158, 11'
|
||||||
|
);
|
||||||
|
|
||||||
|
await act(async () => {
|
||||||
|
root.unmount();
|
||||||
|
await Promise.resolve();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
it('shows a degraded runtime warning when a binary is found but the health check fails', async () => {
|
it('shows a degraded runtime warning when a binary is found but the health check fails', async () => {
|
||||||
vi.stubGlobal('IS_REACT_ACT_ENVIRONMENT', true);
|
vi.stubGlobal('IS_REACT_ACT_ENVIRONMENT', true);
|
||||||
storeState.cliInstallerState = 'idle';
|
storeState.cliInstallerState = 'idle';
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue