mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-26 18:56:39 +00:00
Warn when punctuation is used in conversation trigger (#17119)
This commit is contained in:
parent
e5146512d5
commit
d6f8941098
@ -10,6 +10,8 @@ import { showConfirmationDialog } from "../../../../../dialogs/generic/show-dial
|
|||||||
import { HomeAssistant } from "../../../../../types";
|
import { HomeAssistant } from "../../../../../types";
|
||||||
import { TriggerElement } from "../ha-automation-trigger-row";
|
import { TriggerElement } from "../ha-automation-trigger-row";
|
||||||
|
|
||||||
|
const PATTERN = "^[^.。,,?¿?؟!!;;::]+$";
|
||||||
|
|
||||||
@customElement("ha-automation-trigger-conversation")
|
@customElement("ha-automation-trigger-conversation")
|
||||||
export class HaConversationTrigger
|
export class HaConversationTrigger
|
||||||
extends LitElement
|
extends LitElement
|
||||||
@ -39,6 +41,12 @@ export class HaConversationTrigger
|
|||||||
iconTrailing
|
iconTrailing
|
||||||
.index=${index}
|
.index=${index}
|
||||||
.value=${option}
|
.value=${option}
|
||||||
|
.validationMessage=${this.hass.localize(
|
||||||
|
"ui.panel.config.automation.editor.triggers.type.conversation.no_punctuation"
|
||||||
|
)}
|
||||||
|
autoValidate
|
||||||
|
validateOnInitialRender
|
||||||
|
pattern=${PATTERN}
|
||||||
@change=${this._updateOption}
|
@change=${this._updateOption}
|
||||||
>
|
>
|
||||||
<ha-icon-button
|
<ha-icon-button
|
||||||
@ -56,6 +64,11 @@ export class HaConversationTrigger
|
|||||||
.label=${this.hass.localize(
|
.label=${this.hass.localize(
|
||||||
"ui.panel.config.automation.editor.triggers.type.conversation.add_sentence"
|
"ui.panel.config.automation.editor.triggers.type.conversation.add_sentence"
|
||||||
)}
|
)}
|
||||||
|
.validationMessage=${this.hass.localize(
|
||||||
|
"ui.panel.config.automation.editor.triggers.type.conversation.no_punctuation"
|
||||||
|
)}
|
||||||
|
autoValidate
|
||||||
|
pattern=${PATTERN}
|
||||||
@keydown=${this._handleKeyAdd}
|
@keydown=${this._handleKeyAdd}
|
||||||
@change=${this._addOption}
|
@change=${this._addOption}
|
||||||
></ha-textfield>`;
|
></ha-textfield>`;
|
||||||
|
@ -2382,6 +2382,7 @@
|
|||||||
},
|
},
|
||||||
"conversation": {
|
"conversation": {
|
||||||
"label": "Sentence",
|
"label": "Sentence",
|
||||||
|
"no_punctuation": "You should not use punctuation in your sentence",
|
||||||
"add_sentence": "Add sentence",
|
"add_sentence": "Add sentence",
|
||||||
"delete": "Delete sentence",
|
"delete": "Delete sentence",
|
||||||
"confirm_delete": "Are you sure you want to delete this sentence?",
|
"confirm_delete": "Are you sure you want to delete this sentence?",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user