diff --git a/dist/plex-meets-homeassistant.js b/dist/plex-meets-homeassistant.js index 245e13f..e19d22f 100644 --- a/dist/plex-meets-homeassistant.js +++ b/dist/plex-meets-homeassistant.js @@ -19486,7 +19486,11 @@ class PlexMeetsHomeAssistantEditor extends HTMLElement { } if (!lodash.isEmpty(this.libraryName.value)) { this.config.libraryName = this.libraryName.value; - this.config.sort = `${this.sort.value}:${this.sortOrder.value}`; + let sortOrderValue = 'asc'; + if (lodash.isEqual(this.sortOrder.value, 'Descending')) { + sortOrderValue = 'desc'; + } + this.config.sort = `${this.sort.value}:${sortOrderValue}`; if (lodash.isEmpty(this.maxCount.value)) { this.config.maxCount = ''; } @@ -19649,23 +19653,26 @@ class PlexMeetsHomeAssistantEditor extends HTMLElement { this.plexValidSection.appendChild(this.sort); this.sortOrder.innerHTML = ''; const sortOrderItems = document.createElement('paper-listbox'); - sortOrderItems.appendChild(addDropdownItem('asc')); - sortOrderItems.appendChild(addDropdownItem('desc')); + sortOrderItems.appendChild(addDropdownItem('Ascending')); + sortOrderItems.appendChild(addDropdownItem('Descending')); sortOrderItems.slot = 'dropdown-content'; this.sortOrder.label = 'Sort Order'; this.sortOrder.appendChild(sortOrderItems); this.sortOrder.style.width = '100%'; this.sortOrder.addEventListener('value-changed', this.valueUpdated); if (lodash.isEmpty(this.config.sort)) { - this.sortOrder.value = 'asc'; + this.sortOrder.value = 'Ascending'; } else { const sortOrder = this.config.sort.split(':')[1]; if (lodash.isEmpty(sortOrder)) { - this.sortOrder.value = 'asc'; + this.sortOrder.value = 'Ascending'; } - else { - this.sortOrder.value = sortOrder; + else if (lodash.isEqual(sortOrder, 'asc')) { + this.sortOrder.value = 'Ascending'; + } + else if (lodash.isEqual(sortOrder, 'desc')) { + this.sortOrder.value = 'Descending'; } } this.plexValidSection.appendChild(this.sortOrder); diff --git a/src/editor.ts b/src/editor.ts index f39d83a..15be2cc 100644 --- a/src/editor.ts +++ b/src/editor.ts @@ -79,7 +79,11 @@ class PlexMeetsHomeAssistantEditor extends HTMLElement { if (!_.isEmpty(this.libraryName.value)) { this.config.libraryName = this.libraryName.value; - this.config.sort = `${this.sort.value}:${this.sortOrder.value}`; + let sortOrderValue = 'asc'; + if (_.isEqual(this.sortOrder.value, 'Descending')) { + sortOrderValue = 'desc'; + } + this.config.sort = `${this.sort.value}:${sortOrderValue}`; if (_.isEmpty(this.maxCount.value)) { this.config.maxCount = ''; } else { @@ -256,21 +260,23 @@ class PlexMeetsHomeAssistantEditor extends HTMLElement { this.sortOrder.innerHTML = ''; const sortOrderItems: any = document.createElement('paper-listbox'); - sortOrderItems.appendChild(addDropdownItem('asc')); - sortOrderItems.appendChild(addDropdownItem('desc')); + sortOrderItems.appendChild(addDropdownItem('Ascending')); + sortOrderItems.appendChild(addDropdownItem('Descending')); sortOrderItems.slot = 'dropdown-content'; this.sortOrder.label = 'Sort Order'; this.sortOrder.appendChild(sortOrderItems); this.sortOrder.style.width = '100%'; this.sortOrder.addEventListener('value-changed', this.valueUpdated); if (_.isEmpty(this.config.sort)) { - this.sortOrder.value = 'asc'; + this.sortOrder.value = 'Ascending'; } else { const sortOrder = this.config.sort.split(':')[1]; if (_.isEmpty(sortOrder)) { - this.sortOrder.value = 'asc'; - } else { - this.sortOrder.value = sortOrder; + this.sortOrder.value = 'Ascending'; + } else if (_.isEqual(sortOrder, 'asc')) { + this.sortOrder.value = 'Ascending'; + } else if (_.isEqual(sortOrder, 'desc')) { + this.sortOrder.value = 'Descending'; } } this.plexValidSection.appendChild(this.sortOrder);