mirror of
https://github.com/home-assistant/frontend.git
synced 2025-04-24 21:37:21 +00:00
Hide local webhooks (#11123)
Co-authored-by: Joakim Sørensen <joasoe@gmail.com>
This commit is contained in:
parent
08863348dc
commit
4cb7154917
@ -4,6 +4,7 @@ export interface Webhook {
|
||||
webhook_id: string;
|
||||
domain: string;
|
||||
name: string;
|
||||
local_only: boolean;
|
||||
}
|
||||
export interface WebhookError {
|
||||
code: number;
|
||||
|
@ -195,9 +195,18 @@ export class CloudWebhooks extends LitElement {
|
||||
}
|
||||
|
||||
private async _fetchData() {
|
||||
this._localHooks = isComponentLoaded(this.hass!, "webhook")
|
||||
? await fetchWebhooks(this.hass!)
|
||||
: [];
|
||||
if (!isComponentLoaded(this.hass!, "webhook")) {
|
||||
this._localHooks = [];
|
||||
return;
|
||||
}
|
||||
const hooks = await fetchWebhooks(this.hass!);
|
||||
this._localHooks = hooks.filter(
|
||||
(hook) =>
|
||||
// Only hooks that are not limited to local requests are relevant
|
||||
!hook.local_only &&
|
||||
// Deleted webhooks -> nobody cares :)
|
||||
(hook.domain !== "mobile_app" || hook.name !== "Deleted Webhook")
|
||||
);
|
||||
}
|
||||
|
||||
static get styles(): CSSResultGroup {
|
||||
|
Loading…
x
Reference in New Issue
Block a user