Merge pull request #746 from chme/webupdate

Update player web interface
This commit is contained in:
Christian Meffert 2019-05-28 23:12:28 +02:00 committed by GitHub
commit d6f45054f0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 1492 additions and 1595 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

2925
web-src/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
{ {
"name": "forked-daapd-web", "name": "forked-daapd-web",
"version": "0.5.1", "version": "0.5.2",
"description": "forked-daapd web interface", "description": "forked-daapd web interface",
"author": "chme <christian.meffert@googlemail.com>", "author": "chme <christian.meffert@googlemail.com>",
"license": "GPL-2.0", "license": "GPL-2.0",
@ -13,26 +13,26 @@
}, },
"dependencies": { "dependencies": {
"axios": "^0.18.0", "axios": "^0.18.0",
"bulma": "^0.7.4", "bulma": "^0.7.5",
"mdi": "^2.1.99", "mdi": "^2.1.99",
"moment": "^2.24.0", "moment": "^2.24.0",
"moment-duration-format": "^2.2.2", "moment-duration-format": "^2.2.2",
"npm": "^6.8.0", "npm": "^6.9.0",
"reconnectingwebsocket": "^1.0.0", "reconnectingwebsocket": "^1.0.0",
"spotify-web-api-js": "^1.2.0", "spotify-web-api-js": "^1.2.0",
"vue": "^2.6.7", "vue": "^2.6.10",
"vue-infinite-loading": "^2.4.3", "vue-infinite-loading": "^2.4.4",
"vue-progressbar": "^0.7.4", "vue-progressbar": "^0.7.4",
"vue-range-slider": "^0.6.0", "vue-range-slider": "^0.6.0",
"vue-router": "^3.0.2", "vue-router": "^3.0.6",
"vuedraggable": "^2.17.0", "vuedraggable": "^2.21.0",
"vuex": "^3.1.0" "vuex": "^3.1.1"
}, },
"devDependencies": { "devDependencies": {
"@vue/cli-plugin-babel": "^3.4.1", "@vue/cli-plugin-babel": "^3.8.0",
"@vue/cli-plugin-eslint": "^3.4.1", "@vue/cli-plugin-eslint": "^3.8.0",
"@vue/cli-service": "^3.4.1", "@vue/cli-service": "^3.8.0",
"@vue/eslint-config-standard": "^3.0.5", "@vue/eslint-config-standard": "^3.0.5",
"vue-template-compiler": "^2.6.7" "vue-template-compiler": "^2.6.10"
} }
} }

View File

@ -3,23 +3,40 @@
<transition name="fade"> <transition name="fade">
<div class="modal is-active" v-if="show"> <div class="modal is-active" v-if="show">
<div class="modal-background" @click="$emit('close')"></div> <div class="modal-background" @click="$emit('close')"></div>
<div class="modal-card"> <div class="modal-content fd-modal-card">
<section class="modal-card-body"> <div class="card">
<form v-on:submit.prevent="add_stream"> <div class="card-content">
<div class="field"> <p class="title is-4">
<p class="control is-expanded has-icons-left"> Add stream URL
<input class="input is-rounded is-shadowless" type="text" placeholder="URL stream" v-model="url" ref="url_field"> </p>
<span class="icon is-left"> <form v-on:submit.prevent="play" class="fd-has-margin-bottom">
<i class="mdi mdi-file-music"></i> <div class="field">
</span> <p class="control is-expanded has-icons-left">
</p> <input class="input is-shadowless" type="text" placeholder="http://url-to-stream" v-model="url" :disabled="loading" ref="url_field">
</div> <span class="icon is-left">
</form> <i class="mdi mdi-web"></i>
</section> </span>
<footer class="modal-card-foot"> </p>
<button class="button is-success" @click="add_stream" :disabled="url.length < 9">Add</button> </div>
<button class="button" @click="$emit('close')">Cancel</button> </form>
</footer> </div>
<footer class="card-footer" v-if="loading">
<a class="card-footer-item has-text-dark">
<span class="icon"><i class="mdi mdi-web"></i></span> <span class="is-size-7">Loading ...</span>
</a>
</footer>
<footer class="card-footer" v-else>
<a class="card-footer-item has-text-danger" @click="$emit('close')">
<span class="icon"><i class="mdi mdi-cancel"></i></span> <span class="is-size-7">Cancel</span>
</a>
<a class="card-footer-item has-text-dark" @click="add_stream">
<span class="icon"><i class="mdi mdi-playlist-plus"></i></span> <span class="is-size-7">Add</span>
</a>
<a class="card-footer-item has-background-info has-text-white has-text-weight-bold" @click="play">
<span class="icon"><i class="mdi mdi-play"></i></span> <span class="is-size-7">Play</span>
</a>
</footer>
</div>
</div> </div>
<button class="modal-close is-large" aria-label="close" @click="$emit('close')"></button> <button class="modal-close is-large" aria-label="close" @click="$emit('close')"></button>
</div> </div>
@ -36,15 +53,43 @@ export default {
data () { data () {
return { return {
url: '' url: '',
loading: false
} }
}, },
methods: { methods: {
add_stream: function () { add_stream: function () {
this.$emit('close') this.loading = true
webapi.queue_add(this.url) webapi.queue_add(this.url).then(() => {
this.url = '' this.$emit('close')
this.url = ''
}).catch(() => {
this.loading = false
})
},
play: function () {
this.loading = true
webapi.player_play_uri(this.url, false).then(() => {
this.$emit('close')
this.url = ''
}).catch(() => {
this.loading = false
})
}
},
watch: {
'show' () {
if (this.show) {
this.loading = false
// We need to delay setting the focus to the input field until the field is part of the dom and visible
setTimeout(() => {
this.$refs.url_field.focus()
}, 10)
}
} }
} }
} }

View File

@ -12,11 +12,11 @@
</span> </span>
<span>Hide previous</span> <span>Hide previous</span>
</a> </a>
<a class="button is-small" @click="add_stream_dialog"> <a class="button is-small" @click="open_add_stream_dialog">
<span class="icon"> <span class="icon">
<i class="mdi mdi-web"></i> <i class="mdi mdi-web"></i>
</span> </span>
<span>Add URL Stream</span> <span>Add Stream</span>
</a> </a>
<!-- <!--
<a class="button" :class="{ 'is-info': edit_mode }" @click="edit_mode = !edit_mode"> <a class="button" :class="{ 'is-info': edit_mode }" @click="edit_mode = !edit_mode">
@ -133,7 +133,7 @@ export default {
this.show_details_modal = true this.show_details_modal = true
}, },
add_stream_dialog: function (item) { open_add_stream_dialog: function (item) {
this.show_url_modal = true this.show_url_modal = true
} }
} }