Skip to content
Snippets Groups Projects
Verified Commit bf7bc9a9 authored by Eliot Berriot's avatar Eliot Berriot
Browse files

Display current request under import and send request to API

parent d91f0ff9
No related branches found
No related tags found
No related merge requests found
......@@ -13,7 +13,8 @@ export default {
defaultEnabled: {type: Boolean, default: true},
backends: {type: Array},
defaultBackendId: {type: String},
queryTemplate: {type: String, default: '$artist $title'}
queryTemplate: {type: String, default: '$artist $title'},
request: {type: Object, required: false}
},
data () {
return {
......@@ -32,6 +33,9 @@ export default {
this.isImporting = true
let url = 'submit/' + self.importType + '/'
let payload = self.importData
if (this.request) {
payload.importRequest = this.request.id
}
axios.post(url, payload).then((response) => {
logger.default.info('launched import for', self.type, self.metadata.id)
self.isImporting = false
......
......@@ -92,6 +92,7 @@
<component
ref="import"
v-if="currentSource == 'external'"
:request="currentRequest"
:metadata="metadata"
:is="importComponent"
:backends="backends"
......@@ -113,7 +114,10 @@
</div>
</div>
</div>
<div class="ui vertical stripe segment">
<div class="ui vertical stripe segment" v-if="currentRequest">
<h3 class="ui header">Music request</h3>
<p>This import will be associated with the music request below. After the import is finished, the request will be marked as fulfilled.</p>
<request-card :request="currentRequest" :import-action="false"></request-card>
</div>
</div>
......@@ -121,6 +125,7 @@
<script>
import RequestCard from '@/components/requests/Card'
import MetadataSearch from '@/components/metadata/Search'
import ReleaseCard from '@/components/metadata/ReleaseCard'
import ArtistCard from '@/components/metadata/ArtistCard'
......@@ -128,6 +133,7 @@ import ReleaseImport from './ReleaseImport'
import FileUpload from './FileUpload'
import ArtistImport from './ArtistImport'
import axios from 'axios'
import router from '@/router'
import $ from 'jquery'
......@@ -138,15 +144,18 @@ export default {
ReleaseCard,
ArtistImport,
ReleaseImport,
FileUpload
FileUpload,
RequestCard
},
props: {
mbType: {type: String, required: false},
request: {type: String, required: false},
source: {type: String, required: false},
mbId: {type: String, required: false}
},
data: function () {
return {
currentRequest: null,
currentType: this.mbType || 'artist',
currentId: this.mbId,
currentStep: 0,
......@@ -166,6 +175,9 @@ export default {
}
},
created () {
if (this.request) {
this.fetchRequest(this.request)
}
if (this.currentSource) {
this.currentStep = 1
}
......@@ -179,7 +191,8 @@ export default {
query: {
source: this.currentSource,
type: this.currentType,
id: this.currentId
id: this.currentId,
request: this.request
}
})
},
......@@ -197,6 +210,12 @@ export default {
},
updateId (newValue) {
this.currentId = newValue
},
fetchRequest (id) {
let self = this
axios.get(`requests/import-requests/${id}`).then((response) => {
self.currentRequest = response.data
})
}
},
computed: {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment