Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
084d86ad7a | ||
|
|
ea6be4a8f3 | ||
|
|
14649ac1fd | ||
|
|
f1b99cad1c | ||
|
|
ab7f50d4aa | ||
|
|
d22bba8c4d | ||
|
|
549f52655b | ||
|
|
2c5d64ab86 | ||
|
|
7c50c345ec | ||
|
|
f4261f9701 | ||
|
|
34826acb97 |
No files matched your search
@@ -1,5 +1,18 @@
|
||||
# Changelog 
|
||||
|
||||
## [0.5.1] - Sidebar!
|
||||
|
||||
- completely redesigned the sidebar!
|
||||
|
||||
- Disable/enable automatons
|
||||
- See 'bad state' automatons
|
||||
- Delete automatons from registry (in cases where references are stale)
|
||||
- Refactored sidebar UX to match MUI standards
|
||||
- Cleaned up editing tags in sidebar
|
||||
<img src="https://user-images.githubusercontent.com/7451445/182066721-07a93651-2f83-44d5-8420-15093caa52df.png" width="400px"/>
|
||||
|
||||
- Websockets now live-refresh when updates occur
|
||||
|
||||
## [0.4.0] - Depedency update
|
||||
|
||||
- Core dependency updates
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
name: Shortumation
|
||||
version: v0.4.0
|
||||
version: v0.5.1
|
||||
slug: shortumation
|
||||
image: asosnovsky/shortumation-{arch}
|
||||
url: "https://github.com/asosnovsky/Shortumation"
|
||||
|
||||
+2
-2
@@ -17,7 +17,7 @@
|
||||
"@uiw/react-codemirror": "4.10.4",
|
||||
"autosuggest-highlight": "3.3.4",
|
||||
"home-assistant-js-websocket": "7.1.0",
|
||||
"jss": "10.9.1",
|
||||
"jss": "10.9.2",
|
||||
"material-ui-confirm": "3.0.4",
|
||||
"notistack": "2.0.5",
|
||||
"react": "18.2.0",
|
||||
@@ -25,7 +25,7 @@
|
||||
"react-dom": "18.2.0",
|
||||
"react-flow-renderer": "10.3.12",
|
||||
"react-imask": "6.4.2",
|
||||
"react-jss": "10.9.1",
|
||||
"react-jss": "10.9.2",
|
||||
"react-router-dom": "6.3.0",
|
||||
"react-scripts": "5.0.1",
|
||||
"superstruct": "0.16.0",
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import "./AutoInfoBox.css";
|
||||
import { AutomationMetadata } from "types/automations";
|
||||
import { InputList } from "components/Inputs/InputList";
|
||||
import InputText from "components/Inputs/InputText";
|
||||
import InputText from "components/Inputs/Base/InputText";
|
||||
import { FC, ReactNode, useRef, useState } from "react";
|
||||
import { AddIcon, TrashIcon } from "components/Icons";
|
||||
import InputAutoText from "components/Inputs/InputAutoText";
|
||||
|
||||
@@ -3,19 +3,23 @@ import "./index.mobile.css";
|
||||
|
||||
import { FC, useState } from "react";
|
||||
import { useCookies } from "react-cookie";
|
||||
import { ControlButton } from "react-flow-renderer";
|
||||
|
||||
import Skeleton from "@mui/material/Skeleton";
|
||||
import LinearProgress from "@mui/material/LinearProgress";
|
||||
import SpeedDial from "@mui/material/SpeedDial";
|
||||
import SpeedDialAction from "@mui/material/SpeedDialAction";
|
||||
|
||||
import Edit from "@mui/icons-material/Edit";
|
||||
import SpeedDialIcon from "@mui/icons-material/SettingsRounded";
|
||||
import UndoIcon from "@mui/icons-material/UndoSharp";
|
||||
import Icon from "@mui/material/Icon";
|
||||
import ModeEditOutlineTwoToneIcon from "@mui/icons-material/ModeEditOutlineTwoTone";
|
||||
import EditIcon from "@mui/icons-material/ModeEditOutlineTwoTone";
|
||||
import DeleteIcon from "@mui/icons-material/DeleteForever";
|
||||
import { CheckMarkIcon } from "components/Icons";
|
||||
import RunIcon from "@mui/icons-material/RunCircleOutlined";
|
||||
|
||||
import { Modal } from "components/Modal";
|
||||
import { Button } from "components/Inputs/Button";
|
||||
import InputYaml from "components/Inputs/InputYaml";
|
||||
import { Button } from "components/Inputs/Buttons/Button";
|
||||
import InputYaml from "components/Inputs/Base/InputYaml";
|
||||
import { TagDB } from "components/AutomationManager/TagDB";
|
||||
import { DAGDims } from "components/DAGGraph/elements/types";
|
||||
import { DAGAutomationGraph } from "components/DAGGraph";
|
||||
@@ -32,6 +36,8 @@ interface Props {
|
||||
automation?: AutomationData;
|
||||
dims: DAGDims;
|
||||
onUpdate: (auto: AutomationData) => void;
|
||||
onTrigger: () => void;
|
||||
onDelete: () => void;
|
||||
tagDB: TagDB;
|
||||
isNew?: boolean;
|
||||
}
|
||||
@@ -39,6 +45,8 @@ export const AutomationEditor: FC<Props> = ({
|
||||
dims,
|
||||
automation: propsAutos,
|
||||
onUpdate: propsOnUpdate,
|
||||
onDelete,
|
||||
onTrigger,
|
||||
tagDB,
|
||||
isNew,
|
||||
}) => {
|
||||
@@ -52,6 +60,7 @@ export const AutomationEditor: FC<Props> = ({
|
||||
validate,
|
||||
save,
|
||||
saveAndUpdate,
|
||||
undo,
|
||||
} = useAutomatioEditorState(propsAutos, propsOnUpdate);
|
||||
const [infoBoxOpen, setInfoBox] = useState(false);
|
||||
const [
|
||||
@@ -198,12 +207,11 @@ export const AutomationEditor: FC<Props> = ({
|
||||
Flip
|
||||
</Button>
|
||||
)}
|
||||
<Button
|
||||
className={"automation-editor--flow-wrapper--toolbar--edit-btn"}
|
||||
onClick={() => setInfoBox(!infoBoxOpen)}
|
||||
>
|
||||
Metadata <Edit />
|
||||
</Button>
|
||||
{state.status === "changed" && (
|
||||
<Button onClick={undo}>
|
||||
<UndoIcon />
|
||||
</Button>
|
||||
)}
|
||||
<Button
|
||||
className={"automation-editor--flow-wrapper--toolbar--save-btn"}
|
||||
onClick={save}
|
||||
@@ -220,12 +228,39 @@ export const AutomationEditor: FC<Props> = ({
|
||||
onTriggerUpdate={updateTrigger}
|
||||
onConditionUpdate={updateCondition}
|
||||
isFlipped={flipped}
|
||||
additionalControls={
|
||||
<ControlButton onClick={() => setInfoBox(!infoBoxOpen)}>
|
||||
<ModeEditOutlineTwoToneIcon />
|
||||
</ControlButton>
|
||||
}
|
||||
/>
|
||||
<SpeedDial
|
||||
ariaLabel="options label"
|
||||
sx={{ position: "absolute", bottom: 16, right: 16 }}
|
||||
icon={<SpeedDialIcon />}
|
||||
>
|
||||
<SpeedDialAction
|
||||
tooltipOpen
|
||||
icon={<RunIcon />}
|
||||
tooltipTitle={"Trigger"}
|
||||
onClick={onTrigger}
|
||||
/>
|
||||
<SpeedDialAction
|
||||
tooltipOpen
|
||||
icon={<DeleteIcon />}
|
||||
tooltipTitle={"Delete"}
|
||||
onClick={onDelete}
|
||||
/>
|
||||
<SpeedDialAction
|
||||
tooltipOpen
|
||||
icon={<EditIcon />}
|
||||
tooltipTitle={"Metadata"}
|
||||
onClick={() => setInfoBox(!infoBoxOpen)}
|
||||
/>
|
||||
{state.status === "changed" && (
|
||||
<SpeedDialAction
|
||||
tooltipOpen
|
||||
icon={<UndoIcon />}
|
||||
tooltipTitle={"Undo"}
|
||||
onClick={undo}
|
||||
/>
|
||||
)}
|
||||
</SpeedDial>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -1,117 +1,156 @@
|
||||
import { useState, useEffect } from 'react';
|
||||
import { useState, useEffect } from "react";
|
||||
import { AutomationData, AutomationMetadata } from "types/automations";
|
||||
import * as v from "types/validators/autmation";
|
||||
import { getFailures } from "types/validators/helper";
|
||||
import { MiniFailure } from '../../types/validators/helper';
|
||||
import { MiniFailure } from "../../types/validators/helper";
|
||||
|
||||
export type EditorData = ReturnType<typeof genEditorData>;
|
||||
export type EditorState = {
|
||||
status: 'unchanged' | 'changed' | 'saving',
|
||||
data: EditorData
|
||||
} | {
|
||||
status: 'loading'
|
||||
} | {
|
||||
status: 'invalid',
|
||||
failures: MiniFailure[],
|
||||
data: EditorData,
|
||||
}
|
||||
export type EditorStatus = EditorState['status'];
|
||||
export type EditorState =
|
||||
| {
|
||||
status: "unchanged";
|
||||
data: EditorData;
|
||||
}
|
||||
| {
|
||||
status: "changed" | "saving";
|
||||
previous: EditorData[];
|
||||
data: EditorData;
|
||||
}
|
||||
| {
|
||||
status: "loading";
|
||||
}
|
||||
| {
|
||||
status: "invalid";
|
||||
failures: MiniFailure[];
|
||||
data: EditorData;
|
||||
};
|
||||
export type EditorStatus = EditorState["status"];
|
||||
|
||||
export const useAutomatioEditorState = (
|
||||
automation: AutomationData | undefined,
|
||||
onSave: (a: AutomationData) => void,
|
||||
automation: AutomationData | undefined,
|
||||
onSave: (a: AutomationData) => void
|
||||
) => {
|
||||
const [state, update] = useState<EditorState>({
|
||||
status: "loading",
|
||||
});
|
||||
const makeUpdate = <K extends keyof EditorData, D extends EditorData[K]>(name: K) => (
|
||||
data: D
|
||||
) => ((state.status === 'changed') || (state.status === 'unchanged')) && update({
|
||||
status: 'changed',
|
||||
const [state, update] = useState<EditorState>({
|
||||
status: "loading",
|
||||
});
|
||||
const makeUpdate =
|
||||
<K extends keyof EditorData, D extends EditorData[K]>(name: K) =>
|
||||
(data: D) =>
|
||||
(state.status === "changed" || state.status === "unchanged") &&
|
||||
update({
|
||||
status: "changed",
|
||||
previous:
|
||||
state.status === "unchanged"
|
||||
? [state.data]
|
||||
: state.previous.concat([state.data]),
|
||||
data: {
|
||||
...state.data,
|
||||
[name]: data,
|
||||
}
|
||||
})
|
||||
...state.data,
|
||||
[name]: data,
|
||||
},
|
||||
});
|
||||
|
||||
const saveAndUpdate = (data: EditorData) => {
|
||||
const cleanData = {
|
||||
...data,
|
||||
tags: data.tags.reduce((all, [tagName, tagValue]) => ({
|
||||
...all,
|
||||
[tagName.trim()]: tagValue.trim(),
|
||||
}), {})
|
||||
};
|
||||
const saveAndUpdate = (data: EditorData) => {
|
||||
if (state.status === "changed") {
|
||||
const cleanData = {
|
||||
...data,
|
||||
tags: data.tags.reduce(
|
||||
(all, [tagName, tagValue]) => ({
|
||||
...all,
|
||||
[tagName.trim()]: tagValue.trim(),
|
||||
}),
|
||||
{}
|
||||
),
|
||||
};
|
||||
update({
|
||||
status: "saving",
|
||||
previous: state.previous,
|
||||
data,
|
||||
});
|
||||
onSave(cleanData);
|
||||
}
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
if (automation) {
|
||||
const failures = getFailures(automation, v.AutomationData);
|
||||
if (failures) {
|
||||
update({
|
||||
status: "saving",
|
||||
data,
|
||||
})
|
||||
onSave(cleanData);
|
||||
status: "invalid",
|
||||
failures,
|
||||
data: genEditorData(automation),
|
||||
});
|
||||
} else {
|
||||
update({
|
||||
status: "unchanged",
|
||||
data: genEditorData(automation),
|
||||
});
|
||||
}
|
||||
}
|
||||
}, [automation]);
|
||||
|
||||
useEffect(() => {
|
||||
if (automation) {
|
||||
const failures = getFailures(automation, v.AutomationData);
|
||||
if (failures) {
|
||||
update({
|
||||
status: 'invalid',
|
||||
failures,
|
||||
data: genEditorData(automation),
|
||||
})
|
||||
} else {
|
||||
update({
|
||||
status: 'unchanged',
|
||||
data: genEditorData(automation),
|
||||
})
|
||||
}
|
||||
return {
|
||||
validate: (data: any) => getFailures(data, v.AutomationData),
|
||||
updateTrigger: makeUpdate("trigger"),
|
||||
updateSequence: makeUpdate("sequence"),
|
||||
updateCondition: makeUpdate("condition"),
|
||||
saveAndUpdate,
|
||||
updateMetadata: (
|
||||
metadata: AutomationMetadata,
|
||||
tags: Array<[string, string]>
|
||||
) => {
|
||||
if (state.status === "changed" || state.status === "unchanged") {
|
||||
update({
|
||||
status: "changed",
|
||||
previous:
|
||||
state.status === "changed"
|
||||
? state.previous.concat([state.data])
|
||||
: [state.data],
|
||||
data: {
|
||||
...state.data,
|
||||
tags,
|
||||
metadata,
|
||||
},
|
||||
});
|
||||
}
|
||||
},
|
||||
save: () => {
|
||||
if (state.status !== "loading") {
|
||||
saveAndUpdate(state.data);
|
||||
}
|
||||
},
|
||||
undo: () => {
|
||||
if (state.status === "changed") {
|
||||
if (state.previous.length === 1) {
|
||||
update({
|
||||
status: "unchanged",
|
||||
data: state.previous[0],
|
||||
});
|
||||
} else {
|
||||
update({
|
||||
status: "changed",
|
||||
data: state.previous[state.previous.length - 1],
|
||||
previous: state.previous.slice(0, state.previous.length - 1),
|
||||
});
|
||||
}
|
||||
}, [automation]);
|
||||
|
||||
return {
|
||||
validate: (data: any) => getFailures(data, v.AutomationData),
|
||||
updateTrigger: makeUpdate('trigger'),
|
||||
updateSequence: makeUpdate('sequence'),
|
||||
updateCondition: makeUpdate('condition'),
|
||||
saveAndUpdate,
|
||||
updateMetadata: (metadata: AutomationMetadata, tags: Array<[string, string]>) => {
|
||||
if ((state.status === 'changed') || (state.status === 'unchanged')) {
|
||||
update({
|
||||
status: 'changed',
|
||||
data: {
|
||||
...state.data,
|
||||
tags,
|
||||
metadata,
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
save: () => {
|
||||
if (state.status !== 'loading') {
|
||||
saveAndUpdate(state.data)
|
||||
}
|
||||
},
|
||||
get state() {
|
||||
return state;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
},
|
||||
get state() {
|
||||
return state;
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
const genEditorData = (automation: AutomationData) => {
|
||||
const {
|
||||
metadata,
|
||||
trigger,
|
||||
sequence,
|
||||
condition,
|
||||
} = automation;
|
||||
const { metadata, trigger, sequence, condition } = automation;
|
||||
|
||||
const tags: [string, string][] = Object.keys(automation.tags).map(tagName => [tagName, automation.tags[tagName]]);
|
||||
const tags: [string, string][] = Object.keys(automation.tags).map(
|
||||
(tagName) => [tagName, automation.tags[tagName]]
|
||||
);
|
||||
|
||||
return {
|
||||
metadata,
|
||||
trigger,
|
||||
sequence,
|
||||
condition,
|
||||
tags,
|
||||
}
|
||||
}
|
||||
return {
|
||||
metadata,
|
||||
trigger,
|
||||
sequence,
|
||||
condition,
|
||||
tags,
|
||||
};
|
||||
};
|
||||
@@ -13,6 +13,10 @@
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
.automation-manager--list-box-group.modified {
|
||||
border: 1px var(--mui-success-main) solid;
|
||||
}
|
||||
|
||||
.automation-manager--list-box-group {
|
||||
border-color: var(--mui-text-secondary);
|
||||
border-width: 0.125px;
|
||||
|
||||
@@ -14,7 +14,10 @@ const { make, componentMeta } = makeStory({
|
||||
args: {
|
||||
title: "Example",
|
||||
type: "items",
|
||||
isSelected: false,
|
||||
flags: {
|
||||
isSelected: false,
|
||||
isModified: false,
|
||||
},
|
||||
data: [
|
||||
{
|
||||
id: "1",
|
||||
@@ -23,7 +26,10 @@ const { make, componentMeta } = makeStory({
|
||||
description: "Amazing automation!",
|
||||
tags: {},
|
||||
state: "on",
|
||||
isSelected: false,
|
||||
flags: {
|
||||
isSelected: false,
|
||||
isModified: false,
|
||||
},
|
||||
},
|
||||
{
|
||||
id: "2",
|
||||
@@ -31,7 +37,10 @@ const { make, componentMeta } = makeStory({
|
||||
entityId: "automation.2",
|
||||
description: "Cool!",
|
||||
state: "on",
|
||||
isSelected: false,
|
||||
flags: {
|
||||
isSelected: false,
|
||||
isModified: false,
|
||||
},
|
||||
tags: {
|
||||
room: "main bedroom",
|
||||
routine: "night time",
|
||||
@@ -48,16 +57,25 @@ export const Basic = make({});
|
||||
export const Nested = make({
|
||||
title: "Top Group",
|
||||
type: "group",
|
||||
isSelected: false,
|
||||
flags: {
|
||||
isSelected: false,
|
||||
isModified: false,
|
||||
},
|
||||
data: [
|
||||
{
|
||||
title: "Subgroup 1",
|
||||
type: "group",
|
||||
isSelected: true,
|
||||
flags: {
|
||||
isSelected: true,
|
||||
isModified: false,
|
||||
},
|
||||
data: [
|
||||
{
|
||||
type: "items",
|
||||
isSelected: true,
|
||||
flags: {
|
||||
isSelected: true,
|
||||
isModified: false,
|
||||
},
|
||||
title: "Subsub group",
|
||||
data: [
|
||||
{
|
||||
@@ -66,7 +84,10 @@ export const Nested = make({
|
||||
description: "",
|
||||
title: "Automation #1",
|
||||
state: "on",
|
||||
isSelected: true,
|
||||
flags: {
|
||||
isSelected: true,
|
||||
isModified: false,
|
||||
},
|
||||
tags: {},
|
||||
},
|
||||
{
|
||||
@@ -75,7 +96,10 @@ export const Nested = make({
|
||||
description: "another one",
|
||||
title: "Automation #2",
|
||||
state: "off",
|
||||
isSelected: false,
|
||||
flags: {
|
||||
isSelected: false,
|
||||
isModified: false,
|
||||
},
|
||||
tags: {},
|
||||
},
|
||||
{
|
||||
@@ -84,7 +108,10 @@ export const Nested = make({
|
||||
description: "bad one",
|
||||
title: "Automation #3",
|
||||
state: "offing",
|
||||
isSelected: false,
|
||||
flags: {
|
||||
isSelected: false,
|
||||
isModified: false,
|
||||
},
|
||||
tags: {
|
||||
type: "bad",
|
||||
},
|
||||
@@ -96,20 +123,29 @@ export const Nested = make({
|
||||
{
|
||||
title: "Subgroup 2",
|
||||
type: "group",
|
||||
isSelected: false,
|
||||
flags: {
|
||||
isSelected: false,
|
||||
isModified: false,
|
||||
},
|
||||
data: [],
|
||||
},
|
||||
{
|
||||
title: "Other",
|
||||
type: "items",
|
||||
isSelected: false,
|
||||
flags: {
|
||||
isSelected: false,
|
||||
isModified: false,
|
||||
},
|
||||
data: [
|
||||
{
|
||||
id: "4",
|
||||
entityId: "automation.4",
|
||||
description: "Cool thing",
|
||||
title: "Automation #4",
|
||||
isSelected: false,
|
||||
flags: {
|
||||
isSelected: false,
|
||||
isModified: false,
|
||||
},
|
||||
state: "on",
|
||||
tags: {
|
||||
type: "good",
|
||||
|
||||
@@ -16,6 +16,7 @@ export type ListBoxGroupProps = AutomationManagerItem & {
|
||||
) => void;
|
||||
onAutomationDelete: (aid: string, eid: string) => void;
|
||||
onSelect: (aid: string) => void;
|
||||
onRun: (eid: string) => void;
|
||||
initialOpenState?: boolean;
|
||||
tagsDB: TagDB;
|
||||
};
|
||||
@@ -23,7 +24,7 @@ export const ListBoxGroup: FC<ListBoxGroupProps> = ({
|
||||
title,
|
||||
type,
|
||||
data,
|
||||
isSelected,
|
||||
flags,
|
||||
initialOpenState,
|
||||
tagsDB,
|
||||
...events
|
||||
@@ -41,7 +42,8 @@ export const ListBoxGroup: FC<ListBoxGroupProps> = ({
|
||||
<div
|
||||
className={[
|
||||
"automation-manager--list-box-group",
|
||||
isSelected ? "selected" : "",
|
||||
flags.isSelected ? "selected" : "",
|
||||
flags.isModified ? "modified" : "",
|
||||
].join(" ")}
|
||||
>
|
||||
<div
|
||||
@@ -67,7 +69,9 @@ export const ListBoxGroup: FC<ListBoxGroupProps> = ({
|
||||
onDelete={() =>
|
||||
events.onAutomationDelete(auto.id, auto.entityId)
|
||||
}
|
||||
isSelected={auto.flags.isSelected}
|
||||
onSelect={() => events.onSelect(auto.id)}
|
||||
onRun={() => events.onRun(auto.entityId)}
|
||||
onDescriptionUpdate={(description) =>
|
||||
events.onAutomationUpdate(
|
||||
{
|
||||
|
||||
@@ -28,17 +28,13 @@ export const useAutomationDB = (
|
||||
return out;
|
||||
}
|
||||
},
|
||||
getAutomationData(autoId: string) {
|
||||
getAutomationData(
|
||||
autoId: string
|
||||
): null | [AutomationManagerAuto, AutomationData | null] {
|
||||
if (newAuto && newAuto[0].id === autoId) {
|
||||
return newAuto[1];
|
||||
return newAuto;
|
||||
}
|
||||
return (autoMap[autoId] ?? [null, null])[1];
|
||||
},
|
||||
getAutomationState(autoId: string): string | null {
|
||||
if (newAuto && newAuto[0].id === autoId) {
|
||||
return newAuto[0].state;
|
||||
}
|
||||
return (autoMap[autoId] ?? [{ state: null }, null])[0].state;
|
||||
return autoMap[autoId] ?? null;
|
||||
},
|
||||
isAutoNew(autoId: string) {
|
||||
return (newAuto && newAuto[0].id === autoId) ?? false;
|
||||
|
||||
@@ -9,14 +9,27 @@ import {
|
||||
UseAutomationManagerStateArgs,
|
||||
} from "./state";
|
||||
import Alert from "@mui/material/Alert";
|
||||
import { useConfirm } from "material-ui-confirm";
|
||||
|
||||
export type AutomationManagerLoadedProps = UseAutomationManagerStateArgs & {
|
||||
onAutomationDelete: (aid: string, eid: string) => void;
|
||||
};
|
||||
export const AutomationManagerLoaded: FC<
|
||||
PropsWithChildren<AutomationManagerLoadedProps>
|
||||
> = ({ children, onAutomationDelete, ...args }) => {
|
||||
> = ({ children, ...args }) => {
|
||||
const state = useAutomationManagerState(args);
|
||||
const confirm = useConfirm();
|
||||
|
||||
const onAutomationDelete = async (aid: string, eid: string) =>
|
||||
confirm({
|
||||
title: "Are you sure you want to delete this automation?",
|
||||
confirmationText: "Delete",
|
||||
})
|
||||
.then(() => {
|
||||
args.onAutomationDelete(aid, eid);
|
||||
state.setSelectedAutomationId(null);
|
||||
})
|
||||
.catch(() => {});
|
||||
|
||||
return (
|
||||
<div className="automation-manager">
|
||||
@@ -27,11 +40,9 @@ export const AutomationManagerLoaded: FC<
|
||||
selectedAutomationId={state.currentAutomationId}
|
||||
onSelectedAutomationId={state.setSelectedAutomationId}
|
||||
onAutomationAdd={() => state.addNew()}
|
||||
onAutomationDelete={(aid, eid) => {
|
||||
onAutomationDelete(aid, eid);
|
||||
state.setSelectedAutomationId(null);
|
||||
}}
|
||||
onAutomationDelete={onAutomationDelete}
|
||||
onAutomationUpdate={state.sideBarUpdateAutomation}
|
||||
onRun={args.onAutomationRun}
|
||||
/>
|
||||
<div className={["automation-manager--editor"].join(" ")}>
|
||||
{state.currentAutomationId !== null ? (
|
||||
@@ -43,6 +54,22 @@ export const AutomationManagerLoaded: FC<
|
||||
}}
|
||||
automation={state.currentAutomation}
|
||||
onUpdate={state.editorUpdateAutomation}
|
||||
onDelete={() => {
|
||||
if (
|
||||
state.currentAutomationId &&
|
||||
state.currentAutomationEntityId
|
||||
) {
|
||||
onAutomationDelete(
|
||||
state.currentAutomationId,
|
||||
state.currentAutomationEntityId
|
||||
);
|
||||
}
|
||||
}}
|
||||
onTrigger={() => {
|
||||
if (state.currentAutomationEntityId) {
|
||||
args.onAutomationRun(state.currentAutomationEntityId);
|
||||
}
|
||||
}}
|
||||
tagDB={state.tagsDB}
|
||||
isNew={state.currentAutomationIsNew}
|
||||
/>
|
||||
|
||||
@@ -15,6 +15,7 @@ export type UseAutomationManagerStateArgs = {
|
||||
onAutomationAdd: (auto: AutomationData) => void;
|
||||
onAutomationUpdate: (aid: string, auto: AutomationData) => void;
|
||||
onAutomationStateChange: (eid: string, on: boolean) => void;
|
||||
onAutomationRun: (eid: string) => void;
|
||||
};
|
||||
export const useAutomationManagerState = ({
|
||||
configAutomations,
|
||||
@@ -65,12 +66,15 @@ export const useAutomationManagerState = ({
|
||||
get tagsDB() {
|
||||
return tagsDB;
|
||||
},
|
||||
get currentAutomation() {
|
||||
return currentAutomation;
|
||||
get currentAutomation(): AutomationData | null {
|
||||
return currentAutomation === null ? null : currentAutomation[1];
|
||||
},
|
||||
get currentAutomationIsNew() {
|
||||
return automationDB.isAutoNew(cookies.currentAutomationId ?? "");
|
||||
},
|
||||
get currentAutomationEntityId(): string | null {
|
||||
return currentAutomation === null ? null : currentAutomation[0].entityId;
|
||||
},
|
||||
async setSelectedAutomationId(i: string | null, force: boolean = false) {
|
||||
if (methods.currentAutomationIsNew && !force) {
|
||||
if (!(await stillHaveNewAreYouSure())) {
|
||||
@@ -101,8 +105,9 @@ export const useAutomationManagerState = ({
|
||||
aid: string,
|
||||
eid: string
|
||||
) {
|
||||
const previousAutoState = automationDB.getAutomationData(aid);
|
||||
if (previousAutoState) {
|
||||
const previousAuto = automationDB.getAutomationData(aid);
|
||||
if (previousAuto && previousAuto[1]) {
|
||||
const previousAutoState = previousAuto[1];
|
||||
if (
|
||||
previousAutoState.metadata.alias !== a.title ||
|
||||
previousAutoState.metadata.description !== a.description
|
||||
@@ -124,7 +129,8 @@ export const useAutomationManagerState = ({
|
||||
{ variant: "error" }
|
||||
);
|
||||
}
|
||||
const previousState = automationDB.getAutomationState(aid);
|
||||
const previousState =
|
||||
previousAuto === null ? null : previousAuto[0].state;
|
||||
if (previousState !== a.state) {
|
||||
onAutomationStateChange(eid, a.state === "on");
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ import SaveIcon from "@mui/icons-material/SaveOutlined";
|
||||
|
||||
import { cleanUpUndefined } from "utils/helpers";
|
||||
import { Modal } from "components/Modal";
|
||||
import { Button } from "components/Inputs/Button";
|
||||
import { Button } from "components/Inputs/Buttons/Button";
|
||||
import InputAutoText from "components/Inputs/InputAutoText";
|
||||
|
||||
import { TagDB } from "../TagDB";
|
||||
@@ -30,7 +30,7 @@ export type TagModalState =
|
||||
|
||||
export const Tags: FC<TagsProps> = ({ automationId, tagsDB }) => {
|
||||
const [modalState, setModal] = useState<TagModalState>({ open: false });
|
||||
const tags = tagsDB.getTags(automationId);
|
||||
const tags = tagsDB.getTags(automationId, true);
|
||||
const onUpdate = (t: Record<string, string>) =>
|
||||
tagsDB.update(automationId, t);
|
||||
|
||||
|
||||
@@ -42,12 +42,25 @@
|
||||
font-size: 0.9em;
|
||||
}
|
||||
|
||||
.automation-manager--metadatabox .buttons {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
gap: 0.25em;
|
||||
}
|
||||
|
||||
.automation-manager--metadatabox .delete:hover {
|
||||
cursor: pointer;
|
||||
color: var(--mui-error-light);
|
||||
color: var(--mui-error-contrastText);
|
||||
background-color: var(--mui-error-dark);
|
||||
}
|
||||
|
||||
.automation-manager--metadatabox .run:hover {
|
||||
cursor: pointer;
|
||||
color: var(--mui-success-contrastText);
|
||||
background-color: var(--mui-success-dark);
|
||||
}
|
||||
|
||||
.automation-manager--metadatabox .select:hover,
|
||||
.automation-manager--metadatabox.selected.automation-manager--metadatabox .select {
|
||||
cursor: pointer;
|
||||
|
||||
@@ -7,6 +7,7 @@ import Alert from "@mui/material/Alert";
|
||||
|
||||
import DeleteForeverIcon from "@mui/icons-material/DeleteForever";
|
||||
import SelectIcon from "@mui/icons-material/HighlightAltSharp";
|
||||
import RunIcon from "@mui/icons-material/RunCircleOutlined";
|
||||
|
||||
import { InputTextView } from "components/Inputs/InputTextView";
|
||||
import { ButtonIcon } from "components/Icons/ButtonIcons";
|
||||
@@ -17,6 +18,7 @@ import { TagDB } from "../TagDB";
|
||||
export type MetadataBoxProps = AutomationManagerAuto & {
|
||||
onDelete: () => void;
|
||||
onSelect: () => void;
|
||||
onRun: () => void;
|
||||
onStateUpdate: (s: "on" | "off") => void;
|
||||
onTitleUpdate: (t: string) => void;
|
||||
onDescriptionUpdate: (t: string) => void;
|
||||
@@ -80,6 +82,7 @@ export const MetadataBox: FC<MetadataBoxProps> = (props) => {
|
||||
icon={<SelectIcon />}
|
||||
onClick={props.onSelect}
|
||||
/>
|
||||
<ButtonIcon className="run" icon={<RunIcon />} onClick={props.onRun} />
|
||||
<ButtonIcon
|
||||
className="delete"
|
||||
icon={<DeleteForeverIcon />}
|
||||
|
||||
@@ -33,6 +33,7 @@ const story = makeStory({
|
||||
selectedAutomationId={selectedAutomationId}
|
||||
tagsDB={useTagDB(automations, (a, t) => onTagUpdate(t, a))}
|
||||
automations={automations}
|
||||
onRun={args.onRun}
|
||||
onSelectedAutomationId={(aid) => {
|
||||
args.onSelectedAutomationId(aid);
|
||||
setSelAutoId(aid);
|
||||
|
||||
@@ -5,7 +5,7 @@ import { FC, useState } from "react";
|
||||
|
||||
import ArrowIcon from "@mui/icons-material/ArrowBackIosNewOutlined";
|
||||
|
||||
import InputText from "components/Inputs/InputText";
|
||||
import InputText from "components/Inputs/Base/InputText";
|
||||
import InputMultiSelect from "components/Inputs/InputMultiSelect";
|
||||
|
||||
import { ListBoxGroup } from "../ListBoxGroup";
|
||||
@@ -16,7 +16,7 @@ import {
|
||||
AutomationManagerAuto,
|
||||
AutomationManagerAutoUpdatable,
|
||||
} from "../types";
|
||||
import { Button } from "components/Inputs/Button";
|
||||
import { Button } from "components/Inputs/Buttons/Button";
|
||||
import { ButtonIcon } from "components/Icons/ButtonIcons";
|
||||
|
||||
export type AutomationManagerSidebarProps = {
|
||||
@@ -31,6 +31,7 @@ export type AutomationManagerSidebarProps = {
|
||||
onAutomationDelete: (aid: string, eid: string) => void;
|
||||
onAutomationAdd: () => void;
|
||||
onSelectedAutomationId: (aid: string) => void;
|
||||
onRun: (eid: string) => void;
|
||||
};
|
||||
export const AutomationManagerSidebar: FC<AutomationManagerSidebarProps> = ({
|
||||
automations,
|
||||
@@ -60,7 +61,11 @@ export const AutomationManagerSidebar: FC<AutomationManagerSidebarProps> = ({
|
||||
);
|
||||
|
||||
const items = grouping.top.map((i) =>
|
||||
convertGroupingToItems(i, selectedAutomationId, automations, grouping)
|
||||
convertGroupingToItems(i, automations, grouping, (aid, t) => ({
|
||||
...t,
|
||||
isSelected: aid === selectedAutomationId,
|
||||
isModified: tagsDB.isModified(aid),
|
||||
}))
|
||||
);
|
||||
|
||||
return (
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
import { useEffect, useRef, useState } from "react";
|
||||
|
||||
type TagDBState = {
|
||||
original: Record<string, Record<string, string>>;
|
||||
changed: Record<string, Record<string, string>>;
|
||||
};
|
||||
export type TagDB = ReturnType<typeof useTagDB>;
|
||||
export const useTagDB = (
|
||||
automations: Array<{
|
||||
@@ -8,28 +13,30 @@ export const useTagDB = (
|
||||
onUpdate: (aid: string, tags: Record<string, string>) => void
|
||||
) => {
|
||||
const lastAuto = useRef(JSON.stringify(automations));
|
||||
const [{ automationTags, changed }, setState] = useState({
|
||||
automationTags: convertAutoListToMap(automations),
|
||||
changed: new Set<string>(),
|
||||
const [{ original, changed }, setState] = useState<TagDBState>({
|
||||
original: convertAutoListToMap(automations),
|
||||
changed: {},
|
||||
});
|
||||
const allTags = computeAllTags(automationTags);
|
||||
const allTags = computeAllTags(original);
|
||||
const allTagNames = Object.keys(allTags);
|
||||
const isModified = changed.size > 0;
|
||||
|
||||
const isModified = Object.keys(changed).length > 0;
|
||||
useEffect(() => {
|
||||
const c = JSON.stringify(automations);
|
||||
if (lastAuto.current !== c) {
|
||||
lastAuto.current = c;
|
||||
setState({
|
||||
automationTags: convertAutoListToMap(automations),
|
||||
changed: new Set(),
|
||||
original: convertAutoListToMap(automations),
|
||||
changed: {},
|
||||
});
|
||||
}
|
||||
}, [automations, setState]);
|
||||
|
||||
return {
|
||||
getTags(automationId: string) {
|
||||
return automationTags[automationId] ?? {};
|
||||
getTags(automationId: string, includeChanged: boolean = false) {
|
||||
if (includeChanged) {
|
||||
return changed[automationId] ?? original[automationId] ?? {};
|
||||
}
|
||||
return original[automationId] ?? {};
|
||||
},
|
||||
getTagNames(myTags: string[]): string[] {
|
||||
return allTagNames.filter((n) => !myTags.includes(n)).sort();
|
||||
@@ -39,27 +46,33 @@ export const useTagDB = (
|
||||
? Array.from(allTags[tagName].values()).sort()
|
||||
: [];
|
||||
},
|
||||
isModified(aid: string) {
|
||||
return changed.has(aid);
|
||||
isModified(aid: string): boolean {
|
||||
return aid in changed;
|
||||
},
|
||||
update(aid: string, tags: Record<string, string>) {
|
||||
if (JSON.stringify(tags) !== JSON.stringify(automationTags[aid])) {
|
||||
setState({
|
||||
changed: changed.add(aid),
|
||||
automationTags: {
|
||||
...automationTags,
|
||||
[aid]: tags,
|
||||
},
|
||||
});
|
||||
const update = JSON.stringify(tags);
|
||||
if (aid in changed) {
|
||||
if (update === JSON.stringify(changed[aid])) {
|
||||
return;
|
||||
}
|
||||
} else if (update === JSON.stringify(original[aid])) {
|
||||
return;
|
||||
}
|
||||
setState({
|
||||
changed: {
|
||||
...changed,
|
||||
[aid]: tags,
|
||||
},
|
||||
original,
|
||||
});
|
||||
},
|
||||
save(aid: string | null) {
|
||||
if (isModified) {
|
||||
if (aid) {
|
||||
onUpdate(aid, automationTags[aid]);
|
||||
onUpdate(aid, changed[aid]);
|
||||
} else {
|
||||
for (const aid of changed.values()) {
|
||||
onUpdate(aid, automationTags[aid]);
|
||||
for (const [aid, change] of Object.entries(changed)) {
|
||||
onUpdate(aid, change);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -99,7 +99,7 @@ test("bigAutoList groupings has not duplicate ids", () => {
|
||||
test("convert grouper to items when no tags are selected", () => {
|
||||
const grouping = makeGrouping(automations, [], null);
|
||||
const items = grouping.top.map((i) =>
|
||||
convertGroupingToItems(i, "", automations, grouping)
|
||||
convertGroupingToItems(i, automations, grouping)
|
||||
);
|
||||
expect(items.filter((i) => i.type === "group")).toHaveLength(0);
|
||||
expect(items).toHaveLength(1);
|
||||
@@ -109,7 +109,7 @@ test("convert grouper to items when no tags are selected", () => {
|
||||
test("convert grouper to items when 1 tag is selected", () => {
|
||||
const grouping = makeGrouping(automations, ["Room"], null);
|
||||
const items = grouping.top.map((i) =>
|
||||
convertGroupingToItems(i, "", automations, grouping)
|
||||
convertGroupingToItems(i, automations, grouping)
|
||||
);
|
||||
expect(grouping.top).toHaveLength(3);
|
||||
expect(items.filter((i) => i.type === "group")).toHaveLength(0);
|
||||
@@ -125,7 +125,7 @@ test("convert grouper to items when 1 tag is selected", () => {
|
||||
test("convert grouper to items when 2 tag is selected", () => {
|
||||
const grouping = makeGrouping(automations, ["Room", "Type"], null);
|
||||
const items = grouping.top.map((i) =>
|
||||
convertGroupingToItems(i, "", automations, grouping)
|
||||
convertGroupingToItems(i, automations, grouping)
|
||||
);
|
||||
expect(grouping.top).toHaveLength(3);
|
||||
expect(items.filter((i) => i.type === "group")).toHaveLength(2);
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
import { AutomationManagerAuto, AutomationManagerItem } from "./types";
|
||||
import {
|
||||
AutomationManagerAuto,
|
||||
AutomationManagerAutoItem,
|
||||
AutomationManagerItem,
|
||||
AutomationManagerItemFlags,
|
||||
} from "./types";
|
||||
|
||||
const makeGrouper = () => {
|
||||
const groupIdNames: string[] = [];
|
||||
@@ -149,33 +154,59 @@ export const makeGrouping = (
|
||||
|
||||
export const convertGroupingToItems = (
|
||||
currentGroupIdx: number,
|
||||
selectedAutomationId: string | null,
|
||||
autos: AutomationManagerAuto[],
|
||||
grouping: AutomationGrouping
|
||||
grouping: AutomationGrouping,
|
||||
computeFlags: (
|
||||
aid: string,
|
||||
f: AutomationManagerItemFlags
|
||||
) => AutomationManagerItemFlags = (aid, t) => t
|
||||
): AutomationManagerItem => {
|
||||
const groupData = grouping.getData(currentGroupIdx);
|
||||
const automationIds = grouping.getAutomations(currentGroupIdx);
|
||||
|
||||
if (automationIds.length > 0) {
|
||||
const data = automationIds.map<AutomationManagerAutoItem>((i) => {
|
||||
return {
|
||||
...autos[i],
|
||||
flags: computeFlags(autos[i].id, {
|
||||
isSelected: false,
|
||||
isModified: false,
|
||||
}),
|
||||
};
|
||||
});
|
||||
return {
|
||||
type: "items",
|
||||
title: groupData.name,
|
||||
data: automationIds.map((i) => {
|
||||
return {
|
||||
...autos[i],
|
||||
isSelected: autos[i].id === selectedAutomationId,
|
||||
};
|
||||
}),
|
||||
isSelected: groupData.selected,
|
||||
data,
|
||||
flags: data.reduce<AutomationManagerItemFlags>(
|
||||
(out, a) => ({
|
||||
isSelected: out.isSelected || a.flags.isSelected,
|
||||
isModified: out.isModified || a.flags.isModified,
|
||||
}),
|
||||
{
|
||||
isSelected: false,
|
||||
isModified: false,
|
||||
}
|
||||
),
|
||||
};
|
||||
}
|
||||
const subgroups = grouping.getSubGroups(currentGroupIdx);
|
||||
const data = subgroups.map((i) =>
|
||||
convertGroupingToItems(i, autos, grouping, computeFlags)
|
||||
);
|
||||
return {
|
||||
type: "group",
|
||||
title: groupData.name,
|
||||
data: subgroups.map((i) =>
|
||||
convertGroupingToItems(i, selectedAutomationId, autos, grouping)
|
||||
data,
|
||||
flags: data.reduce<AutomationManagerItemFlags>(
|
||||
(out, a) => ({
|
||||
isSelected: out.isSelected || a.flags.isSelected,
|
||||
isModified: out.isModified || a.flags.isModified,
|
||||
}),
|
||||
{
|
||||
isSelected: false,
|
||||
isModified: false,
|
||||
}
|
||||
),
|
||||
isSelected: groupData.selected,
|
||||
};
|
||||
};
|
||||
@@ -20,6 +20,7 @@ const { make, componentMeta } = makeStory({
|
||||
api={useMockApiService(args.automations ?? [], !args.automations)}
|
||||
haEntities={useMockHAEntities(haEntities)}
|
||||
refreshAutomations={() => {}}
|
||||
triggerAutomation={() => {}}
|
||||
forceDeleteAutomation={() => {}}
|
||||
onAutomationStateChange={(eid, on) => {
|
||||
if (!haEntities.loading && !haEntities.error) {
|
||||
|
||||
@@ -14,6 +14,7 @@ export type AutomationManagerProps = {
|
||||
onAutomationStateChange: (eid: string, on: boolean) => void;
|
||||
refreshAutomations: () => void;
|
||||
forceDeleteAutomation: (eid: string) => void;
|
||||
triggerAutomation: (eid: string) => void;
|
||||
haEntities: HAEntitiesState;
|
||||
api: ApiService;
|
||||
};
|
||||
@@ -24,6 +25,7 @@ export const AutomationManager: FC<AutomationManagerProps> = ({
|
||||
onAutomationStateChange,
|
||||
refreshAutomations,
|
||||
forceDeleteAutomation,
|
||||
triggerAutomation,
|
||||
}) => {
|
||||
const snackbr = useSnackbar();
|
||||
const [isSaving, setIsSaving] = useState(false);
|
||||
@@ -79,6 +81,7 @@ export const AutomationManager: FC<AutomationManagerProps> = ({
|
||||
<AutomationManagerLoaded
|
||||
configAutomations={configAutomations.data}
|
||||
hassEntities={hassEntities}
|
||||
onAutomationRun={triggerAutomation}
|
||||
onAutomationStateChange={onAutomationStateChange}
|
||||
onAutomationAdd={async (auto) => {
|
||||
await api.updateAutomation({
|
||||
|
||||
@@ -10,10 +10,16 @@ export type AutomationManagerAuto = AutomationManagerAutoUpdatable & {
|
||||
issue?: string;
|
||||
isNew?: boolean;
|
||||
};
|
||||
|
||||
export type AutomationManagerAutoItem = AutomationManagerAuto & {
|
||||
flags: AutomationManagerItemFlags;
|
||||
};
|
||||
export type AutomationManagerItemFlags = {
|
||||
isSelected: boolean;
|
||||
isModified: boolean;
|
||||
};
|
||||
export type AutomationManagerItem = {
|
||||
title: string;
|
||||
isSelected: boolean;
|
||||
flags: AutomationManagerItemFlags;
|
||||
} & (
|
||||
| {
|
||||
type: "group";
|
||||
@@ -21,6 +27,6 @@ export type AutomationManagerItem = {
|
||||
}
|
||||
| {
|
||||
type: "items";
|
||||
data: Array<AutomationManagerAuto & { isSelected: boolean }>;
|
||||
data: Array<AutomationManagerAutoItem>;
|
||||
}
|
||||
);
|
||||
@@ -7,7 +7,7 @@ import { AutomationCondition } from "types/automations/conditions";
|
||||
import { getSubTypeList } from "utils/automations";
|
||||
import { getConditionDefaultValues } from "utils/defaults";
|
||||
import { useHA } from "haService";
|
||||
import InputYaml from "components/Inputs/InputYaml";
|
||||
import InputYaml from "components/Inputs/Base/InputYaml";
|
||||
import { getViewer } from "./viewRender";
|
||||
import { getEditor } from "./editorRender";
|
||||
import useWindowSize from "utils/useWindowSize";
|
||||
|
||||
@@ -10,26 +10,26 @@ import {
|
||||
TriggerCondition,
|
||||
ZoneCondition,
|
||||
} from "types/automations/conditions";
|
||||
import InputNumber from "components/Inputs/InputNumber";
|
||||
import InputText from "components/Inputs/InputText";
|
||||
import { InputEntity } from "components/Inputs/InputEntities";
|
||||
import InputNumber from "components/Inputs/Base/InputNumber";
|
||||
import InputText from "components/Inputs/Base/InputText";
|
||||
import { InputEntity } from "components/Inputs/AutoComplete/InputEntities";
|
||||
import {
|
||||
ConditionNodeBase,
|
||||
ConditionNodeBaseViewMode,
|
||||
} from "./ConditionNodeBase";
|
||||
import { genUpdateMethods } from "./nestedUpdater";
|
||||
import { InputTime } from "components/Inputs/InputTime";
|
||||
import InputYaml from "components/Inputs/InputYaml";
|
||||
import { InputTime } from "components/Inputs/Base/InputTime";
|
||||
import InputYaml from "components/Inputs/Base/InputYaml";
|
||||
import { HAService } from "haService";
|
||||
import { DeviceEditor } from "components/DeviceEditor";
|
||||
import { ButtonIcon } from "components/Icons/ButtonIcons";
|
||||
import AddIcon from "@mui/icons-material/Add";
|
||||
import { getEntityDomains } from "utils/automations";
|
||||
import { InputAutoComplete } from "components/Inputs/InputAutoComplete";
|
||||
import { InputTimeEntity } from "components/Inputs/InputTimeEntity";
|
||||
import { InputAutoComplete } from "components/Inputs/AutoComplete/InputAutoComplete";
|
||||
import { InputTimeEntity } from "components/Inputs/AutoComplete/InputTimeEntity";
|
||||
import { prettyName } from "utils/formatting";
|
||||
import { InputList } from "components/Inputs/InputList";
|
||||
import { Button } from "components/Inputs/Button";
|
||||
import { Button } from "components/Inputs/Buttons/Button";
|
||||
import { RemoveCircle } from "@mui/icons-material";
|
||||
|
||||
interface Editor<C extends AutomationCondition>
|
||||
|
||||
@@ -8,67 +8,61 @@ import { AutomationActionData } from "types/automations";
|
||||
import { createUpdaterFromAutomationData } from "../updater";
|
||||
import { ModalState } from "../board/types";
|
||||
import { DEFAULT_DIMS } from "./constants";
|
||||
import { makeStory } from "devUtils";
|
||||
|
||||
const Demo: FC<{
|
||||
automation: AutomationActionData;
|
||||
flipped: boolean;
|
||||
}> = (props) => {
|
||||
const { namer } = useHA();
|
||||
const [state, setState] = useState<AutomationActionData>(props.automation);
|
||||
const [modalState, setModalState] =
|
||||
useState<ModalState | undefined>(undefined);
|
||||
const updater = createUpdaterFromAutomationData(
|
||||
setModalState,
|
||||
state,
|
||||
setState
|
||||
);
|
||||
const elementData = useAutomationNodes(state, {
|
||||
dims: {
|
||||
...DEFAULT_DIMS,
|
||||
flipped: props.flipped,
|
||||
},
|
||||
namer,
|
||||
openModal: setModalState,
|
||||
stateUpdater: updater,
|
||||
});
|
||||
return (
|
||||
<DAGGraphBoard
|
||||
modalState={modalState}
|
||||
closeModal={() => setModalState(undefined)}
|
||||
state={{
|
||||
ready: true,
|
||||
data: {
|
||||
elements: elementData,
|
||||
},
|
||||
}}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
export default {
|
||||
title: "DAGGraph/Elements",
|
||||
component: Demo,
|
||||
parameters: { actions: { argTypesRegex: "^on.*" } },
|
||||
args: {
|
||||
flipped: true,
|
||||
automation: {
|
||||
trigger: [],
|
||||
condition: [],
|
||||
sequence: [],
|
||||
const { make, componentMeta } = makeStory({
|
||||
Component: (props: {
|
||||
automation: AutomationActionData;
|
||||
flipped: boolean;
|
||||
}) => {
|
||||
const { namer } = useHA();
|
||||
const [state, setState] = useState<AutomationActionData>(props.automation);
|
||||
const [modalState, setModalState] =
|
||||
useState<ModalState | undefined>(undefined);
|
||||
const updater = createUpdaterFromAutomationData(
|
||||
setModalState,
|
||||
state,
|
||||
setState
|
||||
);
|
||||
const elementData = useAutomationNodes(state, {
|
||||
dims: {
|
||||
...DEFAULT_DIMS,
|
||||
flipped: props.flipped,
|
||||
},
|
||||
namer,
|
||||
openModal: setModalState,
|
||||
stateUpdater: updater,
|
||||
});
|
||||
return (
|
||||
<DAGGraphBoard
|
||||
modalState={modalState}
|
||||
closeModal={() => setModalState(undefined)}
|
||||
state={{
|
||||
ready: true,
|
||||
data: {
|
||||
elements: elementData,
|
||||
},
|
||||
}}
|
||||
/>
|
||||
);
|
||||
},
|
||||
meta: {
|
||||
title: "DAGGraph/Elements",
|
||||
args: {
|
||||
flipped: true,
|
||||
automation: {
|
||||
trigger: [],
|
||||
condition: [],
|
||||
sequence: [],
|
||||
},
|
||||
},
|
||||
},
|
||||
} as ComponentMeta<typeof Demo>;
|
||||
});
|
||||
|
||||
const Template: ComponentStory<typeof Demo> = (args) => (
|
||||
<Page>
|
||||
<Demo {...args} />
|
||||
</Page>
|
||||
);
|
||||
export default componentMeta;
|
||||
|
||||
export const Empty = Template.bind({});
|
||||
export const Trigger = Template.bind({});
|
||||
Trigger.args = {
|
||||
...Trigger.args,
|
||||
export const Empty = make({});
|
||||
export const Trigger = make({
|
||||
automation: {
|
||||
trigger: [
|
||||
{ platform: "homeassistant", event: "up" },
|
||||
@@ -82,10 +76,9 @@ Trigger.args = {
|
||||
condition: [],
|
||||
sequence: [],
|
||||
},
|
||||
};
|
||||
export const Conditions = Template.bind({});
|
||||
Conditions.args = {
|
||||
...Conditions.args,
|
||||
});
|
||||
|
||||
export const Conditions = make({
|
||||
automation: {
|
||||
trigger: [
|
||||
{
|
||||
@@ -119,11 +112,9 @@ Conditions.args = {
|
||||
],
|
||||
sequence: [],
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
export const FullAuto = Template.bind({});
|
||||
FullAuto.args = {
|
||||
...FullAuto.args,
|
||||
export const FullAuto = make({
|
||||
automation: {
|
||||
condition: [
|
||||
{
|
||||
@@ -272,11 +263,9 @@ FullAuto.args = {
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
export const ChooseAuto = Template.bind({});
|
||||
ChooseAuto.args = {
|
||||
...ChooseAuto.args,
|
||||
export const ChooseAuto = make({
|
||||
automation: {
|
||||
condition: [],
|
||||
trigger: [],
|
||||
@@ -370,12 +359,9 @@ ChooseAuto.args = {
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
export const EmptyChooseAuto = Template.bind({});
|
||||
|
||||
EmptyChooseAuto.args = {
|
||||
...EmptyChooseAuto.args,
|
||||
export const EmptyChooseAuto = make({
|
||||
automation: {
|
||||
condition: [],
|
||||
trigger: [],
|
||||
@@ -386,11 +372,9 @@ EmptyChooseAuto.args = {
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
export const RepeatAuto = Template.bind({});
|
||||
RepeatAuto.args = {
|
||||
...RepeatAuto.args,
|
||||
export const RepeatAuto = make({
|
||||
automation: {
|
||||
condition: [],
|
||||
trigger: [],
|
||||
@@ -437,11 +421,9 @@ RepeatAuto.args = {
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
export const ParallelAuto = Template.bind({});
|
||||
ParallelAuto.args = {
|
||||
...ParallelAuto.args,
|
||||
export const ParallelAuto = make({
|
||||
automation: {
|
||||
condition: [],
|
||||
trigger: [],
|
||||
@@ -467,11 +449,9 @@ ParallelAuto.args = {
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
export const BadNodes = Template.bind({});
|
||||
BadNodes.args = {
|
||||
...BadNodes.args,
|
||||
export const BadNodes = make({
|
||||
automation: {
|
||||
condition: [
|
||||
{
|
||||
@@ -500,11 +480,9 @@ BadNodes.args = {
|
||||
},
|
||||
] as any,
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
export const IfElseNode = Template.bind({});
|
||||
IfElseNode.args = {
|
||||
...IfElseNode.args,
|
||||
export const IfElseNode = make({
|
||||
automation: {
|
||||
condition: [],
|
||||
trigger: [],
|
||||
@@ -516,4 +494,24 @@ IfElseNode.args = {
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
export const TimeNodes = make({
|
||||
automation: {
|
||||
condition: [],
|
||||
trigger: [
|
||||
{
|
||||
platform: "time",
|
||||
at: "",
|
||||
},
|
||||
{
|
||||
platform: "time_pattern",
|
||||
},
|
||||
],
|
||||
sequence: [
|
||||
{
|
||||
condition: "time",
|
||||
},
|
||||
],
|
||||
},
|
||||
});
|
||||
@@ -4,7 +4,7 @@ import { ButtonIcon } from "components/Icons/ButtonIcons";
|
||||
import { FC } from "react";
|
||||
import { ButtonNodeProps } from "./types";
|
||||
import { Handle, Position } from "react-flow-renderer";
|
||||
import { Button } from "components/Inputs/Button";
|
||||
import { Button } from "components/Inputs/Buttons/Button";
|
||||
|
||||
export const ButtonNode: FC<ButtonNodeProps> = ({
|
||||
height,
|
||||
|
||||
@@ -12,7 +12,7 @@ import Edit from "@mui/icons-material/Edit";
|
||||
import KeyboardArrowDownSharpIcon from "@mui/icons-material/KeyboardArrowDownSharp";
|
||||
import AddOutlined from "@mui/icons-material/AddOutlined";
|
||||
|
||||
import InputBoolean from "components/Inputs/InputBoolean";
|
||||
import InputBoolean from "components/Inputs/Base/InputBoolean";
|
||||
import { SpeedDial } from "components/SpeedDial";
|
||||
import { SequenceNodeElementProps } from "./types";
|
||||
import { useSequenceNodeColor } from "./util";
|
||||
|
||||
@@ -104,6 +104,9 @@ export const createUpdater = (
|
||||
}),
|
||||
trigger: createBasicUpdater("trigger", {
|
||||
platform: "device",
|
||||
domain: "",
|
||||
type: "",
|
||||
device_id: "",
|
||||
})({
|
||||
trigger: args.trigger,
|
||||
openModal: args.openModal,
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import {
|
||||
BaseOption,
|
||||
InputAutoComplete,
|
||||
} from "components/Inputs/InputAutoComplete";
|
||||
import { InputDevice } from "components/Inputs/InputDevice";
|
||||
import { InputDeviceCapabilties } from "components/Inputs/InputDeviceCapabilties";
|
||||
import { InputEntity } from "components/Inputs/InputEntities";
|
||||
} from "components/Inputs/AutoComplete/InputAutoComplete";
|
||||
import { InputDevice } from "components/Inputs/AutoComplete/InputDevice";
|
||||
import { InputDeviceCapabilties } from "components/Inputs/AutoComplete/InputDeviceCapabilties";
|
||||
import { InputEntity } from "components/Inputs/AutoComplete/InputEntities";
|
||||
import { cleanUpUndefined } from "utils/helpers";
|
||||
import { DeviceBaseType, DeviceTypeCapability } from "haService/types";
|
||||
import { AutomationDeviceState } from "types/automations/common";
|
||||
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
+4
-4
@@ -4,10 +4,10 @@ import { useSnackbar } from "notistack";
|
||||
import { useRef } from "react";
|
||||
import { prettyName } from "utils/formatting";
|
||||
import { InputAutoComplete, Option } from "./InputAutoComplete";
|
||||
import InputBoolean from "./InputBoolean";
|
||||
import { InputTime } from "./InputDayTime";
|
||||
import InputNumber from "./InputNumber";
|
||||
import InputText from "./InputText";
|
||||
import InputBoolean from "components/Inputs/Base/InputBoolean";
|
||||
import { InputTime } from "../Base/InputTime";
|
||||
import InputNumber from "components/Inputs/Base/InputNumber";
|
||||
import InputText from "components/Inputs/Base/InputText";
|
||||
|
||||
export type InputDeviceCapabiltiesProps<T extends Record<string, any>> = {
|
||||
defn: HaFormSchema[];
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
+1
-1
@@ -11,7 +11,7 @@ import {
|
||||
isAutomationTimeString24Hours,
|
||||
} from "utils/time";
|
||||
import { InputEntity } from "./InputEntities";
|
||||
import { InputTime } from "./InputTime";
|
||||
import { InputTime } from "components/Inputs/Base/InputTime";
|
||||
|
||||
export type InputTimeEntityProps = {
|
||||
value: string;
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
+1
@@ -1,4 +1,5 @@
|
||||
import "./InputTime.css";
|
||||
|
||||
import { useState, useEffect, FC } from "react";
|
||||
import TextField from "@mui/material/TextField";
|
||||
import EditIcon from "@mui/icons-material/Edit";
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -1,150 +0,0 @@
|
||||
import "./InputTime.css";
|
||||
import { useState, useEffect, FC } from "react";
|
||||
import TextField from "@mui/material/TextField";
|
||||
import EditIcon from "@mui/icons-material/Edit";
|
||||
import CloseIcon from "@mui/icons-material/Close";
|
||||
import { AutomationTime, AutomationTimeObject } from "types/automations/common";
|
||||
import {
|
||||
convertAutomationTimeToTimeObject,
|
||||
convertObjectToAutomationTimeString,
|
||||
} from "utils/time";
|
||||
import { convertAutomationTimeToTimeString } from "utils/time";
|
||||
import { prettyName } from "utils/formatting";
|
||||
import InputLabel from "@mui/material/InputLabel";
|
||||
import { ButtonIcon } from "components/Icons/ButtonIcons";
|
||||
|
||||
// constants
|
||||
const fields: Array<keyof AutomationTimeObject> = [
|
||||
"hours",
|
||||
"minutes",
|
||||
"seconds",
|
||||
"milliseconds",
|
||||
];
|
||||
export interface Props {
|
||||
label: string;
|
||||
value?: AutomationTime;
|
||||
onChange: (v?: AutomationTimeObject) => void;
|
||||
}
|
||||
export const InputTime: FC<Props> = (props) => {
|
||||
// state
|
||||
const [disabled, setDisabled] = useState(!props.value);
|
||||
const [displayValue, setDisplayValue] = useState(
|
||||
convertAutomationTimeToTimeObject(props.value)
|
||||
);
|
||||
|
||||
// process display input
|
||||
const updateOne = (k: keyof AutomationTimeObject) => (v: string) => {
|
||||
if (Number(v) < 0) {
|
||||
setDisplayValue({
|
||||
...displayValue,
|
||||
[k]: 0,
|
||||
});
|
||||
} else if (k === "hours") {
|
||||
setDisplayValue({
|
||||
...displayValue,
|
||||
[k]: Number(v),
|
||||
});
|
||||
} else if (k === "minutes") {
|
||||
let minutes = Number(v);
|
||||
let { hours = 0 } = displayValue;
|
||||
if (minutes > 59) {
|
||||
const additonalHours = Math.floor(minutes / 60);
|
||||
hours += additonalHours;
|
||||
minutes = minutes - additonalHours * 60;
|
||||
}
|
||||
setDisplayValue({
|
||||
...displayValue,
|
||||
minutes,
|
||||
hours,
|
||||
});
|
||||
} else if (k === "seconds") {
|
||||
let seconds = Number(v);
|
||||
let { hours = 0, minutes = 0 } = displayValue;
|
||||
if (seconds > 59) {
|
||||
const additonalHours = Math.floor(seconds / (60 * 60));
|
||||
hours += additonalHours;
|
||||
seconds = seconds - additonalHours * 60;
|
||||
}
|
||||
if (seconds > 59) {
|
||||
const additionalMinutes = Math.floor(seconds / 60);
|
||||
minutes += additionalMinutes;
|
||||
seconds = seconds - additionalMinutes * 60;
|
||||
}
|
||||
setDisplayValue({
|
||||
...displayValue,
|
||||
minutes,
|
||||
hours,
|
||||
seconds,
|
||||
});
|
||||
} else if (k === "milliseconds") {
|
||||
let milliseconds = Number(v);
|
||||
let { hours = 0, minutes = 0, seconds = 0 } = displayValue;
|
||||
if (milliseconds > 1000) {
|
||||
const additonalHours = Math.floor(milliseconds / (60 * 60 * 1000));
|
||||
hours += additonalHours;
|
||||
milliseconds = milliseconds - additonalHours * 60 * 60 * 1000;
|
||||
}
|
||||
if (milliseconds > 1000) {
|
||||
const additionalMinutes = Math.floor(milliseconds / (60 * 1000));
|
||||
minutes += additionalMinutes;
|
||||
milliseconds = milliseconds - additionalMinutes * 60 * 1000;
|
||||
}
|
||||
if (milliseconds > 1000) {
|
||||
const additionalSeconds = Math.floor(milliseconds / 1000);
|
||||
seconds += additionalSeconds;
|
||||
milliseconds = milliseconds - additionalSeconds * 1000;
|
||||
}
|
||||
setDisplayValue({
|
||||
...displayValue,
|
||||
minutes,
|
||||
hours,
|
||||
seconds,
|
||||
milliseconds,
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
// effect
|
||||
useEffect(() => {
|
||||
if (disabled && !props.value) {
|
||||
return;
|
||||
}
|
||||
if (disabled) {
|
||||
props.onChange(undefined);
|
||||
} else {
|
||||
const pVal = convertAutomationTimeToTimeString(props.value);
|
||||
const cVal = convertObjectToAutomationTimeString(displayValue);
|
||||
if (pVal !== cVal) {
|
||||
props.onChange(displayValue);
|
||||
}
|
||||
}
|
||||
// eslint-disable-next-line
|
||||
}, [disabled, displayValue]);
|
||||
|
||||
return (
|
||||
<div className="input-time">
|
||||
<InputLabel>{props.label}</InputLabel>
|
||||
<div className="input-time--inner">
|
||||
{fields.map((name) => (
|
||||
<TextField
|
||||
key={name}
|
||||
variant="filled"
|
||||
label={prettyName(name)}
|
||||
defaultValue="00"
|
||||
InputProps={{
|
||||
disabled,
|
||||
type: "number",
|
||||
title: prettyName(name),
|
||||
}}
|
||||
value={displayValue[name] ?? 0}
|
||||
onChange={(e) => updateOne(name)(e.target.value)}
|
||||
/>
|
||||
))}
|
||||
<ButtonIcon
|
||||
onClick={() => setDisabled(!disabled)}
|
||||
icon={disabled ? <EditIcon /> : <CloseIcon />}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
@@ -1,6 +1,6 @@
|
||||
import { ComponentMeta, ComponentStory } from "@storybook/react";
|
||||
import { Page } from "components/Page";
|
||||
import InputText from "./InputText";
|
||||
import InputText from "./Base/InputText";
|
||||
|
||||
import { InputTextView } from "./InputTextView";
|
||||
|
||||
|
||||
@@ -1,33 +1,36 @@
|
||||
import React from "react";
|
||||
import { ComponentMeta, ComponentStory } from '@storybook/react';
|
||||
import { ComponentMeta, ComponentStory } from "@storybook/react";
|
||||
import { Modal } from ".";
|
||||
import { useState } from 'react';
|
||||
import { Button } from "components/Inputs/Button";
|
||||
|
||||
import { useState } from "react";
|
||||
import { Button } from "components/Inputs/Buttons/Button";
|
||||
|
||||
export default {
|
||||
title: 'Modal',
|
||||
title: "Modal",
|
||||
component: Modal,
|
||||
parameters: { actions: { argTypesRegex: '^on.*' } },
|
||||
parameters: { actions: { argTypesRegex: "^on.*" } },
|
||||
args: {
|
||||
open: true
|
||||
}
|
||||
} as ComponentMeta<typeof Modal>
|
||||
open: true,
|
||||
},
|
||||
} as ComponentMeta<typeof Modal>;
|
||||
|
||||
export const Simple: ComponentStory<typeof Modal> = args => {
|
||||
return <>
|
||||
<Modal {...args}>
|
||||
<div>Hello World!</div>
|
||||
</Modal>
|
||||
</>
|
||||
}
|
||||
export const WithButtons: ComponentStory<typeof Modal> = args => {
|
||||
export const Simple: ComponentStory<typeof Modal> = (args) => {
|
||||
return (
|
||||
<>
|
||||
<Modal {...args}>
|
||||
<div>Hello World!</div>
|
||||
</Modal>
|
||||
</>
|
||||
);
|
||||
};
|
||||
export const WithButtons: ComponentStory<typeof Modal> = (args) => {
|
||||
const [open, setOpen] = useState(false);
|
||||
return <>
|
||||
<Button onClick={() => setOpen(!open)}>Open Me!</Button>
|
||||
<Modal open={open}>
|
||||
<div>Hello World!</div>
|
||||
<Button onClick={() => setOpen(!open)}>Close Me!</Button>
|
||||
</Modal>
|
||||
</>
|
||||
}
|
||||
return (
|
||||
<>
|
||||
<Button onClick={() => setOpen(!open)}>Open Me!</Button>
|
||||
<Modal open={open}>
|
||||
<div>Hello World!</div>
|
||||
<Button onClick={() => setOpen(!open)}>Close Me!</Button>
|
||||
</Modal>
|
||||
</>
|
||||
);
|
||||
};
|
||||
@@ -1,33 +1,31 @@
|
||||
import InputYaml from "components/Inputs/InputYaml";
|
||||
import InputText from "components/Inputs/InputText";
|
||||
import InputYaml from "components/Inputs/Base/InputYaml";
|
||||
import InputText from "components/Inputs/Base/InputText";
|
||||
import { FireEventAction } from "types/automations/actions";
|
||||
import { OptionManager, updateActionData } from "./OptionManager";
|
||||
|
||||
|
||||
export const ActionEventState: OptionManager<FireEventAction> = {
|
||||
defaultState: () => ({
|
||||
alias: "Fire Event",
|
||||
event: "",
|
||||
event_data: {},
|
||||
}),
|
||||
isReady: ({ alias, event }) => (
|
||||
alias !== '' &&
|
||||
event !== ""
|
||||
),
|
||||
isReady: ({ alias, event }) => alias !== "" && event !== "",
|
||||
renderOptionList: (state, setState) => {
|
||||
const update = updateActionData(state, setState);
|
||||
return <>
|
||||
<InputText
|
||||
textBoxFor="event"
|
||||
label="Event"
|
||||
value={state.event}
|
||||
onChange={event => update({ event })}
|
||||
/>
|
||||
<InputYaml
|
||||
label="Event Data"
|
||||
value={state.event_data}
|
||||
onChange={event_data => update({ event_data })}
|
||||
/>
|
||||
</>
|
||||
}
|
||||
}
|
||||
return (
|
||||
<>
|
||||
<InputText
|
||||
textBoxFor="event"
|
||||
label="Event"
|
||||
value={state.event}
|
||||
onChange={(event) => update({ event })}
|
||||
/>
|
||||
<InputYaml
|
||||
label="Event Data"
|
||||
value={state.event_data}
|
||||
onChange={(event_data) => update({ event_data })}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
},
|
||||
};
|
||||
@@ -1,7 +1,7 @@
|
||||
import InputNumber from "components/Inputs/InputNumber";
|
||||
import InputNumber from "components/Inputs/Base/InputNumber";
|
||||
import { RepeatAction } from "types/automations/actions";
|
||||
import { OptionManager } from "./OptionManager";
|
||||
import { InputAutoComplete } from "components/Inputs/InputAutoComplete";
|
||||
import { InputAutoComplete } from "components/Inputs/AutoComplete/InputAutoComplete";
|
||||
|
||||
const determineType = (repeatNode: RepeatAction["repeat"]) =>
|
||||
"count" in repeatNode ? "count" : "until" in repeatNode ? "until" : "while";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { InputService } from "components/Inputs/InputService";
|
||||
import { InputService } from "components/Inputs/AutoComplete/InputService";
|
||||
import { ServiceEditor } from "components/ServiceEditor";
|
||||
import { ServiceAction } from "types/automations/actions";
|
||||
import { OptionManager, updateActionData } from "./OptionManager";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import InputText from "components/Inputs/InputText";
|
||||
import InputText from "components/Inputs/Base/InputText";
|
||||
import { StopAction } from "types/automations/actions";
|
||||
import { OptionManager } from "./OptionManager";
|
||||
|
||||
|
||||
@@ -1,23 +1,23 @@
|
||||
import "./ActionWait.css";
|
||||
import InputBoolean from "components/Inputs/InputBoolean";
|
||||
import InputBoolean from "components/Inputs/Base/InputBoolean";
|
||||
import { InputList } from "components/Inputs/InputList";
|
||||
import InputNumber from "components/Inputs/InputNumber";
|
||||
import InputText from "components/Inputs/InputText";
|
||||
import { InputTime } from "components/Inputs/InputTime";
|
||||
import InputNumber from "components/Inputs/Base/InputNumber";
|
||||
import InputText from "components/Inputs/Base/InputText";
|
||||
import { InputTime } from "components/Inputs/Base/InputTime";
|
||||
import { useState } from "react";
|
||||
import { DelayAction, WaitAction } from "types/automations/actions";
|
||||
import { OptionManager, updateActionData } from './OptionManager';
|
||||
import InputYaml from "components/Inputs/InputYaml";
|
||||
import { OptionManager, updateActionData } from "./OptionManager";
|
||||
import InputYaml from "components/Inputs/Base/InputYaml";
|
||||
|
||||
type ThisAction = WaitAction | DelayAction;
|
||||
type Option = 'delay' | 'template' | 'trigger'
|
||||
type Option = "delay" | "template" | "trigger";
|
||||
const getCurrentOption = (node: ThisAction): Option => {
|
||||
if ('delay' in node) {
|
||||
return 'delay'
|
||||
if ("delay" in node) {
|
||||
return "delay";
|
||||
} else {
|
||||
return 'template'
|
||||
return "template";
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
export const ActionWaitState: OptionManager<ThisAction> = {
|
||||
defaultState: () => ({
|
||||
@@ -32,78 +32,108 @@ export const ActionWaitState: OptionManager<ThisAction> = {
|
||||
const base: any = {
|
||||
alias: state.alias,
|
||||
variables: state.variables,
|
||||
}
|
||||
if (opt === 'delay') {
|
||||
};
|
||||
if (opt === "delay") {
|
||||
setState({
|
||||
...base,
|
||||
delay: (state as any).delay ?? "",
|
||||
})
|
||||
});
|
||||
} else {
|
||||
base.timeout = (state as any).timeout
|
||||
base.continue_on_timeout = (state as any).continue_on_timeout
|
||||
if (opt === 'template') {
|
||||
base.timeout = (state as any).timeout;
|
||||
base.continue_on_timeout = (state as any).continue_on_timeout;
|
||||
if (opt === "template") {
|
||||
setState({
|
||||
...base,
|
||||
wait_template: (state as any).wait_template ?? "",
|
||||
})
|
||||
});
|
||||
} else {
|
||||
setState({
|
||||
...base,
|
||||
wait_for_trigger: (state as any).wait_for_trigger ?? "",
|
||||
})
|
||||
});
|
||||
}
|
||||
}
|
||||
_setCurrent(opt)
|
||||
}
|
||||
_setCurrent(opt);
|
||||
};
|
||||
|
||||
// determine options
|
||||
let option: JSX.Element = <></>;
|
||||
if (current === "delay") {
|
||||
option = <>
|
||||
<InputTime className="for" label="for" value={(state as any).delay} onChange={delay => update({ delay })} />
|
||||
</>
|
||||
} else if (current === 'template') {
|
||||
option = (
|
||||
<>
|
||||
<InputTime
|
||||
className="for"
|
||||
label="for"
|
||||
value={(state as any).delay}
|
||||
onChange={(delay) => update({ delay })}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
} else if (current === "template") {
|
||||
state = state as WaitAction;
|
||||
option = <>
|
||||
<InputText
|
||||
label="Template"
|
||||
className="template"
|
||||
value={state.wait_template ?? ""}
|
||||
onChange={wait_template => update({ wait_template })}
|
||||
/>
|
||||
</>
|
||||
} else if (current === 'trigger') {
|
||||
option = (
|
||||
<>
|
||||
<InputText
|
||||
label="Template"
|
||||
className="template"
|
||||
value={state.wait_template ?? ""}
|
||||
onChange={(wait_template) => update({ wait_template })}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
} else if (current === "trigger") {
|
||||
state = state as WaitAction;
|
||||
option = <>
|
||||
<InputYaml
|
||||
className="triggers"
|
||||
label="Triggers"
|
||||
value={state.wait_for_trigger ?? []}
|
||||
onChange={wait_for_trigger => update({ wait_for_trigger })}
|
||||
/>
|
||||
</>
|
||||
option = (
|
||||
<>
|
||||
<InputYaml
|
||||
className="triggers"
|
||||
label="Triggers"
|
||||
value={state.wait_for_trigger ?? []}
|
||||
onChange={(wait_for_trigger) => update({ wait_for_trigger })}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
// render
|
||||
return <div className="node-editor--action-wait">
|
||||
<InputList
|
||||
className="wait-type"
|
||||
label="Wait Type" prettyOptionLabels
|
||||
options={["template", 'trigger', "delay"]}
|
||||
current={current} onChange={setCurrent} />
|
||||
{option}
|
||||
{current !== 'delay' ? <div className="wait-options">
|
||||
<InputNumber
|
||||
label="Timeout"
|
||||
value={(state as any).timeout ? Number((state as any).timeout) : undefined}
|
||||
onChange={timeout => update({ timeout: timeout === undefined ? undefined : String(timeout) })}
|
||||
return (
|
||||
<div className="node-editor--action-wait">
|
||||
<InputList
|
||||
className="wait-type"
|
||||
label="Wait Type"
|
||||
prettyOptionLabels
|
||||
options={["template", "trigger", "delay"]}
|
||||
current={current}
|
||||
onChange={setCurrent}
|
||||
/>
|
||||
<InputBoolean
|
||||
label="Continue on Timeout"
|
||||
value={(state as any).continue_on_timeout ?? false}
|
||||
onChange={continue_on_timeout => update({ continue_on_timeout })}
|
||||
/>
|
||||
</div> : <></>}
|
||||
</div>
|
||||
}
|
||||
}
|
||||
{option}
|
||||
{current !== "delay" ? (
|
||||
<div className="wait-options">
|
||||
<InputNumber
|
||||
label="Timeout"
|
||||
value={
|
||||
(state as any).timeout
|
||||
? Number((state as any).timeout)
|
||||
: undefined
|
||||
}
|
||||
onChange={(timeout) =>
|
||||
update({
|
||||
timeout: timeout === undefined ? undefined : String(timeout),
|
||||
})
|
||||
}
|
||||
/>
|
||||
<InputBoolean
|
||||
label="Continue on Timeout"
|
||||
value={(state as any).continue_on_timeout ?? false}
|
||||
onChange={(continue_on_timeout) =>
|
||||
update({ continue_on_timeout })
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
) : (
|
||||
<></>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
},
|
||||
};
|
||||
@@ -5,6 +5,9 @@ import { DeviceEditor } from "components/DeviceEditor";
|
||||
export const TriggerDevice: OptionManager<AutomationTriggerDevice> = {
|
||||
defaultState: () => ({
|
||||
platform: "device",
|
||||
device_id: "",
|
||||
domain: "",
|
||||
type: "",
|
||||
}),
|
||||
isReady: () => true,
|
||||
Component: ({ state, setState, ha }) => {
|
||||
@@ -27,6 +30,9 @@ export const TriggerDevice: OptionManager<AutomationTriggerDevice> = {
|
||||
setState={(s) =>
|
||||
setState({
|
||||
platform: "device",
|
||||
device_id: "",
|
||||
domain: "",
|
||||
type: "",
|
||||
...s,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import InputText from "components/Inputs/InputText";
|
||||
import InputText from "components/Inputs/Base/InputText";
|
||||
import { OptionManager } from "./OptionManager";
|
||||
import { AutomationTriggerEvent } from "../../../types/automations/triggers";
|
||||
import InputYaml from "components/Inputs/InputYaml";
|
||||
import InputYaml from "components/Inputs/Base/InputYaml";
|
||||
|
||||
export const TriggerEventState: OptionManager<AutomationTriggerEvent> = {
|
||||
defaultState: () => ({
|
||||
|
||||
@@ -1,33 +1,34 @@
|
||||
import { OptionManager } from './OptionManager';
|
||||
import { AutomationTriggerMQTT } from 'types/automations/triggers';
|
||||
import InputText from 'components/Inputs/InputText';
|
||||
|
||||
import { OptionManager } from "./OptionManager";
|
||||
import { AutomationTriggerMQTT } from "types/automations/triggers";
|
||||
import InputText from "components/Inputs/Base/InputText";
|
||||
|
||||
export const TriggerMQTTState: OptionManager<AutomationTriggerMQTT> = {
|
||||
defaultState: () => ({
|
||||
"platform": "mqtt",
|
||||
"payload": "",
|
||||
"topic": "",
|
||||
"value_template": ""
|
||||
platform: "mqtt",
|
||||
payload: "",
|
||||
topic: "",
|
||||
value_template: "",
|
||||
}),
|
||||
isReady: () => true,
|
||||
renderOptionList: (state, setState) => {
|
||||
return <>
|
||||
<InputText
|
||||
label='Payload'
|
||||
value={state.payload}
|
||||
onChange={payload => setState({ ...state, payload })}
|
||||
/>
|
||||
<InputText
|
||||
label='Topic'
|
||||
value={state.topic}
|
||||
onChange={topic => setState({ ...state, topic })}
|
||||
/>
|
||||
<InputText
|
||||
label='Template'
|
||||
value={state.value_template}
|
||||
onChange={value_template => setState({ ...state, value_template })}
|
||||
/>
|
||||
</>
|
||||
}
|
||||
}
|
||||
return (
|
||||
<>
|
||||
<InputText
|
||||
label="Payload"
|
||||
value={state.payload}
|
||||
onChange={(payload) => setState({ ...state, payload })}
|
||||
/>
|
||||
<InputText
|
||||
label="Topic"
|
||||
value={state.topic}
|
||||
onChange={(topic) => setState({ ...state, topic })}
|
||||
/>
|
||||
<InputText
|
||||
label="Template"
|
||||
value={state.value_template}
|
||||
onChange={(value_template) => setState({ ...state, value_template })}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
},
|
||||
};
|
||||
@@ -1,63 +1,82 @@
|
||||
import { OptionManager } from './OptionManager';
|
||||
import { AutomationTriggerNumericState } from 'types/automations/triggers';
|
||||
import InputText from 'components/Inputs/InputText';
|
||||
import { InputEntity } from 'components/Inputs/InputEntities';
|
||||
import InputNumber from 'components/Inputs/InputNumber';
|
||||
import { InputTime } from 'components/Inputs/InputTime'; import InputYaml from 'components/Inputs/InputYaml';
|
||||
import { OptionManager } from "./OptionManager";
|
||||
import { AutomationTriggerNumericState } from "types/automations/triggers";
|
||||
import InputText from "components/Inputs/Base/InputText";
|
||||
import { InputEntity } from "components/Inputs/AutoComplete/InputEntities";
|
||||
import InputNumber from "components/Inputs/Base/InputNumber";
|
||||
import { InputTime } from "components/Inputs/Base/InputTime";
|
||||
import InputYaml from "components/Inputs/Base/InputYaml";
|
||||
|
||||
|
||||
export const TriggerNumericState: OptionManager<AutomationTriggerNumericState> = {
|
||||
defaultState: () => ({
|
||||
"platform": 'numeric_state',
|
||||
"entity_id": "",
|
||||
}),
|
||||
isReady: () => true,
|
||||
renderOptionList: (state, setState) => {
|
||||
return <>
|
||||
<InputEntity
|
||||
value={state.entity_id}
|
||||
multiple
|
||||
onChange={entity_id => setState({
|
||||
...state,
|
||||
entity_id
|
||||
})}
|
||||
/>
|
||||
<InputText label="Attribute" value={state.attribute ?? ""} onChange={attribute => setState({
|
||||
...state,
|
||||
attribute
|
||||
})} />
|
||||
<InputNumber
|
||||
label="Above"
|
||||
value={state.above ? Number(state.above) : undefined}
|
||||
onChange={above => setState({
|
||||
...state,
|
||||
above: above ? String(above) : undefined,
|
||||
})}
|
||||
/>
|
||||
<InputNumber
|
||||
label="Below"
|
||||
value={state.below ? Number(state.below) : undefined}
|
||||
onChange={below => setState({
|
||||
...state,
|
||||
below: below ? String(below) : undefined,
|
||||
})}
|
||||
/>
|
||||
<InputYaml
|
||||
label="Template"
|
||||
value={state.value_template ?? ""}
|
||||
onChange={value_template => setState({
|
||||
...state,
|
||||
value_template
|
||||
})}
|
||||
/>
|
||||
<InputTime
|
||||
label="For"
|
||||
value={state.for}
|
||||
onChange={_for => setState({
|
||||
...state,
|
||||
for: _for,
|
||||
})}
|
||||
/>
|
||||
</>
|
||||
}
|
||||
}
|
||||
export const TriggerNumericState: OptionManager<AutomationTriggerNumericState> =
|
||||
{
|
||||
defaultState: () => ({
|
||||
platform: "numeric_state",
|
||||
entity_id: "",
|
||||
}),
|
||||
isReady: () => true,
|
||||
renderOptionList: (state, setState) => {
|
||||
return (
|
||||
<>
|
||||
<InputEntity
|
||||
value={state.entity_id}
|
||||
multiple
|
||||
onChange={(entity_id) =>
|
||||
setState({
|
||||
...state,
|
||||
entity_id,
|
||||
})
|
||||
}
|
||||
/>
|
||||
<InputText
|
||||
label="Attribute"
|
||||
value={state.attribute ?? ""}
|
||||
onChange={(attribute) =>
|
||||
setState({
|
||||
...state,
|
||||
attribute,
|
||||
})
|
||||
}
|
||||
/>
|
||||
<InputNumber
|
||||
label="Above"
|
||||
value={state.above ? Number(state.above) : undefined}
|
||||
onChange={(above) =>
|
||||
setState({
|
||||
...state,
|
||||
above: above ? String(above) : undefined,
|
||||
})
|
||||
}
|
||||
/>
|
||||
<InputNumber
|
||||
label="Below"
|
||||
value={state.below ? Number(state.below) : undefined}
|
||||
onChange={(below) =>
|
||||
setState({
|
||||
...state,
|
||||
below: below ? String(below) : undefined,
|
||||
})
|
||||
}
|
||||
/>
|
||||
<InputYaml
|
||||
label="Template"
|
||||
value={state.value_template ?? ""}
|
||||
onChange={(value_template) =>
|
||||
setState({
|
||||
...state,
|
||||
value_template,
|
||||
})
|
||||
}
|
||||
/>
|
||||
<InputTime
|
||||
label="For"
|
||||
value={state.for}
|
||||
onChange={(_for) =>
|
||||
setState({
|
||||
...state,
|
||||
for: _for,
|
||||
})
|
||||
}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
},
|
||||
};
|
||||
@@ -1,9 +1,9 @@
|
||||
import { OptionManager } from "./OptionManager";
|
||||
import { AutomationTriggerState } from "types/automations/triggers";
|
||||
import InputText from "components/Inputs/InputText";
|
||||
import { InputEntity } from "components/Inputs/InputEntities";
|
||||
import { InputTime } from "components/Inputs/InputTime";
|
||||
import { InputAutoComplete } from "components/Inputs/InputAutoComplete";
|
||||
import InputText from "components/Inputs/Base/InputText";
|
||||
import { InputEntity } from "components/Inputs/AutoComplete/InputEntities";
|
||||
import { InputTime } from "components/Inputs/Base/InputTime";
|
||||
import { InputAutoComplete } from "components/Inputs/AutoComplete/InputAutoComplete";
|
||||
import { FC } from "react";
|
||||
import { getEntityDomains } from "utils/automations";
|
||||
import { InputList } from "components/Inputs/InputList";
|
||||
|
||||
@@ -1,30 +1,33 @@
|
||||
import { OptionManager } from './OptionManager';
|
||||
import { AutomationTriggerTemplate } from 'types/automations/triggers';
|
||||
import InputText from 'components/Inputs/InputText';
|
||||
import { InputTime } from 'components/Inputs/InputTime';
|
||||
|
||||
import { OptionManager } from "./OptionManager";
|
||||
import { AutomationTriggerTemplate } from "types/automations/triggers";
|
||||
import InputText from "components/Inputs/Base/InputText";
|
||||
import { InputTime } from "components/Inputs/Base/InputTime";
|
||||
|
||||
export const TriggerTemplate: OptionManager<AutomationTriggerTemplate> = {
|
||||
defaultState: () => ({
|
||||
"platform": 'template',
|
||||
"value_template": "",
|
||||
platform: "template",
|
||||
value_template: "",
|
||||
}),
|
||||
isReady: () => true,
|
||||
renderOptionList: (state, setState) => {
|
||||
return <>
|
||||
<InputText
|
||||
label='Template'
|
||||
value={state.value_template}
|
||||
onChange={value_template => setState({ ...state, value_template })}
|
||||
/>
|
||||
<InputTime
|
||||
label="For"
|
||||
value={state.for}
|
||||
onChange={_for => setState({
|
||||
...state,
|
||||
for: _for,
|
||||
})}
|
||||
/>
|
||||
</>
|
||||
}
|
||||
}
|
||||
return (
|
||||
<>
|
||||
<InputText
|
||||
label="Template"
|
||||
value={state.value_template}
|
||||
onChange={(value_template) => setState({ ...state, value_template })}
|
||||
/>
|
||||
<InputTime
|
||||
label="For"
|
||||
value={state.for}
|
||||
onChange={(_for) =>
|
||||
setState({
|
||||
...state,
|
||||
for: _for,
|
||||
})
|
||||
}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
},
|
||||
};
|
||||
@@ -8,13 +8,13 @@ import {
|
||||
AutomationTriggerExactTime,
|
||||
AutomationTriggerTimePattern,
|
||||
} from "types/automations/triggers";
|
||||
import InputText from "components/Inputs/InputText";
|
||||
import InputText from "components/Inputs/Base/InputText";
|
||||
import { FC } from "react";
|
||||
import { InputList } from "components/Inputs/InputList";
|
||||
import { Button } from "components/Inputs/Button";
|
||||
import { Button } from "components/Inputs/Buttons/Button";
|
||||
import { useState } from "react";
|
||||
import AddIcon from "@mui/icons-material/Add";
|
||||
import { InputTimeEntity } from "components/Inputs/InputTimeEntity";
|
||||
import { InputTimeEntity } from "components/Inputs/AutoComplete/InputTimeEntity";
|
||||
|
||||
export const TriggerTime: OptionManager<AutomationTriggerTime> = {
|
||||
defaultState: () => ({
|
||||
@@ -59,7 +59,8 @@ export const TriggerTime: OptionManager<AutomationTriggerTime> = {
|
||||
divisible by that number. You can specify "*" to match any value.{" "}
|
||||
<a
|
||||
href="https://www.home-assistant.io/docs/automation/trigger/#time-pattern-trigger"
|
||||
target="_blank" rel="noreferrer"
|
||||
target="_blank"
|
||||
rel="noreferrer"
|
||||
>
|
||||
More Info.
|
||||
</a>
|
||||
|
||||
@@ -1,20 +1,27 @@
|
||||
import { OptionManager } from './OptionManager';
|
||||
import { AutomationTriggerWebhook } from 'types/automations/triggers';
|
||||
import InputText from 'components/Inputs/InputText';
|
||||
|
||||
import { OptionManager } from "./OptionManager";
|
||||
import { AutomationTriggerWebhook } from "types/automations/triggers";
|
||||
import InputText from "components/Inputs/Base/InputText";
|
||||
|
||||
export const TriggerWebhook: OptionManager<AutomationTriggerWebhook> = {
|
||||
defaultState: () => ({
|
||||
"platform": 'webhook',
|
||||
"webhook_id": "",
|
||||
platform: "webhook",
|
||||
webhook_id: "",
|
||||
}),
|
||||
isReady: () => true,
|
||||
renderOptionList: (state, setState) => {
|
||||
return <>
|
||||
<InputText label="Webhook ID" value={state.webhook_id ?? ""} onChange={webhook_id => setState({
|
||||
...state,
|
||||
webhook_id
|
||||
})} />
|
||||
</>
|
||||
}
|
||||
}
|
||||
return (
|
||||
<>
|
||||
<InputText
|
||||
label="Webhook ID"
|
||||
value={state.webhook_id ?? ""}
|
||||
onChange={(webhook_id) =>
|
||||
setState({
|
||||
...state,
|
||||
webhook_id,
|
||||
})
|
||||
}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
},
|
||||
};
|
||||
@@ -1,40 +1,53 @@
|
||||
import { OptionManager } from './OptionManager';
|
||||
import { AutomationTriggerZone } from 'types/automations/triggers';
|
||||
import { InputList } from 'components/Inputs/InputList';
|
||||
import { InputEntity } from 'components/Inputs/InputEntities';
|
||||
|
||||
import { OptionManager } from "./OptionManager";
|
||||
import { AutomationTriggerZone } from "types/automations/triggers";
|
||||
import { InputList } from "components/Inputs/InputList";
|
||||
import { InputEntity } from "components/Inputs/AutoComplete/InputEntities";
|
||||
|
||||
export const TriggerZone: OptionManager<AutomationTriggerZone> = {
|
||||
defaultState: () => ({
|
||||
"platform": 'zone',
|
||||
"zone": "",
|
||||
"event": "enter",
|
||||
"entity_id": "",
|
||||
platform: "zone",
|
||||
zone: "",
|
||||
event: "enter",
|
||||
entity_id: "",
|
||||
}),
|
||||
isReady: () => true,
|
||||
renderOptionList: (state, setState) => {
|
||||
return <>
|
||||
<InputEntity label="Zone" restrictToDomain={['zone']} value={state.zone} onChange={zone => setState({
|
||||
...state,
|
||||
zone: zone ?? ""
|
||||
})} />
|
||||
<InputList
|
||||
label="Event"
|
||||
current={state.event}
|
||||
options={['enter', 'leave']}
|
||||
onChange={event => setState({
|
||||
...state, event,
|
||||
})}
|
||||
/>
|
||||
<InputEntity
|
||||
multiple
|
||||
restrictToDomain={["device_tracker", "person"]}
|
||||
value={state.entity_id}
|
||||
onChange={entity_id => setState({
|
||||
...state,
|
||||
entity_id
|
||||
})}
|
||||
/>
|
||||
</>
|
||||
}
|
||||
}
|
||||
return (
|
||||
<>
|
||||
<InputEntity
|
||||
label="Zone"
|
||||
restrictToDomain={["zone"]}
|
||||
value={state.zone}
|
||||
onChange={(zone) =>
|
||||
setState({
|
||||
...state,
|
||||
zone: zone ?? "",
|
||||
})
|
||||
}
|
||||
/>
|
||||
<InputList
|
||||
label="Event"
|
||||
current={state.event}
|
||||
options={["enter", "leave"]}
|
||||
onChange={(event) =>
|
||||
setState({
|
||||
...state,
|
||||
event,
|
||||
})
|
||||
}
|
||||
/>
|
||||
<InputEntity
|
||||
multiple
|
||||
restrictToDomain={["device_tracker", "person"]}
|
||||
value={state.entity_id}
|
||||
onChange={(entity_id) =>
|
||||
setState({
|
||||
...state,
|
||||
entity_id,
|
||||
})
|
||||
}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
},
|
||||
};
|
||||
@@ -7,8 +7,8 @@ import {
|
||||
getSubTypeList,
|
||||
validateNode,
|
||||
} from "utils/automations";
|
||||
import InputYaml from "components/Inputs/InputYaml";
|
||||
import InputText from "components/Inputs/InputText";
|
||||
import InputYaml from "components/Inputs/Base/InputYaml";
|
||||
import InputText from "components/Inputs/Base/InputText";
|
||||
import { getDescriptionFromAutomationNode } from "utils/formatting";
|
||||
import { useHA } from "haService";
|
||||
import { Generic } from "./Generic";
|
||||
|
||||
@@ -3,7 +3,7 @@ import { ComponentMeta, ComponentStory } from "@storybook/react";
|
||||
import { NodeEditor } from ".";
|
||||
|
||||
import { AutomationCondition } from "types/automations/conditions";
|
||||
import { Button } from "components/Inputs/Button";
|
||||
import { Button } from "components/Inputs/Buttons/Button";
|
||||
import { useState } from "react";
|
||||
import { Modal } from "components/Modal";
|
||||
import { Page } from "components/Page";
|
||||
|
||||
@@ -4,8 +4,8 @@ import { FC, ReactNode } from "react";
|
||||
import { AutomationNode, AutomationNodeMapping } from "types/automations/index";
|
||||
import { useEditorNodeState } from "./OptionManager";
|
||||
import { InputList } from "components/Inputs/InputList";
|
||||
import { Button } from "components/Inputs/Button";
|
||||
import InputBoolean from "components/Inputs/InputBoolean";
|
||||
import { Button } from "components/Inputs/Buttons/Button";
|
||||
import InputBoolean from "components/Inputs/Base/InputBoolean";
|
||||
import { useConfirm } from "material-ui-confirm";
|
||||
import { getNodeSubTypeDescription } from "./utils";
|
||||
|
||||
|
||||
@@ -1,16 +1,19 @@
|
||||
import "./ServiceEditorField.css";
|
||||
import { FC, useRef } from "react";
|
||||
import { ServiceEditorOption } from "./options";
|
||||
import InputText from "components/Inputs/InputText";
|
||||
import InputNumber from "components/Inputs/InputNumber";
|
||||
import InputText from "components/Inputs/Base/InputText";
|
||||
import InputNumber from "components/Inputs/Base/InputNumber";
|
||||
import { RemoveCircle } from "@mui/icons-material";
|
||||
import { InputAutoComplete, Option } from "components/Inputs/InputAutoComplete";
|
||||
import {
|
||||
InputAutoComplete,
|
||||
Option,
|
||||
} from "components/Inputs/AutoComplete/InputAutoComplete";
|
||||
import { prettyName } from "utils/formatting";
|
||||
import InputBoolean from "components/Inputs/InputBoolean";
|
||||
import InputBoolean from "components/Inputs/Base/InputBoolean";
|
||||
import { SelectorNumber, SelectorText } from "haService/fieldTypes";
|
||||
import InputYaml from "components/Inputs/InputYaml";
|
||||
import InputYaml from "components/Inputs/Base/InputYaml";
|
||||
import { useSnackbar } from "notistack";
|
||||
import { InputEntity } from "components/Inputs/InputEntities";
|
||||
import { InputEntity } from "components/Inputs/AutoComplete/InputEntities";
|
||||
import { ButtonIcon } from "components/Icons/ButtonIcons";
|
||||
|
||||
export type ServiceEditorFieldProps = {
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import "./ServiceEditorTarget.css";
|
||||
import { InputDevice } from "components/Inputs/InputDevice";
|
||||
import { InputEntity } from "components/Inputs/InputEntities";
|
||||
import { InputDevice } from "components/Inputs/AutoComplete/InputDevice";
|
||||
import { InputEntity } from "components/Inputs/AutoComplete/InputEntities";
|
||||
import { Targets } from "haService/fieldTypes";
|
||||
import { FC } from "react";
|
||||
import { InputArea } from "components/Inputs/InputArea";
|
||||
import { InputArea } from "components/Inputs/AutoComplete/InputArea";
|
||||
|
||||
type RawTargetData = {
|
||||
entity_id?: string[] | string;
|
||||
|
||||
@@ -3,7 +3,7 @@ import { ComponentMeta, ComponentStory } from "@storybook/react";
|
||||
import { Page } from "components/Page";
|
||||
import { ServiceEditor } from ".";
|
||||
import { TypedHassService } from "haService/fieldTypes";
|
||||
import InputYaml from "components/Inputs/InputYaml";
|
||||
import InputYaml from "components/Inputs/Base/InputYaml";
|
||||
|
||||
export default {
|
||||
title: "Services/ServiceEditor",
|
||||
|
||||
@@ -10,7 +10,7 @@ import {
|
||||
ServiceEditorData,
|
||||
} from "./options";
|
||||
import { ServiceEditorField } from "./ServiceEditorField";
|
||||
import { InputAutoComplete } from "components/Inputs/InputAutoComplete";
|
||||
import { InputAutoComplete } from "components/Inputs/AutoComplete/InputAutoComplete";
|
||||
import { ServiceEditorTarget } from "./ServiceEditorTarget";
|
||||
|
||||
export type ServiceEditorProps = {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { BaseOption } from "components/Inputs/InputAutoComplete";
|
||||
import { BaseOption } from "components/Inputs/AutoComplete/InputAutoComplete";
|
||||
import { FieldData, TypedHassService } from "haService/fieldTypes";
|
||||
import { prettyName } from "utils/formatting";
|
||||
|
||||
@@ -7,17 +7,22 @@ export type ServiceEditorData = {
|
||||
target: Record<string, any>;
|
||||
};
|
||||
export type ServiceEditorOption = BaseOption<{
|
||||
data: FieldData
|
||||
data: FieldData;
|
||||
}>;
|
||||
|
||||
export const convertFieldToOption = (id: string, data: FieldData): ServiceEditorOption => ({
|
||||
export const convertFieldToOption = (
|
||||
id: string,
|
||||
data: FieldData
|
||||
): ServiceEditorOption => ({
|
||||
id,
|
||||
label: data.name ?? prettyName(id),
|
||||
data,
|
||||
})
|
||||
});
|
||||
|
||||
|
||||
export const splitUpOptions = (service: TypedHassService, data: ServiceEditorData) => {
|
||||
export const splitUpOptions = (
|
||||
service: TypedHassService,
|
||||
data: ServiceEditorData
|
||||
) => {
|
||||
const required: ServiceEditorOption[] = [];
|
||||
const additional: ServiceEditorOption[] = [];
|
||||
const incmFields: string[] = [];
|
||||
@@ -28,7 +33,7 @@ export const splitUpOptions = (service: TypedHassService, data: ServiceEditorDat
|
||||
required.push(opt);
|
||||
} else {
|
||||
if (data.field[opt.id]) {
|
||||
incmFields.push(opt.id)
|
||||
incmFields.push(opt.id);
|
||||
} else {
|
||||
additional.push(opt);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
import { Connection, getCollection } from "home-assistant-js-websocket";
|
||||
import { useHassCollection } from "./useHassCollection";
|
||||
import { Option, BaseOption } from "components/Inputs/InputAutoComplete";
|
||||
import {
|
||||
Option,
|
||||
BaseOption,
|
||||
} from "components/Inputs/AutoComplete/InputAutoComplete";
|
||||
import { EntityRegisteryItem, HassEntitiesRegistry } from "./types";
|
||||
import { prettyName } from "utils/formatting";
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Option } from "components/Inputs/InputAutoComplete";
|
||||
import { Option } from "components/Inputs/AutoComplete/InputAutoComplete";
|
||||
import { HACollectionState, useHassCollection } from "./useHassCollection";
|
||||
import { entitiesColl, HassEntities } from "home-assistant-js-websocket";
|
||||
import { entitySourceColl } from "./additionalCollections";
|
||||
|
||||
@@ -2,9 +2,9 @@ import React, { FC, useEffect, useState } from "react";
|
||||
import { ComponentMeta, ComponentStory } from "@storybook/react";
|
||||
import { Page } from "components/Page";
|
||||
import { useHA } from "haService";
|
||||
import InputYaml from "components/Inputs/InputYaml";
|
||||
import InputYaml from "components/Inputs/Base/InputYaml";
|
||||
import { InputList } from "components/Inputs/InputList";
|
||||
import { Button } from "components/Inputs/Button";
|
||||
import { Button } from "components/Inputs/Buttons/Button";
|
||||
import { ServiceEditor } from "components/ServiceEditor";
|
||||
|
||||
const Test: FC = () => {
|
||||
|
||||
@@ -2,7 +2,7 @@ import React, { FC } from "react";
|
||||
import { ComponentMeta, ComponentStory } from "@storybook/react";
|
||||
import { Page } from "components/Page";
|
||||
import { useHADeviceRegistry } from "haService";
|
||||
import InputYaml from "components/Inputs/InputYaml";
|
||||
import InputYaml from "components/Inputs/Base/InputYaml";
|
||||
|
||||
const Test: FC<{ onRender: () => void }> = ({ onRender }) => {
|
||||
const conn = useHADeviceRegistry();
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { BaseOption } from "components/Inputs/InputAutoComplete";
|
||||
import { BaseOption } from "components/Inputs/AutoComplete/InputAutoComplete";
|
||||
import { MessageBase } from "home-assistant-js-websocket";
|
||||
import { useEffect, useRef, useState } from "react";
|
||||
import { prettyName } from "utils/formatting";
|
||||
|
||||
@@ -9,7 +9,7 @@ import { useHassCollection } from "./useHassCollection";
|
||||
import { useHAConnection } from "./connection";
|
||||
import { useSnackbar } from "notistack";
|
||||
import { TypedHassService } from "./fieldTypes";
|
||||
import { Option } from "components/Inputs/InputAutoComplete";
|
||||
import { Option } from "components/Inputs/AutoComplete/InputAutoComplete";
|
||||
import { getDeviceExtraWsCalls } from "./extras";
|
||||
import { useHAEntities } from "./HAEntities";
|
||||
|
||||
|
||||
@@ -2,9 +2,9 @@ import React, { FC, useEffect, useState } from "react";
|
||||
import { ComponentMeta, ComponentStory } from "@storybook/react";
|
||||
import { Page } from "components/Page";
|
||||
import { useHA } from "haService";
|
||||
import InputYaml from "components/Inputs/InputYaml";
|
||||
import InputYaml from "components/Inputs/Base/InputYaml";
|
||||
import { InputList } from "components/Inputs/InputList";
|
||||
import { Button } from "components/Inputs/Button";
|
||||
import { Button } from "components/Inputs/Buttons/Button";
|
||||
import { ServiceEditor } from "components/ServiceEditor";
|
||||
|
||||
const Test: FC = () => {
|
||||
|
||||
@@ -41,12 +41,6 @@ export const useHassCollection = <T, D extends {} = {}>(
|
||||
}
|
||||
const unsub = collection.subscribe((d) => {
|
||||
if (d) {
|
||||
console.log(
|
||||
"updating with",
|
||||
Object.keys(d).length,
|
||||
Object.fromEntries(Object.entries(d).map(([k, v]) => [k, v.state])),
|
||||
getHACollection
|
||||
);
|
||||
setState({
|
||||
ready: true,
|
||||
collection: d,
|
||||
|
||||
@@ -11,6 +11,16 @@ export const AutomationRoute: FC<{ api: ApiService }> = ({ api }) => {
|
||||
<AutomationManager
|
||||
api={api}
|
||||
refreshAutomations={() => ha.callService("automation", "reload")}
|
||||
triggerAutomation={(entity_id) =>
|
||||
ha.callService(
|
||||
"automation",
|
||||
"trigger",
|
||||
{},
|
||||
{
|
||||
entity_id,
|
||||
}
|
||||
)
|
||||
}
|
||||
forceDeleteAutomation={(eid) =>
|
||||
ha.callHA({
|
||||
entity_id: eid,
|
||||
|
||||
@@ -48,13 +48,14 @@ export const AutomationTimeObject = st.object({
|
||||
milliseconds: st.optional(st.number()),
|
||||
});
|
||||
export const AutomationTime = st.union([st.string(), AutomationTimeObject]);
|
||||
export const AutomationDeviceState = st.type({
|
||||
export const _AutomationDeviceState = {
|
||||
subtype: st.optional(st.string()),
|
||||
entity_id: st.optional(st.string()),
|
||||
type: st.string(),
|
||||
device_id: st.string(),
|
||||
domain: st.string(),
|
||||
});
|
||||
};
|
||||
export const AutomationDeviceState = st.type(_AutomationDeviceState);
|
||||
export const DayOfWeek = st.enums([
|
||||
"mon",
|
||||
"tue",
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
import * as st from "superstruct";
|
||||
import {
|
||||
AutomationTime,
|
||||
AutomationDeviceState,
|
||||
} from "./common";
|
||||
import { AutomationTime, _AutomationDeviceState } from "./common";
|
||||
|
||||
const AutomationTriggerBase = {
|
||||
id: st.optional(st.string()),
|
||||
@@ -99,13 +96,11 @@ export const AutomationTriggerZone = st.type({
|
||||
event: st.enums(["enter", "leave"]),
|
||||
});
|
||||
|
||||
export const AutomationTriggerDevice = st.assign(
|
||||
st.partial(AutomationDeviceState),
|
||||
st.type({
|
||||
...AutomationTriggerBase,
|
||||
platform: st.literal("device"),
|
||||
})
|
||||
);
|
||||
export const AutomationTriggerDevice = st.type({
|
||||
...AutomationTriggerBase,
|
||||
..._AutomationDeviceState,
|
||||
platform: st.literal("device"),
|
||||
});
|
||||
|
||||
export const AutomationTrigger = st.union([
|
||||
AutomationTriggerEvent,
|
||||
|
||||
+94
-94
@@ -6358,14 +6358,14 @@ css-has-pseudo@^3.0.4:
|
||||
dependencies:
|
||||
postcss-selector-parser "^6.0.9"
|
||||
|
||||
css-jss@10.9.1:
|
||||
version "10.9.1"
|
||||
resolved "https://registry.yarnpkg.com/css-jss/-/css-jss-10.9.1.tgz#0fb6f7ac128f71b2d21353ea207e765eb832aca2"
|
||||
integrity sha512-0AHeUiRt7jLMuh2QQXmt2siaTrsi+EbD4yYh5d0VXTgo3+/aDjuZLoP41oLAOQlchk1SbTydmoIsM2f896shOw==
|
||||
css-jss@10.9.2:
|
||||
version "10.9.2"
|
||||
resolved "https://registry.yarnpkg.com/css-jss/-/css-jss-10.9.2.tgz#ac75ef944def062ffa3a667afc0f867ff651a356"
|
||||
integrity sha512-85P3X4lr2MkPBRkk/cn5AQTy5WHyHOBtQPnWRSYx6F3m0O4pVKexpFKdCDDoAgihp6cwYCf38eGVwU/ssZDSjA==
|
||||
dependencies:
|
||||
"@babel/runtime" "^7.3.1"
|
||||
jss "10.9.1"
|
||||
jss-preset-default "10.9.1"
|
||||
jss "10.9.2"
|
||||
jss-preset-default "10.9.2"
|
||||
|
||||
css-loader@^3.6.0:
|
||||
version "3.6.0"
|
||||
@@ -10278,14 +10278,14 @@ jsonpointer@^5.0.0:
|
||||
resolved "https://registry.yarnpkg.com/jsonpointer/-/jsonpointer-5.0.0.tgz#f802669a524ec4805fa7389eadbc9921d5dc8072"
|
||||
integrity sha512-PNYZIdMjVIvVgDSYKTT63Y+KZ6IZvGRNNWcxwD+GNnUz1MKPfv30J8ueCjdwcN0nDx2SlshgyB7Oy0epAzVRRg==
|
||||
|
||||
jss-plugin-camel-case@10.9.1:
|
||||
version "10.9.1"
|
||||
resolved "https://registry.yarnpkg.com/jss-plugin-camel-case/-/jss-plugin-camel-case-10.9.1.tgz#66fee442163cec6baa9d8791322fd5dec6ff69d5"
|
||||
integrity sha512-irEr3Z2ENUz71OIq6PWN0N6g3uIA6LyGEwiIfL1JBzy+HVZS17xq/vwnHda3KyvPls18cKiwNNuuVwY6TrWwWg==
|
||||
jss-plugin-camel-case@10.9.2:
|
||||
version "10.9.2"
|
||||
resolved "https://registry.yarnpkg.com/jss-plugin-camel-case/-/jss-plugin-camel-case-10.9.2.tgz#76dddfa32f9e62d17daa4e3504991fd0933b89e1"
|
||||
integrity sha512-wgBPlL3WS0WDJ1lPJcgjux/SHnDuu7opmgQKSraKs4z8dCCyYMx9IDPFKBXQ8Q5dVYij1FFV0WdxyhuOOAXuTg==
|
||||
dependencies:
|
||||
"@babel/runtime" "^7.3.1"
|
||||
hyphenate-style-name "^1.0.3"
|
||||
jss "10.9.1"
|
||||
jss "10.9.2"
|
||||
|
||||
jss-plugin-camel-case@^10.8.2:
|
||||
version "10.9.0"
|
||||
@@ -10296,22 +10296,22 @@ jss-plugin-camel-case@^10.8.2:
|
||||
hyphenate-style-name "^1.0.3"
|
||||
jss "10.9.0"
|
||||
|
||||
jss-plugin-compose@10.9.1:
|
||||
version "10.9.1"
|
||||
resolved "https://registry.yarnpkg.com/jss-plugin-compose/-/jss-plugin-compose-10.9.1.tgz#f4fe401c6723f4b8c433b6fe978b8bed27b51e13"
|
||||
integrity sha512-expcDs517tASeRB5Yq3Ek4jezck0IsODMPeWtSx9w5i8c2c0KVFcbEWWDwxjKVRtj16sZMyJPOIk7G8qungWow==
|
||||
jss-plugin-compose@10.9.2:
|
||||
version "10.9.2"
|
||||
resolved "https://registry.yarnpkg.com/jss-plugin-compose/-/jss-plugin-compose-10.9.2.tgz#276c463ceea0abaf266a17e0fdb6a998a7189ba0"
|
||||
integrity sha512-XvsGar4D791VgOMqbEk1XYY5s84Ew57OMLYjbnTXl3MSaBTvmR5M3dTqQbBquJGp4pLyyqlfTcijfolZII1w4Q==
|
||||
dependencies:
|
||||
"@babel/runtime" "^7.3.1"
|
||||
jss "10.9.1"
|
||||
jss "10.9.2"
|
||||
tiny-warning "^1.0.2"
|
||||
|
||||
jss-plugin-default-unit@10.9.1:
|
||||
version "10.9.1"
|
||||
resolved "https://registry.yarnpkg.com/jss-plugin-default-unit/-/jss-plugin-default-unit-10.9.1.tgz#c1f667e25141f9c18976157b6f217a4df85fd1e1"
|
||||
integrity sha512-sqQ1nRSy07z1brABTXK8EamDDjYVp/u9b/gKL51ZB+NNzbqvQF0CR33fGKPt0IOai98mzk0aHHIpf5il7mRN7A==
|
||||
jss-plugin-default-unit@10.9.2:
|
||||
version "10.9.2"
|
||||
resolved "https://registry.yarnpkg.com/jss-plugin-default-unit/-/jss-plugin-default-unit-10.9.2.tgz#3e7f4a1506b18d8fe231554fd982439feb2a9c53"
|
||||
integrity sha512-pYg0QX3bBEFtTnmeSI3l7ad1vtHU42YEEpgW7pmIh+9pkWNWb5dwS/4onSfAaI0kq+dOZHzz4dWe+8vWnanoSg==
|
||||
dependencies:
|
||||
"@babel/runtime" "^7.3.1"
|
||||
jss "10.9.1"
|
||||
jss "10.9.2"
|
||||
|
||||
jss-plugin-default-unit@^10.8.2:
|
||||
version "10.9.0"
|
||||
@@ -10321,30 +10321,30 @@ jss-plugin-default-unit@^10.8.2:
|
||||
"@babel/runtime" "^7.3.1"
|
||||
jss "10.9.0"
|
||||
|
||||
jss-plugin-expand@10.9.1:
|
||||
version "10.9.1"
|
||||
resolved "https://registry.yarnpkg.com/jss-plugin-expand/-/jss-plugin-expand-10.9.1.tgz#0772c25dc8772b3edc94a09c066ddf176de4076f"
|
||||
integrity sha512-HnWvVo9CtjVJC6IwjSKUUSInhmLc5/CxOk/YjKqaTPW5tnKf6w3L335ih/YUmBEj//CRVdLwVs3lJIGy1FIX3Q==
|
||||
jss-plugin-expand@10.9.2:
|
||||
version "10.9.2"
|
||||
resolved "https://registry.yarnpkg.com/jss-plugin-expand/-/jss-plugin-expand-10.9.2.tgz#d9a1b52ff72c7f5214ed8d1adde2f302374f65c9"
|
||||
integrity sha512-D3PGLUJu3YbHhX6vANooCa1gqfv68wLssDp08wH21YVTCt6u8jWfqkoj9NmPz5ea1Fc0WMoJtofJTlgb6ApZvw==
|
||||
dependencies:
|
||||
"@babel/runtime" "^7.3.1"
|
||||
jss "10.9.1"
|
||||
jss "10.9.2"
|
||||
|
||||
jss-plugin-extend@10.9.1:
|
||||
version "10.9.1"
|
||||
resolved "https://registry.yarnpkg.com/jss-plugin-extend/-/jss-plugin-extend-10.9.1.tgz#929d6712eb1e5b3d724677b7c37038d2bafabcc1"
|
||||
integrity sha512-3lTHjNeFtkwSdku27DwhdMJobgG7Xo+tdoHz6D6iwAMWMzxAHQaJZg6TWTf1Efn2ghlTHj8kFA6+RrJvbbj62g==
|
||||
jss-plugin-extend@10.9.2:
|
||||
version "10.9.2"
|
||||
resolved "https://registry.yarnpkg.com/jss-plugin-extend/-/jss-plugin-extend-10.9.2.tgz#8774a3ad79a7112437e62389fb0baa36f32d8e40"
|
||||
integrity sha512-55lXOQ7yyRtrMRYOcWUeZ3Ea4/Cd/oTndvb9j/5O3+E816nRoYbDsqKI8ob0Yx8PnfHBsQN0u10JcLnqq+8aPA==
|
||||
dependencies:
|
||||
"@babel/runtime" "^7.3.1"
|
||||
jss "10.9.1"
|
||||
jss "10.9.2"
|
||||
tiny-warning "^1.0.2"
|
||||
|
||||
jss-plugin-global@10.9.1:
|
||||
version "10.9.1"
|
||||
resolved "https://registry.yarnpkg.com/jss-plugin-global/-/jss-plugin-global-10.9.1.tgz#06d8124f919f67dc2895a84f27ac0daa8598226a"
|
||||
integrity sha512-wc8EQMUe9NGInmnZErA1xQsX9jfk+7MrgN0sOB7l1IqfFQyuN0ntgo93bKhIj4I5RUtzjCskcvReBEZVwAHK8w==
|
||||
jss-plugin-global@10.9.2:
|
||||
version "10.9.2"
|
||||
resolved "https://registry.yarnpkg.com/jss-plugin-global/-/jss-plugin-global-10.9.2.tgz#e7f2ad4a5e8e674fb703b04b57a570b8c3e5c2c2"
|
||||
integrity sha512-GcX0aE8Ef6AtlasVrafg1DItlL/tWHoC4cGir4r3gegbWwF5ZOBYhx04gurPvWHC8F873aEGqge7C17xpwmp2g==
|
||||
dependencies:
|
||||
"@babel/runtime" "^7.3.1"
|
||||
jss "10.9.1"
|
||||
jss "10.9.2"
|
||||
|
||||
jss-plugin-global@^10.8.2:
|
||||
version "10.9.0"
|
||||
@@ -10354,13 +10354,13 @@ jss-plugin-global@^10.8.2:
|
||||
"@babel/runtime" "^7.3.1"
|
||||
jss "10.9.0"
|
||||
|
||||
jss-plugin-nested@10.9.1:
|
||||
version "10.9.1"
|
||||
resolved "https://registry.yarnpkg.com/jss-plugin-nested/-/jss-plugin-nested-10.9.1.tgz#75c1d219e6bc21d690dc884f53cb71a8286891c8"
|
||||
integrity sha512-5kSHhhZra1+xwitBVyKN4da00860X7DDeuzf+sF8C6L6C0DuV2VAy6MKIoWKuIrx3pknYUgS/eo/VfsRmFP5Mw==
|
||||
jss-plugin-nested@10.9.2:
|
||||
version "10.9.2"
|
||||
resolved "https://registry.yarnpkg.com/jss-plugin-nested/-/jss-plugin-nested-10.9.2.tgz#3aa2502816089ecf3981e1a07c49b276d67dca63"
|
||||
integrity sha512-VgiOWIC6bvgDaAL97XCxGD0BxOKM0K0zeB/ECyNaVF6FqvdGB9KBBWRdy2STYAss4VVA7i5TbxFZN+WSX1kfQA==
|
||||
dependencies:
|
||||
"@babel/runtime" "^7.3.1"
|
||||
jss "10.9.1"
|
||||
jss "10.9.2"
|
||||
tiny-warning "^1.0.2"
|
||||
|
||||
jss-plugin-nested@^10.8.2:
|
||||
@@ -10372,13 +10372,13 @@ jss-plugin-nested@^10.8.2:
|
||||
jss "10.9.0"
|
||||
tiny-warning "^1.0.2"
|
||||
|
||||
jss-plugin-props-sort@10.9.1:
|
||||
version "10.9.1"
|
||||
resolved "https://registry.yarnpkg.com/jss-plugin-props-sort/-/jss-plugin-props-sort-10.9.1.tgz#96757398abb8410e2b0bdbbad6cd83655ea101bb"
|
||||
integrity sha512-Z+KkIty+MEq8+7SDGYdpb9A0IV6NTlk5s4NGGPvgHxyB/6gr46XWvaHuPE8BagrC+k1Aq5E63nPN6uL0pKsnjw==
|
||||
jss-plugin-props-sort@10.9.2:
|
||||
version "10.9.2"
|
||||
resolved "https://registry.yarnpkg.com/jss-plugin-props-sort/-/jss-plugin-props-sort-10.9.2.tgz#645f6c8f179309667b3e6212f66b59a32fb3f01f"
|
||||
integrity sha512-AP1AyUTbi2szylgr+O0OB7gkIxEGzySLITZ2GpsaoX72YMCGI2jYAc+WUhPfvUnZYiauF4zTnN4V4TGuvFjJlw==
|
||||
dependencies:
|
||||
"@babel/runtime" "^7.3.1"
|
||||
jss "10.9.1"
|
||||
jss "10.9.2"
|
||||
|
||||
jss-plugin-props-sort@^10.8.2:
|
||||
version "10.9.0"
|
||||
@@ -10388,13 +10388,13 @@ jss-plugin-props-sort@^10.8.2:
|
||||
"@babel/runtime" "^7.3.1"
|
||||
jss "10.9.0"
|
||||
|
||||
jss-plugin-rule-value-function@10.9.1:
|
||||
version "10.9.1"
|
||||
resolved "https://registry.yarnpkg.com/jss-plugin-rule-value-function/-/jss-plugin-rule-value-function-10.9.1.tgz#d799eafa3cd9ae2c99f60bc15c1c11783806ac7b"
|
||||
integrity sha512-4GbLHDqq+Ps6BZMRYZwjiAtxuqnscGLxwG4YnrgfuDM/yqGNJFZwK4Zfabs3XMe0cM+IbadsgJVUQgJwuNB4IA==
|
||||
jss-plugin-rule-value-function@10.9.2:
|
||||
version "10.9.2"
|
||||
resolved "https://registry.yarnpkg.com/jss-plugin-rule-value-function/-/jss-plugin-rule-value-function-10.9.2.tgz#9afe07596e477123cbf11120776be6a64494541f"
|
||||
integrity sha512-vf5ms8zvLFMub6swbNxvzsurHfUZ5Shy5aJB2gIpY6WNA3uLinEcxYyraQXItRHi5ivXGqYciFDRM2ZoVoRZ4Q==
|
||||
dependencies:
|
||||
"@babel/runtime" "^7.3.1"
|
||||
jss "10.9.1"
|
||||
jss "10.9.2"
|
||||
tiny-warning "^1.0.2"
|
||||
|
||||
jss-plugin-rule-value-function@^10.8.2:
|
||||
@@ -10406,32 +10406,32 @@ jss-plugin-rule-value-function@^10.8.2:
|
||||
jss "10.9.0"
|
||||
tiny-warning "^1.0.2"
|
||||
|
||||
jss-plugin-rule-value-observable@10.9.1:
|
||||
version "10.9.1"
|
||||
resolved "https://registry.yarnpkg.com/jss-plugin-rule-value-observable/-/jss-plugin-rule-value-observable-10.9.1.tgz#0ad7786bfe43da15f3d79fc9068bc3068faa88ad"
|
||||
integrity sha512-A6FUX0OAU5rD38ui607pGEALtqkwV6Uz4N+/d+175SXlIjVVIqEWoWnO9eUkM9pw+dYtSLdDhZ0c4CrRvzvIcw==
|
||||
jss-plugin-rule-value-observable@10.9.2:
|
||||
version "10.9.2"
|
||||
resolved "https://registry.yarnpkg.com/jss-plugin-rule-value-observable/-/jss-plugin-rule-value-observable-10.9.2.tgz#3e024ccc3f1188116ccbf5e6b7825c42ccee57c2"
|
||||
integrity sha512-SSqBD4s/k2mwsOUg6+LI/oEmvUxokIWi+5bZOyer/2nP4kMxeo3gHURc2yiAEu3v62Sf3GHhgC6pBAugxhLL9A==
|
||||
dependencies:
|
||||
"@babel/runtime" "^7.3.1"
|
||||
jss "10.9.1"
|
||||
jss "10.9.2"
|
||||
symbol-observable "^1.2.0"
|
||||
|
||||
jss-plugin-template@10.9.1:
|
||||
version "10.9.1"
|
||||
resolved "https://registry.yarnpkg.com/jss-plugin-template/-/jss-plugin-template-10.9.1.tgz#f1bb1c24c1d9db437c590455a48ddeb605358035"
|
||||
integrity sha512-yTkHfUtOhYcKfEIPl9kwRG5Yujx1GaXZvNLDFxgTu4nvLCKy5FpL/XHo0McJT9e2JsCRiaWMl3FExU7CqA0dhA==
|
||||
jss-plugin-template@10.9.2:
|
||||
version "10.9.2"
|
||||
resolved "https://registry.yarnpkg.com/jss-plugin-template/-/jss-plugin-template-10.9.2.tgz#df03c552d171948e061bdb7fa660245fbd9a5450"
|
||||
integrity sha512-f+ANQg8n+tkYea4Fu1Qt4skv9UJiNllzJB1Ga0QyumDZZJVpCzl8/mbFT1cvQSW7h+yB31GexFYVF3ct5fFGzA==
|
||||
dependencies:
|
||||
"@babel/runtime" "^7.3.1"
|
||||
jss "10.9.1"
|
||||
jss "10.9.2"
|
||||
tiny-warning "^1.0.2"
|
||||
|
||||
jss-plugin-vendor-prefixer@10.9.1:
|
||||
version "10.9.1"
|
||||
resolved "https://registry.yarnpkg.com/jss-plugin-vendor-prefixer/-/jss-plugin-vendor-prefixer-10.9.1.tgz#b408c29912dd32168c9441732924123a98165669"
|
||||
integrity sha512-tlaN/UdAkim7vji7EcAw5MbOUq5/Vh1hhrWMzmdlcDATwHhDp2bYiq9G21NEa5D0AzcW631VjJq7WulpE1APHQ==
|
||||
jss-plugin-vendor-prefixer@10.9.2:
|
||||
version "10.9.2"
|
||||
resolved "https://registry.yarnpkg.com/jss-plugin-vendor-prefixer/-/jss-plugin-vendor-prefixer-10.9.2.tgz#410a0f3b9f8dbbfba58f4d329134df4849aa1237"
|
||||
integrity sha512-SxcEoH+Rttf9fEv6KkiPzLdXRmI6waOTcMkbbEFgdZLDYNIP9UKNHFy6thhbRKqv0XMQZdrEsbDyV464zE/dUA==
|
||||
dependencies:
|
||||
"@babel/runtime" "^7.3.1"
|
||||
css-vendor "^2.0.8"
|
||||
jss "10.9.1"
|
||||
jss "10.9.2"
|
||||
|
||||
jss-plugin-vendor-prefixer@^10.8.2:
|
||||
version "10.9.0"
|
||||
@@ -10442,25 +10442,25 @@ jss-plugin-vendor-prefixer@^10.8.2:
|
||||
css-vendor "^2.0.8"
|
||||
jss "10.9.0"
|
||||
|
||||
jss-preset-default@10.9.1:
|
||||
version "10.9.1"
|
||||
resolved "https://registry.yarnpkg.com/jss-preset-default/-/jss-preset-default-10.9.1.tgz#e60722d3f94b925c839bd743a1c85cd0c5e467a4"
|
||||
integrity sha512-Yd1Y+KjBVKTbT8Yeh+TL99o2IClBYj4O9BLjxC6LCJ4UipUSQHZwXapuyJPvF9aUSDlvKA3p3AH6wwms/tlrLQ==
|
||||
jss-preset-default@10.9.2:
|
||||
version "10.9.2"
|
||||
resolved "https://registry.yarnpkg.com/jss-preset-default/-/jss-preset-default-10.9.2.tgz#684e0c0a2ce3b1127e990457ebc0ba71272780f3"
|
||||
integrity sha512-HMkTLgYPRjwdiu8n8ZB2VEfpO95cZ5AmmSYvFSvt76MQJMp/xDh6cP49MmZHwMpIvXwNj0LI8Peglgwz+rHKBQ==
|
||||
dependencies:
|
||||
"@babel/runtime" "^7.3.1"
|
||||
jss "10.9.1"
|
||||
jss-plugin-camel-case "10.9.1"
|
||||
jss-plugin-compose "10.9.1"
|
||||
jss-plugin-default-unit "10.9.1"
|
||||
jss-plugin-expand "10.9.1"
|
||||
jss-plugin-extend "10.9.1"
|
||||
jss-plugin-global "10.9.1"
|
||||
jss-plugin-nested "10.9.1"
|
||||
jss-plugin-props-sort "10.9.1"
|
||||
jss-plugin-rule-value-function "10.9.1"
|
||||
jss-plugin-rule-value-observable "10.9.1"
|
||||
jss-plugin-template "10.9.1"
|
||||
jss-plugin-vendor-prefixer "10.9.1"
|
||||
jss "10.9.2"
|
||||
jss-plugin-camel-case "10.9.2"
|
||||
jss-plugin-compose "10.9.2"
|
||||
jss-plugin-default-unit "10.9.2"
|
||||
jss-plugin-expand "10.9.2"
|
||||
jss-plugin-extend "10.9.2"
|
||||
jss-plugin-global "10.9.2"
|
||||
jss-plugin-nested "10.9.2"
|
||||
jss-plugin-props-sort "10.9.2"
|
||||
jss-plugin-rule-value-function "10.9.2"
|
||||
jss-plugin-rule-value-observable "10.9.2"
|
||||
jss-plugin-template "10.9.2"
|
||||
jss-plugin-vendor-prefixer "10.9.2"
|
||||
|
||||
jss@10.9.0, jss@^10.8.2:
|
||||
version "10.9.0"
|
||||
@@ -10472,10 +10472,10 @@ jss@10.9.0, jss@^10.8.2:
|
||||
is-in-browser "^1.1.3"
|
||||
tiny-warning "^1.0.2"
|
||||
|
||||
jss@10.9.1:
|
||||
version "10.9.1"
|
||||
resolved "https://registry.yarnpkg.com/jss/-/jss-10.9.1.tgz#43d95a964f68f31074470da8de5167aed4586311"
|
||||
integrity sha512-omDBQTYyIdYuHee1mkpqDyHw2NguCrURBU1izPPHmdtDK6SkP7P3buZt4ybHWOahTZ3+xd0C+zLPBBw7Hn3eYg==
|
||||
jss@10.9.2:
|
||||
version "10.9.2"
|
||||
resolved "https://registry.yarnpkg.com/jss/-/jss-10.9.2.tgz#9379be1f195ef98011dfd31f9448251bd61b95a9"
|
||||
integrity sha512-b8G6rWpYLR4teTUbGd4I4EsnWjg7MN0Q5bSsjKhVkJVjhQDy2KzkbD2AW3TuT0RYZVmZZHKIrXDn6kjU14qkUg==
|
||||
dependencies:
|
||||
"@babel/runtime" "^7.3.1"
|
||||
csstype "^3.0.2"
|
||||
@@ -13051,18 +13051,18 @@ react-is@^18.0.0:
|
||||
resolved "https://registry.yarnpkg.com/react-is/-/react-is-18.1.0.tgz#61aaed3096d30eacf2a2127118b5b41387d32a67"
|
||||
integrity sha512-Fl7FuabXsJnV5Q1qIOQwx/sagGF18kogb4gpfcG4gjLBWO0WDiiz1ko/ExayuxE7InyQkBLkxRFG5oxY6Uu3Kg==
|
||||
|
||||
react-jss@10.9.1:
|
||||
version "10.9.1"
|
||||
resolved "https://registry.yarnpkg.com/react-jss/-/react-jss-10.9.1.tgz#c3754e551437a0058c12eb35e7f3496f1640ccbd"
|
||||
integrity sha512-voEAxKejBxzNpftwjN28itnOkk0vnk77aSiuTeHnfZG1NsjHUmVrYjt0Pb8F3ruFJlbuLnvFFdSWR/nRacbqzw==
|
||||
react-jss@10.9.2:
|
||||
version "10.9.2"
|
||||
resolved "https://registry.yarnpkg.com/react-jss/-/react-jss-10.9.2.tgz#3a98ca0cf2698b0e65f7219f018bf1a8f4c1a4d0"
|
||||
integrity sha512-f7azcJ3GhFXa3vNVF9IMN5ja/u1rEmyRhUiPa9KRdnnZ4wdN8xfCs5LShanRBslLXlD+OFi1Zzz66PwXSkd41w==
|
||||
dependencies:
|
||||
"@babel/runtime" "^7.3.1"
|
||||
"@emotion/is-prop-valid" "^0.7.3"
|
||||
css-jss "10.9.1"
|
||||
css-jss "10.9.2"
|
||||
hoist-non-react-statics "^3.2.0"
|
||||
is-in-browser "^1.1.3"
|
||||
jss "10.9.1"
|
||||
jss-preset-default "10.9.1"
|
||||
jss "10.9.2"
|
||||
jss-preset-default "10.9.2"
|
||||
prop-types "^15.6.0"
|
||||
shallow-equal "^1.2.0"
|
||||
theming "^3.3.0"
|
||||
|
||||
Reference in new issue
Block a user