Update dependency prettier to v3.1.0 (#18675)

* Update dependency prettier to v3.1.0

* Reformat

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Steve Repsher <steverep@users.noreply.github.com>
This commit is contained in:
renovate[bot] 2023-11-19 23:31:56 -05:00 committed by GitHub
parent 6e66ba202f
commit 15395275ba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
146 changed files with 2733 additions and 2648 deletions

View File

@ -30,8 +30,8 @@ gulp.task(
env.useWDS() env.useWDS()
? "wds-watch-app" ? "wds-watch-app"
: env.useRollup() : env.useRollup()
? "rollup-watch-app" ? "rollup-watch-app"
: "webpack-watch-app" : "webpack-watch-app"
) )
); );

View File

@ -51,8 +51,8 @@ const createWebpackConfig = ({
devtool: isTestBuild devtool: isTestBuild
? false ? false
: isProdBuild : isProdBuild
? "nosources-source-map" ? "nosources-source-map"
: "eval-cheap-module-source-map", : "eval-cheap-module-source-map",
entry, entry,
node: false, node: false,
module: { module: {

View File

@ -73,44 +73,44 @@ class HcCast extends LitElement {
${error ${error
? html` <div class="card-content">${error}</div> ` ? html` <div class="card-content">${error}</div> `
: !this.castManager.status : !this.castManager.status
? html` ? html`
<p class="center-item"> <p class="center-item">
<mwc-button raised @click=${this._handleLaunch}> <mwc-button raised @click=${this._handleLaunch}>
<ha-svg-icon .path=${mdiCast}></ha-svg-icon> <ha-svg-icon .path=${mdiCast}></ha-svg-icon>
Start Casting Start Casting
</mwc-button> </mwc-button>
</p> </p>
` `
: html` : html`
<div class="section-header">PICK A VIEW</div> <div class="section-header">PICK A VIEW</div>
<paper-listbox <paper-listbox
attr-for-selected="data-path" attr-for-selected="data-path"
.selected=${this.castManager.status.lovelacePath || ""} .selected=${this.castManager.status.lovelacePath || ""}
> >
${( ${(
this.lovelaceViews ?? [ this.lovelaceViews ?? [
generateDefaultViewConfig({}, {}, {}, {}, () => ""), generateDefaultViewConfig({}, {}, {}, {}, () => ""),
] ]
).map( ).map(
(view, idx) => html` (view, idx) => html`
<paper-icon-item <paper-icon-item
@click=${this._handlePickView} @click=${this._handlePickView}
data-path=${view.path || idx} data-path=${view.path || idx}
> >
${view.icon ${view.icon
? html` ? html`
<ha-icon <ha-icon
.icon=${view.icon} .icon=${view.icon}
slot="item-icon" slot="item-icon"
></ha-icon> ></ha-icon>
` `
: ""} : ""}
${view.title || view.path} ${view.title || view.path}
</paper-icon-item> </paper-icon-item>
` `
)} )}
</paper-listbox> </paper-listbox>
`} `}
<div class="card-actions"> <div class="card-actions">
${this.castManager.status ${this.castManager.status
? html` ? html`

View File

@ -33,13 +33,13 @@ const translateErr = (err) =>
err === ERR_CANNOT_CONNECT err === ERR_CANNOT_CONNECT
? "Unable to connect" ? "Unable to connect"
: err === ERR_HASS_HOST_REQUIRED : err === ERR_HASS_HOST_REQUIRED
? "Please enter a Home Assistant URL." ? "Please enter a Home Assistant URL."
: err === ERR_INVALID_HTTPS_TO_HTTP : err === ERR_INVALID_HTTPS_TO_HTTP
? html` ? html`
Cannot connect to Home Assistant instances over "http://". Cannot connect to Home Assistant instances over "http://".
${seeFAQ("https")} ${seeFAQ("https")}
` `
: `Unknown error (${err}).`; : `Unknown error (${err}).`;
const INTRO = html` const INTRO = html`
<p> <p>

View File

@ -43,8 +43,8 @@ const generateMeanStatistics = (
period === "day" period === "day"
? addDays(currentDate, 1) ? addDays(currentDate, 1)
: period === "month" : period === "month"
? addMonths(currentDate, 1) ? addMonths(currentDate, 1)
: addHours(currentDate, 1); : addHours(currentDate, 1);
} }
return statistics; return statistics;
}; };
@ -80,8 +80,8 @@ const generateSumStatistics = (
period === "day" period === "day"
? addDays(currentDate, 1) ? addDays(currentDate, 1)
: period === "month" : period === "month"
? addMonths(currentDate, 1) ? addMonths(currentDate, 1)
: addHours(currentDate, 1); : addHours(currentDate, 1);
} }
return statistics; return statistics;
}; };

View File

@ -86,15 +86,15 @@ export class HassioAddonRepositoryEl extends LitElement {
) )
: this.supervisor.localize("addon.state.installed") : this.supervisor.localize("addon.state.installed")
: addon.available : addon.available
? this.supervisor.localize("addon.state.not_installed") ? this.supervisor.localize("addon.state.not_installed")
: this.supervisor.localize("addon.state.not_available")} : this.supervisor.localize("addon.state.not_available")}
.iconClass=${addon.installed .iconClass=${addon.installed
? addon.update_available ? addon.update_available
? "update" ? "update"
: "installed" : "installed"
: !addon.available : !addon.available
? "not_available" ? "not_available"
: ""} : ""}
.iconImage=${atLeastVersion( .iconImage=${atLeastVersion(
this.hass.config.version, this.hass.config.version,
0, 0,
@ -108,8 +108,8 @@ export class HassioAddonRepositoryEl extends LitElement {
? "update" ? "update"
: "installed" : "installed"
: !addon.available : !addon.available
? "unavailable" ? "unavailable"
: ""} : ""}
></hassio-card-content> ></hassio-card-content>
</div> </div>
</ha-card> </ha-card>

View File

@ -104,50 +104,50 @@ class HassioAddonConfig extends LitElement {
selector: { select: { options: entry.options } }, selector: { select: { options: entry.options } },
} }
: entry.type === "string" : entry.type === "string"
? entry.multiple ? entry.multiple
? { ? {
name: entry.name, name: entry.name,
required: entry.required, required: entry.required,
selector: { selector: {
select: { options: [], multiple: true, custom_value: true }, select: { options: [], multiple: true, custom_value: true },
},
}
: {
name: entry.name,
required: entry.required,
selector: {
text: {
type:
entry.format || MASKED_FIELDS.includes(entry.name)
? "password"
: "text",
}, },
}, }
} : {
: entry.type === "boolean" name: entry.name,
? { required: entry.required,
name: entry.name, selector: {
required: entry.required, text: {
selector: { boolean: {} }, type:
} entry.format || MASKED_FIELDS.includes(entry.name)
: entry.type === "schema" ? "password"
? { : "text",
name: entry.name, },
required: entry.required, },
selector: { object: {} }, }
} : entry.type === "boolean"
: entry.type === "float" || entry.type === "integer" ? {
? { name: entry.name,
name: entry.name, required: entry.required,
required: entry.required, selector: { boolean: {} },
selector: { }
number: { : entry.type === "schema"
mode: "box", ? {
step: entry.type === "float" ? "any" : undefined, name: entry.name,
}, required: entry.required,
}, selector: { object: {} },
} }
: entry : entry.type === "float" || entry.type === "integer"
? {
name: entry.name,
required: entry.required,
selector: {
number: {
mode: "box",
step: entry.type === "float" ? "any" : undefined,
},
},
}
: entry
) )
); );

View File

@ -17,8 +17,11 @@ class SupervisorFormfieldLabel extends LitElement {
${this.imageUrl ${this.imageUrl
? html`<img loading="lazy" alt="" src=${this.imageUrl} class="icon" />` ? html`<img loading="lazy" alt="" src=${this.imageUrl} class="icon" />`
: this.iconPath : this.iconPath
? html`<ha-svg-icon .path=${this.iconPath} class="icon"></ha-svg-icon>` ? html`<ha-svg-icon
: ""} .path=${this.iconPath}
class="icon"
></ha-svg-icon>`
: ""}
<span class="label">${this.label}</span> <span class="label">${this.label}</span>
${this.version ${this.version
? html`<span class="version">(${this.version})</span>` ? html`<span class="version">(${this.version})</span>`

View File

@ -68,17 +68,19 @@ class HassioAddons extends LitElement {
.iconTitle=${addon.state !== "started" .iconTitle=${addon.state !== "started"
? this.supervisor.localize("dashboard.addon_stopped") ? this.supervisor.localize("dashboard.addon_stopped")
: addon.update_available! : addon.update_available!
? this.supervisor.localize( ? this.supervisor.localize(
"dashboard.addon_new_version" "dashboard.addon_new_version"
) )
: this.supervisor.localize("dashboard.addon_running")} : this.supervisor.localize(
"dashboard.addon_running"
)}
.iconClass=${addon.update_available .iconClass=${addon.update_available
? addon.state === "started" ? addon.state === "started"
? "update" ? "update"
: "update stopped" : "update stopped"
: addon.state === "started" : addon.state === "started"
? "running" ? "running"
: "stopped"} : "stopped"}
.iconImage=${atLeastVersion( .iconImage=${atLeastVersion(
this.hass.config.version, this.hass.config.version,
0, 0,

View File

@ -105,12 +105,12 @@ class HassioDatadiskDialog extends LitElement {
</ha-select> </ha-select>
` `
: this.devices === undefined : this.devices === undefined
? this.dialogParams.supervisor.localize( ? this.dialogParams.supervisor.localize(
"dialog.datadisk_move.loading_devices" "dialog.datadisk_move.loading_devices"
) )
: this.dialogParams.supervisor.localize( : this.dialogParams.supervisor.localize(
"dialog.datadisk_move.no_devices" "dialog.datadisk_move.no_devices"
)} )}
<mwc-button <mwc-button
slot="secondaryAction" slot="secondaryAction"

View File

@ -67,8 +67,8 @@ class HassioRouter extends HassRouterPage {
const route = hassioPanel const route = hassioPanel
? this.route ? this.route
: ingressPanel && this.panel.config?.ingress : ingressPanel && this.panel.config?.ingress
? this._ingressRoute(this.panel.config?.ingress) ? this._ingressRoute(this.panel.config?.ingress)
: this.routeTail; : this.routeTail;
el.hass = this.hass; el.hass = this.hass;
el.narrow = this.narrow; el.narrow = this.narrow;

View File

@ -109,19 +109,19 @@ class HassioSupervisorInfo extends LitElement {
</ha-progress-button> </ha-progress-button>
` `
: this.supervisor.supervisor.channel === "stable" : this.supervisor.supervisor.channel === "stable"
? html` ? html`
<ha-progress-button <ha-progress-button
@click=${this._toggleBeta} @click=${this._toggleBeta}
.title=${this.supervisor.localize( .title=${this.supervisor.localize(
"system.supervisor.join_beta_description" "system.supervisor.join_beta_description"
)} )}
> >
${this.supervisor.localize( ${this.supervisor.localize(
"system.supervisor.join_beta_action" "system.supervisor.join_beta_action"
)} )}
</ha-progress-button> </ha-progress-button>
` `
: ""} : ""}
</ha-settings-row> </ha-settings-row>
${this.supervisor.supervisor.supported ${this.supervisor.supervisor.supported

View File

@ -70,8 +70,8 @@ const changelogUrl = (
return version.includes("dev") return version.includes("dev")
? "https://github.com/home-assistant/core/commits/dev" ? "https://github.com/home-assistant/core/commits/dev"
: version.includes("b") : version.includes("b")
? "https://next.home-assistant.io/latest-release-notes/" ? "https://next.home-assistant.io/latest-release-notes/"
: "https://www.home-assistant.io/latest-release-notes/"; : "https://www.home-assistant.io/latest-release-notes/";
} }
if (entry === "os") { if (entry === "os") {
return version.includes("dev") return version.includes("dev")
@ -141,44 +141,47 @@ class UpdateAvailableCard extends LitElement {
})} })}
</p>` </p>`
: !this._updating : !this._updating
? html` ? html`
${this._changelogContent ${this._changelogContent
? html` ? html`
<ha-faded> <ha-faded>
<ha-markdown .content=${this._changelogContent}> <ha-markdown .content=${this._changelogContent}>
</ha-markdown> </ha-markdown>
</ha-faded> </ha-faded>
` `
: ""} : ""}
<div class="versions"> <div class="versions">
<p> <p>
${this.supervisor.localize("update_available.description", { ${this.supervisor.localize(
"update_available.description",
{
name: this._name,
version: this._version,
newest_version: this._version_latest,
}
)}
</p>
</div>
${["core", "addon"].includes(this._updateType)
? html`
<ha-formfield
.label=${this.supervisor.localize(
"update_available.create_backup"
)}
>
<ha-checkbox checked></ha-checkbox>
</ha-formfield>
`
: ""}
`
: html`<ha-circular-progress alt="Updating" size="large" active>
</ha-circular-progress>
<p class="progress-text">
${this.supervisor.localize("update_available.updating", {
name: this._name, name: this._name,
version: this._version, version: this._version_latest,
newest_version: this._version_latest,
})} })}
</p> </p>`}
</div>
${["core", "addon"].includes(this._updateType)
? html`
<ha-formfield
.label=${this.supervisor.localize(
"update_available.create_backup"
)}
>
<ha-checkbox checked></ha-checkbox>
</ha-formfield>
`
: ""}
`
: html`<ha-circular-progress alt="Updating" size="large" active>
</ha-circular-progress>
<p class="progress-text">
${this.supervisor.localize("update_available.updating", {
name: this._name,
version: this._version_latest,
})}
</p>`}
</div> </div>
${this._version !== this._version_latest && !this._updating ${this._version !== this._version_latest && !this._updating
? html` ? html`

View File

@ -229,7 +229,7 @@
"object-hash": "3.0.0", "object-hash": "3.0.0",
"open": "9.1.0", "open": "9.1.0",
"pinst": "3.0.0", "pinst": "3.0.0",
"prettier": "3.0.3", "prettier": "3.1.0",
"rollup": "2.79.1", "rollup": "2.79.1",
"rollup-plugin-string": "3.0.0", "rollup-plugin-string": "3.0.0",
"rollup-plugin-terser": "7.0.2", "rollup-plugin-terser": "7.0.2",

View File

@ -41,8 +41,8 @@ export class HaAuthFormString extends HaFormString {
!this.isPassword !this.isPassword
? this.stringType ? this.stringType
: this.unmaskedPassword : this.unmaskedPassword
? "text" ? "text"
: "password" : "password"
} }
.label=${this.label} .label=${this.label}
.value=${this.data || ""} .value=${this.data || ""}

View File

@ -10,10 +10,10 @@ const isLoadedIntegration = (hass: HomeAssistant, page: PageNavigation) =>
page.component page.component
? isComponentLoaded(hass, page.component) ? isComponentLoaded(hass, page.component)
: page.components : page.components
? page.components.some((integration) => ? page.components.some((integration) =>
isComponentLoaded(hass, integration) isComponentLoaded(hass, integration)
) )
: true; : true;
const isCore = (page: PageNavigation) => page.core; const isCore = (page: PageNavigation) => page.core;
const isAdvancedPage = (page: PageNavigation) => page.advancedOnly; const isAdvancedPage = (page: PageNavigation) => page.advancedOnly;
const userWantsAdvanced = (hass: HomeAssistant) => hass.userData?.showAdvanced; const userWantsAdvanced = (hass: HomeAssistant) => hass.userData?.showAdvanced;

View File

@ -4,5 +4,5 @@ export const mainWindow =
window.name === MAIN_WINDOW_NAME window.name === MAIN_WINDOW_NAME
? window ? window
: parent.name === MAIN_WINDOW_NAME : parent.name === MAIN_WINDOW_NAME
? parent ? parent
: top!; : top!;

View File

@ -225,8 +225,8 @@ export const computeStateDisplayFromEntityAttributes = (
: localize("ui.card.update.installing") : localize("ui.card.update.installing")
: attributes.latest_version : attributes.latest_version
: attributes.skipped_version === attributes.latest_version : attributes.skipped_version === attributes.latest_version
? attributes.latest_version ?? localize("state.default.unavailable") ? attributes.latest_version ?? localize("state.default.unavailable")
: localize("ui.card.update.up_to_date"); : localize("ui.card.update.up_to_date");
} }
return ( return (

View File

@ -100,8 +100,8 @@ export const domainIconWithoutDefault = (
return compareState === "unavailable" return compareState === "unavailable"
? mdiRobotConfused ? mdiRobotConfused
: compareState === "off" : compareState === "off"
? mdiRobotOff ? mdiRobotOff
: mdiRobot; : mdiRobot;
case "binary_sensor": case "binary_sensor":
return binarySensorIcon(compareState, stateObj); return binarySensorIcon(compareState, stateObj);

View File

@ -40,15 +40,15 @@ export class HaProgressButton extends LitElement {
${this._result === "success" ${this._result === "success"
? html`<ha-svg-icon .path=${mdiCheckBold}></ha-svg-icon>` ? html`<ha-svg-icon .path=${mdiCheckBold}></ha-svg-icon>`
: this._result === "error" : this._result === "error"
? html`<ha-svg-icon .path=${mdiAlertOctagram}></ha-svg-icon>` ? html`<ha-svg-icon .path=${mdiAlertOctagram}></ha-svg-icon>`
: this.progress : this.progress
? html` ? html`
<ha-circular-progress <ha-circular-progress
size="small" size="small"
active active
></ha-circular-progress> ></ha-circular-progress>
` `
: ""} : ""}
</div> </div>
`} `}
`; `;

View File

@ -161,8 +161,8 @@ export class StateHistoryChartTimeline extends LitElement {
const yWidth = this.showNames const yWidth = this.showNames
? y.width ?? 0 ? y.width ?? 0
: computeRTL(this.hass) : computeRTL(this.hass)
? 0 ? 0
: y.left ?? 0; : y.left ?? 0;
if ( if (
this._yWidth !== Math.floor(yWidth) && this._yWidth !== Math.floor(yWidth) &&
y.ticks.length === this.data.length y.ticks.length === this.data.length

View File

@ -400,8 +400,8 @@ export class StatisticsChart extends LitElement {
? type === "min" && hasMean ? type === "min" && hasMean
? "+1" ? "+1"
: type === "max" : type === "max"
? "-1" ? "-1"
: false : false
: false, : false,
borderColor: borderColor:
band && hasMean ? color + (this.hideLegend ? "00" : "7F") : color, band && hasMean ? color + (this.hideLegend ? "00" : "7F") : color,

View File

@ -40,8 +40,8 @@ export class TextBarElement extends BarElement {
(options?.backgroundColor === "transparent" (options?.backgroundColor === "transparent"
? "transparent" ? "transparent"
: luminosity(hex2rgb(options.backgroundColor)) > 0.5 : luminosity(hex2rgb(options.backgroundColor)) > 0.5
? "#000" ? "#000"
: "#fff"); : "#fff");
// ctx.font = "12px arial"; // ctx.font = "12px arial";
ctx.fillStyle = textColor; ctx.fillStyle = textColor;

View File

@ -112,9 +112,9 @@ export class HaStateLabelBadge extends LitElement {
const image = this.icon const image = this.icon
? "" ? ""
: this.image : this.image
? this.image ? this.image
: entityState.attributes.entity_picture_local || : entityState.attributes.entity_picture_local ||
entityState.attributes.entity_picture; entityState.attributes.entity_picture;
const value = const value =
!image && !showIcon !image && !showIcon
? this._computeValue(domain, entityState, entry) ? this._computeValue(domain, entityState, entry)
@ -186,12 +186,12 @@ export class HaStateLabelBadge extends LitElement {
entityState.state === UNAVAILABLE entityState.state === UNAVAILABLE
? "—" ? "—"
: isNumericState(entityState) : isNumericState(entityState)
? formatNumber( ? formatNumber(
entityState.state, entityState.state,
this.hass!.locale, this.hass!.locale,
getNumberFormatOptions(entityState, entry) getNumberFormatOptions(entityState, entry)
) )
: this.hass!.formatEntityState(entityState); : this.hass!.formatEntityState(entityState);
} }
} }

View File

@ -85,8 +85,8 @@ export class HaCameraStream extends LitElement {
.src=${__DEMO__ .src=${__DEMO__
? this.stateObj.attributes.entity_picture! ? this.stateObj.attributes.entity_picture!
: this._connected : this._connected
? computeMJPEGStreamUrl(this.stateObj) ? computeMJPEGStreamUrl(this.stateObj)
: ""} : ""}
.alt=${`Preview of the ${computeStateName(this.stateObj)} camera.`} .alt=${`Preview of the ${computeStateName(this.stateObj)} camera.`}
/>`; />`;
} }

View File

@ -436,8 +436,8 @@ export class HaControlCircularSlider extends LitElement {
mode === "end" mode === "end"
? target <= current ? target <= current
: mode === "start" : mode === "start"
? current <= target ? current <= target
: false; : false;
const showTarget = value != null; const showTarget = value != null;
@ -453,8 +453,8 @@ export class HaControlCircularSlider extends LitElement {
mode === "full" mode === "full"
? this._strokeDashArc(this.min, this.max) ? this._strokeDashArc(this.min, this.max)
: mode === "end" : mode === "end"
? this._strokeDashArc(target, limit) ? this._strokeDashArc(target, limit)
: this._strokeDashArc(limit, target); : this._strokeDashArc(limit, target);
const targetCircle = showTarget const targetCircle = showTarget
? this._strokeCircleDashArc(target) ? this._strokeCircleDashArc(target)

View File

@ -129,8 +129,8 @@ export class HaControlSelectMenu extends SelectBase {
${icon && "path" in icon ${icon && "path" in icon
? html`<ha-svg-icon .path=${icon.path}></ha-svg-icon>` ? html`<ha-svg-icon .path=${icon.path}></ha-svg-icon>`
: icon && "icon" in icon : icon && "icon" in icon
? html`<ha-icon .path=${icon.icon}></ha-icon>` ? html`<ha-icon .path=${icon.icon}></ha-icon>`
: html`<slot name="icon"></slot>`} : html`<slot name="icon"></slot>`}
</div> </div>
`; `;
} }

View File

@ -184,8 +184,8 @@ export class HaControlSelect extends LitElement {
${option.path ${option.path
? html`<ha-svg-icon .path=${option.path}></ha-svg-icon>` ? html`<ha-svg-icon .path=${option.path}></ha-svg-icon>`
: option.icon : option.icon
? html`<ha-icon .icon=${option.icon}></ha-icon> ` ? html`<ha-icon .icon=${option.icon}></ha-icon> `
: nothing} : nothing}
${option.label && !this.hideLabel ${option.label && !this.hideLabel
? html`<span>${option.label}</span>` ? html`<span>${option.label}</span>`
: nothing} : nothing}

View File

@ -147,8 +147,8 @@ export class HaControlSwitch extends LitElement {
? html`<ha-svg-icon .path=${this.pathOn}></ha-svg-icon>` ? html`<ha-svg-icon .path=${this.pathOn}></ha-svg-icon>`
: html`<slot name="icon-on"></slot>` : html`<slot name="icon-on"></slot>`
: this.pathOff : this.pathOff
? html`<ha-svg-icon .path=${this.pathOff}></ha-svg-icon>` ? html`<ha-svg-icon .path=${this.pathOff}></ha-svg-icon>`
: html`<slot name="icon-off"></slot>`} : html`<slot name="icon-off"></slot>`}
</div> </div>
</div> </div>
`; `;

View File

@ -112,40 +112,40 @@ export class HaFileUpload extends LitElement {
> >
<span class="supports">${this.supports}</span>` <span class="supports">${this.supports}</span>`
: typeof this.value === "string" : typeof this.value === "string"
? html`<div class="row"> ? html`<div class="row">
<div class="value" @click=${this._openFilePicker}> <div class="value" @click=${this._openFilePicker}>
<ha-svg-icon <ha-svg-icon
.path=${this.icon || mdiFileUpload} .path=${this.icon || mdiFileUpload}
></ha-svg-icon> ></ha-svg-icon>
${this.value} ${this.value}
</div> </div>
<ha-icon-button <ha-icon-button
@click=${this._clearValue} @click=${this._clearValue}
.label=${this.hass?.localize("ui.common.delete") || .label=${this.hass?.localize("ui.common.delete") ||
"Delete"} "Delete"}
.path=${mdiDelete} .path=${mdiDelete}
></ha-icon-button> ></ha-icon-button>
</div>` </div>`
: (this.value instanceof FileList : (this.value instanceof FileList
? Array.from(this.value) ? Array.from(this.value)
: ensureArray(this.value) : ensureArray(this.value)
).map( ).map(
(file) => (file) =>
html`<div class="row"> html`<div class="row">
<div class="value" @click=${this._openFilePicker}> <div class="value" @click=${this._openFilePicker}>
<ha-svg-icon <ha-svg-icon
.path=${this.icon || mdiFileUpload} .path=${this.icon || mdiFileUpload}
></ha-svg-icon> ></ha-svg-icon>
${file.name} - ${bytesToString(file.size)} ${file.name} - ${bytesToString(file.size)}
</div> </div>
<ha-icon-button <ha-icon-button
@click=${this._clearValue} @click=${this._clearValue}
.label=${this.hass?.localize("ui.common.delete") || .label=${this.hass?.localize("ui.common.delete") ||
"Delete"} "Delete"}
.path=${mdiDelete} .path=${mdiDelete}
></ha-icon-button> ></ha-icon-button>
</div>` </div>`
)} )}
<input <input
id="input" id="input"
type="file" type="file"

View File

@ -37,8 +37,10 @@ export class HaFormExpendable extends LitElement implements HaFormElement {
${this.schema.icon ${this.schema.icon
? html` <ha-icon .icon=${this.schema.icon}></ha-icon> ` ? html` <ha-icon .icon=${this.schema.icon}></ha-icon> `
: this.schema.iconPath : this.schema.iconPath
? html` <ha-svg-icon .path=${this.schema.iconPath}></ha-svg-icon> ` ? html`
: nothing} <ha-svg-icon .path=${this.schema.iconPath}></ha-svg-icon>
`
: nothing}
${this.schema.title} ${this.schema.title}
</div> </div>
<div class="content"> <div class="content">

View File

@ -53,8 +53,8 @@ export class HaFormString extends LitElement implements HaFormElement {
.type=${!this.isPassword .type=${!this.isPassword
? this.stringType ? this.stringType
: this.unmaskedPassword : this.unmaskedPassword
? "text" ? "text"
: "password"} : "password"}
.label=${this.label} .label=${this.label}
.value=${this.data || ""} .value=${this.data || ""}
.helper=${this.helper} .helper=${this.helper}

View File

@ -115,12 +115,12 @@ export class HaForm extends LitElement implements HaFormElement {
</ha-alert> </ha-alert>
` `
: warning : warning
? html` ? html`
<ha-alert own-margin alert-type="warning"> <ha-alert own-margin alert-type="warning">
${this._computeWarning(warning, item)} ${this._computeWarning(warning, item)}
</ha-alert> </ha-alert>
` `
: ""} : ""}
${"selector" in item ${"selector" in item
? html`<ha-selector ? html`<ha-selector
.schema=${item} .schema=${item}
@ -204,8 +204,8 @@ export class HaForm extends LitElement implements HaFormElement {
return this.computeLabel return this.computeLabel
? this.computeLabel(schema, data) ? this.computeLabel(schema, data)
: schema : schema
? schema.name ? schema.name
: ""; : "";
} }
private _computeHelper(schema: HaFormSchema) { private _computeHelper(schema: HaFormSchema) {

View File

@ -141,8 +141,8 @@ export class Gauge extends LitElement {
this._segment_label this._segment_label
? "" ? ""
: this.label === "%" : this.label === "%"
? blankBeforePercent(this.locale) + "%" ? blankBeforePercent(this.locale) + "%"
: ` ${this.label}` : ` ${this.label}`
} }
</text> </text>
</svg>`; </svg>`;

View File

@ -71,23 +71,23 @@ export class HaIconOverflowMenu extends LitElement {
item.narrowOnly item.narrowOnly
? "" ? ""
: item.divider : item.divider
? html`<div role="separator"></div>` ? html`<div role="separator"></div>`
: html`<div> : html`<div>
${item.tooltip ${item.tooltip
? html`<simple-tooltip ? html`<simple-tooltip
animation-delay="0" animation-delay="0"
position="left" position="left"
> >
${item.tooltip} ${item.tooltip}
</simple-tooltip>` </simple-tooltip>`
: ""} : ""}
<ha-icon-button <ha-icon-button
@click=${item.action} @click=${item.action}
.label=${item.label} .label=${item.label}
.path=${item.path} .path=${item.path}
?disabled=${item.disabled} ?disabled=${item.disabled}
></ha-icon-button> ></ha-icon-button>
</div> ` </div> `
)} )}
`} `}
`; `;

View File

@ -120,11 +120,11 @@ export class HaIconPicker extends LitElement {
</ha-icon> </ha-icon>
` `
: this.fallbackPath : this.fallbackPath
? html`<ha-svg-icon ? html`<ha-svg-icon
.path=${this.fallbackPath} .path=${this.fallbackPath}
slot="icon" slot="icon"
></ha-svg-icon>` ></ha-svg-icon>`
: ""} : ""}
</ha-combo-box> </ha-combo-box>
`; `;
} }

View File

@ -96,8 +96,8 @@ class HaMountPicker extends LitElement {
.path=${mount.usage === SupervisorMountUsage.MEDIA .path=${mount.usage === SupervisorMountUsage.MEDIA
? mdiPlayBox ? mdiPlayBox
: mount.usage === SupervisorMountUsage.SHARE : mount.usage === SupervisorMountUsage.SHARE
? mdiFolder ? mdiFolder
: mdiBackupRestore} : mdiBackupRestore}
></ha-svg-icon> ></ha-svg-icon>
</ha-list-item>` </ha-list-item>`
)} )}

View File

@ -145,13 +145,13 @@ export class HaMediaSelector extends LitElement {
.path=${!this.value?.media_content_id .path=${!this.value?.media_content_id
? mdiPlus ? mdiPlus
: this.value?.metadata?.media_class : this.value?.metadata?.media_class
? MediaClassBrowserSettings[ ? MediaClassBrowserSettings[
this.value.metadata.media_class === "directory" this.value.metadata.media_class === "directory"
? this.value.metadata.children_media_class || ? this.value.metadata.children_media_class ||
this.value.metadata.media_class this.value.metadata.media_class
: this.value.metadata.media_class : this.value.metadata.media_class
].icon ].icon
: mdiPlayBox} : mdiPlayBox}
></ha-svg-icon> ></ha-svg-icon>
</div> </div>
`} `}

View File

@ -414,17 +414,17 @@ export class HaServiceControl extends LitElement {
></ha-selector ></ha-selector
></ha-settings-row>` ></ha-settings-row>`
: entityId : entityId
? html`<ha-entity-picker ? html`<ha-entity-picker
.hass=${this.hass} .hass=${this.hass}
.disabled=${this.disabled} .disabled=${this.disabled}
.value=${this._value?.data?.entity_id} .value=${this._value?.data?.entity_id}
.label=${this.hass.localize( .label=${this.hass.localize(
`component.${domain}.services.${serviceName}.fields.entity_id.description` `component.${domain}.services.${serviceName}.fields.entity_id.description`
) || entityId.description} ) || entityId.description}
@value-changed=${this._entityPicked} @value-changed=${this._entityPicked}
allow-custom-entity allow-custom-entity
></ha-entity-picker>` ></ha-entity-picker>`
: ""} : ""}
${shouldRenderServiceDataYaml ${shouldRenderServiceDataYaml
? html`<ha-yaml-editor ? html`<ha-yaml-editor
.hass=${this.hass} .hass=${this.hass}

View File

@ -425,8 +425,8 @@ class HaSidebar extends SubscribeMixin(LitElement) {
panel.url_path === this.hass.defaultPanel && !panel.icon panel.url_path === this.hass.defaultPanel && !panel.icon
? PANEL_ICONS.lovelace ? PANEL_ICONS.lovelace
: panel.url_path in PANEL_ICONS : panel.url_path in PANEL_ICONS
? PANEL_ICONS[panel.url_path] ? PANEL_ICONS[panel.url_path]
: undefined : undefined
) )
); );
} }
@ -499,11 +499,14 @@ class HaSidebar extends SubscribeMixin(LitElement) {
.path=${PANEL_ICONS.lovelace} .path=${PANEL_ICONS.lovelace}
></ha-svg-icon>` ></ha-svg-icon>`
: panel.url_path in PANEL_ICONS : panel.url_path in PANEL_ICONS
? html`<ha-svg-icon ? html`<ha-svg-icon
slot="item-icon" slot="item-icon"
.path=${PANEL_ICONS[panel.url_path]} .path=${PANEL_ICONS[panel.url_path]}
></ha-svg-icon>` ></ha-svg-icon>`
: html`<ha-icon slot="item-icon" .icon=${panel.icon}></ha-icon>`} : html`<ha-icon
slot="item-icon"
.icon=${panel.icon}
></ha-icon>`}
<span class="item-text" <span class="item-text"
>${panel.url_path === this.hass.defaultPanel >${panel.url_path === this.hass.defaultPanel
? this.hass.localize("panel.states") ? this.hass.localize("panel.states")

View File

@ -303,40 +303,40 @@ export class HaTargetPicker extends LitElement {
></ha-area-picker> ></ha-area-picker>
` `
: this._addMode === "device_id" : this._addMode === "device_id"
? html` ? html`
<ha-device-picker <ha-device-picker
.hass=${this.hass} .hass=${this.hass}
id="input" id="input"
.type=${"device_id"} .type=${"device_id"}
.label=${this.hass.localize( .label=${this.hass.localize(
"ui.components.target-picker.add_device_id" "ui.components.target-picker.add_device_id"
)} )}
.deviceFilter=${this.deviceFilter} .deviceFilter=${this.deviceFilter}
.entityFilter=${this.entityFilter} .entityFilter=${this.entityFilter}
.includeDeviceClasses=${this.includeDeviceClasses} .includeDeviceClasses=${this.includeDeviceClasses}
.includeDomains=${this.includeDomains} .includeDomains=${this.includeDomains}
.excludeDevices=${ensureArray(this.value?.device_id)} .excludeDevices=${ensureArray(this.value?.device_id)}
@value-changed=${this._targetPicked} @value-changed=${this._targetPicked}
@click=${this._preventDefault} @click=${this._preventDefault}
></ha-device-picker> ></ha-device-picker>
` `
: html` : html`
<ha-entity-picker <ha-entity-picker
.hass=${this.hass} .hass=${this.hass}
id="input" id="input"
.type=${"entity_id"} .type=${"entity_id"}
.label=${this.hass.localize( .label=${this.hass.localize(
"ui.components.target-picker.add_entity_id" "ui.components.target-picker.add_entity_id"
)} )}
.entityFilter=${this.entityFilter} .entityFilter=${this.entityFilter}
.includeDeviceClasses=${this.includeDeviceClasses} .includeDeviceClasses=${this.includeDeviceClasses}
.includeDomains=${this.includeDomains} .includeDomains=${this.includeDomains}
.excludeEntities=${ensureArray(this.value?.entity_id)} .excludeEntities=${ensureArray(this.value?.entity_id)}
@value-changed=${this._targetPicked} @value-changed=${this._targetPicked}
@click=${this._preventDefault} @click=${this._preventDefault}
allow-custom-entity allow-custom-entity
></ha-entity-picker> ></ha-entity-picker>
`}</mwc-menu-surface `}</mwc-menu-surface
>`; >`;
} }

View File

@ -151,54 +151,54 @@ class DialogMediaManage extends LitElement {
</div> </div>
` `
: !children.length : !children.length
? html`<div class="no-items"> ? html`<div class="no-items">
<p> <p>
${this.hass.localize( ${this.hass.localize(
"ui.components.media-browser.file_management.no_items" "ui.components.media-browser.file_management.no_items"
)} )}
</p> </p>
${this._currentItem?.children?.length ${this._currentItem?.children?.length
? html`<span class="folders" ? html`<span class="folders"
>${this.hass.localize( >${this.hass.localize(
"ui.components.media-browser.file_management.folders_not_supported" "ui.components.media-browser.file_management.folders_not_supported"
)}</span )}</span
>` >`
: ""} : ""}
</div>` </div>`
: html` : html`
<mwc-list multi @selected=${this._handleSelected}> <mwc-list multi @selected=${this._handleSelected}>
${repeat( ${repeat(
children, children,
(item) => item.media_content_id, (item) => item.media_content_id,
(item) => { (item) => {
const icon = html` const icon = html`
<ha-svg-icon <ha-svg-icon
slot="graphic" slot="graphic"
.path=${MediaClassBrowserSettings[ .path=${MediaClassBrowserSettings[
item.media_class === "directory" item.media_class === "directory"
? item.children_media_class || item.media_class ? item.children_media_class || item.media_class
: item.media_class : item.media_class
].icon} ].icon}
></ha-svg-icon> ></ha-svg-icon>
`; `;
return html` return html`
<ha-check-list-item <ha-check-list-item
${animate({ ${animate({
id: item.media_content_id, id: item.media_content_id,
skipInitial: true, skipInitial: true,
})} })}
graphic="icon" graphic="icon"
.disabled=${this._uploading || this._deleting} .disabled=${this._uploading || this._deleting}
.selected=${this._selected.has(fileIndex++)} .selected=${this._selected.has(fileIndex++)}
.item=${item} .item=${item}
> >
${icon} ${item.title} ${icon} ${item.title}
</ha-check-list-item> </ha-check-list-item>
`; `;
} }
)} )}
</mwc-list> </mwc-list>
`} `}
${isComponentLoaded(this.hass, "hassio") ${isComponentLoaded(this.hass, "hassio")
? html`<ha-tip .hass=${this.hass}> ? html`<ha-tip .hass=${this.hass}>
${this.hass.localize( ${this.hass.localize(

View File

@ -445,107 +445,109 @@ export class HaMediaPlayerBrowse extends LitElement {
</div> </div>
` `
: isTTSMediaSource(currentItem.media_content_id) : isTTSMediaSource(currentItem.media_content_id)
? html` ? html`
<ha-browse-media-tts <ha-browse-media-tts
.item=${currentItem} .item=${currentItem}
.hass=${this.hass} .hass=${this.hass}
.action=${this.action} .action=${this.action}
@tts-picked=${this._ttsPicked} @tts-picked=${this._ttsPicked}
></ha-browse-media-tts> ></ha-browse-media-tts>
` `
: !children.length && !currentItem.not_shown : !children.length && !currentItem.not_shown
? html` ? html`
<div class="container no-items"> <div class="container no-items">
${currentItem.media_content_id === ${currentItem.media_content_id ===
"media-source://media_source/local/." "media-source://media_source/local/."
? html` ? html`
<div class="highlight-add-button"> <div class="highlight-add-button">
<span> <span>
<ha-svg-icon <ha-svg-icon
.path=${mdiArrowUpRight} .path=${mdiArrowUpRight}
></ha-svg-icon> ></ha-svg-icon>
</span> </span>
<span> <span>
${this.hass.localize( ${this.hass.localize(
"ui.components.media-browser.file_management.highlight_button" "ui.components.media-browser.file_management.highlight_button"
)} )}
</span> </span>
</div> </div>
` `
: this.hass.localize( : this.hass.localize(
"ui.components.media-browser.no_items" "ui.components.media-browser.no_items"
)}
</div>
`
: childrenMediaClass.layout === "grid"
? html`
<lit-virtualizer
scroller
.layout=${grid({
itemSize: {
width: "175px",
height:
childrenMediaClass.thumbnail_ratio === "portrait"
? "312px"
: "225px",
},
gap: "16px",
flex: { preserve: "aspect-ratio" },
justify: "space-evenly",
direction: "vertical",
})}
.items=${children}
.renderItem=${this._renderGridItem}
class="children ${classMap({
portrait:
childrenMediaClass.thumbnail_ratio === "portrait",
not_shown: !!currentItem.not_shown,
})}"
></lit-virtualizer>
${currentItem.not_shown
? html`
<div class="grid not-shown">
<div class="title">
${this.hass.localize(
"ui.components.media-browser.not_shown",
{ count: currentItem.not_shown }
)} )}
</div> </div>
</div> `
: childrenMediaClass.layout === "grid"
? html`
<lit-virtualizer
scroller
.layout=${grid({
itemSize: {
width: "175px",
height:
childrenMediaClass.thumbnail_ratio ===
"portrait"
? "312px"
: "225px",
},
gap: "16px",
flex: { preserve: "aspect-ratio" },
justify: "space-evenly",
direction: "vertical",
})}
.items=${children}
.renderItem=${this._renderGridItem}
class="children ${classMap({
portrait:
childrenMediaClass.thumbnail_ratio ===
"portrait",
not_shown: !!currentItem.not_shown,
})}"
></lit-virtualizer>
${currentItem.not_shown
? html`
<div class="grid not-shown">
<div class="title">
${this.hass.localize(
"ui.components.media-browser.not_shown",
{ count: currentItem.not_shown }
)}
</div>
</div>
`
: ""}
`
: html`
<mwc-list>
<lit-virtualizer
scroller
.items=${children}
style=${styleMap({
height: `${children.length * 72 + 26}px`,
})}
.renderItem=${this._renderListItem}
></lit-virtualizer>
${currentItem.not_shown
? html`
<mwc-list-item
noninteractive
class="not-shown"
.graphic=${mediaClass.show_list_images
? "medium"
: "avatar"}
dir=${computeRTLDirection(this.hass)}
>
<span class="title">
${this.hass.localize(
"ui.components.media-browser.not_shown",
{ count: currentItem.not_shown }
)}
</span>
</mwc-list-item>
`
: ""}
</mwc-list>
` `
: ""}
`
: html`
<mwc-list>
<lit-virtualizer
scroller
.items=${children}
style=${styleMap({
height: `${children.length * 72 + 26}px`,
})}
.renderItem=${this._renderListItem}
></lit-virtualizer>
${currentItem.not_shown
? html`
<mwc-list-item
noninteractive
class="not-shown"
.graphic=${mediaClass.show_list_images
? "medium"
: "avatar"}
dir=${computeRTLDirection(this.hass)}
>
<span class="title">
${this.hass.localize(
"ui.components.media-browser.not_shown",
{ count: currentItem.not_shown }
)}
</span>
</mwc-list-item>
`
: ""}
</mwc-list>
`
} }
</div> </div>
</div> </div>

View File

@ -62,8 +62,8 @@ export class HaTracePathDetails extends LitElement {
${this._view === "config" ${this._view === "config"
? this._renderSelectedConfig() ? this._renderSelectedConfig()
: this._view === "changed_variables" : this._view === "changed_variables"
? this._renderChangedVars() ? this._renderChangedVars()
: this._renderLogbook()} : this._renderLogbook()}
`; `;
} }
@ -134,8 +134,8 @@ export class HaTracePathDetails extends LitElement {
? html`Result: ? html`Result:
<pre>${dump(result)}</pre>` <pre>${dump(result)}</pre>`
: error : error
? html`<div class="error">Error: ${error}</div>` ? html`<div class="error">Error: ${error}</div>`
: ""} : ""}
${Object.keys(rest).length === 0 ${Object.keys(rest).length === 0
? "" ? ""
: html`<pre>${dump(rest)}</pre>`} : html`<pre>${dump(rest)}</pre>`}

View File

@ -389,8 +389,8 @@ const tryDescribeTrigger = (
typeof at !== "string" typeof at !== "string"
? at ? at
: at.includes(".") : at.includes(".")
? `entity ${hass.states[at] ? computeStateName(hass.states[at]) : at}` ? `entity ${hass.states[at] ? computeStateName(hass.states[at]) : at}`
: localizeTimeString(at, hass.locale, hass.config) : localizeTimeString(at, hass.locale, hass.config)
); );
return hass.localize(`${triggerTranslationBaseKey}.time.description.full`, { return hass.localize(`${triggerTranslationBaseKey}.time.description.full`, {
@ -411,10 +411,10 @@ const tryDescribeTrigger = (
const seconds = seconds_all const seconds = seconds_all
? 0 ? 0
: typeof trigger.seconds === "number" : typeof trigger.seconds === "number"
? trigger.seconds ? trigger.seconds
: seconds_interval : seconds_interval
? parseInt(trigger.seconds.substring(1)) ? parseInt(trigger.seconds.substring(1))
: parseInt(trigger.seconds); : parseInt(trigger.seconds);
if ( if (
isNaN(seconds) || isNaN(seconds) ||
@ -440,10 +440,10 @@ const tryDescribeTrigger = (
const minutes = minutes_all const minutes = minutes_all
? 0 ? 0
: typeof trigger.minutes === "number" : typeof trigger.minutes === "number"
? trigger.minutes ? trigger.minutes
: minutes_interval : minutes_interval
? parseInt(trigger.minutes.substring(1)) ? parseInt(trigger.minutes.substring(1))
: parseInt(trigger.minutes); : parseInt(trigger.minutes);
if ( if (
isNaN(minutes) || isNaN(minutes) ||
@ -477,10 +477,10 @@ const tryDescribeTrigger = (
const hours = hours_all const hours = hours_all
? 0 ? 0
: typeof trigger.hours === "number" : typeof trigger.hours === "number"
? trigger.hours ? trigger.hours
: hours_interval : hours_interval
? parseInt(trigger.hours.substring(1)) ? parseInt(trigger.hours.substring(1))
: parseInt(trigger.hours); : parseInt(trigger.hours);
if ( if (
isNaN(hours) || isNaN(hours) ||
@ -919,23 +919,23 @@ const tryDescribeCondition = (
typeof condition.before !== "string" typeof condition.before !== "string"
? condition.before ? condition.before
: condition.before.includes(".") : condition.before.includes(".")
? `entity ${ ? `entity ${
hass.states[condition.before] hass.states[condition.before]
? computeStateName(hass.states[condition.before]) ? computeStateName(hass.states[condition.before])
: condition.before : condition.before
}` }`
: localizeTimeString(condition.before, hass.locale, hass.config); : localizeTimeString(condition.before, hass.locale, hass.config);
const after = const after =
typeof condition.after !== "string" typeof condition.after !== "string"
? condition.after ? condition.after
: condition.after.includes(".") : condition.after.includes(".")
? `entity ${ ? `entity ${
hass.states[condition.after] hass.states[condition.after]
? computeStateName(hass.states[condition.after]) ? computeStateName(hass.states[condition.after])
: condition.after : condition.after
}` }`
: localizeTimeString(condition.after, hass.locale, hass.config); : localizeTimeString(condition.after, hass.locale, hass.config);
let localizedDays: string[] = []; let localizedDays: string[] = [];
if (validWeekdays) { if (validWeekdays) {

View File

@ -767,8 +767,8 @@ export const getEnergyGasUnit = (
return unitClass === "energy" return unitClass === "energy"
? "kWh" ? "kWh"
: hass.config.unit_system.length === "km" : hass.config.unit_system.length === "km"
? "m³" ? "m³"
: "ft³"; : "ft³";
}; };
export const getEnergyWaterUnit = (hass: HomeAssistant): string | undefined => export const getEnergyWaterUnit = (hass: HomeAssistant): string | undefined =>

View File

@ -89,8 +89,8 @@ export function computeFanSpeedIcon(
return speed === "on" return speed === "on"
? mdiFan ? mdiFan
: speed === "off" : speed === "off"
? mdiFanOff ? mdiFanOff
: [mdiFanSpeed1, mdiFanSpeed2, mdiFanSpeed3][index - 1]; : [mdiFanSpeed1, mdiFanSpeed2, mdiFanSpeed3][index - 1];
} }
export const FAN_SPEED_COUNT_MAX_FOR_BUTTONS = 4; export const FAN_SPEED_COUNT_MAX_FOR_BUTTONS = 4;

View File

@ -377,8 +377,8 @@ const processLineChartEntities = (
entityId in hassEntities entityId in hassEntities
? hassEntities[entityId].attributes ? hassEntities[entityId].attributes
: "friendly_name" in first.a : "friendly_name" in first.a
? first.a ? first.a
: undefined; : undefined;
data.push({ data.push({
domain, domain,

View File

@ -68,8 +68,8 @@ export const getLightCurrentModeRgbColor = (
entity.attributes.color_mode === LightColorMode.RGBWW entity.attributes.color_mode === LightColorMode.RGBWW
? entity.attributes.rgbww_color ? entity.attributes.rgbww_color
: entity.attributes.color_mode === LightColorMode.RGBW : entity.attributes.color_mode === LightColorMode.RGBW
? entity.attributes.rgbw_color ? entity.attributes.rgbw_color
: entity.attributes.rgb_color; : entity.attributes.rgb_color;
interface LightEntityAttributes extends HassEntityAttributeBase { interface LightEntityAttributes extends HassEntityAttributeBase {
min_color_temp_kelvin?: number; min_color_temp_kelvin?: number;

View File

@ -331,16 +331,16 @@ export const computeMediaControls = (
state === "on" state === "on"
? mdiPlayPause ? mdiPlayPause
: state !== "playing" : state !== "playing"
? mdiPlay ? mdiPlay
: supportsFeature(stateObj, MediaPlayerEntityFeature.PAUSE) : supportsFeature(stateObj, MediaPlayerEntityFeature.PAUSE)
? mdiPause ? mdiPause
: mdiStop, : mdiStop,
action: action:
state !== "playing" state !== "playing"
? "media_play" ? "media_play"
: supportsFeature(stateObj, MediaPlayerEntityFeature.PAUSE) : supportsFeature(stateObj, MediaPlayerEntityFeature.PAUSE)
? "media_pause" ? "media_pause"
: "media_stop", : "media_stop",
}); });
} }
@ -394,8 +394,8 @@ export const computeMediaControls = (
stateAttr.repeat === "all" stateAttr.repeat === "all"
? mdiRepeat ? mdiRepeat
: stateAttr.repeat === "one" : stateAttr.repeat === "one"
? mdiRepeatOnce ? mdiRepeatOnce
: mdiRepeatOff, : mdiRepeatOff,
action: "repeat_set", action: "repeat_set",
}); });
} }
@ -459,18 +459,18 @@ export const handleMediaControlClick = (
shuffle: !stateObj!.attributes.shuffle, shuffle: !stateObj!.attributes.shuffle,
} }
: action === "repeat_set" : action === "repeat_set"
? { ? {
entity_id: stateObj!.entity_id, entity_id: stateObj!.entity_id,
repeat: repeat:
stateObj!.attributes.repeat === "all" stateObj!.attributes.repeat === "all"
? "one" ? "one"
: stateObj!.attributes.repeat === "off" : stateObj!.attributes.repeat === "off"
? "all" ? "all"
: "off", : "off",
} }
: { : {
entity_id: stateObj!.entity_id, entity_id: stateObj!.entity_id,
} }
); );
export const mediaPlayerPlayMedia = ( export const mediaPlayerPlayMedia = (

View File

@ -383,13 +383,13 @@ const getWeatherStateSVG = (
/> />
` `
: state === "partlycloudy" : state === "partlycloudy"
? svg` ? svg`
<path <path
class="sun" class="sun"
d="m14.981 4.2112c0 1.9244-1.56 3.4844-3.484 3.4844-1.9244 0-3.4844-1.56-3.4844-3.4844s1.56-3.484 3.4844-3.484c1.924 0 3.484 1.5596 3.484 3.484" d="m14.981 4.2112c0 1.9244-1.56 3.4844-3.484 3.4844-1.9244 0-3.4844-1.56-3.4844-3.4844s1.56-3.484 3.4844-3.484c1.924 0 3.484 1.5596 3.484 3.484"
/> />
` `
: "" : ""
} }
${ ${
cloudyStates.has(state) cloudyStates.has(state)
@ -524,8 +524,8 @@ export const weatherIcon = (state?: string, nightTime?: boolean): string =>
!state !state
? undefined ? undefined
: nightTime && state === "partlycloudy" : nightTime && state === "partlycloudy"
? mdiWeatherNightPartlyCloudy ? mdiWeatherNightPartlyCloudy
: weatherIcons[state]; : weatherIcons[state];
const EIGHT_HOURS = 28800000; const EIGHT_HOURS = 28800000;
const DAY_IN_MILLISECONDS = 86400000; const DAY_IN_MILLISECONDS = 86400000;

View File

@ -227,107 +227,108 @@ class DataEntryFlowDialog extends LitElement {
></step-flow-loading> ></step-flow-loading>
` `
: this._step === undefined : this._step === undefined
? // When we are going to next step, we render 1 round of empty ? // When we are going to next step, we render 1 round of empty
// to reset the element. // to reset the element.
"" ""
: html` : html`
<div class="dialog-actions"> <div class="dialog-actions">
${([ ${([
"form", "form",
"menu", "menu",
"external", "external",
"progress", "progress",
"data_entry_flow_progressed", "data_entry_flow_progressed",
].includes(this._step?.type as any) && ].includes(this._step?.type as any) &&
this._params.manifest?.is_built_in) || this._params.manifest?.is_built_in) ||
this._params.manifest?.documentation this._params.manifest?.documentation
? html` ? html`
<a <a
href=${this._params.manifest.is_built_in href=${this._params.manifest.is_built_in
? documentationUrl( ? documentationUrl(
this.hass, this.hass,
`/integrations/${this._params.manifest.domain}` `/integrations/${this._params.manifest.domain}`
) )
: this._params?.manifest?.documentation} : this._params?.manifest?.documentation}
target="_blank" target="_blank"
rel="noreferrer noopener" rel="noreferrer noopener"
>
<ha-icon-button
.label=${this.hass.localize("ui.common.help")}
.path=${mdiHelpCircle}
> >
</ha-icon-button <ha-icon-button
></a> .label=${this.hass.localize("ui.common.help")}
.path=${mdiHelpCircle}
>
</ha-icon-button
></a>
`
: ""}
<ha-icon-button
.label=${this.hass.localize(
"ui.panel.config.integrations.config_flow.dismiss"
)}
.path=${mdiClose}
dialogAction="close"
></ha-icon-button>
</div>
${this._step.type === "form"
? html`
<step-flow-form
.flowConfig=${this._params.flowConfig}
.step=${this._step}
.hass=${this.hass}
></step-flow-form>
` `
: ""} : this._step.type === "external"
<ha-icon-button ? html`
.label=${this.hass.localize( <step-flow-external
"ui.panel.config.integrations.config_flow.dismiss" .flowConfig=${this._params.flowConfig}
)} .step=${this._step}
.path=${mdiClose} .hass=${this.hass}
dialogAction="close" ></step-flow-external>
></ha-icon-button> `
</div> : this._step.type === "abort"
${this._step.type === "form" ? html`
? html` <step-flow-abort
<step-flow-form .params=${this._params}
.flowConfig=${this._params.flowConfig} .step=${this._step}
.step=${this._step} .hass=${this.hass}
.hass=${this.hass} .domain=${this._step.handler}
></step-flow-form> ></step-flow-abort>
` `
: this._step.type === "external" : this._step.type === "progress"
? html` ? html`
<step-flow-external <step-flow-progress
.flowConfig=${this._params.flowConfig} .flowConfig=${this._params.flowConfig}
.step=${this._step} .step=${this._step}
.hass=${this.hass} .hass=${this.hass}
></step-flow-external> ></step-flow-progress>
` `
: this._step.type === "abort" : this._step.type === "menu"
? html` ? html`
<step-flow-abort <step-flow-menu
.params=${this._params} .flowConfig=${this._params.flowConfig}
.step=${this._step} .step=${this._step}
.hass=${this.hass} .hass=${this.hass}
.domain=${this._step.handler} ></step-flow-menu>
></step-flow-abort> `
` : this._devices === undefined ||
: this._step.type === "progress" this._areas === undefined
? html` ? // When it's a create entry result, we will fetch device & area registry
<step-flow-progress html`
.flowConfig=${this._params.flowConfig} <step-flow-loading
.step=${this._step} .flowConfig=${this._params.flowConfig}
.hass=${this.hass} .hass=${this.hass}
></step-flow-progress> loadingReason="loading_devices_areas"
` ></step-flow-loading>
: this._step.type === "menu" `
? html` : html`
<step-flow-menu <step-flow-create-entry
.flowConfig=${this._params.flowConfig} .flowConfig=${this._params.flowConfig}
.step=${this._step} .step=${this._step}
.hass=${this.hass} .hass=${this.hass}
></step-flow-menu> .devices=${this._devices}
` .areas=${this._areas}
: this._devices === undefined || this._areas === undefined ></step-flow-create-entry>
? // When it's a create entry result, we will fetch device & area registry `}
html` `}
<step-flow-loading
.flowConfig=${this._params.flowConfig}
.hass=${this.hass}
loadingReason="loading_devices_areas"
></step-flow-loading>
`
: html`
<step-flow-create-entry
.flowConfig=${this._params.flowConfig}
.step=${this._step}
.hass=${this.hass}
.devices=${this._devices}
.areas=${this._areas}
></step-flow-create-entry>
`}
`}
</div> </div>
</ha-dialog> </ha-dialog>
`; `;

View File

@ -66,56 +66,56 @@ class FlowPreviewTemplate extends LitElement {
${!this._listeners ${!this._listeners
? nothing ? nothing
: this._listeners.all : this._listeners.all
? html` ? html`
<p class="all_listeners"> <p class="all_listeners">
${this.hass.localize( ${this.hass.localize(
"ui.dialogs.helper_settings.template.all_listeners" "ui.dialogs.helper_settings.template.all_listeners"
)}
</p>
`
: this._listeners.domains.length || this._listeners.entities.length
? html`
<p>
${this.hass.localize(
"ui.dialogs.helper_settings.template.listeners"
)}
</p>
<ul>
${this._listeners.domains
.sort()
.map(
(domain) => html`
<li>
<b
>${this.hass.localize(
"ui.dialogs.helper_settings.template.domain"
)}</b
>: ${domain}
</li>
`
)} )}
${this._listeners.entities </p>
.sort() `
.map( : this._listeners.domains.length || this._listeners.entities.length
(entity_id) => html` ? html`
<li> <p>
<b ${this.hass.localize(
>${this.hass.localize( "ui.dialogs.helper_settings.template.listeners"
"ui.dialogs.helper_settings.template.entity" )}
)}</b </p>
>: ${entity_id} <ul>
</li> ${this._listeners.domains
` .sort()
)} .map(
</ul> (domain) => html`
` <li>
: !this._listeners.time <b
? html`<p class="all_listeners"> >${this.hass.localize(
${this.hass.localize( "ui.dialogs.helper_settings.template.domain"
"ui.dialogs.helper_settings.template.no_listeners" )}</b
)} >: ${domain}
</p>` </li>
: nothing} `; `
)}
${this._listeners.entities
.sort()
.map(
(entity_id) => html`
<li>
<b
>${this.hass.localize(
"ui.dialogs.helper_settings.template.entity"
)}</b
>: ${entity_id}
</li>
`
)}
</ul>
`
: !this._listeners.time
? html`<p class="all_listeners">
${this.hass.localize(
"ui.dialogs.helper_settings.template.no_listeners"
)}
</p>`
: nothing} `;
} }
private _setPreview = (preview: TemplatePreview) => { private _setPreview = (preview: TemplatePreview) => {

View File

@ -137,36 +137,36 @@ export class DialogEnterCode
value === "" value === ""
? html`<span></span>` ? html`<span></span>`
: value === "clear" : value === "clear"
? html` ? html`
<ha-control-button <ha-control-button
@click=${this._clear} @click=${this._clear}
class="clear" class="clear"
.disabled=${!this._showClearButton} .disabled=${!this._showClearButton}
.label=${this.hass!.localize("ui.common.clear")} .label=${this.hass!.localize("ui.common.clear")}
> >
<ha-svg-icon path=${mdiClose}></ha-svg-icon> <ha-svg-icon path=${mdiClose}></ha-svg-icon>
</ha-control-button> </ha-control-button>
` `
: value === "submit" : value === "submit"
? html` ? html`
<ha-control-button <ha-control-button
@click=${this._submit} @click=${this._submit}
class="submit" class="submit"
.label=${this._dialogParams!.submitText ?? .label=${this._dialogParams!.submitText ??
this.hass!.localize("ui.common.submit")} this.hass!.localize("ui.common.submit")}
> >
<ha-svg-icon path=${mdiCheck}></ha-svg-icon> <ha-svg-icon path=${mdiCheck}></ha-svg-icon>
</ha-control-button> </ha-control-button>
` `
: html` : html`
<ha-control-button <ha-control-button
.value=${value} .value=${value}
@click=${this._numberClick} @click=${this._numberClick}
.label=${value} .label=${value}
> >
${value} ${value}
</ha-control-button> </ha-control-button>
` `
)} )}
</div> </div>
</div> </div>

View File

@ -189,8 +189,8 @@ export class HaMoreInfoClimateTemperature extends LitElement {
{ action: actionLabel } { action: actionLabel }
) )
: action && action !== "off" && action !== "idle" : action && action !== "off" && action !== "idle"
? actionLabel ? actionLabel
: this.hass.localize("ui.dialogs.more_info_control.climate.target")} : this.hass.localize("ui.dialogs.more_info_control.climate.target")}
</p> </p>
`; `;
} }

View File

@ -104,10 +104,10 @@ export class HaMoreInfoHumidifierHumidity extends LitElement {
{ action: actionLabel } { action: actionLabel }
) )
: action && action !== "off" && action !== "idle" : action && action !== "off" && action !== "idle"
? actionLabel ? actionLabel
: this.hass.localize( : this.hass.localize(
"ui.dialogs.more_info_control.humidifier.target" "ui.dialogs.more_info_control.humidifier.target"
)} )}
</p> </p>
`; `;
} }

View File

@ -139,13 +139,13 @@ class MoreInfoCover extends LitElement {
></ha-more-info-cover-toggle> ></ha-more-info-cover-toggle>
` `
: supportsOpenClose || supportsTilt : supportsOpenClose || supportsTilt
? html` ? html`
<ha-more-info-cover-buttons <ha-more-info-cover-buttons
.stateObj=${this.stateObj} .stateObj=${this.stateObj}
.hass=${this.hass} .hass=${this.hass}
></ha-more-info-cover-buttons> ></ha-more-info-cover-buttons>
` `
: nothing} : nothing}
` `
: nothing : nothing
} }

View File

@ -39,8 +39,8 @@ class MoreInfoInputDatetime extends LitElement {
.value=${this.stateObj.state === UNKNOWN .value=${this.stateObj.state === UNKNOWN
? "" ? ""
: this.stateObj.attributes.has_date : this.stateObj.attributes.has_date
? this.stateObj.state.split(" ")[1] ? this.stateObj.state.split(" ")[1]
: this.stateObj.state} : this.stateObj.state}
.locale=${this.hass.locale} .locale=${this.hass.locale}
.disabled=${isUnavailableState(this.stateObj.state)} .disabled=${isUnavailableState(this.stateObj.state)}
@value-changed=${this._timeChanged} @value-changed=${this._timeChanged}

View File

@ -108,11 +108,11 @@ class MoreInfoUpdate extends LitElement {
<ha-markdown .content=${this._releaseNotes}></ha-markdown> <ha-markdown .content=${this._releaseNotes}></ha-markdown>
</ha-faded> ` </ha-faded> `
: this.stateObj.attributes.release_summary : this.stateObj.attributes.release_summary
? html`<hr /> ? html`<hr />
<ha-markdown <ha-markdown
.content=${this.stateObj.attributes.release_summary} .content=${this.stateObj.attributes.release_summary}
></ha-markdown>` ></ha-markdown>`
: ""} : ""}
${supportsFeature(this.stateObj, UPDATE_SUPPORT_BACKUP) ${supportsFeature(this.stateObj, UPDATE_SUPPORT_BACKUP)
? html`<hr /> ? html`<hr />
<ha-formfield <ha-formfield
@ -131,26 +131,26 @@ class MoreInfoUpdate extends LitElement {
${this.stateObj.attributes.auto_update ${this.stateObj.attributes.auto_update
? "" ? ""
: this.stateObj.state === BINARY_STATE_OFF && : this.stateObj.state === BINARY_STATE_OFF &&
this.stateObj.attributes.skipped_version this.stateObj.attributes.skipped_version
? html` ? html`
<mwc-button @click=${this._handleClearSkipped}> <mwc-button @click=${this._handleClearSkipped}>
${this.hass.localize( ${this.hass.localize(
"ui.dialogs.more_info_control.update.clear_skipped" "ui.dialogs.more_info_control.update.clear_skipped"
)} )}
</mwc-button> </mwc-button>
` `
: html` : html`
<mwc-button <mwc-button
@click=${this._handleSkip} @click=${this._handleSkip}
.disabled=${skippedVersion || .disabled=${skippedVersion ||
this.stateObj.state === BINARY_STATE_OFF || this.stateObj.state === BINARY_STATE_OFF ||
updateIsInstalling(this.stateObj)} updateIsInstalling(this.stateObj)}
> >
${this.hass.localize( ${this.hass.localize(
"ui.dialogs.more_info_control.update.skip" "ui.dialogs.more_info_control.update.skip"
)} )}
</mwc-button> </mwc-button>
`} `}
${supportsFeature(this.stateObj, UPDATE_SUPPORT_INSTALL) ${supportsFeature(this.stateObj, UPDATE_SUPPORT_INSTALL)
? html` ? html`
<mwc-button <mwc-button

View File

@ -269,20 +269,20 @@ class MoreInfoWeather extends LitElement {
: this.hass!.localize("ui.card.weather.night")}) : this.hass!.localize("ui.card.weather.night")})
` `
: hourly : hourly
? html` ? html`
${formatTimeWeekday( ${formatTimeWeekday(
new Date(item.datetime), new Date(item.datetime),
this.hass!.locale, this.hass!.locale,
this.hass!.config this.hass!.config
)} )}
` `
: html` : html`
${formatDateWeekdayDay( ${formatDateWeekdayDay(
new Date(item.datetime), new Date(item.datetime),
this.hass!.locale, this.hass!.locale,
this.hass!.config this.hass!.config
)} )}
`} `}
</div> </div>
<div class="templow"> <div class="templow">
${this._showValue(item.templow) ${this._showValue(item.templow)
@ -292,8 +292,8 @@ class MoreInfoWeather extends LitElement {
item.templow item.templow
) )
: hourly : hourly
? "" ? ""
: "—"} : "—"}
</div> </div>
<div class="temp"> <div class="temp">
${this._showValue(item.temperature) ${this._showValue(item.temperature)

View File

@ -429,41 +429,41 @@ export class MoreInfoDialog extends LitElement {
</div> </div>
` `
: this._currView === "info" : this._currView === "info"
? html` ? html`
<ha-more-info-info <ha-more-info-info
dialogInitialFocus dialogInitialFocus
.hass=${this.hass} .hass=${this.hass}
.entityId=${this._entityId} .entityId=${this._entityId}
.entry=${this._entry} .entry=${this._entry}
.editMode=${this._infoEditMode} .editMode=${this._infoEditMode}
></ha-more-info-info> ></ha-more-info-info>
` `
: this._currView === "history" : this._currView === "history"
? html` ? html`
<ha-more-info-history-and-logbook <ha-more-info-history-and-logbook
.hass=${this.hass} .hass=${this.hass}
.entityId=${this._entityId} .entityId=${this._entityId}
></ha-more-info-history-and-logbook> ></ha-more-info-history-and-logbook>
` `
: this._currView === "settings" : this._currView === "settings"
? html` ? html`
<ha-more-info-settings <ha-more-info-settings
.hass=${this.hass} .hass=${this.hass}
.entityId=${this._entityId} .entityId=${this._entityId}
.entry=${this._entry} .entry=${this._entry}
></ha-more-info-settings> ></ha-more-info-settings>
` `
: this._currView === "related" : this._currView === "related"
? html` ? html`
<ha-related-items <ha-related-items
.hass=${this.hass} .hass=${this.hass}
.itemId=${entityId} .itemId=${entityId}
.itemType=${SearchableDomains.has(domain) .itemType=${SearchableDomains.has(domain)
? domain ? domain
: "entity"} : "entity"}
></ha-related-items> ></ha-related-items>
` `
: nothing : nothing
)} )}
</div> </div>
</ha-dialog> </ha-dialog>

View File

@ -84,24 +84,24 @@ export class MoreInfoHistory extends LitElement {
${this._error ${this._error
? html`<div class="errors">${this._error}</div>` ? html`<div class="errors">${this._error}</div>`
: this._statistics : this._statistics
? html`<statistics-chart ? html`<statistics-chart
.hass=${this.hass} .hass=${this.hass}
.isLoadingData=${!this._statistics} .isLoadingData=${!this._statistics}
.statisticsData=${this._statistics} .statisticsData=${this._statistics}
.metadata=${this._metadata} .metadata=${this._metadata}
.statTypes=${statTypes} .statTypes=${statTypes}
.names=${this._statNames} .names=${this._statNames}
hideLegend hideLegend
.showNames=${false} .showNames=${false}
></statistics-chart>` ></statistics-chart>`
: html`<state-history-charts : html`<state-history-charts
up-to-now up-to-now
.hass=${this.hass} .hass=${this.hass}
.historyData=${this._stateHistory} .historyData=${this._stateHistory}
.isLoadingData=${!this._stateHistory} .isLoadingData=${!this._stateHistory}
.showNames=${false} .showNames=${false}
.clickForMoreInfo=${false} .clickForMoreInfo=${false}
></state-history-charts>`}` ></state-history-charts>`}`
: ""}`; : ""}`;
} }

View File

@ -217,35 +217,36 @@ export class QuickBar extends LitElement {
active active
></ha-circular-progress>` ></ha-circular-progress>`
: items.length === 0 : items.length === 0
? html` ? html`
<div class="nothing-found"> <div class="nothing-found">
${this.hass.localize("ui.dialogs.quick-bar.nothing_found")} ${this.hass.localize("ui.dialogs.quick-bar.nothing_found")}
</div> </div>
` `
: html` : html`
<mwc-list> <mwc-list>
${this._opened ${this._opened
? html`<lit-virtualizer ? html`<lit-virtualizer
scroller scroller
@keydown=${this._handleListItemKeyDown} @keydown=${this._handleListItemKeyDown}
@rangechange=${this._handleRangeChanged} @rangechange=${this._handleRangeChanged}
@click=${this._handleItemClick} @click=${this._handleItemClick}
class="ha-scrollbar" class="ha-scrollbar"
style=${styleMap({ style=${styleMap({
height: this._narrow height: this._narrow
? "calc(100vh - 56px)" ? "calc(100vh - 56px)"
: `${Math.min( : `${Math.min(
items.length * (this._commandMode ? 56 : 72) + 26, items.length * (this._commandMode ? 56 : 72) +
500 26,
)}px`, 500
})} )}px`,
.items=${items} })}
.renderItem=${this._renderItem} .items=${items}
> .renderItem=${this._renderItem}
</lit-virtualizer>` >
: ""} </lit-virtualizer>`
</mwc-list> : ""}
`} </mwc-list>
`}
${this._hint ${this._hint
? html`<ha-tip .hass=${this.hass}>${this._hint}</ha-tip>` ? html`<ha-tip .hass=${this.hass}>${this._hint}</ha-tip>`
: ""} : ""}

View File

@ -349,8 +349,8 @@ class ClimateEntity extends Entity {
lowTarget >= current lowTarget >= current
? "heating" ? "heating"
: highTarget <= current : highTarget <= current
? "cooling" ? "cooling"
: "idle"; : "idle";
} }
return state; return state;
} }

View File

@ -57,19 +57,19 @@ class HassSubpage extends LitElement {
></ha-menu-button> ></ha-menu-button>
` `
: this.backPath : this.backPath
? html` ? html`
<a href=${this.backPath}> <a href=${this.backPath}>
<ha-icon-button-arrow-prev
.hass=${this.hass}
></ha-icon-button-arrow-prev>
</a>
`
: html`
<ha-icon-button-arrow-prev <ha-icon-button-arrow-prev
.hass=${this.hass} .hass=${this.hass}
@click=${this._backTapped}
></ha-icon-button-arrow-prev> ></ha-icon-button-arrow-prev>
</a> `}
`
: html`
<ha-icon-button-arrow-prev
.hass=${this.hass}
@click=${this._backTapped}
></ha-icon-button-arrow-prev>
`}
<div class="main-title"><slot name="header">${this.header}</slot></div> <div class="main-title"><slot name="header">${this.header}</slot></div>
<slot name="toolbar-icon"></slot> <slot name="toolbar-icon"></slot>

View File

@ -156,19 +156,19 @@ class HassTabsSubpage extends LitElement {
></ha-menu-button> ></ha-menu-button>
` `
: this.backPath : this.backPath
? html` ? html`
<a href=${this.backPath}> <a href=${this.backPath}>
<ha-icon-button-arrow-prev
.hass=${this.hass}
></ha-icon-button-arrow-prev>
</a>
`
: html`
<ha-icon-button-arrow-prev <ha-icon-button-arrow-prev
.hass=${this.hass} .hass=${this.hass}
@click=${this._backTapped}
></ha-icon-button-arrow-prev> ></ha-icon-button-arrow-prev>
</a> `}
`
: html`
<ha-icon-button-arrow-prev
.hass=${this.hass}
@click=${this._backTapped}
></ha-icon-button-arrow-prev>
`}
${this.narrow || !showTabs ${this.narrow || !showTabs
? html`<div class="main-title"> ? html`<div class="main-title">
<slot name="header">${!showTabs ? tabs[0] : ""}</slot> <slot name="header">${!showTabs ? tabs[0] : ""}</slot>

View File

@ -127,10 +127,10 @@ export class HomeAssistantMain extends LitElement {
dock: ev.detail?.open dock: ev.detail?.open
? "docked" ? "docked"
: ev.detail?.open === false : ev.detail?.open === false
? "auto" ? "auto"
: this.hass.dockedSidebar === "auto" : this.hass.dockedSidebar === "auto"
? "docked" ? "docked"
: "auto", : "auto",
}); });
} }
}); });

View File

@ -342,50 +342,56 @@ export class HaAutomationEditor extends KeyboardShortcutMixin(LitElement) {
></manual-automation-editor> ></manual-automation-editor>
` `
: this._mode === "yaml" : this._mode === "yaml"
? html` ? html`
${this._readOnly ${this._readOnly
? html`<ha-alert alert-type="warning"> ? html`<ha-alert alert-type="warning">
${this.hass.localize(
"ui.panel.config.automation.editor.read_only"
)}
<mwc-button slot="action" @click=${this._duplicate}>
${this.hass.localize( ${this.hass.localize(
"ui.panel.config.automation.editor.migrate" "ui.panel.config.automation.editor.read_only"
)} )}
</mwc-button> <mwc-button
</ha-alert>` slot="action"
: ""} @click=${this._duplicate}
${stateObj?.state === "off" >
? html`
<ha-alert alert-type="info">
${this.hass.localize(
"ui.panel.config.automation.editor.disabled"
)}
<mwc-button slot="action" @click=${this._toggle}>
${this.hass.localize( ${this.hass.localize(
"ui.panel.config.automation.editor.enable" "ui.panel.config.automation.editor.migrate"
)} )}
</mwc-button> </mwc-button>
</ha-alert> </ha-alert>`
` : ""}
: ""} ${stateObj?.state === "off"
<ha-yaml-editor ? html`
.hass=${this.hass} <ha-alert alert-type="info">
.defaultValue=${this._preprocessYaml()} ${this.hass.localize(
.readOnly=${this._readOnly} "ui.panel.config.automation.editor.disabled"
@value-changed=${this._yamlChanged} )}
></ha-yaml-editor> <mwc-button
<ha-card outlined> slot="action"
<div class="card-actions"> @click=${this._toggle}
<mwc-button @click=${this._copyYaml}> >
${this.hass.localize( ${this.hass.localize(
"ui.panel.config.automation.editor.copy_to_clipboard" "ui.panel.config.automation.editor.enable"
)} )}
</mwc-button> </mwc-button>
</div> </ha-alert>
</ha-card> `
` : ""}
: ``} <ha-yaml-editor
.hass=${this.hass}
.defaultValue=${this._preprocessYaml()}
.readOnly=${this._readOnly}
@value-changed=${this._yamlChanged}
></ha-yaml-editor>
<ha-card outlined>
<div class="card-actions">
<mwc-button @click=${this._copyYaml}>
${this.hass.localize(
"ui.panel.config.automation.editor.copy_to_clipboard"
)}
</mwc-button>
</div>
</ha-card>
`
: ``}
</div> </div>
` `
: ""} : ""}

View File

@ -215,104 +215,104 @@ export class HaAutomationTrace extends LitElement {
${this._traces === undefined ${this._traces === undefined
? html`<div class="container">Loading…</div>` ? html`<div class="container">Loading…</div>`
: this._traces.length === 0 : this._traces.length === 0
? html`<div class="container">No traces found</div>` ? html`<div class="container">No traces found</div>`
: this._trace === undefined : this._trace === undefined
? "" ? ""
: html` : html`
<div class="main"> <div class="main">
<div class="graph"> <div class="graph">
<hat-script-graph <hat-script-graph
.trace=${this._trace} .trace=${this._trace}
.selected=${this._selected?.path} .selected=${this._selected?.path}
@graph-node-selected=${this._pickNode} @graph-node-selected=${this._pickNode}
></hat-script-graph> ></hat-script-graph>
</div> </div>
<div class="info"> <div class="info">
<div class="tabs top"> <div class="tabs top">
${[ ${[
["details", "Step Details"], ["details", "Step Details"],
["timeline", "Trace Timeline"], ["timeline", "Trace Timeline"],
["logbook", "Related logbook entries"], ["logbook", "Related logbook entries"],
["config", "Automation Config"], ["config", "Automation Config"],
].map( ].map(
([view, label]) => html` ([view, label]) => html`
<button <button
tabindex="0" tabindex="0"
.view=${view} .view=${view}
class=${classMap({ active: this._view === view })} class=${classMap({ active: this._view === view })}
@click=${this._showTab} @click=${this._showTab}
> >
${label} ${label}
</button> </button>
` `
)} )}
${this._trace.blueprint_inputs ${this._trace.blueprint_inputs
? html` ? html`
<button <button
tabindex="0" tabindex="0"
.view=${"blueprint"} .view=${"blueprint"}
class=${classMap({ class=${classMap({
active: this._view === "blueprint", active: this._view === "blueprint",
})} })}
@click=${this._showTab} @click=${this._showTab}
> >
Blueprint Config Blueprint Config
</button> </button>
` `
: ""} : ""}
</div>
${this._selected === undefined ||
this._logbookEntries === undefined ||
trackedNodes === undefined
? ""
: this._view === "details"
? html`
<ha-trace-path-details
.hass=${this.hass}
.narrow=${this.narrow}
.trace=${this._trace}
.selected=${this._selected}
.logbookEntries=${this._logbookEntries}
.trackedNodes=${trackedNodes}
.renderedNodes=${renderedNodes!}
></ha-trace-path-details>
`
: this._view === "config"
? html`
<ha-trace-config
.hass=${this.hass}
.trace=${this._trace}
></ha-trace-config>
`
: this._view === "logbook"
? html`
<ha-trace-logbook
.hass=${this.hass}
.narrow=${this.narrow}
.trace=${this._trace}
.logbookEntries=${this._logbookEntries}
></ha-trace-logbook>
`
: this._view === "blueprint"
? html`
<ha-trace-blueprint-config
.hass=${this.hass}
.trace=${this._trace}
></ha-trace-blueprint-config>
`
: html`
<ha-trace-timeline
.hass=${this.hass}
.trace=${this._trace}
.logbookEntries=${this._logbookEntries}
.selected=${this._selected}
@value-changed=${this._timelinePathPicked}
></ha-trace-timeline>
`}
</div>
</div> </div>
${this._selected === undefined || `}
this._logbookEntries === undefined ||
trackedNodes === undefined
? ""
: this._view === "details"
? html`
<ha-trace-path-details
.hass=${this.hass}
.narrow=${this.narrow}
.trace=${this._trace}
.selected=${this._selected}
.logbookEntries=${this._logbookEntries}
.trackedNodes=${trackedNodes}
.renderedNodes=${renderedNodes!}
></ha-trace-path-details>
`
: this._view === "config"
? html`
<ha-trace-config
.hass=${this.hass}
.trace=${this._trace}
></ha-trace-config>
`
: this._view === "logbook"
? html`
<ha-trace-logbook
.hass=${this.hass}
.narrow=${this.narrow}
.trace=${this._trace}
.logbookEntries=${this._logbookEntries}
></ha-trace-logbook>
`
: this._view === "blueprint"
? html`
<ha-trace-blueprint-config
.hass=${this.hass}
.trace=${this._trace}
></ha-trace-blueprint-config>
`
: html`
<ha-trace-timeline
.hass=${this.hass}
.trace=${this._trace}
.logbookEntries=${this._logbookEntries}
.selected=${this._selected}
@value-changed=${this._timelinePathPicked}
></ha-trace-timeline>
`}
</div>
</div>
`}
</hass-subpage> </hass-subpage>
`; `;
} }

View File

@ -114,12 +114,12 @@ export class CloudAccount extends SubscribeMixin(LitElement) {
"ui.panel.config.cloud.account.connected" "ui.panel.config.cloud.account.connected"
) )
: this.cloudStatus.cloud === "disconnected" : this.cloudStatus.cloud === "disconnected"
? this.hass.localize( ? this.hass.localize(
"ui.panel.config.cloud.account.not_connected" "ui.panel.config.cloud.account.not_connected"
) )
: this.hass.localize( : this.hass.localize(
"ui.panel.config.cloud.account.connecting" "ui.panel.config.cloud.account.connecting"
)} )}
</div> </div>
</div> </div>

View File

@ -52,16 +52,16 @@ export class CloudRemotePref extends LitElement {
"ui.panel.config.cloud.account.remote.cerificate_error" "ui.panel.config.cloud.account.remote.cerificate_error"
) )
: remote_certificate_status === "loading" : remote_certificate_status === "loading"
? this.hass.localize( ? this.hass.localize(
"ui.panel.config.cloud.account.remote.cerificate_loading" "ui.panel.config.cloud.account.remote.cerificate_loading"
) )
: remote_certificate_status === "loaded" : remote_certificate_status === "loaded"
? this.hass.localize( ? this.hass.localize(
"ui.panel.config.cloud.account.remote.cerificate_loaded" "ui.panel.config.cloud.account.remote.cerificate_loaded"
) )
: this.hass.localize( : this.hass.localize(
"ui.panel.config.cloud.account.remote.access_is_being_prepared" "ui.panel.config.cloud.account.remote.access_is_being_prepared"
)} )}
</div> </div>
</ha-card> </ha-card>
`; `;

View File

@ -59,55 +59,57 @@ export class CloudWebhooks extends LitElement {
</div> </div>
` `
: this._localHooks.length === 0 : this._localHooks.length === 0
? html` ? html`
<div class="body-text"> <div class="body-text">
${this.hass.localize( ${this.hass.localize(
"ui.panel.config.cloud.account.webhooks.no_hooks_yet" "ui.panel.config.cloud.account.webhooks.no_hooks_yet"
)}
<a href="/config/integrations"
>${this.hass.localize(
"ui.panel.config.cloud.account.webhooks.no_hooks_yet_link_integration"
)} )}
</a> <a href="/config/integrations"
${this.hass.localize( >${this.hass.localize(
"ui.panel.config.cloud.account.webhooks.no_hooks_yet2" "ui.panel.config.cloud.account.webhooks.no_hooks_yet_link_integration"
)} )}
<a href="/config/automation/edit/new" </a>
>${this.hass.localize( ${this.hass.localize(
"ui.panel.config.cloud.account.webhooks.no_hooks_yet_link_automation" "ui.panel.config.cloud.account.webhooks.no_hooks_yet2"
)}</a )}
>. <a href="/config/automation/edit/new"
</div> >${this.hass.localize(
` "ui.panel.config.cloud.account.webhooks.no_hooks_yet_link_automation"
: this._localHooks.map( )}</a
(entry) => html` >.
<ha-settings-row .narrow=${this.narrow} .entry=${entry}> </div>
<span slot="heading">
${entry.name}
${entry.domain !== entry.name.toLowerCase()
? ` (${entry.domain})`
: ""}
</span>
<span slot="description">${entry.webhook_id}</span>
${this._progress.includes(entry.webhook_id)
? html`
<div class="progress">
<ha-circular-progress active></ha-circular-progress>
</div>
`
: this._cloudHooks![entry.webhook_id]
? html`
<mwc-button @click=${this._handleManageButton}>
${this.hass!.localize(
"ui.panel.config.cloud.account.webhooks.manage"
)}
</mwc-button>
`
: html`<ha-switch @click=${this._enableWebhook}>
</ha-switch>`}
</ha-settings-row>
` `
)} : this._localHooks.map(
(entry) => html`
<ha-settings-row .narrow=${this.narrow} .entry=${entry}>
<span slot="heading">
${entry.name}
${entry.domain !== entry.name.toLowerCase()
? ` (${entry.domain})`
: ""}
</span>
<span slot="description">${entry.webhook_id}</span>
${this._progress.includes(entry.webhook_id)
? html`
<div class="progress">
<ha-circular-progress
active
></ha-circular-progress>
</div>
`
: this._cloudHooks![entry.webhook_id]
? html`
<mwc-button @click=${this._handleManageButton}>
${this.hass!.localize(
"ui.panel.config.cloud.account.webhooks.manage"
)}
</mwc-button>
`
: html`<ha-switch @click=${this._enableWebhook}>
</ha-switch>`}
</ha-settings-row>
`
)}
<div class="footer"> <div class="footer">
<a <a
href="https://www.nabucasa.com/config/webhooks" href="https://www.nabucasa.com/config/webhooks"

View File

@ -34,8 +34,8 @@ class ConfigAnalytics extends LitElement {
const error = this._error const error = this._error
? this._error ? this._error
: !isComponentLoaded(this.hass, "analytics") : !isComponentLoaded(this.hass, "analytics")
? "Analytics integration not loaded" ? "Analytics integration not loaded"
: undefined; : undefined;
return html` return html`
<ha-card outlined> <ha-card outlined>

View File

@ -164,10 +164,10 @@ class HaConfigSystemNavigation extends LitElement {
const backups: BackupContent[] | HassioBackup[] = isHassioLoaded const backups: BackupContent[] | HassioBackup[] = isHassioLoaded
? await fetchHassioBackups(this.hass) ? await fetchHassioBackups(this.hass)
: isComponentLoaded(this.hass, "backup") : isComponentLoaded(this.hass, "backup")
? await fetchBackupInfo(this.hass).then( ? await fetchBackupInfo(this.hass).then(
(backupData) => backupData.backups (backupData) => backupData.backups
) )
: []; : [];
if (backups.length > 0) { if (backups.length > 0) {
this._latestBackupDate = (backups as any[]).reduce((a, b) => this._latestBackupDate = (backups as any[]).reduce((a, b) =>

View File

@ -167,11 +167,11 @@ export class HaDeviceEntitiesCard extends LitElement {
let name = entry.name let name = entry.name
? stripPrefixFromEntityName(entry.name, this.deviceName.toLowerCase()) ? stripPrefixFromEntityName(entry.name, this.deviceName.toLowerCase())
: entry.has_entity_name : entry.has_entity_name
? entry.original_name || this.deviceName ? entry.original_name || this.deviceName
: stripPrefixFromEntityName( : stripPrefixFromEntityName(
computeStateName(stateObj), computeStateName(stateObj),
this.deviceName.toLowerCase() this.deviceName.toLowerCase()
); );
if (!name) { if (!name) {
name = computeStateName(stateObj); name = computeStateName(stateObj);

View File

@ -113,12 +113,12 @@ export class HaDeviceInfoZWaveJS extends SubscribeMixin(LitElement) {
}.title` }.title`
) )
: this._node.is_secure === false : this._node.is_secure === false
? this.hass.localize( ? this.hass.localize(
"ui.panel.config.zwave_js.security_classes.none.title" "ui.panel.config.zwave_js.security_classes.none.title"
) )
: this.hass.localize( : this.hass.localize(
"ui.panel.config.zwave_js.device_info.unknown" "ui.panel.config.zwave_js.device_info.unknown"
)} )}
</div> </div>
<div> <div>
${this.hass.localize( ${this.hass.localize(

View File

@ -207,10 +207,10 @@ export class HaConfigDevicePage extends LitElement {
entry.entity_category entry.entity_category
? entry.entity_category ? entry.entity_category
: computeDomain(entry.entity_id) === "event" : computeDomain(entry.entity_id) === "event"
? "event" ? "event"
: SENSOR_ENTITIES.includes(computeDomain(entry.entity_id)) : SENSOR_ENTITIES.includes(computeDomain(entry.entity_id))
? "sensor" ? "sensor"
: "control" : "control"
) as Record< ) as Record<
| "control" | "control"
| "event" | "event"

View File

@ -67,10 +67,10 @@ export class DialogEnergyGasSettings
this._costs = this._source.entity_energy_price this._costs = this._source.entity_energy_price
? "entity" ? "entity"
: this._source.number_energy_price : this._source.number_energy_price
? "number" ? "number"
: this._source.stat_cost : this._source.stat_cost
? "statistic" ? "statistic"
: "no-costs"; : "no-costs";
this._energy_units = ( this._energy_units = (
await getSensorDeviceClassConvertibleUnits(this.hass, "energy") await getSensorDeviceClassConvertibleUnits(this.hass, "energy")
).units; ).units;
@ -100,8 +100,8 @@ export class DialogEnergyGasSettings
this._params.allowedGasUnitClass === undefined this._params.allowedGasUnitClass === undefined
? [...(this._gas_units || []), ...(this._energy_units || [])].join(", ") ? [...(this._gas_units || []), ...(this._energy_units || [])].join(", ")
: this._params.allowedGasUnitClass === "energy" : this._params.allowedGasUnitClass === "energy"
? this._energy_units?.join(", ") || "" ? this._energy_units?.join(", ") || ""
: this._gas_units?.join(", ") || ""; : this._gas_units?.join(", ") || "";
const unitPrice = this._pickedDisplayUnit const unitPrice = this._pickedDisplayUnit
? `${this.hass.config.currency}/${this._pickedDisplayUnit}` ? `${this.hass.config.currency}/${this._pickedDisplayUnit}`

View File

@ -59,17 +59,17 @@ export class DialogEnergyGridFlowSettings
this._source = params.source this._source = params.source
? { ...params.source } ? { ...params.source }
: params.direction === "from" : params.direction === "from"
? emptyFlowFromGridSourceEnergyPreference() ? emptyFlowFromGridSourceEnergyPreference()
: emptyFlowToGridSourceEnergyPreference(); : emptyFlowToGridSourceEnergyPreference();
this._costs = this._source.entity_energy_price this._costs = this._source.entity_energy_price
? "entity" ? "entity"
: this._source.number_energy_price : this._source.number_energy_price
? "number" ? "number"
: this._source[ : this._source[
params.direction === "from" ? "stat_cost" : "stat_compensation" params.direction === "from" ? "stat_cost" : "stat_compensation"
] ]
? "statistic" ? "statistic"
: "no-costs"; : "no-costs";
const initialSourceId = const initialSourceId =
this._source[ this._source[

View File

@ -204,13 +204,13 @@ export class DialogEnergySolarSettings
domains.length === 0 domains.length === 0
? [] ? []
: domains.length === 1 : domains.length === 1
? await getConfigEntries(this.hass, { ? await getConfigEntries(this.hass, {
type: ["service"], type: ["service"],
domain: domains[0], domain: domains[0],
}) })
: (await getConfigEntries(this.hass, { type: ["service"] })).filter( : (await getConfigEntries(this.hass, { type: ["service"] })).filter(
(entry) => domains.includes(entry.domain) (entry) => domains.includes(entry.domain)
); );
} }
private _handleForecastChanged(ev: CustomEvent) { private _handleForecastChanged(ev: CustomEvent) {

View File

@ -62,10 +62,10 @@ export class DialogEnergyWaterSettings
this._costs = this._source.entity_energy_price this._costs = this._source.entity_energy_price
? "entity" ? "entity"
: this._source.number_energy_price : this._source.number_energy_price
? "number" ? "number"
: this._source.stat_cost : this._source.stat_cost
? "statistic" ? "statistic"
: "no-costs"; : "no-costs";
this._water_units = ( this._water_units = (
await getSensorDeviceClassConvertibleUnits(this.hass, "water") await getSensorDeviceClassConvertibleUnits(this.hass, "water")
).units; ).units;

View File

@ -86,16 +86,16 @@ export class EntityRegistrySettingsHelper extends LitElement {
this.entry.platform this.entry.platform
) )
: this._item === null : this._item === null
? this.hass.localize("ui.dialogs.helper_settings.yaml_not_editable") ? this.hass.localize("ui.dialogs.helper_settings.yaml_not_editable")
: html` : html`
<span @value-changed=${this._valueChanged}> <span @value-changed=${this._valueChanged}>
${dynamicElement(`ha-${this.entry.platform}-form`, { ${dynamicElement(`ha-${this.entry.platform}-form`, {
hass: this.hass, hass: this.hass,
item: this._item, item: this._item,
entry: this.entry, entry: this.entry,
})} })}
</span> </span>
`} `}
<entity-registry-settings-editor <entity-registry-settings-editor
.hass=${this.hass} .hass=${this.hass}
.entry=${this.entry} .entry=${this.entry}

View File

@ -428,37 +428,37 @@ export class EntityRegistrySettingsEditor extends LitElement {
)} )}
</ha-select>` </ha-select>`
: this.helperConfigEntry?.domain === "switch_as_x" : this.helperConfigEntry?.domain === "switch_as_x"
? html`<ha-select ? html`<ha-select
.label=${this.hass.localize( .label=${this.hass.localize(
"ui.dialogs.entity_registry.editor.switch_as_x" "ui.dialogs.entity_registry.editor.switch_as_x"
)} )}
.value=${this._switchAs} .value=${this._switchAs}
naturalMenuWidth naturalMenuWidth
fixedMenuPosition fixedMenuPosition
@selected=${this._switchAsChanged} @selected=${this._switchAsChanged}
@closed=${stopPropagation} @closed=${stopPropagation}
> >
<ha-list-item value="switch"> <ha-list-item value="switch">
${domainToName(this.hass.localize, "switch")} ${domainToName(this.hass.localize, "switch")}
</ha-list-item> </ha-list-item>
<ha-list-item .value=${domain}> <ha-list-item .value=${domain}>
${domainToName(this.hass.localize, domain)} ${domainToName(this.hass.localize, domain)}
</ha-list-item> </ha-list-item>
<li divider role="separator"></li> <li divider role="separator"></li>
${this._switchAsDomainsSorted( ${this._switchAsDomainsSorted(
SWITCH_AS_DOMAINS, SWITCH_AS_DOMAINS,
this.hass.localize this.hass.localize
).map((entry) => ).map((entry) =>
domain === entry.domain domain === entry.domain
? nothing ? nothing
: html` : html`
<ha-list-item .value=${entry.domain}> <ha-list-item .value=${entry.domain}>
${entry.label} ${entry.label}
</ha-list-item> </ha-list-item>
` `
)} )}
</ha-select>` </ha-select>`
: nothing} : nothing}
${this._deviceClassOptions ${this._deviceClassOptions
? html` ? html`
<ha-select <ha-select

View File

@ -97,21 +97,23 @@ export class EntityRegistrySettings extends SubscribeMixin(LitElement) {
)} )}
</mwc-button>` </mwc-button>`
: this.entry.disabled_by : this.entry.disabled_by
? html`${this.hass!.localize( ? html`${this.hass!.localize(
"ui.dialogs.entity_registry.editor.entity_disabled" "ui.dialogs.entity_registry.editor.entity_disabled"
)}${["user", "integration"].includes(this.entry.disabled_by!) )}${["user", "integration"].includes(
? html`<mwc-button this.entry.disabled_by!
slot="action" )
@click=${this._enableEntry} ? html`<mwc-button
> slot="action"
${this.hass!.localize( @click=${this._enableEntry}
"ui.dialogs.entity_registry.editor.enable_entity" >
)}</mwc-button ${this.hass!.localize(
>` "ui.dialogs.entity_registry.editor.enable_entity"
: ""}` )}</mwc-button
: this.hass!.localize( >`
"ui.dialogs.entity_registry.editor.unavailable" : ""}`
)} : this.hass!.localize(
"ui.dialogs.entity_registry.editor.unavailable"
)}
</ha-alert> </ha-alert>
` `
: ""} : ""}

View File

@ -268,12 +268,12 @@ export class HaConfigEntities extends SubscribeMixin(LitElement) {
.path=${entry.restored .path=${entry.restored
? mdiRestoreAlert ? mdiRestoreAlert
: entry.unavailable : entry.unavailable
? mdiAlertCircle ? mdiAlertCircle
: entry.disabled_by : entry.disabled_by
? mdiCancel ? mdiCancel
: entry.hidden_by : entry.hidden_by
? mdiEyeOff ? mdiEyeOff
: mdiPencilOff} : mdiPencilOff}
></ha-svg-icon> ></ha-svg-icon>
<simple-tooltip animation-delay="0" position="left"> <simple-tooltip animation-delay="0" position="left">
${entry.restored ${entry.restored
@ -281,20 +281,20 @@ export class HaConfigEntities extends SubscribeMixin(LitElement) {
"ui.panel.config.entities.picker.status.restored" "ui.panel.config.entities.picker.status.restored"
) )
: entry.unavailable : entry.unavailable
? this.hass.localize( ? this.hass.localize(
"ui.panel.config.entities.picker.status.unavailable" "ui.panel.config.entities.picker.status.unavailable"
) )
: entry.disabled_by : entry.disabled_by
? this.hass.localize( ? this.hass.localize(
"ui.panel.config.entities.picker.status.disabled" "ui.panel.config.entities.picker.status.disabled"
) )
: entry.hidden_by : entry.hidden_by
? this.hass.localize( ? this.hass.localize(
"ui.panel.config.entities.picker.status.hidden" "ui.panel.config.entities.picker.status.hidden"
) )
: this.hass.localize( : this.hass.localize(
"ui.panel.config.entities.picker.status.readonly" "ui.panel.config.entities.picker.status.readonly"
)} )}
</simple-tooltip> </simple-tooltip>
</div> </div>
` `
@ -426,10 +426,10 @@ export class HaConfigEntities extends SubscribeMixin(LitElement) {
status: restored status: restored
? localize("ui.panel.config.entities.picker.status.restored") ? localize("ui.panel.config.entities.picker.status.restored")
: unavailable : unavailable
? localize("ui.panel.config.entities.picker.status.unavailable") ? localize("ui.panel.config.entities.picker.status.unavailable")
: entry.disabled_by : entry.disabled_by
? localize("ui.panel.config.entities.picker.status.disabled") ? localize("ui.panel.config.entities.picker.status.disabled")
: localize("ui.panel.config.entities.picker.status.ok"), : localize("ui.panel.config.entities.picker.status.ok"),
}); });
} }

View File

@ -439,16 +439,16 @@ class HaConfigHardware extends SubscribeMixin(LitElement) {
</div> </div>
</ha-card>` </ha-card>`
: isComponentLoaded(this.hass, "hardware") : isComponentLoaded(this.hass, "hardware")
? html`<ha-card outlined> ? html`<ha-card outlined>
<div class="card-content"> <div class="card-content">
<div class="value"> <div class="value">
${this.hass.localize( ${this.hass.localize(
"ui.panel.config.hardware.loading_system_data" "ui.panel.config.hardware.loading_system_data"
)} )}
</div>
</div> </div>
</div> </ha-card>`
</ha-card>` : ""}
: ""}
</div> </div>
</hass-subpage> </hass-subpage>
`; `;

View File

@ -161,8 +161,8 @@ class HaCounterForm extends LitElement {
? Number(target.value) ? Number(target.value)
: undefined : undefined
: target.localName === "ha-switch" : target.localName === "ha-switch"
? (ev.target as HaSwitch).checked ? (ev.target as HaSwitch).checked
: ev.detail?.value || target.value; : ev.detail?.value || target.value;
if (this[`_${configValue}`] === value) { if (this[`_${configValue}`] === value) {
return; return;
} }

View File

@ -33,8 +33,8 @@ class HaInputDateTimeForm extends LitElement {
item.has_time && item.has_date item.has_time && item.has_date
? "datetime" ? "datetime"
: item.has_time : item.has_time
? "time" ? "time"
: "date"; : "date";
this._item.has_date = this._item.has_date =
!item.has_date && !item.has_time ? true : item.has_date; !item.has_date && !item.has_time ? true : item.has_date;
} else { } else {

View File

@ -684,25 +684,25 @@ class HaConfigIntegrationPage extends SubscribeMixin(LitElement) {
${this.hass.localize("ui.common.enable")} ${this.hass.localize("ui.common.enable")}
</mwc-button>` </mwc-button>`
: configPanel && : configPanel &&
(item.domain !== "matter" || isDevVersion(this.hass.config.version)) (item.domain !== "matter" || isDevVersion(this.hass.config.version))
? html`<a ? html`<a
slot="meta" slot="meta"
href=${`/${configPanel}?config_entry=${item.entry_id}`} href=${`/${configPanel}?config_entry=${item.entry_id}`}
><mwc-button> ><mwc-button>
${this.hass.localize( ${this.hass.localize(
"ui.panel.config.integrations.config_entry.configure" "ui.panel.config.integrations.config_entry.configure"
)} )}
</mwc-button></a </mwc-button></a
>` >`
: item.supports_options && !stateText : item.supports_options && !stateText
? html` ? html`
<mwc-button slot="meta" @click=${this._showOptions}> <mwc-button slot="meta" @click=${this._showOptions}>
${this.hass.localize( ${this.hass.localize(
"ui.panel.config.integrations.config_entry.configure" "ui.panel.config.integrations.config_entry.configure"
)} )}
</mwc-button> </mwc-button>
` `
: ""} : ""}
<ha-button-menu slot="meta"> <ha-button-menu slot="meta">
<ha-icon-button <ha-icon-button
slot="trigger" slot="trigger"
@ -835,19 +835,19 @@ class HaConfigIntegrationPage extends SubscribeMixin(LitElement) {
></ha-svg-icon> ></ha-svg-icon>
</ha-list-item>` </ha-list-item>`
: item.source !== "system" : item.source !== "system"
? html`<ha-list-item ? html`<ha-list-item
class="warning"
@request-selected=${this._handleDisable}
graphic="icon"
>
${this.hass.localize("ui.common.disable")}
<ha-svg-icon
slot="graphic"
class="warning" class="warning"
.path=${mdiStopCircleOutline} @request-selected=${this._handleDisable}
></ha-svg-icon> graphic="icon"
</ha-list-item>` >
: ""} ${this.hass.localize("ui.common.disable")}
<ha-svg-icon
slot="graphic"
class="warning"
.path=${mdiStopCircleOutline}
></ha-svg-icon>
</ha-list-item>`
: ""}
${item.source !== "system" ${item.source !== "system"
? html`<ha-list-item ? html`<ha-list-item
class="warning" class="warning"

View File

@ -465,57 +465,60 @@ class HaConfigIntegrationsDashboard extends SubscribeMixin(LitElement) {
></ha-integration-card>` ></ha-integration-card>`
) )
: this._filter && : this._filter &&
!configEntriesInProgress.length && !configEntriesInProgress.length &&
!integrations.length && !integrations.length &&
this.configEntries.length this.configEntries.length
? html` ? html`
<div class="empty-message"> <div class="empty-message">
<h1> <h1>
${this.hass.localize( ${this.hass.localize(
"ui.panel.config.integrations.none_found" "ui.panel.config.integrations.none_found"
)} )}
</h1> </h1>
<p> <p>
${this.hass.localize( ${this.hass.localize(
"ui.panel.config.integrations.none_found_detail" "ui.panel.config.integrations.none_found_detail"
)} )}
</p> </p>
<mwc-button <mwc-button
@click=${this._createFlow} @click=${this._createFlow}
unelevated unelevated
.label=${this.hass.localize( .label=${this.hass.localize(
"ui.panel.config.integrations.add_integration" "ui.panel.config.integrations.add_integration"
)} )}
></mwc-button> ></mwc-button>
</div> </div>
` `
: // If we have a filter, never show a card : // If we have a filter, never show a card
this._filter this._filter
? "" ? ""
: // If we're showing 0 cards, show empty state text : // If we're showing 0 cards, show empty state text
(!this._showIgnored || ignoredConfigEntries.length === 0) && (!this._showIgnored || ignoredConfigEntries.length === 0) &&
(!this._showDisabled || disabledConfigEntries.length === 0) && (!this._showDisabled ||
integrations.length === 0 disabledConfigEntries.length === 0) &&
? html` integrations.length === 0
<div class="empty-message"> ? html`
<h1> <div class="empty-message">
${this.hass.localize("ui.panel.config.integrations.none")} <h1>
</h1> ${this.hass.localize(
<p> "ui.panel.config.integrations.none"
${this.hass.localize( )}
"ui.panel.config.integrations.no_integrations" </h1>
)} <p>
</p> ${this.hass.localize(
<mwc-button "ui.panel.config.integrations.no_integrations"
@click=${this._createFlow} )}
unelevated </p>
.label=${this.hass.localize( <mwc-button
"ui.panel.config.integrations.add_integration" @click=${this._createFlow}
)} unelevated
></mwc-button> .label=${this.hass.localize(
</div> "ui.panel.config.integrations.add_integration"
` )}
: ""} ></mwc-button>
</div>
`
: ""}
</div> </div>
<ha-fab <ha-fab
slot="fab" slot="fab"

View File

@ -105,10 +105,10 @@ export class HaIntegrationCard extends LitElement {
`ui.panel.config.integrations.config_entry.state.${entryState}` `ui.panel.config.integrations.config_entry.state.${entryState}`
) )
: debugLoggingEnabled : debugLoggingEnabled
? this.hass.localize( ? this.hass.localize(
"ui.panel.config.integrations.config_entry.debug_logging_enabled" "ui.panel.config.integrations.config_entry.debug_logging_enabled"
) )
: undefined} : undefined}
.manifest=${this.manifest} .manifest=${this.manifest}
> >
</ha-integration-header> </ha-integration-header>
@ -146,26 +146,26 @@ export class HaIntegrationCard extends LitElement {
</ha-button> </ha-button>
</a>` </a>`
: entities.length > 0 : entities.length > 0
? html`<a ? html`<a
href=${`/config/entities?historyBack=1&domain=${this.domain}`} href=${`/config/entities?historyBack=1&domain=${this.domain}`}
> >
<ha-button> <ha-button>
${this.hass.localize( ${this.hass.localize(
`ui.panel.config.integrations.config_entry.entities`, `ui.panel.config.integrations.config_entry.entities`,
"count", "count",
entities.length entities.length
)} )}
</ha-button> </ha-button>
</a>` </a>`
: html`<a href=${`/config/integrations/integration/${this.domain}`}> : html`<a href=${`/config/integrations/integration/${this.domain}`}>
<ha-button> <ha-button>
${this.hass.localize( ${this.hass.localize(
`ui.panel.config.integrations.config_entry.entries`, `ui.panel.config.integrations.config_entry.entries`,
"count", "count",
this.items.length this.items.length
)} )}
</ha-button> </ha-button>
</a>`} </a>`}
<div class="icons"> <div class="icons">
${this.manifest && !this.manifest.is_built_in ${this.manifest && !this.manifest.is_built_in
? html`<span class="icon custom"> ? html`<span class="icon custom">

View File

@ -56,13 +56,13 @@ export class HaIntegrationHeader extends LitElement {
</div> </div>
` `
: this.warning : this.warning
? html` ? html`
<div class="secondary warning"> <div class="secondary warning">
<ha-svg-icon .path=${mdiAlertOutline}></ha-svg-icon> <ha-svg-icon .path=${mdiAlertOutline}></ha-svg-icon>
<span>${this.warning}</span> <span>${this.warning}</span>
</div> </div>
` `
: nothing} : nothing}
</div> </div>
<ha-icon-next <ha-icon-next
class="header-button" class="header-button"

View File

@ -140,40 +140,40 @@ class DialogZHAManageZigbeeDevice extends LitElement {
></zha-manage-clusters> ></zha-manage-clusters>
` `
: this._currTab === "bindings" : this._currTab === "bindings"
? html` ? html`
${this._bindableDevices.length > 0 ${this._bindableDevices.length > 0
? html` ? html`
<zha-device-binding-control <zha-device-binding-control
.hass=${this.hass} .hass=${this.hass}
.device=${this._device} .device=${this._device}
.bindableDevices=${this._bindableDevices} .bindableDevices=${this._bindableDevices}
></zha-device-binding-control> ></zha-device-binding-control>
` `
: ""} : ""}
${this._device && this._groups.length > 0 ${this._device && this._groups.length > 0
? html` ? html`
<zha-group-binding-control <zha-group-binding-control
.hass=${this.hass} .hass=${this.hass}
.device=${this._device} .device=${this._device}
.groups=${this._groups} .groups=${this._groups}
></zha-group-binding-control> ></zha-group-binding-control>
` `
: ""} : ""}
` `
: this._currTab === "signature" : this._currTab === "signature"
? html` ? html`
<zha-device-zigbee-info <zha-device-zigbee-info
.hass=${this.hass} .hass=${this.hass}
.device=${this._device} .device=${this._device}
></zha-device-zigbee-info> ></zha-device-zigbee-info>
` `
: html` : html`
<zha-device-neighbors <zha-device-neighbors
.hass=${this.hass} .hass=${this.hass}
.device=${this._device} .device=${this._device}
.narrow=${!this.large} .narrow=${!this.large}
></zha-device-neighbors> ></zha-device-neighbors>
` `
)} )}
</div> </div>
</ha-dialog> </ha-dialog>

View File

@ -119,76 +119,80 @@ class DialogZWaveJSAddNode extends LitElement {
<ha-circular-progress size="large" active></ha-circular-progress> <ha-circular-progress size="large" active></ha-circular-progress>
</div>` </div>`
: this._status === "choose_strategy" : this._status === "choose_strategy"
? html`<h3>Choose strategy</h3> ? html`<h3>Choose strategy</h3>
<div class="flex-column"> <div class="flex-column">
<ha-formfield <ha-formfield
.label=${html`<b>Secure if possible</b> .label=${html`<b>Secure if possible</b>
<div class="secondary"> <div class="secondary">
Requires user interaction during inclusion. Fast and Requires user interaction during inclusion. Fast and
secure with S2 when supported. Fallback to legacy S0 or no secure with S2 when supported. Fallback to legacy S0 or
encryption when necessary. no encryption when necessary.
</div>`} </div>`}
>
<ha-radio
name="strategy"
@change=${this._handleStrategyChange}
.value=${InclusionStrategy.Default}
.checked=${this._inclusionStrategy ===
InclusionStrategy.Default ||
this._inclusionStrategy === undefined}
> >
</ha-radio> <ha-radio
</ha-formfield> name="strategy"
<ha-formfield @change=${this._handleStrategyChange}
.label=${html`<b>Legacy Secure</b> .value=${InclusionStrategy.Default}
<div class="secondary"> .checked=${this._inclusionStrategy ===
Uses the older S0 security that is secure, but slow due to InclusionStrategy.Default ||
a lot of overhead. Allows securely including S2 capable this._inclusionStrategy === undefined}
devices which fail to be included with S2. >
</div>`} </ha-radio>
> </ha-formfield>
<ha-radio <ha-formfield
name="strategy" .label=${html`<b>Legacy Secure</b>
@change=${this._handleStrategyChange} <div class="secondary">
.value=${InclusionStrategy.Security_S0} Uses the older S0 security that is secure, but slow due
.checked=${this._inclusionStrategy === to a lot of overhead. Allows securely including S2
InclusionStrategy.Security_S0} capable devices which fail to be included with S2.
</div>`}
> >
</ha-radio> <ha-radio
</ha-formfield> name="strategy"
<ha-formfield @change=${this._handleStrategyChange}
.label=${html`<b>Insecure</b> .value=${InclusionStrategy.Security_S0}
<div class="secondary">Do not use encryption.</div>`} .checked=${this._inclusionStrategy ===
> InclusionStrategy.Security_S0}
<ha-radio >
name="strategy" </ha-radio>
@change=${this._handleStrategyChange} </ha-formfield>
.value=${InclusionStrategy.Insecure} <ha-formfield
.checked=${this._inclusionStrategy === .label=${html`<b>Insecure</b>
InclusionStrategy.Insecure} <div class="secondary">Do not use encryption.</div>`}
> >
</ha-radio> <ha-radio
</ha-formfield> name="strategy"
</div> @change=${this._handleStrategyChange}
<mwc-button .value=${InclusionStrategy.Insecure}
slot="primaryAction" .checked=${this._inclusionStrategy ===
@click=${this._startManualInclusion} InclusionStrategy.Insecure}
> >
Search device </ha-radio>
</mwc-button>` </ha-formfield>
: this._status === "qr_scan" </div>
? html`${this._error <mwc-button
? html`<ha-alert alert-type="error">${this._error}</ha-alert>` slot="primaryAction"
: ""} @click=${this._startManualInclusion}
<ha-qr-scanner >
.localize=${this.hass.localize} Search device
@qr-code-scanned=${this._qrCodeScanned} </mwc-button>`
></ha-qr-scanner> : this._status === "qr_scan"
<mwc-button slot="secondaryAction" @click=${this._startOver}> ? html`${this._error
${this.hass.localize("ui.panel.config.zwave_js.common.back")} ? html`<ha-alert alert-type="error"
</mwc-button>` >${this._error}</ha-alert
: this._status === "validate_dsk_enter_pin" >`
? html` : ""}
<ha-qr-scanner
.localize=${this.hass.localize}
@qr-code-scanned=${this._qrCodeScanned}
></ha-qr-scanner>
<mwc-button slot="secondaryAction" @click=${this._startOver}>
${this.hass.localize(
"ui.panel.config.zwave_js.common.back"
)}
</mwc-button>`
: this._status === "validate_dsk_enter_pin"
? html`
<p> <p>
Please enter the 5-digit PIN for your device and verify that Please enter the 5-digit PIN for your device and verify that
the rest of the device-specific key matches the one that can the rest of the device-specific key matches the one that can
@ -217,262 +221,300 @@ class DialogZWaveJSAddNode extends LitElement {
</mwc-button> </mwc-button>
</div> </div>
` `
: this._status === "grant_security_classes" : this._status === "grant_security_classes"
? html` ? html`
<h3>The device has requested the following security classes:</h3> <h3>
${this._error The device has requested the following security classes:
? html`<ha-alert alert-type="error">${this._error}</ha-alert>` </h3>
: ""} ${this._error
<div class="flex-column"> ? html`<ha-alert alert-type="error"
${this._requestedGrant?.securityClasses >${this._error}</ha-alert
.sort() >`
.reverse() : ""}
.map( <div class="flex-column">
(securityClass) => ${this._requestedGrant?.securityClasses
html`<ha-formfield .sort()
.label=${html`<b .reverse()
>${this.hass.localize( .map(
`ui.panel.config.zwave_js.security_classes.${SecurityClass[securityClass]}.title` (securityClass) =>
)}</b html`<ha-formfield
> .label=${html`<b
<div class="secondary"> >${this.hass.localize(
${this.hass.localize( `ui.panel.config.zwave_js.security_classes.${SecurityClass[securityClass]}.title`
`ui.panel.config.zwave_js.security_classes.${SecurityClass[securityClass]}.description` )}</b
)} >
</div>`} <div class="secondary">
> ${this.hass.localize(
<ha-checkbox `ui.panel.config.zwave_js.security_classes.${SecurityClass[securityClass]}.description`
@change=${this._handleSecurityClassChange} )}
.value=${securityClass} </div>`}
.checked=${this._securityClasses.includes( >
securityClass <ha-checkbox
@change=${this._handleSecurityClassChange}
.value=${securityClass}
.checked=${this._securityClasses.includes(
securityClass
)}
>
</ha-checkbox>
</ha-formfield>`
)} )}
</div>
<mwc-button
slot="primaryAction"
.disabled=${!this._securityClasses.length}
@click=${this._grantSecurityClasses}
>
Submit
</mwc-button>
`
: this._status === "timed_out"
? html`
<h3>Timed out!</h3>
<p>
We have not found any device in inclusion mode. Make
sure the device is active and in inclusion mode.
</p>
<mwc-button
slot="primaryAction"
@click=${this._startOver}
> >
</ha-checkbox> Retry
</ha-formfield>`
)}
</div>
<mwc-button
slot="primaryAction"
.disabled=${!this._securityClasses.length}
@click=${this._grantSecurityClasses}
>
Submit
</mwc-button>
`
: this._status === "timed_out"
? html`
<h3>Timed out!</h3>
<p>
We have not found any device in inclusion mode. Make sure the
device is active and in inclusion mode.
</p>
<mwc-button slot="primaryAction" @click=${this._startOver}>
Retry
</mwc-button>
`
: this._status === "started_specific"
? html`<h3>
${this.hass.localize(
"ui.panel.config.zwave_js.add_node.searching_device"
)}
</h3>
<ha-circular-progress active></ha-circular-progress>
<p>
${this.hass.localize(
"ui.panel.config.zwave_js.add_node.follow_device_instructions"
)}
</p>`
: this._status === "started"
? html`
<div class="select-inclusion">
<div class="outline">
<h2>
${this.hass.localize(
"ui.panel.config.zwave_js.add_node.searching_device"
)}
</h2>
<ha-circular-progress active></ha-circular-progress>
<p>
${this.hass.localize(
"ui.panel.config.zwave_js.add_node.follow_device_instructions"
)}
</p>
<p>
<button
class="link"
@click=${this._chooseInclusionStrategy}
>
${this.hass.localize(
"ui.panel.config.zwave_js.add_node.choose_inclusion_strategy"
)}
</button>
</p>
</div>
${this._supportsSmartStart
? html` <div class="outline">
<h2>
${this.hass.localize(
"ui.panel.config.zwave_js.add_node.qr_code"
)}
</h2>
<ha-svg-icon .path=${mdiQrcodeScan}></ha-svg-icon>
<p>
${this.hass.localize(
"ui.panel.config.zwave_js.add_node.qr_code_paragraph"
)}
</p>
<p>
<mwc-button @click=${this._scanQRCode}>
${this.hass.localize(
"ui.panel.config.zwave_js.add_node.scan_qr_code"
)}
</mwc-button> </mwc-button>
</p> `
</div>` : this._status === "started_specific"
: ""} ? html`<h3>
</div> ${this.hass.localize(
<mwc-button slot="primaryAction" @click=${this.closeDialog}> "ui.panel.config.zwave_js.add_node.searching_device"
${this.hass.localize("ui.common.cancel")} )}
</mwc-button> </h3>
` <ha-circular-progress active></ha-circular-progress>
: this._status === "interviewing" <p>
? html` ${this.hass.localize(
<div class="flex-container"> "ui.panel.config.zwave_js.add_node.follow_device_instructions"
<ha-circular-progress active></ha-circular-progress> )}
<div class="status"> </p>`
<p> : this._status === "started"
<b ? html`
>${this.hass.localize( <div class="select-inclusion">
"ui.panel.config.zwave_js.add_node.interview_started" <div class="outline">
)}</b <h2>
> ${this.hass.localize(
</p> "ui.panel.config.zwave_js.add_node.searching_device"
${this._stages )}
? html` <div class="stages"> </h2>
${this._stages.map( <ha-circular-progress
(stage) => html` active
<span class="stage"> ></ha-circular-progress>
<ha-svg-icon <p>
.path=${mdiCheckCircle} ${this.hass.localize(
class="success" "ui.panel.config.zwave_js.add_node.follow_device_instructions"
></ha-svg-icon> )}
${stage} </p>
</span> <p>
<button
class="link"
@click=${this._chooseInclusionStrategy}
>
${this.hass.localize(
"ui.panel.config.zwave_js.add_node.choose_inclusion_strategy"
)}
</button>
</p>
</div>
${this._supportsSmartStart
? html` <div class="outline">
<h2>
${this.hass.localize(
"ui.panel.config.zwave_js.add_node.qr_code"
)}
</h2>
<ha-svg-icon
.path=${mdiQrcodeScan}
></ha-svg-icon>
<p>
${this.hass.localize(
"ui.panel.config.zwave_js.add_node.qr_code_paragraph"
)}
</p>
<p>
<mwc-button @click=${this._scanQRCode}>
${this.hass.localize(
"ui.panel.config.zwave_js.add_node.scan_qr_code"
)}
</mwc-button>
</p>
</div>`
: ""}
</div>
<mwc-button
slot="primaryAction"
@click=${this.closeDialog}
>
${this.hass.localize("ui.common.cancel")}
</mwc-button>
` `
)} : this._status === "interviewing"
</div>` ? html`
: ""} <div class="flex-container">
</div> <ha-circular-progress
</div> active
<mwc-button slot="primaryAction" @click=${this.closeDialog}> ></ha-circular-progress>
${this.hass.localize("ui.common.close")} <div class="status">
</mwc-button> <p>
` <b
: this._status === "failed" >${this.hass.localize(
? html` "ui.panel.config.zwave_js.add_node.interview_started"
<div class="flex-container"> )}</b
<div class="status"> >
<ha-alert </p>
alert-type="error" ${this._stages
.title=${this.hass.localize( ? html` <div class="stages">
"ui.panel.config.zwave_js.add_node.inclusion_failed" ${this._stages.map(
)} (stage) => html`
> <span class="stage">
${this._error || <ha-svg-icon
this.hass.localize( .path=${mdiCheckCircle}
"ui.panel.config.zwave_js.add_node.check_logs" class="success"
)} ></ha-svg-icon>
</ha-alert> ${stage}
${this._stages </span>
? html` <div class="stages"> `
${this._stages.map( )}
(stage) => html` </div>`
<span class="stage"> : ""}
<ha-svg-icon </div>
.path=${mdiCheckCircle} </div>
class="success" <mwc-button
></ha-svg-icon> slot="primaryAction"
${stage} @click=${this.closeDialog}
</span> >
` ${this.hass.localize("ui.common.close")}
)} </mwc-button>
</div>` `
: ""} : this._status === "failed"
</div> ? html`
</div> <div class="flex-container">
<mwc-button slot="primaryAction" @click=${this.closeDialog}> <div class="status">
${this.hass.localize("ui.common.close")} <ha-alert
</mwc-button> alert-type="error"
` .title=${this.hass.localize(
: this._status === "finished" "ui.panel.config.zwave_js.add_node.inclusion_failed"
? html` )}
<div class="flex-container"> >
<ha-svg-icon ${this._error ||
.path=${this._lowSecurity ? mdiAlertCircle : mdiCheckCircle} this.hass.localize(
class=${this._lowSecurity ? "warning" : "success"} "ui.panel.config.zwave_js.add_node.check_logs"
></ha-svg-icon> )}
<div class="status"> </ha-alert>
<p> ${this._stages
${this.hass.localize( ? html` <div class="stages">
"ui.panel.config.zwave_js.add_node.inclusion_finished" ${this._stages.map(
)} (stage) => html`
</p> <span class="stage">
${this._lowSecurity <ha-svg-icon
? html`<ha-alert .path=${mdiCheckCircle}
alert-type="warning" class="success"
title="The device was added insecurely" ></ha-svg-icon>
> ${stage}
There was an error during secure inclusion. You can try </span>
again by excluding the device and adding it again. `
</ha-alert>` )}
: ""} </div>`
<a href=${`/config/devices/device/${this._device!.id}`}> : ""}
<mwc-button> </div>
${this.hass.localize( </div>
"ui.panel.config.zwave_js.add_node.view_device" <mwc-button
)} slot="primaryAction"
</mwc-button> @click=${this.closeDialog}
</a> >
${this._stages ${this.hass.localize("ui.common.close")}
? html` <div class="stages"> </mwc-button>
${this._stages.map( `
(stage) => html` : this._status === "finished"
<span class="stage"> ? html`
<ha-svg-icon <div class="flex-container">
.path=${mdiCheckCircle} <ha-svg-icon
class="success" .path=${this._lowSecurity
></ha-svg-icon> ? mdiAlertCircle
${stage} : mdiCheckCircle}
</span> class=${this._lowSecurity
` ? "warning"
)} : "success"}
</div>` ></ha-svg-icon>
: ""} <div class="status">
</div> <p>
</div> ${this.hass.localize(
<mwc-button slot="primaryAction" @click=${this.closeDialog}> "ui.panel.config.zwave_js.add_node.inclusion_finished"
${this.hass.localize("ui.common.close")} )}
</mwc-button> </p>
` ${this._lowSecurity
: this._status === "provisioned" ? html`<ha-alert
? html` <div class="flex-container"> alert-type="warning"
<ha-svg-icon title="The device was added insecurely"
.path=${mdiCheckCircle} >
class="success" There was an error during secure
></ha-svg-icon> inclusion. You can try again by
<div class="status"> excluding the device and adding it
<p> again.
${this.hass.localize( </ha-alert>`
"ui.panel.config.zwave_js.add_node.provisioning_finished" : ""}
)} <a
</p> href=${`/config/devices/device/${
</div> this._device!.id
</div> }`}
<mwc-button slot="primaryAction" @click=${this.closeDialog}> >
${this.hass.localize("ui.common.close")} <mwc-button>
</mwc-button>` ${this.hass.localize(
: ""} "ui.panel.config.zwave_js.add_node.view_device"
)}
</mwc-button>
</a>
${this._stages
? html` <div class="stages">
${this._stages.map(
(stage) => html`
<span class="stage">
<ha-svg-icon
.path=${mdiCheckCircle}
class="success"
></ha-svg-icon>
${stage}
</span>
`
)}
</div>`
: ""}
</div>
</div>
<mwc-button
slot="primaryAction"
@click=${this.closeDialog}
>
${this.hass.localize("ui.common.close")}
</mwc-button>
`
: this._status === "provisioned"
? html` <div class="flex-container">
<ha-svg-icon
.path=${mdiCheckCircle}
class="success"
></ha-svg-icon>
<div class="status">
<p>
${this.hass.localize(
"ui.panel.config.zwave_js.add_node.provisioning_finished"
)}
</p>
</div>
</div>
<mwc-button
slot="primaryAction"
@click=${this.closeDialog}
>
${this.hass.localize("ui.common.close")}
</mwc-button>`
: ""}
</ha-dialog> </ha-dialog>
`; `;
} }

View File

@ -215,77 +215,77 @@ class DialogZWaveJSUpdateFirmwareNode extends LitElement {
${abortFirmwareUpdateButton} ${abortFirmwareUpdateButton}
` `
: this._updateProgressMessage && !this._updateFinishedMessage : this._updateProgressMessage && !this._updateFinishedMessage
? html` ? html`
<p> <p>
${this.hass.localize( ${this.hass.localize(
"ui.panel.config.zwave_js.update_firmware.in_progress", "ui.panel.config.zwave_js.update_firmware.in_progress",
{ {
device: html`<strong>${this._deviceName}</strong>`, device: html`<strong>${this._deviceName}</strong>`,
progress: ( progress: (
(this._updateProgressMessage.sent_fragments * 100) / (this._updateProgressMessage.sent_fragments * 100) /
this._updateProgressMessage.total_fragments this._updateProgressMessage.total_fragments
).toFixed(2), ).toFixed(2),
} }
)} )}
</p> </p>
<mwc-linear-progress <mwc-linear-progress
determinate determinate
.progress=${this._updateProgressMessage.sent_fragments / .progress=${this._updateProgressMessage.sent_fragments /
this._updateProgressMessage.total_fragments} this._updateProgressMessage.total_fragments}
></mwc-linear-progress> ></mwc-linear-progress>
<p> <p>
${this.hass.localize( ${this.hass.localize(
"ui.panel.config.zwave_js.update_firmware.close", "ui.panel.config.zwave_js.update_firmware.close",
{ {
device: html`<strong>${this._deviceName}</strong>`, device: html`<strong>${this._deviceName}</strong>`,
} }
)} )}
</p> </p>
${abortFirmwareUpdateButton} ${abortFirmwareUpdateButton}
` `
: html` : html`
<div class="flex-container"> <div class="flex-container">
<ha-svg-icon <ha-svg-icon
.path=${this._updateFinishedMessage!.success .path=${this._updateFinishedMessage!.success
? mdiCheckCircle ? mdiCheckCircle
: mdiCloseCircle} : mdiCloseCircle}
.class=${status} .class=${status}
></ha-svg-icon> ></ha-svg-icon>
<div class="status"> <div class="status">
<p> <p>
${this.hass.localize(
`ui.panel.config.zwave_js.update_firmware.finished_status.${status}`,
{
device: html`<strong>${this._deviceName}</strong>`,
message: this.hass.localize(
`ui.panel.config.zwave_js.update_firmware.finished_status.${
this._nodeStatus.is_controller_node
? ControllerFirmwareUpdateStatus[
this._updateFinishedMessage!.status
]
: NodeFirmwareUpdateStatus[
this._updateFinishedMessage!.status
]
}`
),
}
)}
</p>
</div>
</div>
${this._updateFinishedMessage!.success
? html`<p>
${this.hass.localize(
`ui.panel.config.zwave_js.update_firmware.finished_status.done${localizationKeySuffix}`
)}
</p>`
: html`<p>
${this.hass.localize( ${this.hass.localize(
"ui.panel.config.zwave_js.update_firmware.finished_status.try_again" `ui.panel.config.zwave_js.update_firmware.finished_status.${status}`,
{
device: html`<strong>${this._deviceName}</strong>`,
message: this.hass.localize(
`ui.panel.config.zwave_js.update_firmware.finished_status.${
this._nodeStatus.is_controller_node
? ControllerFirmwareUpdateStatus[
this._updateFinishedMessage!.status
]
: NodeFirmwareUpdateStatus[
this._updateFinishedMessage!.status
]
}`
),
}
)} )}
</p> </p>
${beginFirmwareUpdateHTML}`} </div>
`} </div>
${this._updateFinishedMessage!.success
? html`<p>
${this.hass.localize(
`ui.panel.config.zwave_js.update_firmware.finished_status.done${localizationKeySuffix}`
)}
</p>`
: html`<p>
${this.hass.localize(
"ui.panel.config.zwave_js.update_firmware.finished_status.try_again"
)}
</p>
${beginFirmwareUpdateHTML}`}
`}
</ha-dialog> </ha-dialog>
`; `;
} }

View File

@ -119,45 +119,45 @@ export class SystemLogCard extends LitElement {
</div> </div>
` `
: filteredItems.length === 0 && this.filter : filteredItems.length === 0 && this.filter
? html`<div class="card-content"> ? html`<div class="card-content">
${this.hass.localize( ${this.hass.localize(
"ui.panel.config.logs.no_issues_search", "ui.panel.config.logs.no_issues_search",
"term", "term",
this.filter this.filter
)}
</div>`
: filteredItems.map(
(item, idx) => html`
<paper-item @click=${this._openLog} .logItem=${item}>
<paper-item-body two-line>
<div class="row">${item.message[0]}</div>
<div class="row-secondary" secondary>
${this._timestamp(item)}
${html`(<span class=${item.level}
>${this.hass.localize(
`ui.panel.config.logs.level.${item.level}`
)}</span
>) `}
${integrations[idx]
? `${domainToName(
this.hass!.localize,
integrations[idx]!
)}${
isCustomIntegrationError(item)
? ` (${this.hass.localize(
"ui.panel.config.logs.custom_integration"
)})`
: ""
}`
: item.source[0]}
${item.count > 1
? html` - ${this._multipleMessages(item)} `
: nothing}
</div>
</paper-item-body>
</paper-item>
`
)} )}
</div>`
: filteredItems.map(
(item, idx) => html`
<paper-item @click=${this._openLog} .logItem=${item}>
<paper-item-body two-line>
<div class="row">${item.message[0]}</div>
<div class="row-secondary" secondary>
${this._timestamp(item)}
${html`(<span class=${item.level}
>${this.hass.localize(
`ui.panel.config.logs.level.${item.level}`
)}</span
>) `}
${integrations[idx]
? `${domainToName(
this.hass!.localize,
integrations[idx]!
)}${
isCustomIntegrationError(item)
? ` (${this.hass.localize(
"ui.panel.config.logs.custom_integration"
)})`
: ""
}`
: item.source[0]}
${item.count > 1
? html` - ${this._multipleMessages(item)} `
: nothing}
</div>
</paper-item-body>
</paper-item>
`
)}
<div class="card-actions"> <div class="card-actions">
<ha-call-service-button <ha-call-service-button

View File

@ -86,19 +86,19 @@ export class DialogLovelaceDashboardDetail extends LitElement {
"ui.panel.config.lovelace.dashboards.cant_edit_yaml" "ui.panel.config.lovelace.dashboards.cant_edit_yaml"
) )
: this._params.urlPath === "lovelace" : this._params.urlPath === "lovelace"
? this.hass.localize( ? this.hass.localize(
"ui.panel.config.lovelace.dashboards.cant_edit_default" "ui.panel.config.lovelace.dashboards.cant_edit_default"
) )
: html` : html`
<ha-form <ha-form
.schema=${this._schema(this._params, this.hass.userData)} .schema=${this._schema(this._params, this.hass.userData)}
.data=${this._data} .data=${this._data}
.hass=${this.hass} .hass=${this.hass}
.error=${this._error} .error=${this._error}
.computeLabel=${this._computeLabel} .computeLabel=${this._computeLabel}
@value-changed=${this._valueChanged} @value-changed=${this._valueChanged}
></ha-form> ></ha-form>
`} `}
</div> </div>
${this._params.urlPath ${this._params.urlPath
? html` ? html`
@ -208,8 +208,8 @@ export class DialogLovelaceDashboardDetail extends LitElement {
entry.name === "show_in_sidebar" entry.name === "show_in_sidebar"
? "show_sidebar" ? "show_sidebar"
: entry.name === "url_path" : entry.name === "url_path"
? "url" ? "url"
: entry.name : entry.name
}` }`
); );

View File

@ -405,24 +405,24 @@ export class HaScriptEditor extends KeyboardShortcutMixin(LitElement) {
</div> </div>
` `
: this._mode === "yaml" : this._mode === "yaml"
? html` ? html`
<ha-yaml-editor <ha-yaml-editor
.hass=${this.hass} .hass=${this.hass}
.defaultValue=${this._preprocessYaml()} .defaultValue=${this._preprocessYaml()}
.readOnly=${this._readOnly} .readOnly=${this._readOnly}
@value-changed=${this._yamlChanged} @value-changed=${this._yamlChanged}
></ha-yaml-editor> ></ha-yaml-editor>
<ha-card outlined> <ha-card outlined>
<div class="card-actions"> <div class="card-actions">
<mwc-button @click=${this._copyYaml}> <mwc-button @click=${this._copyYaml}>
${this.hass.localize( ${this.hass.localize(
"ui.panel.config.automation.editor.copy_to_clipboard" "ui.panel.config.automation.editor.copy_to_clipboard"
)} )}
</mwc-button> </mwc-button>
</div> </div>
</ha-card> </ha-card>
` `
: ``} : ``}
</div> </div>
<ha-fab <ha-fab
slot="fab" slot="fab"

View File

@ -210,104 +210,104 @@ export class HaScriptTrace extends LitElement {
${this._traces === undefined ${this._traces === undefined
? html`<div class="container">Loading…</div>` ? html`<div class="container">Loading…</div>`
: this._traces.length === 0 : this._traces.length === 0
? html`<div class="container">No traces found</div>` ? html`<div class="container">No traces found</div>`
: this._trace === undefined : this._trace === undefined
? "" ? ""
: html` : html`
<div class="main"> <div class="main">
<div class="graph"> <div class="graph">
<hat-script-graph <hat-script-graph
.trace=${this._trace} .trace=${this._trace}
.selected=${this._selected?.path} .selected=${this._selected?.path}
@graph-node-selected=${this._pickNode} @graph-node-selected=${this._pickNode}
></hat-script-graph> ></hat-script-graph>
</div> </div>
<div class="info"> <div class="info">
<div class="tabs top"> <div class="tabs top">
${[ ${[
["details", "Step Details"], ["details", "Step Details"],
["timeline", "Trace Timeline"], ["timeline", "Trace Timeline"],
["logbook", "Related logbook entries"], ["logbook", "Related logbook entries"],
["config", "Script Config"], ["config", "Script Config"],
].map( ].map(
([view, label]) => html` ([view, label]) => html`
<button <button
tabindex="0" tabindex="0"
.view=${view} .view=${view}
class=${classMap({ active: this._view === view })} class=${classMap({ active: this._view === view })}
@click=${this._showTab} @click=${this._showTab}
> >
${label} ${label}
</button> </button>
` `
)} )}
${this._trace.blueprint_inputs ${this._trace.blueprint_inputs
? html` ? html`
<button <button
tabindex="0" tabindex="0"
.view=${"blueprint"} .view=${"blueprint"}
class=${classMap({ class=${classMap({
active: this._view === "blueprint", active: this._view === "blueprint",
})} })}
@click=${this._showTab} @click=${this._showTab}
> >
Blueprint Config Blueprint Config
</button> </button>
` `
: ""} : ""}
</div>
${this._selected === undefined ||
this._logbookEntries === undefined ||
trackedNodes === undefined
? ""
: this._view === "details"
? html`
<ha-trace-path-details
.hass=${this.hass}
.narrow=${this.narrow}
.trace=${this._trace}
.selected=${this._selected}
.logbookEntries=${this._logbookEntries}
.trackedNodes=${trackedNodes}
.renderedNodes=${renderedNodes!}
></ha-trace-path-details>
`
: this._view === "config"
? html`
<ha-trace-config
.hass=${this.hass}
.trace=${this._trace}
></ha-trace-config>
`
: this._view === "logbook"
? html`
<ha-trace-logbook
.hass=${this.hass}
.narrow=${this.narrow}
.trace=${this._trace}
.logbookEntries=${this._logbookEntries}
></ha-trace-logbook>
`
: this._view === "blueprint"
? html`
<ha-trace-blueprint-config
.hass=${this.hass}
.trace=${this._trace}
></ha-trace-blueprint-config>
`
: html`
<ha-trace-timeline
.hass=${this.hass}
.trace=${this._trace}
.logbookEntries=${this._logbookEntries}
.selected=${this._selected}
@value-changed=${this._timelinePathPicked}
></ha-trace-timeline>
`}
</div>
</div> </div>
${this._selected === undefined || `}
this._logbookEntries === undefined ||
trackedNodes === undefined
? ""
: this._view === "details"
? html`
<ha-trace-path-details
.hass=${this.hass}
.narrow=${this.narrow}
.trace=${this._trace}
.selected=${this._selected}
.logbookEntries=${this._logbookEntries}
.trackedNodes=${trackedNodes}
.renderedNodes=${renderedNodes!}
></ha-trace-path-details>
`
: this._view === "config"
? html`
<ha-trace-config
.hass=${this.hass}
.trace=${this._trace}
></ha-trace-config>
`
: this._view === "logbook"
? html`
<ha-trace-logbook
.hass=${this.hass}
.narrow=${this.narrow}
.trace=${this._trace}
.logbookEntries=${this._logbookEntries}
></ha-trace-logbook>
`
: this._view === "blueprint"
? html`
<ha-trace-blueprint-config
.hass=${this.hass}
.trace=${this._trace}
></ha-trace-blueprint-config>
`
: html`
<ha-trace-timeline
.hass=${this.hass}
.trace=${this._trace}
.logbookEntries=${this._logbookEntries}
.selected=${this._selected}
@value-changed=${this._timelinePathPicked}
></ha-trace-timeline>
`}
</div>
</div>
`}
</hass-subpage> </hass-subpage>
`; `;
} }

View File

@ -92,59 +92,59 @@ const mountSchema = memoizeOne(
}, },
] as const) ] as const)
: mountType === "cifs" : mountType === "cifs"
? ([ ? ([
...(showCIFSVersion ...(showCIFSVersion
? ([ ? ([
{ {
name: "version", name: "version",
required: true, required: true,
selector: { selector: {
select: { select: {
options: [ options: [
{ {
label: localize( label: localize(
"ui.panel.config.storage.network_mounts.cifs_versions.auto" "ui.panel.config.storage.network_mounts.cifs_versions.auto"
), ),
value: "auto", value: "auto",
}, },
{ {
label: localize( label: localize(
"ui.panel.config.storage.network_mounts.cifs_versions.legacy", "ui.panel.config.storage.network_mounts.cifs_versions.legacy",
{ version: "2.0" } { version: "2.0" }
), ),
value: "2.0", value: "2.0",
}, },
{ {
label: localize( label: localize(
"ui.panel.config.storage.network_mounts.cifs_versions.legacy", "ui.panel.config.storage.network_mounts.cifs_versions.legacy",
{ version: "1.0" } { version: "1.0" }
), ),
value: "1.0", value: "1.0",
}, },
], ],
mode: "dropdown", mode: "dropdown",
},
}, },
}, },
}, ] as const)
] as const) : ([] as const)),
: ([] as const)), {
{ name: "share",
name: "share", required: true,
required: true, selector: { text: {} },
selector: { text: {} }, },
}, {
{ name: "username",
name: "username", required: false,
required: false, selector: { text: {} },
selector: { text: {} }, },
}, {
{ name: "password",
name: "password", required: false,
required: false, selector: { text: { type: "password" } },
selector: { text: { type: "password" } }, },
}, ] as const)
] as const) : ([] as const)),
: ([] as const)),
] as const ] as const
); );

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