forked from box/mojito
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
I18N-1291 - Mojito user management table should be searchable (#155)
Made user management table searchable
- Loading branch information
Showing
15 changed files
with
428 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 10 additions & 5 deletions
15
webapp/src/main/resources/public/js/actions/users/UserDataSource.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
webapp/src/main/resources/public/js/actions/users/UserSearchParamActions.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import alt from "../../alt"; | ||
|
||
class UserSearchParamActions { | ||
constructor() { | ||
this.generateActions( | ||
"changeSearchText", | ||
"resetUserSearchParams", | ||
); | ||
} | ||
} | ||
|
||
export default alt.createActions(UserSearchParamActions); |
54 changes: 54 additions & 0 deletions
54
webapp/src/main/resources/public/js/components/common/SearchText.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import React from "react"; | ||
import {injectIntl} from "react-intl"; | ||
import PropTypes from "prop-types"; | ||
import keycode from "keycode"; | ||
import {Button, FormControl, FormGroup, Glyphicon, InputGroup} from "react-bootstrap"; | ||
|
||
class SearchText extends React.Component { | ||
static propTypes = { | ||
"searchText": PropTypes.string.isRequired, | ||
"isSpinnerShown": PropTypes.bool.isRequired, | ||
"onSearchTextChanged": PropTypes.func.isRequired, | ||
"onPerformSearch": PropTypes.func.isRequired, | ||
"placeholderTextId": PropTypes.string.isRequired | ||
} | ||
|
||
onKeyDownOnSearchText(e) { | ||
e.stopPropagation(); | ||
if (e.keyCode === keycode("enter")) { | ||
this.props.onPerformSearch(); | ||
} | ||
} | ||
|
||
onSearchButtonClicked() { | ||
this.props.onPerformSearch(); | ||
} | ||
|
||
renderSearchButton() { | ||
return ( | ||
<Button onClick={() => this.onSearchButtonClicked()}> | ||
<Glyphicon glyph='glyphicon glyphicon-search'/> | ||
</Button> | ||
); | ||
} | ||
|
||
render() { | ||
return ( | ||
<div className="search-text"> | ||
<FormGroup> | ||
<InputGroup> | ||
<FormControl type='text' value={this.props.searchText} | ||
onChange={(e) => this.props.onSearchTextChanged(e.target.value)} | ||
placeholder={this.props.intl.formatMessage({id: this.props.placeholderTextId})} | ||
onKeyDown={(e) => this.onKeyDownOnSearchText(e)}/> | ||
<InputGroup> | ||
{this.props.isSpinnerShown && (<span className="glyphicon glyphicon-refresh spinning"/>)} | ||
</InputGroup> | ||
<InputGroup.Button>{this.renderSearchButton()}</InputGroup.Button> | ||
</InputGroup> | ||
</FormGroup> | ||
</div> | ||
); | ||
} | ||
} | ||
export default injectIntl(SearchText); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
webapp/src/main/resources/public/js/sdk/UserSearcherParameters.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
export default class UserSearcherParameters { | ||
constructor() { | ||
this.params = {}; | ||
} | ||
|
||
search(searchText) { | ||
this.params.search = searchText; | ||
return this; | ||
} | ||
|
||
page(page) { | ||
this.params.page = page; | ||
return this; | ||
} | ||
|
||
size(size) { | ||
this.params.size = size; | ||
return this; | ||
} | ||
|
||
getParams() { | ||
return this.params; | ||
} | ||
} |
39 changes: 39 additions & 0 deletions
39
webapp/src/main/resources/public/js/stores/users/UserSearchParamStore.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import alt from "../../alt"; | ||
import UserSearchParamActions from "../../actions/users/UserSearchParamActions"; | ||
import UserActions from "../../actions/users/UserActions"; | ||
|
||
class UserSearchParamStore { | ||
constructor() { | ||
this.setDefaultState(); | ||
|
||
this.bindActions(UserSearchParamActions); | ||
this.bindActions(UserActions); | ||
} | ||
|
||
setDefaultState() { | ||
this.searchText = ""; | ||
this.isSpinnerShown = false; | ||
} | ||
|
||
changeSearchText(text) { | ||
this.searchText = text; | ||
} | ||
|
||
resetUserSearchParams() { | ||
this.setDefaultState(); | ||
} | ||
|
||
getUsers() { | ||
this.isSpinnerShown = true; | ||
} | ||
|
||
getUsersSuccess() { | ||
this.isSpinnerShown = false; | ||
} | ||
|
||
getUsersError() { | ||
this.isSpinnerShown = false; | ||
} | ||
} | ||
|
||
export default alt.createStore(UserSearchParamStore, "UserSearchParamStore"); |
Oops, something went wrong.