Upgrade eslint to 4.8.0 (#445)

* Upgrade eslint

* Fix post-merge errors
This commit is contained in:
Andrey
2017-10-08 21:08:06 -07:00
committed by Paulus Schoutsen
parent 121c0d0879
commit bc0d44ca81
74 changed files with 651 additions and 639 deletions
@@ -239,28 +239,26 @@ Polymer({
},
_updateComponent: function () {
this._rendered = window.AutomationEditor(
this.$.root, {
automation: this.config,
onChange: this.configChanged,
isWide: this.isWide,
}, this._rendered);
this._rendered = window.AutomationEditor(this.$.root, {
automation: this.config,
onChange: this.configChanged,
isWide: this.isWide,
}, this._rendered);
},
saveAutomation: function () {
var id = this.creatingNew ? '' + Date.now() : this.automation.attributes.id;
this.hass.callApi(
'post', 'config/automation/config/' + id, this.config).then(function () {
this.dirty = false;
this.hass.callApi('post', 'config/automation/config/' + id, this.config).then(function () {
this.dirty = false;
if (this.creatingNew) {
history.replaceState(null, null, '/config/automation/edit/' + id);
this.fire('location-changed');
}
}.bind(this), function (errors) {
this.errors = errors.body.message;
throw errors;
}.bind(this));
if (this.creatingNew) {
history.replaceState(null, null, '/config/automation/edit/' + id);
this.fire('location-changed');
}
}.bind(this), function (errors) {
this.errors = errors.body.message;
throw errors;
}.bind(this));
},
computeName: function (automation) {
@@ -119,8 +119,7 @@ Polymer({
},
automationTapped: function (ev) {
history.pushState(
null, null, '/config/automation/edit/' + this.automations[ev.model.index].attributes.id);
history.pushState(null, null, '/config/automation/edit/' + this.automations[ev.model.index].attributes.id);
this.fire('location-changed');
},
@@ -74,8 +74,7 @@ class HaConfigCloudAccount extends window.hassMixins.EventsMixin(Polymer.Element
}
handleLogout() {
this.hass.callApi('post', 'cloud/logout').then(
() => this.fire('ha-account-refreshed', { account: null }));
this.hass.callApi('post', 'cloud/logout').then(() => this.fire('ha-account-refreshed', { account: null }));
}
}
@@ -113,8 +113,7 @@
<script>
class HaConfigCloudForgotPassword extends
window.hassMixins.NavigateMixin(
window.hassMixins.EventsMixin(Polymer.Element)) {
window.hassMixins.NavigateMixin(window.hassMixins.EventsMixin(Polymer.Element)) {
static get is() { return 'ha-config-cloud-forgot-password'; }
static get properties() {
@@ -180,15 +179,14 @@ class HaConfigCloudForgotPassword extends
this.hass.callApi('post', 'cloud/forgot_password', {
email: this.email,
}).then(
() => {
this._hasToken = true;
this._requestInProgress = false;
}, (err) => {
this._requestInProgress = false;
this.error = err && err.body && err.body.message ?
err.body.message : 'Unknown error';
});
}).then(() => {
this._hasToken = true;
this._requestInProgress = false;
}, (err) => {
this._requestInProgress = false;
this.error = err && err.body && err.body.message ?
err.body.message : 'Unknown error';
});
}
_handleHaveToken() {
@@ -219,16 +217,15 @@ class HaConfigCloudForgotPassword extends
email: this.email,
confirmation_code: this._confirmationCode,
new_password: this._newPassword,
}).then(
() => {
// eslint-disable-next-line
}).then(() => {
// eslint-disable-next-line
alert('Password reset successful! You can now login.');
this.navigate('config/cloud/login');
}, (err) => {
this._requestInProgress = false;
this.error = err && err.body && err.body.message ?
err.body.message : 'Unknown error';
});
this.navigate('config/cloud/login');
}, (err) => {
this._requestInProgress = false;
this.error = err && err.body && err.body.message ?
err.body.message : 'Unknown error';
});
}
}
+21 -23
View File
@@ -101,8 +101,7 @@
<script>
class HaConfigCloudLogin extends
window.hassMixins.NavigateMixin(
window.hassMixins.EventsMixin(Polymer.Element)) {
window.hassMixins.NavigateMixin(window.hassMixins.EventsMixin(Polymer.Element)) {
static get is() { return 'ha-config-cloud-login'; }
static get properties() {
@@ -156,27 +155,26 @@ class HaConfigCloudLogin extends
this.hass.callApi('post', 'cloud/login', {
email: this.email,
password: this._password,
}).then(
(account) => {
this.fire('ha-account-refreshed', { account: account });
this.email = '';
this._password = '';
}, (err) => {
this._password = '';
this._requestInProgress = false;
if (!err || !err.body || !err.body.message) {
this.error = 'Unknown error';
return;
} else if (err.body.code === 'UserNotConfirmed') {
alert('You need to confirm your email before logging in.');
this.navigate('/config/cloud/register#confirm');
return;
} else if (err.body.code === 'PasswordChangeRequired') {
alert('You need to change your password before logging in.');
this.navigate('/config/cloud/forgot-password');
}
this.error = err.body.message;
});
}).then((account) => {
this.fire('ha-account-refreshed', { account: account });
this.email = '';
this._password = '';
}, (err) => {
this._password = '';
this._requestInProgress = false;
if (!err || !err.body || !err.body.message) {
this.error = 'Unknown error';
return;
} else if (err.body.code === 'UserNotConfirmed') {
alert('You need to confirm your email before logging in.');
this.navigate('/config/cloud/register#confirm');
return;
} else if (err.body.code === 'PasswordChangeRequired') {
alert('You need to change your password before logging in.');
this.navigate('/config/cloud/forgot-password');
}
this.error = err.body.message;
});
}
_handleRegister() {
@@ -134,8 +134,7 @@
<script>
class HaConfigCloudRegister extends
window.hassMixins.NavigateMixin(
window.hassMixins.EventsMixin(Polymer.Element)) {
window.hassMixins.NavigateMixin(window.hassMixins.EventsMixin(Polymer.Element)) {
static get is() { return 'ha-config-cloud-register'; }
static get properties() {
@@ -202,16 +201,15 @@ class HaConfigCloudRegister extends
this.hass.callApi('post', 'cloud/register', {
email: this.email,
password: this._password,
}).then(
() => {
this._requestInProgress = false;
this._hasConfirmationCode = true;
}, (err) => {
this._password = '';
this._requestInProgress = false;
this._error = err && err.body && err.body.message ?
err.body.message : 'Unknown error';
});
}).then(() => {
this._requestInProgress = false;
this._hasConfirmationCode = true;
}, (err) => {
this._password = '';
this._requestInProgress = false;
this._error = err && err.body && err.body.message ?
err.body.message : 'Unknown error';
});
}
_handleShowVerifyAccount() {
@@ -234,17 +232,16 @@ class HaConfigCloudRegister extends
this.hass.callApi('post', 'cloud/confirm_register', {
email: this.email,
confirmation_code: this._confirmationCode,
}).then(
() => {
// eslint-disable-next-line
}).then(() => {
// eslint-disable-next-line
alert('Confirmation successful. You can now login.');
this.navigate('config/cloud/login');
}, (err) => {
this._confirmationCode = '';
this._error = err && err.body && err.body.message ?
err.body.message : 'Unknown error';
this._requestInProgress = false;
});
this.navigate('config/cloud/login');
}, (err) => {
this._confirmationCode = '';
this._error = err && err.body && err.body.message ?
err.body.message : 'Unknown error';
this._requestInProgress = false;
});
}
}
-1
View File
@@ -75,7 +75,6 @@
<script>
class HaConfigCore extends Polymer.Element {
static get is() { return 'ha-config-core'; }
static get properties() {
@@ -130,7 +130,6 @@
<script>
class HaConfigSectionCore extends Polymer.Element {
static get is() { return 'ha-config-section-core'; }
static get properties() {
@@ -36,7 +36,6 @@
<script>
class HaConfigSectionGroup extends Polymer.Element {
static get is() { return 'ha-config-section-group'; }
static get properties() {
@@ -66,7 +66,6 @@
<script>
class HaConfigSectionHassbian extends Polymer.Element {
static get is() { return 'ha-config-section-hassbian'; }
static get properties() {
@@ -35,7 +35,6 @@
<script>
class HaConfigSectionThemes extends window.hassMixins.EventsMixin(Polymer.Element) {
static get is() { return 'ha-config-section-themes'; }
static get properties() {
-1
View File
@@ -132,7 +132,6 @@
<script>
class HaFormGroup extends Polymer.Element {
static get is() { return 'ha-form-group'; }
static get properties() {
@@ -33,7 +33,6 @@
<script>
class HaCustomizeAttribute extends Polymer.Element {
static get is() { return 'ha-customize-attribute'; }
static get properties() {
@@ -21,7 +21,6 @@
<script>
class HaFormCustomizeAttributes extends Polymer.MutableData(Polymer.Element) {
static get is() { return 'ha-form-customize-attributes'; }
static get properties() {
+23 -20
View File
@@ -72,7 +72,6 @@
<script>
class HaFormCustomize extends Polymer.Element {
static get is() { return 'ha-form-customize'; }
static get properties() {
@@ -139,17 +138,17 @@ class HaFormCustomize extends Polymer.Element {
loadEntity(entity) {
this.entity = entity;
return this.hass.callApi('GET', 'config/customize/config/' + entity.entity_id)
.then((data) => {
this.localConfig = data.local;
this.globalConfig = data.global;
this.newAttributes = [];
});
.then((data) => {
this.localConfig = data.local;
this.globalConfig = data.global;
this.newAttributes = [];
});
}
saveEntity() {
const data = {};
const attrs = this.localAttributes.concat(
this.globalAttributes, this.existingAttributes, this.newAttributes);
const attrs = this.localAttributes
.concat(this.globalAttributes, this.existingAttributes, this.newAttributes);
attrs.forEach((attr) => {
if (attr.closed || attr.secondary || !attr.attribute || !attr.value) return;
const value = attr.type === 'json' ? JSON.parse(attr.value) : attr.value;
@@ -190,14 +189,14 @@ class HaFormCustomize extends Polymer.Element {
const localKeys = Object.keys(localConfig);
const globalKeys = Object.keys(globalConfig);
const entityKeys = Object.keys(entity.attributes)
.filter(key => !localKeys.includes(key) && !globalKeys.includes(key));
.filter(key => !localKeys.includes(key) && !globalKeys.includes(key));
return this._computeAttributes(entity.attributes, entityKeys, true);
}
computeShowWarning(localConfig, globalConfig) {
if (!localConfig || !globalConfig) return false;
return Object.keys(localConfig).some(
key => JSON.stringify(globalConfig[key]) !== JSON.stringify(localConfig[key]));
return Object.keys(localConfig)
.some(key => JSON.stringify(globalConfig[key]) !== JSON.stringify(localConfig[key]));
}
filterFromAttributes(attributes) {
@@ -207,15 +206,15 @@ class HaFormCustomize extends Polymer.Element {
getNewAttributesOptions(localAttributes, globalAttributes, existingAttributes, newAttributes) {
const knownKeys =
Object.keys(window.hassAttributeUtil.LOGIC_STATE_ATTRIBUTES)
.filter((key) => {
const conf = window.hassAttributeUtil.LOGIC_STATE_ATTRIBUTES[key];
return conf && (!conf.domains || !this.entity ||
.filter((key) => {
const conf = window.hassAttributeUtil.LOGIC_STATE_ATTRIBUTES[key];
return conf && (!conf.domains || !this.entity ||
conf.domains.includes(window.hassUtil.computeDomain(this.entity)));
})
.filter(this.filterFromAttributes(localAttributes))
.filter(this.filterFromAttributes(globalAttributes))
.filter(this.filterFromAttributes(existingAttributes))
.filter(this.filterFromAttributes(newAttributes));
})
.filter(this.filterFromAttributes(localAttributes))
.filter(this.filterFromAttributes(globalAttributes))
.filter(this.filterFromAttributes(existingAttributes))
.filter(this.filterFromAttributes(newAttributes));
return knownKeys.sort().concat('Other');
}
@@ -268,7 +267,11 @@ class HaFormCustomize extends Polymer.Element {
this.hasNewAttributes =
this.newAttributes && this.newAttributes.some(attr => !attr.closed);
this.newAttributesOptions = this.getNewAttributesOptions(
this.localAttributes, this.globalAttributes, this.existingAttributes, this.newAttributes);
this.localAttributes,
this.globalAttributes,
this.existingAttributes,
this.newAttributes
);
}
}
customElements.define(HaFormCustomize.is, HaFormCustomize);
@@ -31,7 +31,6 @@
<script>
class HaCustomizeArray extends window.hassMixins.EventsMixin(Polymer.Element) {
static get is() { return 'ha-customize-array'; }
static get properties() {
@@ -58,7 +57,6 @@ class HaCustomizeArray extends window.hassMixins.EventsMixin(Polymer.Element) {
const options = this.getOptions(item);
return options.indexOf(item.value);
}
}
customElements.define(HaCustomizeArray.is, HaCustomizeArray);
</script>
@@ -14,7 +14,6 @@
<script>
class HaCustomizeBoolean extends Polymer.Element {
static get is() { return 'ha-customize-boolean'; }
static get properties() {
@@ -27,7 +27,6 @@
<script>
class HaCustomizeIcon extends Polymer.Element {
static get is() { return 'ha-customize-icon'; }
static get properties() {
@@ -30,7 +30,6 @@
<script>
class HaCustomizeKeyValue extends Polymer.Element {
static get is() { return 'ha-customize-key-value'; }
static get properties() {
@@ -13,7 +13,6 @@
<script>
class HaCustomizeString extends Polymer.Element {
static get is() { return 'ha-customize-string'; }
static get properties() {
@@ -74,8 +74,7 @@ Polymer({
},
_computeLoaded: function (hass, component) {
return component.loaded || window.hassUtil.isComponentLoaded(
hass, component.domain);
return component.loaded || window.hassUtil.isComponentLoaded(hass, component.domain);
},
_computeCaption: function (component) {
@@ -87,8 +86,7 @@ Polymer({
},
_navigate: function (ev) {
history.pushState(
null, null, '/config/' + ev.model.item.domain);
history.pushState(null, null, '/config/' + ev.model.item.domain);
this.fire('location-changed');
},
});
+1 -3
View File
@@ -132,9 +132,7 @@ class HaPanelConfig extends window.hassMixins.EventsMixin(Polymer.Element) {
ready() {
super.ready();
if (window.hassUtil.isComponentLoaded(this.hass, 'cloud')) {
this.hass.callApi('get', 'cloud/account').then(
(account) => { this.account = account; }
);
this.hass.callApi('get', 'cloud/account').then((account) => { this.account = account; });
}
this.addEventListener('ha-account-refreshed', (ev) => {
this.account = ev.detail.account;
+15 -17
View File
@@ -234,28 +234,26 @@ Polymer({
},
_updateComponent: function () {
this._rendered = window.ScriptEditor(
this.$.root, {
script: this.config,
onChange: this.configChanged,
isWide: this.isWide,
}, this._rendered);
this._rendered = window.ScriptEditor(this.$.root, {
script: this.config,
onChange: this.configChanged,
isWide: this.isWide,
}, this._rendered);
},
saveScript: function () {
var id = this.creatingNew ? '' + Date.now() : window.hassUtil.computeObjectId(this.script);
this.hass.callApi(
'post', 'config/script/config/' + id, this.config).then(function () {
this.dirty = false;
this.hass.callApi('post', 'config/script/config/' + id, this.config).then(function () {
this.dirty = false;
if (this.creatingNew) {
history.replaceState(null, null, '/config/script/edit/' + id);
this.fire('location-changed');
}
}.bind(this), function (errors) {
this.errors = errors.body.message;
throw errors;
}.bind(this));
if (this.creatingNew) {
history.replaceState(null, null, '/config/script/edit/' + id);
this.fire('location-changed');
}
}.bind(this), function (errors) {
this.errors = errors.body.message;
throw errors;
}.bind(this));
},
computeName: function (script) {
+1 -2
View File
@@ -115,8 +115,7 @@ Polymer({
},
scriptTapped: function (ev) {
history.pushState(
null, null, '/config/script/edit/' + this.scripts[ev.model.index].entity_id);
history.pushState(null, null, '/config/script/edit/' + this.scripts[ev.model.index].entity_id);
this.fire('location-changed');
},
+22 -26
View File
@@ -449,38 +449,33 @@ Polymer({
this.selectedConfigParameterValue = -1;
this.selectedGroup = -1;
this.hass.callApi('GET', 'zwave/config/' + this.nodes[selectedNode].attributes.node_id).then(
(configs) => {
this.config = this._objToArray(configs);
});
this.hass.callApi('GET', 'zwave/config/' + this.nodes[selectedNode].attributes.node_id).then((configs) => {
this.config = this._objToArray(configs);
});
this.hass.callApi('GET', 'zwave/values/' + this.nodes[selectedNode].attributes.node_id).then(
(values) => {
this.values = this._objToArray(values);
});
this.hass.callApi('GET', 'zwave/values/' + this.nodes[selectedNode].attributes.node_id).then((values) => {
this.values = this._objToArray(values);
});
this.hass.callApi('GET', 'zwave/groups/' + this.nodes[selectedNode].attributes.node_id).then(
(groups) => {
this.groups = this._objToArray(groups);
});
this.hass.callApi('GET', 'zwave/groups/' + this.nodes[selectedNode].attributes.node_id).then((groups) => {
this.groups = this._objToArray(groups);
});
this.hasNodeUserCodes = false;
this.notifyPath('hasNodeUserCodes');
this.hass.callApi('GET', 'zwave/usercodes/' + this.nodes[selectedNode].attributes.node_id).then(
(usercodes) => {
this.userCodes = this._objToArray(usercodes);
this.hasNodeUserCodes = this.userCodes.length > 0;
this.notifyPath('hasNodeUserCodes');
});
this.hass.callApi('GET', 'zwave/usercodes/' + this.nodes[selectedNode].attributes.node_id).then((usercodes) => {
this.userCodes = this._objToArray(usercodes);
this.hasNodeUserCodes = this.userCodes.length > 0;
this.notifyPath('hasNodeUserCodes');
});
},
selectedEntityChanged: function (selectedEntity) {
if (selectedEntity === -1) return;
var el = this;
el.hass.callApi('GET', 'zwave/values/' + el.nodes[el.selectedNode].attributes.node_id).then(
(values) => {
el.values = el._objToArray(values);
});
el.hass.callApi('GET', 'zwave/values/' + el.nodes[el.selectedNode].attributes.node_id).then((values) => {
el.values = el._objToArray(values);
});
var valueId = el.entities[selectedEntity].attributes.value_id;
var valueData = el.values.find(function (obj) { return obj.key === valueId; });
@@ -532,8 +527,10 @@ Polymer({
},
computeNodeNameServiceData: function (newNodeNameInput) {
return { node_id: this.nodes[this.selectedNode].attributes.node_id,
name: newNodeNameInput };
return {
node_id: this.nodes[this.selectedNode].attributes.node_id,
name: newNodeNameInput
};
},
computeRefreshEntityServiceData: function (selectedEntity) {
@@ -555,8 +552,7 @@ Polymer({
ignored: this.entityIgnored,
polling_intensity: parseInt(this.entityPollingIntensity),
};
return this.hass.callApi(
'POST', 'config/zwave/device_config/' + this.entities[this.selectedEntity].entity_id, data);
return this.hass.callApi('POST', 'config/zwave/device_config/' + this.entities[this.selectedEntity].entity_id, data);
},
toggleHelp: function () {
+13 -12
View File
@@ -220,25 +220,26 @@ Polymer({
computeAssocServiceData: function (selectedGroup, type) {
if (!this.groups === -1 || selectedGroup === -1 || this.selectedNode === -1) return -1;
return { node_id: this.nodes[this.selectedNode].attributes.node_id,
return {
node_id: this.nodes[this.selectedNode].attributes.node_id,
association: type,
target_node_id: this.nodes[this.selectedTargetNode].attributes.node_id,
group: this.groups[selectedGroup].key };
group: this.groups[selectedGroup].key
};
},
refreshGroups: function (selectedNode) {
var groupData = [];
this.hass.callApi('GET', 'zwave/groups/' + this.nodes[selectedNode].attributes.node_id).then(
function (groups) {
Object.keys(groups).forEach(function (key) {
groupData.push({
key: key,
value: groups[key],
});
this.hass.callApi('GET', 'zwave/groups/' + this.nodes[selectedNode].attributes.node_id).then(function (groups) {
Object.keys(groups).forEach(function (key) {
groupData.push({
key: key,
value: groups[key],
});
this.groups = groupData;
this.selectedGroupChanged(this.selectedGroup);
}.bind(this));
});
this.groups = groupData;
this.selectedGroupChanged(this.selectedGroup);
}.bind(this));
},
selectedGroupChanged: function (selectedGroup) {
+17 -14
View File
@@ -236,8 +236,10 @@ Polymer({
},
computeWakeupServiceData: function (wakeupInput) {
return { node_id: this.nodes[this.selectedNode].attributes.node_id,
value: wakeupInput };
return {
node_id: this.nodes[this.selectedNode].attributes.node_id,
value: wakeupInput
};
},
computeConfigValueHelp: function (selectedConfigParameter) {
@@ -257,9 +259,11 @@ Polymer({
} if (this.selectedConfigParameterType === 'List') {
valueData = this.selectedConfigParameterValues[selectedConfigValue];
}
return { node_id: this.nodes[this.selectedNode].attributes.node_id,
return {
node_id: this.nodes[this.selectedNode].attributes.node_id,
parameter: this.config[this.selectedConfigParameter].key,
value: valueData };
value: valueData
};
},
selectedConfigParameterChanged: function (selectedConfigParameter) {
@@ -300,17 +304,16 @@ Polymer({
refreshConfig: function (selectedNode) {
var configData = [];
this.hass.callApi('GET', 'zwave/config/' + this.nodes[selectedNode].attributes.node_id).then(
function (config) {
Object.keys(config).forEach(function (key) {
configData.push({
key: key,
value: config[key],
});
this.hass.callApi('GET', 'zwave/config/' + this.nodes[selectedNode].attributes.node_id).then(function (config) {
Object.keys(config).forEach(function (key) {
configData.push({
key: key,
value: config[key],
});
this.config = configData;
this.selectedConfigParameterChanged(this.selectedConfigParameter);
}.bind(this));
});
this.config = configData;
this.selectedConfigParameterChanged(this.selectedConfigParameter);
}.bind(this));
},
});
</script>
+17 -14
View File
@@ -145,13 +145,17 @@ Polymer({
var valueData = null;
if (type === 'Add') {
valueData = selectedUserCodeValue;
serviceData = { node_id: this.nodes[this.selectedNode].attributes.node_id,
serviceData = {
node_id: this.nodes[this.selectedNode].attributes.node_id,
code_slot: this.selectedUserCode,
usercode: valueData };
usercode: valueData
};
}
if (type === 'Delete') {
serviceData = { node_id: this.nodes[this.selectedNode].attributes.node_id,
code_slot: this.selectedUserCode };
serviceData = {
node_id: this.nodes[this.selectedNode].attributes.node_id,
code_slot: this.selectedUserCode
};
}
return serviceData;
},
@@ -159,17 +163,16 @@ Polymer({
refreshUserCodes: function (selectedNode) {
this.selectedUserCodeValue = '';
var userCodes = [];
this.hass.callApi('GET', 'zwave/usercodes/' + this.nodes[selectedNode].attributes.node_id).then(
function (usercodes) {
Object.keys(usercodes).forEach(function (key) {
userCodes.push({
key: key,
value: usercodes[key],
});
this.hass.callApi('GET', 'zwave/usercodes/' + this.nodes[selectedNode].attributes.node_id).then(function (usercodes) {
Object.keys(usercodes).forEach(function (key) {
userCodes.push({
key: key,
value: usercodes[key],
});
this.userCodes = userCodes;
this.selectedUserCodeChanged(this.selectedUserCode);
}.bind(this));
});
this.userCodes = userCodes;
this.selectedUserCodeChanged(this.selectedUserCode);
}.bind(this));
},
});
</script>
+9 -10
View File
@@ -122,17 +122,16 @@ Polymer({
refreshValues: function (selectedNode) {
var valueData = [];
this.hass.callApi('GET', 'zwave/values/' + this.nodes[selectedNode].attributes.node_id).then(
function (values) {
Object.keys(values).forEach(function (key) {
valueData.push({
key: key,
value: values[key],
});
this.hass.callApi('GET', 'zwave/values/' + this.nodes[selectedNode].attributes.node_id).then(function (values) {
Object.keys(values).forEach(function (key) {
valueData.push({
key: key,
value: values[key],
});
this.values = valueData;
this.selectedValueChanged(this.selectedValue);
}.bind(this));
});
this.values = valueData;
this.selectedValueChanged(this.selectedValue);
}.bind(this));
},
computeValueNameServiceData: function (newValueNameInput) {
+3 -4
View File
@@ -141,10 +141,9 @@ Polymer({
this.errorLog = 'Loading error log…';
this.hass.callApi('GET', 'error_log').then(
function (log) {
this.errorLog = log || 'No errors have been reported.';
}.bind(this));
this.hass.callApi('GET', 'error_log').then(function (log) {
this.errorLog = log || 'No errors have been reported.';
}.bind(this));
},
});
</script>
+1 -2
View File
@@ -177,8 +177,7 @@ Polymer({
_computeEndTime: function (_currentDate, periodIndex) {
var startTime = this._computeStartTime(_currentDate);
var endTime = new Date(startTime);
endTime.setDate(
startTime.getDate() + this._computeFilterDays(periodIndex));
endTime.setDate(startTime.getDate() + this._computeFilterDays(periodIndex));
return endTime;
},
+5 -5
View File
@@ -52,8 +52,8 @@ Polymer({
var map = this._map = window.L.map(this.$.map);
var style = document.createElement('link');
style.setAttribute('href', window.HASS_DEV ?
'/static/home-assistant-polymer/bower_components/leaflet/dist/leaflet.css' :
'/static/images/leaflet/leaflet.css');
'/static/home-assistant-polymer/bower_components/leaflet/dist/leaflet.css' :
'/static/images/leaflet/leaflet.css');
style.setAttribute('rel', 'stylesheet');
this.$.map.parentNode.appendChild(style);
map.setView([51.505, -0.09], 13);
@@ -79,10 +79,10 @@ Polymer({
if (this._mapItems.length === 0) {
this._map.setView(
new window.L.LatLng(this.hass.config.core.latitude, this.hass.config.core.longitude),
14);
14
);
} else {
bounds = new window.L.latLngBounds(
this._mapItems.map(function (item) { return item.getLatLng(); }));
bounds = new window.L.latLngBounds(this._mapItems.map(item => item.getLatLng()));
this._map.fitBounds(bounds.pad(0.5));
}
},