diff --git a/webapp/src/components/NodeEditor/index.stories.tsx b/webapp/src/components/NodeEditor/index.stories.tsx index f4dc3d0..01e9241 100644 --- a/webapp/src/components/NodeEditor/index.stories.tsx +++ b/webapp/src/components/NodeEditor/index.stories.tsx @@ -22,9 +22,17 @@ export default { } as ComponentMeta; const Base: ComponentStory = (props) => { + const [state, setState] = useState(props.node); return ( - + { + setState(s); + props.onSave && props.onSave(s); + }} + /> ); }; @@ -133,3 +141,15 @@ DeviceActionFilledExample.args = { device_id: "c9711be86b0301955f72380509285485", }, }; + +export const NotifyPhoneViaDeviceAction = Action.bind({}); +NotifyPhoneViaDeviceAction.args = { + ...NotifyPhoneViaDeviceAction.args, + node: { + device_id: "2a98db84af7526c7ec3cc7aebd1a9e1c", + domain: "mobile_app", + type: "notify", + title: "Hassio Status", + message: "Hassio Is turning off...", + } as any, +}; diff --git a/webapp/src/types/validators/actions.ts b/webapp/src/types/validators/actions.ts index 2a11f19..6f069d7 100644 --- a/webapp/src/types/validators/actions.ts +++ b/webapp/src/types/validators/actions.ts @@ -52,10 +52,10 @@ export const FireEventAction = st.intersection([ }), ]); -export const DeviceAction = st.intersection([ +export const DeviceAction = st.assign( AutomationActionNodeBase, - st.partial(AutomationDeviceState), -]); + st.partial(AutomationDeviceState) +); export const ChooseAction = st.intersection([ AutomationActionNodeBase,