Skip to content

Commit 619c75a

Browse files
authored
Update apps filtering and styles to show stage and remove advanced mode filters (#30165)
* Remove filter for unstable app stages * Show stage in app store repository view * Increase size of cards to accomadate badges * Add stage to installed apps, update style * Make "Search" consistent, "Search apps" not needed in this context * Remove show advanced mode logic for app visibility * Add margin to .addition * Remove [deprecated] from app page title also * Use common helper
1 parent 5b09101 commit 619c75a

9 files changed

Lines changed: 113 additions & 99 deletions

File tree

src/panels/config/apps/app-view/info/supervisor-app-info.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ import { mdiHomeAssistant } from "../../../../../resources/home-assistant-logo-s
7676
import { haStyle } from "../../../../../resources/styles";
7777
import type { HomeAssistant, Route } from "../../../../../types";
7878
import { bytesToString } from "../../../../../util/bytes-to-string";
79+
import { getAppDisplayName } from "../../common/app";
7980
import "../../components/supervisor-apps-card-content";
8081
import "../components/supervisor-app-metric";
8182
import { extractChangelog } from "../util/supervisor-app";
@@ -197,7 +198,9 @@ class SupervisorAppInfo extends LitElement {
197198
<ha-card outlined>
198199
<div class="card-content">
199200
<div class="addon-header">
200-
${!this.narrow ? this.addon.name : nothing}
201+
${!this.narrow
202+
? getAppDisplayName(this.addon.name, this.addon.stage)
203+
: nothing}
201204
<div class="addon-version light-color">
202205
${this.addon.version
203206
? html`
@@ -490,7 +493,7 @@ class SupervisorAppInfo extends LitElement {
490493
href=${this.addon.url!}
491494
target="_blank"
492495
rel="noreferrer"
493-
>${this.addon.name}</a
496+
>${getAppDisplayName(this.addon.name, this.addon.stage)}</a
494497
>`,
495498
}
496499
)}
@@ -1223,7 +1226,7 @@ class SupervisorAppInfo extends LitElement {
12231226
title: this.hass.localize(
12241227
"ui.panel.config.apps.dashboard.uninstall_dialog.title",
12251228
{
1226-
name: this.addon.name,
1229+
name: getAppDisplayName(this.addon.name, this.addon.stage),
12271230
}
12281231
),
12291232
text: html`
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import type { AddonStage } from "../../../../data/hassio/addon";
2+
3+
export const getAppDisplayName = (name: string, stage: AddonStage): string =>
4+
stage === "deprecated" ? name.replace(/\s*\[deprecated\]\s*$/i, "") : name;

src/panels/config/apps/components/supervisor-apps-card-content.ts

Lines changed: 43 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
import { mdiHelpCircleOutline } from "@mdi/js";
22
import type { TemplateResult } from "lit";
3-
import { css, html, LitElement } from "lit";
3+
import { css, html, LitElement, nothing } from "lit";
44
import { customElement, property } from "lit/decorators";
55
import "../../../../components/ha-svg-icon";
6+
import type { AddonStage } from "../../../../data/hassio/addon";
67
import type { HomeAssistant } from "../../../../types";
8+
import { getAppDisplayName } from "../common/app";
79

810
@customElement("supervisor-apps-card-content")
911
class SupervisorAppsCardContent extends LitElement {
@@ -12,6 +14,8 @@ class SupervisorAppsCardContent extends LitElement {
1214
// eslint-disable-next-line lit/no-native-attributes
1315
@property() public title!: string;
1416

17+
@property() public stage: AddonStage = "stable";
18+
1519
@property() public description?: string;
1620

1721
@property({ type: Boolean }) public available = true;
@@ -29,6 +33,13 @@ class SupervisorAppsCardContent extends LitElement {
2933
@property({ attribute: false }) public iconImage?: string;
3034

3135
protected render(): TemplateResult {
36+
const stageLabel =
37+
this.stage !== "stable"
38+
? this.hass.localize(
39+
`ui.panel.config.apps.dashboard.capability.stages.${this.stage}`
40+
)
41+
: undefined;
42+
3243
return html`
3344
${this.showTopbar
3445
? html` <div class="topbar ${this.topbarClass}"></div> `
@@ -52,7 +63,12 @@ class SupervisorAppsCardContent extends LitElement {
5263
></ha-svg-icon>
5364
`}
5465
<div>
55-
<div class="title">${this.title}</div>
66+
<div class="title-row">
67+
<div class="title">${getAppDisplayName(this.title, this.stage)}</div>
68+
${stageLabel
69+
? html` <span class="stage ${this.stage}"> ${stageLabel} </span> `
70+
: nothing}
71+
</div>
5672
<div class="addition">
5773
${this.description}
5874
${
@@ -91,13 +107,38 @@ class SupervisorAppsCardContent extends LitElement {
91107
color: var(--error-color);
92108
}
93109
.title {
110+
flex: 1;
111+
min-width: 0;
94112
color: var(--primary-text-color);
95113
white-space: nowrap;
96114
text-overflow: ellipsis;
97115
overflow: hidden;
98116
}
117+
.title-row {
118+
display: flex;
119+
align-items: center;
120+
gap: var(--ha-space-2);
121+
min-width: 0;
122+
}
123+
.stage {
124+
flex: none;
125+
border-radius: 999px;
126+
font-size: 12px;
127+
line-height: 1;
128+
padding: 4px 8px;
129+
white-space: nowrap;
130+
}
131+
.stage.experimental {
132+
color: var(--warning-color);
133+
background-color: rgba(var(--rgb-warning-color), 0.12);
134+
}
135+
.stage.deprecated {
136+
color: var(--error-color);
137+
background-color: rgba(var(--rgb-error-color), 0.12);
138+
}
99139
.addition {
100140
color: var(--secondary-text-color);
141+
margin-top: var(--ha-space-1);
101142
overflow: hidden;
102143
position: relative;
103144
height: 2.4em;

src/panels/config/apps/ha-config-apps-available.ts

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -154,17 +154,6 @@ export class HaConfigAppsAvailable extends LitElement {
154154
155155
${repos}
156156
`}
157-
${!this.hass.userData?.showAdvanced
158-
? html`
159-
<div class="advanced">
160-
<a href="/profile" target="_top">
161-
${this.hass.localize(
162-
"ui.panel.config.apps.store.missing_apps"
163-
)}
164-
</a>
165-
</div>
166-
`
167-
: ""}
168157
</hass-subpage>
169158
`;
170159
}
@@ -296,18 +285,6 @@ export class HaConfigAppsAvailable extends LitElement {
296285
--mdc-text-field-fill-color: var(--sidebar-background-color);
297286
--mdc-text-field-idle-line-color: var(--divider-color);
298287
}
299-
.advanced {
300-
padding: 12px;
301-
display: flex;
302-
flex-wrap: wrap;
303-
color: var(--primary-text-color);
304-
}
305-
.advanced a {
306-
margin-left: 0.5em;
307-
margin-inline-start: 0.5em;
308-
margin-inline-end: initial;
309-
color: var(--primary-color);
310-
}
311288
`;
312289
}
313290

src/panels/config/apps/ha-config-apps-installed.ts

Lines changed: 54 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import "../../../layouts/hass-loading-screen";
3030
import "../../../layouts/hass-subpage";
3131
import type { HomeAssistant, Route } from "../../../types";
3232
import "./components/supervisor-apps-card-content";
33+
import { supervisorAppsStyle } from "./resources/supervisor-apps-style";
3334

3435
@customElement("ha-config-apps-installed")
3536
export class HaConfigAppsInstalled extends LitElement {
@@ -92,9 +93,6 @@ export class HaConfigAppsInstalled extends LitElement {
9293
suffix
9394
.filter=${this._filter}
9495
@value-changed=${this._handleSearchChange}
95-
.label=${this.hass.localize(
96-
"ui.panel.config.apps.installed.search"
97-
)}
9896
>
9997
</search-input>
10098
</div>
@@ -123,6 +121,7 @@ export class HaConfigAppsInstalled extends LitElement {
123121
<supervisor-apps-card-content
124122
.hass=${this.hass}
125123
.title=${addon.name}
124+
.stage=${addon.stage}
126125
.description=${addon.description}
127126
available
128127
.showTopbar=${addon.update_available}
@@ -225,66 +224,65 @@ export class HaConfigAppsInstalled extends LitElement {
225224
navigate("/config/apps/available");
226225
}
227226

228-
static styles: CSSResultGroup = css`
229-
:host {
230-
display: block;
231-
height: 100%;
232-
background-color: var(--primary-background-color);
233-
}
234-
235-
ha-card {
236-
cursor: pointer;
237-
overflow: hidden;
238-
direction: ltr;
239-
}
227+
static styles: CSSResultGroup = [
228+
supervisorAppsStyle,
229+
css`
230+
:host {
231+
display: block;
232+
height: 100%;
233+
background-color: var(--primary-background-color);
234+
}
240235
241-
.search {
242-
position: sticky;
243-
top: 0;
244-
z-index: 2;
245-
}
236+
ha-card {
237+
cursor: pointer;
238+
overflow: hidden;
239+
direction: ltr;
240+
}
246241
247-
search-input {
248-
display: block;
249-
--mdc-text-field-fill-color: var(--sidebar-background-color);
250-
--mdc-text-field-idle-line-color: var(--divider-color);
251-
}
242+
.search {
243+
position: sticky;
244+
top: 0;
245+
z-index: 2;
246+
}
252247
253-
.content {
254-
padding: var(--ha-space-4);
255-
margin-bottom: var(--ha-space-18);
256-
}
248+
search-input {
249+
display: block;
250+
--mdc-text-field-fill-color: var(--sidebar-background-color);
251+
--mdc-text-field-idle-line-color: var(--divider-color);
252+
}
257253
258-
.card-group {
259-
display: grid;
260-
grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
261-
grid-gap: var(--ha-space-2);
262-
}
254+
.content {
255+
padding: var(--ha-space-4);
256+
margin-bottom: var(--ha-space-18);
257+
}
263258
264-
.card-content {
265-
padding: var(--ha-space-4);
266-
}
259+
.card-content {
260+
padding: var(--ha-space-4);
261+
}
267262
268-
button.link {
269-
color: var(--primary-color);
270-
background: none;
271-
border: none;
272-
padding: 0;
273-
font: inherit;
274-
text-align: left;
275-
text-decoration: underline;
276-
cursor: pointer;
277-
}
263+
button.link {
264+
color: var(--primary-color);
265+
background: none;
266+
border: none;
267+
padding: 0;
268+
font: inherit;
269+
text-align: left;
270+
text-decoration: underline;
271+
cursor: pointer;
272+
}
278273
279-
ha-fab {
280-
position: fixed;
281-
right: calc(var(--ha-space-4) + var(--safe-area-inset-right));
282-
bottom: calc(var(--ha-space-4) + var(--safe-area-inset-bottom));
283-
inset-inline-end: calc(var(--ha-space-4) + var(--safe-area-inset-right));
284-
inset-inline-start: initial;
285-
z-index: 1;
286-
}
287-
`;
274+
ha-fab {
275+
position: fixed;
276+
right: calc(var(--ha-space-4) + var(--safe-area-inset-right));
277+
bottom: calc(var(--ha-space-4) + var(--safe-area-inset-bottom));
278+
inset-inline-end: calc(
279+
var(--ha-space-4) + var(--safe-area-inset-right)
280+
);
281+
inset-inline-start: initial;
282+
z-index: 1;
283+
}
284+
`,
285+
];
288286
}
289287

290288
declare global {

src/panels/config/apps/ha-config-apps.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ class HaConfigApps extends HassRouterPage {
1111

1212
@property({ attribute: "is-wide", type: Boolean }) public isWide = false;
1313

14-
@property({ attribute: false }) public showAdvanced = false;
15-
1614
@property({ attribute: false }) public route!: Route;
1715

1816
protected routerOptions: RouterOptions = {
@@ -41,7 +39,6 @@ class HaConfigApps extends HassRouterPage {
4139
pageEl.hass = this.hass;
4240
pageEl.narrow = this.narrow;
4341
pageEl.isWide = this.isWide;
44-
pageEl.showAdvanced = this.showAdvanced;
4542
pageEl.route = this.routeTail;
4643
}
4744
}

src/panels/config/apps/resources/supervisor-apps-style.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,22 +30,22 @@ export const supervisorAppsStyle = css`
3030
}
3131
.card-group {
3232
display: grid;
33-
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
33+
grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
3434
grid-gap: var(--ha-space-2);
3535
}
3636
@media screen and (min-width: 640px) {
3737
.card-group {
38-
grid-template-columns: repeat(auto-fit, minmax(300px, 0.5fr));
38+
grid-template-columns: repeat(auto-fit, minmax(340px, 0.5fr));
3939
}
4040
}
4141
@media screen and (min-width: 1020px) {
4242
.card-group {
43-
grid-template-columns: repeat(auto-fit, minmax(300px, 0.333fr));
43+
grid-template-columns: repeat(auto-fit, minmax(340px, 0.333fr));
4444
}
4545
}
4646
@media screen and (min-width: 1300px) {
4747
.card-group {
48-
grid-template-columns: repeat(auto-fit, minmax(300px, 0.25fr));
48+
grid-template-columns: repeat(auto-fit, minmax(340px, 0.25fr));
4949
}
5050
}
5151
.error {

src/panels/config/apps/supervisor-apps-repository.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,7 @@ export class SupervisorAppsRepositoryEl extends LitElement {
3434

3535
protected render(): TemplateResult {
3636
const repo = this.repo;
37-
let _addons = this.addons;
38-
if (!this.hass.userData?.showAdvanced) {
39-
_addons = _addons.filter(
40-
(addon) => !addon.advanced && addon.stage === "stable"
41-
);
42-
}
43-
const addons = this._getAddons(_addons, this.filter);
37+
const addons = this._getAddons(this.addons, this.filter);
4438

4539
if (this.filter && addons.length < 1) {
4640
return html`
@@ -72,6 +66,7 @@ export class SupervisorAppsRepositoryEl extends LitElement {
7266
<supervisor-apps-card-content
7367
.hass=${this.hass}
7468
.title=${addon.name}
69+
.stage=${addon.stage}
7570
.description=${addon.description}
7671
.available=${addon.available}
7772
.icon=${addon.installed && addon.update_available

src/translations/en.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2598,7 +2598,6 @@
25982598
"check_updates": "Check for updates",
25992599
"repositories": "Repositories",
26002600
"registries": "Registries",
2601-
"missing_apps": "Looking for apps? Enable advanced mode.",
26022601
"no_results_found": "No results found in {repository}"
26032602
},
26042603
"repositories": {

0 commit comments

Comments
 (0)