mirror of
https://github.com/home-assistant/frontend.git
synced 2025-04-27 06:47:20 +00:00
Implemented navigate function
Fix linting error
This commit is contained in:
parent
8afc3812b7
commit
bf0eb798d9
@ -1,6 +1,7 @@
|
|||||||
import { HomeAssistant } from "../../types";
|
import { HomeAssistant } from "../../types";
|
||||||
import { LovelaceElementConfig } from "../../panels/lovelace/elements/types";
|
import { LovelaceElementConfig } from "../../panels/lovelace/elements/types";
|
||||||
import { fireEvent } from "../dom/fire_event.js";
|
import { fireEvent } from "../dom/fire_event.js";
|
||||||
|
import { navigate } from "../../common/navigate";
|
||||||
import toggleEntity from "../../../src/panels/lovelace/common/entity/toggle-entity";
|
import toggleEntity from "../../../src/panels/lovelace/common/entity/toggle-entity";
|
||||||
|
|
||||||
export const handleClick = (
|
export const handleClick = (
|
||||||
@ -24,7 +25,7 @@ export const handleClick = (
|
|||||||
fireEvent(node, "hass-more-info", { entityId: config.entity });
|
fireEvent(node, "hass-more-info", { entityId: config.entity });
|
||||||
break;
|
break;
|
||||||
case "navigate":
|
case "navigate":
|
||||||
// this.navigate(config.navigation_path); // TODO wait for balloob's navigate function
|
navigate(node, config.navigation_path ? config.navigation_path : "");
|
||||||
break;
|
break;
|
||||||
case "toggle":
|
case "toggle":
|
||||||
toggleEntity(hass, config.entity);
|
toggleEntity(hass, config.entity);
|
||||||
@ -32,11 +33,10 @@ export const handleClick = (
|
|||||||
case "call-service": {
|
case "call-service": {
|
||||||
if (config.service) {
|
if (config.service) {
|
||||||
const [domain, service] = config.service.split(".", 2);
|
const [domain, service] = config.service.split(".", 2);
|
||||||
const serviceData = Object.assign(
|
const serviceData = {
|
||||||
{},
|
entity_id: config.entity,
|
||||||
{ entity_id: config.entity },
|
...config.service_data,
|
||||||
config.service_data
|
};
|
||||||
);
|
|
||||||
hass.callService(domain, service, serviceData);
|
hass.callService(domain, service, serviceData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user