Browse Source

fix: 全局参数没有时,流水线编辑时不显示

pull/117/head
cp3hnu 1 year ago
parent
commit
eda18ad3f6
3 changed files with 31 additions and 25 deletions
  1. +2
    -2
      react-ui/src/pages/ModelDeployment/Create/index.tsx
  2. +15
    -11
      react-ui/src/pages/Pipeline/Info/utils.tsx
  3. +14
    -12
      react-ui/src/pages/Pipeline/components/PropsLabel/index.tsx

+ 2
- 2
react-ui/src/pages/ModelDeployment/Create/index.tsx View File

@@ -278,8 +278,8 @@ function ModelDeploymentCreate() {
message: '请输入副本数量',
},
{
pattern: /^-?\d+(\.\d+)?$/,
message: '副本数量必须是数',
pattern: /^[1-9]\d*$/,
message: '副本数量必须是正整数',
},
]}
>


+ 15
- 11
react-ui/src/pages/Pipeline/Info/utils.tsx View File

@@ -55,17 +55,21 @@ export function createMenuItems(
};
});

return [
{
key: 'global',
label: '全局参数',
children: params.map((item) => ({
key: item.param_name,
label: item.param_name,
})),
},
...nodes,
];
if (params.length > 0) {
return [
{
key: 'global',
label: '全局参数',
children: params.map((item) => ({
key: item.param_name,
label: item.param_name,
})),
},
...nodes,
];
} else {
return [...nodes];
}
}

export function getInParameterComponent(


+ 14
- 12
react-ui/src/pages/Pipeline/components/PropsLabel/index.tsx View File

@@ -23,18 +23,20 @@ function PropsLabel({ title, menuItems, onClick }: PropsLabelProps) {
return (
<div className={styles['props-label']}>
<div>{title}</div>
<Dropdown
menu={{
items: menuItems,
onClick: handleItemClick,
triggerSubMenuAction: 'hover',
}}
trigger={['click']}
placement="topRight"
arrow
>
<a onClick={(e) => e.preventDefault()}>参数</a>
</Dropdown>
{menuItems && menuItems.length > 0 && (
<Dropdown
menu={{
items: menuItems,
onClick: handleItemClick,
triggerSubMenuAction: 'hover',
}}
trigger={['click']}
placement="topRight"
arrow
>
<a onClick={(e) => e.preventDefault()}>参数</a>
</Dropdown>
)}
</div>
);
}


Loading…
Cancel
Save