@@ -38,26 +38,79 @@ export default {
type: String,
default: "Cancel",
},
+
+ visible: {
+ type: Boolean,
+ default: false,
+ },
+
+ value: {
+ type: String,
+ default: "",
+ },
+ },
+
+ data() {
+ return {
+ value_: "",
+ visible_: false,
+ }
},
methods: {
onConfirm() {
- this.$emit('input', this.$refs.input.value)
+ this.$emit('input', this.value_)
this.close()
},
- show() {
+ open() {
+ if (this.visible_)
+ return
+
+ this.value_ = this.value
this.$refs.modal.show()
+ this.visible_ = true
+ this.focus()
},
close() {
+ if (!this.visible_)
+ return
+
+ this.value_ = ""
this.$refs.modal.hide()
+ this.visible_ = false
+ },
+
+ show() {
+ this.open()
+ },
+
+ hide() {
+ this.close()
+ },
+
+ focus() {
+ this.$nextTick(() => {
+ this.$refs.input.focus()
+ })
+ },
+ },
+
+ watch: {
+ visible(val) {
+ if (val) {
+ this.open()
+ } else {
+ this.close()
+ }
},
},
mounted() {
+ this.visible_ = this.visible
+ this.value_ = this.value || ""
this.$nextTick(() => {
- this.$refs.input.value = ""
this.$refs.input.focus()
})
},
diff --git a/platypush/backend/http/webapp/src/components/panels/Media/Browser.vue b/platypush/backend/http/webapp/src/components/panels/Media/Browser.vue
index 5244b21ec6..291cc989eb 100644
--- a/platypush/backend/http/webapp/src/components/panels/Media/Browser.vue
+++ b/platypush/backend/http/webapp/src/components/panels/Media/Browser.vue
@@ -23,9 +23,11 @@
+ @play="$emit('play', $event)"
+ />
@@ -39,8 +41,17 @@ import Utils from "@/Utils";
import providersMetadata from "./Providers/meta.json";
export default {
- emits: ['path-change', 'play'],
mixins: [Utils],
+ emits: [
+ 'add-to-playlist',
+ 'create-playlist',
+ 'path-change',
+ 'play',
+ 'remove-from-playlist',
+ 'remove-playlist',
+ 'rename-playlist',
+ ],
+
components: {
Browser,
Loading,
diff --git a/platypush/backend/http/webapp/src/components/panels/Media/Index.vue b/platypush/backend/http/webapp/src/components/panels/Media/Index.vue
index 311d3bb186..364a330aff 100644
--- a/platypush/backend/http/webapp/src/components/panels/Media/Index.vue
+++ b/platypush/backend/http/webapp/src/components/panels/Media/Index.vue
@@ -39,6 +39,7 @@
:plugin-name="pluginName"
:loading="loading"
:filter="browserFilter"
+ @add-to-playlist="addToPlaylistItem = $event"
@select="onResultSelect($event)"
@play="play"
@view="view"
@@ -51,6 +52,7 @@
v-else-if="selectedView === 'torrents'" />
+ @add-to-playlist="$emit('add-to-playlist', $event)"
+ @play="$emit('play', $event)"
+ v-if="selectedView === 'feed'"
+ />
+
+ v-else-if="selectedView === 'playlists'"
+ />
+
+ v-else-if="selectedView === 'subscriptions'"
+ />
+
@@ -87,6 +97,21 @@ export default {
}
},
+ async removeFromPlaylist(event) {
+ const playlistId = event.playlist_id
+ const videoId = event.item.url
+ this.loading = true
+
+ try {
+ await this.request('youtube.remove_from_playlist', {
+ playlist_id: playlistId,
+ video_id: videoId,
+ })
+ } finally {
+ this.loading = false
+ }
+ },
+
selectView(view) {
this.selectedView = view
if (view === 'playlists')
diff --git a/platypush/backend/http/webapp/src/components/panels/Media/Providers/YouTube/Feed.vue b/platypush/backend/http/webapp/src/components/panels/Media/Providers/YouTube/Feed.vue
index eaadfda6ca..58793c622e 100644
--- a/platypush/backend/http/webapp/src/components/panels/Media/Providers/YouTube/Feed.vue
+++ b/platypush/backend/http/webapp/src/components/panels/Media/Providers/YouTube/Feed.vue
@@ -9,6 +9,7 @@
:filter="filter"
:sources="{'youtube': true}"
:selected-result="selectedResult"
+ @add-to-playlist="$emit('add-to-playlist', $event)"
@select="selectedResult = $event"
@play="$emit('play', $event)"
v-else />
@@ -22,8 +23,12 @@ import Results from "@/components/panels/Media/Results";
import Utils from "@/Utils";
export default {
- emits: ['play'],
mixins: [Utils],
+ emits: [
+ 'add-to-playlist',
+ 'play',
+ ],
+
components: {
Loading,
NoItems,
diff --git a/platypush/backend/http/webapp/src/components/panels/Media/Providers/YouTube/Playlist.vue b/platypush/backend/http/webapp/src/components/panels/Media/Providers/YouTube/Playlist.vue
index c09d0089af..4a70e42e0d 100644
--- a/platypush/backend/http/webapp/src/components/panels/Media/Providers/YouTube/Playlist.vue
+++ b/platypush/backend/http/webapp/src/components/panels/Media/Providers/YouTube/Playlist.vue
@@ -8,9 +8,12 @@