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) => { lodash.forEach(this.sections, (section) => {
libraryItems.appendChild(addDropdownItem(section.title)); libraryItems.appendChild(addDropdownItem(section.title));
}); });
libraryItems.appendChild(addDropdownItem('Collections', true)); if (!lodash.isEmpty(this.collections)) {
lodash.forEach(this.collections, (collection) => { libraryItems.appendChild(addDropdownItem('Collections', true));
libraryItems.appendChild(addDropdownItem(collection.title)); 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.playlists)) {
}); libraryItems.appendChild(addDropdownItem('Playlists', true));
lodash.forEach(this.playlists, (playlist) => {
libraryItems.appendChild(addDropdownItem(playlist.title));
});
}
this.libraryName.disabled = false; this.libraryName.disabled = false;
this.libraryName.value = this.config.libraryName; this.libraryName.value = this.config.libraryName;
let libraryType = ''; let libraryType = '';

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

Loading…
Cancel
Save