mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-10 10:56:34 +00:00
Add internal, legacy to IQS (#23040)
This commit is contained in:
parent
a1be9d923e
commit
3120184d63
@ -40,12 +40,13 @@ export interface IntegrationManifest {
|
|||||||
loggers?: string[];
|
loggers?: string[];
|
||||||
quality_scale?:
|
quality_scale?:
|
||||||
| "bronze"
|
| "bronze"
|
||||||
| "gold"
|
|
||||||
| "internal"
|
|
||||||
| "platinum"
|
|
||||||
| "silver"
|
| "silver"
|
||||||
| "custom"
|
| "gold"
|
||||||
| "no_score";
|
| "platinum"
|
||||||
|
| "no_score"
|
||||||
|
| "internal"
|
||||||
|
| "legacy"
|
||||||
|
| "custom";
|
||||||
iot_class:
|
iot_class:
|
||||||
| "assumed_state"
|
| "assumed_state"
|
||||||
| "cloud_polling"
|
| "cloud_polling"
|
||||||
|
39
src/data/integration_quality_scale.ts
Normal file
39
src/data/integration_quality_scale.ts
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
import { mdiContentSave, mdiMedal, mdiTrophy } from "@mdi/js";
|
||||||
|
import { mdiHomeAssistant } from "../resources/home-assistant-logo-svg";
|
||||||
|
import type { LocalizeKeys } from "../common/translations/localize";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Map integration quality scale to icon and translation key.
|
||||||
|
*/
|
||||||
|
export const QUALITY_SCALE_MAP: Record<
|
||||||
|
string,
|
||||||
|
{ icon: string; translationKey: LocalizeKeys }
|
||||||
|
> = {
|
||||||
|
bronze: {
|
||||||
|
icon: mdiMedal,
|
||||||
|
translationKey: "ui.panel.config.integrations.config_entry.bronze_quality",
|
||||||
|
},
|
||||||
|
silver: {
|
||||||
|
icon: mdiMedal,
|
||||||
|
translationKey: "ui.panel.config.integrations.config_entry.silver_quality",
|
||||||
|
},
|
||||||
|
gold: {
|
||||||
|
icon: mdiMedal,
|
||||||
|
translationKey: "ui.panel.config.integrations.config_entry.gold_quality",
|
||||||
|
},
|
||||||
|
platinum: {
|
||||||
|
icon: mdiTrophy,
|
||||||
|
translationKey:
|
||||||
|
"ui.panel.config.integrations.config_entry.platinum_quality",
|
||||||
|
},
|
||||||
|
internal: {
|
||||||
|
icon: mdiHomeAssistant,
|
||||||
|
translationKey:
|
||||||
|
"ui.panel.config.integrations.config_entry.internal_integration",
|
||||||
|
},
|
||||||
|
legacy: {
|
||||||
|
icon: mdiContentSave,
|
||||||
|
translationKey:
|
||||||
|
"ui.panel.config.integrations.config_entry.legacy_integration",
|
||||||
|
},
|
||||||
|
};
|
@ -13,7 +13,6 @@ import {
|
|||||||
mdiDownload,
|
mdiDownload,
|
||||||
mdiFileCodeOutline,
|
mdiFileCodeOutline,
|
||||||
mdiHandExtendedOutline,
|
mdiHandExtendedOutline,
|
||||||
mdiMedal,
|
|
||||||
mdiOpenInNew,
|
mdiOpenInNew,
|
||||||
mdiPackageVariant,
|
mdiPackageVariant,
|
||||||
mdiPlayCircleOutline,
|
mdiPlayCircleOutline,
|
||||||
@ -23,7 +22,6 @@ import {
|
|||||||
mdiRenameBox,
|
mdiRenameBox,
|
||||||
mdiShapeOutline,
|
mdiShapeOutline,
|
||||||
mdiStopCircleOutline,
|
mdiStopCircleOutline,
|
||||||
mdiTrophy,
|
|
||||||
mdiWeb,
|
mdiWeb,
|
||||||
mdiWrench,
|
mdiWrench,
|
||||||
} from "@mdi/js";
|
} from "@mdi/js";
|
||||||
@ -107,9 +105,7 @@ import { documentationUrl } from "../../../util/documentation-url";
|
|||||||
import { fileDownload } from "../../../util/file_download";
|
import { fileDownload } from "../../../util/file_download";
|
||||||
import type { DataEntryFlowProgressExtended } from "./ha-config-integrations";
|
import type { DataEntryFlowProgressExtended } from "./ha-config-integrations";
|
||||||
import { showAddIntegrationDialog } from "./show-add-integration-dialog";
|
import { showAddIntegrationDialog } from "./show-add-integration-dialog";
|
||||||
|
import { QUALITY_SCALE_MAP } from "../../../data/integration_quality_scale";
|
||||||
type MedalColor = "gold" | "silver" | "bronze" | "platinum";
|
|
||||||
const MEDAL_COLORS = ["bronze", "silver", "gold", "platinum"];
|
|
||||||
|
|
||||||
export const renderConfigEntryError = (
|
export const renderConfigEntryError = (
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
@ -344,29 +340,30 @@ class HaConfigIntegrationPage extends SubscribeMixin(LitElement) {
|
|||||||
? html`<div class="version">${this._manifest.version}</div>`
|
? html`<div class="version">${this._manifest.version}</div>`
|
||||||
: nothing}
|
: nothing}
|
||||||
${this._manifest?.quality_scale &&
|
${this._manifest?.quality_scale &&
|
||||||
MEDAL_COLORS.includes(this._manifest.quality_scale)
|
Object.keys(QUALITY_SCALE_MAP).includes(
|
||||||
|
this._manifest.quality_scale
|
||||||
|
)
|
||||||
? html`
|
? html`
|
||||||
<div class="quality-scale integration-info">
|
<div class="quality-scale integration-info">
|
||||||
<ha-svg-icon
|
<ha-svg-icon
|
||||||
class=${`${this._manifest.quality_scale}-medal`}
|
class=${`${this._manifest.quality_scale}-quality`}
|
||||||
.path=${this._manifest.quality_scale === "platinum"
|
.path=${QUALITY_SCALE_MAP[
|
||||||
? mdiTrophy
|
this._manifest.quality_scale
|
||||||
: mdiMedal}
|
].icon}
|
||||||
></ha-svg-icon>
|
></ha-svg-icon>
|
||||||
<span>
|
<a
|
||||||
<a
|
href=${documentationUrl(
|
||||||
href=${documentationUrl(
|
this.hass,
|
||||||
this.hass,
|
`/docs/quality_scale/#-${this._manifest.quality_scale}`
|
||||||
`/docs/quality_scale/#-${this._manifest.quality_scale}`
|
)}
|
||||||
)}
|
rel="noopener noreferrer"
|
||||||
rel="noopener noreferrer"
|
target="_blank"
|
||||||
target="_blank"
|
>
|
||||||
>
|
${this.hass.localize(
|
||||||
${this.hass.localize(
|
QUALITY_SCALE_MAP[this._manifest.quality_scale]
|
||||||
`ui.panel.config.integrations.config_entry.${this._manifest.quality_scale as MedalColor}_quality`
|
.translationKey
|
||||||
)}
|
)}
|
||||||
</a>
|
</a>
|
||||||
</span>
|
|
||||||
</div>
|
</div>
|
||||||
`
|
`
|
||||||
: nothing}
|
: nothing}
|
||||||
@ -376,9 +373,18 @@ class HaConfigIntegrationPage extends SubscribeMixin(LitElement) {
|
|||||||
class="warning"
|
class="warning"
|
||||||
path=${mdiPackageVariant}
|
path=${mdiPackageVariant}
|
||||||
></ha-svg-icon>
|
></ha-svg-icon>
|
||||||
${this.hass.localize(
|
<a
|
||||||
"ui.panel.config.integrations.config_entry.custom_integration"
|
href=${documentationUrl(
|
||||||
)}
|
this.hass,
|
||||||
|
`/docs/quality_scale/#-custom`
|
||||||
|
)}
|
||||||
|
rel="noopener noreferrer"
|
||||||
|
target="_blank"
|
||||||
|
>
|
||||||
|
${this.hass.localize(
|
||||||
|
"ui.panel.config.integrations.config_entry.custom_integration"
|
||||||
|
)}
|
||||||
|
</a>
|
||||||
</div>`
|
</div>`
|
||||||
: nothing}
|
: nothing}
|
||||||
${this._manifest?.iot_class?.startsWith("cloud_")
|
${this._manifest?.iot_class?.startsWith("cloud_")
|
||||||
@ -1532,18 +1538,25 @@ class HaConfigIntegrationPage extends SubscribeMixin(LitElement) {
|
|||||||
100%;
|
100%;
|
||||||
animation: shimmer 2.5s infinite;
|
animation: shimmer 2.5s infinite;
|
||||||
}
|
}
|
||||||
ha-svg-icon.bronze-medal {
|
ha-svg-icon.bronze-quality {
|
||||||
color: #cd7f32;
|
color: #cd7f32;
|
||||||
}
|
}
|
||||||
ha-svg-icon.silver-medal {
|
ha-svg-icon.silver-quality {
|
||||||
color: silver;
|
color: silver;
|
||||||
}
|
}
|
||||||
ha-svg-icon.gold-medal {
|
ha-svg-icon.gold-quality {
|
||||||
color: gold;
|
color: gold;
|
||||||
}
|
}
|
||||||
ha-svg-icon.platinum-medal {
|
ha-svg-icon.platinum-quality {
|
||||||
color: #727272;
|
color: #727272;
|
||||||
}
|
}
|
||||||
|
ha-svg-icon.internal-quality {
|
||||||
|
color: var(--primary-color);
|
||||||
|
}
|
||||||
|
ha-svg-icon.legacy-quality {
|
||||||
|
color: var(--mdc-theme-text-icon-on-background, rgba(0, 0, 0, 0.38));
|
||||||
|
animation: unset;
|
||||||
|
}
|
||||||
ha-md-list-item {
|
ha-md-list-item {
|
||||||
position: relative;
|
position: relative;
|
||||||
}
|
}
|
||||||
|
@ -4505,6 +4505,8 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"custom_integration": "Custom integration",
|
"custom_integration": "Custom integration",
|
||||||
|
"internal_integration": "Internal integration",
|
||||||
|
"legacy_integration": "Legacy integration",
|
||||||
"custom_overwrites_core": "Custom integration that replaces a core component",
|
"custom_overwrites_core": "Custom integration that replaces a core component",
|
||||||
"depends_on_cloud": "Depends on Internet connection",
|
"depends_on_cloud": "Depends on Internet connection",
|
||||||
"yaml_only": "This integration cannot be setup from the UI",
|
"yaml_only": "This integration cannot be setup from the UI",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user