mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-08 18:06:36 +00:00
Fixes for dev-service panel (#337)
This commit is contained in:
parent
2c69e001ee
commit
12e3afb7b7
@ -75,7 +75,7 @@
|
|||||||
data='{{domain}}'>
|
data='{{domain}}'>
|
||||||
</app-localstorage-document>
|
</app-localstorage-document>
|
||||||
<app-localstorage-document
|
<app-localstorage-document
|
||||||
key='panel-dev-service-state-service'
|
key='[[computeServiceKey(domain)]]'
|
||||||
data='{{service}}'>
|
data='{{service}}'>
|
||||||
</app-localstorage-document>
|
</app-localstorage-document>
|
||||||
<app-localstorage-document
|
<app-localstorage-document
|
||||||
@ -86,7 +86,6 @@
|
|||||||
<div class='content'>
|
<div class='content'>
|
||||||
<p>
|
<p>
|
||||||
Call a service from a component.
|
Call a service from a component.
|
||||||
|
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<div class='ha-form'>
|
<div class='ha-form'>
|
||||||
@ -108,9 +107,12 @@
|
|||||||
|
|
||||||
<template is='dom-if' if='[[domain]]'>
|
<template is='dom-if' if='[[domain]]'>
|
||||||
<template is='dom-if' if='[[service]]'>
|
<template is='dom-if' if='[[service]]'>
|
||||||
<template is='dom-if' if='[[!_attributes.length]]'>
|
<template is='dom-if' if='[[!_description]]'>
|
||||||
<h1>No description is available</h1>
|
<h1>No description is available</h1>
|
||||||
</template>
|
</template>
|
||||||
|
<template is='dom-if' if='[[_description]]'>
|
||||||
|
<h3>[[_description]]</h3>
|
||||||
|
</template>
|
||||||
<template is='dom-if' if='[[_attributes.length]]'>
|
<template is='dom-if' if='[[_attributes.length]]'>
|
||||||
<h1>Valid Parameters</h1>
|
<h1>Valid Parameters</h1>
|
||||||
<table class='attributes'>
|
<table class='attributes'>
|
||||||
@ -177,6 +179,11 @@ Polymer({
|
|||||||
computed: 'computeAttributesArray(serviceDomains, domain, service)',
|
computed: 'computeAttributesArray(serviceDomains, domain, service)',
|
||||||
},
|
},
|
||||||
|
|
||||||
|
_description: {
|
||||||
|
type: String,
|
||||||
|
computed: 'computeDescription(serviceDomains, domain, service)',
|
||||||
|
},
|
||||||
|
|
||||||
serviceDomains: {
|
serviceDomains: {
|
||||||
type: Object,
|
type: Object,
|
||||||
computed: 'computeServiceDomains(hass)',
|
computed: 'computeServiceDomains(hass)',
|
||||||
@ -198,6 +205,13 @@ Polymer({
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
computeDescription: function (serviceDomains, domain, service) {
|
||||||
|
if (!serviceDomains) return undefined;
|
||||||
|
if (!(domain in serviceDomains)) return undefined;
|
||||||
|
if (!(service in serviceDomains[domain])) return undefined;
|
||||||
|
return serviceDomains[domain][service].description;
|
||||||
|
},
|
||||||
|
|
||||||
computeDomains: function (serviceDomains) {
|
computeDomains: function (serviceDomains) {
|
||||||
return Object.keys(serviceDomains).sort();
|
return Object.keys(serviceDomains).sort();
|
||||||
},
|
},
|
||||||
@ -208,6 +222,13 @@ Polymer({
|
|||||||
return Object.keys(serviceDomains[domain]).sort();
|
return Object.keys(serviceDomains[domain]).sort();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
computeServiceKey: function (domain) {
|
||||||
|
if (!domain) {
|
||||||
|
return 'panel-dev-service-state-service';
|
||||||
|
}
|
||||||
|
return 'panel-dev-service-state-service.' + domain;
|
||||||
|
},
|
||||||
|
|
||||||
computeServicedataKey: function (domain, service) {
|
computeServicedataKey: function (domain, service) {
|
||||||
if (!domain || !service) {
|
if (!domain || !service) {
|
||||||
return 'panel-dev-service-state-servicedata';
|
return 'panel-dev-service-state-servicedata';
|
||||||
|
Loading…
x
Reference in New Issue
Block a user