@@ -2,9 +2,7 @@ import { mdiDotsVertical, mdiDownload } from "@mdi/js";
22import type { TemplateResult } from "lit" ;
33import { css , html , LitElement , nothing } from "lit" ;
44import { customElement , property } from "lit/decorators" ;
5- import "../../../components/ha-button-menu" ;
65import "../../../components/ha-icon-button" ;
7- import "../../../components/ha-list-item" ;
86import "../../../components/ha-svg-icon" ;
97import { getSignedPath } from "../../../data/auth" ;
108import "../../../layouts/hass-subpage" ;
@@ -14,6 +12,8 @@ import {
1412 downloadFileSupported ,
1513 fileDownload ,
1614} from "../../../util/file_download" ;
15+ import "../../../components/ha-dropdown-item" ;
16+ import "../../../components/ha-dropdown" ;
1717
1818@customElement ( "ha-config-section-analytics" )
1919class HaConfigSectionAnalytics extends LitElement {
@@ -33,22 +33,19 @@ class HaConfigSectionAnalytics extends LitElement {
3333 >
3434 ${ downloadFileSupported ( this . hass )
3535 ? html `
36- <ha- but to n - menu
37- @action = ${ this . _handleOverflowAction }
36+ <ha- dropdown
37+ @wa-select = ${ this . _handleOverflowAction }
3838 slot= "toolbar-icon"
3939 >
4040 <ha- icon- butto n slot= "trigger" .path = ${ mdiDotsVertical } >
4141 </ ha- icon- butto n>
42- <ha- lis t- item graphic= "icon" >
43- <ha- svg- icon
44- slot= "graphic"
45- .path = ${ mdiDownload }
46- > </ ha- svg- icon>
42+ <ha- dropdown- item .value = ${ "download_device_info" } >
43+ <ha- svg- icon slot= "icon" .path = ${ mdiDownload } > </ ha- svg- icon>
4744 ${ this . hass . localize (
4845 "ui.panel.config.analytics.download_device_info"
4946 ) }
50- </ ha- l is t - item>
51- </ ha- but to n - menu >
47+ </ ha- dropdown - item>
48+ </ ha- dropdown >
5249 `
5350 : nothing }
5451 <div class= "content" >
@@ -58,9 +55,16 @@ class HaConfigSectionAnalytics extends LitElement {
5855 ` ;
5956 }
6057
61- private async _handleOverflowAction ( ) : Promise < void > {
62- const signedPath = await getSignedPath ( this . hass , "/api/analytics/devices" ) ;
63- fileDownload ( signedPath . path ) ;
58+ private async _handleOverflowAction (
59+ ev : CustomEvent < { item : { value : string } } >
60+ ) : Promise < void > {
61+ if ( ev . detail . item . value === "download_device_info" ) {
62+ const signedPath = await getSignedPath (
63+ this . hass ,
64+ "/api/analytics/devices"
65+ ) ;
66+ fileDownload ( signedPath . path ) ;
67+ }
6468 }
6569
6670 static styles = css `
0 commit comments