enabled flag
This commit is contained in:
1 parent
e3a816f2c8
commit
b30f4ed59a
7 files changed
+45
-5
No files matched your search
@@ -9,6 +9,7 @@ import { getDescriptionFromAutomationNode } from 'utils/formatting';
|
||||
import { useHA } from 'haService';
|
||||
import { Generic } from './Generic';
|
||||
import { getNodeTypeAndValidate } from '../../../utils/automations';
|
||||
import InputBoolean from 'components/Inputs/InputBoolean';
|
||||
|
||||
type UseState = <S>(s: S) => [S, Dispatch<SetStateAction<S>>]
|
||||
|
||||
@@ -70,8 +71,13 @@ export const useEditorNodeState = (originalNode: AutomationNode, isErrored: bool
|
||||
get data() {
|
||||
return currentNode
|
||||
},
|
||||
setEnabled(enabled: boolean) {
|
||||
setState({
|
||||
...currentNode,
|
||||
enabled,
|
||||
})
|
||||
},
|
||||
renderOptionList() {
|
||||
console.log('rendering option list')
|
||||
let aliasEditor = <></>
|
||||
if (nodeType === 'trigger') {
|
||||
aliasEditor = <InputText
|
||||
|
||||
@@ -8,6 +8,14 @@
|
||||
margin-top: 0.5em;
|
||||
}
|
||||
|
||||
.node-editor--root.disabled {
|
||||
background-color: var(--secondary);
|
||||
}
|
||||
|
||||
.node-editor--root.disabled .enabled-flag {
|
||||
color: var(--secondary-accent);
|
||||
}
|
||||
|
||||
.node-editor--root.modded {
|
||||
border: 1px solid var(--change);
|
||||
border-radius: 5px;
|
||||
@@ -67,4 +75,16 @@
|
||||
|
||||
.node-editor--error>li {
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.node-editor--body-flags {
|
||||
padding-left: 1em;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-evenly;
|
||||
}
|
||||
|
||||
.node-editor--body-flags .MuiCheckbox-root {
|
||||
margin: 0;
|
||||
padding: 0 0 0 0;
|
||||
}
|
||||
@@ -43,7 +43,12 @@ export const NodeEditor: FC<NodeEditorProps> = ({
|
||||
// events
|
||||
onFlags(isReady, isModified);
|
||||
// render
|
||||
return <div className={["node-editor--root", isModified ? "modded" : "", (!isReady && isModified) ? 'not-ready' : ''].join(" ")}>
|
||||
return <div className={[
|
||||
"node-editor--root",
|
||||
isModified ? "modded" : "",
|
||||
(!isReady && isModified) ? 'not-ready' : '',
|
||||
state.data.enabled === false ? 'disabled' : 'enabled'
|
||||
].join(" ")}>
|
||||
<div className="node-editor--body">
|
||||
<div className="node-editor--body-title">
|
||||
{allowedTypes.length > 1 ? <InputList
|
||||
@@ -58,7 +63,10 @@ export const NodeEditor: FC<NodeEditorProps> = ({
|
||||
options={state.subTypes}
|
||||
onChange={state.setSubType}
|
||||
/> : <></>}
|
||||
<InputBoolean label="Yaml" onChange={state.setYamlMode} value={state.yamlMode} disabled={state.isErrored} />
|
||||
<div className="node-editor--body-flags">
|
||||
<InputBoolean label="Yaml" onChange={state.setYamlMode} value={state.yamlMode} disabled={state.isErrored} />
|
||||
<InputBoolean className="enabled-flag" label='Enabled' value={state.data.enabled ?? true} onChange={state.setEnabled} />
|
||||
</div>
|
||||
</div>
|
||||
{state.renderOptionList()}
|
||||
</div>
|
||||
|
||||
Reference in new issue
Block a user