mirror of
https://github.com/haiwen/seahub.git
synced 2025-08-09 02:47:51 +00:00
optimize-code (#5667)
This commit is contained in:
parent
a173d4fb66
commit
02c0b3dce1
@ -235,6 +235,15 @@ class OrgGroupsSearchGroups extends Component {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
handleKeyDown = (e) => {
|
||||||
|
if (e.keyCode === 13) {
|
||||||
|
const { isSubmitBtnActive } = this.state;
|
||||||
|
if (isSubmitBtnActive) {
|
||||||
|
this.getItems();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { query, isSubmitBtnActive } = this.state;
|
const { query, isSubmitBtnActive } = this.state;
|
||||||
|
|
||||||
@ -251,7 +260,7 @@ class OrgGroupsSearchGroups extends Component {
|
|||||||
<Form tag={'div'}>
|
<Form tag={'div'}>
|
||||||
<FormGroup row>
|
<FormGroup row>
|
||||||
<Col sm={5}>
|
<Col sm={5}>
|
||||||
<Input type="text" name="query" value={query} placeholder={gettext('Search groups')} onChange={this.handleInputChange} />
|
<Input type="text" name="query" value={query} placeholder={gettext('Search groups')} onChange={this.handleInputChange} onKeyDown={this.handleKeyDown} />
|
||||||
</Col>
|
</Col>
|
||||||
</FormGroup>
|
</FormGroup>
|
||||||
<FormGroup row>
|
<FormGroup row>
|
||||||
|
@ -142,6 +142,15 @@ class OrgUsersSearchUsers extends Component {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
handleKeyDown = (e) => {
|
||||||
|
if (e.keyCode === 13) {
|
||||||
|
const { isSubmitBtnActive } = this.state;
|
||||||
|
if (isSubmitBtnActive) {
|
||||||
|
this.getItems();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { query, isSubmitBtnActive } = this.state;
|
const { query, isSubmitBtnActive } = this.state;
|
||||||
|
|
||||||
@ -158,7 +167,7 @@ class OrgUsersSearchUsers extends Component {
|
|||||||
<Form tag={'div'}>
|
<Form tag={'div'}>
|
||||||
<FormGroup row>
|
<FormGroup row>
|
||||||
<Col sm={5}>
|
<Col sm={5}>
|
||||||
<Input type="text" name="query" value={query} placeholder={gettext('Search users')} onChange={this.handleInputChange} />
|
<Input type="text" name="query" value={query} placeholder={gettext('Search users')} onChange={this.handleInputChange} onKeyDown={this.handleKeyDown} />
|
||||||
</Col>
|
</Col>
|
||||||
</FormGroup>
|
</FormGroup>
|
||||||
<FormGroup row>
|
<FormGroup row>
|
||||||
|
@ -89,6 +89,15 @@ class SearchGroups extends Component {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
handleKeyDown = (e) => {
|
||||||
|
if (e.keyCode === 13) {
|
||||||
|
const { isSubmitBtnActive } = this.state;
|
||||||
|
if (isSubmitBtnActive) {
|
||||||
|
this.getGroups();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { name, isSubmitBtnActive } = this.state;
|
const { name, isSubmitBtnActive } = this.state;
|
||||||
|
|
||||||
@ -108,7 +117,7 @@ class SearchGroups extends Component {
|
|||||||
<FormGroup row>
|
<FormGroup row>
|
||||||
<Label for="name" sm={1}>{gettext('Name')}</Label>
|
<Label for="name" sm={1}>{gettext('Name')}</Label>
|
||||||
<Col sm={5}>
|
<Col sm={5}>
|
||||||
<Input type="text" name="name" id="name" value={name} onChange={this.handleNameInputChange} />
|
<Input type="text" name="name" id="name" value={name} onChange={this.handleNameInputChange} onKeyDown={this.handleKeyDown} />
|
||||||
</Col>
|
</Col>
|
||||||
</FormGroup>
|
</FormGroup>
|
||||||
<FormGroup row>
|
<FormGroup row>
|
||||||
|
@ -86,6 +86,15 @@ class SearchOrgs extends Component {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
handleKeyDown = (e) => {
|
||||||
|
if (e.keyCode === 13) {
|
||||||
|
const { isSubmitBtnActive } = this.state;
|
||||||
|
if (isSubmitBtnActive) {
|
||||||
|
this.getItems();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { query, isSubmitBtnActive } = this.state;
|
const { query, isSubmitBtnActive } = this.state;
|
||||||
return (
|
return (
|
||||||
@ -104,7 +113,7 @@ class SearchOrgs extends Component {
|
|||||||
<FormGroup row>
|
<FormGroup row>
|
||||||
<Label for="name" sm={1}>{gettext('Name')}</Label>
|
<Label for="name" sm={1}>{gettext('Name')}</Label>
|
||||||
<Col sm={5}>
|
<Col sm={5}>
|
||||||
<Input type="text" name="query" id="name" value={query} onChange={this.handleInputChange} />
|
<Input type="text" name="query" id="name" value={query} onChange={this.handleInputChange} onKeyDown={this.handleKeyDown} />
|
||||||
</Col>
|
</Col>
|
||||||
</FormGroup>
|
</FormGroup>
|
||||||
<FormGroup row>
|
<FormGroup row>
|
||||||
|
@ -78,6 +78,15 @@ class SearchRepos extends Component {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
handleKeyDown = (e) => {
|
||||||
|
if (e.keyCode === 13) {
|
||||||
|
const { isSubmitBtnActive } = this.state;
|
||||||
|
if (isSubmitBtnActive) {
|
||||||
|
this.searchRepos();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { name, isSubmitBtnActive } = this.state;
|
const { name, isSubmitBtnActive } = this.state;
|
||||||
return (
|
return (
|
||||||
@ -96,7 +105,7 @@ class SearchRepos extends Component {
|
|||||||
<FormGroup row>
|
<FormGroup row>
|
||||||
<Label for="name" sm={1}>{gettext('Name or ID')}</Label>
|
<Label for="name" sm={1}>{gettext('Name or ID')}</Label>
|
||||||
<Col sm={5}>
|
<Col sm={5}>
|
||||||
<Input type="text" name="name" id="name" value={name} onChange={this.handleNameInputChange} />
|
<Input type="text" name="name" id="name" value={name} onChange={this.handleNameInputChange} onKeyDown={this.handleKeyDown} />
|
||||||
</Col>
|
</Col>
|
||||||
</FormGroup>
|
</FormGroup>
|
||||||
<FormGroup row>
|
<FormGroup row>
|
||||||
|
@ -270,6 +270,15 @@ class SearchUsers extends Component {
|
|||||||
this.getItems(this.state.pageInfo.current_page + 1);
|
this.getItems(this.state.pageInfo.current_page + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
handleKeyDown = (e) => {
|
||||||
|
if (e.keyCode === 13) {
|
||||||
|
const { isSubmitBtnActive } = this.state;
|
||||||
|
if (isSubmitBtnActive) {
|
||||||
|
this.getItems();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { query, isSubmitBtnActive } = this.state;
|
const { query, isSubmitBtnActive } = this.state;
|
||||||
const {
|
const {
|
||||||
@ -299,7 +308,7 @@ class SearchUsers extends Component {
|
|||||||
<Form tag={'div'}>
|
<Form tag={'div'}>
|
||||||
<FormGroup row>
|
<FormGroup row>
|
||||||
<Col sm={5}>
|
<Col sm={5}>
|
||||||
<Input type="text" name="query" value={query} placeholder={gettext('Search users')} onChange={this.handleInputChange} />
|
<Input type="text" name="query" value={query} placeholder={gettext('Search users')} onChange={this.handleInputChange} onKeyDown={this.handleKeyDown} />
|
||||||
</Col>
|
</Col>
|
||||||
</FormGroup>
|
</FormGroup>
|
||||||
<FormGroup row>
|
<FormGroup row>
|
||||||
|
Loading…
Reference in New Issue
Block a user