Merge branch '302-radio-save-message' into 'develop'
Resolve "save radio not showing info message" Closes #305 See merge request funkwhale/funkwhale!333
This commit is contained in:
commit
fa673c7c38
|
@ -0,0 +1 @@
|
||||||
|
Added feedback when creating/updating radio (#302)
|
|
@ -6,7 +6,17 @@
|
||||||
<translate>Builder</translate>
|
<translate>Builder</translate>
|
||||||
</h2>
|
</h2>
|
||||||
<p><translate>You can use this interface to build your own custom radio, which will play tracks according to your criteria.</translate></p>
|
<p><translate>You can use this interface to build your own custom radio, which will play tracks according to your criteria.</translate></p>
|
||||||
<div class="ui form">
|
<div class="ui form">
|
||||||
|
<div v-if="success" class="ui positive message">
|
||||||
|
<div class="header">
|
||||||
|
<template v-if="radioName">
|
||||||
|
<translate>Radio updated</translate>
|
||||||
|
</template>
|
||||||
|
<template v-else>
|
||||||
|
<translate>Radio created</translate>
|
||||||
|
</template>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="inline fields">
|
<div class="inline fields">
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<label for="name"><translate>Radio name</translate></label>
|
<label for="name"><translate>Radio name</translate></label>
|
||||||
|
@ -16,7 +26,7 @@
|
||||||
<input id="public" type="checkbox" v-model="isPublic" />
|
<input id="public" type="checkbox" v-model="isPublic" />
|
||||||
<label for="public"><translate>Display publicly</translate></label>
|
<label for="public"><translate>Display publicly</translate></label>
|
||||||
</div>
|
</div>
|
||||||
<button :disabled="!canSave" @click="save" class="ui green button">
|
<button :disabled="!canSave" @click="save" :class="['ui', 'green', {loading: isLoading}, 'button']">
|
||||||
<translate>Save</translate>
|
<translate>Save</translate>
|
||||||
</button>
|
</button>
|
||||||
<radio-button v-if="id" type="custom" :custom-radio-id="id"></radio-button>
|
<radio-button v-if="id" type="custom" :custom-radio-id="id"></radio-button>
|
||||||
|
@ -96,6 +106,8 @@ export default {
|
||||||
},
|
},
|
||||||
data: function () {
|
data: function () {
|
||||||
return {
|
return {
|
||||||
|
isLoading: false,
|
||||||
|
success: false,
|
||||||
availableFilters: [],
|
availableFilters: [],
|
||||||
currentFilterType: null,
|
currentFilterType: null,
|
||||||
filters: [],
|
filters: [],
|
||||||
|
@ -141,6 +153,7 @@ export default {
|
||||||
},
|
},
|
||||||
fetch: function () {
|
fetch: function () {
|
||||||
let self = this
|
let self = this
|
||||||
|
self.isLoading = true
|
||||||
let url = 'radios/radios/' + this.id + '/'
|
let url = 'radios/radios/' + this.id + '/'
|
||||||
axios.get(url).then((response) => {
|
axios.get(url).then((response) => {
|
||||||
self.filters = response.data.config.map(f => {
|
self.filters = response.data.config.map(f => {
|
||||||
|
@ -152,6 +165,7 @@ export default {
|
||||||
})
|
})
|
||||||
self.radioName = response.data.name
|
self.radioName = response.data.name
|
||||||
self.isPublic = response.data.is_public
|
self.isPublic = response.data.is_public
|
||||||
|
self.isLoading = false
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
fetchCandidates: function () {
|
fetchCandidates: function () {
|
||||||
|
@ -173,6 +187,9 @@ export default {
|
||||||
},
|
},
|
||||||
save: function () {
|
save: function () {
|
||||||
let self = this
|
let self = this
|
||||||
|
self.success = false
|
||||||
|
self.isLoading = true
|
||||||
|
|
||||||
let final = this.filters.map(f => {
|
let final = this.filters.map(f => {
|
||||||
let c = _.clone(f.config)
|
let c = _.clone(f.config)
|
||||||
c.type = f.filter.type
|
c.type = f.filter.type
|
||||||
|
@ -186,10 +203,14 @@ export default {
|
||||||
if (this.id) {
|
if (this.id) {
|
||||||
let url = 'radios/radios/' + this.id + '/'
|
let url = 'radios/radios/' + this.id + '/'
|
||||||
axios.put(url, final).then((response) => {
|
axios.put(url, final).then((response) => {
|
||||||
|
self.isLoading = false
|
||||||
|
self.success = true
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
let url = 'radios/radios/'
|
let url = 'radios/radios/'
|
||||||
axios.post(url, final).then((response) => {
|
axios.post(url, final).then((response) => {
|
||||||
|
self.success = true
|
||||||
|
self.isLoading = false
|
||||||
self.$router.push({
|
self.$router.push({
|
||||||
name: 'library.radios.detail',
|
name: 'library.radios.detail',
|
||||||
params: {
|
params: {
|
||||||
|
|
Loading…
Reference in New Issue