fix: vendor options display by locales
This commit is contained in:
@@ -4,7 +4,7 @@ export default {
|
|||||||
'vendor.hygon': 'Hygon',
|
'vendor.hygon': 'Hygon',
|
||||||
'vendor.moorthreads': 'Moore Threads',
|
'vendor.moorthreads': 'Moore Threads',
|
||||||
'vendor.iluvatar': 'Iluvatar',
|
'vendor.iluvatar': 'Iluvatar',
|
||||||
'vendor.metax': 'Metax',
|
'vendor.metax': 'MetaX',
|
||||||
'vendor.cambricon': 'Cambricon',
|
'vendor.cambricon': 'Cambricon',
|
||||||
'vendor.thead': 'T-Head PPU'
|
'vendor.thead': 'T-Head PPU'
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ export default {
|
|||||||
'vendor.hygon': 'Hygon',
|
'vendor.hygon': 'Hygon',
|
||||||
'vendor.moorthreads': 'Moore Threads',
|
'vendor.moorthreads': 'Moore Threads',
|
||||||
'vendor.iluvatar': 'Iluvatar',
|
'vendor.iluvatar': 'Iluvatar',
|
||||||
'vendor.metax': 'Metax',
|
'vendor.metax': 'MetaX',
|
||||||
'vendor.cambricon': 'Cambricon',
|
'vendor.cambricon': 'Cambricon',
|
||||||
'vendor.thead': 'T-Head PPU'
|
'vendor.thead': 'T-Head PPU'
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ export default {
|
|||||||
'vendor.hygon': 'Hygon',
|
'vendor.hygon': 'Hygon',
|
||||||
'vendor.moorthreads': 'Moore Threads',
|
'vendor.moorthreads': 'Moore Threads',
|
||||||
'vendor.iluvatar': 'Iluvatar',
|
'vendor.iluvatar': 'Iluvatar',
|
||||||
'vendor.metax': 'Metax',
|
'vendor.metax': 'MetaX',
|
||||||
'vendor.cambricon': 'Cambricon',
|
'vendor.cambricon': 'Cambricon',
|
||||||
'vendor.thead': 'T-Head PPU'
|
'vendor.thead': 'T-Head PPU'
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ export default {
|
|||||||
'vendor.hygon': 'Hygon',
|
'vendor.hygon': 'Hygon',
|
||||||
'vendor.moorthreads': 'Moore Threads',
|
'vendor.moorthreads': 'Moore Threads',
|
||||||
'vendor.iluvatar': 'Iluvatar',
|
'vendor.iluvatar': 'Iluvatar',
|
||||||
'vendor.metax': 'Metax',
|
'vendor.metax': 'MetaX',
|
||||||
'vendor.cambricon': 'Cambricon',
|
'vendor.cambricon': 'Cambricon',
|
||||||
'vendor.thead': 'T-Head PPU'
|
'vendor.thead': 'T-Head PPU'
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -41,16 +41,6 @@ const imageLogoMap = {
|
|||||||
ubuntu: ubuntuLogo
|
ubuntu: ubuntuLogo
|
||||||
} as const;
|
} 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 = (
|
const matchImageLogo = (
|
||||||
image: string | undefined
|
image: string | undefined
|
||||||
): { logo: string; type: string } | null => {
|
): { logo: string; type: string } | null => {
|
||||||
@@ -145,6 +135,19 @@ interface TemplateCardProps {
|
|||||||
const TemplateCardItem: React.FC<TemplateCardProps> = ({ data, onSelect }) => {
|
const TemplateCardItem: React.FC<TemplateCardProps> = ({ data, onSelect }) => {
|
||||||
const intl = useIntl();
|
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) => {
|
const handleOnSelect = (item: any) => {
|
||||||
onSelect?.({ action: item.key, data });
|
onSelect?.({ action: item.key, data });
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -47,7 +47,9 @@ const Basic: React.FC<BasicProps> = ({
|
|||||||
const manufacturerOptions = useMemo(
|
const manufacturerOptions = useMemo(
|
||||||
() =>
|
() =>
|
||||||
Object.values(GPUsConfigs).map((item) => ({
|
Object.values(GPUsConfigs).map((item) => ({
|
||||||
label: item.label,
|
label: item.locales.locale
|
||||||
|
? intl.formatMessage({ id: item.locales.label })
|
||||||
|
: item.locales.label,
|
||||||
value: item.gpuVendor
|
value: item.gpuVendor
|
||||||
})),
|
})),
|
||||||
[]
|
[]
|
||||||
|
|||||||
@@ -60,12 +60,14 @@ const GPUServiceTemplates: React.FC = () => {
|
|||||||
const manufacturerOptions = useMemo(
|
const manufacturerOptions = useMemo(
|
||||||
() => [
|
() => [
|
||||||
...Object.values(GPUsConfigs).map((item) => ({
|
...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
|
value: item.gpuVendor as string
|
||||||
})),
|
})),
|
||||||
{ label: 'CPU', value: 'cpu' }
|
{ label: 'CPU', value: 'cpu' }
|
||||||
],
|
],
|
||||||
[]
|
[intl]
|
||||||
);
|
);
|
||||||
|
|
||||||
const handleFilterByManufacturer = (value: string) => {
|
const handleFilterByManufacturer = (value: string) => {
|
||||||
|
|||||||
@@ -36,6 +36,14 @@ export const manfacturerValueMap = {
|
|||||||
THEAD: 'thead'
|
THEAD: 'thead'
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// 'vendor.ascend': '昇腾',
|
||||||
|
// 'vendor.hygon': '海光',
|
||||||
|
// 'vendor.moorthreads': '摩尔线程',
|
||||||
|
// 'vendor.iluvatar': '天数智芯',
|
||||||
|
// 'vendor.metax': '沐曦',
|
||||||
|
// 'vendor.cambricon': '寒武纪',
|
||||||
|
// 'vendor.thead': '平头哥 PPU'
|
||||||
|
|
||||||
export const GPUsConfigs: Record<
|
export const GPUsConfigs: Record<
|
||||||
string,
|
string,
|
||||||
{
|
{
|
||||||
@@ -44,6 +52,10 @@ export const GPUsConfigs: Record<
|
|||||||
runtime: string;
|
runtime: string;
|
||||||
driver: string;
|
driver: string;
|
||||||
gpuVendor?: string;
|
gpuVendor?: string;
|
||||||
|
locales: {
|
||||||
|
label: string;
|
||||||
|
locale?: boolean;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
> = {
|
> = {
|
||||||
[GPUDriverMap.NVIDIA]: {
|
[GPUDriverMap.NVIDIA]: {
|
||||||
@@ -51,63 +63,99 @@ export const GPUsConfigs: Record<
|
|||||||
value: GPUDriverMap.NVIDIA,
|
value: GPUDriverMap.NVIDIA,
|
||||||
runtime: 'nvidia',
|
runtime: 'nvidia',
|
||||||
driver: 'nvidia-smi',
|
driver: 'nvidia-smi',
|
||||||
gpuVendor: 'nvidia'
|
gpuVendor: 'nvidia',
|
||||||
|
locales: {
|
||||||
|
label: 'NVIDIA',
|
||||||
|
locale: false
|
||||||
|
}
|
||||||
},
|
},
|
||||||
[GPUDriverMap.AMD]: {
|
[GPUDriverMap.AMD]: {
|
||||||
label: 'AMD',
|
label: 'AMD',
|
||||||
value: GPUDriverMap.AMD,
|
value: GPUDriverMap.AMD,
|
||||||
runtime: 'amd',
|
runtime: 'amd',
|
||||||
driver: 'amd-smi static',
|
driver: 'amd-smi static',
|
||||||
gpuVendor: 'amd'
|
gpuVendor: 'amd',
|
||||||
|
locales: {
|
||||||
|
label: 'AMD',
|
||||||
|
locale: false
|
||||||
|
}
|
||||||
},
|
},
|
||||||
[GPUDriverMap.ASCEND]: {
|
[GPUDriverMap.ASCEND]: {
|
||||||
label: 'Ascend',
|
label: 'Ascend',
|
||||||
value: GPUDriverMap.ASCEND,
|
value: GPUDriverMap.ASCEND,
|
||||||
runtime: 'ascend',
|
runtime: 'ascend',
|
||||||
driver: 'npu-smi info',
|
driver: 'npu-smi info',
|
||||||
gpuVendor: 'ascend'
|
gpuVendor: 'ascend',
|
||||||
|
locales: {
|
||||||
|
label: 'vendor.ascend',
|
||||||
|
locale: true
|
||||||
|
}
|
||||||
},
|
},
|
||||||
[GPUDriverMap.HYGON]: {
|
[GPUDriverMap.HYGON]: {
|
||||||
label: 'Hygon',
|
label: 'Hygon',
|
||||||
value: GPUDriverMap.HYGON,
|
value: GPUDriverMap.HYGON,
|
||||||
runtime: 'hygon', // TODO: confirm runtime name
|
runtime: 'hygon', // TODO: confirm runtime name
|
||||||
driver: 'hy-smi',
|
driver: 'hy-smi',
|
||||||
gpuVendor: 'hygon'
|
gpuVendor: 'hygon',
|
||||||
|
locales: {
|
||||||
|
label: 'vendor.hygon',
|
||||||
|
locale: true
|
||||||
|
}
|
||||||
},
|
},
|
||||||
[GPUDriverMap.MOORE_THREADS]: {
|
[GPUDriverMap.MOORE_THREADS]: {
|
||||||
label: 'Moore Threads',
|
label: 'Moore Threads',
|
||||||
value: GPUDriverMap.MOORE_THREADS,
|
value: GPUDriverMap.MOORE_THREADS,
|
||||||
runtime: 'mthreads',
|
runtime: 'mthreads',
|
||||||
driver: 'mthreads-gmi',
|
driver: 'mthreads-gmi',
|
||||||
gpuVendor: 'mthreads'
|
gpuVendor: 'mthreads',
|
||||||
|
locales: {
|
||||||
|
label: 'vendor.moorthreads',
|
||||||
|
locale: true
|
||||||
|
}
|
||||||
},
|
},
|
||||||
[GPUDriverMap.ILUVATAR]: {
|
[GPUDriverMap.ILUVATAR]: {
|
||||||
label: 'Iluvatar',
|
label: 'Iluvatar',
|
||||||
value: GPUDriverMap.ILUVATAR,
|
value: GPUDriverMap.ILUVATAR,
|
||||||
runtime: 'iluvatar',
|
runtime: 'iluvatar',
|
||||||
driver: 'ixsmi',
|
driver: 'ixsmi',
|
||||||
gpuVendor: 'iluvatar'
|
gpuVendor: 'iluvatar',
|
||||||
|
locales: {
|
||||||
|
label: 'vendor.iluvatar',
|
||||||
|
locale: true
|
||||||
|
}
|
||||||
},
|
},
|
||||||
[GPUDriverMap.CAMBRICON]: {
|
[GPUDriverMap.CAMBRICON]: {
|
||||||
label: 'Cambricon',
|
label: 'Cambricon',
|
||||||
value: GPUDriverMap.CAMBRICON,
|
value: GPUDriverMap.CAMBRICON,
|
||||||
runtime: 'cambricon',
|
runtime: 'cambricon',
|
||||||
driver: 'cnmon info',
|
driver: 'cnmon info',
|
||||||
gpuVendor: 'cambricon'
|
gpuVendor: 'cambricon',
|
||||||
|
locales: {
|
||||||
|
label: 'vendor.cambricon',
|
||||||
|
locale: true
|
||||||
|
}
|
||||||
},
|
},
|
||||||
[GPUDriverMap.METAX]: {
|
[GPUDriverMap.METAX]: {
|
||||||
label: 'Metax',
|
label: 'Metax',
|
||||||
value: GPUDriverMap.METAX,
|
value: GPUDriverMap.METAX,
|
||||||
runtime: 'metax',
|
runtime: 'metax',
|
||||||
driver: 'mx-smi',
|
driver: 'mx-smi',
|
||||||
gpuVendor: 'metax'
|
gpuVendor: 'metax',
|
||||||
|
locales: {
|
||||||
|
label: 'vendor.metax',
|
||||||
|
locale: true
|
||||||
|
}
|
||||||
},
|
},
|
||||||
[GPUDriverMap.THEAD]: {
|
[GPUDriverMap.THEAD]: {
|
||||||
label: 'T-Head PPU',
|
label: 'T-Head PPU',
|
||||||
value: GPUDriverMap.THEAD,
|
value: GPUDriverMap.THEAD,
|
||||||
runtime: 'thead', // TODO: confirm runtime name
|
runtime: 'thead', // TODO: confirm runtime name
|
||||||
driver: 'ppu-smi',
|
driver: 'ppu-smi',
|
||||||
gpuVendor: 'thead'
|
gpuVendor: 'thead',
|
||||||
|
locales: {
|
||||||
|
label: 'vendor.thead',
|
||||||
|
locale: true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user