From 25b3bb1285d7892891bbe8d77824f576b35bfe71 Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Fri, 16 Apr 2021 11:22:22 -0700 Subject: [PATCH] Fixes for integration cards (#8930) --- gallery/src/demos/demo-integration-card.ts | 116 +++++++++++------- .../integrations/ha-integration-card.ts | 25 ++-- 2 files changed, 90 insertions(+), 51 deletions(-) diff --git a/gallery/src/demos/demo-integration-card.ts b/gallery/src/demos/demo-integration-card.ts index 1e805910a8..966978ffd1 100644 --- a/gallery/src/demos/demo-integration-card.ts +++ b/gallery/src/demos/demo-integration-card.ts @@ -139,9 +139,9 @@ const configEntries: Array<{ { items: [ loadedEntry, - longNameEntry, setupErrorEntry, migrationErrorEntry, + longNameEntry, setupRetryEntry, failedUnloadEntry, notLoadedEntry, @@ -211,47 +211,77 @@ export class DemoIntegrationCard extends LitElement { return html``; } return html` -
- - - - - - +
+
+ + + + + + +
+ + + + ${configFlows.map( + (flow) => html` + + ` + )} + ${configEntries.map( + (info) => html` + + ` + )} +
+
+ +
- - - - ${configFlows.map( - (flow) => html` - - ` - )} - ${configEntries.map( - (info) => html` - - ` - )} `; } @@ -272,7 +302,7 @@ export class DemoIntegrationCard extends LitElement { static get styles() { return css` - :host { + .container { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); grid-gap: 16px 16px; @@ -280,7 +310,7 @@ export class DemoIntegrationCard extends LitElement { margin-bottom: 64px; } - :host > * { + .container > * { max-width: 500px; } diff --git a/src/panels/config/integrations/ha-integration-card.ts b/src/panels/config/integrations/ha-integration-card.ts index fc975fb6bc..786b394e7e 100644 --- a/src/panels/config/integrations/ha-integration-card.ts +++ b/src/panels/config/integrations/ha-integration-card.ts @@ -49,7 +49,6 @@ import { } from "./ha-config-integrations-common"; const ERROR_STATES: ConfigEntry["state"][] = [ - "failed_unload", "migration_error", "setup_error", "setup_retry", @@ -116,6 +115,7 @@ export class HaIntegrationCard extends LitElement { hasMultiple: this.items.length > 1, disabled: this.disabled, "state-not-loaded": hasItem && item!.state === "not_loaded", + "state-failed-unload": hasItem && item!.state === "failed_unload", "state-error": hasItem && ERROR_STATES.includes(item!.state), })}" .configEntry=${item} @@ -619,6 +619,10 @@ export class HaIntegrationCard extends LitElement { --state-color: var(--error-color); --text-on-state-color: var(--text-primary-color); } + .state-failed-unload { + --state-color: var(--warning-color); + --text-on-state-color: var(--primary-text-color); + } .state-not-loaded { --state-message-color: var(--primary-text-color); } @@ -626,9 +630,6 @@ export class HaIntegrationCard extends LitElement { --state-color: var(--accent-color); --text-on-state-color: var(--text-primary-color); } - ha-card.group { - max-height: 200px; - } .back-btn { background-color: var(--state-color); @@ -650,9 +651,6 @@ export class HaIntegrationCard extends LitElement { align-items: center; padding: 16px 8px 8px 16px; } - .group.disabled .header { - padding-top: 8px; - } .header img { margin-right: 16px; width: 40px; @@ -706,10 +704,21 @@ export class HaIntegrationCard extends LitElement { --mdc-menu-min-width: 200px; } @media (min-width: 563px) { + ha-card.group { + position: relative; + min-height: 164px; + } paper-listbox { - flex: 1; + position: absolute; + top: 64px; + left: 0; + right: 0; + bottom: 0; overflow: auto; } + .disabled paper-listbox { + top: 100px; + } } paper-item { cursor: pointer;