mirror of
https://github.com/YMFE/yapi.git
synced 2025-02-23 13:59:28 +08:00
opti: 增加过滤接口集功能
This commit is contained in:
parent
b885140cbe
commit
1491ae13ea
@ -212,6 +212,8 @@ export default class InterfaceColMenu extends Component {
|
||||
)
|
||||
};
|
||||
|
||||
let isFilterCat = false;
|
||||
|
||||
return (
|
||||
<div>
|
||||
<div className="interface-filter">
|
||||
@ -229,7 +231,18 @@ export default class InterfaceColMenu extends Component {
|
||||
onExpand={this.onExpand}
|
||||
>
|
||||
{
|
||||
this.props.interfaceColList.filter(col => col.name.indexOf(filterValue) !== -1).map((col) => (
|
||||
this.props.interfaceColList.filter(col =>{
|
||||
if(col.name.indexOf(filterValue) !== -1){
|
||||
isFilterCat = true;
|
||||
return true;
|
||||
}
|
||||
isFilterCat = false;
|
||||
|
||||
let caseList = col.caseList.filter(item=>{
|
||||
return item.casename.indexOf(filterValue) !== -1
|
||||
})
|
||||
return caseList.length > 0;
|
||||
}).map((col) => (
|
||||
<TreeNode
|
||||
key={'col_' + col._id}
|
||||
title={
|
||||
@ -242,7 +255,12 @@ export default class InterfaceColMenu extends Component {
|
||||
}
|
||||
>
|
||||
{
|
||||
col.caseList && col.caseList.map((interfaceCase) => (
|
||||
col.caseList && col.caseList.filter((item)=>{
|
||||
if(isFilterCat){
|
||||
return true;
|
||||
}
|
||||
return item.casename.indexOf(filterValue) !== -1
|
||||
}).map((interfaceCase) => (
|
||||
<TreeNode
|
||||
style={{width: '100%'}}
|
||||
key={'case_' + interfaceCase._id}
|
||||
|
@ -551,7 +551,7 @@ class InterfaceEditForm extends Component {
|
||||
})}
|
||||
</Select>
|
||||
|
||||
<Tooltip title="接口基本路径,可在项目配置里修改" style={{ display: this.props.basepath == '' ? 'block' : 'none' }}>
|
||||
<Tooltip title="接口基本路径,可在 项目设置->环境配置 里修改" style={{ display: this.props.basepath == '' ? 'block' : 'none' }}>
|
||||
<Input disabled value={this.props.basepath} readOnly onChange={() => { }} style={{ width: '25%' }} />
|
||||
</Tooltip>
|
||||
{getFieldDecorator('path', {
|
||||
@ -560,7 +560,9 @@ class InterfaceEditForm extends Component {
|
||||
required: true, message: '请输入接口路径!'
|
||||
}]
|
||||
})(
|
||||
<Input onChange={this.handlePath} placeholder="/path" style={{ width: '60%' }} />
|
||||
<Tooltip title="支持类似 ?controller=xxx&action=xxx 的QueryRouter, 默认接口Query参数请定义到 Request设置 -> Query ">
|
||||
<Input onChange={this.handlePath} placeholder="/path" style={{ width: '60%' }} />
|
||||
</Tooltip>
|
||||
)}
|
||||
</InputGroup>
|
||||
<Row className="interface-edit-item">
|
||||
|
Loading…
Reference in New Issue
Block a user