fix: vendor options display by locales

This commit is contained in:
jialin
2026-06-03 18:28:31 +08:00
committed by jialin
parent 2bb04a419d
commit dc04529f5b
8 changed files with 81 additions and 26 deletions
@@ -41,16 +41,6 @@ const imageLogoMap = {
ubuntu: ubuntuLogo
} as const;
const manufacturerLabelMap: Record<string, string> = Object.values(
GPUsConfigs
).reduce(
(acc, item) => {
if (item.gpuVendor) acc[item.gpuVendor] = item.label;
return acc;
},
{ cpu: 'CPU' } as Record<string, string>
);
const matchImageLogo = (
image: string | undefined
): { logo: string; type: string } | null => {
@@ -145,6 +135,19 @@ interface TemplateCardProps {
const TemplateCardItem: React.FC<TemplateCardProps> = ({ data, onSelect }) => {
const intl = useIntl();
const manufacturerLabelMap: Record<string, string> = Object.values(
GPUsConfigs
).reduce(
(acc, item) => {
if (item.gpuVendor)
acc[item.gpuVendor] = item.locales.locale
? intl.formatMessage({ id: item.locales.label })
: item.locales.label;
return acc;
},
{ cpu: 'CPU' } as Record<string, string>
);
const handleOnSelect = (item: any) => {
onSelect?.({ action: item.key, data });
};
@@ -47,7 +47,9 @@ const Basic: React.FC<BasicProps> = ({
const manufacturerOptions = useMemo(
() =>
Object.values(GPUsConfigs).map((item) => ({
label: item.label,
label: item.locales.locale
? intl.formatMessage({ id: item.locales.label })
: item.locales.label,
value: item.gpuVendor
})),
[]
+4 -2
View File
@@ -60,12 +60,14 @@ const GPUServiceTemplates: React.FC = () => {
const manufacturerOptions = useMemo(
() => [
...Object.values(GPUsConfigs).map((item) => ({
label: item.label,
label: item.locales.locale
? intl.formatMessage({ id: item.locales.label })
: item.locales.label,
value: item.gpuVendor as string
})),
{ label: 'CPU', value: 'cpu' }
],
[]
[intl]
);
const handleFilterByManufacturer = (value: string) => {