mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-08 18:06:36 +00:00
Show errors on dashboard when something went wrong.
https://www.pivotaltracker.com/story/show/145310923
This commit is contained in:
parent
9bde68c4cc
commit
a4f7caef81
@ -16,6 +16,10 @@
|
||||
.info td:nth-child(2) {
|
||||
text-align: right;
|
||||
}
|
||||
.errors {
|
||||
color: var(--google-red-500);
|
||||
margin-top: 16px;
|
||||
}
|
||||
</style>
|
||||
<template>
|
||||
<paper-card heading="Home Assistant">
|
||||
@ -30,6 +34,9 @@
|
||||
<td>[[data.last_version]]</td>
|
||||
</tr>
|
||||
</table>
|
||||
<template is='dom-if' if='[[errors]]'>
|
||||
<div class='errors'>Error: [[errors]]</div>
|
||||
</template>
|
||||
</div>
|
||||
<div class="card-actions">
|
||||
<template is='dom-if' if='[[computeUpdateAvailable(data)]]'>
|
||||
@ -63,6 +70,25 @@ Polymer({
|
||||
},
|
||||
},
|
||||
|
||||
listeners: {
|
||||
'hass-api-called': 'apiCalled',
|
||||
},
|
||||
|
||||
apiCalled: function (ev) {
|
||||
if (ev.detail.success) {
|
||||
this.errors = null;
|
||||
return;
|
||||
}
|
||||
|
||||
var response = ev.detail.response;
|
||||
|
||||
if (typeof response.body === 'object') {
|
||||
this.errors = response.body.message || 'Unknown error';
|
||||
} else {
|
||||
this.errors = response.body;
|
||||
}
|
||||
},
|
||||
|
||||
computeUpdateAvailable: function (data) {
|
||||
return data.version !== data.last_version;
|
||||
},
|
||||
|
@ -15,6 +15,10 @@
|
||||
.info td:nth-child(2) {
|
||||
text-align: right;
|
||||
}
|
||||
.errors {
|
||||
color: var(--google-red-500);
|
||||
margin-top: 16px;
|
||||
}
|
||||
</style>
|
||||
<template>
|
||||
<paper-card heading="Host OS">
|
||||
@ -41,6 +45,9 @@
|
||||
<td>[[data.last_version]]</td>
|
||||
</tr>
|
||||
</table>
|
||||
<template is='dom-if' if='[[errors]]'>
|
||||
<div class='errors'>Error: [[errors]]</div>
|
||||
</template>
|
||||
</div>
|
||||
<div class="card-actions">
|
||||
<template is='dom-if' if='[[computeUpdateAvailable(data)]]'>
|
||||
@ -74,6 +81,27 @@ Polymer({
|
||||
type: Object,
|
||||
value: {},
|
||||
},
|
||||
|
||||
errors: String,
|
||||
},
|
||||
|
||||
listeners: {
|
||||
'hass-api-called': 'apiCalled',
|
||||
},
|
||||
|
||||
apiCalled: function (ev) {
|
||||
if (ev.detail.success) {
|
||||
this.errors = null;
|
||||
return;
|
||||
}
|
||||
|
||||
var response = ev.detail.response;
|
||||
|
||||
if (typeof response.body === 'object') {
|
||||
this.errors = response.body.message || 'Unknown error';
|
||||
} else {
|
||||
this.errors = response.body;
|
||||
}
|
||||
},
|
||||
|
||||
computeUpdateAvailable: function (data) {
|
||||
|
@ -15,6 +15,10 @@
|
||||
.info td:nth-child(2) {
|
||||
text-align: right;
|
||||
}
|
||||
.errors {
|
||||
color: var(--google-red-500);
|
||||
margin-top: 16px;
|
||||
}
|
||||
</style>
|
||||
<template>
|
||||
<paper-card heading="Supervisor">
|
||||
@ -33,6 +37,9 @@
|
||||
<td>[[data.last_version]]</td>
|
||||
</tr>
|
||||
</table>
|
||||
<template is='dom-if' if='[[errors]]'>
|
||||
<div class='errors'>Error: [[errors]]</div>
|
||||
</template>
|
||||
</div>
|
||||
<div class="card-actions">
|
||||
<paper-button on-tap='supervisorLogsTapped'>View logs</paper-button>
|
||||
@ -65,6 +72,27 @@ Polymer({
|
||||
type: Object,
|
||||
value: {},
|
||||
},
|
||||
|
||||
errors: String,
|
||||
},
|
||||
|
||||
listeners: {
|
||||
'hass-api-called': 'apiCalled',
|
||||
},
|
||||
|
||||
apiCalled: function (ev) {
|
||||
if (ev.detail.success) {
|
||||
this.errors = null;
|
||||
return;
|
||||
}
|
||||
|
||||
var response = ev.detail.response;
|
||||
|
||||
if (typeof response.body === 'object') {
|
||||
this.errors = response.body.message || 'Unknown error';
|
||||
} else {
|
||||
this.errors = response.body;
|
||||
}
|
||||
},
|
||||
|
||||
computeUpdateAvailable: function (data) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user