mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-14 21:06:34 +00:00
Add name of integration to diagnostics when more than 1 (#11523)
This commit is contained in:
parent
4e55460799
commit
8466ef371a
@ -39,6 +39,7 @@ import {
|
|||||||
findBatteryEntity,
|
findBatteryEntity,
|
||||||
updateEntityRegistryEntry,
|
updateEntityRegistryEntry,
|
||||||
} from "../../../data/entity_registry";
|
} from "../../../data/entity_registry";
|
||||||
|
import { domainToName } from "../../../data/integration";
|
||||||
import { SceneEntities, showSceneEditor } from "../../../data/scene";
|
import { SceneEntities, showSceneEditor } from "../../../data/scene";
|
||||||
import { findRelated, RelatedResult } from "../../../data/search";
|
import { findRelated, RelatedResult } from "../../../data/search";
|
||||||
import {
|
import {
|
||||||
@ -212,34 +213,53 @@ export class HaConfigDevicePage extends LitElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let links = await Promise.all(
|
let links = await Promise.all(
|
||||||
this._integrations(device, this.entries)
|
this._integrations(device, this.entries).map(async (entry) => {
|
||||||
.filter((entry) => entry.state === "loaded")
|
if (entry.state !== "loaded") {
|
||||||
.map(async (entry) => {
|
return false;
|
||||||
|
}
|
||||||
const info = await fetchDiagnosticHandler(this.hass, entry.domain);
|
const info = await fetchDiagnosticHandler(this.hass, entry.domain);
|
||||||
|
|
||||||
if (!info.handlers.device && !info.handlers.config_entry) {
|
if (!info.handlers.device && !info.handlers.config_entry) {
|
||||||
return "";
|
return false;
|
||||||
}
|
}
|
||||||
const link = info.handlers.device
|
return {
|
||||||
|
link: info.handlers.device
|
||||||
? getDeviceDiagnosticsDownloadUrl(entry.entry_id, this.deviceId)
|
? getDeviceDiagnosticsDownloadUrl(entry.entry_id, this.deviceId)
|
||||||
: getConfigEntryDiagnosticsDownloadUrl(entry.entry_id);
|
: getConfigEntryDiagnosticsDownloadUrl(entry.entry_id),
|
||||||
return html`
|
domain: entry.domain,
|
||||||
<a href=${link} @click=${this._signUrl}>
|
};
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
|
links = links.filter(Boolean);
|
||||||
|
|
||||||
|
if (this._diagnosticDownloadLinks !== requestId) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (links.length > 0) {
|
||||||
|
this._diagnosticDownloadLinks = (
|
||||||
|
links as { link: string; domain: string }[]
|
||||||
|
).map(
|
||||||
|
(link) => html`
|
||||||
|
<a href=${link.link} @click=${this._signUrl}>
|
||||||
<mwc-button>
|
<mwc-button>
|
||||||
${this.hass.localize(
|
${links.length > 1
|
||||||
|
? this.hass.localize(
|
||||||
|
`ui.panel.config.devices.download_diagnostics_integration`,
|
||||||
|
{
|
||||||
|
integration: domainToName(
|
||||||
|
this.hass.localize,
|
||||||
|
link.domain
|
||||||
|
),
|
||||||
|
}
|
||||||
|
)
|
||||||
|
: this.hass.localize(
|
||||||
`ui.panel.config.devices.download_diagnostics`
|
`ui.panel.config.devices.download_diagnostics`
|
||||||
)}
|
)}
|
||||||
</mwc-button>
|
</mwc-button>
|
||||||
</a>
|
</a>
|
||||||
`;
|
`
|
||||||
})
|
|
||||||
);
|
);
|
||||||
if (this._diagnosticDownloadLinks !== requestId) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
links = links.filter(Boolean);
|
|
||||||
if (links.length > 0) {
|
|
||||||
this._diagnosticDownloadLinks = links;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2231,6 +2231,7 @@
|
|||||||
"open_configuration_url_device": "Visit device",
|
"open_configuration_url_device": "Visit device",
|
||||||
"open_configuration_url_service": "Visit service",
|
"open_configuration_url_service": "Visit service",
|
||||||
"download_diagnostics": "Download diagnostics",
|
"download_diagnostics": "Download diagnostics",
|
||||||
|
"download_diagnostics_integration": "Download {integration} diagnostics",
|
||||||
"type": {
|
"type": {
|
||||||
"device_heading": "Device",
|
"device_heading": "Device",
|
||||||
"device": "device",
|
"device": "device",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user