Update: Do not show playlists/collections in Library select in UI edit if there are none

pull/30/head
Juraj Nyíri 3 years ago
parent 8dfbb9aec5
commit 1581cee47e

@ -19998,14 +19998,18 @@ class PlexMeetsHomeAssistantEditor extends HTMLElement {
lodash.forEach(this.sections, (section) => {
libraryItems.appendChild(addDropdownItem(section.title));
});
libraryItems.appendChild(addDropdownItem('Collections', true));
lodash.forEach(this.collections, (collection) => {
libraryItems.appendChild(addDropdownItem(collection.title));
});
libraryItems.appendChild(addDropdownItem('Playlists', true));
lodash.forEach(this.playlists, (playlist) => {
libraryItems.appendChild(addDropdownItem(playlist.title));
});
if (!lodash.isEmpty(this.collections)) {
libraryItems.appendChild(addDropdownItem('Collections', true));
lodash.forEach(this.collections, (collection) => {
libraryItems.appendChild(addDropdownItem(collection.title));
});
}
if (!lodash.isEmpty(this.playlists)) {
libraryItems.appendChild(addDropdownItem('Playlists', true));
lodash.forEach(this.playlists, (playlist) => {
libraryItems.appendChild(addDropdownItem(playlist.title));
});
}
this.libraryName.disabled = false;
this.libraryName.value = this.config.libraryName;
let libraryType = '';

@ -497,14 +497,19 @@ class PlexMeetsHomeAssistantEditor extends HTMLElement {
_.forEach(this.sections, (section: Record<string, any>) => {
libraryItems.appendChild(addDropdownItem(section.title));
});
libraryItems.appendChild(addDropdownItem('Collections', true));
_.forEach(this.collections, (collection: Record<string, any>) => {
libraryItems.appendChild(addDropdownItem(collection.title));
});
libraryItems.appendChild(addDropdownItem('Playlists', true));
_.forEach(this.playlists, (playlist: Record<string, any>) => {
libraryItems.appendChild(addDropdownItem(playlist.title));
});
if (!_.isEmpty(this.collections)) {
libraryItems.appendChild(addDropdownItem('Collections', true));
_.forEach(this.collections, (collection: Record<string, any>) => {
libraryItems.appendChild(addDropdownItem(collection.title));
});
}
if (!_.isEmpty(this.playlists)) {
libraryItems.appendChild(addDropdownItem('Playlists', true));
_.forEach(this.playlists, (playlist: Record<string, any>) => {
libraryItems.appendChild(addDropdownItem(playlist.title));
});
}
this.libraryName.disabled = false;
this.libraryName.value = this.config.libraryName;

Loading…
Cancel
Save