mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-19 07:16:39 +00:00
Tweak
This commit is contained in:
parent
0dc56d7983
commit
f88ce269a7
@ -270,7 +270,6 @@ export class HaConfigDevicePage extends LitElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private _renderDeleteButtons() {
|
private _renderDeleteButtons() {
|
||||||
console.log("Hello!")
|
|
||||||
const device = this._device(this.deviceId, this.devices);
|
const device = this._device(this.deviceId, this.devices);
|
||||||
|
|
||||||
if (!device) {
|
if (!device) {
|
||||||
@ -278,8 +277,6 @@ export class HaConfigDevicePage extends LitElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let buttons = this._integrations(device, this.entries).map((entry) => {
|
let buttons = this._integrations(device, this.entries).map((entry) => {
|
||||||
console.log("Hello!")
|
|
||||||
console.log(entry.supports_remove_device)
|
|
||||||
if (entry.state !== "loaded" || !entry.supports_remove_device) {
|
if (entry.state !== "loaded" || !entry.supports_remove_device) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -296,7 +293,11 @@ export class HaConfigDevicePage extends LitElement {
|
|||||||
buttons as { entry_id: string; domain: string }[]
|
buttons as { entry_id: string; domain: string }[]
|
||||||
).map(
|
).map(
|
||||||
(button) => html`
|
(button) => html`
|
||||||
<mwc-button class="warning" @click=${this._confirmDeleteEntry}>
|
<mwc-button
|
||||||
|
class="warning"
|
||||||
|
entry_id=${button.entry_id}
|
||||||
|
@click=${this._confirmDeleteEntry}
|
||||||
|
>
|
||||||
${buttons.length > 1
|
${buttons.length > 1
|
||||||
? this.hass.localize(
|
? this.hass.localize(
|
||||||
`ui.panel.config.devices.delete_device_integration`,
|
`ui.panel.config.devices.delete_device_integration`,
|
||||||
@ -307,16 +308,16 @@ export class HaConfigDevicePage extends LitElement {
|
|||||||
),
|
),
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
: this.hass.localize(
|
: this.hass.localize(`ui.panel.config.devices.delete_device`)}
|
||||||
`ui.panel.config.devices.delete_device`
|
|
||||||
)}
|
|
||||||
</mwc-button>
|
</mwc-button>
|
||||||
`
|
`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async _confirmDeleteEntry(): Promise<void> {
|
private async _confirmDeleteEntry(e: MouseEvent): Promise<void> {
|
||||||
|
const entry_id = (e.currentTarget! as HTMLElement).getAttribute("entry_id")
|
||||||
|
|
||||||
const confirmed = await showConfirmationDialog(this, {
|
const confirmed = await showConfirmationDialog(this, {
|
||||||
text: this.hass.localize("ui.panel.config.devices.confirm_delete"),
|
text: this.hass.localize("ui.panel.config.devices.confirm_delete"),
|
||||||
});
|
});
|
||||||
@ -325,7 +326,7 @@ export class HaConfigDevicePage extends LitElement {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
await removeConfigEntryFromDevice(this.hass!, this.deviceId, "blabla");
|
await removeConfigEntryFromDevice(this.hass!, this.deviceId, entry_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected firstUpdated(changedProps) {
|
protected firstUpdated(changedProps) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user