/*
 * @Author: 赵伟
 * @Date: 2024-04-09 15:59:14
 * @Description: 查看实验使用的参数
 */
import parameterImg from '@/assets/img/modal-parameter.png';
import KFModal from '@/components/KFModal';
import { type PipelineGlobalParam } from '@/types';
import { getParamType } from '../AddExperimentModal';
import styles from './index.less';

type ParamsModalProps = {
  open: boolean;
  onCancel: () => void;
  globalParam?: PipelineGlobalParam[] | null;
};

function ParamsModal({ open, onCancel, globalParam = [] }: ParamsModalProps) {
  return (
    <KFModal
      title="执行参数"
      image={parameterImg}
      open={open}
      onOk={onCancel}
      onCancel={onCancel}
      cancelButtonProps={{ style: { display: 'none' } }}
      width={825}
    >
      <div className={styles.params_container}>
        {globalParam?.map((item) => (
          <div key={item.param_name} className={styles.params_container_line}>
            <span className={styles.params_container_line_label}>{getParamType(item)}</span>
            <span className={styles.params_container_line_value}>{item.param_value}</span>
          </div>
        ))}
      </div>
    </KFModal>
  );
}

export default ParamsModal;
