Display current request under import and send request to API
This commit is contained in:
parent
d91f0ff9a6
commit
bf7bc9a9bc
|
@ -13,7 +13,8 @@ export default {
|
||||||
defaultEnabled: {type: Boolean, default: true},
|
defaultEnabled: {type: Boolean, default: true},
|
||||||
backends: {type: Array},
|
backends: {type: Array},
|
||||||
defaultBackendId: {type: String},
|
defaultBackendId: {type: String},
|
||||||
queryTemplate: {type: String, default: '$artist $title'}
|
queryTemplate: {type: String, default: '$artist $title'},
|
||||||
|
request: {type: Object, required: false}
|
||||||
},
|
},
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
|
@ -32,6 +33,9 @@ export default {
|
||||||
this.isImporting = true
|
this.isImporting = true
|
||||||
let url = 'submit/' + self.importType + '/'
|
let url = 'submit/' + self.importType + '/'
|
||||||
let payload = self.importData
|
let payload = self.importData
|
||||||
|
if (this.request) {
|
||||||
|
payload.importRequest = this.request.id
|
||||||
|
}
|
||||||
axios.post(url, payload).then((response) => {
|
axios.post(url, payload).then((response) => {
|
||||||
logger.default.info('launched import for', self.type, self.metadata.id)
|
logger.default.info('launched import for', self.type, self.metadata.id)
|
||||||
self.isImporting = false
|
self.isImporting = false
|
||||||
|
|
|
@ -92,6 +92,7 @@
|
||||||
<component
|
<component
|
||||||
ref="import"
|
ref="import"
|
||||||
v-if="currentSource == 'external'"
|
v-if="currentSource == 'external'"
|
||||||
|
:request="currentRequest"
|
||||||
:metadata="metadata"
|
:metadata="metadata"
|
||||||
:is="importComponent"
|
:is="importComponent"
|
||||||
:backends="backends"
|
:backends="backends"
|
||||||
|
@ -113,7 +114,10 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</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>
|
||||||
</div>
|
</div>
|
||||||
|
@ -121,6 +125,7 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
|
import RequestCard from '@/components/requests/Card'
|
||||||
import MetadataSearch from '@/components/metadata/Search'
|
import MetadataSearch from '@/components/metadata/Search'
|
||||||
import ReleaseCard from '@/components/metadata/ReleaseCard'
|
import ReleaseCard from '@/components/metadata/ReleaseCard'
|
||||||
import ArtistCard from '@/components/metadata/ArtistCard'
|
import ArtistCard from '@/components/metadata/ArtistCard'
|
||||||
|
@ -128,6 +133,7 @@ import ReleaseImport from './ReleaseImport'
|
||||||
import FileUpload from './FileUpload'
|
import FileUpload from './FileUpload'
|
||||||
import ArtistImport from './ArtistImport'
|
import ArtistImport from './ArtistImport'
|
||||||
|
|
||||||
|
import axios from 'axios'
|
||||||
import router from '@/router'
|
import router from '@/router'
|
||||||
import $ from 'jquery'
|
import $ from 'jquery'
|
||||||
|
|
||||||
|
@ -138,15 +144,18 @@ export default {
|
||||||
ReleaseCard,
|
ReleaseCard,
|
||||||
ArtistImport,
|
ArtistImport,
|
||||||
ReleaseImport,
|
ReleaseImport,
|
||||||
FileUpload
|
FileUpload,
|
||||||
|
RequestCard
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
mbType: {type: String, required: false},
|
mbType: {type: String, required: false},
|
||||||
|
request: {type: String, required: false},
|
||||||
source: {type: String, required: false},
|
source: {type: String, required: false},
|
||||||
mbId: {type: String, required: false}
|
mbId: {type: String, required: false}
|
||||||
},
|
},
|
||||||
data: function () {
|
data: function () {
|
||||||
return {
|
return {
|
||||||
|
currentRequest: null,
|
||||||
currentType: this.mbType || 'artist',
|
currentType: this.mbType || 'artist',
|
||||||
currentId: this.mbId,
|
currentId: this.mbId,
|
||||||
currentStep: 0,
|
currentStep: 0,
|
||||||
|
@ -166,6 +175,9 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created () {
|
created () {
|
||||||
|
if (this.request) {
|
||||||
|
this.fetchRequest(this.request)
|
||||||
|
}
|
||||||
if (this.currentSource) {
|
if (this.currentSource) {
|
||||||
this.currentStep = 1
|
this.currentStep = 1
|
||||||
}
|
}
|
||||||
|
@ -179,7 +191,8 @@ export default {
|
||||||
query: {
|
query: {
|
||||||
source: this.currentSource,
|
source: this.currentSource,
|
||||||
type: this.currentType,
|
type: this.currentType,
|
||||||
id: this.currentId
|
id: this.currentId,
|
||||||
|
request: this.request
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
@ -197,6 +210,12 @@ export default {
|
||||||
},
|
},
|
||||||
updateId (newValue) {
|
updateId (newValue) {
|
||||||
this.currentId = newValue
|
this.currentId = newValue
|
||||||
|
},
|
||||||
|
fetchRequest (id) {
|
||||||
|
let self = this
|
||||||
|
axios.get(`requests/import-requests/${id}`).then((response) => {
|
||||||
|
self.currentRequest = response.data
|
||||||
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
|
Loading…
Reference in New Issue