Use documentationUrl instead of manifest for core integrations (#11450)

This commit is contained in:
Joakim Sørensen 2022-01-27 15:49:55 +01:00 committed by GitHub
parent 8b20b2b63c
commit 242bad0a29
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 35 additions and 5 deletions

View File

@ -17,6 +17,7 @@ import {
import { Selector } from "../data/selector"; import { Selector } from "../data/selector";
import { PolymerChangedEvent } from "../polymer-types"; import { PolymerChangedEvent } from "../polymer-types";
import { HomeAssistant } from "../types"; import { HomeAssistant } from "../types";
import { documentationUrl } from "../util/documentation-url";
import "./ha-checkbox"; import "./ha-checkbox";
import "./ha-icon-button"; import "./ha-icon-button";
import "./ha-selector/ha-selector"; import "./ha-selector/ha-selector";
@ -230,7 +231,12 @@ export class HaServiceControl extends LitElement {
<p>${serviceData?.description}</p> <p>${serviceData?.description}</p>
${this._manifest ${this._manifest
? html` <a ? html` <a
href=${this._manifest.documentation} href=${this._manifest.is_built_in
? documentationUrl(
this.hass,
`/integrations/${this._manifest.domain}`
)
: this._manifest.documentation}
title=${this.hass.localize( title=${this.hass.localize(
"ui.components.service-control.integration_doc" "ui.components.service-control.integration_doc"
)} )}

View File

@ -12,6 +12,7 @@ import {
} from "../../../data/integration"; } from "../../../data/integration";
import { HomeAssistant } from "../../../types"; import { HomeAssistant } from "../../../types";
import { brandsUrl } from "../../../util/brands-url"; import { brandsUrl } from "../../../util/brands-url";
import { documentationUrl } from "../../../util/documentation-url";
@customElement("integrations-card") @customElement("integrations-card")
class IntegrationsCard extends LitElement { class IntegrationsCard extends LitElement {
@ -66,7 +67,12 @@ class IntegrationsCard extends LitElement {
const manifest = this._manifests && this._manifests[domain]; const manifest = this._manifests && this._manifests[domain];
const docLink = manifest const docLink = manifest
? html`<a ? html`<a
href=${manifest.documentation} href=${manifest.is_built_in
? documentationUrl(
this.hass,
`/integrations/${manifest.domain}`
)
: manifest.documentation}
target="_blank" target="_blank"
rel="noreferrer" rel="noreferrer"
>${this.hass.localize( >${this.hass.localize(

View File

@ -15,6 +15,7 @@ import { showConfirmationDialog } from "../../../dialogs/generic/show-dialog-box
import type { HomeAssistant } from "../../../types"; import type { HomeAssistant } from "../../../types";
import type { DataEntryFlowProgressExtended } from "./ha-config-integrations"; import type { DataEntryFlowProgressExtended } from "./ha-config-integrations";
import "./ha-integration-action-card"; import "./ha-integration-action-card";
import { documentationUrl } from "../../../util/documentation-url";
@customElement("ha-config-flow-card") @customElement("ha-config-flow-card")
export class HaConfigFlowCard extends LitElement { export class HaConfigFlowCard extends LitElement {
@ -82,7 +83,12 @@ export class HaConfigFlowCard extends LitElement {
: ""} : ""}
${this.manifest ${this.manifest
? html`<a ? html`<a
href=${this.manifest.documentation} href=${this.manifest.is_built_in
? documentationUrl(
this.hass,
`/integrations/${this.manifest.domain}`
)
: this.manifest.documentation}
rel="noreferrer" rel="noreferrer"
target="_blank" target="_blank"
> >

View File

@ -46,6 +46,7 @@ import {
} from "../../../dialogs/generic/show-dialog-box"; } from "../../../dialogs/generic/show-dialog-box";
import { haStyle, haStyleScrollbar } from "../../../resources/styles"; import { haStyle, haStyleScrollbar } from "../../../resources/styles";
import type { HomeAssistant } from "../../../types"; import type { HomeAssistant } from "../../../types";
import { documentationUrl } from "../../../util/documentation-url";
import { fileDownload } from "../../../util/file_download"; import { fileDownload } from "../../../util/file_download";
import type { ConfigEntryExtended } from "./ha-config-integrations"; import type { ConfigEntryExtended } from "./ha-config-integrations";
import "./ha-integration-header"; import "./ha-integration-header";
@ -331,7 +332,12 @@ export class HaIntegrationCard extends LitElement {
</mwc-list-item> </mwc-list-item>
${this.manifest ${this.manifest
? html` <a ? html` <a
href=${this.manifest.documentation} href=${this.manifest.is_built_in
? documentationUrl(
this.hass,
`/integrations/${this.manifest.domain}`
)
: this.manifest.documentation}
rel="noreferrer" rel="noreferrer"
target="_blank" target="_blank"
> >

View File

@ -21,6 +21,7 @@ import {
} from "../../../data/system_log"; } from "../../../data/system_log";
import { haStyleDialog } from "../../../resources/styles"; import { haStyleDialog } from "../../../resources/styles";
import type { HomeAssistant } from "../../../types"; import type { HomeAssistant } from "../../../types";
import { documentationUrl } from "../../../util/documentation-url";
import { showToast } from "../../../util/toast"; import { showToast } from "../../../util/toast";
import type { SystemLogDetailDialogParams } from "./show-dialog-system-log-detail"; import type { SystemLogDetailDialogParams } from "./show-dialog-system-log-detail";
import { formatSystemLogTime } from "./util"; import { formatSystemLogTime } from "./util";
@ -117,7 +118,12 @@ class DialogSystemLogDetail extends LitElement {
? "" ? ""
: html` : html`
(<a (<a
href=${this._manifest.documentation} href=${this._manifest.is_built_in
? documentationUrl(
this.hass,
`/integrations/${this._manifest.domain}`
)
: this._manifest.documentation}
target="_blank" target="_blank"
rel="noreferrer" rel="noreferrer"
>documentation</a >documentation</a