mirror of
https://github.com/home-assistant/frontend.git
synced 2025-04-27 23:07:20 +00:00
Docs integrations overflow (#6278)
This commit is contained in:
parent
4ce9c71521
commit
ae6c0bfe40
@ -47,7 +47,11 @@ import {
|
|||||||
EntityRegistryEntry,
|
EntityRegistryEntry,
|
||||||
subscribeEntityRegistry,
|
subscribeEntityRegistry,
|
||||||
} from "../../../data/entity_registry";
|
} from "../../../data/entity_registry";
|
||||||
import { domainToName } from "../../../data/integration";
|
import {
|
||||||
|
domainToName,
|
||||||
|
fetchIntegrationManifests,
|
||||||
|
IntegrationManifest,
|
||||||
|
} from "../../../data/integration";
|
||||||
import { showConfigFlowDialog } from "../../../dialogs/config-flow/show-dialog-config-flow";
|
import { showConfigFlowDialog } from "../../../dialogs/config-flow/show-dialog-config-flow";
|
||||||
import { showConfirmationDialog } from "../../../dialogs/generic/show-dialog-box";
|
import { showConfirmationDialog } from "../../../dialogs/generic/show-dialog-box";
|
||||||
import "../../../layouts/hass-loading-screen";
|
import "../../../layouts/hass-loading-screen";
|
||||||
@ -106,6 +110,8 @@ class HaConfigIntegrations extends SubscribeMixin(LitElement) {
|
|||||||
|
|
||||||
@property() private _deviceRegistryEntries: DeviceRegistryEntry[] = [];
|
@property() private _deviceRegistryEntries: DeviceRegistryEntry[] = [];
|
||||||
|
|
||||||
|
@property() private _manifests!: { [domain: string]: IntegrationManifest };
|
||||||
|
|
||||||
@property() private _showIgnored = false;
|
@property() private _showIgnored = false;
|
||||||
|
|
||||||
@property() private _searchParms = new URLSearchParams(
|
@property() private _searchParms = new URLSearchParams(
|
||||||
@ -211,6 +217,7 @@ class HaConfigIntegrations extends SubscribeMixin(LitElement) {
|
|||||||
super.firstUpdated(changed);
|
super.firstUpdated(changed);
|
||||||
this._loadConfigEntries();
|
this._loadConfigEntries();
|
||||||
this.hass.loadBackendTranslation("title", undefined, true);
|
this.hass.loadBackendTranslation("title", undefined, true);
|
||||||
|
this._fetchManifests();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected updated(changed: PropertyValues) {
|
protected updated(changed: PropertyValues) {
|
||||||
@ -390,6 +397,7 @@ class HaConfigIntegrations extends SubscribeMixin(LitElement) {
|
|||||||
.hass=${this.hass}
|
.hass=${this.hass}
|
||||||
.domain=${domain}
|
.domain=${domain}
|
||||||
.items=${items}
|
.items=${items}
|
||||||
|
.manifest=${this._manifests[domain]}
|
||||||
.entityRegistryEntries=${this._entityRegistryEntries}
|
.entityRegistryEntries=${this._entityRegistryEntries}
|
||||||
.deviceRegistryEntries=${this._deviceRegistryEntries}
|
.deviceRegistryEntries=${this._deviceRegistryEntries}
|
||||||
></ha-integration-card>`
|
></ha-integration-card>`
|
||||||
@ -470,6 +478,13 @@ class HaConfigIntegrations extends SubscribeMixin(LitElement) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private async _fetchManifests() {
|
||||||
|
const manifests = {};
|
||||||
|
const fetched = await fetchIntegrationManifests(this.hass);
|
||||||
|
for (const manifest of fetched) manifests[manifest.domain] = manifest;
|
||||||
|
this._manifests = manifests;
|
||||||
|
}
|
||||||
|
|
||||||
private _handleRemoved(ev: HASSDomEvent<ConfigEntryRemovedEvent>) {
|
private _handleRemoved(ev: HASSDomEvent<ConfigEntryRemovedEvent>) {
|
||||||
this._configEntries = this._configEntries!.filter(
|
this._configEntries = this._configEntries!.filter(
|
||||||
(entry) => entry.entry_id !== ev.detail.entryId
|
(entry) => entry.entry_id !== ev.detail.entryId
|
||||||
|
@ -9,7 +9,7 @@ import {
|
|||||||
} from "lit-element";
|
} from "lit-element";
|
||||||
import { HomeAssistant } from "../../../types";
|
import { HomeAssistant } from "../../../types";
|
||||||
import { ConfigEntryExtended } from "./ha-config-integrations";
|
import { ConfigEntryExtended } from "./ha-config-integrations";
|
||||||
import { domainToName } from "../../../data/integration";
|
import { domainToName, IntegrationManifest } from "../../../data/integration";
|
||||||
import {
|
import {
|
||||||
ConfigEntry,
|
ConfigEntry,
|
||||||
updateConfigEntry,
|
updateConfigEntry,
|
||||||
@ -27,7 +27,7 @@ import {
|
|||||||
import { haStyle } from "../../../resources/styles";
|
import { haStyle } from "../../../resources/styles";
|
||||||
import "../../../components/ha-icon-next";
|
import "../../../components/ha-icon-next";
|
||||||
import { fireEvent } from "../../../common/dom/fire_event";
|
import { fireEvent } from "../../../common/dom/fire_event";
|
||||||
import { mdiDotsVertical } from "@mdi/js";
|
import { mdiDotsVertical, mdiOpenInNew } from "@mdi/js";
|
||||||
|
|
||||||
export interface ConfigEntryUpdatedEvent {
|
export interface ConfigEntryUpdatedEvent {
|
||||||
entry: ConfigEntry;
|
entry: ConfigEntry;
|
||||||
@ -68,12 +68,18 @@ export class HaIntegrationCard extends LitElement {
|
|||||||
|
|
||||||
@property() public items!: ConfigEntryExtended[];
|
@property() public items!: ConfigEntryExtended[];
|
||||||
|
|
||||||
|
@property() public manifest!: IntegrationManifest;
|
||||||
|
|
||||||
@property() public entityRegistryEntries!: EntityRegistryEntry[];
|
@property() public entityRegistryEntries!: EntityRegistryEntry[];
|
||||||
|
|
||||||
@property() public deviceRegistryEntries!: DeviceRegistryEntry[];
|
@property() public deviceRegistryEntries!: DeviceRegistryEntry[];
|
||||||
|
|
||||||
@property() public selectedConfigEntryId?: string;
|
@property() public selectedConfigEntryId?: string;
|
||||||
|
|
||||||
|
firstUpdated(changedProps) {
|
||||||
|
super.firstUpdated(changedProps);
|
||||||
|
}
|
||||||
|
|
||||||
protected render(): TemplateResult {
|
protected render(): TemplateResult {
|
||||||
if (this.items.length === 1) {
|
if (this.items.length === 1) {
|
||||||
return this._renderSingleEntry(this.items[0]);
|
return this._renderSingleEntry(this.items[0]);
|
||||||
@ -125,6 +131,7 @@ export class HaIntegrationCard extends LitElement {
|
|||||||
private _renderSingleEntry(item: ConfigEntryExtended): TemplateResult {
|
private _renderSingleEntry(item: ConfigEntryExtended): TemplateResult {
|
||||||
const devices = this._getDevices(item);
|
const devices = this._getDevices(item);
|
||||||
const entities = this._getEntities(item);
|
const entities = this._getEntities(item);
|
||||||
|
|
||||||
return html`
|
return html`
|
||||||
<ha-card
|
<ha-card
|
||||||
outlined
|
outlined
|
||||||
@ -229,6 +236,25 @@ export class HaIntegrationCard extends LitElement {
|
|||||||
"ui.panel.config.integrations.config_entry.system_options"
|
"ui.panel.config.integrations.config_entry.system_options"
|
||||||
)}
|
)}
|
||||||
</mwc-list-item>
|
</mwc-list-item>
|
||||||
|
${!this.manifest
|
||||||
|
? ""
|
||||||
|
: html`
|
||||||
|
<a
|
||||||
|
class="documentation"
|
||||||
|
href=${this.manifest.documentation}
|
||||||
|
rel="noreferrer"
|
||||||
|
target="_blank"
|
||||||
|
>
|
||||||
|
<mwc-list-item hasMeta>
|
||||||
|
${this.hass.localize(
|
||||||
|
"ui.panel.config.integrations.config_entry.documentation"
|
||||||
|
)}<ha-svg-icon
|
||||||
|
slot="meta"
|
||||||
|
.path=${mdiOpenInNew}
|
||||||
|
></ha-svg-icon>
|
||||||
|
</mwc-list-item>
|
||||||
|
</a>
|
||||||
|
`}
|
||||||
<mwc-list-item class="warning" @click=${this._removeIntegration}>
|
<mwc-list-item class="warning" @click=${this._removeIntegration}>
|
||||||
${this.hass.localize(
|
${this.hass.localize(
|
||||||
"ui.panel.config.integrations.config_entry.delete"
|
"ui.panel.config.integrations.config_entry.delete"
|
||||||
@ -360,6 +386,9 @@ export class HaIntegrationCard extends LitElement {
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
padding-right: 5px;
|
padding-right: 5px;
|
||||||
}
|
}
|
||||||
|
.card-actions .documentation {
|
||||||
|
color: var(--primary-text-color);
|
||||||
|
}
|
||||||
.group-header {
|
.group-header {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
@ -402,6 +431,7 @@ export class HaIntegrationCard extends LitElement {
|
|||||||
}
|
}
|
||||||
ha-button-menu {
|
ha-button-menu {
|
||||||
color: var(--secondary-text-color);
|
color: var(--secondary-text-color);
|
||||||
|
--mdc-menu-min-width: 200px;
|
||||||
}
|
}
|
||||||
@media (min-width: 563px) {
|
@media (min-width: 563px) {
|
||||||
paper-listbox {
|
paper-listbox {
|
||||||
|
@ -1469,6 +1469,7 @@
|
|||||||
"rename": "Rename",
|
"rename": "Rename",
|
||||||
"options": "Options",
|
"options": "Options",
|
||||||
"system_options": "System options",
|
"system_options": "System options",
|
||||||
|
"documentation": "Documentation",
|
||||||
"delete": "Delete",
|
"delete": "Delete",
|
||||||
"delete_confirm": "Are you sure you want to delete this integration?",
|
"delete_confirm": "Are you sure you want to delete this integration?",
|
||||||
"restart_confirm": "Restart Home Assistant to finish removing this integration",
|
"restart_confirm": "Restart Home Assistant to finish removing this integration",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user