Compare commits

..

583 Commits

Author SHA1 Message Date
Bram Kragten
254744cd7d Bumped version to 20200318.1 2020-03-18 23:29:00 +01:00
Zack Arnett
595d04c922 Fix theme update (#5246) 2020-03-18 23:28:50 +01:00
Bram Kragten
a3969fe2c8 Fix stack editor in stack editor (#5255) 2020-03-18 23:28:42 +01:00
Paulus Schoutsen
220e4134b7 Fix calculating title if panels not loaded yet (#5262) 2020-03-18 23:28:35 +01:00
Bram Kragten
56e176a6f1 Fix stack editor in conditional card (#5265) 2020-03-18 23:28:30 +01:00
Bram Kragten
89a94b3efc Merge pull request #5252 from home-assistant/dev
20200318.0
2020-03-18 12:33:12 +01:00
Bram Kragten
71793dcfa5 Cast fix for urlPath === "lovelace" (#5242) 2020-03-18 12:19:01 +01:00
Bram Kragten
1e527a8350 Bumped version to 20200318.0 2020-03-18 12:18:24 +01:00
Bram Kragten
262b12eb93 Fix dialog conent color (#5251)
* Fix ha-dialog content color

* Fix
2020-03-18 12:17:01 +01:00
HomeAssistant Azure
7fb1e699ae [ci skip] Translation update 2020-03-18 00:32:39 +00:00
Aidan Timson
9ee647329b Fix Wrong Index for Filtered Tabs (#5221)
* Fix wrong index for filtered tabs

* Set active tab to actual tab and use path

* Update src/layouts/hass-tabs-subpage.ts

Co-Authored-By: Paulus Schoutsen <paulus@home-assistant.io>

* Update src/layouts/hass-tabs-subpage.ts

Co-Authored-By: Paulus Schoutsen <paulus@home-assistant.io>

Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
Co-authored-by: Bram Kragten <mail@bramkragten.nl>
2020-03-17 20:44:07 +01:00
HomeAssistant Azure
cd6dcec644 [ci skip] Translation update 2020-03-17 00:32:43 +00:00
Bram Kragten
d8f248c60e Merge pull request #5234 from home-assistant/dev
20200316.1
2020-03-16 21:18:04 +01:00
Aidan Timson
2925b930ad Set Title to Current Panel (#5220)
* Set title to current panel

* Move to mixin

* Naming

* guard clause
2020-03-16 20:54:55 +01:00
Bram Kragten
127aaba47b Add UI for reload resources service (#5229)
* Add UI for reload resources service

* Update hui-root.ts

* Check for config of main panel
2020-03-16 20:52:21 +01:00
Bram Kragten
8bc8761af6 Bumped version to 20200316.1 2020-03-16 20:32:59 +01:00
Bram Kragten
a88321d243 Only show url path field in advanced mode (#5233) 2020-03-16 20:32:13 +01:00
Bram Kragten
4e19232960 Merge pull request #5230 from Tediore/patch-3
Minor corrections and cosmetic improvements
2020-03-16 14:51:14 +01:00
Jay
5b95bdb6b7 Minor corrections and cosmetic improvements
Updated the correct file this time...
2020-03-16 08:15:18 -05:00
Bram Kragten
0fc59ccb16 Merge pull request #5228 from home-assistant/dev
20200316.0
2020-03-16 12:38:28 +01:00
Bram Kragten
a9daf9835a Bumped version to 20200316.0 2020-03-16 12:24:39 +01:00
Zack Arnett
2110d9c3b9 Map Card: Fix Dark Mode Toggle (#5209)
* Fix Editor

* comment
2020-03-16 12:23:13 +01:00
Zack Arnett
b77e0b8125 Card Picker: Remove Scale (#5205)
* remove scalling

* add zoom back
2020-03-16 12:22:56 +01:00
Zack Arnett
5197f102ea Webpage Card: Fix Aspect Ratio in Editor (#5210)
* fix Ifram editor

* suffix
2020-03-16 12:22:41 +01:00
Bram Kragten
447d4604c6 Require hyphen in lovelace dashboard url path (#5214)
* Require hyphen in url path

* Update dialog-lovelace-dashboard-detail.ts
2020-03-16 12:22:21 +01:00
Jason Lachowsky
5a84e34f93 Corrected minor misspellings (#5225) 2020-03-16 11:56:04 +01:00
Jay
fb6d3cccdc Cosmetic improvements, minor corrections (#5199)
Made some minor corrections:
"it's" > "its" ("its" is the possessive form of "it")
"setup" > "set up" ("setup" is a noun, "set up" is a verb)

Cosmetic improvement:
"can not" > "cannot" (both are correct, but "cannot" is usually more common, at least in the US. Strictly a matter of opinion here so no worries if you want this reversed.)
2020-03-16 11:51:43 +01:00
HomeAssistant Azure
fad3cb185b [ci skip] Translation update 2020-03-16 00:32:44 +00:00
HomeAssistant Azure
f61ce395f5 [ci skip] Translation update 2020-03-15 00:32:49 +00:00
Franck Nijhof
17f3299152 Fix brightness_pct in light device turn_on action (#5201) 2020-03-13 21:58:34 -07:00
HomeAssistant Azure
17e04589d0 [ci skip] Translation update 2020-03-14 00:32:33 +00:00
Bram Kragten
4b2edde81b Merge pull request #5198 from home-assistant/dev
20200313.0
2020-03-13 20:39:21 +01:00
Bram Kragten
5d3d766f56 Bumped version to 20200313.0 2020-03-13 20:25:21 +01:00
Zack Arnett
94e2a0dea0 Media Card: Reset Marquee on Text change (#5184)
* Stop marquee on next and prev

* force stop

* clean

* This is much better

* Clean

* comments

* comment

* No more repaints
2020-03-13 20:22:49 +01:00
Paulus Schoutsen
21fe68add0 Stub config tweaks (#5197)
* Stub config tweaks

* Lint
2020-03-13 20:22:34 +01:00
Bram Kragten
af6ebea4a3 Fix translations in production builds (#5192)
* Fix translations in production builds

* Make env functions
2020-03-13 10:19:32 -07:00
Paulus Schoutsen
3c17ee03b6 Improve color extraction for media control card (#5189)
* Improve color extraction

* Lazy load media control

* Update src/panels/lovelace/cards/hui-media-control-card.ts

Co-Authored-By: Bram Kragten <mail@bramkragten.nl>

* Extract constant

* Fix media control demo

* Remove quality(1)

Co-authored-by: Bram Kragten <mail@bramkragten.nl>
2020-03-13 10:01:36 -07:00
Bram Kragten
0c3c007faf Check if entities is an array (#5193) 2020-03-13 17:48:49 +01:00
Zack Arnett
330eb0957b Update Gauge CSS (#5182) 2020-03-13 14:52:12 +01:00
HomeAssistant Azure
02923475e6 [ci skip] Translation update 2020-03-13 01:16:04 +00:00
Zack Arnett
01ff97b366 Fix Marquee Ellipsis (#5183) 2020-03-12 19:08:51 -04:00
Bram Kragten
f0a4a99654 Merge pull request #5181 from home-assistant/dev
20200312.0
2020-03-12 21:43:28 +01:00
Bram Kragten
02d2368654 Bumped version to 20200312.0 2020-03-12 21:05:35 +01:00
Bram Kragten
e19d07e434 Typos (#5180)
Fixes #5179
Fixes #5178
2020-03-12 21:04:46 +01:00
Bram Kragten
669ed5cb28 Dont create new array on every render (#5177) 2020-03-12 21:02:05 +01:00
Bram Kragten
785ae4a83d Fix for views with url starting with a number (#5176) 2020-03-12 20:49:26 +01:00
Bram Kragten
d327045802 Update dialog-helper-detail.ts 2020-03-12 20:48:41 +01:00
Bram Kragten
785ef19cce Only update map if one of entities changed (#5175) 2020-03-12 20:37:54 +01:00
Bram Kragten
f5653d0da5 Show if helper can be edited (#5174)
Fixes #5173
Fixes #5171
2020-03-12 20:37:33 +01:00
Bram Kragten
e0a6d2efe5 Add on state to media control card (#5168) 2020-03-12 20:11:33 +01:00
Bram Kragten
9971e2e934 Fix scroll entity settings dialog (#5165)
Fixes #5144
2020-03-12 20:11:19 +01:00
Bram Kragten
558802c7dd Simplify action handler directive (#5157) 2020-03-12 20:11:05 +01:00
Bram Kragten
91edcf9b52 Fix stack size (#5155) 2020-03-12 20:10:45 +01:00
Sergey Avdeev
f401aa2897 Update icon_color_css.ts (#5163) 2020-03-12 20:10:30 +01:00
Bram Kragten
1d0389327f Fix helper UI (#5161)
Fixes #5146
Fixes #5145
Fixes #5142
2020-03-12 20:10:06 +01:00
Bram Kragten
06cd7556f3 Dashboard UI fixes (#5160)
Fixes #5152
Fixes #5150
Fixes #5148
2020-03-12 20:09:55 +01:00
Bram Kragten
3b1f9a5dab Fix secondary info (#5159) 2020-03-12 20:09:41 +01:00
Bram Kragten
f54cd18da4 Fix resize observer on error card (#5158)
* Fix resize observer on error card

* Update hui-media-control-card.ts
2020-03-12 20:09:27 +01:00
Zack Arnett
73e0fd614e updates transparent to be hex plus alpha of 0 (#5167) 2020-03-12 19:47:48 +01:00
Paulus Schoutsen
9b220cc6ce Extract media controls into method (#5141)
* Extract media controls into method

* address comments

* lint

* Moooorre fixes

* Fix margin

* Update demos

* Very narrow idle players show play button

* Lint

* More stuff

* Marquee on steroids
2020-03-12 10:40:03 +01:00
Zack Arnett
c7a5f63e33 Fix for safari (#5143) 2020-03-12 10:06:08 +01:00
HomeAssistant Azure
11192e6065 [ci skip] Translation update 2020-03-12 00:32:46 +00:00
Bram Kragten
d83b308100 Fix area dialog too wide (#5136)
* Fix area dialog to wide

* Update styles
2020-03-11 17:10:26 -07:00
Quentame
f67bf6908f Refactor Freebox : add config flow + temperature sensor + signal dispatch (#4448)
* Add config flow to Freebox

* Compress image with https://tinypng.com/
2020-03-11 22:12:40 +01:00
Bram Kragten
2784edc689 Merge pull request #5135 from home-assistant/dev
20200311.1
2020-03-11 19:07:22 +01:00
Bram Kragten
8f41e99464 Bumped version to 20200311.1 2020-03-11 18:52:20 +01:00
Paulus Schoutsen
7c2b37e8ca Demo paths (#5134)
* Update paths to images in demo

* Remove some unused attributes

* Fix camera paths
2020-03-11 10:37:23 -07:00
Bram Kragten
dbdbad2deb Fix closing hui-editor (#5132) 2020-03-11 15:23:31 +01:00
Bram Kragten
e5db86363c Only save non system generated users and tweak text (#5131)
* Only save non system generated users and tweak text

* Clean up
2020-03-11 15:23:19 +01:00
Bram Kragten
b2026c1cd7 Fix automation event trigger UI (#5130) 2020-03-11 13:47:23 +01:00
Bram Kragten
b12f29afad Merge pull request #5128 from home-assistant/dev
20200311.0
2020-03-11 10:09:46 +01:00
Bram Kragten
04b23388b5 Bumped version to 20200311.0 2020-03-11 09:49:43 +01:00
Bram Kragten
7309a937e8 Bump home-assistant-js-websocket (#5127) 2020-03-11 09:38:21 +01:00
Ian Richardson
5dbcd1f726 ability to show attribute instead of state in picture-glance (#4958) 2020-03-11 09:01:00 +01:00
guillempages
3338459139 Allow state-label-element to show attributes (#4953)
* Allow state-label-element to show attributes

Add an additional (optional) parameter to the state-label element,
so that instead of showing the state, an attribute can be shown instead.

Can be used to e.g. add a climate entity to the floorplan,
but show the current temperature instead of the desired one.

* Improve style

Put the most frequent case as default in the ternary

* Remove unneeded variables

Use the _config.attribute directly instead of having a local temporary
Also remove superfluous checks for "!stateObj" (was already checked before)
2020-03-11 09:00:43 +01:00
Bram Kragten
35f17fc1d4 Add no data row when data table empty (#5113) 2020-03-11 08:42:52 +01:00
Zack Arnett
e062940639 Media Card: Fix Style Maps (#5120)
* Fix style map

* Comments
2020-03-11 08:42:34 +01:00
HomeAssistant Azure
ff4d5265c5 [ci skip] Translation update 2020-03-11 00:32:44 +00:00
Paulus Schoutsen
906f417436 Lazy load our elements once again (#5124) 2020-03-10 15:18:13 -07:00
Bram Kragten
1c75fe3bb8 Change marquee to css animations (#5119)
* Update hui-marquee.ts

* Change to css animation

* Comments

* tweaks

* Prevent page repaint on animation start/end
2020-03-10 17:39:16 -04:00
Bram Kragten
283e858576 Helpers: remove init values, change date/time mode picker, dont… (#5118) 2020-03-10 09:37:44 -07:00
HomeAssistant Azure
2b4ab6320b [ci skip] Translation update 2020-03-10 00:32:45 +00:00
Bram Kragten
2085260ce7 Fixes media card (#5115)
* Fixes media card

* Update hui-media-control-card.ts

* Change update of progress bar
2020-03-09 21:22:17 +01:00
Erik Montnemery
1f143176ad Use fallback for device name on device page (#5116)
* Use fallback for device name on device page

* Update ha-config-device-page.ts

* Lint
2020-03-09 21:09:27 +01:00
Bram Kragten
dd2163a837 Update media_player.family_room_2 2020-03-09 19:27:58 +01:00
Zack Arnett
0e1eca8a3e Media Card: Add Marquee to Title (#5095)
* Marquee Addition

* Review Comments

* instance var name change

* fix merge

* Comments plus merge fix
2020-03-09 09:43:53 -07:00
Bram Kragten
9da32880ec Fix update of cached datatables on connect (#5114) 2020-03-09 08:19:23 -07:00
Bram Kragten
15aee6a66a Fix alignment of generic entity row (#5112) 2020-03-09 13:55:30 +01:00
Zack Arnett
aba74f074a Fix input number from overflowing (#5099) 2020-03-09 13:55:14 +01:00
Bram Kragten
75860508de Recalc content height on lovelace change (#5110)
Fixes https://github.com/home-assistant/frontend/issues/5108
2020-03-09 13:20:26 +01:00
Aidan Timson
52160a367a 🔧 Standardize Generic Dialogs (#4726)
* 🔧 Use confirmation dialog in area deletion

* Swap automation confirmation dialogs

* Add to disable webhook

* Add to person deletion

* Add to zone deletion

* Add dialogs in raw editor

* Add/fix try catch

Co-authored-by: Bram Kragten <mail@bramkragten.nl>
2020-03-09 13:16:02 +01:00
Zack Arnett
5651a61604 Media Card: Adds Cursor: Pointer to Progress Bar (#5091) 2020-03-08 20:59:40 -07:00
Zack Arnett
959d8c3181 Media Card: Colors more integrated with Art (#5105) 2020-03-08 20:55:03 -07:00
Paulus Schoutsen
64ee7456dc Style unavailable/unknown cards (#5104)
* Style unavailable/unknown cards

* Hide default image if unavailable

* Style map

Co-authored-by: Zack Arnett <arnett.zackary@gmail.com>
2020-03-08 14:19:58 -07:00
Paulus Schoutsen
814fcf63a8 Fix cardHeight (#5102)
* Fix cardHeight

* Opacity instead of changing DOM

* Better fix

* Remove guard we don't need
2020-03-08 09:42:59 -07:00
Zack Arnett
b72d8cf7d7 Media Card: Fix Progress update (#5096) 2020-03-07 22:00:52 -08:00
Zack Arnett
8e7ef58715 Card Picker: Firefox Fix (#5098) 2020-03-07 21:59:25 -08:00
Paulus Schoutsen
56bfa01c56 Fix demo name 2020-03-07 21:53:40 -08:00
Paulus Schoutsen
4a0fc3e087 Rename demo 2020-03-07 21:51:48 -08:00
Paulus Schoutsen
f3c371996f Add media player card gallery (#5101) 2020-03-07 21:47:53 -08:00
Paulus Schoutsen
e5467181cb Fix vibrant type (#5100) 2020-03-08 00:46:51 -05:00
HomeAssistant Azure
0b3d2ea4ad [ci skip] Translation update 2020-03-08 00:32:36 +00:00
HomeAssistant Azure
9648aa3588 [ci skip] Translation update 2020-03-07 00:32:40 +00:00
HomeAssistant Azure
1b92cbbf74 [ci skip] Translation update 2020-03-06 13:41:27 +00:00
Bram Kragten
9979c046b3 Update azure-pipelines-translation.yml for Azure Pipelines 2020-03-06 14:38:19 +01:00
Bram Kragten
9ad121f9e6 Merge pull request #5089 from home-assistant/dev
20200306.0
2020-03-06 14:19:28 +01:00
Bram Kragten
a0900afba3 Bumped version to 20200306.0 2020-03-06 14:00:36 +01:00
Bram Kragten
1cb614c8a8 Forgot border height (#5088) 2020-03-06 13:46:11 +01:00
David F. Mulcahey
e63723f39e fix click handlers on data tables (#5087) 2020-03-06 13:45:12 +01:00
Bram Kragten
720bd03173 Add image to demo media player (#5086) 2020-03-06 13:44:59 +01:00
Bram Kragten
9e07cf67a5 Fix navigation after deleting a view and allow deleting view with cards (#5085)
* Fix navigation after deleting a view

* Allow deleting views with cards
2020-03-06 13:14:43 +01:00
Thomas Lovén
503dec7345 GUI editor for conditional card (#5051)
* GUI editor for conditional card

* Typing

* Fix typos. Remove quotes

* Add lovelace to card picker

* Address review comments
2020-03-06 12:58:41 +01:00
Bram Kragten
5a2649a65b Virtualize data tabel (#5066)
* WIP

* Fixes and implement further

* Give more space to table on mobile

* Remove unused deps

* Update ha-config-lovelace-dashboards.ts

* Add auto-height

* Console.bye

hihi

* lint
2020-03-06 12:58:13 +01:00
Tomasz
1599dc9e16 Set view visibility form UI (#4978)
* wip

* move logic to hui-view-visibility-editor.ts

* users will be always set

* extra filter to remove deleted users

* added better UI.
I had to add &nbsp; to ha-switch to avoid scrollbar

* fix for comments

* setting default visibility in a better way

* simplified logic, addressed comments
2020-03-06 12:36:34 +01:00
Zack Arnett
84dc8188c4 New Media Player - Cloned from Android Spotify Notification (#5044)
* Media Player Spotify Clone

* Ellipsis fix

* Style for theme update

* Height now determined by player height

* comments - Also includes Testing with images

* Pushing to resolve balloobs comments ;)

* Add Node Vibrant type

* Update Styles

* Comments

* Reviews

* Lint

* undo readme

* Reviews && Clean up

* Clear Interval

* Animation updates + comments

* small style tweak and comment

* Last little fix

Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
2020-03-05 21:33:38 -05:00
Paulus Schoutsen
74657ae815 Make cast backwards compatible (#5081)
* Make cast backwards compatible

* Update hc-main.ts

* Update home-assistant-js-websocket
2020-03-05 13:36:13 -08:00
Paulus Schoutsen
1a3b747d17 Style fixes to lovelace config dashboard (#5055)
* Style fixes to lovelace config dashboard

* Add standard panel and show which is default

* Update dialog-lovelace-dashboard-detail.ts

* Updated lovelace icon

* Comments and adapt to backend changes
2020-03-05 11:52:16 -08:00
Bram Kragten
802db71400 Fix secondary info in generic entity row (#5072) 2020-03-05 20:42:15 +01:00
Paulus Schoutsen
4f98524258 Optimise config entities panel + clarify not being able to dele… (#5079) 2020-03-05 09:09:29 -08:00
Bram Kragten
b17ea09b8b Improve chips (#5070)
Follow mdc specs
2020-03-05 12:59:32 +01:00
Bram Kragten
8abbc71e91 Only rebuild when current panel changed (#5071)
* Only rebuild when current panel changed

* Oops

* Update yarn.lock

* copy dep to repo

* Update deep-equal.ts

* Comments
2020-03-05 12:59:18 +01:00
Paulus Schoutsen
1db31fb0f7 Show entity reg editor for helpers when not editable (#5056) 2020-03-04 17:20:16 -08:00
Bram Kragten
e9b5725d7b Update default icon Lovelace sidebar. (#5069) 2020-03-05 00:19:41 +01:00
Bram Kragten
d3105b6846 Add rel=noopener (#5046) 2020-03-04 22:34:48 +01:00
Bram Kragten
196540afc7 Allow card editors to use card picker again (#5067) 2020-03-04 22:04:04 +01:00
Paulus Schoutsen
2b8b9f8311 Remove unused camera command (#5068) 2020-03-04 12:39:56 -08:00
redbar0n
b4f0fce600 Changed login text to be less misleading (#5054)
* Changed login text to be less misleading

See https://github.com/home-assistant/frontend/issues/5053

* Update according to suggestion for improvement

The new text should be more user-friendly.
2020-03-04 15:31:40 +01:00
Zack Arnett
c6f101a487 Add Descriptions for cards - Card Picker (#5058)
* Add Descriptions for cards - this is for card pick

* oops

* Comments from Frenck

* few card capitalizations found

* Comments

* Comments on glance
2020-03-03 17:05:24 -05:00
Paulus Schoutsen
54739c7ccd Support grouped system log messages (#5030)
* Support grouped system log messages

* Format source
2020-03-03 13:55:26 -08:00
Zack Arnett
aa2e632df3 Card Picker with Previews of cards (#4975)
* Card Picker with Previews of cards

* Getting Preview Async - Using dialogs entities

* Create generic getElement - filter entities before

* lint

* Add entities back to Picker. Set Qualifier

* Style Updates

* Move setup of filtered cards to connected

* style updates

* Dont pull entities if noEntity config

* Move all config logic to getConfig

* Style Update - Remove Manual process

* lint

* Accounting for ll-rebuild for async cards

* Style Updates - Use GetStubConfig for most

* Lint

* Filter entities with function - style - no preview

* Iframe rename and description

* Move getstubconfig to helper - update spinner

* Style for themes

* Move entities to be calc once

* Should update

* oops

* TSC

* Comments
2020-03-03 14:53:55 -05:00
Paulus Schoutsen
f3445d99cf Sort ungrouped entities (#5047)
* Sort ungrouped entities

* Console.bye
2020-03-03 17:36:39 +01:00
Bram Kragten
7e48b21767 Remove states-ui and allow setting (local) default lovelace panel (#5043)
* Remove states-ui and allow setting (local) default lovelace panel

* Remove from demo

* Delete ha-cards.js

* Add default for yaml defined dashboards

* Update ha-config-lovelace-dashboards.ts
2020-03-03 16:27:35 +01:00
Bram Kragten
1d1688093a Update config.yml 2020-03-03 11:10:57 +01:00
Bram Kragten
d392695ab7 Recreate translations when changed on dev (#5042) 2020-03-02 07:55:16 -08:00
HomeAssistant Azure
5066560411 [ci skip] Translation update 2020-03-02 12:54:26 +00:00
Bram Kragten
7fa6686e8c Update README.md 2020-03-02 13:40:45 +01:00
Paulus Schoutsen
d74fe6ed52 Update translation hashing (#5025)
* Update translation hashing

* Move gulp-rename
2020-03-02 11:36:00 +01:00
HomeAssistant Azure
319a3b4943 [ci skip] Translation update 2020-03-02 00:36:43 +00:00
HomeAssistant Azure
226e6e9f59 [ci skip] Translation update 2020-03-01 00:32:29 +00:00
Erik Montnemery
42f311a457 Update whitelist (#5026) 2020-02-29 14:09:14 +01:00
HomeAssistant Azure
e50ec2e2e2 [ci skip] Translation update 2020-02-29 00:32:31 +00:00
Bram Kragten
b72a3361c0 Fixes for brightness automation action (#5003)
* Fixes for brightness

* Add checbox before optional range integer

* Console

* Comments
2020-02-28 23:01:45 +01:00
Bram Kragten
7b057eaa77 Merge pull request #5024 from home-assistant/dev
20200228.0
2020-02-28 22:59:33 +01:00
Paulus Schoutsen
d7aaed05b7 Clean up generic row (#5022) 2020-02-28 13:35:42 -08:00
Bram Kragten
c5fe5565bb Merge branch 'master' into dev 2020-02-28 22:21:45 +01:00
Bram Kragten
a1a1763897 Bumped version to 20200228.0 2020-02-28 22:20:44 +01:00
Bram Kragten
724357683c Add take control for yaml mode (#4992) 2020-02-28 22:00:01 +01:00
Bram Kragten
0d6de9fe73 Fix for unavailable input-select (#4991)
* Fix for unavailable select

* Update hui-thermostat-card.ts
2020-02-28 21:59:14 +01:00
Bram Kragten
5646045e9e Add UI to create and manage Lovelace dashboards and resources (#5012)
* Add UI to create and manage Lovelace dashboards and resources

* update, comments, fixes

* Align icons with seach icon and checkboxes

* Fix

* Remove js and html resource types

* Allow it for existing ones
2020-02-28 21:58:50 +01:00
Bram Kragten
17c7a3bbac Bumped version to 20200220.5 2020-02-28 15:35:08 +01:00
Ian Richardson
8d65eb1fdf Fix state_color for button (#4995) 2020-02-28 15:35:04 +01:00
Ian Richardson
2298a55b16 Fix action handling for buttons row (#5007) 2020-02-28 15:34:45 +01:00
HomeAssistant Azure
33d65bcefc [ci skip] Translation update 2020-02-28 00:32:34 +00:00
Thomas Lovén
3cc7deda04 GUI editors for stacks (#4999)
* GUI editors for stacks

* fix type checking

* lint

* Address review comments

* Cleanup. Removing inline functions, combining others

* Give the class a more fitting name

* Final tweak

* Update stack cards

Co-authored-by: Bram Kragten <mail@bramkragten.nl>
2020-02-27 14:07:55 +01:00
Bram Kragten
e2de660bec Only cache default lovelace and handle config updates (#5000)
* Only cache default lovelace and handle config updates

* Update partial-panel-resolver.ts
2020-02-27 14:01:37 +01:00
Bram Kragten
6b1e5a525f Fix update if no lastversion and change audio pickers to default (#5010) 2020-02-27 11:44:09 +01:00
Ian Richardson
93565f0ed9 Fix action handling for buttons row (#5007) 2020-02-27 09:20:20 +01:00
HomeAssistant Azure
143d1162b6 [ci skip] Translation update 2020-02-27 00:32:30 +00:00
Ian Richardson
788d616fa2 Fix state_color for button (#4995) 2020-02-26 23:03:47 +01:00
Bram Kragten
0de9471a5d Revert "Static import all the LL cards etc" (#4989)
This reverts commit 52ded635ff.
2020-02-26 08:03:05 -08:00
Bram Kragten
b229071248 Add helper UI (#4940)
* Add helper UI

* Oops

* Update

* Update

* Update

* Lint

* Add all input forms

* Return extended entity registry entry from update

* Comments

Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2020-02-26 12:53:03 +01:00
Bram Kragten
6d145730a5 Bumped version to 20200220.4 2020-02-26 09:42:10 +01:00
Paulus Schoutsen
f02bb67485 Static import all the LL cards etc (#4987) 2020-02-26 09:42:03 +01:00
Paulus Schoutsen
52ded635ff Static import all the LL cards etc (#4987) 2020-02-26 09:40:54 +01:00
HomeAssistant Azure
a6d73828b8 [ci skip] Translation update 2020-02-26 00:32:31 +00:00
Paulus Schoutsen
1d052fa5bb Add support for multiple Lovelace dashboards (#4967)
* Add support for multiple Lovelace dashboards

* Fix navigation, add to cast, revert resource loading

* Change resource logic

* Lint + cast fix

* Comments

* Fixes

* Console.bye

* Lint"

Co-authored-by: Bram Kragten <mail@bramkragten.nl>
2020-02-25 13:06:25 -08:00
Bram Kragten
38d758b52f Bumped version to 20200220.3 2020-02-25 21:56:52 +01:00
Bram Kragten
9162e9c318 Bumped version to 20200220.2 2020-02-25 21:55:36 +01:00
Bram Kragten
189ea00768 Fix for when the preview element was an error element (#4969)
* Fix for when the preview element was an error element

* Comments

* Update hui-dialog-edit-card.ts
2020-02-25 21:51:52 +01:00
Bram Kragten
25d6427aed Fix for when the preview element was an error element (#4969)
* Fix for when the preview element was an error element

* Comments

* Update hui-dialog-edit-card.ts
2020-02-25 21:51:07 +01:00
Franck Nijhof
8a61442cf2 Add dev demo builds GitHub Actions workflow (#4980) 2020-02-25 10:15:48 -08:00
Franck Nijhof
106d405699 Only trigger on PRs or pushes against the master and dev branch… (#4982) 2020-02-25 10:06:14 -08:00
Chris Talkington
1f23e9062f Fix typo in supervisor popup (#4966) 2020-02-24 20:45:08 -08:00
Franck Nijhof
231b498ea5 Remove Travis-CI (#4972) 2020-02-24 20:43:47 -08:00
HomeAssistant Azure
a256e5abfa [ci skip] Translation update 2020-02-25 00:33:05 +00:00
Ruslan Sayfutdinov
028b370ead [logbook] fix scrolling on iOS (#4950)
* [logbook] fix scrolling on iOS

* Update styling

* Update ha-logbook.ts

Co-authored-by: Bram Kragten <mail@bramkragten.nl>
2020-02-24 13:50:22 +01:00
Sergey Avdeev
18abc6adf7 Update icon_color_css.ts (#4962) 2020-02-24 11:43:58 +01:00
Ruslan Sayfutdinov
95aa29d6ca Fix layout of history and logbook filters (#4963) 2020-02-24 11:38:05 +01:00
Paulus Schoutsen
5d2242dd16 Add a smarter default value for entity card show header toggle (#4964) 2020-02-24 11:29:40 +01:00
HomeAssistant Azure
de8bca6967 [ci skip] Translation update 2020-02-24 00:32:30 +00:00
HomeAssistant Azure
12234de20e [ci skip] Translation update 2020-02-23 00:32:34 +00:00
Tomasz
b41369a2ad Localize tabs names in view editor (#4954)
* Localize tabs

* remove Polish localization
2020-02-22 15:00:01 +01:00
HomeAssistant Azure
6e35c79c14 [ci skip] Translation update 2020-02-22 00:32:31 +00:00
Franck Nijhof
22e4c0512e Add GitHub Actions (#4952) 2020-02-21 13:59:09 +01:00
HomeAssistant Azure
3606b8077f [ci skip] Translation update 2020-02-21 00:34:40 +00:00
Paulus Schoutsen
3a90a65ba8 Merge pull request #4948 from home-assistant/dev
20200220.1
2020-02-20 14:49:22 -08:00
Paulus Schoutsen
e59987a8ed Bumped version to 20200220.1 2020-02-20 14:47:40 -08:00
Paulus Schoutsen
22d8ce0fd9 Fix creating card (#4947) 2020-02-20 14:47:28 -08:00
Zep Fietje
01eae3876b Make config list items appearance consistent for automations, scenes and scripts (#4945) 2020-02-20 21:10:40 +01:00
Paulus Schoutsen
2e43f390a4 Merge pull request #4942 from home-assistant/dev
20200220.0
2020-02-20 10:29:20 -08:00
Paulus Schoutsen
65421fa551 Bumped version to 20200220.0 2020-02-20 10:14:57 -08:00
Zack Arnett
fc88922ce3 Fix CPU and Browser Usuage (#4935) 2020-02-20 09:57:14 +01:00
Paulus Schoutsen
52609dded9 Add rebuild support to editor preview (#4932)
* Add rebuild support to editor preview

* getLovelaceCardClass function added

* Use error class

* Tiny cleanup

* Misplaced comment
2020-02-20 09:55:42 +01:00
HomeAssistant Azure
6d54496187 [ci skip] Translation update 2020-02-20 00:32:31 +00:00
Bram Kragten
2a6c38066d Merge pull request #4920 from home-assistant/dev
20200219.0
2020-02-19 10:49:19 +01:00
Bram Kragten
924c7804c9 Update hui-media-control-card.ts (#4919) 2020-02-19 10:44:42 +01:00
Bram Kragten
23f34fa7ae Bumped version to 20200219.0 2020-02-19 10:30:14 +01:00
Ian Richardson
7046cba1f7 Add buttons row (#4714)
*  Add buttons row

* refactor to composition

* Add action handler

* address review
2020-02-19 10:25:42 +01:00
Zack Arnett
4be1040a14 Convert History Graph Card to Typescript (#4882)
* Converting History Graph to Typescript

* Conversion to TS

* Reviews

* Review Updates
2020-02-19 10:20:37 +01:00
Zack Arnett
68baeb83cb Media Card Seek Functionality (#4907)
* Seek function

* Remove a testing section

* reviews
2020-02-19 10:19:57 +01:00
Zack Arnett
aa94e45582 Sensor Card - Top Margin 16px -> 8px (#4917) 2020-02-18 22:36:49 -08:00
Zack Arnett
2c58a9f802 Sensor Stroke Width Fix (#4916)
* Sensor width fix

* Const
2020-02-18 20:20:32 -08:00
HomeAssistant Azure
0a41a4f066 [ci skip] Translation update 2020-02-19 00:32:35 +00:00
Bram Kragten
e265d9581c Fix multiselect without data (#4906) 2020-02-18 22:17:52 +01:00
Paulus Schoutsen
4675579f79 Add safe mode support (#4908)
* Add safe mode support

* Lint

* Fix type in demo
2020-02-18 08:33:25 -08:00
Bram Kragten
52ae01ea74 Fix description and title of options flow (#4910) 2020-02-18 11:27:27 +01:00
HomeAssistant Azure
099430238c [ci skip] Translation update 2020-02-18 00:32:41 +00:00
Bram Kragten
af3626b215 Merge pull request #4850 from zsarnett/media-card-updates
Update Media Card to check for Supported Features
2020-02-17 21:16:06 +01:00
Bram Kragten
52ea3a5ce8 Merge pull request #4895 from scop/sort-available-events
Sort list of available events
2020-02-17 21:15:08 +01:00
Ville Skyttä
2ab2ade642 Import compare 2020-02-17 21:15:58 +02:00
Zack Arnett
1cc3936ec3 Typing functions 2020-02-17 13:36:21 -05:00
Paulus Schoutsen
322eef1c0f Add more info to system log (#4899)
* Add more info to system log

* Add util, oops

* Tweak UI
2020-02-17 10:20:24 -08:00
Zack Arnett
0964130782 rookie mistake 2020-02-17 12:09:17 -05:00
Zack Arnett
be9ec50e3a When no image occurs mark the image as undefined 2020-02-17 11:51:05 -05:00
Zack Arnett
da1dd45169 Update for playlist information if music isnt present 2020-02-17 11:31:27 -05:00
Zack Arnett
9a7f7f119d Review updates again because I am a fool 2020-02-17 10:28:13 -05:00
Bram Kragten
b1a414c840 Merge pull request #4903 from home-assistant/dev
20200217.0
2020-02-17 16:24:27 +01:00
Zack Arnett
2718ada9f9 Review updates 2020-02-17 10:01:01 -05:00
Bram Kragten
46a596ce34 Bumped version to 20200217.0 2020-02-17 15:58:06 +01:00
Bram Kragten
7036cefa72 Allow to change the location of home zone in zone editor (#4849)
* Allow to change the location of home zone in zone editor

* Update src/translations/en.json

Co-Authored-By: Paulus Schoutsen <balloob@gmail.com>

* Comment + mobile to general config

* Remove dupe import

Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2020-02-17 15:27:31 +01:00
Ian Richardson
fb7fbf2dac add state_color option to glance, button and state-icon (#4854)
* add state_color option to glance, button and state-icon

* address comments

* address comments
2020-02-17 15:26:45 +01:00
Bram Kragten
49b0c8d549 include entities not in entity registry in config entities (#4867)
* include entities not in entity registry in config entities

* Update ha-data-table.ts

* Comments

* Update ha-device-entities-card.ts

* Comments
2020-02-17 15:02:23 +01:00
Bram Kragten
8f9a6bd544 Add multi select component to ha-form (#4247)
* Add multi select component

* Apply suggestions from code review

Co-Authored-By: Ian Richardson <iantrich@gmail.com>

* Comments

* update

* Fix

* Refactor to dropdown menu

Co-authored-by: Ian Richardson <iantrich@gmail.com>
2020-02-17 14:13:09 +01:00
Ruslan Sayfutdinov
24e4b0b772 [sidebar] set max-width for item-text (#4893) 2020-02-16 20:23:25 -08:00
HomeAssistant Azure
1c86bd2f8b [ci skip] Translation update 2020-02-17 00:32:55 +00:00
Zack Arnett
363f548f13 fix error (#4885) 2020-02-16 15:19:28 -08:00
Ville Skyttä
51ce481e77 Sort list of available events 2020-02-16 23:32:47 +02:00
Zack Arnett
30e5611812 Stupid mistake 2020-02-16 12:15:56 -05:00
Zack Arnett
67706a312d Support for requesting the image from the server 2020-02-16 12:11:18 -05:00
Paulus Schoutsen
f4eb3380b4 Less whitespace around icon (#4888) 2020-02-15 22:39:03 -08:00
Paulus Schoutsen
73934afc7d Sensor card hugging (#4887) 2020-02-16 00:57:56 -05:00
Paulus Schoutsen
9d2a0c0502 Reduce size of floorplan pic Arsaboo (#4886) 2020-02-15 21:40:28 -08:00
HomeAssistant Azure
9ec75531a8 [ci skip] Translation update 2020-02-16 00:32:37 +00:00
HomeAssistant Azure
91bdb8f742 [ci skip] Translation update 2020-02-15 00:32:38 +00:00
Thomas Lovén
d8ae3439de Make sure config is always frozen. Not just on error (#4871) 2020-02-14 16:11:25 -08:00
Bram Kragten
2d018fff6c Update babel en disable ES5 builds on dev (#4876) 2020-02-14 16:09:21 -08:00
Bram Kragten
7d37dc6cde Bump vaadin elements (#4878) 2020-02-14 16:08:44 -08:00
Bram Kragten
c60033027d Update material elements (#4877)
* Update material elements

* Update ha-checkbox.ts
2020-02-14 16:08:30 -08:00
Ian Richardson
3f7c29a6f6 ♻️ change entity-button to button card (#4581)
* ♻️ change entity-button to button card

* maintain separate entity-button class
2020-02-14 10:56:08 +01:00
Paulus Schoutsen
b2243f480c Add option to lazy load cards (#4857)
* Add option to lazy load cards

* Lazy load header/footer elements

* Lazy load rows

* Clean up params

* Rename last var
2020-02-13 21:13:48 -08:00
Ian Richardson
f5384e8bc8 add create helper functions for custom cards (#4853)
* add create helper functions for custom cards

* address comments
2020-02-13 21:13:29 -08:00
Robbie Trencheny
ecc6fcf862 Hide HTML5 push notification toggle if inside external app (#4860)
* Hide HTML5 push notification toggle if external bus is engaged

* Use isExternal instead

* Hide the whole row

* Black

* Fix import

Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2020-02-13 17:47:08 -08:00
HomeAssistant Azure
46cc2aec94 [ci skip] Translation update 2020-02-14 00:32:50 +00:00
Thomas Lovén
c62a5a6dcd Freeze lovelace configuration on load (#4862)
* Freeze lovelace configuration on load

* Clone only when necessary

* Make cloning badges really work

* Freeze after checking

* Don't doublefreeze
2020-02-13 16:18:15 -08:00
Zack Arnett
f6b10232ec Disabled Style Updates 2020-02-13 16:35:16 -05:00
Zack Arnett
87559c0938 Review Updates 2020-02-13 16:30:34 -05:00
Bram Kragten
7903541689 Add toolbars and mobile headers + layout tweaks (#4803)
* Add toolbars and mobile headers + layout tweaks

* Comments
2020-02-13 19:53:48 +01:00
Bram Kragten
c93e1b0123 Add more info for Person (#4848)
* Add more info for Person

* Update src/dialogs/more-info/controls/more-info-vacuum.ts

Co-Authored-By: Paulus Schoutsen <balloob@gmail.com>

Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2020-02-13 09:06:52 -08:00
Bram Kragten
e261fafdb3 Allow enabling/disabling automation from edit screen (#4846)
* Allow enabling/disabling automation from edit screen

* Comments
2020-02-13 09:06:14 -08:00
Bram Kragten
485e2fde25 Update hui-thermostat-card.ts (#4863) 2020-02-13 08:41:51 -08:00
Bram Kragten
6feaf64c90 Fix display of arrays/objects in attributes (#4836)
* Fix display of arrays/objects in attributes

* async import js-yaml
2020-02-13 08:22:41 -08:00
Bram Kragten
6b115bf06a Merge pull request #4859 from home-assistant/frenck-2020-0188
Spelling: Config(uration)
2020-02-13 10:29:46 +01:00
Bram Kragten
f45785fafe Change defaults of automations to device (#4843)
* Change defaults of automations to device

* Script too

* Update device_automation.ts

* Update device_automation.ts
2020-02-12 20:43:44 -08:00
Ruslan Sayfutdinov
ec046bc925 [history] fix dropdown animation (#4858) 2020-02-12 20:36:29 -08:00
HomeAssistant Azure
ab5733718b [ci skip] Translation update 2020-02-13 00:33:01 +00:00
Franck Nijhof
1077fb2945 Spelling: Config(uration) 2020-02-13 00:30:41 +01:00
Bram Kragten
b7a84cdd60 Merge pull request #4856 from home-assistant/dev
20200212.0
2020-02-12 22:41:36 +01:00
Bram Kragten
78102f5882 Merge branch 'master' into dev 2020-02-12 22:21:32 +01:00
Bram Kragten
4ea11bd928 Bumped version to 20200212.0 2020-02-12 22:18:01 +01:00
Bram Kragten
785aefa028 Bumped version to 20200130.3 2020-02-12 21:58:59 +01:00
Bram Kragten
5c2004bcc1 Bumped version to 20200130.2 2020-02-12 21:56:03 +01:00
Bram Kragten
156d944ca1 Fix translations for update button config entry system options (#4837) 2020-02-12 21:55:53 +01:00
Bram Kragten
97a6354a72 Fix tap firing twice on iOS (#4841) 2020-02-12 21:55:28 +01:00
Bram Kragten
49422c3f63 Fix translations for update button config entry system options (#4837) 2020-02-12 13:49:20 +01:00
Bram Kragten
0b8700f725 Hide zone edit button for non admins (#4840) 2020-02-12 13:48:51 +01:00
Bram Kragten
c5aa000a97 Check for null target_temp (#4842)
Fixes #4359
2020-02-12 13:48:27 +01:00
Bram Kragten
4cdc4765f7 Fix tap firing twice on iOS (#4841) 2020-02-12 13:47:56 +01:00
Ruslan Sayfutdinov
a95290235d [logbook] fix margins for RTL languages (#4852) 2020-02-11 17:29:35 -08:00
HomeAssistant Azure
fb9d7ac2d8 [ci skip] Translation update 2020-02-12 00:32:46 +00:00
Ruslan Sayfutdinov
d48a4e0ac6 [logbook] implement shouldUpdate (#4832)
* [logbook] implement shouldUpdate

* Update src/panels/logbook/ha-logbook.ts

Co-Authored-By: Paulus Schoutsen <paulus@home-assistant.io>

Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2020-02-11 15:26:28 -08:00
Zack Arnett
d33e035db7 Update Media Card to check for supported features 2020-02-11 13:11:25 -05:00
Bram Kragten
1437b4c4b6 Fix media control card styling (#4845) 2020-02-11 09:43:46 -05:00
Robert Resch
9fce60065b Add lozalization to more-info-vacuum (#4793)
* Convert more-info-vacuum to Lit

* Introduce VacuumCommand to reduce render complexity and duplicate code

* Add localization for more-info-vacuum

* Inline supportFeature instead of creating a const.

* - Use interface instead of class for VacuumCommand
- Add different translation for start_pause and pause as they are not the same

* fix typo

* Use VACUUM_COMMANDS.some instead of writing duplicate code

* add @bramkragten suggestions
2020-02-11 09:15:38 +01:00
Paulus Schoutsen
d052b9ede8 Update en.json (#4835) 2020-02-11 09:05:18 +01:00
Ruslan Sayfutdinov
8cee5c729e [logbook] fix period dropdown animation (#4834) 2020-02-10 20:50:12 -08:00
HomeAssistant Azure
88bdf7c7ec [ci skip] Translation update 2020-02-11 00:32:36 +00:00
Bram Kragten
2c006e99f2 Use original id to remove entity (#4829) 2020-02-10 15:17:29 -08:00
Erik Montnemery
e7e8dff0ec Graceful fallback if translations for device automations are missing (#4824)
* Graceful fallback if translations for device automations are missing

* Update src/data/device_automation.ts

Co-Authored-By: Bram Kragten <mail@bramkragten.nl>

* Update src/data/device_automation.ts

Co-Authored-By: Bram Kragten <mail@bramkragten.nl>

* Update src/data/device_automation.ts

Co-Authored-By: Bram Kragten <mail@bramkragten.nl>

* tweak

Co-authored-by: Bram Kragten <mail@bramkragten.nl>
2020-02-10 20:17:24 +01:00
Ian Richardson
981c798e22 💄 match alarm panel icon coloring to card's (#4825) 2020-02-10 08:43:38 -08:00
Ruslan Sayfutdinov
4613d8b1f6 [logbook] configure flex container to display entries correctly on mobile devices (#4810) 2020-02-10 10:11:28 +01:00
Paulus Schoutsen
ba4e1949c4 Theme update refetch themes (#4812) 2020-02-10 10:10:39 +01:00
Iulian Onofrei
cc6686a790 Fix typo (#4779) 2020-02-10 10:03:42 +01:00
Nicholas Amadori
f791412f73 Spelling (#4806)
"Gerenal" corrected to "General"
2020-02-10 10:03:19 +01:00
HomeAssistant Azure
0c8ac17dcb [ci skip] Translation update 2020-02-10 00:32:29 +00:00
HomeAssistant Azure
9e11fe868e [ci skip] Translation update 2020-02-09 00:32:35 +00:00
Bram Kragten
7d91515bf5 Style tweaks (#4766)
* Style tweaks

* Update ha-style.ts

* Move derived styles
2020-02-08 14:49:29 -08:00
HomeAssistant Azure
e0565c35ab [ci skip] Translation update 2020-02-08 00:32:33 +00:00
Paulus Schoutsen
e5387e5806 Fall back to use handler if translations broken (#4777) 2020-02-07 18:46:16 +01:00
Paulus Schoutsen
8a4c52aeb7 Filter battery sensors from generated UI (#4799)
* Filter battery sensors from generated UI

* Use fancy TypeScript feature
2020-02-07 18:32:37 +01:00
Paulus Schoutsen
15e7b8117c Add integrations to dev info page (#4800)
* Add integrations to dev info page

* Fix annoying looking html tags

* What happened here
2020-02-07 18:30:38 +01:00
HomeAssistant Azure
d1703ba3e8 [ci skip] Translation update 2020-02-07 00:32:35 +00:00
Ruslan Sayfutdinov
c977f22047 Show seconds in the UI (#4765) 2020-02-06 10:38:38 -08:00
Zack Arnett
2e47aa1905 Update Edit Footer for Cards (#4752)
* Update CSS

* Radius Updates

* Updating to be a ha-card element
2020-02-05 23:05:49 -08:00
HomeAssistant Azure
c72105dca3 [ci skip] Translation update 2020-02-06 00:32:31 +00:00
Bram Kragten
e01f1cfcac More info scroll fix (#4774)
* Fix more info dialog scrolling

* Update ha-more-info-dialog.js
2020-02-05 14:03:16 -08:00
Zack Arnett
2e4c73c087 Convert Media Control Card to Typescript (#4761)
* Delete old JS file. Add new TS file. Add Type

* Updates

* Reviews

* Review Updates :)

* Updating State Localize

* Clean up

* Fixing Travis
2020-02-05 09:28:29 -08:00
Bram Kragten
c7f7ef28bf Fixes removing audio device (#4763)
(only the supervisor doesn't support it)
2020-02-05 09:21:43 -08:00
Michael Irigoyen
aac7dbab58 Update Material Design Icons to v4.9.95 (#4764) 2020-02-05 17:34:10 +01:00
Bram Kragten
8518f774d4 Rename hass.io panel to supervisor 2020-02-05 10:00:19 +01:00
HomeAssistant Azure
cb0d91d124 [ci skip] Translation update 2020-02-05 00:32:34 +00:00
Zack Arnett
107f428dd3 Sensor Card Fill feature (#4745) 2020-02-04 16:11:13 -08:00
Bram Kragten
7758ddba56 Fix theming with derived styles (#4758)
* Fix theming with derived styles

* Move
2020-02-04 15:40:35 -08:00
Paulus Schoutsen
e0376c803f Fix hassio audio 2020-02-04 10:28:43 -08:00
Paulus Schoutsen
788c490bbc Update update headers in hassio (#4751)
* Update update headers in hassio

* Other tabs too
2020-02-04 18:36:10 +01:00
Ian Richardson
cdf6e9eb75 🐛 properly format timestamps in glance card (#4602)
* 🐛 properly format timestamps in glance card

* address review comments
2020-02-04 16:18:42 +01:00
Bram Kragten
4aa49f66bc Remove unused classmap 2020-02-04 15:55:29 +01:00
Bram Kragten
50d0671abe Bumped version to 20200130.1 2020-02-04 15:38:03 +01:00
Bram Kragten
e176357fbf Tweak badge focus padding (#4750) 2020-02-04 15:34:20 +01:00
David F. Mulcahey
de1b127ac2 fix loading groups (#4727) 2020-02-04 15:33:50 +01:00
Bram Kragten
1dad7c81da Fix passive color radius and fix switch label clicks (#4703) 2020-02-04 15:33:01 +01:00
Bram Kragten
e980e93969 Change map settings icon (#4701)
* Change map settings icon

Closes #4694

* hide for demo
2020-02-04 15:28:59 +01:00
Ian Richardson
57fc56f836 🐛 fix tabindex for default entity more-info actions (#4697)
* 🐛 fix tabindex for default entity more-info actions

* Update hui-state-label-badge.ts
2020-02-04 15:28:33 +01:00
Bram Kragten
05113e1809 Styling zone menu (#4684)
* Styling zone menu

* Update ha-device-entities-card.ts
2020-02-04 15:28:10 +01:00
Bram Kragten
1bf82f216a Tweak badge focus padding (#4750) 2020-02-04 15:15:15 +01:00
Bram Kragten
004ff58c21 Update hassio-style.ts 2020-02-04 13:34:14 +01:00
Joakim Sørensen
f1a1654371 Use icon image where available (#4721)
* Use iconimg where available

* Adjust margin for icon

* remove log

* Fix property casing

* Add blue topbar, and generalize properties

* Inline checks

* inline property functions

* Limit compute

* Linting

* lovercase const

* Review comments and move update dot to line

* Add roboto font to hassio

* Fix update and stopped styles colliding

Co-authored-by: Bram Kragten <mail@bramkragten.nl>
2020-02-04 12:36:09 +01:00
Bram Kragten
862044ca23 Hassio styling tweaks (#4749)
* Hassio styling tweaks

* Update hassio-style.ts

* Update hassio-pages-with-tabs.ts
2020-02-04 10:54:10 +01:00
Paulus Schoutsen
c54b474838 Hide automations from generated UI (#4748) 2020-02-04 09:27:26 +01:00
Bram Kragten
42cbe863bb Fix passive color radius and fix switch label clicks (#4703)
* Fix passive color radius and fix switch label clicks

* Colors vars
2020-02-03 22:32:22 -08:00
HomeAssistant Azure
ccc42dad79 [ci skip] Translation update 2020-02-04 00:33:02 +00:00
Paulus Schoutsen
82ff444cec Confirm when resetting hassio optoins (#4718) 2020-02-03 08:53:57 -08:00
Paulus Schoutsen
24c591fbf3 Convert Hass.io add-on options to YAML (#4717)
* Convert Hass.io options to YAML

* Fix yaml editors on other places

* Update ha-automation-action-service.ts

Co-authored-by: Bram Kragten <mail@bramkragten.nl>
2020-02-03 11:06:47 +01:00
Joakim Sørensen
ad676d7fd3 Fix theme on sensor card (#4724) 2020-02-03 09:30:20 +01:00
David F. Mulcahey
cbe4782d78 fix loading groups (#4727) 2020-02-03 09:29:13 +01:00
HomeAssistant Azure
3fdcc1c0ea [ci skip] Translation update 2020-02-03 00:32:48 +00:00
HomeAssistant Azure
f9d64e51c4 [ci skip] Translation update 2020-02-02 00:32:38 +00:00
Paulus Schoutsen
b082828a75 Forward haptic events to parent window (#4719) 2020-02-01 08:11:57 -08:00
Paulus Schoutsen
25f5bf0042 Fix ingress add-on not started dialog showing twice (#4716)
* Fix ingress add-on not started dialog showing twice

* logging not allowed
2020-02-01 08:11:30 -08:00
Bram Kragten
f5dec3c6d5 Change map settings icon (#4701)
* Change map settings icon

Closes #4694

* hide for demo
2020-02-01 00:26:22 -08:00
Joakim Sørensen
3215437bb8 Fixes add-on audio selector (#4648)
* Fixes addon audio selector

* Set device as property

* Use getAttribute

* Keep device as attribute

Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2020-01-31 23:03:30 -08:00
HomeAssistant Azure
33176d8f3d [ci skip] Translation update 2020-02-01 00:32:28 +00:00
Ian Richardson
f82b62f45c 🐛 fix tabindex for default entity more-info actions (#4697)
* 🐛 fix tabindex for default entity more-info actions

* Update hui-state-label-badge.ts
2020-01-31 17:19:08 +01:00
Bram Kragten
edfdd0da89 Styling zone menu (#4684)
* Styling zone menu

* Update ha-device-entities-card.ts
2020-01-31 12:14:21 +01:00
HomeAssistant Azure
33d9bf4660 [ci skip] Translation update 2020-01-31 00:32:34 +00:00
Bram Kragten
1479ce9d56 Merge pull request #4672 from home-assistant/dev
20200130.0
2020-01-30 17:37:25 +01:00
Bram Kragten
1912bda60d Fix flex issues on google and alexa settings page (#4674) 2020-01-30 17:18:27 +01:00
Bram Kragten
2e25db4d1b Merge pull request #4673 from home-assistant/fix-tooltip
Fix tooltip in sidemenu
2020-01-30 17:18:02 +01:00
Bram Kragten
ec08b2ef65 Update ha-sidebar.ts 2020-01-30 16:39:09 +01:00
Bram Kragten
2c740cedb8 Fix tooltip sidemenu 2020-01-30 16:38:42 +01:00
Bram Kragten
e3984d7bf9 Bumped version to 20200130.0 2020-01-30 15:51:24 +01:00
Bram Kragten
2f86b6ec3d Merge pull request #4671 from home-assistant/device-page-fixes
Device info page fixes
2020-01-30 14:51:40 +01:00
Bram Kragten
d10045eac1 Remove log 2020-01-30 14:34:53 +01:00
Bram Kragten
41da68290e Merge pull request #4668 from home-assistant/zone-fixes
Zone ui fixes
2020-01-30 14:04:36 +01:00
Bram Kragten
593a2de07b Device info page fixes
Fixes #4666
Fixes #4664
Fixes #4663
Fixes #4662
2020-01-30 14:03:45 +01:00
Bram Kragten
59540bdf63 Merge pull request #4667 from home-assistant/restore-back-buttons
Restore back buttons
2020-01-30 11:56:29 +01:00
Bram Kragten
616df070a4 Zone ui fixes
fixes #4659
fixes #4658
fixes #4661
fixes #4665
fixes #4660
fixes #4655
2020-01-30 11:54:49 +01:00
Bram Kragten
ef62f1956b Restore back buttons
fixes #4654
fixes #4653
fixes #4656
2020-01-30 11:22:50 +01:00
HomeAssistant Azure
b41f25ef12 [ci skip] Translation update 2020-01-30 00:32:32 +00:00
Bram Kragten
ce8caa34f5 Merge pull request #4649 from home-assistant/dev
20200129.0
2020-01-29 19:48:36 +01:00
Bram Kragten
3ed538276e Merge branch 'master' into dev 2020-01-29 19:33:36 +01:00
Bram Kragten
c1a29e8091 Bumped version to 20200129.0 2020-01-29 19:28:09 +01:00
Bram Kragten
4e8bf434f1 Add settings button to map panel (#4641) 2020-01-29 19:04:12 +01:00
Bram Kragten
dd8c568a2c Fix action directive double tab iOS issues (#4639) 2020-01-29 19:03:43 +01:00
Bram Kragten
7ab9257f5e Fix translation advanced mode (#4647) 2020-01-29 19:01:35 +01:00
Bram Kragten
7021fd5809 Make dialogs full width on mobile, and modal (#4642)
* Make dialogs full width on mobile, and modal

* Fix dialog to bottom screen mobile
2020-01-29 08:59:37 -08:00
Bram Kragten
adec2fc2df Only update disabled for entity reg if it is a user value. (#4646) 2020-01-29 08:51:29 -08:00
Bram Kragten
27ebcc1bda Remove balloob from cast page (#4645) 2020-01-29 17:09:56 +01:00
HomeAssistant Azure
2fb7a31c76 [ci skip] Translation update 2020-01-29 00:32:22 +00:00
Bram Kragten
65994e7280 Add related items to device info (#4637)
* Add related items to device info

* Update ha-config-device-page.ts

* remove log

* Lint

* Fix dialog logic showing triggers on script dialog

Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2020-01-28 15:13:44 -08:00
Joakim Sørensen
036eedc69d Add styles to addon-header (#4632)
* Add styles to addon-header

* Update hassio/src/addon-view/hassio-addon-info.ts

Co-Authored-By: Paulus Schoutsen <paulus@home-assistant.io>

Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2020-01-28 14:37:53 -08:00
Joakim Sørensen
7937714ce6 Fixes add-on install button (#4635)
* Fixes add-on install button

* Set the default

* linting issue
2020-01-28 14:37:42 -08:00
Bram Kragten
cdbd51f6f7 Update hass-tabs-subpage.ts 2020-01-28 22:44:21 +01:00
Bram Kragten
d5a8105718 Update ha-config-areas.ts 2020-01-28 22:40:57 +01:00
Bram Kragten
1c9eab7ca0 Change config navigation to tabs (#4630)
* Change config navigation to tabs

* Update ha-menu-button.ts

* Icons

* update

* Review comments

* configSections -> object instead of array
2020-01-28 21:48:21 +01:00
Joakim Sørensen
6e624b394b Corrects add-on link (#4634)
* Fixes the addon url

* quote it

* Don't link the extra space

* puerly for testing

* Don't link the extra space
2020-01-28 11:39:42 -08:00
Joakim Sørensen
1cb10694e7 Fixes status switch spacing (#4633)
* fix switch spacing

* Fix alignment
2020-01-28 11:37:33 -08:00
HomeAssistant Azure
d496b9742f [ci skip] Translation update 2020-01-28 00:32:38 +00:00
Paulus Schoutsen
72e5375795 Fix hassio build 2020-01-27 11:57:28 -08:00
Bram Kragten
04f8f0f74f Render should always return a html template (#4612) 2020-01-27 08:34:22 -08:00
Paulus Schoutsen
82fb622904 Add buttons header-footer (#4601)
* Add buttons header-footer

* Simplify

* Update src/panels/lovelace/header-footer/hui-buttons-header-footer.ts

Co-Authored-By: Ian Richardson <iantrich@gmail.com>

* Address comments

Co-authored-by: Ian Richardson <iantrich@gmail.com>
2020-01-27 09:34:08 +01:00
HomeAssistant Azure
95ba1fd0cb [ci skip] Translation update 2020-01-27 00:32:22 +00:00
Bram Kragten
c7b3a517e8 Add area picker (#4608)
* Add area picker

* Make config flow dialog wider

* Comment
2020-01-26 21:41:11 +01:00
Joakim Sørensen
523dc881bb Convert Hass.io panel to TS/Lit (#4398)
* Convert system

* Convert dashboard

* Remove logging statement

* Convert addon view (base) and log

* Convert addon-view info

* Remove unintended file in commit

* Convert ansi-to-html

* Fix log update reloading

* Convert addon-view config

* Convert addon-view network

* Add inn missing haStyle

* Convert addon-view audio

* convert dialog-hassio-markdown

* Convert dialog-hassio-snapshot

* Convert entrypoint

* Convert hassio-style

* Lint hassio-addon-audio

* Lint hassio-addon-audio

* Lint hassio-addon-config

* Remove file that should not have been comitted

* Linting of the rest

* Cleanup

* Cleanup config

* Required changes after rebase

* Change property/method clasification

* use ? for _inputDevices and _outputDevices

* Use undefined instead of null for addon property

* Use ? for addons property

* Async addon audio

* Corrects typo in Error

* Wrap async calls in try/catch

* Remove npm task

* Fix async constant/functions

* Reintroduce noDevice

* We don't use the data of the POST no need to store and pass it

* Update hassio/src/addon-view/hassio-addon-info.ts

Co-Authored-By: Paulus Schoutsen <paulus@home-assistant.io>

* Update hassio/src/addon-view/hassio-addon-config.ts

Co-Authored-By: Paulus Schoutsen <paulus@home-assistant.io>

* Update hassio/src/addon-view/hassio-addon-audio.ts

Co-Authored-By: Bram Kragten <mail@bramkragten.nl>

* Update hassio/src/addon-view/hassio-addon-audio.ts

Co-Authored-By: Paulus Schoutsen <paulus@home-assistant.io>

* Apply review comments

* Simplify selected item change

* Change back to attr

* Apply lessons learned to addon-config

* Send event on config change

* Extract error msg

* Apply lessons learned to addon-info

* Apply lessons learned to addon-logs

* Fix shorthand linting issue

* Prefix private with _

* reset error

* Apply lessons learned to addon-network

* Revert package.json change

* Apply lessons learned to addon-view

* Fixes Unnecessary 'await' issue

* rename content -> addoninfo

* Update hassio/src/addon-view/hassio-addon-config.ts

Co-Authored-By: Bram Kragten <mail@bramkragten.nl>

* Update hassio/src/addon-view/hassio-addon-config.ts

Co-Authored-By: Bram Kragten <mail@bramkragten.nl>

* Update hassio/src/addon-view/hassio-addon-config.ts

Co-Authored-By: Bram Kragten <mail@bramkragten.nl>

* Update hassio/src/addon-view/hassio-addon-info.ts

Co-Authored-By: Bram Kragten <mail@bramkragten.nl>

* Update hassio/src/addon-view/hassio-addon-info.ts

Co-Authored-By: Bram Kragten <mail@bramkragten.nl>

* Update hassio/src/addon-view/hassio-addon-info.ts

Co-Authored-By: Bram Kragten <mail@bramkragten.nl>

* Update hassio/src/addon-view/hassio-addon-info.ts

Co-Authored-By: Bram Kragten <mail@bramkragten.nl>

* Update hassio/src/addon-view/hassio-addon-info.ts

Co-Authored-By: Bram Kragten <mail@bramkragten.nl>

* Update hassio/src/addon-view/hassio-addon-info.ts

Co-Authored-By: Bram Kragten <mail@bramkragten.nl>

* Update hassio/src/addon-view/hassio-addon-network.ts

Co-Authored-By: Bram Kragten <mail@bramkragten.nl>

* Update hassio/src/addon-view/hassio-addon-logs.ts

Co-Authored-By: Bram Kragten <mail@bramkragten.nl>

* Update hassio/src/addon-view/hassio-addon-info.ts

Co-Authored-By: Bram Kragten <mail@bramkragten.nl>

* Update hassio/src/addon-view/hassio-addon-info.ts

Co-Authored-By: Bram Kragten <mail@bramkragten.nl>

* Update hassio/src/addon-view/hassio-addon-info.ts

Co-Authored-By: Bram Kragten <mail@bramkragten.nl>

* Update hassio/src/addon-view/hassio-addon-info.ts

Co-Authored-By: Bram Kragten <mail@bramkragten.nl>

* Update hassio/src/addon-view/hassio-addon-info.ts

Co-Authored-By: Bram Kragten <mail@bramkragten.nl>

* Update hassio/src/addon-view/hassio-addon-info.ts

Co-Authored-By: Bram Kragten <mail@bramkragten.nl>

* Fix syntax issues

* Fix error handling issues

* Use forEach and not map

* Use private for _error

* Update hassio/src/addon-view/hassio-addon-info.ts

Co-Authored-By: Bram Kragten <mail@bramkragten.nl>

* Update hassio/src/addon-view/hassio-addon-info.ts

Co-Authored-By: Bram Kragten <mail@bramkragten.nl>

* Use classMap

* remove unneded limitations

* it can be null

* Update hassio/src/system/hassio-supervisor-log.ts

Co-Authored-By: Paulus Schoutsen <paulus@home-assistant.io>

* split hassio.ts

* Update datahandling

* Return result

* Use map instead of forEach

* Unnecessary 'await'.

* Move setSupervisorOption to data/hassio/supervisor

* Unnecessary 'await'

* Move fetchSupervisorLogs to data/hassio/supervisor

* Move fetchHassioHardwareInfo to data/hassio/hardware

* change error property

Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
Co-authored-by: Bram Kragten <mail@bramkragten.nl>
2020-01-26 20:37:20 +01:00
HomeAssistant Azure
1123adc584 [ci skip] Translation update 2020-01-26 00:32:39 +00:00
Timmo
15be1688ad Merge Confirmation Dialogs into Alert, Confirmation or Prompt (#4114)
*  Add alert dialog

🔨 Add alert dialogs

🔨 add more

🔨 Add more

🔨 Enhance check

Co-Authored-By: Bram Kragten <mail@bramkragten.nl>

🔥 Combine confirmation into alert dialog

🔨 Replace confirmation calls with alert dialog

✏️ Remove 3

🔨 Add prompt logic

Rename to generic

Rename and add new params for alert, confirmation and prompt

Renames and prop changes

Rename and props

Cleanup

Setup prompt

Wording

Use text for prompt

Add prompts and confirmation on delete user

Rename

Rename

Rename imports

Fix parms change

Only use default for confirmation

Co-Authored-By: Bram Kragten <mail@bramkragten.nl>

Update src/dialogs/generic/dialog-box.ts

Co-Authored-By: Bram Kragten <mail@bramkragten.nl>

Update

change text

Add autofocus

Merge show dialogs into one generic

Add automation delete confirmation

Modal

Remove deleted file

Add delete donfirm to script

Fix error with tslint

Fix from rebase

Fix from rebase

Fix from rebase

* 🔧 Split dialog functions

* 🔧 Fix from rebase

* 🔧 More fixes

* 🔧 Fix

* 🔧 Apply suggestions from code review

Co-Authored-By: Bram Kragten <mail@bramkragten.nl>

* 🔧 Update from suggestion

* 🔧 Renames and cleanup

* 🔧 Camelcase

Co-Authored-By: Bram Kragten <mail@bramkragten.nl>

* 🔧 camel case

Co-Authored-By: Bram Kragten <mail@bramkragten.nl>

Co-authored-by: Bram Kragten <mail@bramkragten.nl>
2020-01-25 17:48:29 +01:00
Bram Kragten
0c0e82a3ba Move get dialog logic entity registry (#4579) 2020-01-25 14:49:36 +01:00
Paulus Schoutsen
8abe8d7615 Automatically strip area name from entities (#4597) 2020-01-25 14:43:11 +01:00
Paulus Schoutsen
f95ba4c04c Allow options flow to define form title/description (#4598)
* Allow options flow to define their own title

* Allow description too
2020-01-25 14:38:58 +01:00
Ian Richardson
6874788cc0 🐛 fix severity toggle in gauge card editor (#4600) 2020-01-25 14:35:48 +01:00
David F. Mulcahey
f77bd79387 fix user given name display (#4606) 2020-01-25 14:34:15 +01:00
Ian Richardson
67a91b7c19 💄 color lights unless explicitly set not to (#4603) 2020-01-24 22:21:31 -08:00
HomeAssistant Azure
30211fe61d [ci skip] Translation update 2020-01-25 00:32:57 +00:00
Bram Kragten
9de80b2947 Fix menu button for touch (#4589)
* Fix menu button for touch

* Missed 2
2020-01-24 23:21:41 +01:00
Bram Kragten
b7a3fe6e91 Improve zones UI (#4576)
* Improve zones UI

* Make home blue

* Only fit after edit in dialog

* Filter states from UI edtor

* Comments

* bring editable circle to front

* Update ha-config-zone.ts

* Update ha-config-zone.ts

* Hide side navigation for zones

* Fix initial ignore fit, fix click on switch label, space dialog buttons
2020-01-24 23:21:26 +01:00
Ian Richardson
1f38d13b3b add action_name option for scene/script rows (#4571)
*  add action_name option for scene/script rows

* address review comments
2020-01-24 23:01:01 +01:00
Ian Richardson
ef6e468a7f 💄 align light card regardless of brightness support (#4582)
* 💄 align light card regardless of brightness support

* merge css properties
2020-01-24 22:12:54 +01:00
Ian Richardson
729a5e385f 🐛 don't remove key when value is empty (#4583)
* 🐛 don't remove key when value is empty

* only restrict delete to required field
2020-01-24 22:12:14 +01:00
Bram Kragten
32fd7a51f4 Fix entity registry dialog translations (#4575)
Fixes #4567
2020-01-24 10:09:40 -08:00
Ian Richardson
f3f32c800e 💄 move advanced mode toggle (#4587) 2020-01-24 09:50:20 -08:00
Bram Kragten
1f44b4b5a9 Fit map if an entity moved (#4590) 2020-01-24 15:12:21 +01:00
Bram Kragten
971538e9c2 Fix alarm card editor (#4592) 2020-01-24 15:11:57 +01:00
Bram Kragten
db9924bd87 Fix Mobile Entity Registry Delete Button (#4591) 2020-01-24 13:59:43 +01:00
Ian Richardson
74c6b9077a add conditional row (#4569)
*  add conditional row

* fix types

* address comments
2020-01-24 09:59:36 +01:00
Ian Richardson
23865c31e6 🐛 fix editor switches (#4584) 2020-01-24 09:32:56 +01:00
Ian Richardson
8641a701cb revert fix for card editor overflow menu selection (#4585) 2020-01-24 09:32:14 +01:00
HomeAssistant Azure
3ca99e5c90 [ci skip] Translation update 2020-01-24 00:32:23 +00:00
Ian Richardson
753804f463 💄 additional active icon states (#4510)
* 💄 additional active icon states

* ♻️ sort by domain

* 👌 address review comments

* state_color option for entities card

* fix typo

* 👌 address comments

extract common css
properly set boolean attributes
separate error states/color
fix unavailable color

* only make copy if necessary

* remove paused timer

* remove paused timer
2020-01-23 09:01:18 -08:00
Ian Richardson
9aedeab4fa close card editor on ESC (#4570) 2020-01-23 14:43:09 +01:00
HomeAssistant Azure
fc4e3e90b2 [ci skip] Translation update 2020-01-23 00:32:51 +00:00
Bram Kragten
ae8a9940ed Add state and related to entity reg dialog (#4473)
* Add state and related to entity reg dialog

* Replace more-info-settings, remove state tab add state button
2020-01-22 15:03:47 -08:00
Pascal Vizeli
a544295167 Add netlify pipeline (#4563)
* Add netlify pipeline

* Address comments
2020-01-22 14:42:32 -08:00
Ian Richardson
8a9e149d33 ♻️ convert more-info-script to LitElement/TypeScript (#4545)
* ♻️ convert more-info-script to Lit/TypeScript

* ♻️ convert more-info-script to LitElement/TypeScript

* 👌 use relative time
2020-01-22 22:01:02 +01:00
Bram Kragten
49611e285f Add zones config UI (#4556)
* Add zones config UI

* Update en.json

* Update dialog-zone-detail.ts

* Update hc-cast.ts

* Update more-info-content.ts

* Add drag radius and icon to dialog

* Review comments
2020-01-22 11:29:51 -08:00
Franck Nijhof
def0c51669 Update issue and PR templates (#4553)
* Update issue and PR templates

* Small Tweak
2020-01-22 09:33:18 -08:00
Ian Richardson
572215b359 🔥 remove more-info-updater (#4544)
* 🔥 remove more-info-updater

* remove reference
2020-01-22 09:30:12 -08:00
Bram Kragten
0f8cf574d3 Use state icon in logbook instead of domain icon (#4558)
Fixes https://github.com/home-assistant/home-assistant-polymer/issues/2313
2020-01-22 09:17:49 -08:00
Bram Kragten
312f1df368 Fix string type in ha-form-string (#4559) 2020-01-22 15:28:54 +01:00
Bram Kragten
5bfacb3bf0 Fix lovelace reload button on error page (#4557)
Fixes https://github.com/home-assistant/home-assistant-polymer/issues/3107
2020-01-22 15:03:51 +01:00
HomeAssistant Azure
2103866c48 [ci skip] Translation update 2020-01-22 00:32:29 +00:00
Franck Nijhof
61cf1bf1eb Add stalebot (#4551) 2020-01-21 16:51:10 +01:00
David F. Mulcahey
9c407caf2c Hide blank manufacturer names on Device details page (#4543)
* don't show "by" when there is no manufacturer

* Update src/panels/config/devices/device-detail/ha-device-card.ts

Co-Authored-By: Bram Kragten <mail@bramkragten.nl>

Co-authored-by: Bram Kragten <mail@bramkragten.nl>
2020-01-21 16:26:32 +01:00
Bram Kragten
323cf72be3 Fix #4539 (#4550) 2020-01-21 16:25:58 +01:00
Marius
eeced628b3 add never_triggered (#4442)
* add never_triggered

Add never_triggered to the last-triggered secondary_info.
as it stands, the secondary_info line is empty when used on an automation or script that hasn't been triggered yet, while the user expects info on that line.

* add "never_triggered"

for automation and script, to use in secondary_info
add last_triggered on script, because it was missing

* delete spaces

* add 2 spaces

travis check

* travis check row 116

* add never_triggered

to entities, delete incorrect entries to automation and script

* Update src/translations/en.json

Co-Authored-By: Bram Kragten <mail@bramkragten.nl>

* Update src/panels/lovelace/components/hui-generic-entity-row.ts

Co-Authored-By: Bram Kragten <mail@bramkragten.nl>

* Update src/panels/lovelace/components/hui-generic-entity-row.ts

Co-Authored-By: Bram Kragten <mail@bramkragten.nl>

* Update en.json

* Update hui-generic-entity-row.ts

Co-authored-by: Bram Kragten <mail@bramkragten.nl>
Co-authored-by: Ian Richardson <iantrich@gmail.com>
2020-01-21 08:21:32 -06:00
David F. Mulcahey
38be488f86 Update ZHA config panel to handle the addition of ZHA devices for the Zigbee coordinator (#4541)
* only show when there are entities

* handle coordinator correctly
2020-01-21 10:35:31 +01:00
Ian Richardson
83756a338a ♻️ convert more-info-automation to LitElement/TypeScript (#4547) 2020-01-21 10:31:22 +01:00
Ian Richardson
b9415cb5f0 ♻️ convert more-info-default to LitElement/TypeScript (#4546) 2020-01-21 10:29:38 +01:00
HomeAssistant Azure
fd49e26120 [ci skip] Translation update 2020-01-21 00:32:30 +00:00
Bram Kragten
3474e92eb7 Fix alignment entities card header toggle (#4532) 2020-01-20 21:05:05 +01:00
Bram Kragten
913299998c Fix missing text device entities (#4531) 2020-01-20 21:04:47 +01:00
Paulus Schoutsen
d9e522e4d7 Add header/footer support to entities card (#4496)
* Add header/footer support to entities card

Oops debug radius

Revert change to hui-picture-card

Remove unused import

* Use new createElement helper
2020-01-20 18:13:19 +01:00
David F. Mulcahey
22c8e4a455 Add the "add all device entities to Lovelace" functionality to ZHA device card (#4521)
* fix race condition

* add all entities
2020-01-20 14:22:48 +01:00
Franck Nijhof
02fe5144d8 Remove obsolete homebridge_* attributes (#4533) 2020-01-20 14:17:57 +01:00
David F. Mulcahey
9d333fb557 use logical device type (#4524) 2020-01-20 12:14:47 +01:00
David F. Mulcahey
ef2ca4a07f Clean up display of ZHA device page (#4522)
* remove margins

* adjust help icon and max width
2020-01-20 12:13:47 +01:00
Ian Richardson
f74ee76ae2 📝 clarify what conditions in automations are (#4514)
* 📝 clarify what conditions in automations are

* 📝 reword to make short and sweet
2020-01-19 17:07:58 -08:00
HomeAssistant Azure
6fb9a7636d [ci skip] Translation update 2020-01-20 00:32:40 +00:00
Joakim Sørensen
56249110d6 Adds error to shopinglist card editor if integration is not loaded (#4523)
* Adds error to shopinglist card edito if integration is not loaded

* localization

* Update src/translations/en.json

Co-Authored-By: Paulus Schoutsen <paulus@home-assistant.io>

Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2020-01-19 14:39:07 -08:00
Ian Richardson
1a2ebabd22 🚸 prompt user to confirm logout (#4501)
* 🚸 prompt user to confirm logout

* 👌 update dialog title/text/confirm
2020-01-18 22:02:36 -08:00
Ian Richardson
28511d0cbf only set tabindex if tap_action defined (#4511) 2020-01-18 21:59:56 -08:00
Joakim Sørensen
b01bdec973 Bring back ha-icon-next (#4516) 2020-01-18 21:57:24 -08:00
Michael Irigoyen
ecee5980af Update Material Design Icons to v4.8.95 (#4520) 2020-01-18 21:54:30 -08:00
HomeAssistant Azure
3e1b85e6b5 [ci skip] Translation update 2020-01-19 00:32:50 +00:00
HomeAssistant Azure
ce94d1ea7c [ci skip] Translation update 2020-01-18 00:32:47 +00:00
Paulus Schoutsen
62654ec598 Refactor create element (#4509)
* Refactor create element

* Move things around

* Fix reference in gallery
2020-01-17 16:19:01 -08:00
Ian Richardson
fbe4550c78 🐛 fix display of current/set temperature when 0 (#4498)
* 🐛 fix display of current/set temperature when 0

* 👌 nullish coalescing
2020-01-17 23:08:18 +01:00
Bram Kragten
a082667c24 Bumped version to 20200108.2 2020-01-17 22:42:48 +01:00
Bram Kragten
fc29b519ae Don't use light card in generated Lovelace mode (#4505)
* Don't make seperate card for grouped lights

* Update generate-lovelace-config.ts

* Don't use light group at all in generated UI
2020-01-17 22:42:24 +01:00
Bram Kragten
c391b19c0e fixes #4468 (#4508) 2020-01-17 22:41:57 +01:00
Bram Kragten
8c49e3c4ef fixes #4468 (#4508) 2020-01-17 22:41:09 +01:00
Ian Richardson
67022b9ffc 🐛 make picture card tabbable only if action set (#4494)
* 🐛 make picture card tabbable only if action set

* 👌use ifDefined and hasAction

* ✏️ fix syntax mistake
2020-01-17 22:39:24 +01:00
Bram Kragten
eb9023595d Don't use light card in generated Lovelace mode (#4505)
* Don't make seperate card for grouped lights

* Update generate-lovelace-config.ts

* Don't use light group at all in generated UI
2020-01-17 22:38:08 +01:00
Bram Kragten
8262d1617f Bumped version to 20200108.1 2020-01-17 17:13:00 +01:00
Alexei Chetroi
581a803cc4 Fix ZHA add device path. (#4486) 2020-01-17 17:12:13 +01:00
Paulus Schoutsen
5ff8fe68ba Alert user when add-on not started (#4485) 2020-01-17 17:02:56 +01:00
David F. Mulcahey
a2a039ebc5 Add group binding to the ZHA config panel and misc. cleanup (#4466)
* clean up zha device card and usage

* group binding tile

* add cluster selection to group binding tile

* fix css class name

* fix filtering

* multiselect for clusters in group binding

* pass narrow to cluster table

* fix tables

* fix device page

* address remaing comments from previous PR

* fix bad cherry-pick

* css cleanup

* consistency

* use properties

* translations

* add confirmation dialog to remove button

* fix css

* review comments

* remove noise
2020-01-17 16:39:57 +01:00
Ian Richardson
1064aed1b0 📝 make some Lovelace UI text more clear (#4500) 2020-01-17 09:54:16 +01:00
Ian Richardson
7025592e8e 🐛 fix picture glance card's camera_view option in editor (#4495) 2020-01-17 09:44:57 +01:00
HomeAssistant Azure
4966354b62 [ci skip] Translation update 2020-01-17 00:32:37 +00:00
David F. Mulcahey
68d6faf4af fix selection check (#4488) 2020-01-16 18:19:01 +01:00
Paulus Schoutsen
e3346483b9 Hide device trackers from generated lovelace (#4487) 2020-01-16 08:57:41 +01:00
HomeAssistant Azure
e8fb79e5ce [ci skip] Translation update 2020-01-16 00:32:40 +00:00
Alexei Chetroi
d612162ab1 Fix ZHA add device path. (#4486) 2020-01-15 20:05:05 +01:00
Bram Kragten
86f8ef3a70 Styling focus menus (#4483)
* Styling menus

* Update ha-config-navigation.ts
2020-01-15 19:41:56 +01:00
Bram Kragten
0e43435362 Don't ask to choose view when only 1 view (#4480) 2020-01-15 09:05:01 -08:00
Bram Kragten
aaefe0b09f Handle unknown state (#4481) 2020-01-15 09:01:59 -08:00
Bram Kragten
bc731a9dc3 Add edit btn to more info for scene, script and automation (#4476) 2020-01-15 09:50:16 +01:00
Bram Kragten
da25701dca Disable adoptedStyleSheets in dev (#4474) 2020-01-15 09:25:17 +01:00
Bram Kragten
21ae483dc9 Styling fixes (#4475) 2020-01-15 09:25:04 +01:00
HomeAssistant Azure
38b6e9ca10 [ci skip] Translation update 2020-01-15 00:32:57 +00:00
Bram Kragten
d31245866c Add DEPRECATED to states ui (#4463)
* Add DEPRECATED to states ui

* unelevated red

* target

* Add msg in info
2020-01-14 06:35:01 -08:00
Bram Kragten
4e08d8f3b3 Fix zha back btn (#4470) 2020-01-14 07:57:00 -05:00
Bram Kragten
1e717ab33e Catch undefined cloudstatus (#4465) 2020-01-14 13:52:23 +01:00
Bram Kragten
995fb4974e Fix translations (#4469) 2020-01-14 13:20:06 +01:00
HomeAssistant Azure
ffb76132f8 [ci skip] Translation update 2020-01-14 00:32:29 +00:00
Bram Kragten
acba3af54b Fix back btn for Polymer (#4467) 2020-01-13 18:21:43 +01:00
Paulus Schoutsen
40ac456937 Force refresh tokens if external app (#4461) 2020-01-13 05:47:08 -08:00
Bram Kragten
5c32413bf7 Onboarding core: Display error message when saving fails (#4462) 2020-01-13 05:31:53 -08:00
Bram Kragten
22792c70c5 Change config panel navigation (#4377)
* Change config panel navigation

* Show active + don't show toolbar?

* Update ha-panel-config.ts

* Change color of menu toolbar

* Update ha-config-router.ts

* Review comments
2020-01-12 17:57:38 +01:00
Krisjanis Lejejs
a8ed87298a Improved map panel and map card to ignore zones when fitting map. (#4447)
* Improved map panel and map card to ignore zones when fitting map. [#1598](https://github.com/home-assistant/home-assistant-polymer/issues/1598)

* Improved map panel and map card to ignore zones when fitting map. [#1598](https://github.com/home-assistant/home-assistant-polymer/issues/1598)

* Improved map panel and map card to ignore zones when fitting map. [#1598](https://github.com/home-assistant/home-assistant-polymer/issues/1598)

* Changed approach and created a different array for zones

* Removed zone key option for markers
2020-01-12 17:56:55 +01:00
Joakim Sørensen
b15270dfe2 Use correct suffix for elevation (#4454)
* Use correct suffix for elevation

* Use correct suffix for elevation
2020-01-12 07:31:59 -08:00
Bram Kragten
58ad949bc8 Virtualize logbook (#4450)
* Virtualize logbook

* Clean

* Update ha-logbook.ts
2020-01-12 13:00:26 +01:00
HomeAssistant Azure
adce40de56 [ci skip] Translation update 2020-01-12 00:33:31 +00:00
Ian Richardson
0f487ae4bf Add tabindex to lovelace elements (#4160)
* tabindex

* use action handler

* circular focus test

* address comment

* add focus styling to other elements

* add focus styling to cards

* style glance card entities

* Add back light/thermo changes that were lost in rebase

* Remove unused import

* lint

* lint

* 💄 tweak focus style for glance entities

* 💄 apply styling to focused state-label-badges
2020-01-11 11:50:43 +01:00
Joakim Sørensen
2848e3a63b Adds CCS var usage to person dialog (#4449) 2020-01-11 11:49:57 +01:00
Bram Kragten
5a172a64c5 Make entry flow dialog modal (#4440)
* Make entry flow dialog modal

* Add close button

* Update dialog-data-entry-flow.ts

* Fix aria-label
2020-01-10 16:40:19 -08:00
HomeAssistant Azure
433aa16ea6 [ci skip] Translation update 2020-01-11 00:32:34 +00:00
HomeAssistant Azure
50cb8cf3cc [ci skip] Translation update 2020-01-10 00:32:38 +00:00
Sean Mooney
4e5406b27b Typo fix in issue template (#4445)
fixes small typo, necesarry = necessary
2020-01-09 09:29:42 -06:00
Franck Nijhof
80eb80619a Add configuration for Lock Threads on closed pull requests (#4443) 2020-01-09 11:40:25 +01:00
Ian Richardson
bf71b3a869 ♻️ convert ha-attributes to lit-element (#4350)
* ♻️ convert ha-attributes to lit-element

* Address comments

* inline items

* 🐛 Fix attribution display logic
2020-01-09 10:22:23 +01:00
HomeAssistant Azure
ff270c4b7d [ci skip] Translation update 2020-01-09 00:32:44 +00:00
Bram Kragten
8b659498b6 Merge pull request #4439 from home-assistant/dev
20200108.0
2020-01-08 18:54:05 +01:00
David F. Mulcahey
5415068917 Rework the ZHA config panel (#4415)
* convert zha config panel to tabs

* add spacer to prevent combobox from hitting bottom

* break clusters out into their own section

* cleanup buttons

* remove header

* make devices default tab

* convert from tabs to a list view

* convert to table on dashboard

* fix anchor on mobile safari

* cleanup CSS to fix display on mobile

* cleanup card css

* more css cleanup

* fix group page

* remove translations changes

* Update src/panels/config/zha/zha-clusters.ts

Co-Authored-By: Bram Kragten <mail@bramkragten.nl>

* Update src/panels/config/zha/zha-config-dashboard.ts

Co-Authored-By: Bram Kragten <mail@bramkragten.nl>

* Update src/panels/config/zha/zha-device-page.ts

Co-Authored-By: Bram Kragten <mail@bramkragten.nl>

* Update src/panels/config/zha/zha-groups-dashboard.ts

Co-Authored-By: Bram Kragten <mail@bramkragten.nl>

* review comments

* fix dangling quote after commit suggestion

* css cleanup

* remove flex rules

* remove flex rules

* css  cleanup

* remove dialog per review comments

Co-authored-by: Bram Kragten <mail@bramkragten.nl>
2020-01-08 18:35:21 +01:00
Bram Kragten
357a67c00d Bumped version to 20200108.0 2020-01-08 18:26:20 +01:00
HomeAssistant Azure
cbe4269320 [ci skip] Translation update 2020-01-08 17:25:54 +00:00
Bram Kragten
fbd5185ce2 Add ability to remove Lovelace config (#4430)
* Add ability to remove Lovelace config

* Update hc-lovelace.ts
2020-01-08 18:19:10 +01:00
Bram Kragten
a33cf97e2c Fix moving actions with data (#4438) 2020-01-08 18:18:53 +01:00
Pascal Vizeli
7e7da26543 Update azure-pipelines-translation.yml for Azure Pipelines 2020-01-08 16:54:09 +01:00
Bram Kragten
79058e893b Add alert when Google sync failed (#4435) 2020-01-08 15:59:22 +01:00
Bram Kragten
e9231fc17e 20200107.0
20200107.0
2020-01-07 21:26:10 +01:00
Bram Kragten
2eb548bb74 Merge branch 'master' into dev 2020-01-07 20:53:23 +01:00
Bram Kragten
08baf8a757 Bumped version to 20200107.0 2020-01-07 20:50:51 +01:00
Bram Kragten
f02fa6a94b Add multi select to entity registry (#4424)
* Add multi select to entity registry

* Fix filter and sort on status

* Remove unused prop platform

* Review

* Update ha-config-entity-registry.ts
2020-01-07 12:29:42 +01:00
Bram Kragten
2ed6d0e73c Make modal of Lovelace editor dialogs (#4426)
Fixes #4425
2020-01-06 22:25:17 +01:00
David F. Mulcahey
35d9b2ac3c Add the ability to create new Zigbee groups to the ZHA config panel (#4384)
* add group page

* Update src/panels/config/zha/zha-add-group-page.ts

Co-Authored-By: Bram Kragten <mail@bramkragten.nl>

* fix group name handling

* Update src/panels/config/zha/zha-add-group-page.ts

Co-Authored-By: Bram Kragten <mail@bramkragten.nl>

Co-authored-by: Bram Kragten <mail@bramkragten.nl>
2020-01-06 07:02:47 -05:00
Bram Kragten
18d09c6f04 Add UI for restored entities (#4414)
* Add UI for restored entities

* Add conformation for removal

* Apply suggestions

* Guard
2020-01-03 12:44:25 +01:00
Joakim Sørensen
70b81de49d Force rerender on update/save (#4396)
* Force rerender on update/save

* Fix linting issue

* Define properties by using @property() instead

* Add styles to disabled save button

* Change to use @customElement, and remove _generation as a property.
2020-01-02 21:15:26 +01:00
David Cramer
f0808c1f54 Add ha-subppage toolbar css styles (#4409) 2020-01-02 20:55:43 +01:00
Jay
e779f0747e Change TRIGGER to EXECUTE (#4413)
There's been some confusion among new users about what the `TRIGGER` button does in the automation info popup. `EXECUTE` better represents what pressing that button does since it bypasses conditions and simply runs the action like a script. The automation docs at <https://www.home-assistant.io/docs/automation/action/> also say "The action of an automation rule is what is being executed when a rule fires."
2020-01-02 20:16:39 +01:00
David F. Mulcahey
bdd18775c3 Add group editing to the ZHA config panel (#4382)
* add group editing

* Update src/panels/config/zha/zha-devices-data-table.ts

Co-Authored-By: Bram Kragten <mail@bramkragten.nl>

* Update src/panels/config/zha/zha-group-page.ts

Co-Authored-By: Bram Kragten <mail@bramkragten.nl>

* Update src/panels/config/zha/zha-devices-data-table.ts

Co-Authored-By: Bram Kragten <mail@bramkragten.nl>

* Update src/panels/config/zha/zha-group-page.ts

Co-Authored-By: Bram Kragten <mail@bramkragten.nl>

* Update src/panels/config/zha/zha-group-page.ts

Co-Authored-By: Bram Kragten <mail@bramkragten.nl>

* Update src/panels/config/zha/zha-group-page.ts

Co-Authored-By: Bram Kragten <mail@bramkragten.nl>

* review comments

Co-authored-by: Bram Kragten <mail@bramkragten.nl>
2020-01-02 15:59:18 +01:00
David F. Mulcahey
711d51c022 Disable ZHA device binding buttons when a device to bind isn't selected (#4407)
* only enable buttons when a device is selected

* review comments
2020-01-02 07:24:40 -05:00
David F. Mulcahey
1b0d8bba29 fix area index on ZHA device card (#4406) 2020-01-02 10:50:19 +01:00
Colin Frei
2988cc512f Fix grammatical error (#4403) 2020-01-02 10:28:36 +01:00
Joakim Sørensen
a2f8e5f3e7 Hide protection mode toggle if not usable (#4392) 2020-01-02 10:20:21 +01:00
David F. Mulcahey
680bf06a4b Add group detail view to the ZHA config panel (#4380)
* add group details

* review comments
2019-12-24 10:29:22 -05:00
David F. Mulcahey
ff0b1881e2 Add Zigbee group removal to the ZHA config panel (#4376)
* add remove groups function

* add ability to remove groups

* translations

* review comments

* review comments

* review comments
2019-12-24 08:12:02 -05:00
David F. Mulcahey
de653e1f7b Add Zigbee group viewing to ZHA config panel (#4365)
* add ability to view zigbee groups

* review comments

* remove selectable until used
2019-12-23 10:46:34 -05:00
Bram Kragten
bb41170765 Add language Iban (#4375) 2019-12-23 16:27:41 +01:00
Bram Kragten
0ed2bc93aa Remove uploading translations from Travis (#4374) 2019-12-23 13:39:47 +01:00
Bram Kragten
04770f8ee2 Add language Esperanto (#4373) 2019-12-23 13:39:31 +01:00
Bram Kragten
15a2790b9f Add support to add all device entities to Lovelace (#4356)
* Add support to add all device entities to Lovelace

* Reload config when it was changed while Lovelace was not active

* Localize

* Update ha-panel-lovelace.ts

* Move to device entities card

* Move Lovelace logic to lovelace combine with unused entities

* Unused imports

* Added suggestions and support for YAML mode
2019-12-23 10:39:17 +01:00
Jc2k
83880791b1 Add 'unignore' to DISCOVERY_SOURCES that can be ignored. (#4370) 2019-12-21 17:10:20 +01:00
HomeAssistant Azure
4dca3289f6 [ci skip] Translation update 2019-12-19 16:07:21 +00:00
Pascal Vizeli
083a3ebfc4 Run translation on dev (#4368) 2019-12-19 17:03:05 +01:00
Pascal Vizeli
6117c4e989 Add Auto Translation handling (#4339)
* Add Auto Translation handling

* Cleanup
2019-12-18 16:38:36 +01:00
Bram Kragten
609763e658 Set focus to search when opening add integration dialog (#4357)
* Set focus to search when opening add integration dialog

* Also add to flow form
2019-12-18 16:35:20 +01:00
Bram Kragten
2c57ab60f1 Add ignore discovery button (#4354)
* Add ignore discovery button

* Add seperate list for ignored integrations

* Move translations

* Add zeroconf
2019-12-18 16:22:17 +01:00
Ian Richardson
dd17a153d2 Fire custom LL event (#4361) 2019-12-18 07:40:26 +01:00
Bram Kragten
c2d551bb7c Merge pull request #4341 from bonanitech/patch-2
Upgrade MDI icons to 4.7.95
2019-12-12 17:20:24 +01:00
Mauricio Bonani
e0b1921108 Fix version number 2019-12-09 12:40:11 -05:00
Mauricio Bonani
fcf39ceb96 Upgrade MDI icons to 4.7.95 2019-12-09 12:27:03 -05:00
Mauricio Bonani
3cc979a077 Upgrade MDI icons to 4.7.95 2019-12-09 12:24:36 -05:00
Bram Kragten
9972973774 Merge pull request #4338 from home-assistant/rc
20191204.1
2019-12-09 13:41:33 +01:00
Bram Kragten
20ae32bc26 Bumped version to 20191204.1 2019-12-09 13:03:17 +01:00
Bram Kragten
a29892023b Revert "Add copy entity ID/state/attributes menu button in dev tools/states" (#4337)
* Revert "Add copy entity ID/state/attributes menu button in dev tools/states (#4259)"

This reverts commit 4b56db5255.

* Update package.json
2019-12-09 13:02:41 +01:00
Bram Kragten
b283fec482 Update cloud-google-assistant.ts (#4329) 2019-12-09 13:02:17 +01:00
Bram Kragten
e0116a8236 Fix thingtalk automations creation (#4328) 2019-12-09 13:01:56 +01:00
Bram Kragten
d1990a4bac Revert "Add copy entity ID/state/attributes menu button in dev tools/states" (#4337)
* Revert "Add copy entity ID/state/attributes menu button in dev tools/states (#4259)"

This reverts commit 4b56db5255.

* Update package.json
2019-12-09 12:59:20 +01:00
Bram Kragten
cbba1849e2 Convert script and automation editor to lit (#4327)
* Convert script and automation editor to lit

* Update yarn.lock
2019-12-09 10:59:52 +01:00
Bram Kragten
43393d1647 Update cloud-google-assistant.ts (#4329) 2019-12-09 08:34:36 +01:00
Bram Kragten
b47ee1051c Fix thingtalk automations creation (#4328) 2019-12-07 20:46:04 +01:00
Bram Kragten
393adacc9e Convert automation actions/scripts to Lit (#4324)
* Convert automation actions/scripts to Lit

* Update ha-automation-action-row.ts

* Comments
2019-12-06 12:14:45 +01:00
Bram Kragten
073428849e Convert automation conditions to Lit (#4321)
* Convert automation conditions to Lit

* Split condition editor and row

* Comments

* Update automation.ts

* Update automation.ts
2019-12-05 19:48:06 +01:00
Bram Kragten
e6ac0258e3 Use dynamicElement directive in ha-form (#4317)
* Use dynamicContentDirective

* Turn around

* Remove attributes

* Rename to dynamicElement
2019-12-04 22:58:35 +01:00
Bram Kragten
d7e7798a55 Merge pull request #4318 from home-assistant/dev
20191204.0
2019-12-04 20:02:41 +01:00
Bram Kragten
2557414b11 Merge branch 'master' into dev 2019-12-04 19:30:47 +01:00
Bram Kragten
f7065fbce9 Bumped version to 20191204.0 2019-12-04 19:28:47 +01:00
Bram Kragten
016564eee9 Update translations 2019-12-04 19:22:23 +01:00
Bram Kragten
ff3087c39c Convert automation trigger to litelement (#4315)
* Convert automation trigger to Lit

* Update ha-automation-trigger-row.ts

* dynamicContentDirective

* update

* Lint

* Implement other types
2019-12-04 09:57:47 -08:00
Bram Kragten
239438ee5d Add entity picker to service call action (#4310)
* Add entity picker to service call action

* Use prop instead of attr
2019-12-03 12:30:51 +01:00
Florian Gareis
5458cda31f Add new confim dialog to automation editor (#4255) 2019-12-03 12:21:51 +01:00
Bram Kragten
36f49e66fd Remove empty defaults from time patern trigger automation (#4307) 2019-12-02 11:11:05 -08:00
Bram Kragten
2bafd38ea8 Allow automation actions/scripts to be moved up/down (#4308)
* Allow automation actions/scripts to be moved up/down

* Update index.tsx
2019-12-02 11:10:44 -08:00
Bram Kragten
73b3262491 Fix editing delay action (#4309) 2019-12-02 11:08:38 -08:00
Bram Kragten
808cde033f Update bug_report.md 2019-12-02 17:39:39 +01:00
Bram Kragten
fa8f6b7b91 Add yaml editor to automation actions and scripts (#4306)
* Add yaml editor to automation actions and scripts

* Add types

* Update event.tsx
2019-12-02 14:08:19 +01:00
Bram Kragten
94c120cdb1 Add yaml editor to automation conditions (#4305) 2019-12-02 12:02:35 +01:00
Bram Kragten
7b2be54f8f YAML support for automation triggers (#4289)
* WIP: Add yaml editors to automation

* Fix form overwriting yaml on switching back

* Finish triggers

* prettier
2019-12-02 11:20:09 +01:00
nicop4
4b56db5255 Add copy entity ID/state/attributes menu button in dev tools/states (#4259)
* Added button and js method to copy with copy-to-clipboard library

* Copy entity id working, tooltip added

* copy ok, use ha toast to notify ok

* cleanup code

* add translation

* removed old useless code

* Replaced copy button with menu

* Fix comparison operator & removed commented code

	modifié :         src/panels/developer-tools/state/developer-tools-state.js

* Fix spaces

	modifié :         src/panels/developer-tools/state/developer-tools-state.js

* Improve copy attributes

* only one menu & update translation

* copy attributes in yml format
use paper-icon-item instead of paper-icon-button and add yarn.lock

* removed paper-item
2019-12-02 10:35:49 +01:00
Bram Kragten
93165c9111 Area/multiple devices and name support for thingtalk automations (#4272)
* WIP: Area/multiple devices and name support

* Fix removing devices

* Don't recalc entities for all devices every time

* Use guards

* Update ha-thingtalk-placeholders.ts
2019-12-02 10:30:30 +01:00
Bram Kragten
caa604d5ca Add more aria labels (#4293)
* Add aria labels

* Fix polymer binding
2019-12-02 09:29:02 +01:00
Thomas Lovén
e7e9e2cf85 Allow setting temperature to 0 degrees (#4300) 2019-12-02 09:23:20 +01:00
Bram Kragten
daa04e9973 Fix jumping on iOS when toggle switch (#4275) 2019-11-29 12:41:37 +01:00
Bram Kragten
5355269f5d Check if external app by object (#4280)
* Check if external app by object

* Update core.ts

* Conditional chaining

* add babel optional chaining
2019-11-27 15:44:59 -08:00
Bram Kragten
2665a75250 Don't show hidden scenes (#4285)
* Don't show hidden scenes

* Comments

* computeStateDomain
2019-11-27 15:44:28 -08:00
Bram Kragten
8a39d18323 Bump TypeScript to 3.7 (#4282)
* Bump TypeScript to 3.7

* Update prettier to support ts 3.7

* Prettier

* More prettier

* Even more prettier
2019-11-27 13:51:03 -08:00
Bram Kragten
b8a026397b Don't filter attributes when saving scene (#4278)
* Add cover attributes to scene editor

* Add more

* Remove filtering of attributes

* Update ha-scene-editor.ts
2019-11-27 13:43:46 -08:00
Bram Kragten
bd5fe302eb Revert "Add specific maskable icons (#4283)" (#4284)
This reverts commit de0f1b2b65.
2019-11-27 20:23:58 +01:00
Bram Kragten
de0f1b2b65 Add specific maskable icons (#4283) 2019-11-27 16:43:23 +01:00
Thomas Lovén
defaa2b276 Fix missing semicolons in CSS (#4281)
Introduced in #4269
2019-11-27 13:06:02 +01:00
Bram Kragten
60efe00a1f Fix styling of vaadin elements (#4276) 2019-11-26 16:57:29 +01:00
Davide Varricchio
fe93b993db Change to thermostat card to reflect step_temp on set-temperature (#4221)
* Minor change to thermostat card to reflect step_temp on set-temperature

* Corrected indentation

* Resolved eslint error
2019-11-25 17:42:38 +01:00
Joakim Sørensen
f6afc92d3c Adds "air" at the bottom of the page (#4267)
* Adds "air" at the bottom of the page

* Update src/panels/config/dashboard/ha-config-dashboard.ts

Co-Authored-By: Bram Kragten <mail@bramkragten.nl>

* Add margin to promo
2019-11-25 17:38:08 +01:00
Carlos Gustavo Sarmiento
e4c635c855 Added new CSS property for styling of the app-header component (#4269) 2019-11-25 17:37:33 +01:00
Bram Kragten
a3e59e168f Bumped version to 20191119.6 2019-11-23 21:31:19 +01:00
Thomas Lovén
e56355b406 Bump round-slider version. Fix #4265 (#4266) 2019-11-23 21:30:54 +01:00
Mauricio Bonani
8ef15c50b4 Upgrade MDI icons to 4.6.95 (#4270)
* Upgrade MDI icons to 4.6.95

* Upgrade MDI icons to 4.6.95
2019-11-23 21:26:32 +01:00
Marius
81588469b8 Add secondary-info: last-triggered (#4222)
* Add secondary-info: last-triggered

add last-triggered to the currently available options 'entity-id' and 'last-changed' see:https://www.home-assistant.io/lovelace/entities/#secondary_info

* corrected omission 'attributes'

* added test for attributes.last_triggered

* Update hui-generic-entity-row.ts

* Update hui-generic-entity-row.ts
2019-11-23 21:19:26 +01:00
Joakim Sørensen
70a920af3c Add initial bg color to panels (#4268) 2019-11-23 21:18:54 +01:00
Thomas Lovén
1329e60c89 Bump round-slider version. Fix #4265 (#4266) 2019-11-23 21:12:48 +01:00
Bram Kragten
9b7c095080 Bumped version to 20191119.5 2019-11-21 17:25:50 +01:00
Bram Kragten
654ff99cd1 Bumped version to 20191119.4 2019-11-21 17:04:43 +01:00
Bram Kragten
0511bc360e iOS 9 doesn't support append (#4260) 2019-11-21 17:04:36 +01:00
Bram Kragten
ea9e8cc392 iOS 9 doesn't support append (#4260) 2019-11-21 17:03:35 +01:00
Bram Kragten
8433678371 Bumped version to 20191119.3 2019-11-21 15:22:07 +01:00
Bram Kragten
757bc00854 Fix thermostat card (#4258)
* Fix thermostat card

* Change styling

* Remove margin on mode buttons
2019-11-21 15:21:45 +01:00
Bram Kragten
2551393821 Fix light card (#4257)
* Fix light card

* Remove unused class

* Fix for when entity is not available

* Fix active state
2019-11-21 15:21:20 +01:00
Bram Kragten
0acd41b7f0 Fix thermostat card (#4258)
* Fix thermostat card

* Change styling

* Remove margin on mode buttons
2019-11-21 15:18:16 +01:00
Bram Kragten
85ca73db84 Fix light card (#4257)
* Fix light card

* Remove unused class

* Fix for when entity is not available

* Fix active state
2019-11-21 15:17:55 +01:00
Bram Kragten
444cbd00d9 Update README.md 2019-11-21 15:05:42 +01:00
Thomas Lovén
6edf23b91f Version bump round-slider. Fix bad rendering in IE/Edge (#4249) 2019-11-20 10:55:06 +01:00
Bram Kragten
1249c0eea9 Fix ha-form on edge (#4248) 2019-11-19 21:06:52 +01:00
Bram Kragten
3133118870 Update vaadin components (#3571)
* Update vaadin components

* Remove resolution

* Migrate person detail dialog to mwc-dialog

* Fix imports

* Update dialog-person-detail.ts
2019-11-19 11:35:37 -06:00
777 changed files with 55955 additions and 19351 deletions

1
.gitattributes vendored
View File

@@ -11,3 +11,4 @@
*.mp3 binary
demo/public/api/camera_proxy_stream/* binary
demo/public/api/media_player_proxy/* binary

88
.github/ISSUE_TEMPLATE/BUG_REPORT.md vendored Normal file
View File

@@ -0,0 +1,88 @@
---
name: Report a bug with the UI, Frontend or Lovelace
about: Report an issue related to the Home Assistant frontend.
labels: bug
---
<!-- READ THIS FIRST:
- If you need additional help with this template please refer to https://www.home-assistant.io/help/reporting_issues/
- Make sure you are running the latest version of Home Assistant before reporting an issue: https://github.com/home-assistant/home-assistant/releases
- Do not report issues for custom Lovelace cards.
- Provide as many details as possible. Paste logs, configuration samples and code into the backticks.
DO NOT DELETE ANY TEXT from this template! Otherwise, your issue may be closed without comment.
-->
## Checklist
- [ ] I have updated to the latest available Home Assistant version.
- [ ] I have cleared the cache of my browser.
- [ ] I have tried a different browser to see if it is related to my browser.
## The problem
<!--
Describe the issue you are experiencing here to communicate to the
maintainers. Tell us about the current behavior.
If possible provide a screenshot with a description.
-->
## Expected behavior
<!--
Describe what you expected to happen or it should look/behave.
If possible provide a screenshot with a description.
-->
## Steps to reproduce
<!--
Provide steps for us, that helps reproducing your issue.
For example:
1. Add a climate integration
2. Navigate to Lovelace
3. Click more info of the climate entity
4. Set the HVAC action to heat
5. Set the temperature higher than the current temperature
6. Set the HVAC action to cool
-->
## Environment
<!--
Provide details about the versions you are using, which helps us reproducing
and finding the issue quicker. Version information is found in the
Home Assistant frontend: Developer tools -> Info.
Browser version and operating system is important! Please try to replicate
your issue in a different browser and be sure to include your findings.
-->
- Home Assistant release with the issue:
- Last working Home Assistant release (if known):
- Browser and browser version:
- Operating system:
## Problem-relevant configuration
<!--
An example configuration that caused the problem for you. Fill this out even
if it seems unimportant to you. Please be sure to remove personal information
like passwords, private URLs and other credentials.
-->
```yaml
```
## Javascript errors shown in your browser console/inspector
<!--
If you come across any javascript or other error logs, e.g., in your browser
console/inspector please provide them.
-->
```txt
```
## Additional information

View File

@@ -0,0 +1,25 @@
---
name: Request a feature for the UI, Frontend or Lovelace
about: Request an new feature for the Home Assistant frontend.
labels: feature request
---
<!--
DO NOT DELETE ANY TEXT from this template!
Otherwise, your request may be closed without comment.
-->
## The request
<!--
Describe to our maintainers, the feature you would like to be added.
Please be clear and concise and, if possible, provide a screenshot or mockup.
-->
## The alternatives
<!--
Are you currently using, or have you considered alternatives?
If so, could you please describe those?
-->
## Additional information

View File

@@ -1,53 +0,0 @@
---
name: Bug report
about: Create a report to help us improve
title: ""
labels: bug
assignees: ""
---
<!-- READ THIS FIRST:
- If you need additional help with this template please refer to https://www.home-assistant.io/help/reporting_issues/
- Make sure you are running the latest version of Home Assistant before reporting an issue: https://github.com/home-assistant/home-assistant/releases
- Provide as many details as possible. Do not delete any text from this template!
-->
**Checklist:**
- [ ] I updated to the latest version available
- [ ] I cleared the cache of my browser
**Home Assistant release with the issue:**
<!--
- Frontend -> Developer tools -> Info
- Or use this command: hass --version
-->
**Last working Home Assistant release (if known):**
**UI (States or Lovelace UI?):**
<!--
- Frontend -> Developer tools -> Info
-->
**Browser and Operating System:**
<!--
Provide details about what browser (and version) you are seeing the issue in. And also which operating system this is on. If possible try to replicate the issue in other browsers and include your findings here.
-->
**Description of problem:**
<!--
Explain what the issue is, and how things should look/behave. If possible provide a screenshot with a description.
-->
**Javascript errors shown in the web inspector (if applicable):**
```
```
**Additional information:**

14
.github/ISSUE_TEMPLATE/config.yml vendored Normal file
View File

@@ -0,0 +1,14 @@
blank_issues_enabled: false
contact_links:
- name: Report a bug that is NOT related to the UI, Frontend or Lovelace
url: https://github.com/home-assistant/core/issues
about: This is the issue tracker for our frontend. Please report other issues with the backend repository.
- name: Report incorrect or missing information on our website
url: https://github.com/home-assistant/home-assistant.io/issues
about: Our documentation has its own issue tracker. Please report issues with the website there.
- name: I have a question or need support
url: https://www.home-assistant.io/help
about: We use GitHub for tracking bugs, check our website for resources on getting help.
- name: I'm unsure where to go
url: https://www.home-assistant.io/join-chat
about: If you are unsure where to go, then joining our chat is recommended; Just ask!

View File

@@ -1,19 +0,0 @@
---
name: Feature request
about: Suggest an idea for this project
title: ""
labels: feature request
assignees: ""
---
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
**Describe the solution you'd like**
A clear and concise description of what you want to happen.
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
**Additional context**
Add any other context or screenshots about the feature request here.

77
.github/PULL_REQUEST_TEMPLATE.md vendored Normal file
View File

@@ -0,0 +1,77 @@
<!--
You are amazing! Thanks for contributing to our project!
Please, DO NOT DELETE ANY TEXT from this template! (unless instructed).
-->
## Breaking change
<!--
If your PR contains a breaking change for existing users, it is important
to tell them what breaks, how to make it work again and why we did this.
This piece of text is published with the release notes, so it helps if you
write it towards our users, not us.
Note: Remove this section if this PR is NOT a breaking change.
-->
## Proposed change
<!--
Describe the big picture of your changes here to communicate to the
maintainers why we should accept this pull request. If it fixes a bug
or resolves a feature request, be sure to link to that issue in the
additional information section.
-->
## Type of change
<!--
What type of change does your PR introduce to the Home Assistant frontend?
NOTE: Please, check only 1! box!
If your PR requires multiple boxes to be checked, you'll most likely need to
split it into multiple PRs. This makes things easier and faster to code review.
-->
- [ ] Dependency upgrade
- [ ] Bugfix (non-breaking change which fixes an issue)
- [ ] New feature (thank you!)
- [ ] Breaking change (fix/feature causing existing functionality to break)
- [ ] Code quality improvements to existing code or addition of tests
## Example configuration
<!--
Supplying a configuration snippet, makes it easier for a maintainer to test
your PR.
-->
```yaml
```
## Additional information
<!--
Details are important, and help maintainers processing your PR.
Please be sure to fill out additional details, if applicable.
-->
- This PR fixes or closes issue: fixes #
- This PR is related to issue:
- Link to documentation pull request:
## Checklist
<!--
Put an `x` in the boxes that apply. You can also fill these out after
creating the PR. If you're unsure about any of them, don't hesitate to ask.
We're here to help! This is simply a reminder of what we are going to look
for before merging your code.
-->
- [ ] The code change is tested and works locally.
- [ ] There is no commented out code in this PR.
- [ ] Tests have been added to verify that the new code works.
If user exposed functionality or configuration variables are added/changed:
- [ ] Documentation added/updated for [www.home-assistant.io][docs-repository]
<!--
Thank you for contributing <3
-->
[docs-repository]: https://github.com/home-assistant/home-assistant.io

27
.github/lock.yml vendored Normal file
View File

@@ -0,0 +1,27 @@
# Configuration for Lock Threads - https://github.com/dessant/lock-threads
# Number of days of inactivity before a closed issue or pull request is locked
daysUntilLock: 1
# Skip issues and pull requests created before a given timestamp. Timestamp must
# follow ISO 8601 (`YYYY-MM-DD`). Set to `false` to disable
skipCreatedBefore: 2020-01-01
# Issues and pull requests with these labels will be ignored. Set to `[]` to disable
exemptLabels: []
# Label to add before locking, such as `outdated`. Set to `false` to disable
lockLabel: false
# Comment to post before locking. Set to `false` to disable
lockComment: false
# Assign `resolved` as the reason for locking. Set to `false` to disable
setLockReason: false
# Limit to only `issues` or `pulls`
only: pulls
# Optionally, specify configuration settings just for `issues` or `pulls`
issues:
daysUntilLock: 30

56
.github/stale.yml vendored Normal file
View File

@@ -0,0 +1,56 @@
# Configuration for probot-stale - https://github.com/probot/stale
# Number of days of inactivity before an Issue or Pull Request becomes stale
daysUntilStale: 90
# Number of days of inactivity before an Issue or Pull Request with the stale label is closed.
# Set to false to disable. If disabled, issues still need to be closed manually, but will remain marked as stale.
daysUntilClose: 7
# Only issues or pull requests with all of these labels are check if stale. Defaults to `[]` (disabled)
onlyLabels: []
# Issues or Pull Requests with these labels will never be considered stale. Set to `[]` to disable
exemptLabels:
- feature request
- Help wanted
- to do
# Set to true to ignore issues in a project (defaults to false)
exemptProjects: true
# Set to true to ignore issues in a milestone (defaults to false)
exemptMilestones: true
# Set to true to ignore issues with an assignee (defaults to false)
exemptAssignees: false
# Label to use when marking as stale
staleLabel: stale
# Comment to post when marking as stale. Set to `false` to disable
markComment: >
There hasn't been any activity on this issue recently. Due to the high number
of incoming GitHub notifications, we have to clean some of the old issues,
as many of them have already been resolved with the latest updates.
Please make sure to update to the latest Home Assistant version and check
if that solves the issue. Let us know if that works for you by adding a
comment 👍
This issue now has been marked as stale and will be closed if no further
activity occurs. Thank you for your contributions.
# Comment to post when removing the stale label.
# unmarkComment: >
# Your comment here.
# Comment to post when closing a stale Issue or Pull Request.
# closeComment: >
# Your comment here.
# Limit the number of actions per hour, from 1-30. Default is 30
limitPerRun: 30
# Limit to only `issues` or `pulls`
only: issues

127
.github/workflows/ci.yaml vendored Normal file
View File

@@ -0,0 +1,127 @@
name: CI
on:
push:
branches:
- dev
- master
pull_request:
branches:
- dev
- master
jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Check out files from GitHub
uses: actions/checkout@v2
- name: Setting up Node.js
uses: actions/setup-node@v1
with:
node-version: 12.x
- name: Get yarn cache path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Fetching Yarn cache
uses: actions/cache@v1
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install dependencies
run: yarn install
env:
CI: true
- name: Build icons
run: ./node_modules/.bin/gulp gen-icons-hassio gen-icons-mdi gen-icons-app
- name: Build translations
run: ./node_modules/.bin/gulp build-translations
- name: Run eslint
run: ./node_modules/.bin/eslint src hassio/src gallery/src
- name: Run tslint
run: ./node_modules/.bin/tslint 'src/**/*.ts' 'hassio/src/**/*.ts' 'gallery/src/**/*.ts' 'cast/src/**/*.ts' 'test-mocha/**/*.ts'
- name: Run tsc
run: ./node_modules/.bin/tsc
test:
runs-on: ubuntu-latest
steps:
- name: Check out files from GitHub
uses: actions/checkout@v2
- name: Setting up Node.js
uses: actions/setup-node@v1
with:
node-version: 12.x
- name: Get yarn cache path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Fetching Yarn cache
uses: actions/cache@v1
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install dependencies
run: yarn install
env:
CI: true
- name: Run Mocha
run: npm run mocha
build:
runs-on: ubuntu-latest
needs: [lint, test]
steps:
- name: Check out files from GitHub
uses: actions/checkout@v2
- name: Setting up Node.js
uses: actions/setup-node@v1
with:
node-version: 12.x
- name: Get yarn cache path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Fetching Yarn cache
uses: actions/cache@v1
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install dependencies
run: yarn install
env:
CI: true
- name: Build Application
run: ./node_modules/.bin/gulp build-app
env:
TRAVIS: "true"
supervisor:
runs-on: ubuntu-latest
needs: [lint, test]
steps:
- name: Check out files from GitHub
uses: actions/checkout@v2
- name: Setting up Node.js
uses: actions/setup-node@v1
with:
node-version: 12.x
- name: Get yarn cache path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Fetching Yarn cache
uses: actions/cache@v1
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install dependencies
run: yarn install
env:
CI: true
- name: Build Application
run: ./node_modules/.bin/gulp build-hassio
env:
TRAVIS: "true"

39
.github/workflows/demo.yaml vendored Normal file
View File

@@ -0,0 +1,39 @@
name: Demo
on:
push:
branches:
- dev
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Check out files from GitHub
uses: actions/checkout@v2
- name: Setting up Node.js
uses: actions/setup-node@v1
with:
node-version: 12.x
- name: Get yarn cache path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Fetching Yarn cache
uses: actions/cache@v1
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install dependencies
run: yarn install
env:
CI: true
- name: Build Demo
run: ./node_modules/.bin/gulp build-demo
- name: Deploy to Netlify
uses: netlify/actions/cli@master
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_DEMO_DEV_SITE_ID }}
with:
args: deploy --dir=demo/dist --prod

View File

@@ -1,27 +0,0 @@
sudo: false
language: node_js
cache:
yarn: true
directories:
- bower_components
install: yarn install
script:
- npm run build
- hassio/script/build_hassio
# Because else eslint fails because hassio has cleaned that build
- ./node_modules/.bin/gulp gen-icons-app
- npm run test
# - xvfb-run wct --module-resolution=node --npm
# - 'if [ "${TRAVIS_PULL_REQUEST}" = "false" ]; then wct --module-resolution=node --npm --plugin sauce; fi'
services:
- docker
before_deploy:
- "docker pull lokalise/lokalise-cli@sha256:2198814ebddfda56ee041a4b427521757dd57f75415ea9693696a64c550cef21"
deploy:
provider: script
script: script/travis_deploy
"on":
branch: master
dist: trusty
addons:
sauce_connect: true

View File

@@ -1,10 +1,10 @@
# Home Assistant Polymer [![Build Status](https://travis-ci.org/home-assistant/home-assistant-polymer.svg?branch=master)](https://travis-ci.org/home-assistant/home-assistant-polymer)
# Home Assistant Frontend
This is the repository for the official [Home Assistant](https://home-assistant.io) frontend.
[![Screenshot of the frontend](https://raw.githubusercontent.com/home-assistant/home-assistant-polymer/master/docs/screenshot.png)](https://home-assistant.io/demo/)
[![Screenshot of the frontend](https://raw.githubusercontent.com/home-assistant/home-assistant-polymer/master/docs/screenshot.png)](https://demo.home-assistant.io/)
- [View demo of the Polymer frontend](https://home-assistant.io/demo/)
- [View demo of Home Assistant](https://demo.home-assistant.io/)
- [More information about Home Assistant](https://home-assistant.io)
- [Frontend development instructions](https://developers.home-assistant.io/docs/en/frontend_index.html)
@@ -19,15 +19,20 @@ This is the repository for the official [Home Assistant](https://home-assistant.
## Frontend development
### Classic environment
A complete guide can be found at the following [link](https://www.home-assistant.io/developers/frontend/). It describes a short guide for the build of project.
### Docker environment
It is possible to compile the project and/or run commands in the development environment having only the [Docker](https://www.docker.com) pre-installed in the system. On the root of project you can do:
* `sh ./script/docker_run.sh build` Build all the project with one command
* `sh ./script/docker_run.sh bash` Open an interactive shell (the same environment generated by the *classic environment*) where you can run commands. This bash work on your project directory and any change on your file is automatically present within your build bash.
- `sh ./script/docker_run.sh build` Build all the project with one command
- `sh ./script/docker_run.sh bash` Open an interactive shell (the same environment generated by the _classic environment_) where you can run commands. This bash work on your project directory and any change on your file is automatically present within your build bash.
**Note**: if you have installed `npm` in addition to the `docker`, you can use the commands `npm run docker_build` and `npm run bash` to get a full build or bash as explained above
## License
Home Assistant is open-source and Apache 2 licensed. Feel free to browse the repository, learn and reuse parts in your own projects.
We use [BrowserStack](https://www.browserstack.com) to test Home Assistant on a large variation of devices.

View File

@@ -0,0 +1,27 @@
# https://dev.azure.com/home-assistant
trigger: none
pr: none
schedules:
- cron: "0 0 * * *"
displayName: "build preview"
branches:
include:
- dev
always: false
variables:
- group: netlify
jobs:
- job: 'Netlify_preview'
pool:
vmImage: 'ubuntu-latest'
steps:
- script: |
# Cast
curl -X POST -d {} https://api.netlify.com/build_hooks/${NETLIFY_CAST}
# Demo
curl -X POST -d {} https://api.netlify.com/build_hooks/${NETLIFY_DEMO}
displayName: 'Trigger netlify build preview'

View File

@@ -0,0 +1,70 @@
# https://dev.azure.com/home-assistant
trigger:
batch: true
branches:
include:
- dev
paths:
include:
- translations/en.json
pr: none
schedules:
- cron: "30 0 * * *"
displayName: "frontend translation update"
branches:
include:
- dev
always: true
variables:
- group: translation
resources:
repositories:
- repository: azure
type: github
name: 'home-assistant/ci-azure'
endpoint: 'home-assistant'
jobs:
- job: 'Upload'
pool:
vmImage: 'ubuntu-latest'
steps:
- task: NodeTool@0
displayName: 'Use Node 12.x'
inputs:
versionSpec: '12.x'
- script: |
export LOKALISE_TOKEN="$(lokaliseToken)"
export AZURE_BRANCH="$(Build.SourceBranchName)"
./script/translations_upload_base
displayName: 'Upload Translation'
- job: 'Download'
dependsOn:
- 'Upload'
condition: or(eq(variables['Build.Reason'], 'Schedule'), eq(variables['Build.Reason'], 'Manual'))
pool:
vmImage: 'ubuntu-latest'
steps:
- task: NodeTool@0
displayName: 'Use Node 12.x'
inputs:
versionSpec: '12.x'
- template: templates/azp-step-git-init.yaml@azure
- script: |
export LOKALISE_TOKEN="$(lokaliseToken)"
export AZURE_BRANCH="$(Build.SourceBranchName)"
npm install
./script/translations_download
displayName: 'Download Translation'
- script: |
git checkout dev
git add translation
git commit -am "[ci skip] Translation update"
git push
displayName: 'Update translation'

View File

@@ -33,6 +33,8 @@ module.exports.babelLoaderConfig = ({ latestBuild }) => {
pragma: "h",
},
],
"@babel/plugin-proposal-optional-chaining",
"@babel/plugin-proposal-nullish-coalescing-operator",
[
require("@babel/plugin-proposal-decorators").default,
{ decoratorsBeforeExport: true },

View File

@@ -1,6 +1,14 @@
module.exports = {
isProdBuild: process.env.NODE_ENV === "production",
isStatsBuild: process.env.STATS === "1",
isTravis: process.env.TRAVIS === "true",
isNetlify: process.env.NETLIFY === "true",
isProdBuild() {
return process.env.NODE_ENV === "production";
},
isStatsBuild() {
return process.env.STATS === "1";
},
isTravis() {
return process.env.TRAVIS === "true";
},
isNetlify() {
return process.env.NETLIFY === "true";
},
};

View File

@@ -24,7 +24,7 @@ gulp.task(
gulp.parallel("gen-icons-app", "gen-icons-mdi"),
"gen-pages-dev",
"gen-index-app-dev",
gulp.series("create-test-translation", "build-translations")
"build-translations"
),
"copy-static",
"webpack-watch-app"
@@ -42,7 +42,7 @@ gulp.task(
"copy-static",
"webpack-prod-app",
...// Don't compress running tests
(envVars.isTravis ? [] : ["compress-app"]),
(envVars.isTravis() ? [] : ["compress-app"]),
gulp.parallel(
"gen-pages-prod",
"gen-index-app-prod",

View File

@@ -16,7 +16,7 @@ gulp.task(
process.env.NODE_ENV = "development";
},
"clean-gallery",
gulp.parallel("gen-icons-app", "gen-icons-app", "build-translations"),
gulp.parallel("gen-icons-app", "gen-icons-mdi", "build-translations"),
"copy-static-gallery",
"gen-index-gallery-dev",
"webpack-dev-server-gallery"

View File

@@ -65,6 +65,12 @@ function copyMapPanel(staticDir) {
);
}
gulp.task("copy-translations", (done) => {
const staticDir = paths.static;
copyTranslations(staticDir);
done();
});
gulp.task("copy-static", (done) => {
const staticDir = paths.static;
const staticPath = genStaticPath(paths.static);

View File

@@ -2,6 +2,7 @@ const gulp = require("gulp");
const path = require("path");
const fs = require("fs");
const paths = require("../paths");
const { mapFiles } = require("../util");
const ICON_PACKAGE_PATH = path.resolve(
__dirname,
@@ -57,20 +58,6 @@ function generateIconset(iconsetName, iconNames) {
return `<ha-iconset-svg name="${iconsetName}" size="24"><svg><defs>${iconDefs}</defs></svg></ha-iconset-svg>`;
}
// Helper function to map recursively over files in a folder and it's subfolders
function mapFiles(startPath, filter, mapFunc) {
const files = fs.readdirSync(startPath);
for (let i = 0; i < files.length; i++) {
const filename = path.join(startPath, files[i]);
const stat = fs.lstatSync(filename);
if (stat.isDirectory()) {
mapFiles(filename, filter, mapFunc);
} else if (filename.indexOf(filter) >= 0) {
mapFunc(filename);
}
}
}
// Find all icons used by the project.
function findIcons(searchPath, iconsetName) {
const iconRegex = new RegExp(`${iconsetName}:[\\w-]+`, "g");

View File

@@ -29,6 +29,6 @@ gulp.task(
gulp.parallel("gen-icons-hassio", "gen-icons-mdi"),
"webpack-prod-hassio",
...// Don't compress running tests
(envVars.isTravis ? [] : ["compress-hassio"])
(envVars.isTravis() ? [] : ["compress-hassio"])
)
);

View File

@@ -1,14 +1,18 @@
const crypto = require("crypto");
const del = require("del");
const path = require("path");
const source = require("vinyl-source-stream");
const vinylBuffer = require("vinyl-buffer");
const gulp = require("gulp");
const fs = require("fs");
const foreach = require("gulp-foreach");
const hash = require("gulp-hash");
const hashFilename = require("gulp-hash-filename");
const merge = require("gulp-merge-json");
const minify = require("gulp-jsonminify");
const rename = require("gulp-rename");
const transform = require("gulp-json-transform");
const { mapFiles } = require("../util");
const env = require("../env");
const paths = require("../paths");
const inDir = "translations";
const workDir = "build-translations";
@@ -39,8 +43,6 @@ const TRANSLATION_FRAGMENTS = [
"developer-tools",
];
const tasks = [];
function recursiveFlatten(prefix, data) {
let output = {};
Object.keys(data).forEach(function(key) {
@@ -116,11 +118,9 @@ function lokaliseTransform(data, original, file) {
return output;
}
let taskName = "clean-translations";
gulp.task(taskName, function() {
return del([`${outDir}/**/*.json`]);
gulp.task("clean-translations", function() {
return del([workDir]);
});
tasks.push(taskName);
gulp.task("ensure-translations-build-dir", (done) => {
if (!fs.existsSync(workDir)) {
@@ -129,29 +129,23 @@ gulp.task("ensure-translations-build-dir", (done) => {
done();
});
taskName = "create-test-metadata";
gulp.task(
taskName,
gulp.series("ensure-translations-build-dir", function writeTestMetaData(cb) {
fs.writeFile(
workDir + "/testMetadata.json",
JSON.stringify({
test: {
nativeName: "Test",
},
}),
cb
);
})
);
tasks.push(taskName);
gulp.task("create-test-metadata", function(cb) {
fs.writeFile(
workDir + "/testMetadata.json",
JSON.stringify({
test: {
nativeName: "Test",
},
}),
cb
);
});
taskName = "create-test-translation";
gulp.task(
taskName,
gulp.series("create-test-metadata", function() {
"create-test-translation",
gulp.series("create-test-metadata", function createTestTranslation() {
return gulp
.src("src/translations/en.json")
.src(path.join(paths.translations_src, "en.json"))
.pipe(
transform(function(data, file) {
return recursiveEmpty(data);
@@ -161,7 +155,6 @@ gulp.task(
.pipe(gulp.dest(workDir));
})
);
tasks.push(taskName);
/**
* This task will build a master translation file, to be used as the base for
@@ -172,235 +165,216 @@ tasks.push(taskName);
* project is buildable immediately after merging new translation keys, since
* the Lokalise update to translations/en.json will not happen immediately.
*/
taskName = "build-master-translation";
gulp.task(
taskName,
gulp.series("clean-translations", function() {
return gulp
.src("src/translations/en.json")
.pipe(
transform(function(data, file) {
return lokaliseTransform(data, data, file);
})
)
.pipe(rename("translationMaster.json"))
.pipe(gulp.dest(workDir));
})
);
tasks.push(taskName);
gulp.task("build-master-translation", function() {
return gulp
.src(path.join(paths.translations_src, "en.json"))
.pipe(
transform(function(data, file) {
return lokaliseTransform(data, data, file);
})
)
.pipe(rename("translationMaster.json"))
.pipe(gulp.dest(workDir));
});
taskName = "build-merged-translations";
gulp.task(
taskName,
gulp.series("build-master-translation", function() {
return gulp
.src([inDir + "/*.json", workDir + "/test.json"], { allowEmpty: true })
.pipe(
transform(function(data, file) {
return lokaliseTransform(data, data, file);
})
)
.pipe(
foreach(function(stream, file) {
// For each language generate a merged json file. It begins with the master
// translation as a failsafe for untranslated strings, and merges all parent
// tags into one file for each specific subtag
//
// TODO: This is a naive interpretation of BCP47 that should be improved.
// Will be OK for now as long as we don't have anything more complicated
// than a base translation + region.
const tr = path.basename(file.history[0], ".json");
const subtags = tr.split("-");
const src = [workDir + "/translationMaster.json"];
for (let i = 1; i <= subtags.length; i++) {
const lang = subtags.slice(0, i).join("-");
if (lang === "test") {
src.push(workDir + "/test.json");
} else if (lang !== "en") {
src.push(inDir + "/" + lang + ".json");
}
gulp.task("build-merged-translations", function() {
return gulp
.src([inDir + "/*.json", workDir + "/test.json"], { allowEmpty: true })
.pipe(
transform(function(data, file) {
return lokaliseTransform(data, data, file);
})
)
.pipe(
foreach(function(stream, file) {
// For each language generate a merged json file. It begins with the master
// translation as a failsafe for untranslated strings, and merges all parent
// tags into one file for each specific subtag
//
// TODO: This is a naive interpretation of BCP47 that should be improved.
// Will be OK for now as long as we don't have anything more complicated
// than a base translation + region.
const tr = path.basename(file.history[0], ".json");
const subtags = tr.split("-");
const src = [workDir + "/translationMaster.json"];
for (let i = 1; i <= subtags.length; i++) {
const lang = subtags.slice(0, i).join("-");
if (lang === "test") {
src.push(workDir + "/test.json");
} else if (lang !== "en") {
src.push(inDir + "/" + lang + ".json");
}
return gulp
.src(src, { allowEmpty: true })
.pipe(transform((data) => emptyFilter(data)))
.pipe(
merge({
fileName: tr + ".json",
})
)
.pipe(gulp.dest(fullDir));
})
);
})
);
tasks.push(taskName);
}
return gulp
.src(src, { allowEmpty: true })
.pipe(transform((data) => emptyFilter(data)))
.pipe(
merge({
fileName: tr + ".json",
})
)
.pipe(gulp.dest(fullDir));
})
);
});
var taskName;
const splitTasks = [];
TRANSLATION_FRAGMENTS.forEach((fragment) => {
taskName = "build-translation-fragment-" + fragment;
gulp.task(
taskName,
gulp.series("build-merged-translations", function() {
// Return only the translations for this fragment.
return gulp
.src(fullDir + "/*.json")
.pipe(
transform((data) => ({
ui: {
panel: {
[fragment]: data.ui.panel[fragment],
},
gulp.task(taskName, function() {
// Return only the translations for this fragment.
return gulp
.src(fullDir + "/*.json")
.pipe(
transform((data) => ({
ui: {
panel: {
[fragment]: data.ui.panel[fragment],
},
}))
)
.pipe(gulp.dest(workDir + "/" + fragment));
})
);
tasks.push(taskName);
},
}))
)
.pipe(gulp.dest(workDir + "/" + fragment));
});
splitTasks.push(taskName);
});
taskName = "build-translation-core";
gulp.task(
taskName,
gulp.series("build-merged-translations", function() {
// Remove the fragment translations from the core translation.
return gulp
.src(fullDir + "/*.json")
.pipe(
transform((data) => {
TRANSLATION_FRAGMENTS.forEach((fragment) => {
delete data.ui.panel[fragment];
});
return data;
})
)
.pipe(gulp.dest(coreDir));
})
);
tasks.push(taskName);
gulp.task(taskName, function() {
// Remove the fragment translations from the core translation.
return gulp
.src(fullDir + "/*.json")
.pipe(
transform((data) => {
TRANSLATION_FRAGMENTS.forEach((fragment) => {
delete data.ui.panel[fragment];
});
return data;
})
)
.pipe(gulp.dest(coreDir));
});
splitTasks.push(taskName);
taskName = "build-flattened-translations";
gulp.task(
taskName,
gulp.series(...splitTasks, function() {
// Flatten the split versions of our translations, and move them into outDir
return gulp
.src(
TRANSLATION_FRAGMENTS.map(
(fragment) => workDir + "/" + fragment + "/*.json"
).concat(coreDir + "/*.json"),
{ base: workDir }
)
.pipe(
transform(function(data) {
// Polymer.AppLocalizeBehavior requires flattened json
return flatten(data);
})
)
.pipe(minify())
.pipe(hashFilename())
.pipe(
rename((filePath) => {
if (filePath.dirname === "core") {
filePath.dirname = "";
}
})
)
.pipe(gulp.dest(outDir));
})
);
tasks.push(taskName);
gulp.task("build-flattened-translations", function() {
// Flatten the split versions of our translations, and move them into outDir
return gulp
.src(
TRANSLATION_FRAGMENTS.map(
(fragment) => workDir + "/" + fragment + "/*.json"
).concat(coreDir + "/*.json"),
{ base: workDir }
)
.pipe(
transform(function(data) {
// Polymer.AppLocalizeBehavior requires flattened json
return flatten(data);
})
)
.pipe(minify())
.pipe(
rename((filePath) => {
if (filePath.dirname === "core") {
filePath.dirname = "";
}
})
)
.pipe(gulp.dest(outDir));
});
taskName = "build-translation-fingerprints";
gulp.task(
taskName,
gulp.series("build-flattened-translations", function() {
return gulp
.src(outDir + "/**/*.json")
.pipe(
rename({
extname: "",
})
)
.pipe(
hash({
algorithm: "md5",
hashLength: 32,
template: "<%= name %>.json",
})
)
.pipe(hash.manifest("translationFingerprints.json"))
.pipe(
transform(function(data) {
// After generating fingerprints of our translation files, consolidate
// all translation fragment fingerprints under the translation name key
const newData = {};
Object.entries(data).forEach(([key, value]) => {
const [path, _md5] = key.rsplit("-", 1);
// let translation = key;
let translation = path;
const parts = translation.split("/");
if (parts.length === 2) {
translation = parts[1];
}
if (!(translation in newData)) {
newData[translation] = {
fingerprints: {},
};
}
newData[translation].fingerprints[path] = value;
});
return newData;
})
)
.pipe(gulp.dest(workDir));
})
);
tasks.push(taskName);
const fingerprints = {};
taskName = "build-translations";
gulp.task(
taskName,
gulp.series("build-translation-fingerprints", function() {
return gulp
.src(
[
"src/translations/translationMetadata.json",
workDir + "/testMetadata.json",
workDir + "/translationFingerprints.json",
],
{ allowEmpty: true }
)
.pipe(merge({}))
.pipe(
transform(function(data) {
const newData = {};
Object.entries(data).forEach(([key, value]) => {
// Filter out translations without native name.
if (data[key].nativeName) {
newData[key] = data[key];
} else {
console.warn(
`Skipping language ${key}. Native name was not translated.`
);
}
if (data[key]) newData[key] = value;
});
return newData;
})
)
.pipe(
transform((data) => ({
fragments: TRANSLATION_FRAGMENTS,
translations: data,
}))
)
.pipe(rename("translationMetadata.json"))
.pipe(gulp.dest(workDir));
})
);
tasks.push(taskName);
"build-translation-fingerprints",
function fingerprintTranslationFiles() {
// Fingerprint full file of each language
const files = fs.readdirSync(fullDir);
module.exports = tasks;
for (let i = 0; i < files.length; i++) {
fingerprints[files[i].split(".")[0]] = {
// In dev we create fake hashes
hash: env.isProdBuild()
? crypto
.createHash("md5")
.update(fs.readFileSync(path.join(fullDir, files[i]), "utf-8"))
.digest("hex")
: "dev",
};
}
mapFiles(outDir, ".json", (filename) => {
const parsed = path.parse(filename);
// nl.json -> nl-<hash>.json
if (!(parsed.name in fingerprints)) {
throw new Error(`Unable to find hash for ${filename}`);
}
fs.renameSync(
filename,
`${parsed.dir}/${parsed.name}-${fingerprints[parsed.name].hash}${
parsed.ext
}`
);
});
const stream = source("translationFingerprints.json");
stream.write(JSON.stringify(fingerprints));
process.nextTick(() => stream.end());
return stream.pipe(vinylBuffer()).pipe(gulp.dest(workDir));
}
);
gulp.task(
"build-translations",
gulp.series(
"clean-translations",
"ensure-translations-build-dir",
env.isProdBuild() ? (done) => done() : "create-test-translation",
"build-master-translation",
"build-merged-translations",
gulp.parallel(...splitTasks),
"build-flattened-translations",
"build-translation-fingerprints",
function writeMetadata() {
return gulp
.src(
[
path.join(paths.translations_src, "translationMetadata.json"),
workDir + "/testMetadata.json",
workDir + "/translationFingerprints.json",
],
{ allowEmpty: true }
)
.pipe(merge({}))
.pipe(
transform(function(data) {
const newData = {};
Object.entries(data).forEach(([key, value]) => {
// Filter out translations without native name.
if (data[key].nativeName) {
newData[key] = data[key];
} else {
console.warn(
`Skipping language ${key}. Native name was not translated.`
);
}
if (data[key]) newData[key] = value;
});
return newData;
})
)
.pipe(
transform((data) => ({
fragments: TRANSLATION_FRAGMENTS,
translations: data,
}))
)
.pipe(rename("translationMetadata.json"))
.pipe(gulp.dest(workDir));
}
)
);

View File

@@ -3,6 +3,7 @@ const gulp = require("gulp");
const webpack = require("webpack");
const WebpackDevServer = require("webpack-dev-server");
const log = require("fancy-log");
const path = require("path");
const paths = require("../paths");
const {
createAppConfig,
@@ -57,10 +58,14 @@ const handler = (done) => (err, stats) => {
gulp.task("webpack-watch-app", () => {
// we are not calling done, so this command will run forever
webpack(bothBuilds(createAppConfig, { isProdBuild: false })).watch(
{},
webpack(createAppConfig({ isProdBuild: false, latestBuild: true })).watch(
{ ignored: /build-translations/ },
handler()
);
gulp.watch(
path.join(paths.translations_src, "en.json"),
gulp.series("build-translations", "copy-translations")
);
});
gulp.task(

View File

@@ -29,4 +29,6 @@ module.exports = {
hassio_dir: path.resolve(__dirname, "../hassio"),
hassio_root: path.resolve(__dirname, "../hassio/build"),
hassio_publicPath: "/api/hassio/app/",
translations_src: path.resolve(__dirname, "../src/translations"),
};

16
build-scripts/util.js Normal file
View File

@@ -0,0 +1,16 @@
const path = require("path");
const fs = require("fs");
// Helper function to map recursively over files in a folder and it's subfolders
module.exports.mapFiles = function mapFiles(startPath, filter, mapFunc) {
const files = fs.readdirSync(startPath);
for (let i = 0; i < files.length; i++) {
const filename = path.join(startPath, files[i]);
const stat = fs.lstatSync(filename);
if (stat.isDirectory()) {
mapFiles(filename, filter, mapFunc);
} else if (filename.indexOf(filter) >= 0) {
mapFunc(filename);
}
}
};

View File

@@ -22,7 +22,11 @@ const createWebpackConfig = ({
isProdBuild,
latestBuild,
isStatsBuild,
dontHash,
}) => {
if (!dontHash) {
dontHash = new Set();
}
return {
mode: isProdBuild ? "production" : "development",
devtool: isProdBuild ? "source-map" : "inline-cheap-module-source-map",
@@ -91,7 +95,7 @@ const createWebpackConfig = ({
),
].filter(Boolean),
resolve: {
extensions: [".ts", ".js", ".json", ".tsx"],
extensions: [".ts", ".js", ".json"],
alias: {
react: "preact-compat",
"react-dom": "preact-compat",
@@ -103,8 +107,6 @@ const createWebpackConfig = ({
},
output: {
filename: ({ chunk }) => {
const dontHash = new Set();
if (!isProdBuild || dontHash.has(chunk.name)) {
return `${chunk.name}.js`;
}
@@ -146,11 +148,17 @@ const createAppConfig = ({ isProdBuild, latestBuild, isStatsBuild }) => {
// Create an object mapping browser urls to their paths during build
const translationMetadata = require("../build-translations/translationMetadata.json");
const workBoxTranslationsTemplatedURLs = {};
const englishFP = translationMetadata.translations.en.fingerprints;
Object.keys(englishFP).forEach((key) => {
const englishFilename = `en-${translationMetadata.translations.en.hash}.json`;
// core
workBoxTranslationsTemplatedURLs[
`/static/translations/${englishFilename}`
] = `build-translations/output/${englishFilename}`;
translationMetadata.fragments.forEach((fragment) => {
workBoxTranslationsTemplatedURLs[
`/static/translations/${englishFP[key]}`
] = `build-translations/output/${key}.json`;
`/static/translations/${fragment}/${englishFilename}`
] = `build-translations/output/${fragment}/${englishFilename}`;
});
config.plugins.push(
@@ -222,11 +230,12 @@ const createHassioConfig = ({ isProdBuild, latestBuild }) => {
}
const config = createWebpackConfig({
entry: {
entrypoint: path.resolve(paths.hassio_dir, "src/entrypoint.js"),
entrypoint: path.resolve(paths.hassio_dir, "src/entrypoint.ts"),
},
outputRoot: "",
isProdBuild,
latestBuild,
dontHash: new Set(["entrypoint"]),
});
config.output.path = paths.hassio_root;

View File

@@ -26,10 +26,12 @@ import { CastManager } from "../../../../src/cast/cast_manager";
import {
LovelaceConfig,
getLovelaceCollection,
getLegacyLovelaceCollection,
} from "../../../../src/data/lovelace";
import "./hc-layout";
import { generateDefaultViewConfig } from "../../../../src/panels/lovelace/common/generate-lovelace-config";
import { toggleAttribute } from "../../../../src/common/dom/toggle_attribute";
import { atLeastVersion } from "../../../../src/common/config/version";
@customElement("hc-cast")
class HcCast extends LitElement {
@@ -39,7 +41,7 @@ class HcCast extends LitElement {
@property() private askWrite = false;
@property() private lovelaceConfig?: LovelaceConfig | null;
protected render(): TemplateResult | void {
protected render(): TemplateResult {
if (this.lovelaceConfig === undefined) {
return html`
<loading-screen></loading-screen>>
@@ -133,7 +135,9 @@ class HcCast extends LitElement {
protected firstUpdated(changedProps) {
super.firstUpdated(changedProps);
const llColl = getLovelaceCollection(this.connection);
const llColl = atLeastVersion(this.connection.haVersion, 0, 107)
? getLovelaceCollection(this.connection)
: getLegacyLovelaceCollection(this.connection);
// We first do a single refresh because we need to check if there is LL
// configuration.
llColl.refresh().then(

View File

@@ -70,7 +70,7 @@ export class HcConnect extends LitElement {
@property() private castManager?: CastManager | null;
private openDemo = false;
protected render(): TemplateResult | void {
protected render(): TemplateResult {
if (this.cannotConnect) {
const tokens = loadTokens();
return html`

View File

@@ -22,7 +22,7 @@ class HcLayout extends LitElement {
@property() public connection?: Connection;
@property() public user?: HassUser;
protected render(): TemplateResult | void {
protected render(): TemplateResult {
return html`
<ha-card>
<div class="layout">
@@ -50,13 +50,12 @@ class HcLayout extends LitElement {
</div>
</ha-card>
<div class="footer">
<a href="./faq.html">Frequently Asked Questions</a> Found a bug? Let
@balloob know
<!-- <a
<a href="./faq.html">Frequently Asked Questions</a> Found a bug?
<a
href="https://github.com/home-assistant/home-assistant-polymer/issues"
target="_blank"
>Let us know!</a
> -->
>
</div>
`;
}

View File

@@ -16,7 +16,7 @@ class HcDemo extends HassElement {
@property() public lovelacePath!: string;
@property() private _lovelaceConfig?: LovelaceConfig;
protected render(): TemplateResult | void {
protected render(): TemplateResult {
if (!this._lovelaceConfig) {
return html``;
}

View File

@@ -14,7 +14,7 @@ class HcLaunchScreen extends LitElement {
@property() public hass?: HomeAssistant;
@property() public error?: string;
protected render(): TemplateResult | void {
protected render(): TemplateResult {
return html`
<div class="container">
<img

View File

@@ -22,7 +22,7 @@ class HcLovelace extends LitElement {
@property() public viewPath?: string | number;
protected render(): TemplateResult | void {
protected render(): TemplateResult {
const index = this._viewIndex;
if (index === undefined) {
return html`
@@ -39,6 +39,7 @@ class HcLovelace extends LitElement {
mode: "storage",
language: "en",
saveConfig: async () => undefined,
deleteConfig: async () => undefined,
setEditMode: () => undefined,
};
return this.lovelaceConfig.views[index].panel

View File

@@ -15,6 +15,9 @@ import {
import {
LovelaceConfig,
getLovelaceCollection,
fetchResources,
LegacyLovelaceConfig,
getLegacyLovelaceCollection,
} from "../../../../src/data/lovelace";
import "./hc-launch-screen";
import { castContext } from "../cast_context";
@@ -22,6 +25,9 @@ import { CAST_NS } from "../../../../src/cast/const";
import { ReceiverStatusMessage } from "../../../../src/cast/sender_messages";
import { loadLovelaceResources } from "../../../../src/panels/lovelace/common/load-resources";
import { isNavigationClick } from "../../../../src/common/dom/is-navigation-click";
import { atLeastVersion } from "../../../../src/common/config/version";
let resourcesLoaded = false;
@customElement("hc-main")
export class HcMain extends HassElement {
@@ -34,6 +40,7 @@ export class HcMain extends HassElement {
@property() private _error?: string;
private _unsubLovelace?: UnsubscribeFunc;
private _urlPath?: string | null;
public processIncomingMessage(msg: HassMessage) {
if (msg.type === "connect") {
@@ -50,7 +57,7 @@ export class HcMain extends HassElement {
}
}
protected render(): TemplateResult | void {
protected render(): TemplateResult {
if (this._showDemo) {
return html`
<hc-demo .lovelacePath=${this._lovelacePath}></hc-demo>
@@ -108,6 +115,7 @@ export class HcMain extends HassElement {
if (this.hass) {
status.hassUrl = this.hass.auth.data.hassUrl;
status.lovelacePath = this._lovelacePath!;
status.urlPath = this._urlPath;
}
if (senderId) {
@@ -163,8 +171,17 @@ export class HcMain extends HassElement {
this._error = "Cannot show Lovelace because we're not connected.";
return;
}
if (!this._unsubLovelace) {
const llColl = getLovelaceCollection(this.hass!.connection);
if (!this._unsubLovelace || this._urlPath !== msg.urlPath) {
if (msg.urlPath === "lovelace") {
msg.urlPath = null;
}
this._urlPath = msg.urlPath;
if (this._unsubLovelace) {
this._unsubLovelace();
}
const llColl = atLeastVersion(this.hass.connection.haVersion, 0, 107)
? getLovelaceCollection(this.hass!.connection, msg.urlPath)
: getLegacyLovelaceCollection(this.hass!.connection);
// We first do a single refresh because we need to check if there is LL
// configuration.
try {
@@ -175,14 +192,23 @@ export class HcMain extends HassElement {
} catch (err) {
// Generate a Lovelace config.
this._unsubLovelace = () => undefined;
const {
generateLovelaceConfigFromHass,
} = await import("../../../../src/panels/lovelace/common/generate-lovelace-config");
const { generateLovelaceConfigFromHass } = await import(
"../../../../src/panels/lovelace/common/generate-lovelace-config"
);
this._handleNewLovelaceConfig(
await generateLovelaceConfigFromHass(this.hass!)
);
}
}
if (!resourcesLoaded) {
resourcesLoaded = true;
const resources = atLeastVersion(this.hass.connection.haVersion, 0, 107)
? await fetchResources(this.hass!.connection)
: (this._lovelaceConfig as LegacyLovelaceConfig).resources;
if (resources) {
loadLovelaceResources(resources, this.hass!.auth.data.hassUrl);
}
}
this._showDemo = false;
this._lovelacePath = msg.viewPath;
if (castContext.getDeviceCapabilities().touch_input_supported) {
@@ -194,12 +220,6 @@ export class HcMain extends HassElement {
private _handleNewLovelaceConfig(lovelaceConfig: LovelaceConfig) {
castContext.setApplicationState(lovelaceConfig.title!);
this._lovelaceConfig = lovelaceConfig;
if (lovelaceConfig.resources) {
loadLovelaceResources(
lovelaceConfig.resources,
this.hass!.auth.data.hassUrl
);
}
}
private _handleShowDemo(_msg: ShowDemoMessage) {

View File

@@ -6,6 +6,6 @@ const { isProdBuild } = require("../build-scripts/env.js");
const latestBuild = true;
module.exports = createCastConfig({
isProdBuild,
isProdBuild: isProdBuild(),
latestBuild,
});

Binary file not shown.

Before

Width:  |  Height:  |  Size: 68 KiB

After

Width:  |  Height:  |  Size: 20 KiB

View File

Before

Width:  |  Height:  |  Size: 81 KiB

After

Width:  |  Height:  |  Size: 81 KiB

View File

Before

Width:  |  Height:  |  Size: 60 KiB

After

Width:  |  Height:  |  Size: 60 KiB

View File

Before

Width:  |  Height:  |  Size: 63 KiB

After

Width:  |  Height:  |  Size: 63 KiB

View File

Before

Width:  |  Height:  |  Size: 76 KiB

After

Width:  |  Height:  |  Size: 76 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 111 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 115 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 185 KiB

View File

@@ -291,16 +291,7 @@ export const demoEntitiesArsaboo: DemoConfig["entities"] = (localize) =>
state: "13:21",
attributes: {
attribution: "Data provided by Ring.com",
device_id: "e04f434dca02",
firmware: "Up to Date",
kind: "lpd_v2",
timezone: "America/New_York",
type: "doorbots",
wifi_name: "RingOfSecurity-hUrGKNlhR",
created_at: "2019-01-22T13:21:03-05:00",
answered: false,
recording_status: "ready",
category: "motion",
friendly_name: "Front Door Last Motion",
icon: "hademo:history",
},
@@ -313,8 +304,7 @@ export const demoEntitiesArsaboo: DemoConfig["entities"] = (localize) =>
"cbd8dfac9efb441f19168e271cb8629b0372d0c1f721353394b23ed0202013b0",
motion_detection: true,
friendly_name: "Patio",
entity_picture:
"/api/camera_proxy/camera.patio?token=cbd8dfac9efb441f19168e271cb8629b0372d0c1f721353394b23ed0202013b0",
entity_picture: "/assets/arsaboo/images/camera.patio.jpg",
supported_features: 0,
},
},
@@ -326,8 +316,7 @@ export const demoEntitiesArsaboo: DemoConfig["entities"] = (localize) =>
"479b332e0a7cad4c58e0fb98a1ecb7942e3b225190adb93a1341edfa7daf45b0",
motion_detection: true,
friendly_name: "Porch",
entity_picture:
"/api/camera_proxy/camera.porch?token=479b332e0a7cad4c58e0fb98a1ecb7942e3b225190adb93a1341edfa7daf45b0",
entity_picture: "/assets/arsaboo/images/camera.porch.jpg",
supported_features: 0,
},
},
@@ -339,8 +328,7 @@ export const demoEntitiesArsaboo: DemoConfig["entities"] = (localize) =>
"9381b2e4edd1bb21e868e2193f5d132a5fae153ce4f458451d979a02712b4642",
motion_detection: true,
friendly_name: "Backyard",
entity_picture:
"/api/camera_proxy/camera.backyard?token=9381b2e4edd1bb21e868e2193f5d132a5fae153ce4f458451d979a02712b4642",
entity_picture: "/assets/arsaboo/images/camera.backyard.jpg",
supported_features: 0,
},
},
@@ -352,8 +340,7 @@ export const demoEntitiesArsaboo: DemoConfig["entities"] = (localize) =>
"ac38bf88c2c5896eed66ae15739a3e726677f92d79e0d57f83f726ac28bda746",
motion_detection: true,
friendly_name: "Driveway",
entity_picture:
"/api/camera_proxy/camera.driveway?token=ac38bf88c2c5896eed66ae15739a3e726677f92d79e0d57f83f726ac28bda746",
entity_picture: "/assets/arsaboo/images/camera.driveway.jpg",
supported_features: 0,
},
},
@@ -477,8 +464,7 @@ export const demoEntitiesArsaboo: DemoConfig["entities"] = (localize) =>
friendly_name: localize(
"ui.panel.page-demo.config.arsaboo.names.family_room"
),
entity_picture:
"/api/media_player_proxy/media_player.family_room_2?token=be41a86e2a360761d67c36a010b09654b730deec092016ee92aafef79b1978ff&cache=e03d22fb103202e7",
entity_picture: "/assets/arsaboo/images/media_player_family_room.jpg",
supported_features: 64063,
},
},
@@ -487,16 +473,7 @@ export const demoEntitiesArsaboo: DemoConfig["entities"] = (localize) =>
state: "06:44",
attributes: {
attribution: "Data provided by Ring.com",
device_id: "e04f434dca02",
firmware: "Up to Date",
kind: "lpd_v2",
timezone: "America/New_York",
type: "doorbots",
wifi_name: "RingOfSecurity-hUrGKNlhR",
created_at: "2019-01-22T06:44:31-05:00",
answered: false,
recording_status: "ready",
category: "ding",
friendly_name: "Front Door Last Ding",
icon: "hademo:history",
},

View File

@@ -395,7 +395,7 @@ export const demoLovelaceTeachingbirds: DemoConfig["lovelace"] = () => ({
cards: [
{
entity: "script.air_cleaner_quiet",
type: "entity-button",
type: "button",
name: "AC bed",
tap_action: {
action: "call-service",
@@ -408,7 +408,7 @@ export const demoLovelaceTeachingbirds: DemoConfig["lovelace"] = () => ({
},
{
entity: "script.air_cleaner_auto",
type: "entity-button",
type: "button",
name: "AC bed",
tap_action: {
action: "call-service",
@@ -421,7 +421,7 @@ export const demoLovelaceTeachingbirds: DemoConfig["lovelace"] = () => ({
},
{
entity: "script.air_cleaner_turbo",
type: "entity-button",
type: "button",
name: "AC bed",
tap_action: {
action: "call-service",
@@ -434,7 +434,7 @@ export const demoLovelaceTeachingbirds: DemoConfig["lovelace"] = () => ({
},
{
entity: "script.ac_off",
type: "entity-button",
type: "button",
name: "AC",
tap_action: {
action: "call-service",
@@ -447,7 +447,7 @@ export const demoLovelaceTeachingbirds: DemoConfig["lovelace"] = () => ({
},
{
entity: "script.ac_on",
type: "entity-button",
type: "button",
name: "AC",
tap_action: {
action: "call-service",
@@ -658,7 +658,7 @@ export const demoLovelaceTeachingbirds: DemoConfig["lovelace"] = () => ({
action: "call-service",
service: "script.goodnight",
},
type: "entity-button",
type: "button",
icon: "mdi:weather-night",
},
{
@@ -670,7 +670,7 @@ export const demoLovelaceTeachingbirds: DemoConfig["lovelace"] = () => ({
},
service: "scene.turn_on",
},
type: "entity-button",
type: "button",
icon: "mdi:coffee-outline",
},
{
@@ -682,7 +682,7 @@ export const demoLovelaceTeachingbirds: DemoConfig["lovelace"] = () => ({
},
service: "scene.turn_on",
},
type: "entity-button",
type: "button",
icon: "mdi:television-classic",
},
],
@@ -743,7 +743,7 @@ export const demoLovelaceTeachingbirds: DemoConfig["lovelace"] = () => ({
},
service: "light.toggle",
},
type: "entity-button",
type: "button",
icon: "mdi:page-layout-footer",
},
{
@@ -755,7 +755,7 @@ export const demoLovelaceTeachingbirds: DemoConfig["lovelace"] = () => ({
},
service: "light.toggle",
},
type: "entity-button",
type: "button",
icon: "mdi:page-layout-header",
},
],

View File

@@ -53,7 +53,7 @@ class CardModder extends LitElement {
for (var k in this._config.style) {
if (window.cardTools.hasTemplate(this._config.style[k]))
this.templated.push(k);
this.card.style.setProperty(k, '');
this.card.style.setProperty(k, "");
target.style.setProperty(
k,
window.cardTools.parseTemplate(this._config.style[k])

View File

@@ -10,7 +10,7 @@ import {
import "../../../src/components/ha-icon";
import {
EntityRow,
LovelaceRow,
CastConfig,
} from "../../../src/panels/lovelace/entity-rows/types";
import { HomeAssistant } from "../../../src/types";
@@ -18,7 +18,7 @@ import { CastManager } from "../../../src/cast/cast_manager";
import { castSendShowDemo } from "../../../src/cast/receiver_messages";
@customElement("cast-demo-row")
class CastDemoRow extends LitElement implements EntityRow {
class CastDemoRow extends LitElement implements LovelaceRow {
public hass!: HomeAssistant;
@property() private _castManager?: CastManager | null;
@@ -27,7 +27,7 @@ class CastDemoRow extends LitElement implements EntityRow {
// No config possible.
}
protected render(): TemplateResult | void {
protected render(): TemplateResult {
if (
!this._castManager ||
this._castManager.castState === "NO_DEVICES_AVAILABLE"

View File

@@ -12,5 +12,7 @@ import "./resources/hademo-icons";
/* polyfill for paper-dropdown */
setTimeout(() => {
import(/* webpackChunkName: "polyfill-web-animations-next" */ "web-animations-js/web-animations-next-lite.min");
import(
/* webpackChunkName: "polyfill-web-animations-next" */ "web-animations-js/web-animations-next-lite.min"
);
}, 1000);

View File

@@ -65,74 +65,79 @@ const generateHistory = (state, deltas) => {
const incrementalUnits = ["clients", "queries", "ads"];
export const mockHistory = (mockHass: MockHomeAssistant) => {
mockHass.mockAPI(new RegExp("history/period/.+"), (
hass,
// @ts-ignore
method,
path,
// @ts-ignore
parameters
) => {
const params = parseQuery<HistoryQueryParams>(path.split("?")[1]);
const entities = params.filter_entity_id.split(",");
mockHass.mockAPI(
new RegExp("history/period/.+"),
(
hass,
// @ts-ignore
method,
path,
// @ts-ignore
parameters
) => {
const params = parseQuery<HistoryQueryParams>(path.split("?")[1]);
const entities = params.filter_entity_id.split(",");
const results: HassEntity[][] = [];
const results: HassEntity[][] = [];
for (const entityId of entities) {
const state = hass.states[entityId];
for (const entityId of entities) {
const state = hass.states[entityId];
if (!state) {
continue;
}
if (!state) {
continue;
}
if (!state.attributes.unit_of_measurement) {
results.push(generateHistory(state, [state.state]));
continue;
}
if (!state.attributes.unit_of_measurement) {
results.push(generateHistory(state, [state.state]));
continue;
}
const numberState = Number(state.state);
const numberState = Number(state.state);
if (isNaN(numberState)) {
// tslint:disable-next-line
console.log(
"Ignoring state with unparsable state but with a unit",
entityId,
state
if (isNaN(numberState)) {
// tslint:disable-next-line
console.log(
"Ignoring state with unparsable state but with a unit",
entityId,
state
);
continue;
}
const statesToGenerate = 15;
let genFunc;
if (incrementalUnits.includes(state.attributes.unit_of_measurement)) {
let initial = Math.floor(
numberState * 0.4 + numberState * Math.random() * 0.2
);
const diff = Math.max(
1,
Math.floor((numberState - initial) / statesToGenerate)
);
genFunc = () => {
initial += diff;
return Math.min(numberState, initial);
};
} else {
const diff = Math.floor(
numberState * (numberState > 80 ? 0.05 : 0.5)
);
genFunc = () =>
numberState - diff + Math.floor(Math.random() * 2 * diff);
}
results.push(
generateHistory(
{
entity_id: state.entity_id,
attributes: state.attributes,
},
Array.from({ length: statesToGenerate }, genFunc)
)
);
continue;
}
const statesToGenerate = 15;
let genFunc;
if (incrementalUnits.includes(state.attributes.unit_of_measurement)) {
let initial = Math.floor(
numberState * 0.4 + numberState * Math.random() * 0.2
);
const diff = Math.max(
1,
Math.floor((numberState - initial) / statesToGenerate)
);
genFunc = () => {
initial += diff;
return Math.min(numberState, initial);
};
} else {
const diff = Math.floor(numberState * (numberState > 80 ? 0.05 : 0.5));
genFunc = () =>
numberState - diff + Math.floor(Math.random() * 2 * diff);
}
results.push(
generateHistory(
{
entity_id: state.entity_id,
attributes: state.attributes,
},
Array.from({ length: statesToGenerate }, genFunc)
)
);
return results;
}
return results;
});
);
};

View File

@@ -12,9 +12,10 @@ export const mockLovelace = (
localizePromise: Promise<LocalizeFunc>
) => {
hass.mockWS("lovelace/config", () =>
Promise.all([selectedDemoConfig, localizePromise]).then(
([config, localize]) => config.lovelace(localize)
)
Promise.all([
selectedDemoConfig,
localizePromise,
]).then(([config, localize]) => config.lovelace(localize))
);
hass.mockWS("lovelace/config/save", () => Promise.resolve());

View File

@@ -6,7 +6,7 @@ const { isProdBuild, isStatsBuild } = require("../build-scripts/env.js");
const latestBuild = true;
module.exports = createDemoConfig({
isProdBuild,
isStatsBuild,
isProdBuild: isProdBuild(),
isStatsBuild: isStatsBuild(),
latestBuild,
});

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 130 KiB

View File

@@ -2,7 +2,7 @@ import { html } from "@polymer/polymer/lib/utils/html-tag";
import { PolymerElement } from "@polymer/polymer/polymer-element";
import { safeLoad } from "js-yaml";
import { createCardElement } from "../../../src/panels/lovelace/common/create-card-element";
import { createCardElement } from "../../../src/panels/lovelace/create-element/create-card-element";
class DemoCard extends PolymerElement {
static get template() {

View File

@@ -0,0 +1,82 @@
import { getEntity } from "../../../src/fake_data/entity";
export const createMediaPlayerEntities = () => [
getEntity("media_player", "music_paused", "paused", {
friendly_name: "Pausing The Music",
media_content_type: "music",
media_title: "I Wanna Be A Hippy (Flamman & Abraxas Radio Mix)",
media_artist: "Technohead",
supported_features: 64063,
entity_picture: "/images/album_cover_2.jpg",
media_duration: 300,
media_position: 50,
media_position_updated_at: new Date(
// 23 seconds in
new Date().getTime() - 23000
).toISOString(),
}),
getEntity("media_player", "music_playing", "playing", {
friendly_name: "Playing The Music",
media_content_type: "music",
media_title: "I Wanna Be A Hippy (Flamman & Abraxas Radio Mix)",
media_artist: "Technohead",
supported_features: 64063,
entity_picture: "/images/album_cover.jpg",
media_duration: 300,
media_position: 0,
media_position_updated_at: new Date(
// 23 seconds in
new Date().getTime() - 23000
).toISOString(),
}),
getEntity("media_player", "stream_playing", "playing", {
friendly_name: "Playing the Stream",
media_content_type: "movie",
media_title: "Epic sax guy 10 hours",
app_name: "YouTube",
supported_features: 33,
}),
getEntity("media_player", "living_room", "playing", {
friendly_name: "Pause, No skip, tvshow",
media_content_type: "tvshow",
media_title: "Chapter 1",
media_series_title: "House of Cards",
app_name: "Netflix",
supported_features: 1,
}),
getEntity("media_player", "sonos_idle", "idle", {
friendly_name: "Sonos Idle",
supported_features: 64063,
}),
getEntity("media_player", "theater", "off", {
friendly_name: "TV Off",
supported_features: 161,
}),
getEntity("media_player", "android_cast", "playing", {
friendly_name: "Casting App",
media_title: "Android Screen Casting",
app_name: "Screen Mirroring",
// supported_features: 21437,
}),
getEntity("media_player", "unavailable", "unavailable", {
friendly_name: "Player Unavailable",
supported_features: 21437,
}),
getEntity("media_player", "unknown", "unknown", {
friendly_name: "Player Unknown",
supported_features: 21437,
}),
getEntity("media_player", "receiver_on", "on", {
source_list: ["AirPlay", "Blu-Ray", "TV", "USB", "iPod (USB)"],
volume_level: 0.63,
is_volume_muted: false,
source: "TV",
friendly_name: "Receiver",
supported_features: 84364,
}),
getEntity("media_player", "receiver_off", "off", {
source_list: ["AirPlay", "Blu-Ray", "TV", "USB", "iPod (USB)"],
friendly_name: "Receiver",
supported_features: 84364,
}),
];

View File

@@ -15,14 +15,14 @@ const CONFIGS = [
{
heading: "Basic example",
config: `
- type: entity-button
- type: button
entity: light.bed_light
`,
},
{
heading: "With Name",
config: `
- type: entity-button
- type: button
name: Bedroom
entity: light.bed_light
`,
@@ -30,7 +30,7 @@ const CONFIGS = [
{
heading: "With Icon",
config: `
- type: entity-button
- type: button
entity: light.bed_light
icon: mdi:hotel
`,
@@ -38,7 +38,7 @@ const CONFIGS = [
{
heading: "Without State",
config: `
- type: entity-button
- type: button
entity: light.bed_light
show_state: false
`,
@@ -46,7 +46,7 @@ const CONFIGS = [
{
heading: "Custom Tap Action (toggle)",
config: `
- type: entity-button
- type: button
entity: light.bed_light
tap_action:
action: toggle
@@ -55,7 +55,7 @@ const CONFIGS = [
{
heading: "Running Service",
config: `
- type: entity-button
- type: button
entity: light.bed_light
service: light.toggle
`,
@@ -63,13 +63,13 @@ const CONFIGS = [
{
heading: "Invalid Entity",
config: `
- type: entity-button
- type: button
entity: sensor.invalid_entity
`,
},
];
class DemoEntityButtonEntity extends PolymerElement {
class DemoButtonEntity extends PolymerElement {
static get template() {
return html`
<demo-cards
@@ -97,4 +97,4 @@ class DemoEntityButtonEntity extends PolymerElement {
}
}
customElements.define("demo-hui-entity-button-card", DemoEntityButtonEntity);
customElements.define("demo-hui-button-card", DemoButtonEntity);

View File

@@ -0,0 +1,117 @@
import { html } from "@polymer/polymer/lib/utils/html-tag";
import { PolymerElement } from "@polymer/polymer/polymer-element";
import { provideHass } from "../../../src/fake_data/provide_hass";
import "../components/demo-cards";
import { createMediaPlayerEntities } from "../data/media_players";
import "../../../src/panels/lovelace/cards/hui-media-control-card";
const CONFIGS = [
{
heading: "Paused music",
config: `
- type: media-control
entity: media_player.music_paused
`,
},
{
heading: "Playing music",
config: `
- type: media-control
entity: media_player.music_playing
`,
},
{
heading: "Playing stream",
config: `
- type: media-control
entity: media_player.stream_playing
`,
},
{
heading: "Pause, No skip, tvshow",
config: `
- type: media-control
entity: media_player.living_room
`,
},
{
heading: "Screen casting",
config: `
- type: media-control
entity: media_player.android_cast
`,
},
{
heading: "Sonos Idle",
config: `
- type: media-control
entity: media_player.sonos_idle
`,
},
{
heading: "Player Off",
config: `
- type: media-control
entity: media_player.theater
`,
},
{
heading: "Player Unavailable",
config: `
- type: media-control
entity: media_player.unavailable
`,
},
{
heading: "Player Unknown",
config: `
- type: media-control
entity: media_player.unknown
`,
},
{
heading: "Receiver On",
config: `
- type: media-control
entity: media_player.receiver_on
`,
},
{
heading: "Receiver Off",
config: `
- type: media-control
entity: media_player.receiver_off
`,
},
];
class DemoHuiMediControlCard extends PolymerElement {
static get template() {
return html`
<demo-cards
id="demos"
hass="[[hass]]"
configs="[[_configs]]"
></demo-cards>
`;
}
static get properties() {
return {
_configs: {
type: Object,
value: CONFIGS,
},
hass: Object,
};
}
public ready() {
super.ready();
const hass = provideHass(this.$.demos);
hass.addEntities(createMediaPlayerEntities());
}
}
customElements.define("demo-hui-media-control-card", DemoHuiMediControlCard);

View File

@@ -1,54 +1,9 @@
import { html } from "@polymer/polymer/lib/utils/html-tag";
import { PolymerElement } from "@polymer/polymer/polymer-element";
import { getEntity } from "../../../src/fake_data/entity";
import { provideHass } from "../../../src/fake_data/provide_hass";
import "../components/demo-cards";
const ENTITIES = [
getEntity("media_player", "bedroom", "playing", {
media_content_type: "movie",
media_title: "Epic sax guy 10 hours",
app_name: "YouTube",
supported_features: 32,
}),
getEntity("media_player", "family_room", "paused", {
media_content_type: "music",
media_title: "I Wanna Be A Hippy (Flamman & Abraxas Radio Mix)",
media_artist: "Technohead",
supported_features: 16417,
}),
getEntity("media_player", "family_room_no_play", "paused", {
media_content_type: "movie",
media_title: "Epic sax guy 10 hours",
app_name: "YouTube",
supported_features: 33,
}),
getEntity("media_player", "living_room", "playing", {
media_content_type: "tvshow",
media_title: "Chapter 1",
media_series_title: "House of Cards",
app_name: "Netflix",
supported_features: 1,
}),
getEntity("media_player", "lounge_room", "idle", {
media_content_type: "music",
media_title: "I Wanna Be A Hippy (Flamman & Abraxas Radio Mix)",
media_artist: "Technohead",
supported_features: 1,
}),
getEntity("media_player", "theater", "off", {
media_content_type: "movie",
media_title: "Epic sax guy 10 hours",
app_name: "YouTube",
supported_features: 33,
}),
getEntity("media_player", "android_cast", "playing", {
media_title: "Android Screen Casting",
app_name: "Screen Mirroring",
supported_features: 21437,
}),
];
import { createMediaPlayerEntities } from "../data/media_players";
const CONFIGS = [
{
@@ -56,20 +11,24 @@ const CONFIGS = [
config: `
- type: entities
entities:
- entity: media_player.bedroom
name: Skip, no pause
- entity: media_player.family_room
name: Paused, music
- entity: media_player.family_room_no_play
- entity: media_player.music_paused
name: Paused music
- entity: media_player.music_playing
name: Playing music
- entity: media_player.stream_playing
name: Paused, no play
- entity: media_player.living_room
name: Pause, No skip, tvshow
- entity: media_player.android_cast
name: Screen casting
- entity: media_player.lounge_room
- entity: media_player.sonos_idle
name: Chromcast Idle
- entity: media_player.theater
name: 'Player Off'
name: Player Off
- entity: media_player.unavailable
name: Player Unavailable
- entity: media_player.unknown
name: Player Unknown
`,
},
];
@@ -98,7 +57,7 @@ class DemoHuiMediaPlayerRows extends PolymerElement {
public ready() {
super.ready();
const hass = provideHass(this.$.demos);
hass.addEntities(ENTITIES);
hass.addEntities(createMediaPlayerEntities());
}
}

View File

@@ -6,7 +6,7 @@ import { actionHandler } from "../../../src/panels/lovelace/common/directives/ac
import { ActionHandlerEvent } from "../../../src/data/lovelace";
export class DemoUtilLongPress extends LitElement {
protected render(): TemplateResult | void {
protected render(): TemplateResult {
return html`
${this.renderStyle()}
${[1, 2, 3].map(

View File

@@ -15,9 +15,10 @@ import { HomeAssistant } from "../../../src/types";
import {
HassioAddonInfo,
HassioAddonRepository,
} from "../../../src/data/hassio";
} from "../../../src/data/hassio/addon";
import { navigate } from "../../../src/common/navigate";
import { filterAndSort } from "../components/hassio-filter-addons";
import { atLeastVersion } from "../../../src/common/config/version";
class HassioAddonRepositoryEl extends LitElement {
@property() public hass!: HomeAssistant;
@@ -36,81 +37,87 @@ class HassioAddonRepositoryEl extends LitElement {
}
);
protected render(): TemplateResult | void {
protected render(): TemplateResult {
const repo = this.repo;
const addons = this._getAddons(this.addons, this.filter);
if (this.filter && addons.length < 1) {
return html`
<div class="card-group">
<div class="title">
<div class="description">
No results found in "${repo.name}"
</div>
</div>
<div class="content">
<p class="description">
No results found in "${repo.name}"
</p>
</div>
`;
}
return html`
<div class="card-group">
<div class="title">
<div class="content">
<h1>
${repo.name}
<div class="description">
Maintained by ${repo.maintainer}<br />
<a class="repo" href=${repo.url} target="_blank">${repo.url}</a>
</div>
</h1>
<p class="description">
Maintained by ${repo.maintainer}<br />
<a class="repo" href=${repo.url} target="_blank" rel="noreferrer">
${repo.url}
</a>
</p>
<div class="card-group">
${addons.map(
(addon) => html`
<paper-card
.addon=${addon}
class=${addon.available ? "" : "not_available"}
@click=${this._addonTapped}
>
<div class="card-content">
<hassio-card-content
.hass=${this.hass}
.title=${addon.name}
.description=${addon.description}
.available=${addon.available}
.icon=${addon.installed && addon.installed !== addon.version
? "hassio:arrow-up-bold-circle"
: "hassio:puzzle"}
.iconTitle=${addon.installed
? addon.installed !== addon.version
? "New version available"
: "Add-on is installed"
: addon.available
? "Add-on is not installed"
: "Add-on is not available on your system"}
.iconClass=${addon.installed
? addon.installed !== addon.version
? "update"
: "installed"
: !addon.available
? "not_available"
: ""}
.iconImage=${atLeastVersion(
this.hass.connection.haVersion,
0,
105
) && addon.icon
? `/api/hassio/addons/${addon.slug}/icon`
: undefined}
.showTopbar=${addon.installed || !addon.available}
.topbarClass=${addon.installed
? addon.installed !== addon.version
? "update"
: "installed"
: !addon.available
? "unavailable"
: ""}
></hassio-card-content>
</div>
</paper-card>
`
)}
</div>
${addons.map(
(addon) => html`
<paper-card
.addon=${addon}
class=${addon.available ? "" : "not_available"}
@click=${this.addonTapped}
>
<div class="card-content">
<hassio-card-content
.hass=${this.hass}
.title=${addon.name}
.description=${addon.description}
.available=${addon.available}
.icon=${this.computeIcon(addon)}
.iconTitle=${this.computeIconTitle(addon)}
.iconClass=${this.computeIconClass(addon)}
></hassio-card-content>
</div>
</paper-card>
`
)}
</div>
`;
}
private computeIcon(addon) {
return addon.installed && addon.installed !== addon.version
? "hassio:arrow-up-bold-circle"
: "hassio:puzzle";
}
private computeIconTitle(addon) {
if (addon.installed) {
return addon.installed !== addon.version
? "New version available"
: "Add-on is installed";
}
return addon.available
? "Add-on is not installed"
: "Add-on is not available on your system";
}
private computeIconClass(addon) {
if (addon.installed) {
return addon.installed !== addon.version ? "update" : "installed";
}
return !addon.available ? "not_available" : "";
}
private addonTapped(ev) {
private _addonTapped(ev) {
navigate(this, `/hassio/addon/${ev.currentTarget.addon.slug}`);
}

View File

@@ -14,7 +14,7 @@ import {
HassioAddonInfo,
fetchHassioAddonsInfo,
reloadHassioAddons,
} from "../../../src/data/hassio";
} from "../../../src/data/hassio/addon";
import "../../../src/layouts/loading-screen";
import "../components/hassio-search-input";
@@ -48,7 +48,7 @@ class HassioAddonStore extends LitElement {
await this._loadData();
}
protected render(): TemplateResult | void {
protected render(): TemplateResult {
if (!this._addons || !this._repos) {
return html`
<loading-screen></loading-screen>

View File

@@ -17,7 +17,7 @@ import "../../../src/components/buttons/ha-call-api-button";
import "../components/hassio-card-content";
import { hassioStyle } from "../resources/hassio-style";
import { HomeAssistant } from "../../../src/types";
import { HassioAddonRepository } from "../../../src/data/hassio";
import { HassioAddonRepository } from "../../../src/data/hassio/addon";
import { PolymerChangedEvent } from "../../../src/polymer-types";
import { repeat } from "lit-html/directives/repeat";
@@ -33,64 +33,66 @@ class HassioRepositoriesEditor extends LitElement {
.sort((a, b) => (a.name < b.name ? -1 : 1))
);
protected render(): TemplateResult | void {
protected render(): TemplateResult {
const repos = this._sortedRepos(this.repos);
return html`
<div class="card-group">
<div class="title">
<div class="content">
<h1>
Repositories
<div class="description">
Configure which add-on repositories to fetch data from:
</div>
</div>
${// Use repeat so that the fade-out from call-service-api-button
// stays with the correct repo after we add/delete one.
repeat(
repos,
(repo) => repo.slug,
(repo) => html`
<paper-card>
<div class="card-content">
<hassio-card-content
.hass=${this.hass}
.title=${repo.name}
.description=${repo.url}
icon="hassio:github-circle"
></hassio-card-content>
</div>
<div class="card-actions">
<ha-call-api-button
path="hassio/supervisor/options"
.hass=${this.hass}
.data=${this.computeRemoveRepoData(repos, repo.url)}
class="warning"
>
Remove
</ha-call-api-button>
</div>
</paper-card>
`
)}
</h1>
<p class="description">
Configure which add-on repositories to fetch data from:
</p>
<div class="card-group">
${// Use repeat so that the fade-out from call-service-api-button
// stays with the correct repo after we add/delete one.
repeat(
repos,
(repo) => repo.slug,
(repo) => html`
<paper-card>
<div class="card-content">
<hassio-card-content
.hass=${this.hass}
.title=${repo.name}
.description=${repo.url}
icon="hassio:github-circle"
></hassio-card-content>
</div>
<div class="card-actions">
<ha-call-api-button
path="hassio/supervisor/options"
.hass=${this.hass}
.data=${this.computeRemoveRepoData(repos, repo.url)}
class="warning"
>
Remove
</ha-call-api-button>
</div>
</paper-card>
`
)}
<paper-card>
<div class="card-content add">
<iron-icon icon="hassio:github-circle"></iron-icon>
<paper-input
label="Add new repository by URL"
.value=${this._repoUrl}
@value-changed=${this._urlChanged}
></paper-input>
</div>
<div class="card-actions">
<ha-call-api-button
path="hassio/supervisor/options"
.hass=${this.hass}
.data=${this.computeAddRepoData(repos, this._repoUrl)}
>
Add
</ha-call-api-button>
</div>
</paper-card>
<paper-card>
<div class="card-content add">
<iron-icon icon="hassio:github-circle"></iron-icon>
<paper-input
label="Add new repository by URL"
.value=${this._repoUrl}
@value-changed=${this._urlChanged}
></paper-input>
</div>
<div class="card-actions">
<ha-call-api-button
path="hassio/supervisor/options"
.hass=${this.hass}
.data=${this.computeAddRepoData(repos, this._repoUrl)}
>
Add
</ha-call-api-button>
</div>
</paper-card>
</div>
</div>
`;
}

View File

@@ -1,142 +0,0 @@
import "web-animations-js/web-animations-next-lite.min";
import "@material/mwc-button";
import "@polymer/paper-card/paper-card";
import "@polymer/paper-dropdown-menu/paper-dropdown-menu";
import "@polymer/paper-item/paper-item";
import "@polymer/paper-listbox/paper-listbox";
import { html } from "@polymer/polymer/lib/utils/html-tag";
import { PolymerElement } from "@polymer/polymer/polymer-element";
import "../../../src/resources/ha-style";
import { EventsMixin } from "../../../src/mixins/events-mixin";
class HassioAddonAudio extends EventsMixin(PolymerElement) {
static get template() {
return html`
<style include="ha-style">
:host,
paper-card,
paper-dropdown-menu {
display: block;
}
.errors {
color: var(--google-red-500);
margin-bottom: 16px;
}
paper-item {
width: 450px;
}
.card-actions {
text-align: right;
}
</style>
<paper-card heading="Audio">
<div class="card-content">
<template is="dom-if" if="[[error]]">
<div class="errors">[[error]]</div>
</template>
<paper-dropdown-menu label="Input">
<paper-listbox
slot="dropdown-content"
attr-for-selected="device"
selected="{{selectedInput}}"
>
<template is="dom-repeat" items="[[inputDevices]]">
<paper-item device\$="[[item.device]]"
>[[item.name]]</paper-item
>
</template>
</paper-listbox>
</paper-dropdown-menu>
<paper-dropdown-menu label="Output">
<paper-listbox
slot="dropdown-content"
attr-for-selected="device"
selected="{{selectedOutput}}"
>
<template is="dom-repeat" items="[[outputDevices]]">
<paper-item device\$="[[item.device]]"
>[[item.name]]</paper-item
>
</template>
</paper-listbox>
</paper-dropdown-menu>
</div>
<div class="card-actions">
<mwc-button on-click="_saveSettings">Save</mwc-button>
</div>
</paper-card>
`;
}
static get properties() {
return {
hass: Object,
addon: {
type: Object,
observer: "addonChanged",
},
inputDevices: Array,
outputDevices: Array,
selectedInput: String,
selectedOutput: String,
error: String,
};
}
addonChanged(addon) {
this.setProperties({
selectedInput: addon.audio_input || "null",
selectedOutput: addon.audio_output || "null",
});
if (this.outputDevices) return;
const noDevice = [{ device: "null", name: "-" }];
this.hass.callApi("get", "hassio/hardware/audio").then(
(resp) => {
const dev = resp.data.audio;
const input = Object.keys(dev.input).map((key) => ({
device: key,
name: dev.input[key],
}));
const output = Object.keys(dev.output).map((key) => ({
device: key,
name: dev.output[key],
}));
this.setProperties({
inputDevices: noDevice.concat(input),
outputDevices: noDevice.concat(output),
});
},
() => {
this.setProperties({
inputDevices: noDevice,
outputDevices: noDevice,
});
}
);
}
_saveSettings() {
this.error = null;
const path = `hassio/addons/${this.addon.slug}/options`;
this.hass
.callApi("post", path, {
audio_input: this.selectedInput === "null" ? null : this.selectedInput,
audio_output:
this.selectedOutput === "null" ? null : this.selectedOutput,
})
.then(
() => {
this.fire("hass-api-called", { success: true, path: path });
},
(resp) => {
this.error = resp.body.message;
}
);
}
}
customElements.define("hassio-addon-audio", HassioAddonAudio);

View File

@@ -0,0 +1,193 @@
import "web-animations-js/web-animations-next-lite.min";
import "@material/mwc-button";
import "@polymer/paper-card/paper-card";
import "@polymer/paper-dropdown-menu/paper-dropdown-menu";
import "@polymer/paper-item/paper-item";
import "@polymer/paper-listbox/paper-listbox";
import {
css,
CSSResult,
customElement,
html,
LitElement,
property,
PropertyValues,
TemplateResult,
} from "lit-element";
import { HomeAssistant } from "../../../src/types";
import {
HassioAddonDetails,
setHassioAddonOption,
HassioAddonSetOptionParams,
} from "../../../src/data/hassio/addon";
import {
HassioHardwareAudioDevice,
fetchHassioHardwareAudio,
} from "../../../src/data/hassio/hardware";
import { hassioStyle } from "../resources/hassio-style";
import { haStyle } from "../../../src/resources/styles";
@customElement("hassio-addon-audio")
class HassioAddonAudio extends LitElement {
@property() public hass!: HomeAssistant;
@property() public addon!: HassioAddonDetails;
@property() private _error?: string;
@property() private _inputDevices?: HassioHardwareAudioDevice[];
@property() private _outputDevices?: HassioHardwareAudioDevice[];
@property() private _selectedInput!: null | string;
@property() private _selectedOutput!: null | string;
protected render(): TemplateResult {
return html`
<paper-card heading="Audio">
<div class="card-content">
${this._error
? html`
<div class="errors">${this._error}</div>
`
: ""}
<paper-dropdown-menu
label="Input"
@iron-select=${this._setInputDevice}
>
<paper-listbox
slot="dropdown-content"
attr-for-selected="device"
.selected=${this._selectedInput}
>
${this._inputDevices &&
this._inputDevices.map((item) => {
return html`
<paper-item device=${item.device || ""}
>${item.name}</paper-item
>
`;
})}
</paper-listbox>
</paper-dropdown-menu>
<paper-dropdown-menu
label="Output"
@iron-select=${this._setOutputDevice}
>
<paper-listbox
slot="dropdown-content"
attr-for-selected="device"
.selected=${this._selectedOutput}
>
${this._outputDevices &&
this._outputDevices.map((item) => {
return html`
<paper-item device=${item.device || ""}
>${item.name}</paper-item
>
`;
})}
</paper-listbox>
</paper-dropdown-menu>
</div>
<div class="card-actions">
<mwc-button @click=${this._saveSettings}>Save</mwc-button>
</div>
</paper-card>
`;
}
static get styles(): CSSResult[] {
return [
haStyle,
hassioStyle,
css`
:host,
paper-card,
paper-dropdown-menu {
display: block;
}
.errors {
color: var(--google-red-500);
margin-bottom: 16px;
}
paper-item {
width: 450px;
}
.card-actions {
text-align: right;
}
`,
];
}
protected update(changedProperties: PropertyValues): void {
super.update(changedProperties);
if (changedProperties.has("addon")) {
this._addonChanged();
}
}
private _setInputDevice(ev): void {
const device = ev.detail.item.getAttribute("device");
this._selectedInput = device;
}
private _setOutputDevice(ev): void {
const device = ev.detail.item.getAttribute("device");
this._selectedOutput = device;
}
private async _addonChanged(): Promise<void> {
this._selectedInput =
this.addon.audio_input === null ? "default" : this.addon.audio_input;
this._selectedOutput =
this.addon.audio_output === null ? "default" : this.addon.audio_output;
if (this._outputDevices) {
return;
}
const noDevice: HassioHardwareAudioDevice = {
device: "default",
name: "Default",
};
try {
const { audio } = await fetchHassioHardwareAudio(this.hass);
const input = Object.keys(audio.input).map((key) => ({
device: key,
name: audio.input[key],
}));
const output = Object.keys(audio.output).map((key) => ({
device: key,
name: audio.output[key],
}));
this._inputDevices = [noDevice, ...input];
this._outputDevices = [noDevice, ...output];
} catch {
this._error = "Failed to fetch audio hardware";
this._inputDevices = [noDevice];
this._outputDevices = [noDevice];
}
}
private async _saveSettings(): Promise<void> {
this._error = undefined;
const data: HassioAddonSetOptionParams = {
audio_input:
this._selectedInput === "default" ? null : this._selectedInput,
audio_output:
this._selectedOutput === "default" ? null : this._selectedOutput,
};
try {
await setHassioAddonOption(this.hass, this.addon.slug, data);
} catch {
this._error = "Failed to set addon audio device";
}
}
}
declare global {
interface HTMLElementTagNameMap {
"hassio-addon-audio": HassioAddonAudio;
}
}

View File

@@ -1,111 +0,0 @@
import "@polymer/iron-autogrow-textarea/iron-autogrow-textarea";
import "@material/mwc-button";
import "@polymer/paper-card/paper-card";
import { html } from "@polymer/polymer/lib/utils/html-tag";
import { PolymerElement } from "@polymer/polymer/polymer-element";
import "../../../src/components/buttons/ha-call-api-button";
class HassioAddonConfig extends PolymerElement {
static get template() {
return html`
<style include="ha-style">
:host {
display: block;
}
paper-card {
display: block;
}
.card-actions {
@apply --layout;
@apply --layout-justified;
}
.errors {
color: var(--google-red-500);
margin-bottom: 16px;
}
iron-autogrow-textarea {
width: 100%;
font-family: monospace;
}
.syntaxerror {
color: var(--google-red-500);
}
</style>
<paper-card heading="Config">
<div class="card-content">
<template is="dom-if" if="[[error]]">
<div class="errors">[[error]]</div>
</template>
<iron-autogrow-textarea
id="config"
value="{{config}}"
></iron-autogrow-textarea>
</div>
<div class="card-actions">
<ha-call-api-button
class="warning"
hass="[[hass]]"
path="hassio/addons/[[addonSlug]]/options"
data="[[resetData]]"
>Reset to defaults</ha-call-api-button
>
<mwc-button on-click="saveTapped" disabled="[[!configParsed]]"
>Save</mwc-button
>
</div>
</paper-card>
`;
}
static get properties() {
return {
hass: Object,
addon: {
type: Object,
observer: "addonChanged",
},
addonSlug: String,
config: {
type: String,
observer: "configChanged",
},
configParsed: Object,
error: String,
resetData: {
type: Object,
value: {
options: null,
},
},
};
}
addonChanged(addon) {
this.config = addon ? JSON.stringify(addon.options, null, 2) : "";
}
configChanged(config) {
try {
this.$.config.classList.remove("syntaxerror");
this.configParsed = JSON.parse(config);
} catch (err) {
this.$.config.classList.add("syntaxerror");
this.configParsed = null;
}
}
saveTapped() {
this.error = null;
this.hass
.callApi("post", `hassio/addons/${this.addonSlug}/options`, {
options: this.configParsed,
})
.catch((resp) => {
this.error = resp.body.message;
});
}
}
customElements.define("hassio-addon-config", HassioAddonConfig);

View File

@@ -0,0 +1,179 @@
import "@polymer/iron-autogrow-textarea/iron-autogrow-textarea";
import "@material/mwc-button";
import "@polymer/paper-card/paper-card";
import {
css,
CSSResult,
customElement,
html,
LitElement,
property,
PropertyValues,
TemplateResult,
query,
} from "lit-element";
import { HomeAssistant } from "../../../src/types";
import {
HassioAddonDetails,
setHassioAddonOption,
HassioAddonSetOptionParams,
} from "../../../src/data/hassio/addon";
import { hassioStyle } from "../resources/hassio-style";
import { haStyle } from "../../../src/resources/styles";
import { fireEvent } from "../../../src/common/dom/fire_event";
import "../../../src/components/ha-yaml-editor";
// tslint:disable-next-line: no-duplicate-imports
import { HaYamlEditor } from "../../../src/components/ha-yaml-editor";
import { showConfirmationDialog } from "../../../src/dialogs/generic/show-dialog-box";
@customElement("hassio-addon-config")
class HassioAddonConfig extends LitElement {
@property() public hass!: HomeAssistant;
@property() public addon!: HassioAddonDetails;
@property() private _error?: string;
@property({ type: Boolean }) private _configHasChanged = false;
@query("ha-yaml-editor") private _editor!: HaYamlEditor;
protected render(): TemplateResult {
const editor = this._editor;
// If editor not rendered, don't show the error.
const valid = editor ? editor.isValid : true;
return html`
<paper-card heading="Config">
<div class="card-content">
<ha-yaml-editor
@value-changed=${this._configChanged}
></ha-yaml-editor>
${this._error
? html`
<div class="errors">${this._error}</div>
`
: ""}
${valid
? ""
: html`
<div class="errors">Invalid YAML</div>
`}
</div>
<div class="card-actions">
<mwc-button class="warning" @click=${this._resetTapped}>
Reset to defaults
</mwc-button>
<mwc-button
@click=${this._saveTapped}
.disabled=${!this._configHasChanged || !valid}
>
Save
</mwc-button>
</div>
</paper-card>
`;
}
static get styles(): CSSResult[] {
return [
haStyle,
hassioStyle,
css`
:host {
display: block;
}
paper-card {
display: block;
}
.card-actions {
display: flex;
justify-content: space-between;
}
.errors {
color: var(--google-red-500);
margin-top: 16px;
}
iron-autogrow-textarea {
width: 100%;
font-family: monospace;
}
.syntaxerror {
color: var(--google-red-500);
}
`,
];
}
protected updated(changedProperties: PropertyValues): void {
super.updated(changedProperties);
if (changedProperties.has("addon")) {
this._editor.setValue(this.addon.options);
}
}
private _configChanged(): void {
this._configHasChanged = true;
this.requestUpdate();
}
private async _resetTapped(): Promise<void> {
const confirmed = await showConfirmationDialog(this, {
title: this.addon.name,
text: "Are you sure you want to reset all your options?",
confirmText: "reset options",
});
if (!confirmed) {
return;
}
this._error = undefined;
const data: HassioAddonSetOptionParams = {
options: null,
};
try {
await setHassioAddonOption(this.hass, this.addon.slug, data);
this._configHasChanged = false;
const eventdata = {
success: true,
response: undefined,
path: "options",
};
fireEvent(this, "hass-api-called", eventdata);
} catch (err) {
this._error = `Failed to reset addon configuration, ${err.body?.message ||
err}`;
}
}
private async _saveTapped(): Promise<void> {
let data: HassioAddonSetOptionParams;
this._error = undefined;
try {
data = {
options: this._editor.value,
};
} catch (err) {
this._error = err;
return;
}
try {
await setHassioAddonOption(this.hass, this.addon.slug, data);
this._configHasChanged = false;
const eventdata = {
success: true,
response: undefined,
path: "options",
};
fireEvent(this, "hass-api-called", eventdata);
} catch (err) {
this._error = `Failed to save addon configuration, ${err.body?.message ||
err}`;
}
}
}
declare global {
interface HTMLElementTagNameMap {
"hassio-addon-config": HassioAddonConfig;
}
}

View File

@@ -1,615 +0,0 @@
import "@polymer/iron-icon/iron-icon";
import "@material/mwc-button";
import "@polymer/paper-card/paper-card";
import "@polymer/paper-tooltip/paper-tooltip";
import { html } from "@polymer/polymer/lib/utils/html-tag";
import { PolymerElement } from "@polymer/polymer/polymer-element";
import "../../../src/components/ha-label-badge";
import "../../../src/components/ha-markdown";
import "../../../src/components/buttons/ha-call-api-button";
import "../../../src/components/ha-switch";
import "../../../src/resources/ha-style";
import "../components/hassio-card-content";
import { EventsMixin } from "../../../src/mixins/events-mixin";
import { navigate } from "../../../src/common/navigate";
import { showHassioMarkdownDialog } from "../dialogs/markdown/show-dialog-hassio-markdown";
const PERMIS_DESC = {
rating: {
title: "Add-on Security Rating",
description:
"Hass.io provides a security rating to each of the add-ons, which indicates the risks involved when using this add-on. The more access an add-on requires on your system, the lower the score, thus raising the possible security risks.\n\nA score is on a scale from 1 to 6. Where 1 is the lowest score (considered the most insecure and highest risk) and a score of 6 is the highest score (considered the most secure and lowest risk).",
},
host_network: {
title: "Host Network",
description:
"Add-ons usually run in their own isolated network layer, which prevents them from accessing the network of the host operating system. In some cases, this network isolation can limit add-ons in providing their services and therefore, the isolation can be lifted by the add-on author, giving the add-on full access to the network capabilities of the host machine. This gives the add-on more networking capabilities but lowers the security, hence, the security rating of the add-on will be lowered when this option is used by the add-on.",
},
homeassistant_api: {
title: "Home Assistant API Access",
description:
"This add-on is allowed to access your running Home Assistant instance directly via the Home Assistant API. This mode handles authentication for the add-on as well, which enables an add-on to interact with Home Assistant without the need for additional authentication tokens.",
},
full_access: {
title: "Full Hardware Access",
description:
"This add-on is given full access to the hardware of your system, by request of the add-on author. Access is comparable to the privileged mode in Docker. Since this opens up possible security risks, this feature impacts the add-on security score negatively.\n\nThis level of access is not granted automatically and needs to be confirmed by you. To do this, you need to disable the protection mode on the add-on manually. Only disable the protection mode if you know, need AND trust the source of this add-on.",
},
hassio_api: {
title: "Hass.io API Access",
description:
"The add-on was given access to the Hass.io API, by request of the add-on author. By default, the add-on can access general version information of your system. When the add-on requests 'manager' or 'admin' level access to the API, it will gain access to control multiple parts of your Hass.io system. This permission is indicated by this badge and will impact the security score of the addon negatively.",
},
docker_api: {
title: "Full Docker Access",
description:
"The add-on author has requested the add-on to have management access to the Docker instance running on your system. This mode gives the add-on full access and control to your entire Hass.io system, which adds security risks, and could damage your system when misused. Therefore, this feature impacts the add-on security score negatively.\n\nThis level of access is not granted automatically and needs to be confirmed by you. To do this, you need to disable the protection mode on the add-on manually. Only disable the protection mode if you know, need AND trust the source of this add-on.",
},
host_pid: {
title: "Host Processes Namespace",
description:
"Usually, the processes the add-on runs, are isolated from all other system processes. The add-on author has requested the add-on to have access to the system processes running on the host system instance, and allow the add-on to spawn processes on the host system as well. This mode gives the add-on full access and control to your entire Hass.io system, which adds security risks, and could damage your system when misused. Therefore, this feature impacts the add-on security score negatively.\n\nThis level of access is not granted automatically and needs to be confirmed by you. To do this, you need to disable the protection mode on the add-on manually. Only disable the protection mode if you know, need AND trust the source of this add-on.",
},
apparmor: {
title: "AppArmor",
description:
"AppArmor ('Application Armor') is a Linux kernel security module that restricts add-ons capabilities like network access, raw socket access, and permission to read, write, or execute specific files.\n\nAdd-on authors can provide their security profiles, optimized for the add-on, or request it to be disabled. If AppArmor is disabled, it will raise security risks and therefore, has a negative impact on the security score of the add-on.",
},
auth_api: {
title: "Home Assistant Authentication",
description:
"An add-on can authenticate users against Home Assistant, allowing add-ons to give users the possibility to log into applications running inside add-ons, using their Home Assistant username/password. This badge indicates if the add-on author requests this capability.",
},
ingress: {
title: "Ingress",
description:
"This add-on is using Ingress to embed its interface securely into Home Assistant.",
},
};
class HassioAddonInfo extends EventsMixin(PolymerElement) {
static get template() {
return html`
<style include="ha-style">
:host {
display: block;
}
paper-card {
display: block;
margin-bottom: 16px;
}
paper-card.warning {
background-color: var(--google-red-500);
color: white;
--paper-card-header-color: white;
}
paper-card.warning mwc-button {
color: white !important;
}
.warning {
color: var(--google-red-500);
}
.addon-header {
@apply --paper-font-headline;
}
.light-color {
color: var(--secondary-text-color);
}
.addon-version {
float: right;
font-size: 15px;
vertical-align: middle;
}
.description {
margin-bottom: 16px;
}
.logo img {
max-height: 60px;
margin: 16px 0;
display: block;
}
.state {
display: flex;
margin: 8px 0;
}
.state div {
width: 180px;
display: inline-block;
}
.state iron-icon {
width: 16px;
color: var(--secondary-text-color);
}
ha-switch {
display: inline;
}
iron-icon.running {
color: var(--paper-green-400);
}
iron-icon.stopped {
color: var(--google-red-300);
}
ha-call-api-button {
font-weight: 500;
color: var(--primary-color);
}
.right {
float: right;
}
ha-markdown img {
max-width: 100%;
}
.red {
--ha-label-badge-color: var(--label-badge-red, #df4c1e);
}
.blue {
--ha-label-badge-color: var(--label-badge-blue, #039be5);
}
.green {
--ha-label-badge-color: var(--label-badge-green, #0da035);
}
.yellow {
--ha-label-badge-color: var(--label-badge-yellow, #f4b400);
}
.security {
margin-bottom: 16px;
}
.security h3 {
margin-bottom: 8px;
font-weight: normal;
}
.security ha-label-badge {
cursor: pointer;
margin-right: 4px;
--iron-icon-height: 45px;
}
.protection-enable mwc-button {
--mdc-theme-primary: white;
}
.description a, ha-markdown a {
color: var(--primary-color);
}
</style>
<template is="dom-if" if="[[computeUpdateAvailable(addon)]]">
<paper-card heading="Update available! 🎉">
<div class="card-content">
<hassio-card-content
hass="[[hass]]"
title="[[addon.name]] [[addon.last_version]] is available"
description="You are currently running version [[addon.version]]"
icon="hassio:arrow-up-bold-circle"
icon-class="update"
></hassio-card-content>
<template is="dom-if" if="[[!addon.available]]">
<p>This update is no longer compatible with your system.</p>
</template>
</div>
<div class="card-actions">
<ha-call-api-button
hass="[[hass]]"
path="hassio/addons/[[addonSlug]]/update"
disabled="[[!addon.available]]"
>
Update
</ha-call-api-button
>
<template is="dom-if" if="[[addon.changelog]]">
<mwc-button on-click="openChangelog">Changelog</mwc-button>
</template>
</div>
</paper-card>
</template>
<template is="dom-if" if="[[!addon.protected]]">
<paper-card heading="Warning: Protection mode is disabled!" class="warning">
<div class="card-content">
Protection mode on this add-on is disabled! This gives the add-on full access to the entire system, which adds security risks, and could damage your system when used incorrectly. Only disable the protection mode if you know, need AND trust the source of this add-on.
</div>
<div class="card-actions protection-enable">
<mwc-button on-click="protectionToggled">Enable Protection mode</mwc-button>
</div>
</div>
</paper-card>
</template>
<paper-card>
<div class="card-content">
<div class="addon-header">
[[addon.name]]
<div class="addon-version light-color">
<template is="dom-if" if="[[addon.version]]">
[[addon.version]]
<template is="dom-if" if="[[isRunning]]">
<iron-icon
title="Add-on is running"
class="running"
icon="hassio:circle"
></iron-icon>
</template>
<template is="dom-if" if="[[!isRunning]]">
<iron-icon
title="Add-on is stopped"
class="stopped"
icon="hassio:circle"
></iron-icon>
</template>
</template>
<template is="dom-if" if="[[!addon.version]]">
[[addon.last_version]]
</template>
</div>
</div>
<div class="description light-color">
[[addon.description]].<br />
Visit
<a href="[[addon.url]]" target="_blank">[[addon.name]] page</a> for
details.
</div>
<template is="dom-if" if="[[addon.logo]]">
<a href="[[addon.url]]" target="_blank" class="logo">
<img src="/api/hassio/addons/[[addonSlug]]/logo" />
</a>
</template>
<div class="security">
<ha-label-badge
class$="[[computeSecurityClassName(addon.rating)]]"
on-click="showMoreInfo"
id="rating"
value="[[addon.rating]]"
label="rating"
description=""
></ha-label-badge>
<template is="dom-if" if="[[addon.host_network]]">
<ha-label-badge
on-click="showMoreInfo"
id="host_network"
icon="hassio:network"
label="host"
description=""
></ha-label-badge>
</template>
<template is="dom-if" if="[[addon.full_access]]">
<ha-label-badge
on-click="showMoreInfo"
id="full_access"
icon="hassio:chip"
label="hardware"
description=""
></ha-label-badge>
</template>
<template is="dom-if" if="[[addon.homeassistant_api]]">
<ha-label-badge
on-click="showMoreInfo"
id="homeassistant_api"
icon="hassio:home-assistant"
label="hass"
description=""
></ha-label-badge>
</template>
<template is="dom-if" if="[[computeHassioApi(addon)]]">
<ha-label-badge
on-click="showMoreInfo"
id="hassio_api"
icon="hassio:home-assistant"
label="hassio"
description="[[addon.hassio_role]]"
></ha-label-badge>
</template>
<template is="dom-if" if="[[addon.docker_api]]">
<ha-label-badge
on-click="showMoreInfo"
id="docker_api"
icon="hassio:docker"
label="docker"
description=""
></ha-label-badge>
</template>
<template is="dom-if" if="[[addon.host_pid]]">
<ha-label-badge
on-click="showMoreInfo"
id="host_pid"
icon="hassio:pound"
label="host pid"
description=""
></ha-label-badge>
</template>
<template is="dom-if" if="[[addon.apparmor]]">
<ha-label-badge
on-click="showMoreInfo"
class$="[[computeApparmorClassName(addon.apparmor)]]"
id="apparmor"
icon="hassio:shield"
label="apparmor"
description=""
></ha-label-badge>
</template>
<template is="dom-if" if="[[addon.auth_api]]">
<ha-label-badge
on-click="showMoreInfo"
id="auth_api"
icon="hassio:key"
label="auth"
description=""
></ha-label-badge>
</template>
<template is="dom-if" if="[[addon.ingress]]">
<ha-label-badge
on-click="showMoreInfo"
id="ingress"
icon="hassio:cursor-default-click-outline"
label="ingress"
description=""
></ha-label-badge>
</template>
</div>
<template is="dom-if" if="[[addon.version]]">
<div class="state">
<div>Start on boot</div>
<ha-switch
on-change="startOnBootToggled"
checked="[[computeStartOnBoot(addon.boot)]]"
></ha-switch>
</div>
<div class="state">
<div>Auto update</div>
<ha-switch
on-change="autoUpdateToggled"
checked="[[addon.auto_update]]"
></ha-switch>
</div>
<template is="dom-if" if="[[addon.ingress]]">
<div class="state">
<div>Show in sidebar</div>
<ha-switch
on-change="panelToggled"
checked="[[addon.ingress_panel]]"
disabled="[[_computeCannotIngressSidebar(hass, addon)]]"
></ha-switch>
<template is="dom-if" if="[[_computeCannotIngressSidebar(hass, addon)]]">
<span>This option requires Home Assistant 0.92 or later.</span>
</template>
</div>
</template>
<div class="state">
<div>
Protection mode
<span>
<iron-icon icon="hassio:information"></iron-icon>
<paper-tooltip>Grant the add-on elevated system access.</paper-tooltip>
</span>
</div>
<ha-switch
on-change="protectionToggled"
checked="[[addon.protected]]"
></ha-switch>
</div>
</template>
</div>
<div class="card-actions">
<template is="dom-if" if="[[addon.version]]">
<mwc-button class="warning" on-click="_unistallClicked"
>Uninstall</mwc-button
>
<template is="dom-if" if="[[addon.build]]">
<ha-call-api-button
class="warning"
hass="[[hass]]"
path="hassio/addons/[[addonSlug]]/rebuild"
>Rebuild</ha-call-api-button
>
</template>
<template is="dom-if" if="[[isRunning]]">
<ha-call-api-button
class="warning"
hass="[[hass]]"
path="hassio/addons/[[addonSlug]]/restart"
>Restart</ha-call-api-button
>
<ha-call-api-button
class="warning"
hass="[[hass]]"
path="hassio/addons/[[addonSlug]]/stop"
>Stop</ha-call-api-button
>
</template>
<template is="dom-if" if="[[!isRunning]]">
<ha-call-api-button
hass="[[hass]]"
path="hassio/addons/[[addonSlug]]/start"
>Start</ha-call-api-button
>
</template>
<template
is="dom-if"
if="[[computeShowWebUI(addon.ingress, addon.webui, isRunning)]]"
>
<a
href="[[pathWebui(addon.webui)]]"
tabindex="-1"
target="_blank"
class="right"
><mwc-button>Open web UI</mwc-button></a
>
</template>
<template
is="dom-if"
if="[[computeShowIngressUI(addon.ingress, isRunning)]]"
>
<mwc-button
tabindex="-1"
class="right"
on-click="openIngress"
>Open web UI</mwc-button>
</template>
</template>
<template is="dom-if" if="[[!addon.version]]">
<template is="dom-if" if="[[!addon.available]]">
<p class="warning">This add-on is not available on your system.</p>
</template>
<ha-call-api-button
disabled="[[!addon.available]]"
hass="[[hass]]"
path="hassio/addons/[[addonSlug]]/install"
>Install</ha-call-api-button
>
</template>
</div>
</paper-card>
<template is="dom-if" if="[[addon.long_description]]">
<paper-card>
<div class="card-content">
<ha-markdown content="[[addon.long_description]]"></ha-markdown>
</div>
</paper-card>
</template>
`;
}
static get properties() {
return {
hass: Object,
addon: Object,
addonSlug: String,
isRunning: { type: Boolean, computed: "computeIsRunning(addon)" },
};
}
computeIsRunning(addon) {
return addon && addon.state === "started";
}
computeUpdateAvailable(addon) {
return (
addon &&
!addon.detached &&
addon.version &&
addon.version !== addon.last_version
);
}
computeHassioApi(addon) {
return (
addon.hassio_api &&
(addon.hassio_role === "manager" || addon.hassio_role === "admin")
);
}
computeApparmorClassName(apparmor) {
if (apparmor === "profile") {
return "green";
}
if (apparmor === "disable") {
return "red";
}
return "";
}
pathWebui(webui) {
return webui && webui.replace("[HOST]", document.location.hostname);
}
computeShowWebUI(ingress, webui, isRunning) {
return !ingress && webui && isRunning;
}
openIngress() {
navigate(this, `/hassio/ingress/${this.addon.slug}`);
}
computeShowIngressUI(ingress, isRunning) {
return ingress && isRunning;
}
computeStartOnBoot(state) {
return state === "auto";
}
computeSecurityClassName(rating) {
if (rating > 4) {
return "green";
}
if (rating > 2) {
return "yellow";
}
return "red";
}
startOnBootToggled() {
const data = { boot: this.addon.boot === "auto" ? "manual" : "auto" };
this.hass.callApi("POST", `hassio/addons/${this.addonSlug}/options`, data);
}
autoUpdateToggled() {
const data = { auto_update: !this.addon.auto_update };
this.hass.callApi("POST", `hassio/addons/${this.addonSlug}/options`, data);
}
protectionToggled() {
const data = { protected: !this.addon.protected };
this.hass.callApi("POST", `hassio/addons/${this.addonSlug}/security`, data);
this.set("addon.protected", !this.addon.protected);
}
panelToggled() {
const data = { ingress_panel: !this.addon.ingress_panel };
this.hass.callApi("POST", `hassio/addons/${this.addonSlug}/options`, data);
}
showMoreInfo(e) {
const id = e.target.getAttribute("id");
showHassioMarkdownDialog(this, {
title: PERMIS_DESC[id].title,
content: PERMIS_DESC[id].description,
});
}
openChangelog() {
this.hass
.callApi("get", `hassio/addons/${this.addonSlug}/changelog`)
.then((resp) => resp, () => "Error getting changelog")
.then((content) => {
showHassioMarkdownDialog(this, {
title: "Changelog",
content: content,
});
});
}
_unistallClicked() {
if (!confirm("Are you sure you want to uninstall this add-on?")) {
return;
}
const path = `hassio/addons/${this.addonSlug}/uninstall`;
const eventData = {
path: path,
};
this.hass
.callApi("post", path)
.then(
(resp) => {
eventData.success = true;
eventData.response = resp;
},
(resp) => {
eventData.success = false;
eventData.response = resp;
}
)
.then(() => {
this.fire("hass-api-called", eventData);
});
}
_computeCannotIngressSidebar(hass, addon) {
return !addon.ingress || !this._computeHA92plus(hass);
}
_computeHA92plus(hass) {
const [major, minor] = hass.config.version.split(".", 2);
return Number(major) > 0 || (major === "0" && Number(minor) >= 92);
}
}
customElements.define("hassio-addon-info", HassioAddonInfo);

View File

@@ -0,0 +1,804 @@
import "@material/mwc-button";
import "@polymer/iron-icon/iron-icon";
import "@polymer/paper-card/paper-card";
import "@polymer/paper-tooltip/paper-tooltip";
import {
css,
CSSResult,
customElement,
html,
LitElement,
property,
TemplateResult,
} from "lit-element";
import { classMap } from "lit-html/directives/class-map";
import "../../../src/components/buttons/ha-call-api-button";
import "../../../src/components/buttons/ha-progress-button";
import "../../../src/components/ha-label-badge";
import "../../../src/components/ha-markdown";
import "../../../src/components/ha-switch";
import "../components/hassio-card-content";
import { fireEvent } from "../../../src/common/dom/fire_event";
import {
HassioAddonDetails,
HassioAddonSetOptionParams,
HassioAddonSetSecurityParams,
setHassioAddonOption,
setHassioAddonSecurity,
uninstallHassioAddon,
installHassioAddon,
fetchHassioAddonChangelog,
} from "../../../src/data/hassio/addon";
import { hassioStyle } from "../resources/hassio-style";
import { haStyle } from "../../../src/resources/styles";
import { HomeAssistant } from "../../../src/types";
import { navigate } from "../../../src/common/navigate";
import { showHassioMarkdownDialog } from "../dialogs/markdown/show-dialog-hassio-markdown";
import { atLeastVersion } from "../../../src/common/config/version";
const PERMIS_DESC = {
rating: {
title: "Add-on Security Rating",
description:
"Hass.io provides a security rating to each of the add-ons, which indicates the risks involved when using this add-on. The more access an add-on requires on your system, the lower the score, thus raising the possible security risks.\n\nA score is on a scale from 1 to 6. Where 1 is the lowest score (considered the most insecure and highest risk) and a score of 6 is the highest score (considered the most secure and lowest risk).",
},
host_network: {
title: "Host Network",
description:
"Add-ons usually run in their own isolated network layer, which prevents them from accessing the network of the host operating system. In some cases, this network isolation can limit add-ons in providing their services and therefore, the isolation can be lifted by the add-on author, giving the add-on full access to the network capabilities of the host machine. This gives the add-on more networking capabilities but lowers the security, hence, the security rating of the add-on will be lowered when this option is used by the add-on.",
},
homeassistant_api: {
title: "Home Assistant API Access",
description:
"This add-on is allowed to access your running Home Assistant instance directly via the Home Assistant API. This mode handles authentication for the add-on as well, which enables an add-on to interact with Home Assistant without the need for additional authentication tokens.",
},
full_access: {
title: "Full Hardware Access",
description:
"This add-on is given full access to the hardware of your system, by request of the add-on author. Access is comparable to the privileged mode in Docker. Since this opens up possible security risks, this feature impacts the add-on security score negatively.\n\nThis level of access is not granted automatically and needs to be confirmed by you. To do this, you need to disable the protection mode on the add-on manually. Only disable the protection mode if you know, need AND trust the source of this add-on.",
},
hassio_api: {
title: "Hass.io API Access",
description:
"The add-on was given access to the Hass.io API, by request of the add-on author. By default, the add-on can access general version information of your system. When the add-on requests 'manager' or 'admin' level access to the API, it will gain access to control multiple parts of your Hass.io system. This permission is indicated by this badge and will impact the security score of the addon negatively.",
},
docker_api: {
title: "Full Docker Access",
description:
"The add-on author has requested the add-on to have management access to the Docker instance running on your system. This mode gives the add-on full access and control to your entire Hass.io system, which adds security risks, and could damage your system when misused. Therefore, this feature impacts the add-on security score negatively.\n\nThis level of access is not granted automatically and needs to be confirmed by you. To do this, you need to disable the protection mode on the add-on manually. Only disable the protection mode if you know, need AND trust the source of this add-on.",
},
host_pid: {
title: "Host Processes Namespace",
description:
"Usually, the processes the add-on runs, are isolated from all other system processes. The add-on author has requested the add-on to have access to the system processes running on the host system instance, and allow the add-on to spawn processes on the host system as well. This mode gives the add-on full access and control to your entire Hass.io system, which adds security risks, and could damage your system when misused. Therefore, this feature impacts the add-on security score negatively.\n\nThis level of access is not granted automatically and needs to be confirmed by you. To do this, you need to disable the protection mode on the add-on manually. Only disable the protection mode if you know, need AND trust the source of this add-on.",
},
apparmor: {
title: "AppArmor",
description:
"AppArmor ('Application Armor') is a Linux kernel security module that restricts add-ons capabilities like network access, raw socket access, and permission to read, write, or execute specific files.\n\nAdd-on authors can provide their security profiles, optimized for the add-on, or request it to be disabled. If AppArmor is disabled, it will raise security risks and therefore, has a negative impact on the security score of the add-on.",
},
auth_api: {
title: "Home Assistant Authentication",
description:
"An add-on can authenticate users against Home Assistant, allowing add-ons to give users the possibility to log into applications running inside add-ons, using their Home Assistant username/password. This badge indicates if the add-on author requests this capability.",
},
ingress: {
title: "Ingress",
description:
"This add-on is using Ingress to embed its interface securely into Home Assistant.",
},
};
@customElement("hassio-addon-info")
class HassioAddonInfo extends LitElement {
@property() public hass!: HomeAssistant;
@property() public addon!: HassioAddonDetails;
@property() private _error?: string;
@property({ type: Boolean }) private _installing = false;
protected render(): TemplateResult {
return html`
${this._computeUpdateAvailable
? html`
<paper-card heading="Update available! 🎉">
<div class="card-content">
<hassio-card-content
.hass=${this.hass}
.title="${this.addon.name} ${this.addon
.last_version} is available"
.description="You are currently running version ${this.addon
.version}"
icon="hassio:arrow-up-bold-circle"
iconClass="update"
></hassio-card-content>
${!this.addon.available
? html`
<p>
This update is no longer compatible with your system.
</p>
`
: ""}
</div>
<div class="card-actions">
<ha-call-api-button
.hass=${this.hass}
.disabled=${!this.addon.available}
path="hassio/addons/${this.addon.slug}/update"
>
Update
</ha-call-api-button>
${this.addon.changelog
? html`
<mwc-button @click=${this._openChangelog}>
Changelog
</mwc-button>
`
: ""}
</div>
</paper-card>
`
: ""}
${!this.addon.protected
? html`
<paper-card heading="Warning: Protection mode is disabled!" class="warning">
<div class="card-content">
Protection mode on this add-on is disabled! This gives the add-on full access to the entire system, which adds security risks, and could damage your system when used incorrectly. Only disable the protection mode if you know, need AND trust the source of this add-on.
</div>
<div class="card-actions protection-enable">
<mwc-button @click=${this._protectionToggled}>Enable Protection mode</mwc-button>
</div>
</div>
</paper-card>
`
: ""}
<paper-card>
<div class="card-content">
<div class="addon-header">
${this.addon.name}
<div class="addon-version light-color">
${this.addon.version
? html`
${this.addon.version}
${this._computeIsRunning
? html`
<iron-icon
title="Add-on is running"
class="running"
icon="hassio:circle"
></iron-icon>
`
: html`
<iron-icon
title="Add-on is stopped"
class="stopped"
icon="hassio:circle"
></iron-icon>
`}
`
: html`
${this.addon.last_version}
`}
</div>
</div>
<div class="description light-color">
${this.addon.description}.<br />
Visit
<a href="${this.addon.url}" target="_blank" rel="noreferrer">
${this.addon.name} page</a
>
for details.
</div>
${this.addon.logo
? html`
<a
href="${this.addon.url}"
target="_blank"
class="logo"
rel="noreferrer"
>
<img src="/api/hassio/addons/${this.addon.slug}/logo" />
</a>
`
: ""}
<div class="security">
<ha-label-badge
class=${classMap({
green: [5, 6].includes(Number(this.addon.rating)),
yellow: [3, 4].includes(Number(this.addon.rating)),
red: [1, 2].includes(Number(this.addon.rating)),
})}
@click=${this._showMoreInfo}
id="rating"
.value=${this.addon.rating}
label="rating"
description=""
></ha-label-badge>
${this.addon.host_network
? html`
<ha-label-badge
@click=${this._showMoreInfo}
id="host_network"
icon="hassio:network"
label="host"
description=""
></ha-label-badge>
`
: ""}
${this.addon.full_access
? html`
<ha-label-badge
@click=${this._showMoreInfo}
id="full_access"
icon="hassio:chip"
label="hardware"
description=""
></ha-label-badge>
`
: ""}
${this.addon.homeassistant_api
? html`
<ha-label-badge
@click=${this._showMoreInfo}
id="homeassistant_api"
icon="hassio:home-assistant"
label="hass"
description=""
></ha-label-badge>
`
: ""}
${this._computeHassioApi
? html`
<ha-label-badge
@click=${this._showMoreInfo}
id="hassio_api"
icon="hassio:home-assistant"
label="hassio"
.description=${this.addon.hassio_role}
></ha-label-badge>
`
: ""}
${this.addon.docker_api
? html`
<ha-label-badge
@click=${this._showMoreInfo}
id="docker_api"
icon="hassio:docker"
label="docker"
description=""
></ha-label-badge>
`
: ""}
${this.addon.host_pid
? html`
<ha-label-badge
@click=${this._showMoreInfo}
id="host_pid"
icon="hassio:pound"
label="host pid"
description=""
></ha-label-badge>
`
: ""}
${this.addon.apparmor
? html`
<ha-label-badge
@click=${this._showMoreInfo}
class=${this._computeApparmorClassName}
id="apparmor"
icon="hassio:shield"
label="apparmor"
description=""
></ha-label-badge>
`
: ""}
${this.addon.auth_api
? html`
<ha-label-badge
@click=${this._showMoreInfo}
id="auth_api"
icon="hassio:key"
label="auth"
description=""
></ha-label-badge>
`
: ""}
${this.addon.ingress
? html`
<ha-label-badge
@click=${this._showMoreInfo}
id="ingress"
icon="hassio:cursor-default-click-outline"
label="ingress"
description=""
></ha-label-badge>
`
: ""}
</div>
${this.addon.version
? html`
<div class="state">
<div>Start on boot</div>
<ha-switch
@change=${this._startOnBootToggled}
.checked=${this.addon.boot === "auto"}
haptic
></ha-switch>
</div>
<div class="state">
<div>Auto update</div>
<ha-switch
@change=${this._autoUpdateToggled}
.checked=${this.addon.auto_update}
haptic
></ha-switch>
</div>
${this.addon.ingress
? html`
<div class="state">
<div>Show in sidebar</div>
<ha-switch
@change=${this._panelToggled}
.checked=${this.addon.ingress_panel}
.disabled=${this._computeCannotIngressSidebar}
haptic
></ha-switch>
${this._computeCannotIngressSidebar
? html`
<span>
This option requires Home Assistant 0.92 or
later.
</span>
`
: ""}
</div>
`
: ""}
${this._computeUsesProtectedOptions
? html`
<div class="state">
<div>
Protection mode
<span>
<iron-icon icon="hassio:information"></iron-icon>
<paper-tooltip>
Grant the add-on elevated system access.
</paper-tooltip>
</span>
</div>
<ha-switch
@change=${this._protectionToggled}
.checked=${this.addon.protected}
haptic
></ha-switch>
</div>
`
: ""}
`
: ""}
${this._error
? html`
<div class="errors">${this._error}</div>
`
: ""}
</div>
<div class="card-actions">
${this.addon.version
? html`
<mwc-button class="warning" @click=${this._uninstallClicked}>
Uninstall
</mwc-button>
${this.addon.build
? html`
<ha-call-api-button
class="warning"
.hass=${this.hass}
.path="hassio/addons/${this.addon.slug}/rebuild"
>
Rebuild
</ha-call-api-button>
`
: ""}
${this._computeIsRunning
? html`
<ha-call-api-button
class="warning"
.hass=${this.hass}
.path="hassio/addons/${this.addon.slug}/restart"
>
Restart
</ha-call-api-button>
<ha-call-api-button
class="warning"
.hass=${this.hass}
.path="hassio/addons/${this.addon.slug}/stop"
>
Stop
</ha-call-api-button>
`
: html`
<ha-call-api-button
.hass=${this.hass}
.path="hassio/addons/${this.addon.slug}/start"
>
Start
</ha-call-api-button>
`}
${this._computeShowWebUI
? html`
<a
.href=${this._pathWebui}
tabindex="-1"
target="_blank"
class="right"
rel="noopener"
>
<mwc-button>
Open web UI
</mwc-button>
</a>
`
: ""}
${this._computeShowIngressUI
? html`
<mwc-button class="right" @click=${this._openIngress}>
Open web UI
</mwc-button>
`
: ""}
`
: html`
${!this.addon.available
? html`
<p class="warning">
This add-on is not available on your system.
</p>
`
: ""}
<ha-progress-button
.disabled=${!this.addon.available || this._installing}
.progress=${this._installing}
@click=${this._installClicked}
>
Install
</ha-progress-button>
`}
</div>
</paper-card>
${this.addon.long_description
? html`
<paper-card>
<div class="card-content">
<ha-markdown
.content=${this.addon.long_description}
></ha-markdown>
</div>
</paper-card>
`
: ""}
`;
}
static get styles(): CSSResult[] {
return [
haStyle,
hassioStyle,
css`
:host {
display: block;
}
paper-card {
display: block;
margin-bottom: 16px;
}
paper-card.warning {
background-color: var(--google-red-500);
color: white;
--paper-card-header-color: white;
}
paper-card.warning mwc-button {
--mdc-theme-primary: white !important;
}
.warning {
color: var(--google-red-500);
--mdc-theme-primary: var(--google-red-500);
}
.light-color {
color: var(--secondary-text-color);
}
.addon-header {
font-size: 24px;
color: var(--paper-card-header-color, --primary-text-color);
}
.addon-version {
float: right;
font-size: 15px;
vertical-align: middle;
}
.errors {
color: var(--google-red-500);
margin-bottom: 16px;
}
.description {
margin-bottom: 16px;
}
.logo img {
max-height: 60px;
margin: 16px 0;
display: block;
}
.state {
display: flex;
margin: 33px 0;
}
.state div {
width: 180px;
display: inline-block;
}
.state iron-icon {
width: 16px;
height: 16px;
color: var(--secondary-text-color);
}
ha-switch {
display: flex;
}
iron-icon.running {
color: var(--paper-green-400);
}
iron-icon.stopped {
color: var(--google-red-300);
}
ha-call-api-button {
font-weight: 500;
color: var(--primary-color);
}
.right {
float: right;
}
ha-markdown img {
max-width: 100%;
}
protection-enable mwc-button {
--mdc-theme-primary: white;
}
.description a,
ha-markdown a {
color: var(--primary-color);
}
.red {
--ha-label-badge-color: var(--label-badge-red, #df4c1e);
}
.blue {
--ha-label-badge-color: var(--label-badge-blue, #039be5);
}
.green {
--ha-label-badge-color: var(--label-badge-green, #0da035);
}
.yellow {
--ha-label-badge-color: var(--label-badge-yellow, #f4b400);
}
.security {
margin-bottom: 16px;
}
.card-actions {
display: flow-root;
}
.security h3 {
margin-bottom: 8px;
font-weight: normal;
}
.security ha-label-badge {
cursor: pointer;
margin-right: 4px;
--iron-icon-height: 45px;
}
`,
];
}
private get _computeHassioApi(): boolean {
return (
this.addon.hassio_api &&
(this.addon.hassio_role === "manager" ||
this.addon.hassio_role === "admin")
);
}
private get _computeApparmorClassName(): string {
if (this.addon.apparmor === "profile") {
return "green";
}
if (this.addon.apparmor === "disable") {
return "red";
}
return "";
}
private _showMoreInfo(ev): void {
const id = ev.target.getAttribute("id");
showHassioMarkdownDialog(this, {
title: PERMIS_DESC[id].title,
content: PERMIS_DESC[id].description,
});
}
private get _computeIsRunning(): boolean {
return this.addon?.state === "started";
}
private get _computeUpdateAvailable(): boolean | "" {
return (
this.addon &&
!this.addon.detached &&
this.addon.version &&
this.addon.version !== this.addon.last_version
);
}
private get _pathWebui(): string | null {
return (
this.addon.webui &&
this.addon.webui.replace("[HOST]", document.location.hostname)
);
}
private get _computeShowWebUI(): boolean | "" | null {
return !this.addon.ingress && this.addon.webui && this._computeIsRunning;
}
private _openIngress(): void {
navigate(this, `/hassio/ingress/${this.addon.slug}`);
}
private get _computeShowIngressUI(): boolean {
return this.addon.ingress && this._computeIsRunning;
}
private get _computeCannotIngressSidebar(): boolean {
return (
!this.addon.ingress ||
!atLeastVersion(this.hass.connection.haVersion, 0, 92)
);
}
private get _computeUsesProtectedOptions(): boolean {
return (
this.addon.docker_api || this.addon.full_access || this.addon.host_pid
);
}
private async _startOnBootToggled(): Promise<void> {
this._error = undefined;
const data: HassioAddonSetOptionParams = {
boot: this.addon.boot === "auto" ? "manual" : "auto",
};
try {
await setHassioAddonOption(this.hass, this.addon.slug, data);
const eventdata = {
success: true,
response: undefined,
path: "option",
};
fireEvent(this, "hass-api-called", eventdata);
} catch (err) {
this._error = `Failed to set addon option, ${err.body?.message || err}`;
}
}
private async _autoUpdateToggled(): Promise<void> {
this._error = undefined;
const data: HassioAddonSetOptionParams = {
auto_update: !this.addon.auto_update,
};
try {
await setHassioAddonOption(this.hass, this.addon.slug, data);
const eventdata = {
success: true,
response: undefined,
path: "option",
};
fireEvent(this, "hass-api-called", eventdata);
} catch (err) {
this._error = `Failed to set addon option, ${err.body?.message || err}`;
}
}
private async _protectionToggled(): Promise<void> {
this._error = undefined;
const data: HassioAddonSetSecurityParams = {
protected: !this.addon.protected,
};
try {
await setHassioAddonSecurity(this.hass, this.addon.slug, data);
const eventdata = {
success: true,
response: undefined,
path: "security",
};
fireEvent(this, "hass-api-called", eventdata);
} catch (err) {
this._error = `Failed to set addon security option, ${err.body?.message ||
err}`;
}
}
private async _panelToggled(): Promise<void> {
this._error = undefined;
const data: HassioAddonSetOptionParams = {
ingress_panel: !this.addon.ingress_panel,
};
try {
await setHassioAddonOption(this.hass, this.addon.slug, data);
const eventdata = {
success: true,
response: undefined,
path: "option",
};
fireEvent(this, "hass-api-called", eventdata);
} catch (err) {
this._error = `Failed to set addon option, ${err.body?.message || err}`;
}
}
private async _openChangelog(): Promise<void> {
this._error = undefined;
try {
const content = await fetchHassioAddonChangelog(
this.hass,
this.addon.slug
);
showHassioMarkdownDialog(this, {
title: "Changelog",
content,
});
} catch (err) {
this._error = `Failed to get addon changelog, ${err.body?.message ||
err}`;
}
}
private async _installClicked(): Promise<void> {
this._error = undefined;
this._installing = true;
try {
await installHassioAddon(this.hass, this.addon.slug);
const eventdata = {
success: true,
response: undefined,
path: "install",
};
fireEvent(this, "hass-api-called", eventdata);
} catch (err) {
this._error = `Failed to install addon, ${err.body?.message || err}`;
}
this._installing = false;
}
private async _uninstallClicked(): Promise<void> {
if (!confirm("Are you sure you want to uninstall this add-on?")) {
return;
}
this._error = undefined;
try {
await uninstallHassioAddon(this.hass, this.addon.slug);
const eventdata = {
success: true,
response: undefined,
path: "uninstall",
};
fireEvent(this, "hass-api-called", eventdata);
} catch (err) {
this._error = `Failed to uninstall addon, ${err.body?.message || err}`;
}
}
}
declare global {
interface HTMLElementTagNameMap {
"hassio-addon-info": HassioAddonInfo;
}
}

View File

@@ -1,66 +0,0 @@
import "@material/mwc-button";
import "@polymer/paper-card/paper-card";
import { html } from "@polymer/polymer/lib/utils/html-tag";
import { PolymerElement } from "@polymer/polymer/polymer-element";
import { ANSI_HTML_STYLE, parseTextToColoredPre } from "../ansi-to-html";
import "../../../src/resources/ha-style";
class HassioAddonLogs extends PolymerElement {
static get template() {
return html`
<style include="ha-style">
:host,
paper-card {
display: block;
}
pre {
overflow-x: auto;
white-space: pre-wrap;
overflow-wrap: break-word;
}
</style>
${ANSI_HTML_STYLE}
<paper-card heading="Log">
<div class="card-content" id="content"></div>
<div class="card-actions">
<mwc-button on-click="refresh">Refresh</mwc-button>
</div>
</paper-card>
`;
}
static get properties() {
return {
hass: Object,
addonSlug: {
type: String,
observer: "addonSlugChanged",
},
};
}
addonSlugChanged(slug) {
if (!this.hass) {
setTimeout(() => {
this.addonChanged(slug);
}, 0);
return;
}
this.refresh();
}
refresh() {
this.hass
.callApi("get", `hassio/addons/${this.addonSlug}/logs`)
.then((text) => {
while (this.$.content.lastChild) {
this.$.content.removeChild(this.$.content.lastChild);
}
this.$.content.appendChild(parseTextToColoredPre(text));
});
}
}
customElements.define("hassio-addon-logs", HassioAddonLogs);

View File

@@ -0,0 +1,95 @@
import "@material/mwc-button";
import "@polymer/paper-card/paper-card";
import {
css,
CSSResult,
customElement,
html,
LitElement,
property,
TemplateResult,
query,
} from "lit-element";
import { HomeAssistant } from "../../../src/types";
import {
HassioAddonDetails,
fetchHassioAddonLogs,
} from "../../../src/data/hassio/addon";
import { ANSI_HTML_STYLE, parseTextToColoredPre } from "../ansi-to-html";
import { hassioStyle } from "../resources/hassio-style";
import { haStyle } from "../../../src/resources/styles";
@customElement("hassio-addon-logs")
class HassioAddonLogs extends LitElement {
@property() public hass!: HomeAssistant;
@property() public addon!: HassioAddonDetails;
@property() private _error?: string;
@query("#content") private _logContent!: any;
public async connectedCallback(): Promise<void> {
super.connectedCallback();
await this._loadData();
}
protected render(): TemplateResult {
return html`
<paper-card heading="Log">
${this._error
? html`
<div class="errors">${this._error}</div>
`
: ""}
<div class="card-content" id="content"></div>
<div class="card-actions">
<mwc-button @click=${this._refresh}>Refresh</mwc-button>
</div>
</paper-card>
`;
}
static get styles(): CSSResult[] {
return [
haStyle,
hassioStyle,
ANSI_HTML_STYLE,
css`
:host,
paper-card {
display: block;
}
pre {
overflow-x: auto;
white-space: pre-wrap;
overflow-wrap: break-word;
}
.errors {
color: var(--google-red-500);
margin-bottom: 16px;
}
`,
];
}
private async _loadData(): Promise<void> {
this._error = undefined;
try {
const content = await fetchHassioAddonLogs(this.hass, this.addon.slug);
while (this._logContent.lastChild) {
this._logContent.removeChild(this._logContent.lastChild as Node);
}
this._logContent.appendChild(parseTextToColoredPre(content));
} catch (err) {
this._error = `Failed to get addon logs, ${err.body?.message || err}`;
}
}
private async _refresh(): Promise<void> {
await this._loadData();
}
}
declare global {
interface HTMLElementTagNameMap {
"hassio-addon-logs": HassioAddonLogs;
}
}

View File

@@ -1,129 +0,0 @@
import "@polymer/paper-card/paper-card";
import "@polymer/paper-input/paper-input";
import { html } from "@polymer/polymer/lib/utils/html-tag";
import { PolymerElement } from "@polymer/polymer/polymer-element";
import "../../../src/components/buttons/ha-call-api-button";
import "../../../src/resources/ha-style";
import { EventsMixin } from "../../../src/mixins/events-mixin";
class HassioAddonNetwork extends EventsMixin(PolymerElement) {
static get template() {
return html`
<style include="ha-style">
:host {
display: block;
}
paper-card {
display: block;
}
.errors {
color: var(--google-red-500);
margin-bottom: 16px;
}
.card-actions {
@apply --layout;
@apply --layout-justified;
}
</style>
<paper-card heading="Network">
<div class="card-content">
<template is="dom-if" if="[[error]]">
<div class="errors">[[error]]</div>
</template>
<table>
<tbody>
<tr>
<th>Container</th>
<th>Host</th>
<th>Description</th>
</tr>
<template is="dom-repeat" items="[[config]]">
<tr>
<td>[[item.container]]</td>
<td>
<paper-input
placeholder="disabled"
value="{{item.host}}"
no-label-float=""
></paper-input>
</td>
<td>[[item.description]]</td>
</tr>
</template>
</tbody>
</table>
</div>
<div class="card-actions">
<ha-call-api-button
class="warning"
hass="[[hass]]"
path="hassio/addons/[[addonSlug]]/options"
data="[[resetData]]"
>Reset to defaults</ha-call-api-button
>
<mwc-button on-click="saveTapped">Save</mwc-button>
</div>
</paper-card>
`;
}
static get properties() {
return {
hass: Object,
addonSlug: String,
config: Object,
addon: {
type: Object,
observer: "addonChanged",
},
error: String,
resetData: {
type: Object,
value: {
network: null,
},
},
};
}
addonChanged(addon) {
if (!addon) return;
const network = addon.network || {};
const description = addon.network_description || {};
const items = Object.keys(network).map((key) => ({
container: key,
host: network[key],
description: description[key],
}));
this.config = items.sort(function(el1, el2) {
return el1.host - el2.host;
});
}
saveTapped() {
this.error = null;
const data = {};
this.config.forEach(function(item) {
data[item.container] = parseInt(item.host);
});
const path = `hassio/addons/${this.addonSlug}/options`;
this.hass
.callApi("post", path, {
network: data,
})
.then(
() => {
this.fire("hass-api-called", { success: true, path: path });
},
(resp) => {
this.error = resp.body.message;
}
);
}
}
customElements.define("hassio-addon-network", HassioAddonNetwork);

View File

@@ -0,0 +1,202 @@
import "@polymer/paper-card/paper-card";
import {
css,
CSSResult,
customElement,
html,
LitElement,
property,
PropertyValues,
TemplateResult,
} from "lit-element";
import { PaperInputElement } from "@polymer/paper-input/paper-input";
import { HomeAssistant } from "../../../src/types";
import {
HassioAddonDetails,
HassioAddonSetOptionParams,
setHassioAddonOption,
} from "../../../src/data/hassio/addon";
import { hassioStyle } from "../resources/hassio-style";
import { haStyle } from "../../../src/resources/styles";
import { fireEvent } from "../../../src/common/dom/fire_event";
interface NetworkItem {
description: string;
container: string;
host: number | null;
}
interface NetworkItemInput extends PaperInputElement {
container: string;
}
@customElement("hassio-addon-network")
class HassioAddonNetwork extends LitElement {
@property() public hass!: HomeAssistant;
@property() public addon!: HassioAddonDetails;
@property() private _error?: string;
@property() private _config?: NetworkItem[];
public connectedCallback(): void {
super.connectedCallback();
this._setNetworkConfig();
}
protected render(): TemplateResult {
if (!this._config) {
return html``;
}
return html`
<paper-card heading="Network">
<div class="card-content">
${this._error
? html`
<div class="errors">${this._error}</div>
`
: ""}
<table>
<tbody>
<tr>
<th>Container</th>
<th>Host</th>
<th>Description</th>
</tr>
${this._config!.map((item) => {
return html`
<tr>
<td>${item.container}</td>
<td>
<paper-input
@value-changed=${this._configChanged}
placeholder="disabled"
.value=${item.host}
.container=${item.container}
no-label-float
></paper-input>
</td>
<td>${item.description}</td>
</tr>
`;
})}
</tbody>
</table>
</div>
<div class="card-actions">
<mwc-button class="warning" @click=${this._resetTapped}>
Reset to defaults
</mwc-button>
<mwc-button @click=${this._saveTapped}>Save</mwc-button>
</div>
</paper-card>
`;
}
static get styles(): CSSResult[] {
return [
haStyle,
hassioStyle,
css`
:host {
display: block;
}
paper-card {
display: block;
}
.errors {
color: var(--google-red-500);
margin-bottom: 16px;
}
.card-actions {
display: flex;
justify-content: space-between;
}
`,
];
}
protected update(changedProperties: PropertyValues): void {
super.update(changedProperties);
if (changedProperties.has("addon")) {
this._setNetworkConfig();
}
}
private _setNetworkConfig(): void {
const network = this.addon.network || {};
const description = this.addon.network_description || {};
const items: NetworkItem[] = Object.keys(network).map((key) => {
return {
container: key,
host: network[key],
description: description[key],
};
});
this._config = items.sort((a, b) => (a.container > b.container ? 1 : -1));
}
private async _configChanged(ev: Event): Promise<void> {
const target = ev.target as NetworkItemInput;
this._config!.forEach((item) => {
if (
item.container === target.container &&
item.host !== parseInt(String(target.value), 10)
) {
item.host = target.value ? parseInt(String(target.value), 10) : null;
}
});
}
private async _resetTapped(): Promise<void> {
const data: HassioAddonSetOptionParams = {
network: null,
};
try {
await setHassioAddonOption(this.hass, this.addon.slug, data);
const eventdata = {
success: true,
response: undefined,
path: "option",
};
fireEvent(this, "hass-api-called", eventdata);
} catch (err) {
this._error = `Failed to set addon network configuration, ${err.body
?.message || err}`;
}
}
private async _saveTapped(): Promise<void> {
this._error = undefined;
const networkconfiguration = {};
this._config!.forEach((item) => {
networkconfiguration[item.container] = parseInt(String(item.host), 10);
});
const data: HassioAddonSetOptionParams = {
network: networkconfiguration,
};
try {
await setHassioAddonOption(this.hass, this.addon.slug, data);
const eventdata = {
success: true,
response: undefined,
path: "option",
};
fireEvent(this, "hass-api-called", eventdata);
} catch (err) {
this._error = `Failed to set addon network configuration, ${err.body
?.message || err}`;
}
}
}
declare global {
interface HTMLElementTagNameMap {
"hassio-addon-network": HassioAddonNetwork;
}
}

View File

@@ -1,139 +0,0 @@
import "@polymer/app-layout/app-header-layout/app-header-layout";
import "@polymer/app-layout/app-header/app-header";
import "@polymer/app-layout/app-toolbar/app-toolbar";
import "@polymer/paper-icon-button/paper-icon-button";
import { html } from "@polymer/polymer/lib/utils/html-tag";
import { PolymerElement } from "@polymer/polymer/polymer-element";
import "./hassio-addon-audio";
import "./hassio-addon-config";
import "./hassio-addon-info";
import "./hassio-addon-logs";
import "./hassio-addon-network";
class HassioAddonView extends PolymerElement {
static get template() {
return html`
<style>
:host {
color: var(--primary-text-color);
--paper-card-header-color: var(--primary-text-color);
}
.content {
padding: 24px 0 32px;
display: flex;
flex-direction: column;
align-items: center;
}
hassio-addon-info,
hassio-addon-network,
hassio-addon-audio,
hassio-addon-config {
margin-bottom: 24px;
width: 600px;
}
hassio-addon-logs {
max-width: calc(100% - 8px);
min-width: 600px;
}
@media only screen and (max-width: 600px) {
hassio-addon-info,
hassio-addon-network,
hassio-addon-audio,
hassio-addon-config,
hassio-addon-logs {
max-width: 100%;
min-width: 100%;
}
}
</style>
<hass-subpage header="Hass.io: add-on details" hassio>
<div class="content">
<hassio-addon-info
hass="[[hass]]"
addon="[[addon]]"
addon-slug="[[addonSlug]]"
></hassio-addon-info>
<template is="dom-if" if="[[addon.version]]">
<hassio-addon-config
hass="[[hass]]"
addon="[[addon]]"
addon-slug="[[addonSlug]]"
></hassio-addon-config>
<template is="dom-if" if="[[addon.audio]]">
<hassio-addon-audio
hass="[[hass]]"
addon="[[addon]]"
></hassio-addon-audio>
</template>
<template is="dom-if" if="[[addon.network]]">
<hassio-addon-network
hass="[[hass]]"
addon="[[addon]]"
addon-slug="[[addonSlug]]"
></hassio-addon-network>
</template>
<hassio-addon-logs
hass="[[hass]]"
addon-slug="[[addonSlug]]"
></hassio-addon-logs>
</template>
</div>
</hass-subpage>
`;
}
static get properties() {
return {
hass: Object,
route: {
type: Object,
observer: "routeDataChanged",
},
addonSlug: {
type: String,
computed: "_computeSlug(route)",
},
addon: Object,
};
}
ready() {
super.ready();
this.addEventListener("hass-api-called", (ev) => this.apiCalled(ev));
}
apiCalled(ev) {
const path = ev.detail.path;
if (!path) return;
if (path.substr(path.lastIndexOf("/") + 1) === "uninstall") {
history.back();
} else {
this.routeDataChanged(this.route);
}
}
routeDataChanged(routeData) {
const addon = routeData.path.substr(1);
this.hass.callApi("get", `hassio/addons/${addon}/info`).then(
(info) => {
this.addon = info.data;
},
() => {
this.addon = null;
}
);
}
_computeSlug(route) {
return route.path.substr(1);
}
}
customElements.define("hassio-addon-view", HassioAddonView);

View File

@@ -0,0 +1,159 @@
import "@polymer/app-layout/app-header-layout/app-header-layout";
import "@polymer/app-layout/app-header/app-header";
import "@polymer/app-layout/app-toolbar/app-toolbar";
import "@polymer/paper-icon-button/paper-icon-button";
import "@polymer/paper-spinner/paper-spinner-lite";
import {
css,
CSSResult,
customElement,
html,
LitElement,
property,
TemplateResult,
} from "lit-element";
import { HomeAssistant, Route } from "../../../src/types";
import {
HassioAddonDetails,
fetchHassioAddonInfo,
} from "../../../src/data/hassio/addon";
import { hassioStyle } from "../resources/hassio-style";
import { haStyle } from "../../../src/resources/styles";
import "./hassio-addon-audio";
import "./hassio-addon-config";
import "./hassio-addon-info";
import "./hassio-addon-logs";
import "./hassio-addon-network";
@customElement("hassio-addon-view")
class HassioAddonView extends LitElement {
@property() public hass!: HomeAssistant;
@property() public route!: Route;
@property() public addon?: HassioAddonDetails;
protected render(): TemplateResult {
if (!this.addon) {
return html`
<paper-spinner-lite active></paper-spinner-lite>
`;
}
return html`
<hass-subpage header="Hass.io: add-on details" hassio>
<div class="content">
<hassio-addon-info
.hass=${this.hass}
.addon=${this.addon}
></hassio-addon-info>
${this.addon && this.addon.version
? html`
<hassio-addon-config
.hass=${this.hass}
.addon=${this.addon}
></hassio-addon-config>
${this.addon.audio
? html`
<hassio-addon-audio
.hass=${this.hass}
.addon=${this.addon}
></hassio-addon-audio>
`
: ""}
${this.addon.network
? html`
<hassio-addon-network
.hass=${this.hass}
.addon=${this.addon}
></hassio-addon-network>
`
: ""}
<hassio-addon-logs
.hass=${this.hass}
.addon=${this.addon}
></hassio-addon-logs>
`
: ""}
</div>
</hass-subpage>
`;
}
static get styles(): CSSResult[] {
return [
haStyle,
hassioStyle,
css`
:host {
color: var(--primary-text-color);
--paper-card-header-color: var(--primary-text-color);
}
.content {
padding: 24px 0 32px;
display: flex;
flex-direction: column;
align-items: center;
}
hassio-addon-info,
hassio-addon-network,
hassio-addon-audio,
hassio-addon-config {
margin-bottom: 24px;
width: 600px;
}
hassio-addon-logs {
max-width: calc(100% - 8px);
min-width: 600px;
}
@media only screen and (max-width: 600px) {
hassio-addon-info,
hassio-addon-network,
hassio-addon-audio,
hassio-addon-config,
hassio-addon-logs {
max-width: 100%;
min-width: 100%;
}
}
`,
];
}
protected async firstUpdated(): Promise<void> {
await this._routeDataChanged(this.route);
this.addEventListener("hass-api-called", (ev) => this._apiCalled(ev));
}
private async _apiCalled(ev): Promise<void> {
const path: string = ev.detail.path;
if (!path) {
return;
}
if (path === "uninstall") {
history.back();
} else {
await this._routeDataChanged(this.route);
}
}
private async _routeDataChanged(routeData: Route): Promise<void> {
const addon = routeData.path.substr(1);
try {
const addoninfo = await fetchHassioAddonInfo(this.hass, addon);
this.addon = addoninfo;
} catch {
this.addon = undefined;
}
}
}
declare global {
interface HTMLElementTagNameMap {
"hassio-addon-view": HassioAddonView;
}
}

View File

@@ -1,68 +1,75 @@
import { html } from "@polymer/polymer/lib/utils/html-tag";
import { css } from "lit-element";
export const ANSI_HTML_STYLE = html`
<style>
.bold {
font-weight: bold;
}
.italic {
font-style: italic;
}
.underline {
text-decoration: underline;
}
.strikethrough {
text-decoration: line-through;
}
.underline.strikethrough {
text-decoration: underline line-through;
}
.fg-red {
color: rgb(222, 56, 43);
}
.fg-green {
color: rgb(57, 181, 74);
}
.fg-yellow {
color: rgb(255, 199, 6);
}
.fg-blue {
color: rgb(0, 111, 184);
}
.fg-magenta {
color: rgb(118, 38, 113);
}
.fg-cyan {
color: rgb(44, 181, 233);
}
.fg-white {
color: rgb(204, 204, 204);
}
.bg-black {
background-color: rgb(0, 0, 0);
}
.bg-red {
background-color: rgb(222, 56, 43);
}
.bg-green {
background-color: rgb(57, 181, 74);
}
.bg-yellow {
background-color: rgb(255, 199, 6);
}
.bg-blue {
background-color: rgb(0, 111, 184);
}
.bg-magenta {
background-color: rgb(118, 38, 113);
}
.bg-cyan {
background-color: rgb(44, 181, 233);
}
.bg-white {
background-color: rgb(204, 204, 204);
}
</style>
interface State {
bold: boolean;
italic: boolean;
underline: boolean;
strikethrough: boolean;
foregroundColor: null | string;
backgroundColor: null | string;
}
export const ANSI_HTML_STYLE = css`
.bold {
font-weight: bold;
}
.italic {
font-style: italic;
}
.underline {
text-decoration: underline;
}
.strikethrough {
text-decoration: line-through;
}
.underline.strikethrough {
text-decoration: underline line-through;
}
.fg-red {
color: rgb(222, 56, 43);
}
.fg-green {
color: rgb(57, 181, 74);
}
.fg-yellow {
color: rgb(255, 199, 6);
}
.fg-blue {
color: rgb(0, 111, 184);
}
.fg-magenta {
color: rgb(118, 38, 113);
}
.fg-cyan {
color: rgb(44, 181, 233);
}
.fg-white {
color: rgb(204, 204, 204);
}
.bg-black {
background-color: rgb(0, 0, 0);
}
.bg-red {
background-color: rgb(222, 56, 43);
}
.bg-green {
background-color: rgb(57, 181, 74);
}
.bg-yellow {
background-color: rgb(255, 199, 6);
}
.bg-blue {
background-color: rgb(0, 111, 184);
}
.bg-magenta {
background-color: rgb(118, 38, 113);
}
.bg-cyan {
background-color: rgb(44, 181, 233);
}
.bg-white {
background-color: rgb(204, 204, 204);
}
`;
export function parseTextToColoredPre(text) {
@@ -70,7 +77,7 @@ export function parseTextToColoredPre(text) {
const re = /\033(?:\[(.*?)[@-~]|\].*?(?:\007|\033\\))/g;
let i = 0;
const state = {
const state: State = {
bold: false,
italic: false,
underline: false,
@@ -81,29 +88,42 @@ export function parseTextToColoredPre(text) {
const addSpan = (content) => {
const span = document.createElement("span");
if (state.bold) span.classList.add("bold");
if (state.italic) span.classList.add("italic");
if (state.underline) span.classList.add("underline");
if (state.strikethrough) span.classList.add("strikethrough");
if (state.foregroundColor !== null)
if (state.bold) {
span.classList.add("bold");
}
if (state.italic) {
span.classList.add("italic");
}
if (state.underline) {
span.classList.add("underline");
}
if (state.strikethrough) {
span.classList.add("strikethrough");
}
if (state.foregroundColor !== null) {
span.classList.add(`fg-${state.foregroundColor}`);
if (state.backgroundColor !== null)
}
if (state.backgroundColor !== null) {
span.classList.add(`bg-${state.backgroundColor}`);
}
span.appendChild(document.createTextNode(content));
pre.appendChild(span);
};
/* eslint-disable no-cond-assign */
let match;
// tslint:disable-next-line
while ((match = re.exec(text)) !== null) {
const j = match.index;
const j = match!.index;
addSpan(text.substring(i, j));
i = j + match[0].length;
if (match[1] === undefined) continue;
if (match[1] === undefined) {
continue;
}
match[1].split(";").forEach((colorCode) => {
switch (parseInt(colorCode)) {
match[1].split(";").forEach((colorCode: string) => {
switch (parseInt(colorCode, 10)) {
case 0:
// reset
state.bold = false;

View File

@@ -17,21 +17,40 @@ class HassioCardContent extends LitElement {
@property() public hass!: HomeAssistant;
@property() public title!: string;
@property() public description?: string;
@property({ type: Boolean }) public available?: boolean;
@property({ type: Boolean }) public available: boolean = true;
@property({ type: Boolean }) public showTopbar: boolean = false;
@property() public topbarClass?: string;
@property() public datetime?: string;
@property() public iconTitle?: string;
@property() public iconClass?: string;
@property() public icon = "hass:help-circle";
@property() public iconImage?: string;
protected render(): TemplateResult | void {
protected render(): TemplateResult {
return html`
<iron-icon
class=${this.iconClass}
.icon=${this.icon}
.title=${this.iconTitle}
></iron-icon>
${this.showTopbar
? html`
<div class="topbar ${this.topbarClass}"></div>
`
: ""}
${this.iconImage
? html`
<div class="icon_image ${this.iconClass}">
<img src="${this.iconImage}" title="${this.iconTitle}" />
<div></div>
</div>
`
: html`
<iron-icon
class=${this.iconClass}
.icon=${this.icon}
.title=${this.iconTitle}
></iron-icon>
`}
<div>
<div class="title">${this.title}</div>
<div class="title">
${this.title}
</div>
<div class="addition">
${this.description}
${/* treat as available when undefined */
@@ -53,8 +72,9 @@ class HassioCardContent extends LitElement {
static get styles(): CSSResult {
return css`
iron-icon {
margin-right: 16px;
margin-top: 16px;
margin-right: 24px;
margin-left: 8px;
margin-top: 12px;
float: left;
color: var(--secondary-text-color);
}
@@ -88,6 +108,44 @@ class HassioCardContent extends LitElement {
ha-relative-time {
display: block;
}
.icon_image img {
max-height: 40px;
max-width: 40px;
margin-top: 4px;
margin-right: 16px;
float: left;
}
.icon_image.stopped,
.icon_image.not_available {
filter: grayscale(1);
}
.dot {
position: absolute;
background-color: var(--paper-orange-400);
width: 12px;
height: 12px;
top: 8px;
right: 8px;
border-radius: 50%;
}
.topbar {
position: absolute;
width: 100%;
height: 2px;
top: 0;
left: 0;
border-top-left-radius: 2px;
border-top-right-radius: 2px;
}
.topbar.installed {
background-color: var(--primary-color);
}
.topbar.update {
background-color: var(--accent-color);
}
.topbar.unavailable {
background-color: var(--error-color);
}
`;
}
}

View File

@@ -1,4 +1,4 @@
import { HassioAddonInfo } from "../../../src/data/hassio";
import { HassioAddonInfo } from "../../../src/data/hassio/addon";
import * as Fuse from "fuse.js";
export function filterAndSort(addons: HassioAddonInfo[], filter: string) {

View File

@@ -16,7 +16,7 @@ import "@material/mwc-button";
class HassioSearchInput extends LitElement {
@property() private filter?: string;
protected render(): TemplateResult | void {
protected render(): TemplateResult {
return html`
<div class="search-container">
<paper-input

View File

@@ -1,92 +0,0 @@
import "@polymer/paper-card/paper-card";
import { html } from "@polymer/polymer/lib/utils/html-tag";
import { PolymerElement } from "@polymer/polymer/polymer-element";
import "../components/hassio-card-content";
import "../resources/hassio-style";
import NavigateMixin from "../../../src/mixins/navigate-mixin";
class HassioAddons extends NavigateMixin(PolymerElement) {
static get template() {
return html`
<style include="ha-style hassio-style">
paper-card {
cursor: pointer;
}
</style>
<div class="content card-group">
<div class="title">Add-ons</div>
<template is="dom-if" if="[[!addons.length]]">
<paper-card>
<div class="card-content">
You don't have any add-ons installed yet. Head over to
<a href="#" on-click="openStore">the add-on store</a> to get
started!
</div>
</paper-card>
</template>
<template
is="dom-repeat"
items="[[addons]]"
as="addon"
sort="sortAddons"
>
<paper-card on-click="addonTapped">
<div class="card-content">
<hassio-card-content
hass="[[hass]]"
title="[[addon.name]]"
description="[[addon.description]]"
available="[[addon.available]]"
icon="[[computeIcon(addon)]]"
icon-title="[[computeIconTitle(addon)]]"
icon-class="[[computeIconClass(addon)]]"
></hassio-card-content>
</div>
</paper-card>
</template>
</div>
`;
}
static get properties() {
return {
hass: Object,
addons: Array,
};
}
sortAddons(a, b) {
return a.name < b.name ? -1 : 1;
}
computeIcon(addon) {
return addon.installed !== addon.version
? "hassio:arrow-up-bold-circle"
: "hassio:puzzle";
}
computeIconTitle(addon) {
if (addon.installed !== addon.version) return "New version available";
return addon.state === "started"
? "Add-on is running"
: "Add-on is stopped";
}
computeIconClass(addon) {
if (addon.installed !== addon.version) return "update";
return addon.state === "started" ? "running" : "";
}
addonTapped(ev) {
this.navigate("/hassio/addon/" + ev.model.addon.slug);
ev.target.blur();
}
openStore(ev) {
this.navigate("/hassio/store");
ev.target.blur();
}
}
customElements.define("hassio-addons", HassioAddons);

View File

@@ -0,0 +1,111 @@
import "@polymer/paper-card/paper-card";
import {
css,
CSSResult,
customElement,
html,
LitElement,
property,
TemplateResult,
} from "lit-element";
import { HomeAssistant } from "../../../src/types";
import { HassioAddonInfo } from "../../../src/data/hassio/addon";
import { navigate } from "../../../src/common/navigate";
import { hassioStyle } from "../resources/hassio-style";
import { haStyle } from "../../../src/resources/styles";
import "../components/hassio-card-content";
import { atLeastVersion } from "../../../src/common/config/version";
@customElement("hassio-addons")
class HassioAddons extends LitElement {
@property() public hass!: HomeAssistant;
@property() public addons?: HassioAddonInfo[];
protected render(): TemplateResult {
return html`
<div class="content">
<h1>Add-ons</h1>
<div class="card-group">
${!this.addons
? html`
<paper-card>
<div class="card-content">
You don't have any add-ons installed yet. Head over to
<a href="#" @click=${this._openStore}>the add-on store</a>
to get started!
</div>
</paper-card>
`
: this.addons
.sort((a, b) => (a.name > b.name ? 1 : -1))
.map(
(addon) => html`
<paper-card .addon=${addon} @click=${this._addonTapped}>
<div class="card-content">
<hassio-card-content
.hass=${this.hass}
.title=${addon.name}
.description=${addon.description}
available
.showTopbar=${addon.installed !== addon.version}
topbarClass="update"
.icon=${addon.installed !== addon.version
? "hassio:arrow-up-bold-circle"
: "hassio:puzzle"}
.iconTitle=${addon.state !== "started"
? "Add-on is stopped"
: addon.installed !== addon.version
? "New version available"
: "Add-on is running"}
.iconClass=${addon.installed &&
addon.installed !== addon.version
? addon.state === "started"
? "update"
: "update stopped"
: addon.installed && addon.state === "started"
? "running"
: "stopped"}
.iconImage=${atLeastVersion(
this.hass.connection.haVersion,
0,
105
) && addon.icon
? `/api/hassio/addons/${addon.slug}/icon`
: undefined}
></hassio-card-content>
</div>
</paper-card>
`
)}
</div>
</div>
`;
}
static get styles(): CSSResult[] {
return [
haStyle,
hassioStyle,
css`
paper-card {
cursor: pointer;
}
`,
];
}
private _addonTapped(ev: any): void {
navigate(this, `/hassio/addon/${ev.currentTarget.addon.slug}`);
}
private _openStore(): void {
navigate(this, "/hassio/store");
}
}
declare global {
interface HTMLElementTagNameMap {
"hassio-addons": HassioAddons;
}
}

View File

@@ -9,22 +9,22 @@ import {
} from "lit-element";
import "./hassio-addons";
import "./hassio-update";
import { haStyle } from "../../../src/resources/styles";
import { HomeAssistant } from "../../../src/types";
import { HassioHassOSInfo } from "../../../src/data/hassio/host";
import {
HassioSupervisorInfo,
HassioHomeAssistantInfo,
HassioHassOSInfo,
} from "../../../src/data/hassio";
} from "../../../src/data/hassio/supervisor";
@customElement("hassio-dashboard")
class HassioDashboard extends LitElement {
@property() public hass!: HomeAssistant;
@property() public supervisorInfo!: HassioSupervisorInfo;
@property() public hassInfo!: HassioHomeAssistantInfo;
@property() public hassOsInfo!: HassioHassOSInfo;
protected render(): TemplateResult | void {
protected render(): TemplateResult {
return html`
<div class="content">
<hassio-update
@@ -41,12 +41,15 @@ class HassioDashboard extends LitElement {
`;
}
static get styles(): CSSResult {
return css`
.content {
margin: 0 auto;
}
`;
static get styles(): CSSResult[] {
return [
haStyle,
css`
.content {
margin: 0 auto;
}
`,
];
}
}

View File

@@ -10,13 +10,14 @@ import {
import "@polymer/iron-icon/iron-icon";
import { HomeAssistant } from "../../../src/types";
import { HassioHassOSInfo } from "../../../src/data/hassio/host";
import {
HassioHomeAssistantInfo,
HassioHassOSInfo,
HassioSupervisorInfo,
} from "../../../src/data/hassio";
} from "../../../src/data/hassio/supervisor";
import { hassioStyle } from "../resources/hassio-style";
import { haStyle } from "../../../src/resources/styles";
import "@material/mwc-button";
import "@polymer/paper-card/paper-card";
@@ -26,20 +27,25 @@ import "../components/hassio-card-content";
@customElement("hassio-update")
export class HassioUpdate extends LitElement {
@property() public hass!: HomeAssistant;
@property() public hassInfo: HassioHomeAssistantInfo;
@property() public hassOsInfo?: HassioHassOSInfo;
@property() public supervisorInfo: HassioSupervisorInfo;
@property() private _error?: string;
@property() public error?: string;
protected render(): TemplateResult | void {
protected render(): TemplateResult {
const updatesAvailable: number = [
this.hassInfo,
this.supervisorInfo,
this.hassOsInfo,
].filter((value) => {
return !!value && value.version !== value.last_version;
return (
!!value &&
(value.last_version
? value.version !== value.last_version
: value.version_latest
? value.version !== value.version_latest
: false)
);
}).length;
if (!updatesAvailable) {
@@ -48,19 +54,19 @@ export class HassioUpdate extends LitElement {
return html`
<div class="content">
${this.error
${this._error
? html`
<div class="error">Error: ${this.error}</div>
<div class="error">Error: ${this._error}</div>
`
: ""}
<h1>
${updatesAvailable > 1
? "Updates Available 🎉"
: "Update Available 🎉"}
</h1>
<div class="card-group">
<div class="title">
${updatesAvailable > 1
? "Updates Available 🎉"
: "Update Available 🎉"}
</div>
${this._renderUpdateCard(
"Home Assistant",
"Home Assistant Core",
this.hassInfo.version,
this.hassInfo.last_version,
"hassio/homeassistant/update",
@@ -70,23 +76,19 @@ export class HassioUpdate extends LitElement {
"hassio:home-assistant"
)}
${this._renderUpdateCard(
"Hass.io Supervisor",
"Supervisor",
this.supervisorInfo.version,
this.supervisorInfo.last_version,
"hassio/supervisor/update",
`https://github.com//home-assistant/hassio/releases/tag/${
this.supervisorInfo.last_version
}`
`https://github.com//home-assistant/hassio/releases/tag/${this.supervisorInfo.last_version}`
)}
${this.hassOsInfo
? this._renderUpdateCard(
"HassOS",
"Operating System",
this.hassOsInfo.version,
this.hassOsInfo.version_latest,
"hassio/hassos/update",
`https://github.com//home-assistant/hassos/releases/tag/${
this.hassOsInfo.version_latest
}`
`https://github.com//home-assistant/hassos/releases/tag/${this.hassOsInfo.version_latest}`
)
: ""}
</div>
@@ -102,7 +104,7 @@ export class HassioUpdate extends LitElement {
releaseNotesUrl: string,
icon?: string
): TemplateResult {
if (lastVersion === curVersion) {
if (!lastVersion || lastVersion === curVersion) {
return html``;
}
return html`
@@ -121,7 +123,7 @@ export class HassioUpdate extends LitElement {
</div>
</div>
<div class="card-actions">
<a href="${releaseNotesUrl}" target="_blank">
<a href="${releaseNotesUrl}" target="_blank" rel="noreferrer">
<mwc-button>Release notes</mwc-button>
</a>
<ha-call-api-button
@@ -138,28 +140,22 @@ export class HassioUpdate extends LitElement {
private _apiCalled(ev) {
if (ev.detail.success) {
this.error = "";
this._error = "";
return;
}
const response = ev.detail.response;
typeof response.body === "object"
? (this.error = response.body.message || "Unknown error")
: (this.error = response.body);
? (this._error = response.body.message || "Unknown error")
: (this._error = response.body);
}
static get styles(): CSSResult[] {
return [
haStyle,
hassioStyle,
css`
:host {
width: 33%;
}
paper-card {
display: inline-block;
margin-bottom: 32px;
}
.icon {
--iron-icon-height: 48px;
--iron-icon-width: 48px;
@@ -174,6 +170,10 @@ export class HassioUpdate extends LitElement {
.warning {
color: var(--secondary-text-color);
}
.card-content {
height: calc(100% - 47px);
box-sizing: border-box;
}
.card-actions {
text-align: right;
}

View File

@@ -1,20 +1,59 @@
import "@polymer/app-layout/app-toolbar/app-toolbar";
import "@polymer/paper-dialog-scrollable/paper-dialog-scrollable";
import "@polymer/paper-icon-button/paper-icon-button";
import { html } from "@polymer/polymer/lib/utils/html-tag";
import { PolymerElement } from "@polymer/polymer/polymer-element";
import "../../../../src/components/ha-markdown";
import "../../../../src/resources/ha-style";
import "../../../../src/components/dialog/ha-paper-dialog";
import { customElement } from "lit-element";
import { PaperDialogElement } from "@polymer/paper-dialog";
import {
css,
CSSResult,
customElement,
html,
LitElement,
property,
TemplateResult,
query,
} from "lit-element";
import { hassioStyle } from "../../resources/hassio-style";
import { haStyleDialog } from "../../../../src/resources/styles";
import { HassioMarkdownDialogParams } from "./show-dialog-hassio-markdown";
import "../../../../src/components/dialog/ha-paper-dialog";
import "../../../../src/components/ha-markdown";
@customElement("dialog-hassio-markdown")
class HassioMarkdownDialog extends PolymerElement {
static get template() {
class HassioMarkdownDialog extends LitElement {
@property() public title!: string;
@property() public content!: string;
@query("#dialog") private _dialog!: PaperDialogElement;
public showDialog(params: HassioMarkdownDialogParams) {
this.title = params.title;
this.content = params.content;
this._dialog.open();
}
protected render(): TemplateResult {
return html`
<style include="ha-style-dialog">
<ha-paper-dialog id="dialog" with-backdrop="">
<app-toolbar>
<paper-icon-button
icon="hassio:close"
dialog-dismiss=""
></paper-icon-button>
<div main-title="">${this.title}</div>
</app-toolbar>
<paper-dialog-scrollable>
<ha-markdown .content=${this.content || ""}></ha-markdown>
</paper-dialog-scrollable>
</ha-paper-dialog>
`;
}
static get styles(): CSSResult[] {
return [
haStyleDialog,
hassioStyle,
css`
ha-paper-dialog {
min-width: 350px;
font-size: 14px;
@@ -52,32 +91,8 @@ class HassioMarkdownDialog extends PolymerElement {
background-color: var(--primary-color);
}
}
</style>
<ha-paper-dialog id="dialog" with-backdrop="">
<app-toolbar>
<paper-icon-button
icon="hassio:close"
dialog-dismiss=""
></paper-icon-button>
<div main-title="">[[title]]</div>
</app-toolbar>
<paper-dialog-scrollable>
<ha-markdown content="[[content]]"></ha-markdown>
</paper-dialog-scrollable>
</ha-paper-dialog>
`;
}
static get properties() {
return {
title: String,
content: String,
};
}
public showDialog(params) {
this.setProperties(params);
(this.$.dialog as PaperDialogElement).open();
`,
];
}
}

View File

@@ -12,7 +12,9 @@ export const showHassioMarkdownDialog = (
fireEvent(element, "show-dialog", {
dialogTag: "dialog-hassio-markdown",
dialogImport: () =>
import(/* webpackChunkName: "dialog-hassio-markdown" */ "./dialog-hassio-markdown"),
import(
/* webpackChunkName: "dialog-hassio-markdown" */ "./dialog-hassio-markdown"
),
dialogParams,
});
};

View File

@@ -1,20 +1,33 @@
import "@polymer/app-layout/app-toolbar/app-toolbar";
import "@material/mwc-button";
import "@polymer/paper-checkbox/paper-checkbox";
import "@polymer/app-layout/app-toolbar/app-toolbar";
import "@polymer/iron-icon/iron-icon";
import "@polymer/paper-dialog-scrollable/paper-dialog-scrollable";
import "@polymer/paper-icon-button/paper-icon-button";
import "@polymer/iron-icon/iron-icon";
import "@polymer/paper-input/paper-input";
import { html } from "@polymer/polymer/lib/utils/html-tag";
import { PolymerElement } from "@polymer/polymer/polymer-element";
import { getSignedPath } from "../../../../src/data/auth";
import "../../../../src/resources/ha-style";
import "../../../../src/components/dialog/ha-paper-dialog";
import { customElement } from "lit-element";
import { PaperDialogElement } from "@polymer/paper-dialog";
import { PaperCheckboxElement } from "@polymer/paper-checkbox/paper-checkbox";
import {
css,
CSSResult,
customElement,
html,
LitElement,
property,
TemplateResult,
query,
} from "lit-element";
import {
fetchHassioSnapshotInfo,
HassioSnapshotDetail,
} from "../../../../src/data/hassio/snapshot";
import { getSignedPath } from "../../../../src/data/auth";
import { HassioSnapshotDialogParams } from "./show-dialog-hassio-snapshot";
import { fetchHassioSnapshotInfo } from "../../../../src/data/hassio";
import { haStyleDialog } from "../../../../src/resources/styles";
import { HomeAssistant } from "../../../../src/types";
import { PolymerChangedEvent } from "../../../../src/polymer-types";
import "../../../../src/components/dialog/ha-paper-dialog";
const _computeFolders = (folders) => {
const list: Array<{ slug: string; name: string; checked: boolean }> = [];
@@ -46,21 +59,179 @@ const _computeAddons = (addons) => {
}));
};
@customElement("dialog-hassio-snapshot")
class HassioSnapshotDialog extends PolymerElement {
// Commented out because it breaks Polymer! Kept around for when we migrate
// to Lit. Now just putting ts-ignore everywhere because we need this out.
// Sorry future developer.
// public hass!: HomeAssistant;
// protected error?: string;
// private snapshot?: any;
// private dialogParams?: HassioSnapshotDialogParams;
// private restoreHass!: boolean;
// private snapshotPassword!: string;
interface AddonItem {
slug: string;
name: string;
version: string;
checked: boolean | null | undefined;
}
static get template() {
interface FolderItem {
slug: string;
name: string;
checked: boolean | null | undefined;
}
@customElement("dialog-hassio-snapshot")
class HassioSnapshotDialog extends LitElement {
@property() public hass!: HomeAssistant;
@property() private _error?: string;
@property() private snapshot?: HassioSnapshotDetail;
@property() private _folders!: FolderItem[];
@property() private _addons!: AddonItem[];
@property() private _dialogParams?: HassioSnapshotDialogParams;
@property() private _snapshotPassword!: string;
@property() private _restoreHass: boolean | null | undefined = true;
@query("#dialog") private _dialog!: PaperDialogElement;
public async showDialog(params: HassioSnapshotDialogParams) {
this.snapshot = await fetchHassioSnapshotInfo(this.hass, params.slug);
this._folders = _computeFolders(
this.snapshot.folders
).sort((a: FolderItem, b: FolderItem) => (a.name > b.name ? 1 : -1));
this._addons = _computeAddons(
this.snapshot.addons
).sort((a: AddonItem, b: AddonItem) => (a.name > b.name ? 1 : -1));
this._dialogParams = params;
try {
this._dialog.open();
} catch {
await this.showDialog(params);
}
}
protected render(): TemplateResult {
if (!this.snapshot) {
return html``;
}
return html`
<style include="ha-style-dialog">
<ha-paper-dialog
id="dialog"
with-backdrop=""
.on-iron-overlay-closed=${this._dialogClosed}
>
<app-toolbar>
<paper-icon-button
icon="hassio:close"
dialog-dismiss=""
></paper-icon-button>
<div main-title="">${this._computeName}</div>
</app-toolbar>
<div class="details">
${this.snapshot.type === "full"
? "Full snapshot"
: "Partial snapshot"}
(${this._computeSize})<br />
${this._formatDatetime(this.snapshot.date)}
</div>
<div>Home Assistant:</div>
<paper-checkbox
.checked=${this._restoreHass}
@change="${(ev: Event) =>
(this._restoreHass = (ev.target as PaperCheckboxElement).checked)}"
>
Home Assistant ${this.snapshot.homeassistant}
</paper-checkbox>
${this._folders.length
? html`
<div>Folders:</div>
<paper-dialog-scrollable class="no-margin-top">
${this._folders.map((item) => {
return html`
<paper-checkbox
.checked=${item.checked}
@change="${(ev: Event) =>
this._updateFolders(
item,
(ev.target as PaperCheckboxElement).checked
)}"
>
${item.name}
</paper-checkbox>
`;
})}
</paper-dialog-scrollable>
`
: ""}
${this._addons.length
? html`
<div>Add-on:</div>
<paper-dialog-scrollable class="no-margin-top">
${this._addons.map((item) => {
return html`
<paper-checkbox
.checked=${item.checked}
@change="${(ev: Event) =>
this._updateAddons(
item,
(ev.target as PaperCheckboxElement).checked
)}"
>
${item.name}
</paper-checkbox>
`;
})}
</paper-dialog-scrollable>
`
: ""}
${this.snapshot.protected
? html`
<paper-input
autofocus=""
label="Password"
type="password"
@value-changed=${this._passwordInput}
.value=${this._snapshotPassword}
></paper-input>
`
: ""}
${this._error
? html`
<p class="error">Error: ${this._error}</p>
`
: ""}
<div>Actions:</div>
<ul class="buttons">
<li>
<mwc-button @click=${this._downloadClicked}>
<iron-icon icon="hassio:download" class="icon"></iron-icon>
Download Snapshot
</mwc-button>
</li>
<li>
<mwc-button @click=${this._partialRestoreClicked}>
<iron-icon icon="hassio:history" class="icon"> </iron-icon>
Restore Selected
</mwc-button>
</li>
${this.snapshot.type === "full"
? html`
<li>
<mwc-button @click=${this._fullRestoreClicked}>
<iron-icon icon="hassio:history" class="icon"> </iron-icon>
Wipe &amp; restore
</mwc-button>
</li>
`
: ""}
<li>
<mwc-button @click=${this._deleteClicked}>
<iron-icon icon="hassio:delete" class="icon warning"> </iron-icon>
<span class="warning">Delete Snapshot</span>
</mwc-button>
</li>
</ul>
</ha-paper-dialog>
`;
}
static get styles(): CSSResult[] {
return [
haStyleDialog,
css`
ha-paper-dialog {
min-width: 350px;
font-size: 14px;
@@ -112,259 +283,155 @@ class HassioSnapshotDialog extends PolymerElement {
.no-margin-top {
margin-top: 0;
}
</style>
<ha-paper-dialog
id="dialog"
with-backdrop=""
on-iron-overlay-closed="_dialogClosed"
>
<app-toolbar>
<paper-icon-button
icon="hassio:close"
dialog-dismiss=""
></paper-icon-button>
<div main-title="">[[_computeName(snapshot)]]</div>
</app-toolbar>
<div class="details">
[[_computeType(snapshot.type)]] ([[_computeSize(snapshot.size)]])<br />
[[_formatDatetime(snapshot.date)]]
</div>
<div>Home Assistant:</div>
<paper-checkbox checked="{{restoreHass}}">
Home Assistant [[snapshot.homeassistant]]
</paper-checkbox>
<template is="dom-if" if="[[_folders.length]]">
<div>Folders:</div>
<template is="dom-repeat" items="[[_folders]]">
<paper-checkbox checked="{{item.checked}}">
[[item.name]]
</paper-checkbox>
</template>
</template>
<template is="dom-if" if="[[_addons.length]]">
<div>Add-ons:</div>
<paper-dialog-scrollable class="no-margin-top">
<template is="dom-repeat" items="[[_addons]]" sort="_sortAddons">
<paper-checkbox checked="{{item.checked}}">
[[item.name]] <span class="details">([[item.version]])</span>
</paper-checkbox>
</template>
</paper-dialog-scrollable>
</template>
<template is="dom-if" if="[[snapshot.protected]]">
<paper-input
autofocus=""
label="Password"
type="password"
value="{{snapshotPassword}}"
></paper-input>
</template>
<template is="dom-if" if="[[error]]">
<p class="error">Error: [[error]]</p>
</template>
<div>Actions:</div>
<ul class="buttons">
<li>
<mwc-button on-click="_downloadClicked">
<iron-icon icon="hassio:download" class="icon"></iron-icon>
Download Snapshot
</mwc-button>
</li>
<li>
<mwc-button on-click="_partialRestoreClicked">
<iron-icon icon="hassio:history" class="icon"> </iron-icon>
Restore Selected
</mwc-button>
</li>
<template is="dom-if" if="[[_isFullSnapshot(snapshot.type)]]">
<li>
<mwc-button on-click="_fullRestoreClicked">
<iron-icon icon="hassio:history" class="icon"> </iron-icon>
Wipe &amp; restore
</mwc-button>
</li>
</template>
<li>
<mwc-button on-click="_deleteClicked">
<iron-icon icon="hassio:delete" class="icon warning"> </iron-icon>
<span class="warning">Delete Snapshot</span>
</mwc-button>
</li>
</ul>
</ha-paper-dialog>
`;
`,
];
}
static get properties() {
return {
hass: Object,
dialogParams: Object,
snapshot: Object,
_folders: Object,
_addons: Object,
restoreHass: {
type: Boolean,
value: true,
},
snapshotPassword: String,
error: String,
};
}
public async showDialog(params: HassioSnapshotDialogParams) {
// @ts-ignore
const snapshot = await fetchHassioSnapshotInfo(this.hass, params.slug);
this.setProperties({
dialogParams: params,
snapshot,
_folders: _computeFolders(snapshot.folders),
_addons: _computeAddons(snapshot.addons),
private _updateFolders(item: FolderItem, value: boolean | null | undefined) {
this._folders = this._folders.map((folder) => {
if (folder.slug === item.slug) {
folder.checked = value;
}
return folder;
});
(this.$.dialog as PaperDialogElement).open();
}
protected _isFullSnapshot(type) {
return type === "full";
private _updateAddons(item: AddonItem, value: boolean | null | undefined) {
this._addons = this._addons.map((addon) => {
if (addon.slug === item.slug) {
addon.checked = value;
}
return addon;
});
}
protected _partialRestoreClicked() {
private _passwordInput(ev: PolymerChangedEvent<string>) {
this._snapshotPassword = ev.detail.value;
}
private _partialRestoreClicked() {
if (!confirm("Are you sure you want to restore this snapshot?")) {
return;
}
// @ts-ignore
const addons = this._addons
.filter((addon) => addon.checked)
.map((addon) => addon.slug);
// @ts-ignore
const folders = this._folders
.filter((folder) => folder.checked)
.map((folder) => folder.slug);
const data = {
// @ts-ignore
homeassistant: this.restoreHass,
const data: {
homeassistant: boolean | null | undefined;
addons: any;
folders: any;
password?: string;
} = {
homeassistant: this._restoreHass,
addons,
folders,
};
// @ts-ignore
if (this.snapshot.protected) {
// @ts-ignore
data.password = this.snapshotPassword;
if (this.snapshot!.protected) {
data.password = this._snapshotPassword;
}
// @ts-ignore
this.hass
.callApi(
"POST",
// @ts-ignore
`hassio/snapshots/${this.dialogParams!.slug}/restore/partial`,
`hassio/snapshots/${this.snapshot!.slug}/restore/partial`,
data
)
.then(
() => {
alert("Snapshot restored!");
(this.$.dialog as PaperDialogElement).close();
this._dialog.close();
},
(error) => {
// @ts-ignore
this.error = error.body.message;
this._error = error.body.message;
}
);
}
protected _fullRestoreClicked() {
private _fullRestoreClicked() {
if (!confirm("Are you sure you want to restore this snapshot?")) {
return;
}
// @ts-ignore
const data = this.snapshot.protected
? {
password:
// @ts-ignore
this.snapshotPassword,
}
const data = this.snapshot!.protected
? { password: this._snapshotPassword }
: undefined;
// @ts-ignore
this.hass
.callApi(
"POST",
// @ts-ignore
`hassio/snapshots/${this.dialogParams!.slug}/restore/full`,
`hassio/snapshots/${this.snapshot!.slug}/restore/full`,
data
)
.then(
() => {
alert("Snapshot restored!");
(this.$.dialog as PaperDialogElement).close();
this._dialog.close();
},
(error) => {
// @ts-ignore
this.error = error.body.message;
this._error = error.body.message;
}
);
}
protected _deleteClicked() {
private _deleteClicked() {
if (!confirm("Are you sure you want to delete this snapshot?")) {
return;
}
// @ts-ignore
this.hass
// @ts-ignore
.callApi("POST", `hassio/snapshots/${this.dialogParams!.slug}/remove`)
.callApi("POST", `hassio/snapshots/${this.snapshot!.slug}/remove`)
.then(
() => {
(this.$.dialog as PaperDialogElement).close();
// @ts-ignore
this.dialogParams!.onDelete();
this._dialog.close();
this._dialogParams!.onDelete();
},
(error) => {
// @ts-ignore
this.error = error.body.message;
this._error = error.body.message;
}
);
}
protected async _downloadClicked() {
let signedPath;
private async _downloadClicked() {
let signedPath: { path: string };
try {
signedPath = await getSignedPath(
// @ts-ignore
this.hass,
// @ts-ignore
`/api/hassio/snapshots/${this.dialogParams!.slug}/download`
`/api/hassio/snapshots/${this.snapshot!.slug}/download`
);
} catch (err) {
alert(`Error: ${err.message}`);
return;
}
// @ts-ignore
const name = this._computeName(this.snapshot).replace(/[^a-z0-9]+/gi, "_");
const name = this._computeName.replace(/[^a-z0-9]+/gi, "_");
const a = document.createElement("a");
a.href = signedPath.path;
a.download = `Hass_io_${name}.tar`;
this.$.dialog.appendChild(a);
this._dialog.appendChild(a);
a.click();
this.$.dialog.removeChild(a);
this._dialog.removeChild(a);
}
protected _computeName(snapshot) {
return snapshot ? snapshot.name || snapshot.slug : "Unnamed snapshot";
private get _computeName() {
return this.snapshot
? this.snapshot.name || this.snapshot.slug
: "Unnamed snapshot";
}
protected _computeType(type) {
return type === "full" ? "Full snapshot" : "Partial snapshot";
private get _computeSize() {
return Math.ceil(this.snapshot!.size * 10) / 10 + " MB";
}
protected _computeSize(size) {
return Math.ceil(size * 10) / 10 + " MB";
}
protected _sortAddons(a, b) {
return a.name < b.name ? -1 : 1;
}
protected _formatDatetime(datetime) {
private _formatDatetime(datetime) {
return new Date(datetime).toLocaleDateString(navigator.language, {
weekday: "long",
year: "numeric",
@@ -375,13 +442,12 @@ class HassioSnapshotDialog extends PolymerElement {
});
}
protected _dialogClosed() {
this.setProperties({
dialogParams: undefined,
snapshot: undefined,
_addons: [],
_folders: [],
});
private _dialogClosed() {
this._dialogParams = undefined;
this.snapshot = undefined;
this._snapshotPassword = "";
this._folders = [];
this._addons = [];
}
}

View File

@@ -12,7 +12,9 @@ export const showHassioSnapshotDialog = (
fireEvent(element, "show-dialog", {
dialogTag: "dialog-hassio-snapshot",
dialogImport: () =>
import(/* webpackChunkName: "dialog-hassio-snapshot" */ "./dialog-hassio-snapshot"),
import(
/* webpackChunkName: "dialog-hassio-snapshot" */ "./dialog-hassio-snapshot"
),
dialogParams,
});
};

View File

@@ -1,9 +1,12 @@
window.loadES5Adapter().then(() => {
// eslint-disable-next-line
import(/* webpackChunkName: "roboto" */ "../../src/resources/roboto");
// eslint-disable-next-line
import(/* webpackChunkName: "hassio-icons" */ "./resources/hassio-icons");
// eslint-disable-next-line
import(/* webpackChunkName: "hassio-main" */ "./hassio-main");
});
const styleEl = document.createElement("style");
styleEl.innerHTML = `
body {

View File

@@ -12,21 +12,28 @@ import {
import { HomeAssistant } from "../../src/types";
import {
fetchHassioSupervisorInfo,
fetchHassioHostInfo,
fetchHassioHassOsInfo,
fetchHassioHomeAssistantInfo,
HassioSupervisorInfo,
HassioHostInfo,
HassioHassOSInfo,
HassioHomeAssistantInfo,
fetchHassioAddonInfo,
createHassioSession,
HassioPanelInfo,
} from "../../src/data/hassio";
} from "../../src/data/hassio/supervisor";
import {
fetchHassioHostInfo,
fetchHassioHassOsInfo,
HassioHostInfo,
HassioHassOSInfo,
} from "../../src/data/hassio/host";
import { fetchHassioAddonInfo } from "../../src/data/hassio/addon";
import { makeDialogManager } from "../../src/dialogs/make-dialog-manager";
import { ProvideHassLitMixin } from "../../src/mixins/provide-hass-lit-mixin";
// Don't codesplit it, that way the dashboard always loads fast.
import "./hassio-pages-with-tabs";
import { navigate } from "../../src/common/navigate";
import {
showAlertDialog,
AlertDialogParams,
} from "../../src/dialogs/generic/show-dialog-box";
// The register callback of the IronA11yKeysBehavior inside paper-icon-button
// is not called, causing _keyBindings to be uninitiliazed for paper-icon-button,
@@ -56,16 +63,19 @@ class HassioMain extends ProvideHassLitMixin(HassRouterPage) {
addon: {
tag: "hassio-addon-view",
load: () =>
import(/* webpackChunkName: "hassio-addon-view" */ "./addon-view/hassio-addon-view"),
import(
/* webpackChunkName: "hassio-addon-view" */ "./addon-view/hassio-addon-view"
),
},
ingress: {
tag: "hassio-ingress-view",
load: () =>
import(/* webpackChunkName: "hassio-ingress-view" */ "./ingress-view/hassio-ingress-view"),
import(
/* webpackChunkName: "hassio-ingress-view" */ "./ingress-view/hassio-ingress-view"
),
},
},
};
@property() private _supervisorInfo: HassioSupervisorInfo;
@property() private _hostInfo: HassioHostInfo;
@property() private _hassOsInfo?: HassioHassOSInfo;
@@ -74,7 +84,12 @@ class HassioMain extends ProvideHassLitMixin(HassRouterPage) {
protected firstUpdated(changedProps: PropertyValues) {
super.firstUpdated(changedProps);
applyThemesOnElement(this, this.hass.themes, this.hass.selectedTheme, true);
applyThemesOnElement(
this.parentElement,
this.hass.themes,
this.hass.selectedTheme,
true
);
this.addEventListener("hass-api-called", (ev) => this._apiCalled(ev));
// Paulus - March 17, 2019
// We went to a single hass-toggle-menu event in HA 0.90. However, the
@@ -100,6 +115,14 @@ class HassioMain extends ProvideHassLitMixin(HassRouterPage) {
})
);
// Forward haptic events to parent window.
window.addEventListener("haptic", (ev) => {
// @ts-ignore
fireEvent(window.parent, ev.type, ev.detail, {
bubbles: false,
});
});
makeDialogManager(this, document.body);
}
@@ -151,25 +174,81 @@ class HassioMain extends ProvideHassLitMixin(HassRouterPage) {
}
private async _redirectIngress(addonSlug: string) {
// When we trigger a navigation, we sleep to make sure we don't
// show the hassio dashboard before navigating away.
const awaitAlert = async (
alertParams: AlertDialogParams,
action: () => void
) => {
await new Promise((resolve) => {
alertParams.confirm = resolve;
showAlertDialog(this, alertParams);
});
action();
await new Promise((resolve) => setTimeout(resolve, 1000));
};
const createSessionPromise = createHassioSession(this.hass).then(
() => true,
() => false
);
let addon;
try {
const [addon] = await Promise.all([
fetchHassioAddonInfo(this.hass, addonSlug).catch(() => {
throw new Error("Failed to fetch add-on info");
}),
createHassioSession(this.hass).catch(() => {
throw new Error("Failed to create an ingress session");
}),
]);
if (!addon.ingress_url) {
throw new Error("Add-on does not support Ingress");
}
location.assign(addon.ingress_url);
// await a promise that doesn't resolve, so we show the loading screen
// while we load the next page.
await new Promise(() => undefined);
addon = await fetchHassioAddonInfo(this.hass, addonSlug);
} catch (err) {
alert(`Unable to open ingress connection `);
await awaitAlert(
{
text: "Unable to fetch add-on info to start Ingress",
title: "Hass.io",
},
() => history.back()
);
return;
}
if (!addon.ingress_url) {
await awaitAlert(
{
text: "Add-on does not support Ingress",
title: addon.name,
},
() => history.back()
);
return;
}
if (addon.state !== "started") {
await awaitAlert(
{
text: "Add-on is not running. Please start it first",
title: addon.name,
},
() => navigate(this, `/hassio/addon/${addon.slug}`, true)
);
return;
}
if (!(await createSessionPromise)) {
await awaitAlert(
{
text: "Unable to create an Ingress session",
title: addon.name,
},
() => history.back()
);
return;
}
location.assign(addon.ingress_url);
// await a promise that doesn't resolve, so we show the loading screen
// while we load the next page.
await new Promise(() => undefined);
}
private _apiCalled(ev) {

View File

@@ -23,12 +23,11 @@ import scrollToTarget from "../../src/common/dom/scroll-to-target";
import { haStyle } from "../../src/resources/styles";
import { HomeAssistant, Route } from "../../src/types";
import { navigate } from "../../src/common/navigate";
import { HassioHostInfo, HassioHassOSInfo } from "../../src/data/hassio/host";
import {
HassioSupervisorInfo,
HassioHostInfo,
HassioHomeAssistantInfo,
HassioHassOSInfo,
} from "../../src/data/hassio";
} from "../../src/data/hassio/supervisor";
const HAS_REFRESH_BUTTON = ["store", "snapshots"];
@@ -42,7 +41,7 @@ class HassioPagesWithTabs extends LitElement {
@property() public hassInfo!: HassioHomeAssistantInfo;
@property() public hassOsInfo!: HassioHassOSInfo;
protected render(): TemplateResult | void {
protected render(): TemplateResult {
const page = this._page;
return html`
<app-header-layout has-scrolling-region>
@@ -53,7 +52,7 @@ class HassioPagesWithTabs extends LitElement {
.narrow=${this.narrow}
hassio
></ha-menu-button>
<div main-title>Hass.io</div>
<div main-title>Supervisor</div>
${HAS_REFRESH_BUTTON.includes(page)
? html`
<paper-icon-button
@@ -124,7 +123,7 @@ class HassioPagesWithTabs extends LitElement {
}
paper-tabs {
margin-left: 12px;
--paper-tabs-selection-bar-color: #fff;
--paper-tabs-selection-bar-color: var(--text-primary-color, #fff);
text-transform: uppercase;
}
`,

View File

@@ -11,12 +11,11 @@ import "./dashboard/hassio-dashboard";
import "./snapshots/hassio-snapshots";
import "./addon-store/hassio-addon-store";
import "./system/hassio-system";
import { HassioHostInfo, HassioHassOSInfo } from "../../src/data/hassio/host";
import {
HassioSupervisorInfo,
HassioHostInfo,
HassioHomeAssistantInfo,
HassioHassOSInfo,
} from "../../src/data/hassio";
} from "../../src/data/hassio/supervisor";
@customElement("hassio-tabs-router")
class HassioTabsRouter extends HassRouterPage {

View File

@@ -9,11 +9,11 @@ import {
css,
} from "lit-element";
import { HomeAssistant, Route } from "../../../src/types";
import { createHassioSession } from "../../../src/data/hassio/supervisor";
import {
createHassioSession,
HassioAddonDetails,
fetchHassioAddonInfo,
} from "../../../src/data/hassio";
} from "../../../src/data/hassio/addon";
import "../../../src/layouts/hass-loading-screen";
import "../../../src/layouts/hass-subpage";
@@ -23,7 +23,7 @@ class HassioIngressView extends LitElement {
@property() public route!: Route;
@property() private _addon?: HassioAddonDetails;
protected render(): TemplateResult | void {
protected render(): TemplateResult {
if (!this._addon) {
return html`
<hass-loading-screen></hass-loading-screen>

View File

@@ -1,66 +0,0 @@
import { css } from "lit-element";
const documentContainer = document.createElement("template");
documentContainer.setAttribute("style", "display: none;");
export const hassioStyle = css`
.card-group {
margin-top: 24px;
}
.card-group .title {
color: var(--primary-text-color);
font-size: 2em;
padding-left: 8px;
margin-bottom: 8px;
}
.card-group .description {
font-size: 0.5em;
font-weight: 500;
margin-top: 4px;
}
.card-group paper-card {
--card-group-columns: 4;
width: calc(
(100% - 12px * var(--card-group-columns)) / var(--card-group-columns)
);
margin: 4px;
vertical-align: top;
}
@media screen and (max-width: 1200px) and (min-width: 901px) {
.card-group paper-card {
--card-group-columns: 3;
}
}
@media screen and (max-width: 900px) and (min-width: 601px) {
.card-group paper-card {
--card-group-columns: 2;
}
}
@media screen and (max-width: 600px) and (min-width: 0) {
.card-group paper-card {
width: 100%;
margin: 4px 0;
}
.content {
padding: 0;
}
}
ha-call-api-button {
font-weight: 500;
color: var(--primary-color);
}
.error {
color: var(--google-red-500);
margin-top: 16px;
}
`;
documentContainer.innerHTML = `<dom-module id="hassio-style">
<template>
<style>
${hassioStyle.toString()}
</style>
</template>
</dom-module>`;
document.head.appendChild(documentContainer.content);

View File

@@ -0,0 +1,51 @@
import { css } from "lit-element";
export const hassioStyle = css`
.content {
margin: 8px;
}
h1 {
color: var(--primary-text-color);
font-size: 2em;
margin-bottom: 8px;
font-family: var(--paper-font-headline_-_font-family);
-webkit-font-smoothing: var(--paper-font-headline_-_-webkit-font-smoothing);
font-size: var(--paper-font-headline_-_font-size);
font-weight: var(--paper-font-headline_-_font-weight);
letter-spacing: var(--paper-font-headline_-_letter-spacing);
line-height: var(--paper-font-headline_-_line-height);
padding-left: 8px;
}
.description {
margin-top: 4px;
padding-left: 8px;
}
.card-group {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
grid-gap: 8px;
}
@media screen and (min-width: 640px) {
.card-group {
grid-template-columns: repeat(auto-fit, minmax(300px, 0.5fr));
}
}
@media screen and (min-width: 1020px) {
.card-group {
grid-template-columns: repeat(auto-fit, minmax(300px, 0.333fr));
}
}
@media screen and (min-width: 1300px) {
.card-group {
grid-template-columns: repeat(auto-fit, minmax(300px, 0.25fr));
}
}
ha-call-api-button {
font-weight: 500;
color: var(--primary-color);
}
.error {
color: var(--error-color);
margin-top: 16px;
}
`;

View File

@@ -17,19 +17,20 @@ import "@polymer/paper-radio-group/paper-radio-group";
import "../components/hassio-card-content";
import { hassioStyle } from "../resources/hassio-style";
import { haStyle } from "../../../src/resources/styles";
import { showHassioSnapshotDialog } from "../dialogs/snapshot/show-dialog-hassio-snapshot";
import { HomeAssistant } from "../../../src/types";
import {
HassioSnapshot,
HassioSupervisorInfo,
fetchHassioSnapshots,
reloadHassioSnapshots,
HassioFullSnapshotCreateParams,
HassioPartialSnapshotCreateParams,
createHassioFullSnapshot,
createHassioPartialSnapshot,
} from "../../../src/data/hassio";
} from "../../../src/data/hassio/snapshot";
import { HassioSupervisorInfo } from "../../../src/data/hassio/supervisor";
import { PolymerChangedEvent } from "../../../src/polymer-types";
import { fireEvent } from "../../../src/common/dom/fire_event";
@@ -75,17 +76,17 @@ class HassioSnapshots extends LitElement {
await this._updateSnapshots();
}
protected render(): TemplateResult | void {
protected render(): TemplateResult {
return html`
<div class="content">
<h1>
Create snapshot
</h1>
<p class="description">
Snapshots allow you to easily backup and restore all data of your Home
Assistant instance.
</p>
<div class="card-group">
<div class="title">
Create snapshot
<div class="description">
Snapshots allow you to easily backup and restore all data of your
Hass.io instance.
</div>
</div>
<paper-card>
<div class="card-content">
<paper-input
@@ -172,8 +173,8 @@ class HassioSnapshots extends LitElement {
</paper-card>
</div>
<h1>Available snapshots</h1>
<div class="card-group">
<div class="title">Available snapshots</div>
${this._snapshots === undefined
? undefined
: this._snapshots.length === 0
@@ -334,6 +335,7 @@ class HassioSnapshots extends LitElement {
static get styles(): CSSResultArray {
return [
haStyle,
hassioStyle,
css`
paper-radio-group {

View File

@@ -1,201 +0,0 @@
import "@material/mwc-button";
import "@polymer/paper-card/paper-card";
import { html } from "@polymer/polymer/lib/utils/html-tag";
import { PolymerElement } from "@polymer/polymer/polymer-element";
import "../../../src/components/buttons/ha-call-api-button";
import { EventsMixin } from "../../../src/mixins/events-mixin";
import { showHassioMarkdownDialog } from "../dialogs/markdown/show-dialog-hassio-markdown";
class HassioHostInfo extends EventsMixin(PolymerElement) {
static get template() {
return html`
<style>
paper-card {
display: inline-block;
width: 400px;
margin-left: 8px;
}
.card-content {
height: 200px;
color: var(--primary-text-color);
}
@media screen and (max-width: 830px) {
paper-card {
margin-top: 8px;
margin-left: 0;
width: 100%;
}
.card-content {
height: auto;
}
}
.info {
width: 100%;
}
.info td:nth-child(2) {
text-align: right;
}
.errors {
color: var(--google-red-500);
margin-top: 16px;
}
mwc-button.info {
max-width: calc(50% - 12px);
}
table.info {
margin-bottom: 10px;
}
</style>
<paper-card>
<div class="card-content">
<h2>Host system</h2>
<table class="info">
<tbody>
<tr>
<td>Hostname</td>
<td>[[data.hostname]]</td>
</tr>
<tr>
<td>System</td>
<td>[[data.operating_system]]</td>
</tr>
<template is="dom-if" if="[[data.deployment]]">
<tr>
<td>Deployment</td>
<td>[[data.deployment]]</td>
</tr>
</template>
</tbody>
</table>
<mwc-button raised on-click="_showHardware" class="info">
Hardware
</mwc-button>
<template is="dom-if" if="[[_featureAvailable(data, 'hostname')]]">
<mwc-button raised on-click="_changeHostnameClicked" class="info">
Change hostname
</mwc-button>
</template>
<template is="dom-if" if="[[errors]]">
<div class="errors">Error: [[errors]]</div>
</template>
</div>
<div class="card-actions">
<template is="dom-if" if="[[_featureAvailable(data, 'reboot')]]">
<ha-call-api-button
class="warning"
hass="[[hass]]"
path="hassio/host/reboot"
>Reboot</ha-call-api-button
>
</template>
<template is="dom-if" if="[[_featureAvailable(data, 'shutdown')]]">
<ha-call-api-button
class="warning"
hass="[[hass]]"
path="hassio/host/shutdown"
>Shutdown</ha-call-api-button
>
</template>
<template is="dom-if" if="[[_featureAvailable(data, 'hassos')]]">
<ha-call-api-button
class="warning"
hass="[[hass]]"
path="hassio/hassos/config/sync"
title="Load HassOS configs or updates from USB"
>Import from USB</ha-call-api-button
>
</template>
<template is="dom-if" if="[[_computeUpdateAvailable(hassOsInfo)]]">
<ha-call-api-button hass="[[hass]]" path="hassio/hassos/update"
>Update</ha-call-api-button
>
</template>
</div>
</paper-card>
`;
}
static get properties() {
return {
hass: Object,
data: Object,
hassOsInfo: Object,
errors: String,
};
}
ready() {
super.ready();
this.addEventListener("hass-api-called", (ev) => this.apiCalled(ev));
}
apiCalled(ev) {
if (ev.detail.success) {
this.errors = null;
return;
}
var response = ev.detail.response;
if (typeof response.body === "object") {
this.errors = response.body.message || "Unknown error";
} else {
this.errors = response.body;
}
}
_computeUpdateAvailable(data) {
return data && data.version !== data.version_latest;
}
_featureAvailable(data, feature) {
return data && data.features && data.features.includes(feature);
}
_showHardware() {
this.hass
.callApi("get", "hassio/hardware/info")
.then(
(resp) => this._objectToMarkdown(resp.data),
() => "Error getting hardware info"
)
.then((content) => {
showHassioMarkdownDialog(this, {
title: "Hardware",
content: content,
});
});
}
_objectToMarkdown(obj, indent = "") {
let data = "";
Object.keys(obj).forEach((key) => {
if (typeof obj[key] !== "object") {
data += `${indent}- ${key}: ${obj[key]}\n`;
} else {
data += `${indent}- ${key}:\n`;
if (Array.isArray(obj[key])) {
if (obj[key].length) {
data +=
`${indent} - ` + obj[key].join(`\n${indent} - `) + "\n";
}
} else {
data += this._objectToMarkdown(obj[key], ` ${indent}`);
}
}
});
return data;
}
_changeHostnameClicked() {
const curHostname = this.data.hostname;
const hostname = prompt("Please enter a new hostname:", curHostname);
if (hostname && hostname !== curHostname) {
this.hass.callApi("post", "hassio/host/options", { hostname });
}
}
}
customElements.define("hassio-host-info", HassioHostInfo);

View File

@@ -0,0 +1,229 @@
import "@material/mwc-button";
import "@polymer/paper-card/paper-card";
import {
css,
CSSResult,
customElement,
html,
LitElement,
property,
TemplateResult,
} from "lit-element";
import { hassioStyle } from "../resources/hassio-style";
import { haStyle } from "../../../src/resources/styles";
import {
HassioHostInfo as HassioHostInfoType,
HassioHassOSInfo,
} from "../../../src/data/hassio/host";
import { fetchHassioHardwareInfo } from "../../../src/data/hassio/hardware";
import { HomeAssistant } from "../../../src/types";
import { showHassioMarkdownDialog } from "../dialogs/markdown/show-dialog-hassio-markdown";
import "../../../src/components/buttons/ha-call-api-button";
@customElement("hassio-host-info")
class HassioHostInfo extends LitElement {
@property() public hass!: HomeAssistant;
@property() public hostInfo!: HassioHostInfoType;
@property() public hassOsInfo!: HassioHassOSInfo;
@property() private _errors?: string;
public render(): TemplateResult | void {
return html`
<paper-card>
<div class="card-content">
<h2>Host system</h2>
<table class="info">
<tbody>
<tr>
<td>Hostname</td>
<td>${this.hostInfo.hostname}</td>
</tr>
<tr>
<td>System</td>
<td>${this.hostInfo.operating_system}</td>
</tr>
${this.hostInfo.deployment
? html`
<tr>
<td>Deployment</td>
<td>${this.hostInfo.deployment}</td>
</tr>
`
: ""}
</tbody>
</table>
<mwc-button raised @click=${this._showHardware} class="info">
Hardware
</mwc-button>
${this.hostInfo.features.includes("hostname")
? html`
<mwc-button
raised
@click=${this._changeHostnameClicked}
class="info"
>
Change hostname
</mwc-button>
`
: ""}
${this._errors
? html`
<div class="errors">Error: ${this._errors}</div>
`
: ""}
</div>
<div class="card-actions">
${this.hostInfo.features.includes("reboot")
? html`
<ha-call-api-button
class="warning"
.hass=${this.hass}
path="hassio/host/reboot"
>Reboot</ha-call-api-button
>
`
: ""}
${this.hostInfo.features.includes("shutdown")
? html`
<ha-call-api-button
class="warning"
.hass=${this.hass}
path="hassio/host/shutdown"
>Shutdown</ha-call-api-button
>
`
: ""}
${this.hostInfo.features.includes("hassos")
? html`
<ha-call-api-button
class="warning"
.hass=${this.hass}
path="hassio/hassos/config/sync"
title="Load HassOS configs or updates from USB"
>Import from USB</ha-call-api-button
>
`
: ""}
${this.hostInfo.version !== this.hostInfo.version_latest
? html`
<ha-call-api-button
.hass=${this.hass}
path="hassio/hassos/update"
>Update</ha-call-api-button
>
`
: ""}
</div>
</paper-card>
`;
}
static get styles(): CSSResult[] {
return [
haStyle,
hassioStyle,
css`
paper-card {
height: 100%;
width: 100%;
}
.card-content {
color: var(--primary-text-color);
box-sizing: border-box;
height: calc(100% - 47px);
}
.info {
width: 100%;
}
.info td:nth-child(2) {
text-align: right;
}
.errors {
color: var(--google-red-500);
margin-top: 16px;
}
mwc-button.info {
max-width: calc(50% - 12px);
}
table.info {
margin-bottom: 10px;
}
.warning {
--mdc-theme-primary: var(--google-red-500);
}
`,
];
}
protected firstUpdated(): void {
this.addEventListener("hass-api-called", (ev) => this._apiCalled(ev));
}
private _apiCalled(ev): void {
if (ev.detail.success) {
this._errors = undefined;
return;
}
const response = ev.detail.response;
this._errors =
typeof response.body === "object"
? response.body.message || "Unknown error"
: response.body;
}
private async _showHardware(): Promise<void> {
try {
const content = this._objectToMarkdown(
await fetchHassioHardwareInfo(this.hass)
);
showHassioMarkdownDialog(this, {
title: "Hardware",
content,
});
} catch (err) {
showHassioMarkdownDialog(this, {
title: "Hardware",
content: "Error getting hardware info",
});
}
}
private _objectToMarkdown(obj, indent = ""): string {
let data = "";
Object.keys(obj).forEach((key) => {
if (typeof obj[key] !== "object") {
data += `${indent}- ${key}: ${obj[key]}\n`;
} else {
data += `${indent}- ${key}:\n`;
if (Array.isArray(obj[key])) {
if (obj[key].length) {
data +=
`${indent} - ` + obj[key].join(`\n${indent} - `) + "\n";
}
} else {
data += this._objectToMarkdown(obj[key], ` ${indent}`);
}
}
});
return data;
}
private _changeHostnameClicked(): void {
const curHostname = this.hostInfo.hostname;
const hostname = prompt("Please enter a new hostname:", curHostname);
if (hostname && hostname !== curHostname) {
this.hass.callApi("POST", "hassio/host/options", { hostname });
}
}
}
declare global {
interface HTMLElementTagNameMap {
"hassio-host-info": HassioHostInfo;
}
}

View File

@@ -1,175 +0,0 @@
import "@material/mwc-button";
import "@polymer/paper-card/paper-card";
import { html } from "@polymer/polymer/lib/utils/html-tag";
import { PolymerElement } from "@polymer/polymer/polymer-element";
import "../../../src/components/buttons/ha-call-api-button";
import { EventsMixin } from "../../../src/mixins/events-mixin";
class HassioSupervisorInfo extends EventsMixin(PolymerElement) {
static get template() {
return html`
<style>
paper-card {
display: inline-block;
width: 400px;
}
.card-content {
height: 200px;
color: var(--primary-text-color);
}
@media screen and (max-width: 830px) {
paper-card {
width: 100%;
}
.card-content {
height: auto;
}
}
.info {
width: 100%;
}
.info td:nth-child(2) {
text-align: right;
}
.errors {
color: var(--google-red-500);
margin-top: 16px;
}
</style>
<paper-card>
<div class="card-content">
<h2>Hass.io supervisor</h2>
<table class="info">
<tbody>
<tr>
<td>Version</td>
<td>[[data.version]]</td>
</tr>
<tr>
<td>Latest version</td>
<td>[[data.last_version]]</td>
</tr>
<template is="dom-if" if='[[!_equals(data.channel, "stable")]]'>
<tr>
<td>Channel</td>
<td>[[data.channel]]</td>
</tr>
</template>
</tbody>
</table>
<template is="dom-if" if="[[errors]]">
<div class="errors">Error: [[errors]]</div>
</template>
</div>
<div class="card-actions">
<ha-call-api-button hass="[[hass]]" path="hassio/supervisor/reload"
>Reload</ha-call-api-button
>
<template is="dom-if" if="[[computeUpdateAvailable(data)]]">
<ha-call-api-button hass="[[hass]]" path="hassio/supervisor/update"
>Update</ha-call-api-button
>
</template>
<template is="dom-if" if='[[_equals(data.channel, "beta")]]'>
<ha-call-api-button
hass="[[hass]]"
path="hassio/supervisor/options"
data="[[leaveBeta]]"
>Leave beta channel</ha-call-api-button
>
</template>
<template is="dom-if" if='[[_equals(data.channel, "stable")]]'>
<mwc-button
on-click="_joinBeta"
class="warning"
title="Get beta updates for Home Assistant (RCs), supervisor and host"
>Join beta channel</mwc-button
>
</template>
</div>
</paper-card>
`;
}
static get properties() {
return {
hass: Object,
data: Object,
errors: String,
leaveBeta: {
type: Object,
value: { channel: "stable" },
},
};
}
ready() {
super.ready();
this.addEventListener("hass-api-called", (ev) => this.apiCalled(ev));
}
apiCalled(ev) {
if (ev.detail.success) {
this.errors = null;
return;
}
var response = ev.detail.response;
if (typeof response.body === "object") {
this.errors = response.body.message || "Unknown error";
} else {
this.errors = response.body;
}
}
computeUpdateAvailable(data) {
return data.version !== data.last_version;
}
_equals(a, b) {
return a === b;
}
_joinBeta() {
if (
!confirm(`WARNING:
Beta releases are for testers and early adopters and can contain unstable code changes. Make sure you have backups of your data before you activate this feature.
This inludes beta releases for:
- Home Assistant (Release Candidates)
- Hass.io supervisor
- Host system`)
) {
return;
}
const method = "post";
const path = "hassio/supervisor/options";
const data = { channel: "beta" };
const eventData = {
method: method,
path: path,
data: data,
};
this.hass
.callApi(method, path, data)
.then(
(resp) => {
eventData.success = true;
eventData.response = resp;
},
(resp) => {
eventData.success = false;
eventData.response = resp;
}
)
.then(() => {
this.fire("hass-api-called", eventData);
});
}
}
customElements.define("hassio-supervisor-info", HassioSupervisorInfo);

View File

@@ -0,0 +1,177 @@
import "@material/mwc-button";
import "@polymer/paper-card/paper-card";
import {
css,
CSSResult,
customElement,
html,
LitElement,
property,
TemplateResult,
} from "lit-element";
import { fireEvent } from "../../../src/common/dom/fire_event";
import {
HassioSupervisorInfo as HassioSupervisorInfoType,
setSupervisorOption,
SupervisorOptions,
} from "../../../src/data/hassio/supervisor";
import { HomeAssistant } from "../../../src/types";
import { hassioStyle } from "../resources/hassio-style";
import { haStyle } from "../../../src/resources/styles";
import "../../../src/components/buttons/ha-call-api-button";
@customElement("hassio-supervisor-info")
class HassioSupervisorInfo extends LitElement {
@property() public hass!: HomeAssistant;
@property() public supervisorInfo!: HassioSupervisorInfoType;
@property() private _errors?: string;
public render(): TemplateResult | void {
return html`
<paper-card>
<div class="card-content">
<h2>Supervisor</h2>
<table class="info">
<tbody>
<tr>
<td>Version</td>
<td>${this.supervisorInfo.version}</td>
</tr>
<tr>
<td>Latest version</td>
<td>${this.supervisorInfo.last_version}</td>
</tr>
${this.supervisorInfo.channel !== "stable"
? html`
<tr>
<td>Channel</td>
<td>${this.supervisorInfo.channel}</td>
</tr>
`
: ""}
</tbody>
</table>
${this._errors
? html`
<div class="errors">Error: ${this._errors}</div>
`
: ""}
</div>
<div class="card-actions">
<ha-call-api-button .hass=${this.hass} path="hassio/supervisor/reload"
>Reload</ha-call-api-button
>
${this.supervisorInfo.version !== this.supervisorInfo.last_version
? html`
<ha-call-api-button
.hass=${this.hass}
path="hassio/supervisor/update"
>Update</ha-call-api-button
>
`
: ""}
${this.supervisorInfo.channel === "beta"
? html`
<ha-call-api-button
.hass=${this.hass}
path="hassio/supervisor/options"
.data=${{ channel: "stable" }}
>Leave beta channel</ha-call-api-button
>
`
: ""}
${this.supervisorInfo.channel === "stable"
? html`
<mwc-button
@click=${this._joinBeta}
class="warning"
title="Get beta updates for Home Assistant (RCs), supervisor and host"
>Join beta channel</mwc-button
>
`
: ""}
</div>
</paper-card>
`;
}
static get styles(): CSSResult[] {
return [
haStyle,
hassioStyle,
css`
paper-card {
height: 100%;
width: 100%;
}
.card-content {
color: var(--primary-text-color);
box-sizing: border-box;
height: calc(100% - 47px);
}
.info {
width: 100%;
}
.info td:nth-child(2) {
text-align: right;
}
.errors {
color: var(--google-red-500);
margin-top: 16px;
}
`,
];
}
protected firstUpdated(): void {
this.addEventListener("hass-api-called", (ev) => this._apiCalled(ev));
}
private _apiCalled(ev): void {
if (ev.detail.success) {
this._errors = undefined;
return;
}
const response = ev.detail.response;
this._errors =
typeof response.body === "object"
? response.body.message || "Unknown error"
: response.body;
}
private async _joinBeta() {
if (
!confirm(`WARNING:
Beta releases are for testers and early adopters and can contain unstable code changes. Make sure you have backups of your data before you activate this feature.
This includes beta releases for:
- Home Assistant (Release Candidates)
- Hass.io supervisor
- Host system`)
) {
return;
}
try {
const data: SupervisorOptions = { channel: "beta" };
await setSupervisorOption(this.hass, data);
const eventdata = {
success: true,
response: undefined,
path: "option",
};
fireEvent(this, "hass-api-called", eventdata);
} catch (err) {
this._errors = `Error joining beta channel, ${err.body?.message || err}`;
}
}
}
declare global {
interface HTMLElementTagNameMap {
"hassio-supervisor-info": HassioSupervisorInfo;
}
}

Some files were not shown because too many files have changed in this diff Show More