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 2.0 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. import ConfigInfo from '@/components/ConfigInfo';
  2. import RunDuration from '@/components/RunDuration';
  3. import { ExperimentStatus } from '@/enums';
  4. import { experimentStatusInfo } from '@/pages/Experiment/status';
  5. import { type NodeStatus } from '@/types';
  6. import { getExperimentInstanceStatus } from '@/utils/experiment';
  7. import { formatDate } from '@/utils/format';
  8. import { Flex } from 'antd';
  9. import { useMemo } from 'react';
  10. type ExperimentRunBasicProps = {
  11. workflowStatus?: NodeStatus;
  12. instanceStatus?: ExperimentStatus;
  13. };
  14. function ExperimentRunBasic({ workflowStatus, instanceStatus }: ExperimentRunBasicProps) {
  15. const instanceDatas = useMemo(() => {
  16. const status = getExperimentInstanceStatus(instanceStatus as ExperimentStatus, workflowStatus);
  17. const statusInfo = experimentStatusInfo[status];
  18. return [
  19. {
  20. label: '启动时间',
  21. value: formatDate(workflowStatus?.startedAt),
  22. },
  23. {
  24. label: '执行时长',
  25. value: (
  26. <RunDuration
  27. createTime={workflowStatus?.startedAt}
  28. finishTime={workflowStatus?.finishedAt}
  29. />
  30. ),
  31. },
  32. {
  33. label: '状态',
  34. value: statusInfo ? (
  35. <Flex align="center">
  36. <img
  37. style={{ width: '17px', marginRight: '7px' }}
  38. src={statusInfo.icon}
  39. draggable={false}
  40. alt=""
  41. />
  42. <div
  43. style={{
  44. color: statusInfo.color,
  45. fontSize: '15px',
  46. lineHeight: 1.6,
  47. }}
  48. >
  49. {statusInfo.label}
  50. </div>
  51. </Flex>
  52. ) : (
  53. '--'
  54. ),
  55. },
  56. ];
  57. }, [workflowStatus, instanceStatus]);
  58. return (
  59. <ConfigInfo
  60. title="运行信息"
  61. datas={instanceDatas}
  62. labelWidth={70}
  63. style={{ marginBottom: '20px' }}
  64. />
  65. );
  66. }
  67. export default ExperimentRunBasic;