1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-08 02:10:24 +00:00

optimized code

This commit is contained in:
shanshuirenjia
2018-12-17 14:42:49 +08:00
parent 03c227f3e1
commit 2a3169c7cf
2 changed files with 22 additions and 15 deletions

View File

@@ -113,9 +113,10 @@ class ShareToUser extends React.Component {
return sharedItem;
});
this.setState({
sharedItems: this.state.sharedItems.concat(items)
sharedItems: this.state.sharedItems.concat(items),
selectedOption: null,
});
})
});
} else {
seafileAPI.shareFolder(repoID, path, 'user', this.state.permission, users).then(res => {
if (res.data.failed.length > 0) {
@@ -126,7 +127,8 @@ class ShareToUser extends React.Component {
this.setState({errorMsg: errorMsg});
}
this.setState({
sharedItems: this.state.sharedItems.concat(res.data.success)
sharedItems: this.state.sharedItems.concat(res.data.success),
selectedOption: null,
});
});
}
@@ -164,12 +166,16 @@ class ShareToUser extends React.Component {
<tr>
<td>
<AsyncSelect
className='reviewer-select' isMulti isFocused
loadOptions={this.loadOptions}
placeholder={gettext('Please enter 1 or more character')}
onChange={this.handleSelectChange}
isClearable classNamePrefix
inputId={'react-select-1-input'}
className='reviewer-select'
placeholder={gettext('Please enter 1 or more character')}
loadOptions={this.loadOptions}
onChange={this.handleSelectChange}
value={this.state.selectedOption}
isMulti
isFocused
isClearable
classNamePrefix
/>
</td>
<td>
@@ -211,7 +217,7 @@ function UserList(props) {
<tr key={index}>
<td>{item.user_info.nickname}</td>
<td>{Utils.sharePerms[item.permission]}</td>
<td><i onClick={(e) => {props.deleteShareItem(e, item.user_info.name);}} className="sf2-icon-delete" title="Delete"></i></td>
<td><a href="#" onClick={(e) => {props.deleteShareItem(e, item.user_info.name);}} className="sf2-icon-x3 sf2-x op-icon" title={gettext('Delete')}></a></td>
</tr>
))}
</tbody>