2.0
Juraj Nyíri 3 years ago
parent ab60645c52
commit 0dc051fac1

@ -19659,6 +19659,20 @@ class PlexMeetsHomeAssistantEditor extends HTMLElement {
} }
} }
this.plexValidSection.appendChild(this.sortOrder); this.plexValidSection.appendChild(this.sortOrder);
let hasUIConfig = true;
if (lodash.isArray(this.config.entity)) {
// eslint-disable-next-line consistent-return
lodash.forEach(this.config.entity, entity => {
if (lodash.isObjectLike(entity)) {
hasUIConfig = false;
return false;
}
});
}
else if (lodash.isObjectLike(this.config.entity)) {
hasUIConfig = false;
}
if (hasUIConfig) {
const devicesTitle = document.createElement('h2'); const devicesTitle = document.createElement('h2');
devicesTitle.innerHTML = `Devices Configuration`; devicesTitle.innerHTML = `Devices Configuration`;
devicesTitle.style.lineHeight = '29px'; devicesTitle.style.lineHeight = '29px';
@ -19690,6 +19704,7 @@ class PlexMeetsHomeAssistantEditor extends HTMLElement {
} }
}); });
} }
}
if (!lodash.isEmpty(this.sections)) { if (!lodash.isEmpty(this.sections)) {
lodash.forEach(this.sections, (section) => { lodash.forEach(this.sections, (section) => {
libraryItems.appendChild(addDropdownItem(section.title)); libraryItems.appendChild(addDropdownItem(section.title));

@ -266,6 +266,20 @@ class PlexMeetsHomeAssistantEditor extends HTMLElement {
} }
this.plexValidSection.appendChild(this.sortOrder); this.plexValidSection.appendChild(this.sortOrder);
let hasUIConfig = true;
if (_.isArray(this.config.entity)) {
// eslint-disable-next-line consistent-return
_.forEach(this.config.entity, entity => {
if (_.isObjectLike(entity)) {
hasUIConfig = false;
return false;
}
});
} else if (_.isObjectLike(this.config.entity)) {
hasUIConfig = false;
}
if (hasUIConfig) {
const devicesTitle = document.createElement('h2'); const devicesTitle = document.createElement('h2');
devicesTitle.innerHTML = `Devices Configuration`; devicesTitle.innerHTML = `Devices Configuration`;
devicesTitle.style.lineHeight = '29px'; devicesTitle.style.lineHeight = '29px';
@ -299,6 +313,8 @@ class PlexMeetsHomeAssistantEditor extends HTMLElement {
} }
}); });
} }
}
if (!_.isEmpty(this.sections)) { if (!_.isEmpty(this.sections)) {
_.forEach(this.sections, (section: Record<string, any>) => { _.forEach(this.sections, (section: Record<string, any>) => {
libraryItems.appendChild(addDropdownItem(section.title)); libraryItems.appendChild(addDropdownItem(section.title));

Loading…
Cancel
Save