Merge pull request #3375 from home-assistant/dev

20190717.0
This commit is contained in:
Paulus Schoutsen 2019-07-17 12:09:36 -07:00 committed by GitHub
commit e5a916032a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 115 additions and 28 deletions

View File

@ -0,0 +1,67 @@
# https://dev.azure.com/home-assistant
trigger:
batch: true
tags:
include:
- "*"
pr: none
variables:
- name: versionBuilder
value: "5.2"
- group: github
- group: twine
stages:
- stage: "Validate"
jobs:
- job: "VersionValidate"
pool:
vmImage: "ubuntu-latest"
steps:
- task: UsePythonVersion@0
displayName: "Use Python 3.7"
inputs:
versionSpec: "3.7"
- script: |
setup_version="$(python setup.py -V)"
branch_version="$(Build.SourceBranchName)"
if [ "${setup_version}" != "${branch_version}" ]; then
echo "Version of tag ${branch_version} don't match with ${setup_version}!"
exit 1
fi
displayName: "Check version of branch/tag"
- script: |
sudo apt-get install -y --no-install-recommends \
jq curl
release="$(Build.SourceBranchName)"
created_by="$(curl -s https://api.github.com/repos/home-assistant/home-assistant/releases/tags/${release} | jq --raw-output '.author.login')"
if [[ "${created_by}" =~ ^(balloob)$ ]]; then
exit 0
fi
echo "${created_by} is not allowed to create an release!"
exit 1
displayName: "Check rights"
- stage: "Build"
jobs:
- job: "ReleasePython"
pool:
vmImage: "ubuntu-latest"
steps:
- task: UsePythonVersion@0
displayName: "Use Python 3.7"
inputs:
versionSpec: "3.7"
- task: NodeTool@0
displayName: "Use Node 12.1"
inputs:
versionSpec: "12.1"
- script: pip install twine wheel
displayName: "Install tools"
- script: script/release
displayName: "Build and release package"

View File

@ -86,7 +86,7 @@ gulp.task("gen-index-app-dev", (done) => {
es5CoreJS: "/frontend_es5/core.js", es5CoreJS: "/frontend_es5/core.js",
es5CustomPanelJS: "/frontend_es5/custom-panel.js", es5CustomPanelJS: "/frontend_es5/custom-panel.js",
es5HassIconsJS: "/frontend_es5/hass-icons.js", es5HassIconsJS: "/frontend_es5/hass-icons.js",
}); }).replace(/#THEMEC/g, "{{ theme_color }}");
fs.outputFileSync(path.resolve(config.root, "index.html"), content); fs.outputFileSync(path.resolve(config.root, "index.html"), content);
done(); done();

View File

@ -26,7 +26,7 @@ class SearchInput extends LitElement {
@value-changed=${this._filterInputChanged} @value-changed=${this._filterInputChanged}
> >
<iron-icon <iron-icon
icon="mdi:magnify" icon="hass:magnify"
slot="prefix" slot="prefix"
class="prefix" class="prefix"
></iron-icon> ></iron-icon>
@ -36,7 +36,7 @@ class SearchInput extends LitElement {
slot="suffix" slot="suffix"
class="suffix" class="suffix"
@click=${this._clearSearch} @click=${this._clearSearch}
icon="mdi:close" icon="hass:close"
alt="Clear" alt="Clear"
title="Clear" title="Clear"
></paper-icon-button> ></paper-icon-button>

View File

@ -69,9 +69,10 @@ class StepFlowCreateEntry extends LitElement {
(device) => (device) =>
html` html`
<div class="device"> <div class="device">
<b>${device.name}</b><br /> <div>
${device.model} (${device.manufacturer}) <b>${device.name}</b><br />
${device.model} (${device.manufacturer})
</div>
<paper-dropdown-menu-light <paper-dropdown-menu-light
label="Area" label="Area"
.device=${device.id} .device=${device.id}
@ -157,6 +158,8 @@ class StepFlowCreateEntry extends LitElement {
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
margin: -4px; margin: -4px;
max-height: 600px;
overflow-y: auto;
} }
.device { .device {
border: 1px solid var(--divider-color); border: 1px solid var(--divider-color);
@ -178,7 +181,7 @@ class StepFlowCreateEntry extends LitElement {
} }
@media all and (max-width: 450px), all and (max-height: 500px) { @media all and (max-width: 450px), all and (max-height: 500px) {
.device { .device {
width: auto; width: 100%;
} }
} }
`, `,

View File

@ -18,6 +18,7 @@ import * as Fuse from "fuse.js";
import "../../components/ha-icon-next"; import "../../components/ha-icon-next";
import "../../common/search/search-input"; import "../../common/search/search-input";
import { styleMap } from "lit-html/directives/style-map";
interface HandlerObj { interface HandlerObj {
name: string; name: string;
@ -29,6 +30,7 @@ class StepFlowPickHandler extends LitElement {
@property() public hass!: HomeAssistant; @property() public hass!: HomeAssistant;
@property() public handlers!: string[]; @property() public handlers!: string[];
@property() private filter?: string; @property() private filter?: string;
private _width?: number;
private _getHandlers = memoizeOne((h: string[], filter?: string) => { private _getHandlers = memoizeOne((h: string[], filter?: string) => {
const handlers: HandlerObj[] = h.map((handler) => { const handlers: HandlerObj[] = h.map((handler) => {
@ -58,11 +60,11 @@ class StepFlowPickHandler extends LitElement {
return html` return html`
<h2>${this.hass.localize("ui.panel.config.integrations.new")}</h2> <h2>${this.hass.localize("ui.panel.config.integrations.new")}</h2>
<div> <search-input
<search-input .filter=${this.filter}
.filter=${this.filter} @value-changed=${this._filterChanged}
@value-changed=${this._filterChanged} ></search-input>
></search-input> <div style=${styleMap({ width: `${this._width}px` })}>
${handlers.map( ${handlers.map(
(handler: HandlerObj) => (handler: HandlerObj) =>
html` html`
@ -80,6 +82,11 @@ class StepFlowPickHandler extends LitElement {
private async _filterChanged(e) { private async _filterChanged(e) {
this.filter = e.detail.value; this.filter = e.detail.value;
// Store the width so that when we search, box doesn't jump
if (this._width === undefined) {
this._width = this.shadowRoot!.querySelector("div")!.clientWidth;
}
} }
private async _handlerPicked(ev) { private async _handlerPicked(ev) {

View File

@ -34,6 +34,8 @@ export class HuiNotificationDrawer extends EventsMixin(
.notifications { .notifications {
overflow-y: auto; overflow-y: auto;
padding-top: 16px; padding-top: 16px;
height: calc(100% - 65px);
box-sizing: border-box;
} }
.notification { .notification {

View File

@ -37,7 +37,7 @@ const thermostatConfig = {
}; };
const modeIcons: { [mode in HvacMode]: string } = { const modeIcons: { [mode in HvacMode]: string } = {
auto: "hass:autorenew", auto: "hass:calendar-repeat",
heat_cool: "hass:autorenew", heat_cool: "hass:autorenew",
heat: "hass:fire", heat: "hass:fire",
cool: "hass:snowflake", cool: "hass:snowflake",
@ -204,10 +204,13 @@ export class HuiThermostatCard extends LitElement implements LovelaceCard {
!changedProps.has("_jQuery") && !changedProps.has("_jQuery") &&
(!oldHass || oldHass.states[this._config.entity] !== stateObj) (!oldHass || oldHass.states[this._config.entity] !== stateObj)
) { ) {
const [sliderValue, uiValue] = this._genSliderValue(stateObj); const [sliderValue, uiValue, _sliderType] = this._genSliderValue(
stateObj
);
this._jQuery("#thermostat", this.shadowRoot).roundSlider({ this._jQuery("#thermostat", this.shadowRoot).roundSlider({
value: sliderValue, value: sliderValue,
sliderType: _sliderType,
}); });
this._updateSetTemp(uiValue); this._updateSetTemp(uiValue);
} }
@ -250,13 +253,7 @@ export class HuiThermostatCard extends LitElement implements LovelaceCard {
this._roundSliderStyle = loaded.roundSliderStyle; this._roundSliderStyle = loaded.roundSliderStyle;
this._jQuery = loaded.jQuery; this._jQuery = loaded.jQuery;
const _sliderType = const [sliderValue, uiValue, _sliderType] = this._genSliderValue(stateObj);
stateObj.attributes.target_temp_low &&
stateObj.attributes.target_temp_high
? "range"
: "min-range";
const [sliderValue, uiValue] = this._genSliderValue(stateObj);
this._jQuery("#thermostat", this.shadowRoot).roundSlider({ this._jQuery("#thermostat", this.shadowRoot).roundSlider({
...thermostatConfig, ...thermostatConfig,
@ -272,7 +269,10 @@ export class HuiThermostatCard extends LitElement implements LovelaceCard {
this._updateSetTemp(uiValue); this._updateSetTemp(uiValue);
} }
private _genSliderValue(stateObj: ClimateEntity): [string | number, string] { private _genSliderValue(
stateObj: ClimateEntity
): [string | number, string, string] {
let sliderType: string;
let sliderValue: string | number; let sliderValue: string | number;
let uiValue: string; let uiValue: string;
@ -280,6 +280,7 @@ export class HuiThermostatCard extends LitElement implements LovelaceCard {
stateObj.attributes.target_temp_low && stateObj.attributes.target_temp_low &&
stateObj.attributes.target_temp_high stateObj.attributes.target_temp_high
) { ) {
sliderType = "range";
sliderValue = `${stateObj.attributes.target_temp_low}, ${ sliderValue = `${stateObj.attributes.target_temp_low}, ${
stateObj.attributes.target_temp_high stateObj.attributes.target_temp_high
}`; }`;
@ -291,6 +292,7 @@ export class HuiThermostatCard extends LitElement implements LovelaceCard {
false false
); );
} else { } else {
sliderType = "min-range";
sliderValue = stateObj.attributes.temperature; sliderValue = stateObj.attributes.temperature;
uiValue = uiValue =
stateObj.attributes.temperature !== null stateObj.attributes.temperature !== null
@ -298,7 +300,7 @@ export class HuiThermostatCard extends LitElement implements LovelaceCard {
: ""; : "";
} }
return [sliderValue, uiValue]; return [sliderValue, uiValue, sliderType];
} }
private _updateSetTemp(value: string): void { private _updateSetTemp(value: string): void {

View File

@ -104,10 +104,12 @@ class HaPanelProfile extends EventsMixin(LocalizeMixin(PolymerElement)) {
mfa-modules="[[hass.user.mfa_modules]]" mfa-modules="[[hass.user.mfa_modules]]"
></ha-mfa-modules-card> ></ha-mfa-modules-card>
<ha-advanced-mode-card <template is="dom-if" if="[[_isAdmin(hass.user)]]">
hass="[[hass]]" <ha-advanced-mode-card
core-user-data="[[_coreUserData]]" hass="[[hass]]"
></ha-advanced-mode-card> core-user-data="[[_coreUserData]]"
></ha-advanced-mode-card>
</template>
<ha-refresh-tokens-card <ha-refresh-tokens-card
hass="[[hass]]" hass="[[hass]]"
@ -168,6 +170,10 @@ class HaPanelProfile extends EventsMixin(LocalizeMixin(PolymerElement)) {
(cred) => cred.auth_provider_type === "homeassistant" (cred) => cred.auth_provider_type === "homeassistant"
); );
} }
_isAdmin(user) {
return user.is_admin;
}
} }
customElements.define("ha-panel-profile", HaPanelProfile); customElements.define("ha-panel-profile", HaPanelProfile);

View File

@ -173,7 +173,7 @@
"off": "[%key:state::default::off%]", "off": "[%key:state::default::off%]",
"heat": "Heat", "heat": "Heat",
"cool": "Cool", "cool": "Cool",
"heat_cool": "Auto", "heat_cool": "Heat/Cool",
"auto": "Auto", "auto": "Auto",
"dry": "Dry", "dry": "Dry",
"fan_only": "Fan only" "fan_only": "Fan only"