Skip to content

Commit

Permalink
OpenConceptLab/ocl_issues#804 | Parallel import can be done with JSON…
Browse files Browse the repository at this point in the history
… body
  • Loading branch information
snyaggarwal committed Jun 11, 2021
1 parent c9fc0fd commit 8111656
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/components/imports/NewImport.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class NewImport extends React.Component {
}

getPayload() {
const { type, fileURL, json, file, workers } = this.state
const { type, fileURL, json, file, workers, parallel } = this.state
if(type === 'upload'){
const formData = new FormData()
formData.append('file', file)
Expand All @@ -89,8 +89,15 @@ class NewImport extends React.Component {
formData.append('parallel', workers)
return formData
}
if(type === 'json')
if(type === 'json') {
if(parallel) {
const formData = new FormData()
formData.append('parallel', workers)
formData.append('data', json)
return formData
}
return json
}
}

getParallelService() {
Expand All @@ -102,7 +109,7 @@ class NewImport extends React.Component {

getService() {
const { type, parallel, queue } = this.state
if(type !== 'json' && parallel)
if(parallel)
return this.getParallelService()

const service = APIService.new().overrideURL('/importers/bulk-import/')
Expand Down Expand Up @@ -191,8 +198,6 @@ class NewImport extends React.Component {
Update if existing concept/mapping found
</FormHelperText>
</div>
{
!isJSON &&
<div className='col-md-6 no-side-padding'>
<FormControlLabel
control={<Checkbox checked={parallel} onChange={this.onParallelToogle} name='parallel' />}
Expand All @@ -202,7 +207,6 @@ class NewImport extends React.Component {
Run concepts/mappings/references imports in parallel
</FormHelperText>
</div>
}
<div className='col-md-12 no-side-padding' style={{margin: '10px 0'}}>
{
isUpload &&
Expand Down

0 comments on commit 8111656

Please sign in to comment.