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.1 kB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /*
  2. * @Author: 赵伟
  3. * @Date: 2024-04-09 15:59:14
  4. * @Description: 查看实验使用的参数
  5. */
  6. import parameterImg from '@/assets/img/modal-parameter.png';
  7. import KFEmpty, { EmptyType } from '@/components/KFEmpty';
  8. import KFModal from '@/components/KFModal';
  9. import { type PipelineGlobalParam } from '@/types';
  10. import { Form } from 'antd';
  11. import { getParamComponent, getParamLabel } from '../AddExperimentModal';
  12. import styles from './index.less';
  13. type ParamsModalProps = {
  14. open: boolean;
  15. onCancel: () => void;
  16. globalParam?: PipelineGlobalParam[] | null;
  17. };
  18. function ParamsModal({ open, onCancel, globalParam = [] }: ParamsModalProps) {
  19. return (
  20. <KFModal
  21. title="执行参数"
  22. image={parameterImg}
  23. open={open}
  24. onOk={onCancel}
  25. onCancel={onCancel}
  26. cancelButtonProps={{ style: { display: 'none' } }}
  27. width={825}
  28. >
  29. {Array.isArray(globalParam) && globalParam.length > 0 ? (
  30. <div className={styles['params-container']}>
  31. <Form
  32. name="view_params_form"
  33. labelCol={{ span: 6 }}
  34. wrapperCol={{ span: 18 }}
  35. initialValues={{ global_param: globalParam }}
  36. labelAlign="left"
  37. disabled
  38. >
  39. <Form.List name="global_param">
  40. {(fields) =>
  41. fields.map(({ key, name, ...restField }) => (
  42. <Form.Item
  43. {...restField}
  44. key={key}
  45. name={[name, 'param_value']}
  46. label={getParamLabel(globalParam[name])}
  47. >
  48. {getParamComponent(globalParam[name]['param_type'])}
  49. </Form.Item>
  50. ))
  51. }
  52. </Form.List>
  53. </Form>
  54. </div>
  55. ) : (
  56. <KFEmpty
  57. className={styles['params-empty']}
  58. type={EmptyType.NoData}
  59. title="暂无数据"
  60. content="该流水线没有设置全局参数"
  61. hasFooter={false}
  62. />
  63. )}
  64. </KFModal>
  65. );
  66. }
  67. export default ParamsModal;