1- import type { RequestSelectedDetail } from "@material/mwc-list/mwc-list-item" ;
21import { mdiDotsVertical , mdiRefresh } from "@mdi/js" ;
32import type { HassEntities } from "home-assistant-js-websocket" ;
43import type { TemplateResult } from "lit" ;
54import { LitElement , css , html } from "lit" ;
65import { customElement , property , state } from "lit/decorators" ;
76import memoizeOne from "memoize-one" ;
87import { isComponentLoaded } from "../../../common/config/is_component_loaded" ;
9- import { shouldHandleRequestSelectedEvent } from "../../../common/mwc/handle-request-selected-event" ;
108import "../../../components/ha-alert" ;
119import "../../../components/ha-bar" ;
12- import "../../../components/ha-button-menu" ;
1310import "../../../components/ha-card" ;
14- import "../../../components/ha-check-list-item" ;
15- import "../../../components/ha-list-item" ;
1611import "../../../components/ha-metric" ;
1712import { extractApiErrorMessage } from "../../../data/hassio/common" ;
1813import type {
@@ -33,6 +28,9 @@ import "../../../layouts/hass-subpage";
3328import type { HomeAssistant } from "../../../types" ;
3429import "../dashboard/ha-config-updates" ;
3530import { showJoinBetaDialog } from "./updates/show-dialog-join-beta" ;
31+ import "../../../components/ha-dropdown" ;
32+ import "../../../components/ha-dropdown-item" ;
33+ import "@home-assistant/webawesome/dist/components/divider/divider" ;
3634
3735@customElement ( "ha-config-section-updates" )
3836class HaConfigSectionUpdates extends LitElement {
@@ -73,35 +71,36 @@ class HaConfigSectionUpdates extends LitElement {
7371 .path = ${ mdiRefresh }
7472 @click = ${ this . _checkUpdates }
7573 > </ ha- icon- butto n>
76- <ha- but to n - menu multi >
74+ <ha- dropdown @wa-select = ${ this . _handleOverflowAction } >
7775 <ha- icon- butto n
7876 slot= "trigger"
7977 .label = ${ this . hass . localize ( "ui.common.menu" ) }
8078 .path = ${ mdiDotsVertical }
8179 > </ ha- icon- butto n>
82- <ha- check- lis t- item
83- left
84- @request-selected = ${ this . _toggleSkipped }
85- .selected = ${ this . _showSkipped }
80+
81+ <ha- dropdown- item
82+ type= "checkbox"
83+ value = "show_skipped"
84+ .checked = ${ this . _showSkipped }
8685 >
8786 ${ this . hass . localize ( "ui.panel.config.updates.show_skipped" ) }
88- </ ha- check - l is t - item>
87+ </ ha- dropdown - item>
8988 ${ this . _supervisorInfo
9089 ? html `
91- <li divider role = "separator" > </ li >
92- <ha- l is t - item
93- @request-selected = ${ this . _toggleBeta }
90+ <wa - divider> </ wa - divider >
91+ <ha- dropdown - item
92+ value = "toggle_beta"
9493 .disabled = ${ this . _supervisorInfo . channel === "dev" }
9594 >
9695 ${ this . _supervisorInfo . channel === "stable"
9796 ? this . hass . localize ( "ui.panel.config.updates.join_beta" )
9897 : this . hass . localize (
9998 "ui.panel.config.updates.leave_beta"
10099 ) }
101- </ ha- l is t - item>
100+ </ ha- dropdown - item>
102101 `
103102 : "" }
104- </ ha- but to n - menu >
103+ </ ha- dropdown >
105104 </ div>
106105 <div class= "content" >
107106 <ha- card outlined>
@@ -133,27 +132,19 @@ class HaConfigSectionUpdates extends LitElement {
133132 this . _supervisorInfo = await fetchHassioSupervisorInfo ( this . hass ) ;
134133 }
135134
136- private _toggleSkipped ( ev : CustomEvent < RequestSelectedDetail > ) : void {
137- if ( ev . detail . source !== "property" ) {
138- return ;
139- }
140-
141- this . _showSkipped = ! this . _showSkipped ;
142- }
143-
144- private async _toggleBeta (
145- ev : CustomEvent < RequestSelectedDetail >
135+ private async _handleOverflowAction (
136+ ev : CustomEvent < { item : { value : string } } >
146137 ) : Promise < void > {
147- if ( ! shouldHandleRequestSelectedEvent ( ev ) ) {
148- return ;
149- }
150-
151- if ( this . _supervisorInfo ! . channel === "stable" ) {
152- showJoinBetaDialog ( this , {
153- join : async ( ) => this . _setChannel ( "beta" ) ,
154- } ) ;
155- } else {
156- this . _setChannel ( "stable" ) ;
138+ if ( ev . detail . item . value === "toggle_beta" ) {
139+ if ( this . _supervisorInfo ! . channel === "stable" ) {
140+ showJoinBetaDialog ( this , {
141+ join : async ( ) => this . _setChannel ( "beta" ) ,
142+ } ) ;
143+ } else {
144+ this . _setChannel ( "stable" ) ;
145+ }
146+ } else if ( ev . detail . item . value === "show_skipped" ) {
147+ this . _showSkipped = ! this . _showSkipped ;
157148 }
158149 }
159150
0 commit comments