Add: Title option to UI editor

live_tv
Juraj Nyíri 3 years ago
parent 18370f09f0
commit 0a2d122c3d

@ -19571,6 +19571,7 @@ class PlexMeetsHomeAssistantEditor extends HTMLElement {
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.maxCount = document.createElement('paper-input');
this.cardTitle = document.createElement('paper-input');
this.libraryName = document.createElement('paper-dropdown-menu'); this.libraryName = document.createElement('paper-dropdown-menu');
this.protocol = document.createElement('paper-dropdown-menu'); this.protocol = document.createElement('paper-dropdown-menu');
this.tabs = document.createElement('paper-tabs'); this.tabs = document.createElement('paper-tabs');
@ -19635,6 +19636,12 @@ class PlexMeetsHomeAssistantEditor extends HTMLElement {
else { else {
this.config.maxCount = this.maxCount.value; this.config.maxCount = this.maxCount.value;
} }
if (lodash.isEmpty(this.cardTitle.value)) {
this.config.title = '';
}
else {
this.config.title = this.cardTitle.value;
}
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 => {
@ -19880,6 +19887,10 @@ class PlexMeetsHomeAssistantEditor extends HTMLElement {
viewTitle.style.marginBottom = '0px'; viewTitle.style.marginBottom = '0px';
viewTitle.style.marginTop = '20px'; viewTitle.style.marginTop = '20px';
this.plexValidSection.appendChild(viewTitle); this.plexValidSection.appendChild(viewTitle);
this.cardTitle.label = 'Card title';
this.cardTitle.value = this.config.title;
this.cardTitle.addEventListener('change', this.valueUpdated);
this.plexValidSection.appendChild(this.cardTitle);
this.maxCount.label = 'Maximum number of items to display'; this.maxCount.label = 'Maximum number of items to display';
this.maxCount.value = this.config.maxCount; this.maxCount.value = this.config.maxCount;
this.maxCount.type = 'number'; this.maxCount.type = 'number';
@ -20127,6 +20138,9 @@ class PlexMeetsHomeAssistantEditor extends HTMLElement {
if (!lodash.isNil(config.runAfter)) { if (!lodash.isNil(config.runAfter)) {
this.config.runAfter = config.runAfter; this.config.runAfter = config.runAfter;
} }
if (!lodash.isNil(config.title)) {
this.config.title = config.title;
}
if (lodash.isNumber(this.config.maxCount)) { if (lodash.isNumber(this.config.maxCount)) {
this.config.maxCount = `${this.config.maxCount}`; this.config.maxCount = `${this.config.maxCount}`;
} }

@ -24,6 +24,8 @@ class PlexMeetsHomeAssistantEditor extends HTMLElement {
maxCount: any = document.createElement('paper-input'); maxCount: any = document.createElement('paper-input');
cardTitle: any = document.createElement('paper-input');
libraryName: any = document.createElement('paper-dropdown-menu'); libraryName: any = document.createElement('paper-dropdown-menu');
protocol: any = document.createElement('paper-dropdown-menu'); protocol: any = document.createElement('paper-dropdown-menu');
@ -117,6 +119,12 @@ class PlexMeetsHomeAssistantEditor extends HTMLElement {
this.config.maxCount = this.maxCount.value; this.config.maxCount = this.maxCount.value;
} }
if (_.isEmpty(this.cardTitle.value)) {
this.config.title = '';
} else {
this.config.title = this.cardTitle.value;
}
if (!_.isEmpty(this.entities)) { if (!_.isEmpty(this.entities)) {
this.config.entity = []; this.config.entity = [];
_.forEach(this.entities, entity => { _.forEach(this.entities, entity => {
@ -374,6 +382,11 @@ class PlexMeetsHomeAssistantEditor extends HTMLElement {
viewTitle.style.marginTop = '20px'; viewTitle.style.marginTop = '20px';
this.plexValidSection.appendChild(viewTitle); this.plexValidSection.appendChild(viewTitle);
this.cardTitle.label = 'Card title';
this.cardTitle.value = this.config.title;
this.cardTitle.addEventListener('change', this.valueUpdated);
this.plexValidSection.appendChild(this.cardTitle);
this.maxCount.label = 'Maximum number of items to display'; this.maxCount.label = 'Maximum number of items to display';
this.maxCount.value = this.config.maxCount; this.maxCount.value = this.config.maxCount;
this.maxCount.type = 'number'; this.maxCount.type = 'number';
@ -629,6 +642,10 @@ class PlexMeetsHomeAssistantEditor extends HTMLElement {
this.config.runAfter = config.runAfter; this.config.runAfter = config.runAfter;
} }
if (!_.isNil(config.title)) {
this.config.title = config.title;
}
if (_.isNumber(this.config.maxCount)) { if (_.isNumber(this.config.maxCount)) {
this.config.maxCount = `${this.config.maxCount}`; this.config.maxCount = `${this.config.maxCount}`;
} }

Loading…
Cancel
Save