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