You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

index.tsx 1.2 kB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /*
  2. * @Author: 赵伟
  3. * @Date: 2024-04-18 18:35:41
  4. * @Description: 模型部署状态
  5. */
  6. import { ServiceRunStatus } from '@/enums';
  7. import styles from './index.less';
  8. export type ServiceRunStatusInfo = {
  9. text: string;
  10. classname: string;
  11. };
  12. export const statusInfo: Record<ServiceRunStatus, ServiceRunStatusInfo> = {
  13. [ServiceRunStatus.Init]: {
  14. text: '启动中',
  15. classname: styles['model-deployment-status-cell'],
  16. },
  17. [ServiceRunStatus.Running]: {
  18. classname: styles['model-deployment-status-cell--running'],
  19. text: '运行中',
  20. },
  21. [ServiceRunStatus.Stopped]: {
  22. classname: styles['model-deployment-status-cell--stopped'],
  23. text: '已停止',
  24. },
  25. [ServiceRunStatus.Failed]: {
  26. classname: styles['model-deployment-status-cell--error'],
  27. text: '失败',
  28. },
  29. [ServiceRunStatus.Pending]: {
  30. classname: styles['model-deployment-status-cell--pending'],
  31. text: '挂起中',
  32. },
  33. };
  34. function ServiceRunStatusCell(status?: ServiceRunStatus | null) {
  35. if (status === null || status === undefined || !statusInfo[status]) {
  36. return <span>--</span>;
  37. }
  38. return <span className={statusInfo[status].classname}>{statusInfo[status].text}</span>;
  39. }
  40. export default ServiceRunStatusCell;