Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
X
xpub-epmc
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Package Registry
Container Registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Insights
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Literature-services
public-projects
xpub-epmc
Commits
06b5d29b
Commit
06b5d29b
authored
6 years ago
by
MoSelim
Browse files
Options
Downloads
Patches
Plain Diff
#450
parent
60e4d296
No related branches found
No related tags found
2 merge requests
!101
Shared data model
,
!102
Shared data model
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
app/components/manage-users/UserSearch.jsx
+31
-7
31 additions, 7 deletions
app/components/manage-users/UserSearch.jsx
with
31 additions
and
7 deletions
app/components/manage-users/UserSearch.jsx
+
31
−
7
View file @
06b5d29b
...
...
@@ -3,7 +3,14 @@ import styled from 'styled-components'
import
{
th
}
from
'
@pubsweet/ui-toolkit
'
import
{
H1
,
Link
}
from
'
@pubsweet/ui
'
import
{
withApollo
}
from
'
react-apollo
'
import
{
Page
,
SearchForm
,
ZebraList
,
ZebraListItem
}
from
'
../ui/
'
import
{
Page
,
SearchForm
,
ZebraList
,
ZebraListItem
,
Loading
,
LoadingIcon
,
}
from
'
../ui/
'
import
{
USERS_BY_NAME
,
USERS_BY_EMAIL
}
from
'
./queries
'
const
SearchArea
=
styled
.
div
`
...
...
@@ -45,6 +52,7 @@ class UserSearch extends React.Component {
searchByName
:
props
.
searchByName
?
props
.
searchByName
:
''
,
searchByEmail
:
props
.
searchByEmail
?
props
.
searchByEmail
:
''
,
results
:
[],
emptyResults
:
false
,
}
this
.
onSearchValChanged
=
this
.
onSearchValChanged
.
bind
(
this
)
this
.
onSearchValSubmitted
=
this
.
onSearchValSubmitted
.
bind
(
this
)
...
...
@@ -61,21 +69,31 @@ class UserSearch extends React.Component {
variables
:
{
name
:
this
.
state
.
searchByName
},
fetchPolicy
:
'
network-only
'
,
}
this
.
setState
({
searchByEmail
:
''
})
this
.
setState
({
searchByEmail
:
''
,
loading
:
true
})
}
else
{
options
=
{
query
:
USERS_BY_EMAIL
,
variables
:
{
email
:
this
.
state
.
searchByEmail
},
fetchPolicy
:
'
network-only
'
,
}
this
.
setState
({
searchByName
:
''
})
this
.
setState
({
searchByName
:
''
,
loading
:
true
})
}
this
.
props
.
client
.
query
(
options
)
.
then
(
response
=>
this
.
setState
({
results
:
response
.
data
[
searchForm
]
}))
this
.
props
.
client
.
query
(
options
).
then
(
response
=>
this
.
setState
({
results
:
response
.
data
[
searchForm
],
loading
:
false
,
emptyResults
:
response
.
data
[
searchForm
].
length
===
0
,
}),
)
}
render
()
{
const
{
searchByName
,
searchByEmail
,
results
}
=
this
.
state
const
{
searchByName
,
searchByEmail
,
results
,
loading
,
emptyResults
,
}
=
this
.
state
return
(
<
Page
>
<
H1
>
Manage Users
</
H1
>
...
...
@@ -128,6 +146,12 @@ class UserSearch extends React.Component {
)
})
}
</
ZebraList
>
{
loading
&&
(
<
Loading
>
<
LoadingIcon
/>
</
Loading
>
)
}
{
emptyResults
&&
<
div
>
No results found for this search.
</
div
>
}
</
div
>
</
Page
>
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment