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.

types.ts 2.7 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. /*
  2. * @Author: 赵伟
  3. * @Date: 2024-04-08 09:54:39
  4. * @Description: 定义全局类型,比如无关联的页面都需要要的类型
  5. */
  6. import { ExperimentStatus, TensorBoardStatus } from '@/enums';
  7. import type { Settings as LayoutSettings } from '@ant-design/pro-components';
  8. // 全局初始状态类型
  9. export type GlobalInitialState = {
  10. settings?: Partial<LayoutSettings>;
  11. currentUser?: API.CurrentUser;
  12. fetchUserInfo?: () => Promise<API.CurrentUser | undefined>;
  13. loading?: boolean;
  14. collapsed?: boolean;
  15. };
  16. // 流水线全局参数
  17. export type PipelineGlobalParam = {
  18. param_name: string;
  19. description: string;
  20. param_type: number;
  21. param_value: number | string | boolean;
  22. is_sensitive: number;
  23. };
  24. // 实验实例
  25. export type ExperimentInstance = {
  26. id: number;
  27. experiment_id: number;
  28. workflow_id: number;
  29. create_time: string;
  30. finish_time: string;
  31. update_time: string;
  32. status: string;
  33. argo_ins_name: string;
  34. argo_ins_ns: string;
  35. nodes_result: {
  36. [key: string]: any;
  37. };
  38. nodes_status: string;
  39. global_param: PipelineGlobalParam[];
  40. tensorBoardStatus?: TensorBoardStatus;
  41. tensorboardUrl?: string;
  42. };
  43. // 流水线节点
  44. export type PipelineNodeModel = {
  45. id: string;
  46. experimentStatus: ExperimentStatus;
  47. label: string;
  48. experimentStartTime: string;
  49. experimentEndTime?: string | null;
  50. control_strategy: string;
  51. in_parameters: string;
  52. out_parameters: string;
  53. component_label: string;
  54. icon_path: string;
  55. workflowId?: string;
  56. };
  57. // 流水线节点模型数据
  58. export type PipelineNodeModelParameter = {
  59. type: string;
  60. item_type: string;
  61. label: string;
  62. value: any;
  63. require?: number;
  64. placeholder?: string;
  65. describe?: string;
  66. fromSelect?: boolean;
  67. showValue?: any;
  68. editable?: number;
  69. activeTab?: string; // ResourceSelectorModal tab
  70. expandedKeys?: string[]; // ResourceSelectorModal expandedKeys
  71. checkedKeys?: string[]; // ResourceSelectorModal checkedKeys
  72. };
  73. // 修改属性类型
  74. export type ChangePropertyType<T, K extends keyof T, NewType> = Omit<T, K> & { [P in K]: NewType };
  75. // export type PascalCaseType<T> = {
  76. // [K in keyof T as `${Capitalize<string & K>}`]: T[K];
  77. // }
  78. // 序列化后的流水线节点
  79. export type PipelineNodeModelSerialize = Omit<
  80. PipelineNodeModel,
  81. 'control_strategy' | 'in_parameters' | 'out_parameters'
  82. > & {
  83. control_strategy: Record<string, PipelineNodeModelParameter>;
  84. in_parameters: Record<string, PipelineNodeModelParameter>;
  85. out_parameters: Record<string, PipelineNodeModelParameter>;
  86. };
  87. // 资源规格
  88. export type ComputingResource = {
  89. id: number;
  90. computing_resource: string;
  91. description: string;
  92. standard: string;
  93. create_by: string;
  94. };