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.playTrailer = document.createElement('paper-dropdown-menu');
this.showExtras = document.createElement('paper-dropdown-menu');
this.showSearch = document.createElement('paper-dropdown-menu');
this.devicesTabs = 0;
this.entities = [];
this.sections = [];
@ -19520,6 +19521,12 @@ class PlexMeetsHomeAssistantEditor extends HTMLElement {
else if (lodash.isEqual(this.showExtras.value, 'No')) {
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)) {
this.fireEvent(this, 'config-changed', { config: this.config });
@ -19713,6 +19720,21 @@ class PlexMeetsHomeAssistantEditor extends HTMLElement {
}
this.showExtras.value = showExtrasValue;
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 canConvert = true;
if (lodash.isArray(this.config.entity)) {
@ -19822,13 +19844,17 @@ class PlexMeetsHomeAssistantEditor extends HTMLElement {
this.config.playTrailer = true;
}
if (!lodash.isNil(config.showExtras)) {
console.log('A');
this.config.showExtras = config.showExtras;
}
else {
console.log('B');
this.config.showExtras = true;
}
if (!lodash.isNil(config.showSearch)) {
this.config.showSearch = config.showSearch;
}
else {
this.config.showSearch = true;
}
this.render();
};
this.configChanged = (newConfig) => {
@ -20568,6 +20594,7 @@ class PlexMeetsHomeAssistant extends HTMLElement {
this.runBefore = '';
this.playTrailer = true;
this.showExtras = true;
this.showSearch = true;
this.previousPageWidth = 0;
this.runAfter = '';
this.columnsCount = 0;
@ -20795,7 +20822,6 @@ class PlexMeetsHomeAssistant extends HTMLElement {
this.render();
}
else {
console.log('RETRY');
setTimeout(() => {
this.renderInitialData();
}, 250);
@ -20887,6 +20913,12 @@ class PlexMeetsHomeAssistant extends HTMLElement {
};
this.renderPage = () => {
this.searchInputElem.placeholder = `Search ${this.config.libraryName}...`;
if (this.showSearch) {
this.searchInputElem.style.display = 'block';
}
else {
this.searchInputElem.style.display = 'none';
}
if (this.card) {
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);
@ -20914,6 +20946,12 @@ class PlexMeetsHomeAssistant extends HTMLElement {
this.card.style.padding = '16px';
this.card.style.paddingRight = '6px';
this.card.appendChild(this.searchInput());
if (this.showSearch) {
this.searchInputElem.style.display = 'block';
}
else {
this.searchInputElem.style.display = 'none';
}
this.appendChild(this.card);
}
this.content = document.createElement('div');
@ -21878,6 +21916,9 @@ class PlexMeetsHomeAssistant extends HTMLElement {
if (!lodash.isNil(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.data = {};
this.error = '';

@ -38,6 +38,8 @@ class PlexMeetsHomeAssistantEditor extends HTMLElement {
showExtras: any = document.createElement('paper-dropdown-menu');
showSearch: any = document.createElement('paper-dropdown-menu');
devicesTabs = 0;
hassObj: HomeAssistant | undefined;
@ -111,6 +113,11 @@ class PlexMeetsHomeAssistantEditor extends HTMLElement {
} else if (_.isEqual(this.showExtras.value, 'No')) {
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)) {
this.fireEvent(this, 'config-changed', { config: this.config });
@ -319,6 +326,22 @@ class PlexMeetsHomeAssistantEditor extends HTMLElement {
this.showExtras.value = showExtrasValue;
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 canConvert = true;
if (_.isArray(this.config.entity)) {
@ -431,13 +454,17 @@ class PlexMeetsHomeAssistantEditor extends HTMLElement {
}
if (!_.isNil(config.showExtras)) {
console.log('A');
this.config.showExtras = config.showExtras;
} else {
console.log('B');
this.config.showExtras = true;
}
if (!_.isNil(config.showSearch)) {
this.config.showSearch = config.showSearch;
} else {
this.config.showSearch = true;
}
this.render();
};

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

Loading…
Cancel
Save