|
|
@ -19451,6 +19451,7 @@ class PlexMeetsHomeAssistantEditor extends HTMLElement {
|
|
|
|
this.ip = document.createElement('paper-input');
|
|
|
|
this.ip = document.createElement('paper-input');
|
|
|
|
this.token = document.createElement('paper-input');
|
|
|
|
this.token = document.createElement('paper-input');
|
|
|
|
this.port = document.createElement('paper-input');
|
|
|
|
this.port = document.createElement('paper-input');
|
|
|
|
|
|
|
|
this.maxCount = document.createElement('paper-input');
|
|
|
|
this.libraryName = document.createElement('paper-dropdown-menu');
|
|
|
|
this.libraryName = document.createElement('paper-dropdown-menu');
|
|
|
|
this.tabs = document.createElement('paper-tabs');
|
|
|
|
this.tabs = document.createElement('paper-tabs');
|
|
|
|
this.devicesTabs = 0;
|
|
|
|
this.devicesTabs = 0;
|
|
|
@ -19476,6 +19477,12 @@ class PlexMeetsHomeAssistantEditor extends HTMLElement {
|
|
|
|
this.config.token = this.token.value;
|
|
|
|
this.config.token = this.token.value;
|
|
|
|
this.config.port = this.port.value;
|
|
|
|
this.config.port = this.port.value;
|
|
|
|
this.config.libraryName = this.libraryName.value;
|
|
|
|
this.config.libraryName = this.libraryName.value;
|
|
|
|
|
|
|
|
if (lodash.isEmpty(this.maxCount.value)) {
|
|
|
|
|
|
|
|
this.config.maxCount = '';
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else {
|
|
|
|
|
|
|
|
this.config.maxCount = parseInt(this.maxCount.value, 10);
|
|
|
|
|
|
|
|
}
|
|
|
|
if (!lodash.isEmpty(this.entities)) {
|
|
|
|
if (!lodash.isEmpty(this.entities)) {
|
|
|
|
this.config.entity = [];
|
|
|
|
this.config.entity = [];
|
|
|
|
lodash.forEach(this.entities, entity => {
|
|
|
|
lodash.forEach(this.entities, entity => {
|
|
|
@ -19542,6 +19549,11 @@ class PlexMeetsHomeAssistantEditor extends HTMLElement {
|
|
|
|
this.port.type = 'number';
|
|
|
|
this.port.type = 'number';
|
|
|
|
this.port.addEventListener('change', this.valueUpdated);
|
|
|
|
this.port.addEventListener('change', this.valueUpdated);
|
|
|
|
this.content.appendChild(this.port);
|
|
|
|
this.content.appendChild(this.port);
|
|
|
|
|
|
|
|
this.maxCount.label = 'Maximum number of items to display';
|
|
|
|
|
|
|
|
this.maxCount.value = this.config.maxCount;
|
|
|
|
|
|
|
|
this.maxCount.type = 'number';
|
|
|
|
|
|
|
|
this.maxCount.addEventListener('change', this.valueUpdated);
|
|
|
|
|
|
|
|
this.content.appendChild(this.maxCount);
|
|
|
|
this.libraryName.innerHTML = '';
|
|
|
|
this.libraryName.innerHTML = '';
|
|
|
|
const libraryItems = document.createElement('paper-listbox');
|
|
|
|
const libraryItems = document.createElement('paper-listbox');
|
|
|
|
libraryItems.appendChild(addDropdownItem('Continue Watching'));
|
|
|
|
libraryItems.appendChild(addDropdownItem('Continue Watching'));
|
|
|
@ -20376,6 +20388,7 @@ class PlexMeetsHomeAssistant extends HTMLElement {
|
|
|
|
this.maxCount = false;
|
|
|
|
this.maxCount = false;
|
|
|
|
this.error = '';
|
|
|
|
this.error = '';
|
|
|
|
this.contentBGHeight = 0;
|
|
|
|
this.contentBGHeight = 0;
|
|
|
|
|
|
|
|
this.initialDataLoaded = false;
|
|
|
|
this.renderNewElementsIfNeeded = () => {
|
|
|
|
this.renderNewElementsIfNeeded = () => {
|
|
|
|
const loadAdditionalRowsCount = 2; // todo: make this configurable
|
|
|
|
const loadAdditionalRowsCount = 2; // todo: make this configurable
|
|
|
|
const height = getHeight(this.content);
|
|
|
|
const height = getHeight(this.content);
|
|
|
@ -20453,8 +20466,8 @@ class PlexMeetsHomeAssistant extends HTMLElement {
|
|
|
|
if (this.card) {
|
|
|
|
if (this.card) {
|
|
|
|
this.previousPageWidth = this.card.offsetWidth;
|
|
|
|
this.previousPageWidth = this.card.offsetWidth;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
this.renderInitialData();
|
|
|
|
|
|
|
|
this.resizeBackground();
|
|
|
|
this.resizeBackground();
|
|
|
|
|
|
|
|
this.initialDataLoaded = true;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
this.renderInitialData = async () => {
|
|
|
|
this.renderInitialData = async () => {
|
|
|
|
let { entity } = JSON.parse(JSON.stringify(this.config));
|
|
|
|
let { entity } = JSON.parse(JSON.stringify(this.config));
|
|
|
@ -21595,7 +21608,6 @@ class PlexMeetsHomeAssistant extends HTMLElement {
|
|
|
|
return playButton;
|
|
|
|
return playButton;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
this.setConfig = (config) => {
|
|
|
|
this.setConfig = (config) => {
|
|
|
|
console.log('setConfig from main');
|
|
|
|
|
|
|
|
this.plexProtocol = 'http';
|
|
|
|
this.plexProtocol = 'http';
|
|
|
|
if (!config.entity || config.entity.length === 0) {
|
|
|
|
if (!config.entity || config.entity.length === 0) {
|
|
|
|
throw new Error('You need to define at least one entity');
|
|
|
|
throw new Error('You need to define at least one entity');
|
|
|
@ -21632,7 +21644,7 @@ class PlexMeetsHomeAssistant extends HTMLElement {
|
|
|
|
if (config.port) {
|
|
|
|
if (config.port) {
|
|
|
|
this.plexPort = config.port;
|
|
|
|
this.plexPort = config.port;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (config.maxCount) {
|
|
|
|
if (config.maxCount && config.maxCount !== '') {
|
|
|
|
this.maxCount = config.maxCount;
|
|
|
|
this.maxCount = config.maxCount;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (config.runBefore) {
|
|
|
|
if (config.runBefore) {
|
|
|
@ -21657,13 +21669,10 @@ class PlexMeetsHomeAssistant extends HTMLElement {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
set hass(hass) {
|
|
|
|
set hass(hass) {
|
|
|
|
this.hassObj = hass;
|
|
|
|
this.hassObj = hass;
|
|
|
|
if (!this.content) {
|
|
|
|
if (!this.initialDataLoaded) {
|
|
|
|
this.error = '';
|
|
|
|
|
|
|
|
if (!this.loading) {
|
|
|
|
|
|
|
|
this.loadInitialData();
|
|
|
|
this.loadInitialData();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static getConfigElement() {
|
|
|
|
static getConfigElement() {
|
|
|
|
return document.createElement('plex-meets-homeassistant-editor');
|
|
|
|
return document.createElement('plex-meets-homeassistant-editor');
|
|
|
|
}
|
|
|
|
}
|
|
|
|