Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/managers/notification-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,12 @@ class NotificationManager extends LitElement {
display: flex;
align-items: center;
justify-content: space-between;
padding: 8px 12px;
}
mwc-button {
color: var(--primary-color);
font-weight: bold;
margin-left: 8px;
}
`;
}
Expand Down
43 changes: 30 additions & 13 deletions src/panels/config/automation/ha-automation-editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import "../../../components/ha-card";
import "../../../components/ha-icon-button";
import "../../../components/ha-svg-icon";
import "../../../components/ha-yaml-editor";
import { showToast } from "../../../util/toast";
import type { HaYamlEditor } from "../../../components/ha-yaml-editor";
import {
AutomationConfig,
Expand Down Expand Up @@ -89,8 +90,6 @@ export class HaAutomationEditor extends KeyboardShortcutMixin(LitElement) {

@internalProperty() private _dirty = false;

@internalProperty() private _errors?: string;

@internalProperty() private _entityId?: string;

@internalProperty() private _mode: "gui" | "yaml" = "gui";
Expand Down Expand Up @@ -131,7 +130,8 @@ export class HaAutomationEditor extends KeyboardShortcutMixin(LitElement) {
>
${this.hass.localize("ui.panel.config.automation.editor.edit_ui")}
${this._mode === "gui"
? html`<ha-svg-icon
? html` <ha-svg-icon
Comment thread
spacegaier marked this conversation as resolved.
Outdated
class="selected_menu_item"
slot="graphic"
.path=${mdiCheck}
></ha-svg-icon>`
Expand All @@ -146,7 +146,8 @@ export class HaAutomationEditor extends KeyboardShortcutMixin(LitElement) {
>
${this.hass.localize("ui.panel.config.automation.editor.edit_yaml")}
${this._mode === "yaml"
? html`<ha-svg-icon
? html` <ha-svg-icon
class="selected_menu_item"
slot="graphic"
.path=${mdiCheck}
></ha-svg-icon>`
Expand All @@ -168,6 +169,7 @@ export class HaAutomationEditor extends KeyboardShortcutMixin(LitElement) {
<ha-svg-icon
slot="graphic"
.path=${mdiContentDuplicate}
class=${classMap({ enabled_icon: this.automationId })}
></ha-svg-icon>
</mwc-list-item>

Expand All @@ -182,7 +184,12 @@ export class HaAutomationEditor extends KeyboardShortcutMixin(LitElement) {
${this.hass.localize(
"ui.panel.config.automation.picker.delete_automation"
)}
<ha-svg-icon slot="graphic" .path=${mdiDelete}></ha-svg-icon>
<ha-svg-icon
class=${classMap({ warning: this.automationId })}
slot="graphic"
.path=${mdiDelete}
>
</ha-svg-icon>
</mwc-list-item>
</ha-button-menu>
${this._config
Expand All @@ -191,9 +198,6 @@ export class HaAutomationEditor extends KeyboardShortcutMixin(LitElement) {
? html` <span slot="header">${this._config?.alias}</span> `
: ""}
<div class="content">
${this._errors
? html` <div class="errors">${this._errors}</div> `
: ""}
${this._mode === "gui"
? html`
<ha-config-section .isWide=${this.isWide}>
Expand Down Expand Up @@ -586,7 +590,6 @@ export class HaAutomationEditor extends KeyboardShortcutMixin(LitElement) {

private _triggerChanged(ev: CustomEvent): void {
this._config = { ...this._config!, trigger: ev.detail.value as Trigger[] };
this._errors = undefined;
this._dirty = true;
}

Expand All @@ -595,13 +598,11 @@ export class HaAutomationEditor extends KeyboardShortcutMixin(LitElement) {
...this._config!,
condition: ev.detail.value as Condition[],
};
this._errors = undefined;
this._dirty = true;
}

private _actionChanged(ev: CustomEvent): void {
this._config = { ...this._config!, action: ev.detail.value as Action[] };
this._errors = undefined;
this._dirty = true;
}

Expand Down Expand Up @@ -632,7 +633,6 @@ export class HaAutomationEditor extends KeyboardShortcutMixin(LitElement) {
return;
}
this._config = ev.detail.value;
this._errors = undefined;
this._dirty = true;
}

Expand Down Expand Up @@ -724,7 +724,15 @@ export class HaAutomationEditor extends KeyboardShortcutMixin(LitElement) {
}
},
(errors) => {
this._errors = errors.body.message;
showToast(this, {
message: errors.body.message,
dismissable: false,
duration: 0,
Comment thread
spacegaier marked this conversation as resolved.
Outdated
action: {
action: () => {},
text: this.hass.localize("ui.dialogs.generic.ok"),
},
});
throw errors;
}
);
Expand Down Expand Up @@ -766,6 +774,15 @@ export class HaAutomationEditor extends KeyboardShortcutMixin(LitElement) {
mwc-fab.dirty {
bottom: 0;
}
.enabled_icon {
color: var(--primary-text-color);
}
.selected_menu_item {
color: var(--primary-color);
}
Comment on lines +781 to +786

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is that the correct link you wanted to paste? If yes, I must be missing the point how the quickbar is related to this PR.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The mdc-theme-text-secondary-on-background variable is the one used for the icon, that is what you are fixing here right? (they both use mwc-list-item)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I thought the link pointed to ha-quick-bar.ts. My change however, does one extra thing: The checkbox icon is colored in primary-color. Also, in case the menu option is disabled, what would happen with your change?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made a test by copying the mentioned style line from your PR. Does not work for me. All icons are black except the last one which I colored red.

li[role="separator"] {
border-bottom-color: var(--divider-color);
}
`,
];
}
Expand Down
14 changes: 10 additions & 4 deletions src/panels/config/scene/ha-scene-editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ import { HomeAssistant, Route } from "../../../types";
import "../ha-config-section";
import { configSections } from "../ha-panel-config";
import "../../../components/ha-svg-icon";
import { showToast } from "../../../util/toast";
import { mdiContentSave } from "@mdi/js";
import { KeyboardShortcutMixin } from "../../../mixins/keyboard-shortcut-mixin";

Expand Down Expand Up @@ -90,8 +91,6 @@ export class HaSceneEditor extends SubscribeMixin(

@internalProperty() private _dirty = false;

@internalProperty() private _errors?: string;

@internalProperty() private _config?: SceneConfig;

@internalProperty() private _entities: string[] = [];
Expand Down Expand Up @@ -210,7 +209,6 @@ export class HaSceneEditor extends SubscribeMixin(
@click=${this._deleteTapped}
></ha-icon-button>
`}
${this._errors ? html` <div class="errors">${this._errors}</div> ` : ""}
${this.narrow ? html` <span slot="header">${name}</span> ` : ""}
<div
id="root"
Expand Down Expand Up @@ -714,7 +712,15 @@ export class HaSceneEditor extends SubscribeMixin(
navigate(this, `/config/scene/edit/${id}`, true);
}
} catch (err) {
this._errors = err.body.message || err.message;
showToast(this, {
message: err.body.message || err.message,
dismissable: false,
duration: 0,
action: {
action: () => {},
text: this.hass.localize("ui.dialogs.generic.ok"),
},
});
throw err;
}
}
Expand Down
50 changes: 36 additions & 14 deletions src/panels/config/script/ha-script-editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,6 @@ export class HaScriptEditor extends KeyboardShortcutMixin(LitElement) {

@internalProperty() private _dirty = false;

@internalProperty() private _errors?: string;

@internalProperty() private _mode: "gui" | "yaml" = "gui";

@query("ha-yaml-editor", true) private _editor?: HaYamlEditor;
Expand Down Expand Up @@ -106,7 +104,8 @@ export class HaScriptEditor extends KeyboardShortcutMixin(LitElement) {
>
${this.hass.localize("ui.panel.config.automation.editor.edit_ui")}
${this._mode === "gui"
? html`<ha-svg-icon
? html` <ha-svg-icon
class="selected_menu_item"
slot="graphic"
.path=${mdiCheck}
></ha-svg-icon>`
Expand All @@ -121,7 +120,8 @@ export class HaScriptEditor extends KeyboardShortcutMixin(LitElement) {
>
${this.hass.localize("ui.panel.config.automation.editor.edit_yaml")}
${this._mode === "yaml"
? html`<ha-svg-icon
? html` <ha-svg-icon
class="selected_menu_item"
slot="graphic"
.path=${mdiCheck}
></ha-svg-icon>`
Expand All @@ -139,16 +139,18 @@ export class HaScriptEditor extends KeyboardShortcutMixin(LitElement) {
graphic="icon"
>
${this.hass.localize("ui.panel.config.script.editor.delete_script")}
<ha-svg-icon slot="graphic" .path=${mdiDelete}></ha-svg-icon>
<ha-svg-icon
class=${classMap({ warning: this.scriptEntityId })}
slot="graphic"
.path=${mdiDelete}
>
</ha-svg-icon>
</mwc-list-item>
</ha-button-menu>
${this.narrow
? html` <span slot="header">${this._config?.alias}</span> `
: ""}
<div class="content">
${this._errors
? html` <div class="errors">${this._errors}</div> `
: ""}
${this._mode === "gui"
? html`
<div
Expand Down Expand Up @@ -504,7 +506,6 @@ export class HaScriptEditor extends KeyboardShortcutMixin(LitElement) {

private _sequenceChanged(ev: CustomEvent): void {
this._config = { ...this._config!, sequence: ev.detail.value as Action[] };
this._errors = undefined;
this._dirty = true;
}

Expand All @@ -524,7 +525,6 @@ export class HaScriptEditor extends KeyboardShortcutMixin(LitElement) {
return;
}
this._config = ev.detail.value;
this._errors = undefined;
this._dirty = true;
}

Expand Down Expand Up @@ -573,9 +573,17 @@ export class HaScriptEditor extends KeyboardShortcutMixin(LitElement) {

private _saveScript(): void {
if (this._idError) {
this._errors = this.hass.localize(
"ui.panel.config.script.editor.id_already_exists_save_error"
);
showToast(this, {
message: this.hass.localize(
"ui.panel.config.script.editor.id_already_exists_save_error"
),
dismissable: false,
duration: 0,
action: {
action: () => {},
text: this.hass.localize("ui.dialogs.generic.ok"),
},
});
return;
}
const id = this.scriptEntityId
Expand All @@ -590,7 +598,15 @@ export class HaScriptEditor extends KeyboardShortcutMixin(LitElement) {
}
},
(errors) => {
this._errors = errors.body.message;
showToast(this, {
message: errors.body.message,
dismissable: false,
duration: 0,
action: {
action: () => {},
text: this.hass.localize("ui.dialogs.generic.ok"),
},
});
throw errors;
}
);
Expand Down Expand Up @@ -629,6 +645,12 @@ export class HaScriptEditor extends KeyboardShortcutMixin(LitElement) {
mwc-fab.dirty {
bottom: 0;
}
.selected_menu_item {
color: var(--primary-color);
}
li[role="separator"] {
border-bottom-color: var(--divider-color);
}
`,
];
}
Expand Down