fix: vendor options display by locales
This commit is contained in:
@@ -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
|
||||
})),
|
||||
[]
|
||||
|
||||
@@ -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) => {
|
||||
|
||||
Reference in New Issue
Block a user