From 0707528bd72128904a48dc8b518ec7f512457832 Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Sat, 25 Nov 2017 16:00:43 -0800 Subject: [PATCH] Entity dropdown improvement (#674) * Ignore hass changes while dropdown is open * Upgrade vaadin-combo-box * Fix styling on dev-service panel * Fix styling for ha-entity-dropdown * Fix height vaadin-combo-box dropdown * Rename ha-entity-dropdown to ha-entity-picker * More entity improvement (#675) * Update script and automation editor to use entity picker * Add entity and service picker to service dev panel * Lint --- .eslintrc-hound.json | 1 + bower.json | 2 +- js/automation-editor/automation.js | 20 +- js/automation-editor/trigger/index.js | 3 +- js/automation-editor/trigger/numeric_state.js | 19 +- js/automation-editor/trigger/state.js | 18 +- js/automation-editor/trigger/trigger_edit.js | 3 +- js/automation-editor/trigger/zone.js | 44 ++- .../component/condition/condition_edit.js | 3 +- js/common/component/condition/index.js | 3 +- .../component/condition/numeric_state.js | 18 +- js/common/component/condition/state.js | 18 +- js/common/component/condition/zone.js | 44 ++- js/common/component/script/action_edit.js | 3 +- js/common/component/script/call_service.js | 28 +- js/common/component/script/condition.js | 3 +- js/common/component/script/index.js | 3 +- js/common/util/location.js | 4 + .../automation/ha-automation-editor.html | 32 +- panels/dev-service/ha-panel-dev-service.html | 335 ++++++++++-------- panels/dev-state/ha-panel-dev-state.html | 18 +- panels/mailbox/ha-panel-mailbox.html | 2 - src/components/entity/ha-entity-dropdown.html | 67 ---- src/components/entity/ha-entity-picker.html | 152 ++++++++ src/components/ha-combo-box.html | 106 ++++++ src/components/ha-service-picker.html | 46 +++ src/resources/ha-style.html | 1 + test-mocha/common/util/location.js | 38 ++ 28 files changed, 730 insertions(+), 304 deletions(-) create mode 100644 js/common/util/location.js delete mode 100644 src/components/entity/ha-entity-dropdown.html create mode 100644 src/components/entity/ha-entity-picker.html create mode 100644 src/components/ha-combo-box.html create mode 100644 src/components/ha-service-picker.html create mode 100644 test-mocha/common/util/location.js diff --git a/.eslintrc-hound.json b/.eslintrc-hound.json index fc0ccf9251..0adcc8129f 100644 --- a/.eslintrc-hound.json +++ b/.eslintrc-hound.json @@ -48,6 +48,7 @@ "import/prefer-default-export": 0, "import/no-unresolved": 0, "import/extensions": [2, "ignorePackages"], + "object-curly-newline": 0, "react/jsx-no-bind": [2, { "ignoreRefs": true }], "react/jsx-no-duplicate-props": 2, "react/self-closing-comp": 2, diff --git a/bower.json b/bower.json index 565796f114..0ec9802361 100644 --- a/bower.json +++ b/bower.json @@ -51,7 +51,7 @@ "paper-toast": "PolymerElements/paper-toast#^2.0.0", "paper-toggle-button": "PolymerElements/paper-toggle-button#^2.0.0", "polymer": "^2.1.1", - "vaadin-combo-box": "vaadin/vaadin-combo-box#^2.0.0", + "vaadin-combo-box": "vaadin/vaadin-combo-box#^3.0.2", "vaadin-date-picker": "vaadin/vaadin-date-picker#^2.0.0", "web-animations-js": "^2.2.5", "webcomponentsjs": "^1.0.10" diff --git a/js/automation-editor/automation.js b/js/automation-editor/automation.js index cebb63d8bf..d76177333c 100644 --- a/js/automation-editor/automation.js +++ b/js/automation-editor/automation.js @@ -42,7 +42,7 @@ export default class Automation extends Component { }); } - render({ automation, isWide }) { + render({ automation, isWide, hass }) { const { alias, trigger, condition, action } = automation; @@ -77,7 +77,11 @@ export default class Automation extends Component { Learn more about triggers.

- + @@ -93,7 +97,11 @@ export default class Automation extends Component { Learn more about conditions.

- +
@@ -104,7 +112,11 @@ export default class Automation extends Component { Learn more about actions.

- diff --git a/panels/dev-state/ha-panel-dev-state.html b/panels/dev-state/ha-panel-dev-state.html index fb3cbd3120..1e16a7772d 100644 --- a/panels/dev-state/ha-panel-dev-state.html +++ b/panels/dev-state/ha-panel-dev-state.html @@ -10,7 +10,7 @@ - + @@ -26,9 +26,9 @@ padding: 16px; } - ha-entity-dropdown { + ha-entity-picker, .state-input, paper-textarea { display: block; - max-width: 300px; + max-width: 400px; } .entities th { @@ -72,12 +72,18 @@ This will not communicate with the actual device.

- - + allow-custom-entity + > + Set State diff --git a/panels/mailbox/ha-panel-mailbox.html b/panels/mailbox/ha-panel-mailbox.html index 50a177d715..f6096bddd9 100644 --- a/panels/mailbox/ha-panel-mailbox.html +++ b/panels/mailbox/ha-panel-mailbox.html @@ -12,8 +12,6 @@ - - diff --git a/src/components/entity/ha-entity-dropdown.html b/src/components/entity/ha-entity-dropdown.html deleted file mode 100644 index 76642cec2c..0000000000 --- a/src/components/entity/ha-entity-dropdown.html +++ /dev/null @@ -1,67 +0,0 @@ - - - - - - - - - - - - - diff --git a/src/components/entity/ha-entity-picker.html b/src/components/entity/ha-entity-picker.html new file mode 100644 index 0000000000..25973b1f0a --- /dev/null +++ b/src/components/entity/ha-entity-picker.html @@ -0,0 +1,152 @@ + + + + + + + + + + + + diff --git a/src/components/ha-combo-box.html b/src/components/ha-combo-box.html new file mode 100644 index 0000000000..03d4fa6b4a --- /dev/null +++ b/src/components/ha-combo-box.html @@ -0,0 +1,106 @@ + + + + + + + + + diff --git a/src/components/ha-service-picker.html b/src/components/ha-service-picker.html new file mode 100644 index 0000000000..602abf74e5 --- /dev/null +++ b/src/components/ha-service-picker.html @@ -0,0 +1,46 @@ + + + + + + + + + diff --git a/src/resources/ha-style.html b/src/resources/ha-style.html index b01a1adaba..355978d43f 100644 --- a/src/resources/ha-style.html +++ b/src/resources/ha-style.html @@ -4,6 +4,7 @@