mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-18 23:06:40 +00:00
Remove custom Tasmota delete device button (#11725)
This commit is contained in:
parent
eae7e82127
commit
cc177ef911
@ -1,10 +0,0 @@
|
|||||||
import { HomeAssistant } from "../types";
|
|
||||||
|
|
||||||
export const removeTasmotaDeviceEntry = (
|
|
||||||
hass: HomeAssistant,
|
|
||||||
deviceId: string
|
|
||||||
): Promise<void> =>
|
|
||||||
hass.callWS({
|
|
||||||
type: "tasmota/device/remove",
|
|
||||||
device_id: deviceId,
|
|
||||||
});
|
|
@ -1,46 +0,0 @@
|
|||||||
import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit";
|
|
||||||
import { customElement, property } from "lit/decorators";
|
|
||||||
import { DeviceRegistryEntry } from "../../../../../../data/device_registry";
|
|
||||||
import { removeTasmotaDeviceEntry } from "../../../../../../data/tasmota";
|
|
||||||
import { showConfirmationDialog } from "../../../../../../dialogs/generic/show-dialog-box";
|
|
||||||
import { haStyle } from "../../../../../../resources/styles";
|
|
||||||
import { HomeAssistant } from "../../../../../../types";
|
|
||||||
|
|
||||||
@customElement("ha-device-actions-tasmota")
|
|
||||||
export class HaDeviceActionsTasmota extends LitElement {
|
|
||||||
@property({ attribute: false }) public hass!: HomeAssistant;
|
|
||||||
|
|
||||||
@property() public device!: DeviceRegistryEntry;
|
|
||||||
|
|
||||||
protected render(): TemplateResult {
|
|
||||||
return html`
|
|
||||||
<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 removeTasmotaDeviceEntry(this.hass!, this.device.id);
|
|
||||||
}
|
|
||||||
|
|
||||||
static get styles(): CSSResultGroup {
|
|
||||||
return [
|
|
||||||
haStyle,
|
|
||||||
css`
|
|
||||||
:host {
|
|
||||||
display: flex;
|
|
||||||
justify-content: space-between;
|
|
||||||
}
|
|
||||||
`,
|
|
||||||
];
|
|
||||||
}
|
|
||||||
}
|
|
@ -860,17 +860,6 @@ export class HaConfigDevicePage extends LitElement {
|
|||||||
></ha-device-actions-ozw>
|
></ha-device-actions-ozw>
|
||||||
`);
|
`);
|
||||||
}
|
}
|
||||||
if (domains.includes("tasmota")) {
|
|
||||||
import(
|
|
||||||
"./device-detail/integration-elements/tasmota/ha-device-actions-tasmota"
|
|
||||||
);
|
|
||||||
deviceActions.push(html`
|
|
||||||
<ha-device-actions-tasmota
|
|
||||||
.hass=${this.hass}
|
|
||||||
.device=${device}
|
|
||||||
></ha-device-actions-tasmota>
|
|
||||||
`);
|
|
||||||
}
|
|
||||||
if (domains.includes("zha")) {
|
if (domains.includes("zha")) {
|
||||||
import("./device-detail/integration-elements/zha/ha-device-actions-zha");
|
import("./device-detail/integration-elements/zha/ha-device-actions-zha");
|
||||||
import("./device-detail/integration-elements/zha/ha-device-info-zha");
|
import("./device-detail/integration-elements/zha/ha-device-info-zha");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user