mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-14 04:46:34 +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;
|
webhook_id: string;
|
||||||
domain: string;
|
domain: string;
|
||||||
name: string;
|
name: string;
|
||||||
|
local_only: boolean;
|
||||||
}
|
}
|
||||||
export interface WebhookError {
|
export interface WebhookError {
|
||||||
code: number;
|
code: number;
|
||||||
|
@ -195,9 +195,18 @@ export class CloudWebhooks extends LitElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private async _fetchData() {
|
private async _fetchData() {
|
||||||
this._localHooks = isComponentLoaded(this.hass!, "webhook")
|
if (!isComponentLoaded(this.hass!, "webhook")) {
|
||||||
? await fetchWebhooks(this.hass!)
|
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 {
|
static get styles(): CSSResultGroup {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user