mirror of
https://github.com/router-for-me/Cli-Proxy-API-Management-Center.git
synced 2026-06-16 21:03:58 +08:00
refactor(providers): remove dead issue and path scaffolding
snapshot.issues was always empty and group.issue always null, so the issue badges and warning panels could never render. group.path / PROVIDER_PATHS were written but never read. Strip the fields, their render branches and the orphan styles.
This commit is contained in:
@@ -457,7 +457,6 @@ export function ProvidersWorkbenchPage() {
|
||||
totalResources={totalResources}
|
||||
providerFamilies={providerFamilies}
|
||||
updatedAtLabel={updatedAtLabel}
|
||||
issueCount={workbench.snapshot?.issues.length ?? 0}
|
||||
isFetching={workbench.isFetching}
|
||||
isNewDisabled={disableMutations && !ampcodeBrandActive}
|
||||
newLabel={
|
||||
|
||||
@@ -5,7 +5,6 @@ import codexLogo from '@/assets/icons/codex.svg';
|
||||
import geminiLogo from '@/assets/icons/gemini.svg';
|
||||
import openaiLogo from '@/assets/icons/openai-light.svg';
|
||||
import vertexLogo from '@/assets/icons/vertex.svg';
|
||||
import { IconAlertTriangle } from '@/components/ui/icons';
|
||||
import type { ProviderBrand, ProviderGroup } from '../types';
|
||||
import styles from './ProviderCategoryList.module.scss';
|
||||
|
||||
@@ -80,20 +79,13 @@ export function ProviderCategoryList({
|
||||
</span>
|
||||
</span>
|
||||
</span>
|
||||
{group.issue ? (
|
||||
<IconAlertTriangle
|
||||
size={16}
|
||||
style={{ color: 'var(--amber-text)', flexShrink: 0 }}
|
||||
/>
|
||||
) : (
|
||||
<span
|
||||
className={`${styles.badge} ${
|
||||
group.id !== 'ampcode' && total === 0 ? styles.badgeAmber : ''
|
||||
}`}
|
||||
>
|
||||
{group.id === 'ampcode' ? (group.resources[0]?.disabled ? '—' : '1') : total}
|
||||
</span>
|
||||
)}
|
||||
<span
|
||||
className={`${styles.badge} ${
|
||||
group.id !== 'ampcode' && total === 0 ? styles.badgeAmber : ''
|
||||
}`}
|
||||
>
|
||||
{group.id === 'ampcode' ? (group.resources[0]?.disabled ? '—' : '1') : total}
|
||||
</span>
|
||||
</button>
|
||||
);
|
||||
})}
|
||||
|
||||
@@ -11,7 +11,6 @@ interface ProviderHeaderCardProps {
|
||||
totalResources: number;
|
||||
providerFamilies: number;
|
||||
updatedAtLabel: string;
|
||||
issueCount?: number;
|
||||
isFetching?: boolean;
|
||||
isNewDisabled?: boolean;
|
||||
newLabel?: string;
|
||||
@@ -24,7 +23,6 @@ export function ProviderHeaderCard({
|
||||
totalResources,
|
||||
providerFamilies,
|
||||
updatedAtLabel,
|
||||
issueCount = 0,
|
||||
isFetching = false,
|
||||
isNewDisabled = false,
|
||||
newLabel,
|
||||
@@ -85,11 +83,6 @@ export function ProviderHeaderCard({
|
||||
<span className={styles.chip}>
|
||||
{t('providersPage.header.updatedAt', { time: updatedAtLabel })}
|
||||
</span>
|
||||
{issueCount > 0 ? (
|
||||
<span className={`${styles.chip} ${styles.chipAmber}`}>
|
||||
{t('providersPage.header.issueCount', { count: issueCount })}
|
||||
</span>
|
||||
) : null}
|
||||
</div>
|
||||
</section>
|
||||
);
|
||||
|
||||
@@ -114,21 +114,6 @@
|
||||
display: inline-flex;
|
||||
}
|
||||
|
||||
.issue {
|
||||
border: 1px solid var(--amber-30);
|
||||
background: var(--amber-10);
|
||||
border-radius: var(--radius-md);
|
||||
padding: 12px 14px;
|
||||
font-size: 14px;
|
||||
color: var(--amber-text);
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
.issueTitle {
|
||||
font-weight: 600;
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
|
||||
.empty {
|
||||
border: 1px dashed var(--border-color);
|
||||
border-radius: var(--radius-md);
|
||||
|
||||
@@ -118,16 +118,6 @@ export function ProviderResourcePanel({
|
||||
) : null}
|
||||
</div>
|
||||
|
||||
{group.issue ? (
|
||||
<div className={styles.issue}>
|
||||
<div className={styles.issueTitle}>
|
||||
{t('providersPage.table.providerIssue')}
|
||||
{group.issue.status ? ` · ${group.issue.status}` : ''}
|
||||
</div>
|
||||
<div>{group.issue.message}</div>
|
||||
</div>
|
||||
) : null}
|
||||
|
||||
{realResources.length === 0 && group.id !== 'ampcode' ? (
|
||||
<div className={styles.empty}>
|
||||
<div>{t('providersPage.table.empty')}</div>
|
||||
|
||||
@@ -153,12 +153,3 @@ export const PROVIDER_BRAND_ORDER: ProviderBrand[] = [
|
||||
'openaiCompatibility',
|
||||
'ampcode',
|
||||
];
|
||||
|
||||
export const PROVIDER_PATHS: Record<ProviderBrand, string> = {
|
||||
gemini: '/ai-providers/gemini',
|
||||
codex: '/ai-providers/codex',
|
||||
claude: '/ai-providers/claude',
|
||||
vertex: '/ai-providers/vertex',
|
||||
openaiCompatibility: '/ai-providers/openai',
|
||||
ampcode: '/ai-providers/ampcode',
|
||||
};
|
||||
|
||||
@@ -64,23 +64,14 @@ export interface ProviderResource {
|
||||
raw: unknown;
|
||||
}
|
||||
|
||||
export interface ProviderGroupIssue {
|
||||
status?: string;
|
||||
message: string;
|
||||
}
|
||||
|
||||
export interface ProviderGroup {
|
||||
id: ProviderBrand;
|
||||
resources: ProviderResource[];
|
||||
issue: ProviderGroupIssue | null;
|
||||
/** 描述路径,例如 /ai-providers/gemini,用于 Sheet description */
|
||||
path: string;
|
||||
}
|
||||
|
||||
export interface ProviderSnapshot {
|
||||
fetchedAt: string;
|
||||
groups: ProviderGroup[];
|
||||
issues: Array<{ brand: ProviderBrand; message: string }>;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -19,7 +19,7 @@ import {
|
||||
openaiToResource,
|
||||
vertexToResource,
|
||||
} from './adapters';
|
||||
import { PROVIDER_BRAND_ORDER, PROVIDER_PATHS } from './descriptors';
|
||||
import { PROVIDER_BRAND_ORDER } from './descriptors';
|
||||
import type {
|
||||
ProviderBrand,
|
||||
ProviderEntryFormInput,
|
||||
@@ -266,14 +266,11 @@ export function useProviderWorkbench(): UseProviderWorkbenchResult {
|
||||
return {
|
||||
id: brand,
|
||||
resources,
|
||||
issue: null,
|
||||
path: PROVIDER_PATHS[brand],
|
||||
};
|
||||
});
|
||||
return {
|
||||
fetchedAt,
|
||||
groups,
|
||||
issues: [],
|
||||
};
|
||||
}, [config, fetchedAt]);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user