58 lines
1.1 KiB
TypeScript
58 lines
1.1 KiB
TypeScript
import {
|
|
CodeOutlined,
|
|
JavaOutlined,
|
|
NodeIndexOutlined,
|
|
PythonOutlined,
|
|
} from '@ant-design/icons';
|
|
import { DevelopmentLanguageTypeEnum } from '@/pages/Deploy/Application/List/types';
|
|
|
|
interface LanguageIconConfig {
|
|
icon: React.ReactNode;
|
|
color: string;
|
|
label: string;
|
|
}
|
|
|
|
/**
|
|
* 语言图标配置映射(与 /deploy/applications 保持一致)
|
|
*/
|
|
export const LANGUAGE_ICONS: Record<DevelopmentLanguageTypeEnum, LanguageIconConfig> = {
|
|
JAVA: {
|
|
icon: <JavaOutlined />,
|
|
color: '#E76F00',
|
|
label: 'Java'
|
|
},
|
|
NODE_JS: {
|
|
icon: <NodeIndexOutlined />,
|
|
color: '#339933',
|
|
label: 'NodeJS'
|
|
},
|
|
PYTHON: {
|
|
icon: <PythonOutlined />,
|
|
color: '#3776AB',
|
|
label: 'Python'
|
|
},
|
|
GO: {
|
|
icon: <CodeOutlined />,
|
|
color: '#00ADD8',
|
|
label: 'Go'
|
|
}
|
|
};
|
|
|
|
/**
|
|
* 获取语言图标配置
|
|
*/
|
|
export const getLanguageIcon = (language?: DevelopmentLanguageTypeEnum): LanguageIconConfig => {
|
|
if (!language) {
|
|
return {
|
|
icon: <CodeOutlined />,
|
|
color: '#666666',
|
|
label: '未知'
|
|
};
|
|
}
|
|
return LANGUAGE_ICONS[language] || {
|
|
icon: <CodeOutlined />,
|
|
color: '#666666',
|
|
label: language
|
|
};
|
|
};
|