-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Add "show not installable option" to update overview page #28717
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Changes from all commits
24a438c
b38a424
c59671e
21ab096
e528a5e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -26,7 +26,7 @@ import { | |||||
| } from "../../../data/hassio/supervisor"; | ||||||
| import { | ||||||
| checkForEntityUpdates, | ||||||
| filterUpdateEntitiesWithInstall, | ||||||
| filterUpdateEntitiesParameterized, | ||||||
| } from "../../../data/update"; | ||||||
| import { showAlertDialog } from "../../../dialogs/generic/show-dialog-box"; | ||||||
| import "../../../layouts/hass-subpage"; | ||||||
|
|
@@ -53,9 +53,15 @@ class HaConfigSectionUpdates extends LitElement { | |||||
| } | ||||||
|
|
||||||
| protected render(): TemplateResult { | ||||||
| const canInstallUpdates = this._filterUpdateEntitiesWithInstall( | ||||||
| const canInstallUpdates = this._filterUpdateEntitiesParameterized( | ||||||
| this.hass.states, | ||||||
| this._showSkipped | ||||||
| this._showSkipped, | ||||||
| false | ||||||
| ); | ||||||
| const notInstallableUpdates = this._filterUpdateEntitiesParameterized( | ||||||
| this.hass.states, | ||||||
| this._showSkipped, | ||||||
| true | ||||||
| ); | ||||||
|
|
||||||
| return html` | ||||||
|
|
@@ -104,26 +110,45 @@ class HaConfigSectionUpdates extends LitElement { | |||||
| </ha-button-menu> | ||||||
| </div> | ||||||
| <div class="content"> | ||||||
| <ha-card outlined> | ||||||
| <div class="card-content"> | ||||||
| ${canInstallUpdates.length | ||||||
| ? html` | ||||||
| ${canInstallUpdates.length | ||||||
| ? html` | ||||||
| <ha-card> | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||||||
| <div class="card-content"> | ||||||
| <ha-config-updates | ||||||
| .hass=${this.hass} | ||||||
| .narrow=${this.narrow} | ||||||
| .updateEntities=${canInstallUpdates} | ||||||
| .isInstallable=${true} | ||||||
| showAll | ||||||
| ></ha-config-updates> | ||||||
| </div> | ||||||
| </ha-card> | ||||||
| ` | ||||||
| : ""} | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| ${notInstallableUpdates.length | ||||||
| ? html` | ||||||
| <ha-card> | ||||||
| <div class="card-content"> | ||||||
| <ha-config-updates | ||||||
| .hass=${this.hass} | ||||||
| .narrow=${this.narrow} | ||||||
| .updateEntities=${notInstallableUpdates} | ||||||
| .isInstallable=${false} | ||||||
| showAll | ||||||
| ></ha-config-updates> | ||||||
| ` | ||||||
| : html` | ||||||
| <div class="no-updates"> | ||||||
| ${this.hass.localize( | ||||||
| "ui.panel.config.updates.no_updates" | ||||||
| )} | ||||||
| </div> | ||||||
| `} | ||||||
| </div> | ||||||
| </ha-card> | ||||||
| </div> | ||||||
| </ha-card> | ||||||
| ` | ||||||
| : ""} | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| ${canInstallUpdates.length + notInstallableUpdates.length | ||||||
| ? "" | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| : html` | ||||||
| <ha-card> | ||||||
| <div class="no-updates"> | ||||||
| ${this.hass.localize("ui.panel.config.updates.no_updates")} | ||||||
| </div> | ||||||
| </ha-card> | ||||||
| `} | ||||||
| </div> | ||||||
| </hass-subpage> | ||||||
| `; | ||||||
|
|
@@ -177,9 +202,17 @@ class HaConfigSectionUpdates extends LitElement { | |||||
| checkForEntityUpdates(this, this.hass); | ||||||
| } | ||||||
|
|
||||||
| private _filterUpdateEntitiesWithInstall = memoizeOne( | ||||||
| (entities: HassEntities, showSkipped: boolean) => | ||||||
| filterUpdateEntitiesWithInstall(entities, showSkipped) | ||||||
| private _filterUpdateEntitiesParameterized = memoizeOne( | ||||||
| ( | ||||||
| entities: HassEntities, | ||||||
| showSkipped: boolean, | ||||||
| showNotInstallable: boolean | ||||||
| ) => | ||||||
| filterUpdateEntitiesParameterized( | ||||||
| entities, | ||||||
| showSkipped, | ||||||
| showNotInstallable | ||||||
| ) | ||||||
| ); | ||||||
|
|
||||||
| static styles = css` | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2384,7 +2384,7 @@ | |
| "no_new_updates": "No new updates found", | ||
| "updates_refreshed": "State of {count} {count, plural,\n one {update}\n other {updates}\n} refreshed", | ||
| "checking_updates": "Checking for updates...", | ||
| "title": "{count} {count, plural,\n one {update}\n other {updates}\n}", | ||
| "title": "{count} {count, plural,\n one {{installable, select, \n true {installable} \n other {not installable}\n} update}\n other {{installable, select, \n true {installable} \n other {not installable}\n} updates}\n}", | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This overcomplicates it IMO. Lets just leave the existing translation as is and add a new one for "not installable" updates. |
||
| "unable_to_fetch": "Unable to load updates", | ||
| "more_updates": "Show all updates", | ||
| "show": "show", | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Calling
_filterUpdateEntitiesParameterizedtwice with different args defeats the memoization as the cache only keeps the latest value.You should create a new memoized method similar to
_filterUpdateEntitiesParameterizedfor "not installable" updates instead of reusing_filterUpdateEntitiesParameterized.