Merge branch 'realTimeVisulization' into simulation
This commit is contained in:
commit
fa6404d86c
|
@ -21,14 +21,17 @@ const BarChartInput = (props: Props) => {
|
||||||
const iotApiUrl = process.env.REACT_APP_IOT_SOCKET_SERVER_URL;
|
const iotApiUrl = process.env.REACT_APP_IOT_SOCKET_SERVER_URL;
|
||||||
const email = localStorage.getItem("email") || "";
|
const email = localStorage.getItem("email") || "";
|
||||||
const organization = email?.split("@")[1]?.split(".")[0]
|
const organization = email?.split("@")[1]?.split(".")[0]
|
||||||
|
const [isLoading, setLoading] = useState<boolean>(true);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const fetchZoneData = async () => {
|
const fetchZoneData = async () => {
|
||||||
try {
|
try {
|
||||||
|
setLoading(true)
|
||||||
const response = await axios.get(`http://${iotApiUrl}/floatinput`);
|
const response = await axios.get(`http://${iotApiUrl}/floatinput`);
|
||||||
if (response.status === 200) {
|
if (response.status === 200) {
|
||||||
// console.log("dropdown data:", response.data);
|
// console.log("dropdown data:", response.data);
|
||||||
setDropDownData(response.data);
|
setDropDownData(response.data);
|
||||||
|
setLoading(false);
|
||||||
} else {
|
} else {
|
||||||
console.log("Unexpected response:", response);
|
console.log("Unexpected response:", response);
|
||||||
}
|
}
|
||||||
|
@ -148,6 +151,7 @@ const BarChartInput = (props: Props) => {
|
||||||
onSelect={(selectedData) => handleSelect(inputKey, selectedData)}
|
onSelect={(selectedData) => handleSelect(inputKey, selectedData)}
|
||||||
onUnselect={() => handleSelect(inputKey, null)}
|
onUnselect={() => handleSelect(inputKey, null)}
|
||||||
selectedValue={selections[inputKey]} // Load from Zustand
|
selectedValue={selections[inputKey]} // Load from Zustand
|
||||||
|
isLoading={isLoading}
|
||||||
/>
|
/>
|
||||||
<div className="icon">
|
<div className="icon">
|
||||||
<AddIcon />
|
<AddIcon />
|
||||||
|
|
|
@ -21,14 +21,17 @@ const FleetEfficiencyInputComponent = (props: Props) => {
|
||||||
const iotApiUrl = process.env.REACT_APP_IOT_SOCKET_SERVER_URL;
|
const iotApiUrl = process.env.REACT_APP_IOT_SOCKET_SERVER_URL;
|
||||||
const email = localStorage.getItem("email") || "";
|
const email = localStorage.getItem("email") || "";
|
||||||
const organization = email?.split("@")[1]?.split(".")[0]
|
const organization = email?.split("@")[1]?.split(".")[0]
|
||||||
|
const [isLoading, setLoading] = useState<boolean>(true);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const fetchZoneData = async () => {
|
const fetchZoneData = async () => {
|
||||||
try {
|
try {
|
||||||
const response = await axios.get(`http://${iotApiUrl}/floatinput`);
|
const response = await axios.get(`http://${iotApiUrl}/floatinput`);
|
||||||
|
setLoading(true)
|
||||||
if (response.status === 200) {
|
if (response.status === 200) {
|
||||||
// console.log("dropdown data:", response.data);
|
// console.log("dropdown data:", response.data);
|
||||||
setDropDownData(response.data);
|
setDropDownData(response.data);
|
||||||
|
setLoading(false)
|
||||||
} else {
|
} else {
|
||||||
console.log("Unexpected response:", response);
|
console.log("Unexpected response:", response);
|
||||||
}
|
}
|
||||||
|
@ -149,6 +152,7 @@ const FleetEfficiencyInputComponent = (props: Props) => {
|
||||||
onSelect={(selectedData) => handleSelect(inputKey, selectedData)}
|
onSelect={(selectedData) => handleSelect(inputKey, selectedData)}
|
||||||
onUnselect={() => handleSelect(inputKey, null)}
|
onUnselect={() => handleSelect(inputKey, null)}
|
||||||
selectedValue={selections[inputKey]} // Load from Zustand
|
selectedValue={selections[inputKey]} // Load from Zustand
|
||||||
|
isLoading={isLoading}
|
||||||
/>
|
/>
|
||||||
<div className="icon">
|
<div className="icon">
|
||||||
<AddIcon />
|
<AddIcon />
|
||||||
|
|
|
@ -21,14 +21,17 @@ const FlotingWidgetInput = (props: Props) => {
|
||||||
const iotApiUrl = process.env.REACT_APP_IOT_SOCKET_SERVER_URL;
|
const iotApiUrl = process.env.REACT_APP_IOT_SOCKET_SERVER_URL;
|
||||||
const email = localStorage.getItem("email") || "";
|
const email = localStorage.getItem("email") || "";
|
||||||
const organization = email?.split("@")[1]?.split(".")[0]
|
const organization = email?.split("@")[1]?.split(".")[0]
|
||||||
|
const [isLoading, setLoading] = useState<boolean>(true);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const fetchZoneData = async () => {
|
const fetchZoneData = async () => {
|
||||||
try {
|
try {
|
||||||
|
setLoading(true)
|
||||||
const response = await axios.get(`http://${iotApiUrl}/floatinput`);
|
const response = await axios.get(`http://${iotApiUrl}/floatinput`);
|
||||||
if (response.status === 200) {
|
if (response.status === 200) {
|
||||||
// console.log("dropdown data:", response.data);
|
// console.log("dropdown data:", response.data);
|
||||||
setDropDownData(response.data);
|
setDropDownData(response.data);
|
||||||
|
setLoading(false);
|
||||||
} else {
|
} else {
|
||||||
console.log("Unexpected response:", response);
|
console.log("Unexpected response:", response);
|
||||||
}
|
}
|
||||||
|
@ -149,6 +152,7 @@ const FlotingWidgetInput = (props: Props) => {
|
||||||
onSelect={(selectedData) => handleSelect(inputKey, selectedData)}
|
onSelect={(selectedData) => handleSelect(inputKey, selectedData)}
|
||||||
onUnselect={() => handleSelect(inputKey, null)}
|
onUnselect={() => handleSelect(inputKey, null)}
|
||||||
selectedValue={selections[inputKey]} // Load from Zustand
|
selectedValue={selections[inputKey]} // Load from Zustand
|
||||||
|
isLoading={isLoading}
|
||||||
/>
|
/>
|
||||||
<div className="icon">
|
<div className="icon">
|
||||||
<AddIcon />
|
<AddIcon />
|
||||||
|
|
|
@ -140,14 +140,17 @@ const LineGrapInput = (props: Props) => {
|
||||||
const iotApiUrl = process.env.REACT_APP_IOT_SOCKET_SERVER_URL;
|
const iotApiUrl = process.env.REACT_APP_IOT_SOCKET_SERVER_URL;
|
||||||
const email = localStorage.getItem("email") || "";
|
const email = localStorage.getItem("email") || "";
|
||||||
const organization = email?.split("@")[1]?.split(".")[0]
|
const organization = email?.split("@")[1]?.split(".")[0]
|
||||||
|
const [isLoading, setLoading] = useState<boolean>(true);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const fetchZoneData = async () => {
|
const fetchZoneData = async () => {
|
||||||
try {
|
try {
|
||||||
|
setLoading(true)
|
||||||
const response = await axios.get(`http://${iotApiUrl}/floatinput`);
|
const response = await axios.get(`http://${iotApiUrl}/floatinput`);
|
||||||
if (response.status === 200) {
|
if (response.status === 200) {
|
||||||
// console.log("dropdown data:", response.data);
|
// console.log("dropdown data:", response.data);
|
||||||
setDropDownData(response.data);
|
setDropDownData(response.data);
|
||||||
|
setLoading(false)
|
||||||
} else {
|
} else {
|
||||||
console.log("Unexpected response:", response);
|
console.log("Unexpected response:", response);
|
||||||
}
|
}
|
||||||
|
@ -267,6 +270,7 @@ const LineGrapInput = (props: Props) => {
|
||||||
onSelect={(selectedData) => handleSelect(inputKey, selectedData)}
|
onSelect={(selectedData) => handleSelect(inputKey, selectedData)}
|
||||||
onUnselect={() => handleSelect(inputKey, null)}
|
onUnselect={() => handleSelect(inputKey, null)}
|
||||||
selectedValue={selections[inputKey]} // Load from Zustand
|
selectedValue={selections[inputKey]} // Load from Zustand
|
||||||
|
isLoading={isLoading}
|
||||||
/>
|
/>
|
||||||
<div className="icon">
|
<div className="icon">
|
||||||
<AddIcon />
|
<AddIcon />
|
||||||
|
|
|
@ -21,14 +21,17 @@ const PieChartInput = (props: Props) => {
|
||||||
const iotApiUrl = process.env.REACT_APP_IOT_SOCKET_SERVER_URL;
|
const iotApiUrl = process.env.REACT_APP_IOT_SOCKET_SERVER_URL;
|
||||||
const email = localStorage.getItem("email") || "";
|
const email = localStorage.getItem("email") || "";
|
||||||
const organization = email?.split("@")[1]?.split(".")[0]
|
const organization = email?.split("@")[1]?.split(".")[0]
|
||||||
|
const [isLoading, setLoading] = useState<boolean>(true);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const fetchZoneData = async () => {
|
const fetchZoneData = async () => {
|
||||||
try {
|
try {
|
||||||
|
setLoading(true)
|
||||||
const response = await axios.get(`http://${iotApiUrl}/floatinput`);
|
const response = await axios.get(`http://${iotApiUrl}/floatinput`);
|
||||||
if (response.status === 200) {
|
if (response.status === 200) {
|
||||||
// console.log("dropdown data:", response.data);
|
// console.log("dropdown data:", response.data);
|
||||||
setDropDownData(response.data);
|
setDropDownData(response.data);
|
||||||
|
setLoading(false)
|
||||||
} else {
|
} else {
|
||||||
console.log("Unexpected response:", response);
|
console.log("Unexpected response:", response);
|
||||||
}
|
}
|
||||||
|
@ -148,6 +151,7 @@ const PieChartInput = (props: Props) => {
|
||||||
onSelect={(selectedData) => handleSelect(inputKey, selectedData)}
|
onSelect={(selectedData) => handleSelect(inputKey, selectedData)}
|
||||||
onUnselect={() => handleSelect(inputKey, null)}
|
onUnselect={() => handleSelect(inputKey, null)}
|
||||||
selectedValue={selections[inputKey]} // Load from Zustand
|
selectedValue={selections[inputKey]} // Load from Zustand
|
||||||
|
isLoading={isLoading}
|
||||||
/>
|
/>
|
||||||
<div className="icon">
|
<div className="icon">
|
||||||
<AddIcon />
|
<AddIcon />
|
||||||
|
|
|
@ -21,14 +21,17 @@ const Progress1Input = (props: Props) => {
|
||||||
const iotApiUrl = process.env.REACT_APP_IOT_SOCKET_SERVER_URL;
|
const iotApiUrl = process.env.REACT_APP_IOT_SOCKET_SERVER_URL;
|
||||||
const email = localStorage.getItem("email") || "";
|
const email = localStorage.getItem("email") || "";
|
||||||
const organization = email?.split("@")[1]?.split(".")[0]
|
const organization = email?.split("@")[1]?.split(".")[0]
|
||||||
|
const [isLoading, setLoading] = useState<boolean>(true);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const fetchZoneData = async () => {
|
const fetchZoneData = async () => {
|
||||||
try {
|
try {
|
||||||
|
setLoading(true)
|
||||||
const response = await axios.get(`http://${iotApiUrl}/floatinput`);
|
const response = await axios.get(`http://${iotApiUrl}/floatinput`);
|
||||||
if (response.status === 200) {
|
if (response.status === 200) {
|
||||||
// console.log("dropdown data:", response.data);
|
// console.log("dropdown data:", response.data);
|
||||||
setDropDownData(response.data);
|
setDropDownData(response.data);
|
||||||
|
setLoading(false)
|
||||||
} else {
|
} else {
|
||||||
console.log("Unexpected response:", response);
|
console.log("Unexpected response:", response);
|
||||||
}
|
}
|
||||||
|
@ -142,6 +145,7 @@ const Progress1Input = (props: Props) => {
|
||||||
onSelect={(selectedData) => handleSelect(inputKey, selectedData)}
|
onSelect={(selectedData) => handleSelect(inputKey, selectedData)}
|
||||||
onUnselect={() => handleSelect(inputKey, null)}
|
onUnselect={() => handleSelect(inputKey, null)}
|
||||||
selectedValue={selections[inputKey]} // Load from Zustand
|
selectedValue={selections[inputKey]} // Load from Zustand
|
||||||
|
isLoading={isLoading}
|
||||||
/>
|
/>
|
||||||
<div className="icon">
|
<div className="icon">
|
||||||
<AddIcon />
|
<AddIcon />
|
||||||
|
|
|
@ -21,14 +21,17 @@ const Progress2Input = (props: Props) => {
|
||||||
const iotApiUrl = process.env.REACT_APP_IOT_SOCKET_SERVER_URL;
|
const iotApiUrl = process.env.REACT_APP_IOT_SOCKET_SERVER_URL;
|
||||||
const email = localStorage.getItem("email") || "";
|
const email = localStorage.getItem("email") || "";
|
||||||
const organization = email?.split("@")[1]?.split(".")[0]
|
const organization = email?.split("@")[1]?.split(".")[0]
|
||||||
|
const [isLoading, setLoading] = useState<boolean>(true);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const fetchZoneData = async () => {
|
const fetchZoneData = async () => {
|
||||||
try {
|
try {
|
||||||
|
setLoading(true)
|
||||||
const response = await axios.get(`http://${iotApiUrl}/floatinput`);
|
const response = await axios.get(`http://${iotApiUrl}/floatinput`);
|
||||||
if (response.status === 200) {
|
if (response.status === 200) {
|
||||||
// console.log("dropdown data:", response.data);
|
// console.log("dropdown data:", response.data);
|
||||||
setDropDownData(response.data);
|
setDropDownData(response.data);
|
||||||
|
setLoading(false)
|
||||||
} else {
|
} else {
|
||||||
console.log("Unexpected response:", response);
|
console.log("Unexpected response:", response);
|
||||||
}
|
}
|
||||||
|
@ -142,6 +145,7 @@ const Progress2Input = (props: Props) => {
|
||||||
onSelect={(selectedData) => handleSelect(inputKey, selectedData)}
|
onSelect={(selectedData) => handleSelect(inputKey, selectedData)}
|
||||||
onUnselect={() => handleSelect(inputKey, null)}
|
onUnselect={() => handleSelect(inputKey, null)}
|
||||||
selectedValue={selections[inputKey]} // Load from Zustand
|
selectedValue={selections[inputKey]} // Load from Zustand
|
||||||
|
isLoading={isLoading}
|
||||||
/>
|
/>
|
||||||
<div className="icon">
|
<div className="icon">
|
||||||
<AddIcon />
|
<AddIcon />
|
||||||
|
|
|
@ -21,14 +21,17 @@ const WarehouseThroughputInputComponent = (props: Props) => {
|
||||||
const iotApiUrl = process.env.REACT_APP_IOT_SOCKET_SERVER_URL;
|
const iotApiUrl = process.env.REACT_APP_IOT_SOCKET_SERVER_URL;
|
||||||
const email = localStorage.getItem("email") || "";
|
const email = localStorage.getItem("email") || "";
|
||||||
const organization = email?.split("@")[1]?.split(".")[0]
|
const organization = email?.split("@")[1]?.split(".")[0]
|
||||||
|
const [isLoading, setLoading] = useState<boolean>(true);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const fetchZoneData = async () => {
|
const fetchZoneData = async () => {
|
||||||
try {
|
try {
|
||||||
|
setLoading(true)
|
||||||
const response = await axios.get(`http://${iotApiUrl}/floatinput`);
|
const response = await axios.get(`http://${iotApiUrl}/floatinput`);
|
||||||
if (response.status === 200) {
|
if (response.status === 200) {
|
||||||
// console.log("dropdown data:", response.data);
|
// console.log("dropdown data:", response.data);
|
||||||
setDropDownData(response.data);
|
setDropDownData(response.data);
|
||||||
|
setLoading(false)
|
||||||
} else {
|
} else {
|
||||||
console.log("Unexpected response:", response);
|
console.log("Unexpected response:", response);
|
||||||
}
|
}
|
||||||
|
@ -149,6 +152,7 @@ const WarehouseThroughputInputComponent = (props: Props) => {
|
||||||
onSelect={(selectedData) => handleSelect(inputKey, selectedData)}
|
onSelect={(selectedData) => handleSelect(inputKey, selectedData)}
|
||||||
onUnselect={() => handleSelect(inputKey, null)}
|
onUnselect={() => handleSelect(inputKey, null)}
|
||||||
selectedValue={selections[inputKey]} // Load from Zustand
|
selectedValue={selections[inputKey]} // Load from Zustand
|
||||||
|
isLoading={isLoading}
|
||||||
/>
|
/>
|
||||||
<div className="icon">
|
<div className="icon">
|
||||||
<AddIcon />
|
<AddIcon />
|
||||||
|
|
|
@ -21,14 +21,17 @@ const Widget2InputCard3D = (props: Props) => {
|
||||||
const iotApiUrl = process.env.REACT_APP_IOT_SOCKET_SERVER_URL;
|
const iotApiUrl = process.env.REACT_APP_IOT_SOCKET_SERVER_URL;
|
||||||
const email = localStorage.getItem("email") || "";
|
const email = localStorage.getItem("email") || "";
|
||||||
const organization = email?.split("@")[1]?.split(".")[0]
|
const organization = email?.split("@")[1]?.split(".")[0]
|
||||||
|
const [isLoading, setLoading] = useState<boolean>(true);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const fetchZoneData = async () => {
|
const fetchZoneData = async () => {
|
||||||
try {
|
try {
|
||||||
|
setLoading(true)
|
||||||
const response = await axios.get(`http://${iotApiUrl}/floatinput`);
|
const response = await axios.get(`http://${iotApiUrl}/floatinput`);
|
||||||
if (response.status === 200) {
|
if (response.status === 200) {
|
||||||
// console.log("dropdown data:", response.data);
|
// console.log("dropdown data:", response.data);
|
||||||
setDropDownData(response.data);
|
setDropDownData(response.data);
|
||||||
|
setLoading(false)
|
||||||
} else {
|
} else {
|
||||||
console.log("Unexpected response:", response);
|
console.log("Unexpected response:", response);
|
||||||
}
|
}
|
||||||
|
@ -147,6 +150,7 @@ const Widget2InputCard3D = (props: Props) => {
|
||||||
onSelect={(selectedData) => handleSelect(inputKey, selectedData)}
|
onSelect={(selectedData) => handleSelect(inputKey, selectedData)}
|
||||||
onUnselect={() => handleSelect(inputKey, null)}
|
onUnselect={() => handleSelect(inputKey, null)}
|
||||||
selectedValue={selections[inputKey]} // Load from Zustand
|
selectedValue={selections[inputKey]} // Load from Zustand
|
||||||
|
isLoading={isLoading}
|
||||||
/>
|
/>
|
||||||
<div className="icon">
|
<div className="icon">
|
||||||
<AddIcon />
|
<AddIcon />
|
||||||
|
|
|
@ -19,14 +19,17 @@ const Widget3InputCard3D = () => {
|
||||||
const iotApiUrl = process.env.REACT_APP_IOT_SOCKET_SERVER_URL;
|
const iotApiUrl = process.env.REACT_APP_IOT_SOCKET_SERVER_URL;
|
||||||
const email = localStorage.getItem("email") || "";
|
const email = localStorage.getItem("email") || "";
|
||||||
const organization = email?.split("@")[1]?.split(".")[0]
|
const organization = email?.split("@")[1]?.split(".")[0]
|
||||||
|
const [isLoading, setLoading] = useState<boolean>(true);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const fetchZoneData = async () => {
|
const fetchZoneData = async () => {
|
||||||
try {
|
try {
|
||||||
|
setLoading(true)
|
||||||
const response = await axios.get(`http://${iotApiUrl}/getinput`);
|
const response = await axios.get(`http://${iotApiUrl}/getinput`);
|
||||||
if (response.status === 200) {
|
if (response.status === 200) {
|
||||||
// console.log("dropdown data:", response.data);
|
// console.log("dropdown data:", response.data);
|
||||||
setDropDownData(response.data);
|
setDropDownData(response.data);
|
||||||
|
setLoading(false)
|
||||||
} else {
|
} else {
|
||||||
console.log("Unexpected response:", response);
|
console.log("Unexpected response:", response);
|
||||||
}
|
}
|
||||||
|
@ -140,6 +143,7 @@ const Widget3InputCard3D = () => {
|
||||||
onSelect={(selectedData) => handleSelect(inputKey, selectedData)}
|
onSelect={(selectedData) => handleSelect(inputKey, selectedData)}
|
||||||
onUnselect={() => handleSelect(inputKey, null)}
|
onUnselect={() => handleSelect(inputKey, null)}
|
||||||
selectedValue={selections[inputKey]} // Load from Zustand
|
selectedValue={selections[inputKey]} // Load from Zustand
|
||||||
|
isLoading={isLoading}
|
||||||
/>
|
/>
|
||||||
<div className="icon">
|
<div className="icon">
|
||||||
<AddIcon />
|
<AddIcon />
|
||||||
|
|
|
@ -21,14 +21,17 @@ const Widget4InputCard3D = (props: Props) => {
|
||||||
const iotApiUrl = process.env.REACT_APP_IOT_SOCKET_SERVER_URL;
|
const iotApiUrl = process.env.REACT_APP_IOT_SOCKET_SERVER_URL;
|
||||||
const email = localStorage.getItem("email") || "";
|
const email = localStorage.getItem("email") || "";
|
||||||
const organization = email?.split("@")[1]?.split(".")[0]
|
const organization = email?.split("@")[1]?.split(".")[0]
|
||||||
|
const [isLoading, setLoading] = useState<boolean>(true);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const fetchZoneData = async () => {
|
const fetchZoneData = async () => {
|
||||||
try {
|
try {
|
||||||
|
setLoading(true)
|
||||||
const response = await axios.get(`http://${iotApiUrl}/floatinput`);
|
const response = await axios.get(`http://${iotApiUrl}/floatinput`);
|
||||||
if (response.status === 200) {
|
if (response.status === 200) {
|
||||||
// console.log("dropdown data:", response.data);
|
// console.log("dropdown data:", response.data);
|
||||||
setDropDownData(response.data);
|
setDropDownData(response.data);
|
||||||
|
setLoading(false)
|
||||||
} else {
|
} else {
|
||||||
console.log("Unexpected response:", response);
|
console.log("Unexpected response:", response);
|
||||||
}
|
}
|
||||||
|
@ -147,6 +150,7 @@ const Widget4InputCard3D = (props: Props) => {
|
||||||
onSelect={(selectedData) => handleSelect(inputKey, selectedData)}
|
onSelect={(selectedData) => handleSelect(inputKey, selectedData)}
|
||||||
onUnselect={() => handleSelect(inputKey, null)}
|
onUnselect={() => handleSelect(inputKey, null)}
|
||||||
selectedValue={selections[inputKey]} // Load from Zustand
|
selectedValue={selections[inputKey]} // Load from Zustand
|
||||||
|
isLoading={isLoading}
|
||||||
/>
|
/>
|
||||||
<div className="icon">
|
<div className="icon">
|
||||||
<AddIcon />
|
<AddIcon />
|
||||||
|
|
|
@ -203,6 +203,7 @@ interface MultiLevelDropdownProps {
|
||||||
onSelect: (selectedData: { name: string; fields: string }) => void;
|
onSelect: (selectedData: { name: string; fields: string }) => void;
|
||||||
onUnselect: () => void;
|
onUnselect: () => void;
|
||||||
selectedValue?: { name: string; fields: string };
|
selectedValue?: { name: string; fields: string };
|
||||||
|
isLoading?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Main Multi-Level Dropdown Component
|
// Main Multi-Level Dropdown Component
|
||||||
|
@ -211,6 +212,7 @@ const MultiLevelDropdown = ({
|
||||||
onSelect,
|
onSelect,
|
||||||
onUnselect,
|
onUnselect,
|
||||||
selectedValue,
|
selectedValue,
|
||||||
|
isLoading = false,
|
||||||
}: MultiLevelDropdownProps) => {
|
}: MultiLevelDropdownProps) => {
|
||||||
const [open, setOpen] = useState(false);
|
const [open, setOpen] = useState(false);
|
||||||
const dropdownRef = useRef<HTMLDivElement>(null);
|
const dropdownRef = useRef<HTMLDivElement>(null);
|
||||||
|
@ -261,19 +263,22 @@ const MultiLevelDropdown = ({
|
||||||
<div className="dropdown-content ">
|
<div className="dropdown-content ">
|
||||||
|
|
||||||
{/* loading list */}
|
{/* loading list */}
|
||||||
{/* <div className="loading" /> */}
|
|
||||||
|
|
||||||
{/* Unselect Option */}
|
{/* Unselect Option */}
|
||||||
<DropdownItem label="Unselect" onClick={handleItemUnselect} />
|
<DropdownItem label="Unselect" onClick={handleItemUnselect} />
|
||||||
{/* Nested Dropdown Items */}
|
{/* Nested Dropdown Items */}
|
||||||
{Object.entries(data).map(([key, value]) => (
|
{
|
||||||
<NestedDropdown
|
isLoading ? <div className="loading" /> :
|
||||||
key={key}
|
Object.entries(data).map(([key, value]) => (
|
||||||
label={key}
|
<NestedDropdown
|
||||||
fields={Object.keys(value)}
|
key={key}
|
||||||
onSelect={handleItemSelect}
|
label={key}
|
||||||
/>
|
fields={Object.keys(value)}
|
||||||
))}
|
onSelect={handleItemSelect}
|
||||||
|
/>
|
||||||
|
))
|
||||||
|
}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
|
@ -100,6 +100,8 @@ export const DraggableWidget = ({
|
||||||
|
|
||||||
const deleteSelectedChart = async () => {
|
const deleteSelectedChart = async () => {
|
||||||
try {
|
try {
|
||||||
|
console.log("delete");
|
||||||
|
|
||||||
const email = localStorage.getItem("email") || "";
|
const email = localStorage.getItem("email") || "";
|
||||||
const organization = email?.split("@")[1]?.split(".")[0];
|
const organization = email?.split("@")[1]?.split(".")[0];
|
||||||
let deleteWidget = {
|
let deleteWidget = {
|
||||||
|
@ -109,7 +111,9 @@ export const DraggableWidget = ({
|
||||||
};
|
};
|
||||||
|
|
||||||
if (visualizationSocket) {
|
if (visualizationSocket) {
|
||||||
|
setSelectedChartId(null)
|
||||||
visualizationSocket.emit("v2:viz-widget:delete", deleteWidget);
|
visualizationSocket.emit("v2:viz-widget:delete", deleteWidget);
|
||||||
|
console.log("delete widget",selectedChartId);
|
||||||
}
|
}
|
||||||
const updatedWidgets = selectedZone.widgets.filter(
|
const updatedWidgets = selectedZone.widgets.filter(
|
||||||
(w: Widget) => w.id !== widget.id
|
(w: Widget) => w.id !== widget.id
|
||||||
|
@ -120,7 +124,6 @@ export const DraggableWidget = ({
|
||||||
widgets: updatedWidgets,
|
widgets: updatedWidgets,
|
||||||
}));
|
}));
|
||||||
setOpenKebabId(null);
|
setOpenKebabId(null);
|
||||||
|
|
||||||
// const response = await deleteWidgetApi(widget.id, organization);
|
// const response = await deleteWidgetApi(widget.id, organization);
|
||||||
// if (response?.message === "Widget deleted successfully") {
|
// if (response?.message === "Widget deleted successfully") {
|
||||||
// const updatedWidgets = selectedZone.widgets.filter(
|
// const updatedWidgets = selectedZone.widgets.filter(
|
||||||
|
@ -175,6 +178,7 @@ export const DraggableWidget = ({
|
||||||
|
|
||||||
const duplicatedWidget: Widget = {
|
const duplicatedWidget: Widget = {
|
||||||
...widget,
|
...widget,
|
||||||
|
title: name === '' ? widget.title : name,
|
||||||
Data: {
|
Data: {
|
||||||
duration: duration,
|
duration: duration,
|
||||||
measurements: { ...measurements },
|
measurements: { ...measurements },
|
||||||
|
@ -187,6 +191,7 @@ export const DraggableWidget = ({
|
||||||
zoneId: selectedZone.zoneId,
|
zoneId: selectedZone.zoneId,
|
||||||
widget: duplicatedWidget,
|
widget: duplicatedWidget,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (visualizationSocket) {
|
if (visualizationSocket) {
|
||||||
visualizationSocket.emit("v2:viz-widget:add", duplicateWidget);
|
visualizationSocket.emit("v2:viz-widget:add", duplicateWidget);
|
||||||
}
|
}
|
||||||
|
@ -306,7 +311,10 @@ export const DraggableWidget = ({
|
||||||
: undefined,
|
: undefined,
|
||||||
}}
|
}}
|
||||||
ref={chartWidget}
|
ref={chartWidget}
|
||||||
onClick={() => setSelectedChartId(widget)}
|
onClick={() => {setSelectedChartId(widget)
|
||||||
|
console.log('click');
|
||||||
|
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
{/* Kebab Icon */}
|
{/* Kebab Icon */}
|
||||||
<div className="icon kebab" onClick={handleKebabClick}>
|
<div className="icon kebab" onClick={handleKebabClick}>
|
||||||
|
@ -327,7 +335,10 @@ export const DraggableWidget = ({
|
||||||
</div>
|
</div>
|
||||||
<div className="label">Duplicate</div>
|
<div className="label">Duplicate</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="edit btn" onClick={deleteSelectedChart}>
|
<div className="edit btn" onClick={(e)=>{
|
||||||
|
e.stopPropagation()
|
||||||
|
deleteSelectedChart();
|
||||||
|
}}>
|
||||||
<div className="icon">
|
<div className="icon">
|
||||||
<DeleteIcon />
|
<DeleteIcon />
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -101,6 +101,7 @@ export const useDroppedObjectsStore = create<DroppedObjectsState>((set) => ({
|
||||||
let visualizationSocket = socketState.visualizationSocket;
|
let visualizationSocket = socketState.visualizationSocket;
|
||||||
let iotMeasurements = iotData.flotingMeasurements;
|
let iotMeasurements = iotData.flotingMeasurements;
|
||||||
let iotDuration = iotData.flotingDuration;
|
let iotDuration = iotData.flotingDuration;
|
||||||
|
let iotHeader = iotData.header
|
||||||
|
|
||||||
if (!zone) return;
|
if (!zone) return;
|
||||||
|
|
||||||
|
@ -117,6 +118,7 @@ export const useDroppedObjectsStore = create<DroppedObjectsState>((set) => ({
|
||||||
measurements: iotMeasurements,
|
measurements: iotMeasurements,
|
||||||
duration: iotDuration,
|
duration: iotDuration,
|
||||||
},
|
},
|
||||||
|
header: iotHeader,
|
||||||
id: `${originalObject.id}-copy-${Date.now()}`, // Unique ID
|
id: `${originalObject.id}-copy-${Date.now()}`, // Unique ID
|
||||||
position: {
|
position: {
|
||||||
...originalObject.position,
|
...originalObject.position,
|
||||||
|
|
Loading…
Reference in New Issue