Skip to content

Commit 296aa95

Browse files
committed
Add iqs indicator on integration-page
1 parent 75c5539 commit 296aa95

File tree

3 files changed

+65
-2
lines changed

3 files changed

+65
-2
lines changed

src/data/integration.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export interface IntegrationManifest {
3838
homekit?: { models: string[] };
3939
integration_type?: IntegrationType;
4040
loggers?: string[];
41-
quality_scale?: "gold" | "internal" | "platinum" | "silver";
41+
quality_scale?: "bronze" | "gold" | "internal" | "platinum" | "silver";
4242
iot_class:
4343
| "assumed_state"
4444
| "cloud_polling"

src/panels/config/integrations/ha-config-integration-page.ts

+59
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ import {
1414
mdiDownload,
1515
mdiFileCodeOutline,
1616
mdiHandExtendedOutline,
17+
mdiInformation,
18+
mdiMedal,
1719
mdiOpenInNew,
1820
mdiPackageVariant,
1921
mdiPlayCircleOutline,
@@ -23,6 +25,7 @@ import {
2325
mdiRenameBox,
2426
mdiShapeOutline,
2527
mdiStopCircleOutline,
28+
mdiTrophy,
2629
mdiWrench,
2730
} from "@mdi/js";
2831
import type { UnsubscribeFunc } from "home-assistant-js-websocket";
@@ -338,6 +341,36 @@ class HaConfigIntegrationPage extends SubscribeMixin(LitElement) {
338341
${this._manifest?.version != null
339342
? html`<div class="version">${this._manifest.version}</div>`
340343
: nothing}
344+
${this._manifest?.quality_scale &&
345+
this._manifest?.quality_scale !== "internal"
346+
? html`<ha-alert
347+
class=${classMap({
348+
[`${this._manifest.quality_scale}-medal`]: true,
349+
})}
350+
alert-type="info"
351+
><ha-svg-icon
352+
class="medal"
353+
slot="icon"
354+
path=${this._manifest.quality_scale === "platinum"
355+
? mdiTrophy
356+
: mdiMedal}
357+
></ha-svg-icon>
358+
${this.hass.localize(
359+
`ui.panel.config.integrations.config_entry.${this._manifest.quality_scale}_quality`
360+
)}
361+
<a
362+
slot="action"
363+
href=${`https://developers.home-assistant.io/docs/core/integration-quality-scale/#-${this._manifest.quality_scale}`}
364+
rel="noopener noreferrer"
365+
target="_blank"
366+
>
367+
<ha-svg-icon
368+
class="info"
369+
path=${mdiInformation}
370+
></ha-svg-icon>
371+
</a>
372+
</ha-alert>`
373+
: nothing}
341374
${this._manifest?.is_built_in === false
342375
? html`<ha-alert alert-type="warning"
343376
><ha-svg-icon
@@ -1478,6 +1511,32 @@ class HaConfigIntegrationPage extends SubscribeMixin(LitElement) {
14781511
ha-alert:first-of-type {
14791512
margin-top: 16px;
14801513
}
1514+
1515+
@keyframes shimmer {
1516+
100% {
1517+
mask-position: left;
1518+
}
1519+
}
1520+
ha-svg-icon.medal {
1521+
mask: linear-gradient(-60deg, #000 30%, #0005, #000 70%) right/350%
1522+
100%;
1523+
animation: shimmer 2.5s infinite;
1524+
}
1525+
ha-alert.bronze-medal {
1526+
--info-color: #cd7f32;
1527+
}
1528+
ha-alert.silver-medal {
1529+
--info-color: silver;
1530+
}
1531+
ha-alert.gold-medal {
1532+
--info-color: gold;
1533+
}
1534+
ha-alert.platinum-medal {
1535+
--info-color: #d9d9d9;
1536+
}
1537+
ha-alert ha-svg-icon.info {
1538+
color: var(--secondary-text-color);
1539+
}
14811540
ha-md-list-item {
14821541
position: relative;
14831542
}

src/translations/en.json

+5-1
Original file line numberDiff line numberDiff line change
@@ -4520,7 +4520,11 @@
45204520
"failed_unload": "Failed to unload",
45214521
"setup_in_progress": "Initializing"
45224522
},
4523-
"open_configuration_url": "Visit device"
4523+
"open_configuration_url": "Visit device",
4524+
"bronze_quality": "Bronze quality",
4525+
"silver_quality": "Silver quality",
4526+
"gold_quality": "Gold quality",
4527+
"platinum_quality": "Platinum quality"
45244528
},
45254529
"config_flow": {
45264530
"success": "Success",

0 commit comments

Comments
 (0)