Files
ha-frontend-cdce8p/panels/config/automation/ha-automation-picker.html
T
Paulus Schoutsen b34c2a6f92 Consolidate config (#377)
* Move automation panel to config

* Hide Hass menu button from error screen

* No longer store undefined in local storage

* Move Z-Wave panel into config panel

* Move Z-Wave node options from core to Z-Wave config

* Remove panel entries in polymer.json

* Lint
2017-08-06 09:22:15 -07:00

147 lines
3.9 KiB
HTML

<link rel="import" href="../../../bower_components/polymer/polymer.html">
<link rel="import" href="../../../bower_components/app-layout/app-header-layout/app-header-layout.html">
<link rel="import" href="../../../bower_components/app-layout/app-header/app-header.html">
<link rel="import" href="../../../bower_components/app-layout/app-toolbar/app-toolbar.html">
<link rel="import" href="../../../bower_components/paper-card/paper-card.html">
<link rel="import" href="../../../bower_components/paper-item/paper-item.html">
<link rel="import" href="../../../bower_components/paper-item/paper-item-body.html">
<link rel="import" href="../../../bower_components/paper-fab/paper-fab.html">
<link rel="import" href="../../../bower_components/paper-icon-button/paper-icon-button.html">
<link rel="import" href="../ha-config-section.html">
<dom-module id="ha-automation-picker">
<template>
<style include="ha-style">
:host {
display: block;
}
/* .content {
padding: 16px;
}
*/
paper-item {
cursor: pointer;
}
paper-fab {
position: fixed;
bottom: 16px;
right: 16px;
z-index: 1;
}
paper-fab[is-wide] {
bottom: 24px;
right: 24px;
}
a {
color: var(--primary-color);
}
</style>
<app-header-layout has-scrolling-region>
<app-header slot="header" fixed>
<app-toolbar>
<paper-icon-button
icon='mdi:arrow-left'
on-tap='_backTapped'
></paper-icon-button>
<div main-title>Automations</div>
</app-toolbar>
</app-header>
<ha-config-section
is-wide='[[isWide]]'
>
<div slot='header'>Automation editor</div>
<div slot='introduction'>
The automation editor allows you to create and edit automations.
Please read <a href='https://home-assistant.io/docs/automation/editor/' target='_blank'>the instructions</a> to make sure that you have configured Home Assistant correctly.
</div>
<paper-card heading='Pick automation to edit'>
<template is='dom-if' if='[[!automations.length]]'>
<div class='card-content'>
<p>We couldn't find any editable automations.</p>
</div>
</template>
<template is='dom-repeat' items='[[automations]]' as='automation'>
<paper-item>
<paper-item-body two-line on-tap='automationTapped'>
<div>[[computeName(automation)]]</div>
<div secondary>[[computeDescription(automation)]]</div>
</paper-item-body>
<iron-icon icon='mdi:chevron-right'></iron-icon>
</paper-item>
</template>
</paper-card>
</ha-config-section>
<paper-fab
is-wide$='[[isWide]]'
icon='mdi:plus'
title='Add Automation'
on-tap='addAutomation'
></paper-fab>
</app-header-layout>
</template>
</dom-module>
<script>
Polymer({
is: 'ha-automation-picker',
properties: {
hass: {
type: Object,
},
narrow: {
type: Boolean,
},
showMenu: {
type: Boolean,
value: false,
},
automations: {
type: Array,
},
isWide: {
type: Boolean,
},
},
automationTapped: function (ev) {
history.pushState(
null, null, '/config/automation/edit/' + this.automations[ev.model.index].attributes.id);
this.fire('location-changed');
},
addAutomation: function () {
history.pushState(null, null, '/config/automation/new');
this.fire('location-changed');
},
computeName: function (automation) {
return window.hassUtil.computeStateName(automation);
},
// Still thinking of something to add here.
// eslint-disable-next-line
computeDescription: function (automation) {
return '';
},
_backTapped: function () {
history.back();
},
});
</script>