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
c89bb276
Commit
c89bb276
authored
6 years ago
by
Audrey Hamelers
Browse files
Options
Downloads
Patches
Plain Diff
#474
parent
ed9d8945
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!112
Shared data model
,
!113
Dev
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
app/components/dashboard/DashboardPage.jsx
+48
-35
48 additions, 35 deletions
app/components/dashboard/DashboardPage.jsx
app/components/dashboard/index.js
+26
-26
26 additions, 26 deletions
app/components/dashboard/index.js
with
74 additions
and
61 deletions
app/components/dashboard/DashboardPage.jsx
+
48
−
35
View file @
c89bb276
...
...
@@ -2,7 +2,7 @@ import React from 'react'
import
{
Query
,
compose
,
graphql
}
from
'
react-apollo
'
import
styled
from
'
styled-components
'
import
{
H4
,
Link
}
from
'
@pubsweet/ui
'
import
{
pageSize
}
from
'
config
'
import
{
pageSize
,
states
}
from
'
config
'
import
{
Loading
,
LoadingIcon
,
Notification
,
Toggle
,
Pagination
}
from
'
../ui
'
import
{
ALL_MANUSCRIPTS
,
...
...
@@ -117,15 +117,13 @@ const MyManuscripts = ({ currentUser, errors, history }) => {
</
Loading
>
)
}
// get the total number of manuscripts to decide whether the toggles are required
const
{
countByStatus
}
=
data
let
totalTount
=
0
countByStatus
.
forEach
(
status
=>
{
totalTount
+=
status
.
count
})
const
togglesRequired
=
totalTount
>
pageSize
const
totalCount
=
countByStatus
.
reduce
(
(
sum
,
status
)
=>
sum
+
parseInt
(
status
.
count
,
10
),
0
,
)
const
togglesRequired
=
totalCount
>
pageSize
// determine the query and variables used to get manuscripts
const
query
=
togglesRequired
?
MANUSCRIPTS_BY_STATUS
:
ALL_MANUSCRIPTS
const
params
=
new
URLSearchParams
(
history
.
location
.
search
)
...
...
@@ -133,17 +131,17 @@ const MyManuscripts = ({ currentUser, errors, history }) => {
const
completed
=
params
.
get
(
'
completed
'
)
const
variables
=
{}
const
done
=
states
.
indexOf
(
'
xml-complete
'
)
if
(
togglesRequired
)
{
if
(
completed
)
{
variables
.
query
=
`xml-complete,ncbi-ready,published`
variables
.
query
=
states
.
slice
(
done
).
join
(
'
,
'
)
variables
.
page
=
params
.
get
(
'
page
'
)
?
params
.
get
(
'
page
'
)
-
1
:
0
variables
.
pageSize
=
pageSize
}
else
{
variables
.
query
=
`INITIAL,READY,submission-error,in-review,submitted,tagging,xml-qa,xml-triage,xml-review,being-withdrawn`
variables
.
query
=
states
.
slice
(
0
,
done
).
join
(
'
,
'
)
variables
.
page
=
-
1
}
}
return
(
<
Query
fetchPolicy
=
"cache-and-network"
...
...
@@ -158,7 +156,6 @@ const MyManuscripts = ({ currentUser, errors, history }) => {
</
Loading
>
)
}
const
{
total
,
manuscripts
}
=
togglesRequired
?
data
.
findByStatus
:
data
...
...
@@ -211,30 +208,41 @@ const MyManuscripts = ({ currentUser, errors, history }) => {
}
const
attention
=
[]
const
review
=
[]
const
warning
=
[]
const
processing
=
[]
const
complete
=
[]
const
other
=
[]
const
highlight
=
[
'
INITIAL
'
,
'
READY
'
,
'
submission-error
'
,
'
in-review
'
,
'
xml-review
'
,
]
manuscripts
.
forEach
(
m
=>
{
const
reviewer
=
m
.
teams
.
find
(
t
=>
t
.
role
===
'
reviewer
'
)
const
submitter
=
m
.
teams
.
find
(
t
=>
t
.
role
===
'
submitter
'
)
if
(
reviewer
&&
reviewer
.
teamMembers
[
0
].
user
.
id
===
currentUser
.
id
&&
[
'
in-review
'
,
'
xml-review
'
].
includes
(
m
.
status
)
)
{
review
.
push
(
m
)
}
else
if
(
submitter
.
teamMembers
[
0
].
user
.
id
===
currentUser
.
id
&&
[
'
INITIAL
'
,
'
READY
'
,
'
submission-error
'
].
includes
(
m
.
status
)
)
{
attention
.
push
(
m
)
if
(
highlight
.
includes
(
m
.
status
))
{
if
(
reviewer
&&
reviewer
.
teamMembers
[
0
].
user
.
id
===
currentUser
.
id
&&
highlight
.
slice
(
-
2
).
includes
(
m
.
status
)
)
{
attention
.
push
(
m
)
}
else
if
(
submitter
.
teamMembers
[
0
].
user
.
id
===
currentUser
.
id
&&
highlight
.
slice
(
0
,
3
).
includes
(
m
.
status
)
)
{
attention
.
push
(
m
)
}
else
{
warning
.
push
(
m
)
}
}
else
if
(
!
togglesRequired
&&
[
'
xml-complete
'
,
'
ncbi-ready
'
,
'
published
'
]
.
includes
(
m
.
status
)
states
.
slice
(
done
)
.
includes
(
m
.
status
)
)
{
complete
.
push
(
m
)
}
else
{
other
.
push
(
m
)
processing
.
push
(
m
)
}
})
return
(
...
...
@@ -256,25 +264,30 @@ const MyManuscripts = ({ currentUser, errors, history }) => {
))
}
{
attention
.
length
>
0
&&
(
<
React
.
Fragment
>
<
H4
>
Needs attention (
{
attention
.
length
}
)
</
H4
>
<
H4
>
Needs
your
attention (
{
attention
.
length
}
)
</
H4
>
<
DashboardList
currentUser
=
{
currentUser
}
listData
=
{
attention
}
sectionRole
=
"submitter"
/>
</
React
.
Fragment
>
)
}
{
review
.
length
>
0
&&
(
{
warning
.
length
>
0
&&
(
<
React
.
Fragment
>
<
H4
>
Waiting for author review (
{
review
.
length
}
)
</
H4
>
<
DashboardList
listData
=
{
review
}
sectionRole
=
"reviewer"
/>
<
H4
>
Waiting for action by another user (
{
warning
.
length
}
)
</
H4
>
<
DashboardList
currentUser
=
{
currentUser
}
listData
=
{
warning
}
/>
</
React
.
Fragment
>
)
}
{
other
.
length
>
0
&&
(
{
processing
.
length
>
0
&&
(
<
React
.
Fragment
>
<
H4
>
In process at Europe PMC (
{
other
.
length
}
)
</
H4
>
<
H4
>
In process at Europe PMC (
{
processing
.
length
}
)
</
H4
>
<
DashboardList
currentUser
=
{
currentUser
}
listData
=
{
other
}
listData
=
{
processing
}
/>
</
React
.
Fragment
>
)
}
...
...
This diff is collapsed.
Click to expand it.
app/components/dashboard/index.js
+
26
−
26
View file @
c89bb276
...
...
@@ -5,7 +5,7 @@ const submitterState = {
url
:
'
create
'
,
},
READY
:
{
status
:
'
Not yet submitted
'
,
status
:
'
Incomplete
'
,
color
:
'
error
'
,
url
:
'
submit
'
,
},
...
...
@@ -15,12 +15,12 @@ const submitterState = {
url
:
'
submit
'
,
},
'
in-review
'
:
{
status
:
'
Submitted
'
,
color
:
'
normal
'
,
status
:
'
Initial review
'
,
color
:
'
warning
'
,
url
:
'
submit
'
,
},
submitted
:
{
status
:
'
Submitted
'
,
status
:
'
Europe PMC QA
'
,
color
:
'
normal
'
,
url
:
'
submit
'
,
},
...
...
@@ -35,8 +35,8 @@ const submitterState = {
url
:
'
submit
'
,
},
'
xml-review
'
:
{
status
:
'
Processing
'
,
color
:
'
normal
'
,
status
:
'
Final proof
'
,
color
:
'
warning
'
,
url
:
'
submit
'
,
},
'
xml-triage
'
:
{
...
...
@@ -45,17 +45,17 @@ const submitterState = {
url
:
'
submit
'
,
},
'
xml-complete
'
:
{
status
:
'
Approved for
archive
'
,
status
:
'
Approved for
Europe PMC
'
,
color
:
'
success
'
,
url
:
'
submit
'
,
},
'
ncbi-ready
'
:
{
status
:
'
Approved for
archive
'
,
status
:
'
Approved for
Europe PMC
'
,
color
:
'
success
'
,
url
:
'
submit
'
,
},
published
:
{
status
:
'
Available in
archive
'
,
status
:
'
Available in
Europe PMC
'
,
color
:
'
success
'
,
url
:
'
submit
'
,
},
...
...
@@ -68,13 +68,13 @@ const submitterState = {
const
reviewerState
=
{
INITIAL
:
{
status
:
'
With submit
te
r
'
,
color
:
'
normal
'
,
status
:
'
Incomple
te
'
,
color
:
'
warning
'
,
url
:
'
submit
'
,
},
READY
:
{
status
:
'
With submit
te
r
'
,
color
:
'
normal
'
,
status
:
'
Incomple
te
'
,
color
:
'
warning
'
,
url
:
'
submit
'
,
},
'
submission-error
'
:
{
...
...
@@ -83,12 +83,12 @@ const reviewerState = {
url
:
'
submit
'
,
},
'
in-review
'
:
{
status
:
'
Needs
review
'
,
status
:
'
Initial
review
'
,
color
:
'
error
'
,
url
:
'
submit
'
,
},
submitted
:
{
status
:
'
Submitted
'
,
status
:
'
Europe PMC QA
'
,
color
:
'
normal
'
,
url
:
'
submit
'
,
},
...
...
@@ -103,27 +103,27 @@ const reviewerState = {
url
:
'
submit
'
,
},
'
xml-review
'
:
{
status
:
'
Needs final review
'
,
status
:
'
Final proof
'
,
color
:
'
error
'
,
url
:
'
review
'
,
},
'
xml-triage
'
:
{
status
:
'
Processing
'
,
color
:
'
warning
'
,
color
:
'
normal
'
,
url
:
'
submit
'
,
},
'
xml-complete
'
:
{
status
:
'
Approved for
archive
'
,
status
:
'
Approved for
Europe PMC
'
,
color
:
'
success
'
,
url
:
'
submit
'
,
},
'
ncbi-ready
'
:
{
status
:
'
Approved for
archive
'
,
status
:
'
Approved for
Europe PMC
'
,
color
:
'
success
'
,
url
:
'
submit
'
,
},
published
:
{
status
:
'
Available in
archive
'
,
status
:
'
Available in
Europe PMC
'
,
color
:
'
success
'
,
url
:
'
submit
'
,
},
...
...
@@ -136,12 +136,12 @@ const reviewerState = {
const
adminState
=
{
INITIAL
:
{
status
:
'
Not yet submitted
'
,
status
:
'
Incomplete
'
,
color
:
'
normal
'
,
url
:
'
create
'
,
},
READY
:
{
status
:
'
Not yet submitted
'
,
status
:
'
Incomplete
'
,
color
:
'
normal
'
,
url
:
'
submit
'
,
},
...
...
@@ -151,7 +151,7 @@ const adminState = {
url
:
'
submit
'
,
},
'
in-review
'
:
{
status
:
'
Needs
review
'
,
status
:
'
Initial
review
'
,
color
:
'
normal
'
,
url
:
'
submit
'
,
},
...
...
@@ -171,7 +171,7 @@ const adminState = {
url
:
'
review
'
,
},
'
xml-review
'
:
{
status
:
'
Final
review
'
,
status
:
'
Final
proof
'
,
color
:
'
normal
'
,
url
:
'
review
'
,
},
...
...
@@ -186,12 +186,12 @@ const adminState = {
url
:
'
activity
'
,
},
'
ncbi-ready
'
:
{
status
:
'
Approved for
archive
'
,
status
:
'
Approved for
Europe PMC
'
,
color
:
'
success
'
,
url
:
'
activity
'
,
},
published
:
{
status
:
'
Available in
archive
'
,
status
:
'
Available in
Europe PMC
'
,
color
:
'
success
'
,
url
:
'
activity
'
,
},
...
...
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