|
@@ -12,7 +12,7 @@ import {
|
|
|
ScrollIndicator,
|
|
ScrollIndicator,
|
|
|
Slider,
|
|
Slider,
|
|
|
SplitButton,
|
|
SplitButton,
|
|
|
- Transfer
|
|
|
|
|
|
|
+ Transfer,
|
|
|
} from "tiny-ui";
|
|
} from "tiny-ui";
|
|
|
import WLED from "./WLED.js";
|
|
import WLED from "./WLED.js";
|
|
|
|
|
|
|
@@ -180,7 +180,7 @@ const InstanceManagement = ({
|
|
|
presets,
|
|
presets,
|
|
|
onCopy,
|
|
onCopy,
|
|
|
onPreset,
|
|
onPreset,
|
|
|
- onDelete
|
|
|
|
|
|
|
+ onDelete,
|
|
|
}) => {
|
|
}) => {
|
|
|
if (!presets) return null;
|
|
if (!presets) return null;
|
|
|
return Object.keys(presets)?.map((o, i) => (
|
|
return Object.keys(presets)?.map((o, i) => (
|
|
@@ -231,88 +231,84 @@ const InstanceManagement = ({
|
|
|
));
|
|
));
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
-const StateMangement = ({ client, onPower, onSync, onBrightness, current }) => {
|
|
|
|
|
|
|
+const StateMangement = ({
|
|
|
|
|
+ client,
|
|
|
|
|
+ setPurge,
|
|
|
|
|
+ setUpload,
|
|
|
|
|
+ setCopy,
|
|
|
|
|
+ onPower,
|
|
|
|
|
+ onSync,
|
|
|
|
|
+ onBrightness,
|
|
|
|
|
+ onPreset,
|
|
|
|
|
+ current,
|
|
|
|
|
+ ...props
|
|
|
|
|
+}) => {
|
|
|
if (!current) return null;
|
|
if (!current) return null;
|
|
|
return (
|
|
return (
|
|
|
<Row>
|
|
<Row>
|
|
|
- <Col>
|
|
|
|
|
|
|
+ <Col span={12}>
|
|
|
|
|
+ <Button
|
|
|
|
|
+ btnType={current?.on ? "primary" : "outline"}
|
|
|
|
|
+ icon={<Icon name="switch" />}
|
|
|
|
|
+ round
|
|
|
|
|
+ onClick={() =>
|
|
|
|
|
+ onPower({ clients: [client], value: current?.on ? "off" : "on" })
|
|
|
|
|
+ }
|
|
|
|
|
+ >
|
|
|
|
|
+ Lights {current?.on ? "on" : "off"}
|
|
|
|
|
+ </Button>
|
|
|
|
|
+ <PopConfirm
|
|
|
|
|
+ title="Are you sure you want to make enable sync?"
|
|
|
|
|
+ onConfirm={() => onSync({ clients: [client], value: "enable" })}
|
|
|
|
|
+ >
|
|
|
|
|
+ <Button btnType="outline" round disabled={current?.udpSync?.send}>
|
|
|
|
|
+ Enable sync
|
|
|
|
|
+ </Button>
|
|
|
|
|
+ </PopConfirm>
|
|
|
|
|
+ <PopConfirm
|
|
|
|
|
+ title="Are you sure you want to disable sync?"
|
|
|
|
|
+ onConfirm={() => onSync({ clients: [client], value: "disable" })}
|
|
|
|
|
+ >
|
|
|
|
|
+ <Button btnType="outline" round disabled={!current?.udpSync?.send}>
|
|
|
|
|
+ Disable sync
|
|
|
|
|
+ </Button>
|
|
|
|
|
+ </PopConfirm>
|
|
|
|
|
+ <PopConfirm
|
|
|
|
|
+ title="Are you sure you want to reboot?"
|
|
|
|
|
+ onConfirm={() => onPower({ clients: [client], value: "reboot" })}
|
|
|
|
|
+ >
|
|
|
|
|
+ <Button icon={<Icon name="loader" />} btnType="danger" round>
|
|
|
|
|
+ Reboot
|
|
|
|
|
+ </Button>
|
|
|
|
|
+ </PopConfirm>
|
|
|
|
|
+ </Col>
|
|
|
|
|
+ <Col span={12} style={{ textAlign: "right" }}>
|
|
|
<Button.Group round>
|
|
<Button.Group round>
|
|
|
<Button
|
|
<Button
|
|
|
- btnType="bordered"
|
|
|
|
|
- icon={<Icon name="switch" />}
|
|
|
|
|
|
|
+ btnType="secondary"
|
|
|
|
|
+ icon={<Icon name="arrow-left" />}
|
|
|
|
|
+ title="Previous preset"
|
|
|
round
|
|
round
|
|
|
- onClick={() =>
|
|
|
|
|
- onPower({ clients: [client], value: current?.on ? "off" : "on" })
|
|
|
|
|
- }
|
|
|
|
|
- >
|
|
|
|
|
- {current?.on ? "Lights off" : "Lights on"}
|
|
|
|
|
- </Button>
|
|
|
|
|
- <PopConfirm
|
|
|
|
|
- title="Are you sure you want to reboot?"
|
|
|
|
|
- onConfirm={() => onPower({ clients: [client], value: "reboot" })}
|
|
|
|
|
- >
|
|
|
|
|
- <Button icon={<Icon name="loader" />} btnType="bordered" round>
|
|
|
|
|
- Reboot
|
|
|
|
|
- </Button>
|
|
|
|
|
- </PopConfirm>
|
|
|
|
|
- </Button.Group>
|
|
|
|
|
- <Button.Group round>
|
|
|
|
|
- <PopConfirm
|
|
|
|
|
- title="Are you sure you want to make enable sync?"
|
|
|
|
|
- onConfirm={() => onSync({ clients: [client], value: "enable" })}
|
|
|
|
|
- >
|
|
|
|
|
- <Button btnType="bordered" round disabled={current?.udpSync?.send}>
|
|
|
|
|
- Enable sync
|
|
|
|
|
- </Button>
|
|
|
|
|
- </PopConfirm>
|
|
|
|
|
- <PopConfirm
|
|
|
|
|
- title="Are you sure you want to disable sync?"
|
|
|
|
|
- onConfirm={() => onSync({ clients: [client], value: "disable" })}
|
|
|
|
|
- >
|
|
|
|
|
- <Button btnType="bordered" round disabled={!current?.udpSync?.send}>
|
|
|
|
|
- Disable sync
|
|
|
|
|
- </Button>
|
|
|
|
|
- </PopConfirm>
|
|
|
|
|
|
|
+ onClick={() => {
|
|
|
|
|
+ onPreset({ clients: [client], value: 249 });
|
|
|
|
|
+ }}
|
|
|
|
|
+ />
|
|
|
|
|
+ <Button
|
|
|
|
|
+ btnType="secondary"
|
|
|
|
|
+ icon={<Icon name="arrow-right" />}
|
|
|
|
|
+ title="Next preset"
|
|
|
|
|
+ round
|
|
|
|
|
+ onClick={() => {
|
|
|
|
|
+ onPreset({ clients: [client], value: 250 });
|
|
|
|
|
+ }}
|
|
|
|
|
+ />
|
|
|
</Button.Group>
|
|
</Button.Group>
|
|
|
- </Col>
|
|
|
|
|
- <Col>
|
|
|
|
|
- <Slider
|
|
|
|
|
- defaultValue={from255(current?.brightness)}
|
|
|
|
|
- onChange={(v) => {
|
|
|
|
|
- onBrightness({ clients: [client], value: to255(v) });
|
|
|
|
|
- }}
|
|
|
|
|
- />
|
|
|
|
|
- </Col>
|
|
|
|
|
- </Row>
|
|
|
|
|
- );
|
|
|
|
|
-};
|
|
|
|
|
|
|
|
|
|
-const Management = ({
|
|
|
|
|
- key,
|
|
|
|
|
- itemKey,
|
|
|
|
|
- clientName,
|
|
|
|
|
- onCopy,
|
|
|
|
|
- onDelete,
|
|
|
|
|
- onSync,
|
|
|
|
|
- ...props
|
|
|
|
|
-}) => {
|
|
|
|
|
- const [copy, setCopy] = useState(null);
|
|
|
|
|
- const [purge, setPurge] = useState(null);
|
|
|
|
|
- const [upload, setUpload] = useState(null);
|
|
|
|
|
- return (
|
|
|
|
|
- <Panel
|
|
|
|
|
- key={key}
|
|
|
|
|
- itemKey={itemKey}
|
|
|
|
|
- header={
|
|
|
|
|
- <>
|
|
|
|
|
- {clientName} ({props?.client})
|
|
|
|
|
- </>
|
|
|
|
|
- }
|
|
|
|
|
- extra={
|
|
|
|
|
<SplitButton
|
|
<SplitButton
|
|
|
onClick={(e) => {
|
|
onClick={(e) => {
|
|
|
e.preventDefault();
|
|
e.preventDefault();
|
|
|
e.stopPropagation();
|
|
e.stopPropagation();
|
|
|
|
|
+ window.open(`http://${client}`);
|
|
|
}}
|
|
}}
|
|
|
overlay={
|
|
overlay={
|
|
|
<StyledMenu>
|
|
<StyledMenu>
|
|
@@ -320,7 +316,7 @@ const Management = ({
|
|
|
onClick={(e) => {
|
|
onClick={(e) => {
|
|
|
e.preventDefault();
|
|
e.preventDefault();
|
|
|
e.stopPropagation();
|
|
e.stopPropagation();
|
|
|
- window.open(`http://${props?.client}`);
|
|
|
|
|
|
|
+ window.open(`http://${client}`);
|
|
|
}}
|
|
}}
|
|
|
>
|
|
>
|
|
|
<Icon name="eye" />
|
|
<Icon name="eye" />
|
|
@@ -366,7 +362,7 @@ const Management = ({
|
|
|
e.stopPropagation();
|
|
e.stopPropagation();
|
|
|
setPurge({
|
|
setPurge({
|
|
|
clients: [props?.client],
|
|
clients: [props?.client],
|
|
|
- value: Object.keys(props?.presets)
|
|
|
|
|
|
|
+ value: Object.keys(props?.presets),
|
|
|
});
|
|
});
|
|
|
}}
|
|
}}
|
|
|
>
|
|
>
|
|
@@ -375,12 +371,52 @@ const Management = ({
|
|
|
</Menu.Item>
|
|
</Menu.Item>
|
|
|
</StyledMenu>
|
|
</StyledMenu>
|
|
|
}
|
|
}
|
|
|
|
|
+ round
|
|
|
>
|
|
>
|
|
|
<Icon name="setting" />
|
|
<Icon name="setting" />
|
|
|
</SplitButton>
|
|
</SplitButton>
|
|
|
|
|
+ </Col>
|
|
|
|
|
+ <Col>
|
|
|
|
|
+ <Slider
|
|
|
|
|
+ defaultValue={from255(current?.brightness)}
|
|
|
|
|
+ onChange={(v) => {
|
|
|
|
|
+ onBrightness({ clients: [client], value: to255(v) });
|
|
|
|
|
+ }}
|
|
|
|
|
+ />
|
|
|
|
|
+ </Col>
|
|
|
|
|
+ </Row>
|
|
|
|
|
+ );
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
|
|
+const Management = ({
|
|
|
|
|
+ key,
|
|
|
|
|
+ itemKey,
|
|
|
|
|
+ clientName,
|
|
|
|
|
+ onCopy,
|
|
|
|
|
+ onDelete,
|
|
|
|
|
+ onSync,
|
|
|
|
|
+ ...props
|
|
|
|
|
+}) => {
|
|
|
|
|
+ const [copy, setCopy] = useState(null);
|
|
|
|
|
+ const [purge, setPurge] = useState(null);
|
|
|
|
|
+ const [upload, setUpload] = useState(null);
|
|
|
|
|
+ return (
|
|
|
|
|
+ <Panel
|
|
|
|
|
+ key={key}
|
|
|
|
|
+ itemKey={itemKey}
|
|
|
|
|
+ header={
|
|
|
|
|
+ <>
|
|
|
|
|
+ {clientName} ({props?.client})
|
|
|
|
|
+ </>
|
|
|
}
|
|
}
|
|
|
>
|
|
>
|
|
|
- <StateMangement onSync={onSync} {...props} />
|
|
|
|
|
|
|
+ <StateMangement
|
|
|
|
|
+ setPurge={setPurge}
|
|
|
|
|
+ setCopy={setCopy}
|
|
|
|
|
+ setUpload={setUpload}
|
|
|
|
|
+ onSync={onSync}
|
|
|
|
|
+ {...props}
|
|
|
|
|
+ />
|
|
|
<InstanceManagement
|
|
<InstanceManagement
|
|
|
{...props}
|
|
{...props}
|
|
|
onDelete={(e) => {
|
|
onDelete={(e) => {
|