reloading autos
This commit is contained in:
1 parent
c17783064c
commit
0cecae5faa
9 files changed
+103
-31
No files matched your search
@@ -46,6 +46,7 @@ export const AutomationEditor: FC<Props> = ({
|
||||
if (dims.flipped !== flipped) {
|
||||
setFlipped(dims.flipped)
|
||||
}
|
||||
// eslint-disable-next-line
|
||||
}, [dims.flipped])
|
||||
|
||||
// render
|
||||
|
||||
@@ -18,7 +18,12 @@ export type Props = {
|
||||
}
|
||||
|
||||
const useAutomationListBoxState = () => {
|
||||
const [cookies, setCookies, _] = useCookies(['albSearchText', 'albSelected']);
|
||||
const [
|
||||
cookies,
|
||||
setCookies,
|
||||
// eslint-disable-next-line
|
||||
_
|
||||
] = useCookies(['albSearchText', 'albSelected']);
|
||||
let initialSelected = [];
|
||||
try {
|
||||
initialSelected = JSON.parse(cookies.albSelected)
|
||||
|
||||
@@ -14,6 +14,7 @@ import { makeTagDB } from "./TagDB";
|
||||
import LinearProgress from "@mui/material/LinearProgress";
|
||||
import CircularProgress from "@mui/material/CircularProgress";
|
||||
import { useCookies } from 'react-cookie';
|
||||
import { useHA } from "haService";
|
||||
|
||||
|
||||
interface AutomationListParams {
|
||||
@@ -26,11 +27,15 @@ interface AutomationListParams {
|
||||
}
|
||||
|
||||
export const useAutomationListState = () => {
|
||||
const [cookies, setCookies, _] = useCookies(['alCurrent']);
|
||||
const [
|
||||
cookies,
|
||||
setCookies,
|
||||
// eslint-disable-next-line
|
||||
_
|
||||
] = useCookies(['alCurrent']);
|
||||
let initialCurrent = 0;
|
||||
try {
|
||||
initialCurrent = Number(cookies.alCurrent ?? '0');
|
||||
// eslint-disable-next-line
|
||||
} catch (_) { }
|
||||
|
||||
const [hideList, setHideList] = useState(false);
|
||||
@@ -109,11 +114,21 @@ export const ConnectedAutomationList: FC<ConnectedAutomationListParams> = ({
|
||||
state: {
|
||||
automations,
|
||||
},
|
||||
removeAutomation,
|
||||
updateAutomation,
|
||||
...methods
|
||||
},
|
||||
dims
|
||||
}) => {
|
||||
const { reloadAutomations } = useHA();
|
||||
const removeAutomation = async (args: any) => {
|
||||
const resp = await methods.removeAutomation(args)
|
||||
await reloadAutomations();
|
||||
return resp
|
||||
}
|
||||
const updateAutomation = async (args: any) => {
|
||||
const resp = await methods.updateAutomation(args)
|
||||
await reloadAutomations();
|
||||
return resp
|
||||
}
|
||||
if (!automations.ready) {
|
||||
return <div className="automation-list--root loading">
|
||||
<LinearProgress />
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import { FC } from "react";
|
||||
import FormHelperText from '@mui/material/FormHelperText';
|
||||
import InputLabel from '@mui/material/InputLabel';
|
||||
import MenuItem from '@mui/material/MenuItem';
|
||||
|
||||
@@ -5,13 +5,8 @@ import EditIcon from '@mui/icons-material/Edit';
|
||||
import CloseIcon from "@mui/icons-material/Close";
|
||||
import IconButton from "@mui/material/IconButton"
|
||||
import { AutomationTime, AutomationTimeObject } from "types/automations/common";
|
||||
import { convertAutomationTimeToTimeObject, convertObjectToAutomationTimeString, milisecondsToObject } from "utils/time";
|
||||
import { convertStringToAutomationTimeObject, convertAutomationTimeToTimeString } from 'utils/time';
|
||||
import { convertAutomationTimeToTimeObject, convertObjectToAutomationTimeString, convertAutomationTimeToTimeString } from 'utils/time';
|
||||
import { prettyName } from "utils/formatting";
|
||||
import FormControl from "@mui/material/FormControl";
|
||||
import InputLabel from '@mui/material/InputLabel';
|
||||
import Input from "@mui/material/Input";
|
||||
import FormHelperText from '@mui/material/FormHelperText';
|
||||
|
||||
// constants
|
||||
const fields: Array<keyof AutomationTimeObject> = [
|
||||
@@ -120,6 +115,7 @@ export const InputTime: FC<Props> = (props) => {
|
||||
props.onChange(displayValue)
|
||||
}
|
||||
}
|
||||
// eslint-disable-next-line
|
||||
}, [disabled, displayValue])
|
||||
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Dispatch, SetStateAction, useEffect, useState, Component } from 'react';
|
||||
import { Dispatch, SetStateAction, useEffect, useState } from 'react';
|
||||
import { AutomationNode, AutomationNodeTypes } from 'types/automations';
|
||||
import { AutomationNodeSubtype } from 'types/automations';
|
||||
import { getOptionManager } from './getOptionManager';
|
||||
@@ -8,8 +8,7 @@ import InputText from 'components/Inputs/InputText';
|
||||
import { getDescriptionFromAutomationNode } from 'utils/formatting';
|
||||
import { useHA } from 'haService';
|
||||
import { Generic } from './Generic';
|
||||
import { getNodeTypeAndValidate } from '../../../utils/automations';
|
||||
import InputBoolean from 'components/Inputs/InputBoolean';
|
||||
import { getNodeTypeAndValidate } from 'utils/automations';
|
||||
|
||||
type UseState = <S>(s: S) => [S, Dispatch<SetStateAction<S>>]
|
||||
|
||||
|
||||
Reference in new issue
Block a user