2.0
Juraj Nyíri 4 years ago
parent 0dc051fac1
commit 403c07ae0b

@ -19456,6 +19456,7 @@ class PlexMeetsHomeAssistantEditor extends HTMLElement {
this.tabs = document.createElement('paper-tabs');
this.sort = document.createElement('paper-dropdown-menu');
this.sortOrder = document.createElement('paper-dropdown-menu');
this.playTrailer = document.createElement('paper-dropdown-menu');
this.devicesTabs = 0;
this.entities = [];
this.sections = [];
@ -19500,6 +19501,15 @@ class PlexMeetsHomeAssistantEditor extends HTMLElement {
}
});
}
if (lodash.isEqual(this.playTrailer.value, 'Yes')) {
this.config.playTrailer = true;
}
else if (lodash.isEqual(this.playTrailer.value, 'No')) {
this.config.playTrailer = false;
}
else if (lodash.isEqual(this.playTrailer.value, 'Muted')) {
this.config.playTrailer = 'muted';
}
}
if (!lodash.isEqual(this.config, originalConfig)) {
console.log(this.config);
@ -19659,6 +19669,25 @@ class PlexMeetsHomeAssistantEditor extends HTMLElement {
}
}
this.plexValidSection.appendChild(this.sortOrder);
this.playTrailer.innerHTML = '';
const playTrailerItems = document.createElement('paper-listbox');
playTrailerItems.appendChild(addDropdownItem('Yes'));
playTrailerItems.appendChild(addDropdownItem('Muted'));
playTrailerItems.appendChild(addDropdownItem('No'));
playTrailerItems.slot = 'dropdown-content';
this.playTrailer.label = 'Play Trailer';
this.playTrailer.appendChild(playTrailerItems);
this.playTrailer.style.width = '100%';
this.playTrailer.addEventListener('value-changed', this.valueUpdated);
let playTrailerValue = 'Yes';
if (lodash.isEqual(this.config.playTrailer, 'muted')) {
playTrailerValue = 'Muted';
}
else if (!this.config.playTrailer) {
playTrailerValue = 'No';
}
this.playTrailer.value = playTrailerValue;
this.plexValidSection.appendChild(this.playTrailer);
let hasUIConfig = true;
if (lodash.isArray(this.config.entity)) {
// eslint-disable-next-line consistent-return
@ -19732,6 +19761,12 @@ class PlexMeetsHomeAssistantEditor extends HTMLElement {
if (!config.sort) {
this.config.sort = 'titleSort:asc';
}
if (!lodash.isNil(config.playTrailer)) {
this.config.playTrailer = config.playTrailer;
}
else {
this.config.playTrailer = true;
}
this.render();
};
this.configChanged = (newConfig) => {

@ -34,6 +34,8 @@ class PlexMeetsHomeAssistantEditor extends HTMLElement {
sortOrder: any = document.createElement('paper-dropdown-menu');
playTrailer: any = document.createElement('paper-dropdown-menu');
devicesTabs = 0;
hassObj: HomeAssistant | undefined;
@ -92,6 +94,13 @@ class PlexMeetsHomeAssistantEditor extends HTMLElement {
}
});
}
if (_.isEqual(this.playTrailer.value, 'Yes')) {
this.config.playTrailer = true;
} else if (_.isEqual(this.playTrailer.value, 'No')) {
this.config.playTrailer = false;
} else if (_.isEqual(this.playTrailer.value, 'Muted')) {
this.config.playTrailer = 'muted';
}
}
if (!_.isEqual(this.config, originalConfig)) {
console.log(this.config);
@ -266,6 +275,25 @@ class PlexMeetsHomeAssistantEditor extends HTMLElement {
}
this.plexValidSection.appendChild(this.sortOrder);
this.playTrailer.innerHTML = '';
const playTrailerItems: any = document.createElement('paper-listbox');
playTrailerItems.appendChild(addDropdownItem('Yes'));
playTrailerItems.appendChild(addDropdownItem('Muted'));
playTrailerItems.appendChild(addDropdownItem('No'));
playTrailerItems.slot = 'dropdown-content';
this.playTrailer.label = 'Play Trailer';
this.playTrailer.appendChild(playTrailerItems);
this.playTrailer.style.width = '100%';
this.playTrailer.addEventListener('value-changed', this.valueUpdated);
let playTrailerValue = 'Yes';
if (_.isEqual(this.config.playTrailer, 'muted')) {
playTrailerValue = 'Muted';
} else if (!this.config.playTrailer) {
playTrailerValue = 'No';
}
this.playTrailer.value = playTrailerValue;
this.plexValidSection.appendChild(this.playTrailer);
let hasUIConfig = true;
if (_.isArray(this.config.entity)) {
// eslint-disable-next-line consistent-return
@ -345,6 +373,12 @@ class PlexMeetsHomeAssistantEditor extends HTMLElement {
this.config.sort = 'titleSort:asc';
}
if (!_.isNil(config.playTrailer)) {
this.config.playTrailer = config.playTrailer;
} else {
this.config.playTrailer = true;
}
this.render();
};

Loading…
Cancel
Save