Commit a5ba79b0 authored by Audrey Hamelers's avatar Audrey Hamelers

Merge branch 'dev' into 'master'

Dev

See merge request !194
parents 0609769b f72bde22
Pipeline #13464 failed with stages
in 11 seconds
......@@ -92,7 +92,7 @@ class CitationEdit extends React.Component {
}
}
render() {
const { manuscript, change, close, linkAndDelete } = this.props
const { manuscript, change, close } = this.props
const { journal, meta } = manuscript
const { notes, articleIds: aids, unmatchedJournal } = meta
const articleIds = aids ? aids.map(aid => omit(aid, '__typename')) : []
......@@ -192,14 +192,14 @@ class CitationEdit extends React.Component {
{(deleteCitation, { data }) => (
<React.Fragment>
<PubMedSearch
adminRemove={linkAndDelete}
citationData={async e => {
adminRemove
citationData={async (e, d) => {
await deleteCitation({
variables: {
manuscriptId: manuscript.id,
},
})
await change(e)
await change(e, d)
close()
}}
search={meta.title}
......
......@@ -99,7 +99,7 @@ const MetaEdit = withTheme(
case 'citation':
return (
<CitationEdit
change={async e => {
change={async (e, d) => {
await props.changeCitation(e)
if (manuscript.status === 'xml-complete') {
const {
......@@ -119,9 +119,11 @@ const MetaEdit = withTheme(
props.setStatus('ncbi-ready')
}
}
if (d) {
await linkAndDelete(d)
}
}}
close={close}
linkAndDelete={linkAndDelete}
manuscript={manuscript}
/>
)
......
......@@ -72,13 +72,13 @@ export const EditIcon = () => (
)
class MetaSec extends React.Component {
state = { edit: null, linkDelete: null, notif: null }
state = { edit: null, notif: null }
componentDidMount() {
this._mounted = true
this.notifTimer = null
}
async componentDidUpdate() {
const { notif, linkDelete } = this.state
const { notif } = this.state
if (this.notifTimer) {
clearTimeout(this.notifTimer)
}
......@@ -89,31 +89,6 @@ class MetaSec extends React.Component {
}
}, 3000)
}
const { manuscript, linkDeleteManuscript } = this.props
const { articleIds } = manuscript.meta
const pmcid =
articleIds &&
articleIds.find(aid => aid.pubIdType === 'pmcid') &&
articleIds.find(aid => aid.pubIdType === 'pmcid').id
if (
linkDelete &&
linkDelete === pmcid &&
manuscript.status !== 'xml-complete'
) {
;(() =>
this.setState({ linkDelete: null }, async () => {
const { data } = await linkDeleteManuscript({
variables: { id: manuscript.id },
})
const result = data.linkDeleteManuscript
this.setState({
notif: {
type: result.success ? 'success' : 'error',
message: result.message,
},
})
}))()
}
}
componentWillUnmount() {
this._mounted = false
......@@ -122,7 +97,12 @@ class MetaSec extends React.Component {
static contextType = UserContext
render() {
const currentUser = this.context
const { manuscript, claimManuscript, unclaimManuscript } = this.props
const {
manuscript,
claimManuscript,
unclaimManuscript,
linkDeleteManuscript,
} = this.props
const { teams, audits, meta, journal, claiming } = manuscript
const {
fundingGroup,
......@@ -390,7 +370,18 @@ class MetaSec extends React.Component {
lastStatusChange.originalData &&
lastStatusChange.originalData.status
}
linkAndDelete={v => this.setState({ linkDelete: v })}
linkAndDelete={async v => {
const { data } = await linkDeleteManuscript({
variables: { id: manuscript.id },
})
const result = data.linkDeleteManuscript
this.setState({
notif: {
type: result.success ? 'success' : 'error',
message: result.message,
},
})
}}
manuscript={manuscript}
refetch={[
{
......
......@@ -41,7 +41,7 @@ class ReviewerEdit extends React.Component {
<React.Fragment>
<SelectReviewer
currentUser={currentUser}
funding={fundingGroup}
funding={fundingGroup || []}
reviewer={reviewer}
reviewerNote={reviewerNote}
setReviewerNote={v => this.setState({ newReviewer: v })}
......
......@@ -117,7 +117,7 @@ class PubMedSearch extends React.Component {
this.props.citationData(citationData)
}
}
selectResult(result, journal) {
selectResult(result, journal, removePMCID) {
const publicationDates = []
const articleIds = [
{
......@@ -181,7 +181,7 @@ class PubMedSearch extends React.Component {
articleIds,
},
}
this.props.citationData(citationData)
this.props.citationData(citationData, removePMCID)
}
onQueryChange(event) {
this.setState({
......@@ -373,8 +373,11 @@ class PubMedSearch extends React.Component {
<FlexP>
<Button
onClick={() => {
this.selectResult(inPMC.result, inPMC.journal)
adminRemove(inPMC.pmcid)
this.selectResult(
inPMC.result,
inPMC.journal,
inPMC.pmcid,
)
}}
>
Remove submission
......
......@@ -15,7 +15,7 @@ services:
app:
# user: 'node'
image: xpubepmc_app:1.6.0
image: xpubepmc_app:1.6.1
build:
context: .
dockerfile: ./Dockerfile
......
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: ftp-pv-claim
labels:
app: ftp-storage-claim
spec:
accessModes:
- ReadWriteMany
resources:
requests:
storage: 100Gi
storageClassName: standard
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
creationTimestamp: null
labels:
io.kompose.service: minio-config
name: minio-config
spec:
accessModes:
- ReadWriteMany
resources:
requests:
storage: 100Mi
status: {}
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
creationTimestamp: null
labels:
io.kompose.service: minio-data
name: minio-data
spec:
accessModes:
- ReadWriteMany
resources:
requests:
storage: 100Gi
status: {}
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
annotations:
kompose.cmd: kompose convert
kompose.version: 1.18.0 (06a2e56)
creationTimestamp: null
labels:
io.kompose.service: minio
name: minio
spec:
replicas: 2
strategy:
type: RollingUpdate
rollingUpdate:
maxUnavailable: 1
maxSurge: 1
template:
metadata:
creationTimestamp: null
labels:
io.kompose.service: minio
spec:
containers:
- args:
- server
- /data
env:
- name: MINIO_ACCESS_KEY
valueFrom:
configMapKeyRef:
key: MINIO_ACCESS_KEY
name: minio-env-minio
- name: MINIO_SECRET_KEY
valueFrom:
configMapKeyRef:
key: MINIO_SECRET_KEY
name: minio-env-minio
image: minio/minio:RELEASE.2020-01-03T19-12-21Z
name: minio
ports:
- containerPort: 9000
resources: {}
volumeMounts:
- mountPath: /data
name: minio-data
- mountPath: /root/.minio
name: minio-config
restartPolicy: Always
volumes:
- name: minio-data
persistentVolumeClaim:
claimName: minio-data
- name: minio-config
persistentVolumeClaim:
claimName: minio-config
status: {}
apiVersion: v1
data:
MINIO_ACCESS_KEY: dummy-access-key
MINIO_SECRET_KEY: dummy-secret-key
kind: ConfigMap
metadata:
creationTimestamp: null
labels:
io.kompose.service: minio-env-minio
name: minio-env-minio
apiVersion: v1
kind: Service
metadata:
annotations:
kompose.cmd: kompose convert
kompose.version: 1.18.0 (06a2e56)
creationTimestamp: null
labels:
io.kompose.service: minio
name: minio
spec:
type: NodePort
ports:
- name: "9000"
port: 9000
targetPort: 9000
selector:
io.kompose.service: minio
status:
loadBalancer: {}
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: xpub-epmc-sftp-deployment
labels:
app: xpub-epmc-sftp
spec:
replicas: 1
selector:
matchLabels:
app: xpub-epmc-sftp
template:
metadata:
labels:
app: xpub-epmc-sftp
spec:
restartPolicy: Always
volumes:
- name: ftp-storage
persistentVolumeClaim:
claimName: ftp-pv-claim
containers:
- name: sftp-server
image: atmoz/sftp
args:
- foo:123:1001
ports:
- containerPort: 22
volumeMounts:
- name: ftp-storage
mountPath: /home/foo
subPath: sftpdata
- name: ftp-storage
mountPath: /etc/sftp
subPath: sftpconfig
apiVersion: v1
kind: Service
metadata:
name: xpub-epmc-sftp-service
labels:
app: xpub-epmc
spec:
type: NodePort
ports:
- name: '22'
port: 22
targetPort: 22
selector:
app: xpub-epmc-sftp
{
"name": "xpub-epmc",
"version": "1.6.0",
"version": "1.6.1",
"private": true,
"description": "xpub configured for Europe PMC Plus manuscript submission system",
"license": "MIT",
......
......@@ -11,7 +11,7 @@ const removeDupeTemplate = (salutation, badId, title, goodId, pmcid) => `
const alreadyCompleteTemplate = (salutation, manId, title, pmcid, inEPMC) => `
<p>Dear ${salutation},</p>
<p>The full text of your manusript submission, <b>${manId}: ${title}</b> has already been provided to Europe PMC. Your submission has been removed as a duplicate of ${pmcid}.</p>
<p>The full text of your manuscript submission, <b>${manId}: ${title}</b> has already been provided to Europe PMC. Your submission has been removed as a duplicate of ${pmcid}.</p>
${
inEPMC
? `<p><a style="color:#20699C" href="https://europepmc.org/articles/${pmcid}">View this article on Europe PMC</a></p>`
......
......@@ -359,7 +359,7 @@ async function deposit(manuscript, adminUser) {
const files =
manuscript.files &&
manuscript.files.filter(file => !file.deleted && file.type === 'IMGprint')
const bigfiles = files.filter(file => file.size > 20000000)
const bigfiles = files.filter(file => file.size > 24000000)
if (bigfiles.length > 0) {
const err = `Unable to generate PDF. The following TIFF files are too large:\n${bigfiles
.map(f => f.filename)
......
require('dotenv').config()
const logger = require('@pubsweet/logger')
const { minioClient } = require('@europepmc/express-middleware-minio')
const AWS = require('aws-sdk')
const { PassThrough } = require('stream')
const s3 = new AWS.S3({
region: 'eu-west-2',
accessKeyId: process.env.AWS_ACCESS_KEY,
secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY,
})
minioClient.listFiles((error, list) => {
if (error) {
logger.info('error')
} else {
let counter = 0
// eslint-disable-next-line no-restricted-syntax
for (const file of list) {
logger.info(file)
uploadFile(file.name.replace('uploads/', ''))
counter += 1
if (counter > 10) {
break
}
}
}
})
function uploadFile(filePath) {
minioClient.getFileStream(filePath, (err, inputStream) => {
if (err) throw err
inputStream.pipe(uploadFromStream(s3, filePath))
})
}
// arn:aws:s3:::xpub-epmc-test
function uploadFromStream(s3, filePath) {
const pass = new PassThrough()
const params = {
Bucket: process.env.AWS_BUCKET_NAME, // pass your bucket name
Key: `uploads/${filePath}`, // file will be saved as
Body: pass,
}
s3.upload(params, (s3Err, data) => {
if (s3Err) throw s3Err
logger.info(`File uploaded successfully at ${data.Location}`)
})
return pass
}
This diff is collapsed.
Markdown is supported
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