- fixed up optional metadata + + desc
- using timestamp for default new ids '
This commit is contained in:
1 parent
ea47b3e1eb
commit
bcd262dd46
5 files changed
+61
-9
No files matched your search
@@ -80,8 +80,8 @@ export const AutoInfoBox: FC<Props> = ({
|
||||
return <div className={`automation-editor--info-box ${className}`}>
|
||||
<div className="automation-editor--info-box-inner">
|
||||
<InputText label="ID" value={metadata.id} onChange={onUpdateMetadata('id')} />
|
||||
<InputText label="Name" value={metadata.alias} onChange={onUpdateMetadata('alias')} />
|
||||
<InputTextArea label="Description" value={metadata.description} onChange={onUpdateMetadata('description')} />
|
||||
<InputText label="Name" value={metadata.alias ?? ""} onChange={onUpdateMetadata('alias')} />
|
||||
<InputTextArea label="Description" value={metadata.description ?? ""} onChange={onUpdateMetadata('description')} />
|
||||
<InputList
|
||||
label="Mode"
|
||||
current={metadata.mode}
|
||||
|
||||
@@ -448,6 +448,58 @@ FewAutos.args = {
|
||||
}
|
||||
],
|
||||
"tags": {}
|
||||
},
|
||||
{
|
||||
"metadata": {
|
||||
"id": "alarmanlage_an",
|
||||
"alias": "alarmanlage_an (Uhrzeit)",
|
||||
"mode": "single"
|
||||
},
|
||||
tags: {},
|
||||
"trigger": [
|
||||
{
|
||||
"entity_id": "sensor.time",
|
||||
"platform": "state",
|
||||
"to": "23:30"
|
||||
}
|
||||
],
|
||||
"condition": [
|
||||
{
|
||||
"condition": "or",
|
||||
"conditions": [
|
||||
{
|
||||
"condition": "state",
|
||||
"entity_id": "person.simon",
|
||||
"state": "home"
|
||||
},
|
||||
{
|
||||
"condition": "state",
|
||||
"entity_id": "person.leni",
|
||||
"state": "home"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"sequence": [
|
||||
{
|
||||
"service": "alarm_control_panel.alarm_arm_night",
|
||||
"target": {
|
||||
"entity_id": [
|
||||
"alarm_control_panel.alarmo"
|
||||
]
|
||||
},
|
||||
"data": {
|
||||
"code": "xxx"
|
||||
}
|
||||
},
|
||||
{
|
||||
"service": "alarm_control_panel.alarm_arm_away",
|
||||
"data": {},
|
||||
"target": {
|
||||
"entity_id": "alarm_control_panel.blink_home"
|
||||
}
|
||||
}
|
||||
],
|
||||
}
|
||||
],
|
||||
}
|
||||
|
||||
@@ -71,8 +71,8 @@ const filterAutomations = (autos: AutomationData[], searchText: string, selected
|
||||
if (searchText.length > 0) {
|
||||
if (
|
||||
!(
|
||||
a.metadata.description.toLocaleLowerCase().includes(searchText) ||
|
||||
a.metadata.alias.toLocaleLowerCase().includes(searchText)
|
||||
(a.metadata.description ?? "").toLocaleLowerCase().includes(searchText) ||
|
||||
(a.metadata.alias ?? "").toLocaleLowerCase().includes(searchText)
|
||||
)
|
||||
) {
|
||||
return false
|
||||
@@ -169,8 +169,8 @@ export const MetadataBox: FC<{
|
||||
let title = <span>{"BadAuto<<Missing Metadata>>"}</span>
|
||||
if (auto.metadata) {
|
||||
title = <>
|
||||
<b>{String(auto.metadata.alias).slice(0, 15)} <span>({String(auto.metadata.id).slice(0, 5)})</span></b>
|
||||
<span>{String(auto.metadata.description).slice(0, 25)}</span>
|
||||
<b>{String(auto.metadata.alias ?? "").slice(0, 15)} <span>({String(auto.metadata.id).slice(0, 5)})</span></b>
|
||||
<span>{String(auto.metadata.description ?? "").slice(0, 25)}</span>
|
||||
</>
|
||||
}
|
||||
return <div
|
||||
|
||||
@@ -40,7 +40,7 @@ export const AutomationList: FC<AutomationListParams> = ({
|
||||
<AutomationListBox
|
||||
automations={automations}
|
||||
onAdd={() => {
|
||||
onAdd(defaultAutomation(`shortu-${automations.length}`));
|
||||
onAdd(defaultAutomation(String(Date.now())));
|
||||
setCurrent(automations.length)
|
||||
}}
|
||||
onSelectAutomation={i => {
|
||||
|
||||
@@ -3,8 +3,8 @@ import * as st from 'superstruct'
|
||||
|
||||
export const AutomationMetadata = st.object({
|
||||
id: st.string(),
|
||||
alias: st.string(),
|
||||
description: st.string(),
|
||||
alias: st.optional(st.string()),
|
||||
description: st.optional(st.string()),
|
||||
trigger_variables: st.optional(st.nullable(st.record(st.string(), st.string()))),
|
||||
mode: st.enums(["single", "restart", "queued", "parallel"]),
|
||||
})
|
||||
Reference in new issue
Block a user