2.0
Juraj Nyíri 3 years ago
parent e403f7acc9
commit 109020b90a

@ -19458,6 +19458,7 @@ class PlexMeetsHomeAssistantEditor extends HTMLElement {
this.sortOrder = document.createElement('paper-dropdown-menu'); this.sortOrder = document.createElement('paper-dropdown-menu');
this.playTrailer = document.createElement('paper-dropdown-menu'); this.playTrailer = document.createElement('paper-dropdown-menu');
this.showExtras = document.createElement('paper-dropdown-menu'); this.showExtras = document.createElement('paper-dropdown-menu');
this.showSearch = document.createElement('paper-dropdown-menu');
this.devicesTabs = 0; this.devicesTabs = 0;
this.entities = []; this.entities = [];
this.sections = []; this.sections = [];
@ -19520,6 +19521,12 @@ class PlexMeetsHomeAssistantEditor extends HTMLElement {
else if (lodash.isEqual(this.showExtras.value, 'No')) { else if (lodash.isEqual(this.showExtras.value, 'No')) {
this.config.showExtras = false; this.config.showExtras = false;
} }
if (lodash.isEqual(this.showSearch.value, 'Yes')) {
this.config.showSearch = true;
}
else if (lodash.isEqual(this.showSearch.value, 'No')) {
this.config.showSearch = false;
}
} }
if (!lodash.isEqual(this.config, originalConfig)) { if (!lodash.isEqual(this.config, originalConfig)) {
this.fireEvent(this, 'config-changed', { config: this.config }); this.fireEvent(this, 'config-changed', { config: this.config });
@ -19713,6 +19720,21 @@ class PlexMeetsHomeAssistantEditor extends HTMLElement {
} }
this.showExtras.value = showExtrasValue; this.showExtras.value = showExtrasValue;
this.plexValidSection.appendChild(this.showExtras); this.plexValidSection.appendChild(this.showExtras);
this.showSearch.innerHTML = '';
const showSearchItems = document.createElement('paper-listbox');
showSearchItems.appendChild(addDropdownItem('Yes'));
showSearchItems.appendChild(addDropdownItem('No'));
showSearchItems.slot = 'dropdown-content';
this.showSearch.label = 'Show Search';
this.showSearch.appendChild(showSearchItems);
this.showSearch.style.width = '100%';
this.showSearch.addEventListener('value-changed', this.valueUpdated);
let showSearchValue = 'Yes';
if (!this.config.showSearch) {
showSearchValue = 'No';
}
this.showSearch.value = showSearchValue;
this.plexValidSection.appendChild(this.showSearch);
let hasUIConfig = true; let hasUIConfig = true;
let canConvert = true; let canConvert = true;
if (lodash.isArray(this.config.entity)) { if (lodash.isArray(this.config.entity)) {
@ -19822,13 +19844,17 @@ class PlexMeetsHomeAssistantEditor extends HTMLElement {
this.config.playTrailer = true; this.config.playTrailer = true;
} }
if (!lodash.isNil(config.showExtras)) { if (!lodash.isNil(config.showExtras)) {
console.log('A');
this.config.showExtras = config.showExtras; this.config.showExtras = config.showExtras;
} }
else { else {
console.log('B');
this.config.showExtras = true; this.config.showExtras = true;
} }
if (!lodash.isNil(config.showSearch)) {
this.config.showSearch = config.showSearch;
}
else {
this.config.showSearch = true;
}
this.render(); this.render();
}; };
this.configChanged = (newConfig) => { this.configChanged = (newConfig) => {
@ -20568,6 +20594,7 @@ class PlexMeetsHomeAssistant extends HTMLElement {
this.runBefore = ''; this.runBefore = '';
this.playTrailer = true; this.playTrailer = true;
this.showExtras = true; this.showExtras = true;
this.showSearch = true;
this.previousPageWidth = 0; this.previousPageWidth = 0;
this.runAfter = ''; this.runAfter = '';
this.columnsCount = 0; this.columnsCount = 0;
@ -20795,7 +20822,6 @@ class PlexMeetsHomeAssistant extends HTMLElement {
this.render(); this.render();
} }
else { else {
console.log('RETRY');
setTimeout(() => { setTimeout(() => {
this.renderInitialData(); this.renderInitialData();
}, 250); }, 250);
@ -20887,6 +20913,12 @@ class PlexMeetsHomeAssistant extends HTMLElement {
}; };
this.renderPage = () => { this.renderPage = () => {
this.searchInputElem.placeholder = `Search ${this.config.libraryName}...`; this.searchInputElem.placeholder = `Search ${this.config.libraryName}...`;
if (this.showSearch) {
this.searchInputElem.style.display = 'block';
}
else {
this.searchInputElem.style.display = 'none';
}
if (this.card) { if (this.card) {
const marginRight = 10; // needs to be equal to .container margin right const marginRight = 10; // needs to be equal to .container margin right
const areaSize = this.card.offsetWidth - parseInt(this.card.style.paddingRight, 10) - parseInt(this.card.style.paddingLeft, 10); const areaSize = this.card.offsetWidth - parseInt(this.card.style.paddingRight, 10) - parseInt(this.card.style.paddingLeft, 10);
@ -20914,6 +20946,12 @@ class PlexMeetsHomeAssistant extends HTMLElement {
this.card.style.padding = '16px'; this.card.style.padding = '16px';
this.card.style.paddingRight = '6px'; this.card.style.paddingRight = '6px';
this.card.appendChild(this.searchInput()); this.card.appendChild(this.searchInput());
if (this.showSearch) {
this.searchInputElem.style.display = 'block';
}
else {
this.searchInputElem.style.display = 'none';
}
this.appendChild(this.card); this.appendChild(this.card);
} }
this.content = document.createElement('div'); this.content = document.createElement('div');
@ -21878,6 +21916,9 @@ class PlexMeetsHomeAssistant extends HTMLElement {
if (!lodash.isNil(config.showExtras)) { if (!lodash.isNil(config.showExtras)) {
this.showExtras = config.showExtras; this.showExtras = config.showExtras;
} }
if (!lodash.isNil(config.showSearch)) {
this.showSearch = config.showSearch;
}
this.plex = new Plex(this.config.ip, this.plexPort, this.config.token, this.plexProtocol, this.config.sort); this.plex = new Plex(this.config.ip, this.plexPort, this.config.token, this.plexProtocol, this.config.sort);
this.data = {}; this.data = {};
this.error = ''; this.error = '';

@ -38,6 +38,8 @@ class PlexMeetsHomeAssistantEditor extends HTMLElement {
showExtras: any = document.createElement('paper-dropdown-menu'); showExtras: any = document.createElement('paper-dropdown-menu');
showSearch: any = document.createElement('paper-dropdown-menu');
devicesTabs = 0; devicesTabs = 0;
hassObj: HomeAssistant | undefined; hassObj: HomeAssistant | undefined;
@ -111,6 +113,11 @@ class PlexMeetsHomeAssistantEditor extends HTMLElement {
} else if (_.isEqual(this.showExtras.value, 'No')) { } else if (_.isEqual(this.showExtras.value, 'No')) {
this.config.showExtras = false; this.config.showExtras = false;
} }
if (_.isEqual(this.showSearch.value, 'Yes')) {
this.config.showSearch = true;
} else if (_.isEqual(this.showSearch.value, 'No')) {
this.config.showSearch = false;
}
} }
if (!_.isEqual(this.config, originalConfig)) { if (!_.isEqual(this.config, originalConfig)) {
this.fireEvent(this, 'config-changed', { config: this.config }); this.fireEvent(this, 'config-changed', { config: this.config });
@ -319,6 +326,22 @@ class PlexMeetsHomeAssistantEditor extends HTMLElement {
this.showExtras.value = showExtrasValue; this.showExtras.value = showExtrasValue;
this.plexValidSection.appendChild(this.showExtras); this.plexValidSection.appendChild(this.showExtras);
this.showSearch.innerHTML = '';
const showSearchItems: any = document.createElement('paper-listbox');
showSearchItems.appendChild(addDropdownItem('Yes'));
showSearchItems.appendChild(addDropdownItem('No'));
showSearchItems.slot = 'dropdown-content';
this.showSearch.label = 'Show Search';
this.showSearch.appendChild(showSearchItems);
this.showSearch.style.width = '100%';
this.showSearch.addEventListener('value-changed', this.valueUpdated);
let showSearchValue = 'Yes';
if (!this.config.showSearch) {
showSearchValue = 'No';
}
this.showSearch.value = showSearchValue;
this.plexValidSection.appendChild(this.showSearch);
let hasUIConfig = true; let hasUIConfig = true;
let canConvert = true; let canConvert = true;
if (_.isArray(this.config.entity)) { if (_.isArray(this.config.entity)) {
@ -431,13 +454,17 @@ class PlexMeetsHomeAssistantEditor extends HTMLElement {
} }
if (!_.isNil(config.showExtras)) { if (!_.isNil(config.showExtras)) {
console.log('A');
this.config.showExtras = config.showExtras; this.config.showExtras = config.showExtras;
} else { } else {
console.log('B');
this.config.showExtras = true; this.config.showExtras = true;
} }
if (!_.isNil(config.showSearch)) {
this.config.showSearch = config.showSearch;
} else {
this.config.showSearch = true;
}
this.render(); this.render();
}; };

@ -45,6 +45,8 @@ class PlexMeetsHomeAssistant extends HTMLElement {
showExtras = true; showExtras = true;
showSearch = true;
previousPageWidth = 0; previousPageWidth = 0;
runAfter = ''; runAfter = '';
@ -355,7 +357,6 @@ class PlexMeetsHomeAssistant extends HTMLElement {
this.loading = false; this.loading = false;
this.render(); this.render();
} else { } else {
console.log('RETRY');
setTimeout(() => { setTimeout(() => {
this.renderInitialData(); this.renderInitialData();
}, 250); }, 250);
@ -459,6 +460,12 @@ class PlexMeetsHomeAssistant extends HTMLElement {
renderPage = (): void => { renderPage = (): void => {
this.searchInputElem.placeholder = `Search ${this.config.libraryName}...`; this.searchInputElem.placeholder = `Search ${this.config.libraryName}...`;
if (this.showSearch) {
this.searchInputElem.style.display = 'block';
} else {
this.searchInputElem.style.display = 'none';
}
if (this.card) { if (this.card) {
const marginRight = 10; // needs to be equal to .container margin right const marginRight = 10; // needs to be equal to .container margin right
const areaSize = const areaSize =
@ -490,7 +497,14 @@ class PlexMeetsHomeAssistant extends HTMLElement {
this.card.style.overflow = 'hidden'; this.card.style.overflow = 'hidden';
this.card.style.padding = '16px'; this.card.style.padding = '16px';
this.card.style.paddingRight = '6px'; this.card.style.paddingRight = '6px';
this.card.appendChild(this.searchInput()); this.card.appendChild(this.searchInput());
if (this.showSearch) {
this.searchInputElem.style.display = 'block';
} else {
this.searchInputElem.style.display = 'none';
}
this.appendChild(this.card); this.appendChild(this.card);
} }
@ -1549,6 +1563,9 @@ class PlexMeetsHomeAssistant extends HTMLElement {
if (!_.isNil(config.showExtras)) { if (!_.isNil(config.showExtras)) {
this.showExtras = config.showExtras; this.showExtras = config.showExtras;
} }
if (!_.isNil(config.showSearch)) {
this.showSearch = config.showSearch;
}
this.plex = new Plex(this.config.ip, this.plexPort, this.config.token, this.plexProtocol, this.config.sort); this.plex = new Plex(this.config.ip, this.plexPort, this.config.token, this.plexProtocol, this.config.sort);
this.data = {}; this.data = {};

Loading…
Cancel
Save