mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-23 17:26:42 +00:00
Remove custom MQTT delete device button (#11724)
This commit is contained in:
parent
9500ac498c
commit
eae7e82127
@ -44,15 +44,6 @@ export const subscribeMQTTTopic = (
|
||||
topic,
|
||||
});
|
||||
|
||||
export const removeMQTTDeviceEntry = (
|
||||
hass: HomeAssistant,
|
||||
deviceId: string
|
||||
): Promise<void> =>
|
||||
hass.callWS({
|
||||
type: "mqtt/device/remove",
|
||||
device_id: deviceId,
|
||||
});
|
||||
|
||||
export const fetchMQTTDebugInfo = (
|
||||
hass: HomeAssistant,
|
||||
deviceId: string
|
||||
|
@ -1,8 +1,6 @@
|
||||
import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit";
|
||||
import { customElement, property } from "lit/decorators";
|
||||
import { DeviceRegistryEntry } from "../../../../../../data/device_registry";
|
||||
import { removeMQTTDeviceEntry } from "../../../../../../data/mqtt";
|
||||
import { showConfirmationDialog } from "../../../../../../dialogs/generic/show-dialog-box";
|
||||
import { haStyle } from "../../../../../../resources/styles";
|
||||
import { HomeAssistant } from "../../../../../../types";
|
||||
import { showMQTTDeviceDebugInfoDialog } from "./show-dialog-mqtt-device-debug-info";
|
||||
@ -16,24 +14,9 @@ export class HaDeviceActionsMqtt extends LitElement {
|
||||
protected render(): TemplateResult {
|
||||
return html`
|
||||
<mwc-button @click=${this._showDebugInfo}> MQTT Info </mwc-button>
|
||||
<mwc-button class="warning" @click=${this._confirmDeleteEntry}>
|
||||
${this.hass.localize("ui.panel.config.devices.delete")}
|
||||
</mwc-button>
|
||||
`;
|
||||
}
|
||||
|
||||
private async _confirmDeleteEntry(): Promise<void> {
|
||||
const confirmed = await showConfirmationDialog(this, {
|
||||
text: this.hass.localize("ui.panel.config.devices.confirm_delete"),
|
||||
});
|
||||
|
||||
if (!confirmed) {
|
||||
return;
|
||||
}
|
||||
|
||||
await removeMQTTDeviceEntry(this.hass!, this.device.id);
|
||||
}
|
||||
|
||||
private async _showDebugInfo(): Promise<void> {
|
||||
const device = this.device;
|
||||
await showMQTTDeviceDebugInfoDialog(this, { device });
|
||||
|
Loading…
x
Reference in New Issue
Block a user