@@ -3,7 +3,14 @@ import "@material/mwc-list/mwc-list-item";
3
3
import type { ActionDetail } from "@material/mwc-list" ;
4
4
import "@polymer/app-layout/app-header/app-header" ;
5
5
import "@polymer/app-layout/app-toolbar/app-toolbar" ;
6
- import { css , CSSResultGroup , html , LitElement , TemplateResult } from "lit" ;
6
+ import {
7
+ css ,
8
+ CSSResultGroup ,
9
+ html ,
10
+ LitElement ,
11
+ PropertyValues ,
12
+ TemplateResult ,
13
+ } from "lit" ;
7
14
import { customElement , property } from "lit/decorators" ;
8
15
import { isComponentLoaded } from "../../../common/config/is_component_loaded" ;
9
16
import "../../../components/ha-card" ;
@@ -26,6 +33,7 @@ import "./ha-config-navigation";
26
33
import "./ha-config-updates" ;
27
34
import { fireEvent } from "../../../common/dom/fire_event" ;
28
35
import { showAlertDialog } from "../../../dialogs/generic/show-dialog-box" ;
36
+ import { showToast } from "../../../util/toast" ;
29
37
30
38
@customElement ( "ha-config-dashboard" )
31
39
class HaConfigDashboard extends LitElement {
@@ -43,6 +51,8 @@ class HaConfigDashboard extends LitElement {
43
51
44
52
@property ( ) public showAdvanced ! : boolean ;
45
53
54
+ private _notifyUpdates = false ;
55
+
46
56
protected render ( ) : TemplateResult {
47
57
return html `
48
58
<ha- app- layout>
@@ -129,6 +139,26 @@ class HaConfigDashboard extends LitElement {
129
139
` ;
130
140
}
131
141
142
+ protected override updated ( changedProps : PropertyValues ) : void {
143
+ super . updated ( changedProps ) ;
144
+
145
+ if ( ! changedProps . has ( "supervisorUpdates" ) || ! this . _notifyUpdates ) {
146
+ return ;
147
+ }
148
+ this . _notifyUpdates = false ;
149
+ if ( this . supervisorUpdates ?. length ) {
150
+ showToast ( this , {
151
+ message : this . hass . localize (
152
+ "ui.panel.config.updates.updates_refreshed"
153
+ ) ,
154
+ } ) ;
155
+ } else {
156
+ showToast ( this , {
157
+ message : this . hass . localize ( "ui.panel.config.updates.no_new_updates" ) ,
158
+ } ) ;
159
+ }
160
+ }
161
+
132
162
private _showQuickBar ( ) : void {
133
163
showQuickBar ( this , {
134
164
commandMode : true ,
@@ -140,6 +170,7 @@ class HaConfigDashboard extends LitElement {
140
170
switch ( ev . detail . index ) {
141
171
case 0 :
142
172
if ( isComponentLoaded ( this . hass , "hassio" ) ) {
173
+ this . _notifyUpdates = true ;
143
174
await refreshSupervisorAvailableUpdates ( this . hass ) ;
144
175
fireEvent ( this , "ha-refresh-supervisor" ) ;
145
176
return ;
0 commit comments