Skip to content
Snippets Groups Projects
Commit ced0a2ec authored by Yogmatee Roochun's avatar Yogmatee Roochun
Browse files

Merge branch 'shared-data-model' of gitlab.coko.foundation:xpub/xpub-epmc into shared-data-model

parents b78a6b67 eaa6f957
No related branches found
No related tags found
2 merge requests!65Dev,!64Shared data model
......@@ -9,7 +9,11 @@ import DashboardList from './DashboardList'
import SearchBoxes from './SearchBoxes'
const MyQueue = ({ currentUser, errors, setErrors }) => (
<Query fetchPolicy="cache-and-network" query={ADMIN_MANUSCRIPTS}>
<Query
fetchPolicy="cache-and-network"
query={ADMIN_MANUSCRIPTS}
variables={{ external: currentUser.external }}
>
{({ data, loading }) => {
if (loading) {
return (
......
......@@ -141,8 +141,8 @@ export const ALL_MANUSCRIPTS = gql`
`
export const ADMIN_MANUSCRIPTS = gql`
query LoadAdminManuscripts {
adminManuscripts {
query LoadAdminManuscripts($external: Boolean) {
adminManuscripts(external: $external) {
...DashboardManuscript
...ClaimedByFragment
}
......
......@@ -148,16 +148,15 @@ const ReviewForm = ({ manuscript, previews, reviews, files, history }) => (
{`If an error is caused by missing or incomplete files, click 'Return for user upload' and you will be given the opportunity to write a message explaining what is needed, and send the manuscript back to the submitter or reviewer to upload files.`}
</p>
<Option>
<H3>Errors fixed?</H3>
{!review ? (
<Button onClick={() => setStatus('xml-qa')}>
Approve for QA
</Button>
) : (
<Button onClick={() => setStatus('xml-review')}>
Approve for final review
</Button>
)}
<H3 style={{ width: '100%', textAlign: 'center' }}>
Errors fixed? Approve for:
</H3>
<Button onClick={() => setStatus('xml-qa')} primary>
QA
</Button>
<Button onClick={() => setStatus('xml-review')} primary>
Final review
</Button>
</Option>
<Option>
<H3>Tagger error?</H3>
......
......@@ -88,7 +88,7 @@ class Review extends React.Component {
render() {
const { manuscript, currentUser, reviews } = this.props
const review = reviews.find(r => !r.deleted) || null
const { files: allfiles, meta, status, teams } = manuscript
const { files: allfiles, status, teams } = manuscript
const sourceFile = allfiles.find(f => f.type === 'manuscript')
const files = allfiles.filter(
f => !f.type || ReviewTypes.some(rev => rev.value === f.type),
......@@ -99,9 +99,6 @@ class Review extends React.Component {
const html = files.find(file => file.type === 'tempHTML')
const pdf = files.find(f => f.type === 'pdf4load' || f.type === 'pdf4print')
const xml = files.find(f => f.type === 'PMC') || null
const xmlError = meta.notes
? meta.notes.find(n => n.notesType === 'xml error')
: ''
const reviewer = teams.find(t => t.role === 'reviewer').teamMembers[0]
const { pane, error, showManuscript, showAll } = this.state
if (
......@@ -160,7 +157,15 @@ class Review extends React.Component {
</Toggle>
<PanelContent>
{pane === 'files' && (
<Mutation mutation={CONVERT_XML}>
<Mutation
mutation={CONVERT_XML}
refetchQueries={() => [
{
query: GET_MANUSCRIPT,
variables: { id: manuscript.id },
},
]}
>
{(convertXML, { data }) => {
const generatePreviews = async () => {
await convertXML({
......@@ -179,9 +184,9 @@ class Review extends React.Component {
{`${showAll ? 'Hide' : 'Show'} submission files`}
</Button>
</Buttons>
{xmlError && (
{manuscript.formState && (
<PreviewError>
{ReactHtmlParser(xmlError.content)}
{ReactHtmlParser(manuscript.formState)}
</PreviewError>
)}
{error && (
......
......@@ -31,14 +31,13 @@ const resolvers = {
}
return ManuscriptManager.countByStatus()
},
async adminManuscripts(_, vars, { user }) {
async adminManuscripts(_, { external }, { user }) {
if (!user) {
throw new Error('You are not authenticated!')
}
const statuses =
user.role === 'admin'
? ['submitted', 'xml-qa', 'xml-triage']
: ['xml-qa']
const statuses = external
? ['xml-qa']
: ['submitted', 'xml-qa', 'xml-triage']
return ManuscriptManager.findByStatus(statuses, -1)
},
async findByStatus(_, { query, page, pageSize }, { user }) {
......
......@@ -21,7 +21,7 @@ type ManuscriptResult {
extend type Query {
manuscript(id: ID!): Manuscript!
manuscripts: [Manuscript]!
adminManuscripts: [Manuscript]!
adminManuscripts(external: Boolean): [Manuscript]!
countByStatus: [Count]!
checkDuplicates(id: ID!, pmid: String, title: String!): [Manuscript]
searchArticleIds(id: String!): ManuscriptResult!
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment