fix: vendor options display by locales
This commit is contained in:
@@ -4,7 +4,7 @@ export default {
|
||||
'vendor.hygon': 'Hygon',
|
||||
'vendor.moorthreads': 'Moore Threads',
|
||||
'vendor.iluvatar': 'Iluvatar',
|
||||
'vendor.metax': 'Metax',
|
||||
'vendor.metax': 'MetaX',
|
||||
'vendor.cambricon': 'Cambricon',
|
||||
'vendor.thead': 'T-Head PPU'
|
||||
};
|
||||
|
||||
@@ -4,7 +4,7 @@ export default {
|
||||
'vendor.hygon': 'Hygon',
|
||||
'vendor.moorthreads': 'Moore Threads',
|
||||
'vendor.iluvatar': 'Iluvatar',
|
||||
'vendor.metax': 'Metax',
|
||||
'vendor.metax': 'MetaX',
|
||||
'vendor.cambricon': 'Cambricon',
|
||||
'vendor.thead': 'T-Head PPU'
|
||||
};
|
||||
|
||||
@@ -4,7 +4,7 @@ export default {
|
||||
'vendor.hygon': 'Hygon',
|
||||
'vendor.moorthreads': 'Moore Threads',
|
||||
'vendor.iluvatar': 'Iluvatar',
|
||||
'vendor.metax': 'Metax',
|
||||
'vendor.metax': 'MetaX',
|
||||
'vendor.cambricon': 'Cambricon',
|
||||
'vendor.thead': 'T-Head PPU'
|
||||
};
|
||||
|
||||
@@ -4,7 +4,7 @@ export default {
|
||||
'vendor.hygon': 'Hygon',
|
||||
'vendor.moorthreads': 'Moore Threads',
|
||||
'vendor.iluvatar': 'Iluvatar',
|
||||
'vendor.metax': 'Metax',
|
||||
'vendor.metax': 'MetaX',
|
||||
'vendor.cambricon': 'Cambricon',
|
||||
'vendor.thead': 'T-Head PPU'
|
||||
};
|
||||
|
||||
@@ -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) => {
|
||||
|
||||
@@ -36,6 +36,14 @@ export const manfacturerValueMap = {
|
||||
THEAD: 'thead'
|
||||
};
|
||||
|
||||
// 'vendor.ascend': '昇腾',
|
||||
// 'vendor.hygon': '海光',
|
||||
// 'vendor.moorthreads': '摩尔线程',
|
||||
// 'vendor.iluvatar': '天数智芯',
|
||||
// 'vendor.metax': '沐曦',
|
||||
// 'vendor.cambricon': '寒武纪',
|
||||
// 'vendor.thead': '平头哥 PPU'
|
||||
|
||||
export const GPUsConfigs: Record<
|
||||
string,
|
||||
{
|
||||
@@ -44,6 +52,10 @@ export const GPUsConfigs: Record<
|
||||
runtime: string;
|
||||
driver: string;
|
||||
gpuVendor?: string;
|
||||
locales: {
|
||||
label: string;
|
||||
locale?: boolean;
|
||||
};
|
||||
}
|
||||
> = {
|
||||
[GPUDriverMap.NVIDIA]: {
|
||||
@@ -51,63 +63,99 @@ export const GPUsConfigs: Record<
|
||||
value: GPUDriverMap.NVIDIA,
|
||||
runtime: 'nvidia',
|
||||
driver: 'nvidia-smi',
|
||||
gpuVendor: 'nvidia'
|
||||
gpuVendor: 'nvidia',
|
||||
locales: {
|
||||
label: 'NVIDIA',
|
||||
locale: false
|
||||
}
|
||||
},
|
||||
[GPUDriverMap.AMD]: {
|
||||
label: 'AMD',
|
||||
value: GPUDriverMap.AMD,
|
||||
runtime: 'amd',
|
||||
driver: 'amd-smi static',
|
||||
gpuVendor: 'amd'
|
||||
gpuVendor: 'amd',
|
||||
locales: {
|
||||
label: 'AMD',
|
||||
locale: false
|
||||
}
|
||||
},
|
||||
[GPUDriverMap.ASCEND]: {
|
||||
label: 'Ascend',
|
||||
value: GPUDriverMap.ASCEND,
|
||||
runtime: 'ascend',
|
||||
driver: 'npu-smi info',
|
||||
gpuVendor: 'ascend'
|
||||
gpuVendor: 'ascend',
|
||||
locales: {
|
||||
label: 'vendor.ascend',
|
||||
locale: true
|
||||
}
|
||||
},
|
||||
[GPUDriverMap.HYGON]: {
|
||||
label: 'Hygon',
|
||||
value: GPUDriverMap.HYGON,
|
||||
runtime: 'hygon', // TODO: confirm runtime name
|
||||
driver: 'hy-smi',
|
||||
gpuVendor: 'hygon'
|
||||
gpuVendor: 'hygon',
|
||||
locales: {
|
||||
label: 'vendor.hygon',
|
||||
locale: true
|
||||
}
|
||||
},
|
||||
[GPUDriverMap.MOORE_THREADS]: {
|
||||
label: 'Moore Threads',
|
||||
value: GPUDriverMap.MOORE_THREADS,
|
||||
runtime: 'mthreads',
|
||||
driver: 'mthreads-gmi',
|
||||
gpuVendor: 'mthreads'
|
||||
gpuVendor: 'mthreads',
|
||||
locales: {
|
||||
label: 'vendor.moorthreads',
|
||||
locale: true
|
||||
}
|
||||
},
|
||||
[GPUDriverMap.ILUVATAR]: {
|
||||
label: 'Iluvatar',
|
||||
value: GPUDriverMap.ILUVATAR,
|
||||
runtime: 'iluvatar',
|
||||
driver: 'ixsmi',
|
||||
gpuVendor: 'iluvatar'
|
||||
gpuVendor: 'iluvatar',
|
||||
locales: {
|
||||
label: 'vendor.iluvatar',
|
||||
locale: true
|
||||
}
|
||||
},
|
||||
[GPUDriverMap.CAMBRICON]: {
|
||||
label: 'Cambricon',
|
||||
value: GPUDriverMap.CAMBRICON,
|
||||
runtime: 'cambricon',
|
||||
driver: 'cnmon info',
|
||||
gpuVendor: 'cambricon'
|
||||
gpuVendor: 'cambricon',
|
||||
locales: {
|
||||
label: 'vendor.cambricon',
|
||||
locale: true
|
||||
}
|
||||
},
|
||||
[GPUDriverMap.METAX]: {
|
||||
label: 'Metax',
|
||||
value: GPUDriverMap.METAX,
|
||||
runtime: 'metax',
|
||||
driver: 'mx-smi',
|
||||
gpuVendor: 'metax'
|
||||
gpuVendor: 'metax',
|
||||
locales: {
|
||||
label: 'vendor.metax',
|
||||
locale: true
|
||||
}
|
||||
},
|
||||
[GPUDriverMap.THEAD]: {
|
||||
label: 'T-Head PPU',
|
||||
value: GPUDriverMap.THEAD,
|
||||
runtime: 'thead', // TODO: confirm runtime name
|
||||
driver: 'ppu-smi',
|
||||
gpuVendor: 'thead'
|
||||
gpuVendor: 'thead',
|
||||
locales: {
|
||||
label: 'vendor.thead',
|
||||
locale: true
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user