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" ;
1210import "../../../components/ha-button-menu" ;
@@ -33,6 +31,9 @@ import "../../../layouts/hass-subpage";
3331import type { HomeAssistant } from "../../../types" ;
3432import "../dashboard/ha-config-updates" ;
3533import { showJoinBetaDialog } from "./updates/show-dialog-join-beta" ;
34+ import "../../../components/ha-dropdown" ;
35+ import "../../../components/ha-dropdown-item" ;
36+ import "@home-assistant/webawesome/dist/components/divider/divider" ;
3637
3738@customElement ( "ha-config-section-updates" )
3839class HaConfigSectionUpdates extends LitElement {
@@ -73,35 +74,36 @@ class HaConfigSectionUpdates extends LitElement {
7374 .path = ${ mdiRefresh }
7475 @click = ${ this . _checkUpdates }
7576 > </ ha- icon- butto n>
76- <ha- but to n - menu multi >
77+ <ha- dropdown @wa-select = ${ this . _handleOverflowAction } >
7778 <ha- icon- butto n
7879 slot= "trigger"
7980 .label = ${ this . hass . localize ( "ui.common.menu" ) }
8081 .path = ${ mdiDotsVertical }
8182 > </ ha- icon- butto n>
82- <ha- check- lis t- item
83- left
84- @request-selected = ${ this . _toggleSkipped }
85- .selected = ${ this . _showSkipped }
83+
84+ <ha- dropdown- item
85+ type= "checkbox"
86+ value = "show_skipped"
87+ .checked = ${ this . _showSkipped }
8688 >
8789 ${ this . hass . localize ( "ui.panel.config.updates.show_skipped" ) }
88- </ ha- check - l is t - item>
90+ </ ha- dropdown - item>
8991 ${ this . _supervisorInfo
9092 ? html `
91- <li divider role = "separator" > </ li >
92- <ha- l is t - item
93- @request-selected = ${ this . _toggleBeta }
93+ <wa - divider> </ wa - divider >
94+ <ha- dropdown - item
95+ value = "toggle_beta"
9496 .disabled = ${ this . _supervisorInfo . channel === "dev" }
9597 >
9698 ${ this . _supervisorInfo . channel === "stable"
9799 ? this . hass . localize ( "ui.panel.config.updates.join_beta" )
98100 : this . hass . localize (
99101 "ui.panel.config.updates.leave_beta"
100102 ) }
101- </ ha- l is t - item>
103+ </ ha- dropdown - item>
102104 `
103105 : "" }
104- </ ha- but to n - menu >
106+ </ ha- dropdown >
105107 </ div>
106108 <div class= "content" >
107109 <ha- card outlined>
@@ -133,27 +135,19 @@ class HaConfigSectionUpdates extends LitElement {
133135 this . _supervisorInfo = await fetchHassioSupervisorInfo ( this . hass ) ;
134136 }
135137
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 >
138+ private async _handleOverflowAction (
139+ ev : CustomEvent < { item : { value : string } } >
146140 ) : 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" ) ;
141+ if ( ev . detail . item . value === "toggle_beta" ) {
142+ if ( this . _supervisorInfo ! . channel === "stable" ) {
143+ showJoinBetaDialog ( this , {
144+ join : async ( ) => this . _setChannel ( "beta" ) ,
145+ } ) ;
146+ } else {
147+ this . _setChannel ( "stable" ) ;
148+ }
149+ } else if ( ev . detail . item . value === "show_skipped" ) {
150+ this . _showSkipped = ! this . _showSkipped ;
157151 }
158152 }
159153
0 commit comments