Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 24 additions & 3 deletions panels/dev-service/ha-panel-dev-service.html
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -86,7 +86,6 @@
<div class='content'>
<p>
Call a service from a component.

</p>

<div class='ha-form'>
Expand All @@ -108,9 +107,12 @@ <h1>Select a service to see the description</h1>

<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'>
Expand Down Expand Up @@ -177,6 +179,11 @@ <h1>Valid Parameters</h1>
computed: 'computeAttributesArray(serviceDomains, domain, service)',
},

_description: {
type: String,
computed: 'computeDescription(serviceDomains, domain, service)',
},

serviceDomains: {
type: Object,
computed: 'computeServiceDomains(hass)',
Expand All @@ -198,6 +205,13 @@ <h1>Valid Parameters</h1>
});
},

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();
},
Expand All @@ -208,6 +222,13 @@ <h1>Valid Parameters</h1>
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';
Expand Down