Display current request under import and send request to API

merge-requests/154/head
Eliot Berriot 2018-02-22 23:35:40 +01:00
rodzic d91f0ff9a6
commit bf7bc9a9bc
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: DD6965E2476E5C27
2 zmienionych plików z 27 dodań i 4 usunięć

Wyświetl plik

@ -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

Wyświetl plik

@ -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: {