Merge remote-tracking branch 'origin/v2-ui' into v2
This commit is contained in:
commit
e16a0a6d8b
|
@ -1,24 +1,27 @@
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import EyeDropInput from "../../../../../ui/inputs/EyeDropInput";
|
|
||||||
|
|
||||||
interface PickAndPlaceActionProps {
|
interface PickAndPlaceActionProps {
|
||||||
pickPointValue: string;
|
clearPoints: () => void;
|
||||||
pickPointOnChange: (value: string) => void;
|
|
||||||
placePointValue: string;
|
|
||||||
placePointOnChange: (value: string) => void;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const PickAndPlaceAction: React.FC<PickAndPlaceActionProps> = ({
|
const PickAndPlaceAction: React.FC<PickAndPlaceActionProps> = ({
|
||||||
pickPointValue,
|
clearPoints,
|
||||||
pickPointOnChange,
|
|
||||||
placePointValue,
|
|
||||||
placePointOnChange,
|
|
||||||
}) => {
|
}) => {
|
||||||
return (
|
return (
|
||||||
<>
|
<div className="selected-actions-list">
|
||||||
<EyeDropInput label="Pick Point" value={pickPointValue} onChange={pickPointOnChange} />
|
<div className="value-field-container">
|
||||||
<EyeDropInput label="Unload Point" value={placePointValue} onChange={placePointOnChange} />
|
<div className="label">Reset</div>
|
||||||
</>
|
<button
|
||||||
|
type="button"
|
||||||
|
className="regularDropdown-container"
|
||||||
|
onClick={() => {
|
||||||
|
clearPoints();
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Clear
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -25,6 +25,7 @@ interface TravelActionProps {
|
||||||
value: string;
|
value: string;
|
||||||
onChange: (value: string) => void;
|
onChange: (value: string) => void;
|
||||||
};
|
};
|
||||||
|
clearPoints: () => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
const TravelAction: React.FC<TravelActionProps> = ({
|
const TravelAction: React.FC<TravelActionProps> = ({
|
||||||
|
@ -32,6 +33,7 @@ const TravelAction: React.FC<TravelActionProps> = ({
|
||||||
unloadDuration,
|
unloadDuration,
|
||||||
pickPoint,
|
pickPoint,
|
||||||
unloadPoint,
|
unloadPoint,
|
||||||
|
clearPoints,
|
||||||
}) => {
|
}) => {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
@ -41,9 +43,9 @@ const TravelAction: React.FC<TravelActionProps> = ({
|
||||||
min={loadCapacity.min}
|
min={loadCapacity.min}
|
||||||
max={loadCapacity.max}
|
max={loadCapacity.max}
|
||||||
defaultValue={loadCapacity.defaultValue}
|
defaultValue={loadCapacity.defaultValue}
|
||||||
step={0.1}
|
step={1}
|
||||||
activeOption="s"
|
activeOption="s"
|
||||||
onClick={() => { }}
|
onClick={() => {}}
|
||||||
onChange={loadCapacity.onChange}
|
onChange={loadCapacity.onChange}
|
||||||
/>
|
/>
|
||||||
<InputWithDropDown
|
<InputWithDropDown
|
||||||
|
@ -54,9 +56,23 @@ const TravelAction: React.FC<TravelActionProps> = ({
|
||||||
defaultValue={unloadDuration.defaultValue}
|
defaultValue={unloadDuration.defaultValue}
|
||||||
step={0.1}
|
step={0.1}
|
||||||
activeOption="s"
|
activeOption="s"
|
||||||
onClick={() => { }}
|
onClick={() => {}}
|
||||||
onChange={unloadDuration.onChange}
|
onChange={unloadDuration.onChange}
|
||||||
/>
|
/>
|
||||||
|
<div className="selected-actions-list">
|
||||||
|
<div className="value-field-container">
|
||||||
|
<div className="label">Reset</div>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
className="regularDropdown-container"
|
||||||
|
onClick={() => {
|
||||||
|
clearPoints();
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Clear
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
{pickPoint && (
|
{pickPoint && (
|
||||||
<EyeDropInput
|
<EyeDropInput
|
||||||
label="Pick Point"
|
label="Pick Point"
|
||||||
|
|
|
@ -4,22 +4,38 @@ import InputWithDropDown from "../../../../../ui/inputs/InputWithDropDown";
|
||||||
import RenameInput from "../../../../../ui/inputs/RenameInput";
|
import RenameInput from "../../../../../ui/inputs/RenameInput";
|
||||||
import LabledDropdown from "../../../../../ui/inputs/LabledDropdown";
|
import LabledDropdown from "../../../../../ui/inputs/LabledDropdown";
|
||||||
import Trigger from "../trigger/Trigger";
|
import Trigger from "../trigger/Trigger";
|
||||||
import { useSelectedEventData, useSelectedProduct, useSelectedAction } from "../../../../../../store/simulation/useSimulationStore";
|
import {
|
||||||
|
useSelectedEventData,
|
||||||
|
useSelectedProduct,
|
||||||
|
useSelectedAction,
|
||||||
|
} from "../../../../../../store/simulation/useSimulationStore";
|
||||||
import { useProductStore } from "../../../../../../store/simulation/useProductStore";
|
import { useProductStore } from "../../../../../../store/simulation/useProductStore";
|
||||||
import PickAndPlaceAction from "../actions/PickAndPlaceAction";
|
import PickAndPlaceAction from "../actions/PickAndPlaceAction";
|
||||||
import ActionsList from "../components/ActionsList";
|
import ActionsList from "../components/ActionsList";
|
||||||
import { upsertProductOrEventApi } from "../../../../../../services/simulation/UpsertProductOrEventApi";
|
import { upsertProductOrEventApi } from "../../../../../../services/simulation/UpsertProductOrEventApi";
|
||||||
|
|
||||||
function RoboticArmMechanics() {
|
function RoboticArmMechanics() {
|
||||||
const [activeOption, setActiveOption] = useState<"default" | "pickAndPlace">("default");
|
const [activeOption, setActiveOption] = useState<"default" | "pickAndPlace">(
|
||||||
const [selectedPointData, setSelectedPointData] = useState<RoboticArmPointSchema | undefined>();
|
"default"
|
||||||
|
);
|
||||||
|
const [selectedPointData, setSelectedPointData] = useState<
|
||||||
|
RoboticArmPointSchema | undefined
|
||||||
|
>();
|
||||||
const { selectedEventData } = useSelectedEventData();
|
const { selectedEventData } = useSelectedEventData();
|
||||||
const { getPointByUuid, getEventByModelUuid, getActionByUuid, updateEvent, updateAction, addAction, removeAction } = useProductStore();
|
const {
|
||||||
|
getPointByUuid,
|
||||||
|
getEventByModelUuid,
|
||||||
|
updateEvent,
|
||||||
|
updateAction,
|
||||||
|
addAction,
|
||||||
|
removeAction,
|
||||||
|
} = useProductStore();
|
||||||
const { selectedProduct } = useSelectedProduct();
|
const { selectedProduct } = useSelectedProduct();
|
||||||
const { selectedAction, setSelectedAction, clearSelectedAction } = useSelectedAction();
|
const { selectedAction, setSelectedAction, clearSelectedAction } =
|
||||||
|
useSelectedAction();
|
||||||
|
|
||||||
const email = localStorage.getItem('email')
|
const email = localStorage.getItem("email");
|
||||||
const organization = (email!.split("@")[1]).split(".")[0];
|
const organization = email!.split("@")[1].split(".")[0];
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (selectedEventData) {
|
if (selectedEventData) {
|
||||||
|
@ -31,8 +47,13 @@ function RoboticArmMechanics() {
|
||||||
if (point?.actions) {
|
if (point?.actions) {
|
||||||
setSelectedPointData(point);
|
setSelectedPointData(point);
|
||||||
if (point.actions.length > 0) {
|
if (point.actions.length > 0) {
|
||||||
setActiveOption(point.actions[0].actionType as "default" | "pickAndPlace");
|
setActiveOption(
|
||||||
setSelectedAction(point.actions[0].actionUuid, point.actions[0].actionName);
|
point.actions[0].actionType as "default" | "pickAndPlace"
|
||||||
|
);
|
||||||
|
setSelectedAction(
|
||||||
|
point.actions[0].actionUuid,
|
||||||
|
point.actions[0].actionName
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -50,17 +71,23 @@ function RoboticArmMechanics() {
|
||||||
productName: productName,
|
productName: productName,
|
||||||
productId: productId,
|
productId: productId,
|
||||||
organization: organization,
|
organization: organization,
|
||||||
eventDatas: eventData
|
eventDatas: eventData,
|
||||||
})
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
const handleRenameAction = (newName: string) => {
|
const handleRenameAction = (newName: string) => {
|
||||||
if (!selectedAction.actionId) return;
|
if (!selectedAction.actionId) return;
|
||||||
const event = updateAction(selectedProduct.productId, selectedAction.actionId, { actionName: newName });
|
const event = updateAction(
|
||||||
|
selectedProduct.productId,
|
||||||
|
selectedAction.actionId,
|
||||||
|
{ actionName: newName }
|
||||||
|
);
|
||||||
|
|
||||||
if (selectedPointData) {
|
if (selectedPointData) {
|
||||||
const updatedActions = selectedPointData.actions.map((action) =>
|
const updatedActions = selectedPointData.actions.map((action) =>
|
||||||
action.actionUuid === selectedAction.actionId ? { ...action, actionName: newName } : action
|
action.actionUuid === selectedAction.actionId
|
||||||
|
? { ...action, actionName: newName }
|
||||||
|
: action
|
||||||
);
|
);
|
||||||
setSelectedPointData({
|
setSelectedPointData({
|
||||||
...selectedPointData,
|
...selectedPointData,
|
||||||
|
@ -80,9 +107,13 @@ function RoboticArmMechanics() {
|
||||||
|
|
||||||
const handleSpeedChange = (value: string) => {
|
const handleSpeedChange = (value: string) => {
|
||||||
if (!selectedEventData) return;
|
if (!selectedEventData) return;
|
||||||
const event = updateEvent(selectedProduct.productId, selectedEventData.data.modelUuid, {
|
const event = updateEvent(
|
||||||
|
selectedProduct.productId,
|
||||||
|
selectedEventData.data.modelUuid,
|
||||||
|
{
|
||||||
speed: parseFloat(value),
|
speed: parseFloat(value),
|
||||||
});
|
}
|
||||||
|
);
|
||||||
|
|
||||||
if (event) {
|
if (event) {
|
||||||
updateBackend(
|
updateBackend(
|
||||||
|
@ -93,17 +124,19 @@ function RoboticArmMechanics() {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
const handleClearPoints = () => {
|
||||||
const handlePickPointChange = (value: string) => {
|
|
||||||
if (!selectedAction.actionId || !selectedPointData) return;
|
if (!selectedAction.actionId || !selectedPointData) return;
|
||||||
const [x, y, z] = value.split(",").map(Number);
|
|
||||||
|
|
||||||
const event = updateAction(selectedProduct.productId, selectedAction.actionId, {
|
const event = updateAction(
|
||||||
|
selectedProduct.productId,
|
||||||
|
selectedAction.actionId,
|
||||||
|
{
|
||||||
process: {
|
process: {
|
||||||
startPoint: [x, y, z] as [number, number, number],
|
startPoint: null,
|
||||||
endPoint: selectedPointData.actions.find((a) => a.actionUuid === selectedAction.actionId)?.process.endPoint || null,
|
endPoint: null,
|
||||||
},
|
},
|
||||||
});
|
}
|
||||||
|
);
|
||||||
|
|
||||||
if (event) {
|
if (event) {
|
||||||
updateBackend(
|
updateBackend(
|
||||||
|
@ -115,28 +148,6 @@ function RoboticArmMechanics() {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const handlePlacePointChange = (value: string) => {
|
|
||||||
if (!selectedAction.actionId || !selectedPointData) return;
|
|
||||||
const [x, y, z] = value.split(",").map(Number);
|
|
||||||
|
|
||||||
const event = updateAction(selectedProduct.productId, selectedAction.actionId, {
|
|
||||||
process: {
|
|
||||||
startPoint: selectedPointData.actions.find((a) => a.actionUuid === selectedAction.actionId)?.process.startPoint || null,
|
|
||||||
endPoint: [x, y, z] as [number, number, number],
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
if (event) {
|
|
||||||
updateBackend(
|
|
||||||
selectedProduct.productName,
|
|
||||||
selectedProduct.productId,
|
|
||||||
organization,
|
|
||||||
event
|
|
||||||
);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
const handleAddAction = () => {
|
const handleAddAction = () => {
|
||||||
if (!selectedEventData || !selectedPointData) return;
|
if (!selectedEventData || !selectedPointData) return;
|
||||||
|
|
||||||
|
@ -189,8 +200,12 @@ function RoboticArmMechanics() {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const index = selectedPointData.actions.findIndex(a => a.actionUuid === actionUuid);
|
const index = selectedPointData.actions.findIndex(
|
||||||
const newActions = selectedPointData.actions.filter(a => a.actionUuid !== actionUuid);
|
(a) => a.actionUuid === actionUuid
|
||||||
|
);
|
||||||
|
const newActions = selectedPointData.actions.filter(
|
||||||
|
(a) => a.actionUuid !== actionUuid
|
||||||
|
);
|
||||||
|
|
||||||
const updatedPoint = {
|
const updatedPoint = {
|
||||||
...selectedPointData,
|
...selectedPointData,
|
||||||
|
@ -213,11 +228,17 @@ function RoboticArmMechanics() {
|
||||||
options: ["pickAndPlace"],
|
options: ["pickAndPlace"],
|
||||||
};
|
};
|
||||||
|
|
||||||
const currentSpeed = (getEventByModelUuid(
|
const currentSpeed =
|
||||||
selectedProduct.productId, selectedEventData?.data.modelUuid || ""
|
(
|
||||||
) as RoboticArmEventSchema | undefined)?.speed?.toString() || "0.5";
|
getEventByModelUuid(
|
||||||
|
selectedProduct.productId,
|
||||||
|
selectedEventData?.data.modelUuid || ""
|
||||||
|
) as RoboticArmEventSchema | undefined
|
||||||
|
)?.speed?.toString() || "0.5";
|
||||||
|
|
||||||
const currentAction = selectedPointData?.actions.find((a) => a.actionUuid === selectedAction.actionId);
|
const currentAction = selectedPointData?.actions.find(
|
||||||
|
(a) => a.actionUuid === selectedAction.actionId
|
||||||
|
);
|
||||||
|
|
||||||
const currentPickPoint = currentAction?.process.startPoint
|
const currentPickPoint = currentAction?.process.startPoint
|
||||||
? `${currentAction.process.startPoint[0]},${currentAction.process.startPoint[1]},${currentAction.process.startPoint[2]}`
|
? `${currentAction.process.startPoint[0]},${currentAction.process.startPoint[1]},${currentAction.process.startPoint[2]}`
|
||||||
|
@ -239,14 +260,13 @@ function RoboticArmMechanics() {
|
||||||
defaultValue={"0.5"}
|
defaultValue={"0.5"}
|
||||||
max={10}
|
max={10}
|
||||||
activeOption="m/s"
|
activeOption="m/s"
|
||||||
onClick={() => { }}
|
onClick={() => {}}
|
||||||
onChange={handleSpeedChange}
|
onChange={handleSpeedChange}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<section>
|
<section>
|
||||||
|
|
||||||
<ActionsList
|
<ActionsList
|
||||||
selectedPointData={selectedPointData}
|
selectedPointData={selectedPointData}
|
||||||
multipleAction
|
multipleAction
|
||||||
|
@ -258,7 +278,7 @@ function RoboticArmMechanics() {
|
||||||
<div className="selected-actions-details">
|
<div className="selected-actions-details">
|
||||||
<div className="selected-actions-header">
|
<div className="selected-actions-header">
|
||||||
<RenameInput
|
<RenameInput
|
||||||
value={selectedAction.actionName || ''}
|
value={selectedAction.actionName || ""}
|
||||||
onRename={handleRenameAction}
|
onRename={handleRenameAction}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
@ -266,18 +286,16 @@ function RoboticArmMechanics() {
|
||||||
<LabledDropdown
|
<LabledDropdown
|
||||||
defaultOption={activeOption}
|
defaultOption={activeOption}
|
||||||
options={availableActions.options}
|
options={availableActions.options}
|
||||||
onSelect={() => { }}
|
onSelect={() => {}}
|
||||||
disabled={true}
|
disabled={true}
|
||||||
/>
|
/>
|
||||||
<PickAndPlaceAction
|
<PickAndPlaceAction clearPoints={handleClearPoints} />
|
||||||
pickPointValue={currentPickPoint}
|
|
||||||
pickPointOnChange={handlePickPointChange}
|
|
||||||
placePointValue={currentPlacePoint}
|
|
||||||
placePointOnChange={handlePlacePointChange}
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
<div className="tirgger">
|
<div className="tirgger">
|
||||||
<Trigger selectedPointData={selectedPointData as any} type={'RoboticArm'} />
|
<Trigger
|
||||||
|
selectedPointData={selectedPointData as any}
|
||||||
|
type={"RoboticArm"}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
|
@ -6,26 +6,34 @@ import Trigger from "../trigger/Trigger";
|
||||||
import {
|
import {
|
||||||
useSelectedAction,
|
useSelectedAction,
|
||||||
useSelectedEventData,
|
useSelectedEventData,
|
||||||
|
useSelectedEventSphere,
|
||||||
useSelectedProduct,
|
useSelectedProduct,
|
||||||
} from "../../../../../../store/simulation/useSimulationStore";
|
} from "../../../../../../store/simulation/useSimulationStore";
|
||||||
import { useProductStore } from "../../../../../../store/simulation/useProductStore";
|
import { useProductStore } from "../../../../../../store/simulation/useProductStore";
|
||||||
import TravelAction from "../actions/TravelAction";
|
import TravelAction from "../actions/TravelAction";
|
||||||
import ActionsList from "../components/ActionsList";
|
import ActionsList from "../components/ActionsList";
|
||||||
import { upsertProductOrEventApi } from "../../../../../../services/simulation/UpsertProductOrEventApi";
|
import { upsertProductOrEventApi } from "../../../../../../services/simulation/UpsertProductOrEventApi";
|
||||||
|
import { useVehicleStore } from "../../../../../../store/simulation/useVehicleStore";
|
||||||
|
|
||||||
function VehicleMechanics() {
|
function VehicleMechanics() {
|
||||||
const [activeOption, setActiveOption] = useState<"default" | "travel">("default");
|
const [activeOption, setActiveOption] = useState<"default" | "travel">(
|
||||||
const [selectedPointData, setSelectedPointData] = useState<VehiclePointSchema | undefined>();
|
"default"
|
||||||
|
);
|
||||||
|
const [selectedPointData, setSelectedPointData] = useState<
|
||||||
|
VehiclePointSchema | undefined
|
||||||
|
>();
|
||||||
const { selectedEventData } = useSelectedEventData();
|
const { selectedEventData } = useSelectedEventData();
|
||||||
const { getPointByUuid, getEventByModelUuid, updateEvent, updateAction } = useProductStore();
|
const { getPointByUuid, getEventByModelUuid, updateEvent, updateAction } =
|
||||||
|
useProductStore();
|
||||||
const { selectedProduct } = useSelectedProduct();
|
const { selectedProduct } = useSelectedProduct();
|
||||||
const { setSelectedAction, clearSelectedAction } = useSelectedAction();
|
const { setSelectedAction, clearSelectedAction } = useSelectedAction();
|
||||||
|
const { getVehicleById } = useVehicleStore();
|
||||||
|
|
||||||
const email = localStorage.getItem('email')
|
const email = localStorage.getItem("email");
|
||||||
const organization = (email!.split("@")[1]).split(".")[0];
|
const organization = email!.split("@")[1].split(".")[0];
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (selectedEventData && selectedEventData.data.type === 'vehicle') {
|
if (selectedEventData && selectedEventData.data.type === "vehicle") {
|
||||||
const point = getPointByUuid(
|
const point = getPointByUuid(
|
||||||
selectedProduct.productId,
|
selectedProduct.productId,
|
||||||
selectedEventData.data.modelUuid,
|
selectedEventData.data.modelUuid,
|
||||||
|
@ -52,15 +60,19 @@ function VehicleMechanics() {
|
||||||
productName: productName,
|
productName: productName,
|
||||||
productId: productId,
|
productId: productId,
|
||||||
organization: organization,
|
organization: organization,
|
||||||
eventDatas: eventData
|
eventDatas: eventData,
|
||||||
})
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
const handleSpeedChange = (value: string) => {
|
const handleSpeedChange = (value: string) => {
|
||||||
if (!selectedEventData) return;
|
if (!selectedEventData) return;
|
||||||
const event = updateEvent(selectedProduct.productId, selectedEventData.data.modelUuid, {
|
const event = updateEvent(
|
||||||
|
selectedProduct.productId,
|
||||||
|
selectedEventData.data.modelUuid,
|
||||||
|
{
|
||||||
speed: parseFloat(value),
|
speed: parseFloat(value),
|
||||||
});
|
}
|
||||||
|
);
|
||||||
|
|
||||||
if (event) {
|
if (event) {
|
||||||
updateBackend(
|
updateBackend(
|
||||||
|
@ -77,9 +89,13 @@ function VehicleMechanics() {
|
||||||
const validOption = option as "travel";
|
const validOption = option as "travel";
|
||||||
setActiveOption(validOption);
|
setActiveOption(validOption);
|
||||||
|
|
||||||
const event = updateAction(selectedProduct.productId, selectedPointData.action.actionUuid, {
|
const event = updateAction(
|
||||||
|
selectedProduct.productId,
|
||||||
|
selectedPointData.action.actionUuid,
|
||||||
|
{
|
||||||
actionType: validOption,
|
actionType: validOption,
|
||||||
});
|
}
|
||||||
|
);
|
||||||
|
|
||||||
if (event) {
|
if (event) {
|
||||||
updateBackend(
|
updateBackend(
|
||||||
|
@ -93,7 +109,11 @@ function VehicleMechanics() {
|
||||||
|
|
||||||
const handleRenameAction = (newName: string) => {
|
const handleRenameAction = (newName: string) => {
|
||||||
if (!selectedPointData) return;
|
if (!selectedPointData) return;
|
||||||
const event = updateAction(selectedProduct.productId, selectedPointData.action.actionUuid, { actionName: newName });
|
const event = updateAction(
|
||||||
|
selectedProduct.productId,
|
||||||
|
selectedPointData.action.actionUuid,
|
||||||
|
{ actionName: newName }
|
||||||
|
);
|
||||||
|
|
||||||
if (event) {
|
if (event) {
|
||||||
updateBackend(
|
updateBackend(
|
||||||
|
@ -107,9 +127,13 @@ function VehicleMechanics() {
|
||||||
|
|
||||||
const handleLoadCapacityChange = (value: string) => {
|
const handleLoadCapacityChange = (value: string) => {
|
||||||
if (!selectedPointData) return;
|
if (!selectedPointData) return;
|
||||||
const event = updateAction(selectedProduct.productId, selectedPointData.action.actionUuid, {
|
const event = updateAction(
|
||||||
|
selectedProduct.productId,
|
||||||
|
selectedPointData.action.actionUuid,
|
||||||
|
{
|
||||||
loadCapacity: parseFloat(value),
|
loadCapacity: parseFloat(value),
|
||||||
});
|
}
|
||||||
|
);
|
||||||
|
|
||||||
if (event) {
|
if (event) {
|
||||||
updateBackend(
|
updateBackend(
|
||||||
|
@ -123,9 +147,13 @@ function VehicleMechanics() {
|
||||||
|
|
||||||
const handleUnloadDurationChange = (value: string) => {
|
const handleUnloadDurationChange = (value: string) => {
|
||||||
if (!selectedPointData) return;
|
if (!selectedPointData) return;
|
||||||
const event = updateAction(selectedProduct.productId, selectedPointData.action.actionUuid, {
|
const event = updateAction(
|
||||||
|
selectedProduct.productId,
|
||||||
|
selectedPointData.action.actionUuid,
|
||||||
|
{
|
||||||
unLoadDuration: parseFloat(value),
|
unLoadDuration: parseFloat(value),
|
||||||
});
|
}
|
||||||
|
);
|
||||||
|
|
||||||
if (event) {
|
if (event) {
|
||||||
updateBackend(
|
updateBackend(
|
||||||
|
@ -147,9 +175,13 @@ function VehicleMechanics() {
|
||||||
|
|
||||||
// Get current values from store
|
// Get current values from store
|
||||||
|
|
||||||
const currentSpeed = (getEventByModelUuid(
|
const currentSpeed =
|
||||||
selectedProduct.productId, selectedEventData?.data.modelUuid || ""
|
(
|
||||||
) as VehicleEventSchema | undefined)?.speed?.toString() || "0.5";
|
getEventByModelUuid(
|
||||||
|
selectedProduct.productId,
|
||||||
|
selectedEventData?.data.modelUuid || ""
|
||||||
|
) as VehicleEventSchema | undefined
|
||||||
|
)?.speed?.toString() || "0.5";
|
||||||
|
|
||||||
const currentActionName = selectedPointData
|
const currentActionName = selectedPointData
|
||||||
? selectedPointData.action.actionName
|
? selectedPointData.action.actionName
|
||||||
|
@ -163,9 +195,45 @@ function VehicleMechanics() {
|
||||||
? selectedPointData.action.unLoadDuration.toString()
|
? selectedPointData.action.unLoadDuration.toString()
|
||||||
: "1";
|
: "1";
|
||||||
|
|
||||||
const currentPickPoint = selectedPointData?.action.pickUpPoint;
|
const { selectedEventSphere } = useSelectedEventSphere();
|
||||||
|
|
||||||
const currentUnloadPoint = selectedPointData?.action.unLoadPoint;
|
function handleClearPoints() {
|
||||||
|
const updatedVehicle = getVehicleById(
|
||||||
|
selectedEventSphere?.userData.modelUuid
|
||||||
|
);
|
||||||
|
|
||||||
|
if (
|
||||||
|
!selectedProduct?.productId ||
|
||||||
|
!selectedEventSphere?.userData?.modelUuid ||
|
||||||
|
!updatedVehicle?.point
|
||||||
|
)
|
||||||
|
return;
|
||||||
|
|
||||||
|
const event = updateEvent(
|
||||||
|
selectedProduct.productId,
|
||||||
|
selectedEventSphere.userData.modelUuid,
|
||||||
|
{
|
||||||
|
point: {
|
||||||
|
...updatedVehicle.point,
|
||||||
|
action: {
|
||||||
|
...updatedVehicle.point?.action,
|
||||||
|
pickUpPoint: null,
|
||||||
|
unLoadPoint: null,
|
||||||
|
steeringAngle: 0,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
if (event) {
|
||||||
|
updateBackend(
|
||||||
|
selectedProduct.productName,
|
||||||
|
selectedProduct.productId,
|
||||||
|
organization,
|
||||||
|
event
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const availableActions = {
|
const availableActions = {
|
||||||
defaultOption: "travel",
|
defaultOption: "travel",
|
||||||
|
@ -187,16 +255,14 @@ function VehicleMechanics() {
|
||||||
defaultValue={"0.5"}
|
defaultValue={"0.5"}
|
||||||
max={10}
|
max={10}
|
||||||
activeOption="m/s"
|
activeOption="m/s"
|
||||||
onClick={() => { }}
|
onClick={() => {}}
|
||||||
onChange={handleSpeedChange}
|
onChange={handleSpeedChange}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<section>
|
<section>
|
||||||
<ActionsList
|
<ActionsList selectedPointData={selectedPointData} />
|
||||||
selectedPointData={selectedPointData}
|
|
||||||
/>
|
|
||||||
<div className="selected-actions-details">
|
<div className="selected-actions-details">
|
||||||
<div className="selected-actions-header">
|
<div className="selected-actions-header">
|
||||||
<RenameInput
|
<RenameInput
|
||||||
|
@ -227,6 +293,7 @@ function VehicleMechanics() {
|
||||||
defaultValue: "1",
|
defaultValue: "1",
|
||||||
onChange: handleUnloadDurationChange,
|
onChange: handleUnloadDurationChange,
|
||||||
}}
|
}}
|
||||||
|
clearPoints={handleClearPoints}
|
||||||
// pickPoint={{
|
// pickPoint={{
|
||||||
// value: currentPickPoint,
|
// value: currentPickPoint,
|
||||||
// onChange: handlePickPointChange,
|
// onChange: handlePickPointChange,
|
||||||
|
@ -240,7 +307,10 @@ function VehicleMechanics() {
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="tirgger">
|
<div className="tirgger">
|
||||||
<Trigger selectedPointData={selectedPointData as any} type={'Vehicle'} />
|
<Trigger
|
||||||
|
selectedPointData={selectedPointData as any}
|
||||||
|
type={"Vehicle"}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
</>
|
</>
|
||||||
|
|
|
@ -1,21 +1,18 @@
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { EyeDroperIcon } from "../../icons/ExportCommonIcons";
|
import { EyeDroperIcon } from "../../icons/ExportCommonIcons";
|
||||||
import RegularDropDown from "./RegularDropDown";
|
|
||||||
|
|
||||||
interface EyeDropInputProps {
|
interface EyeDropInputProps {
|
||||||
label: string;
|
label: string;
|
||||||
value: string;
|
value: string;
|
||||||
onChange: (value: string) => void;
|
onChange: (value: string) => void;
|
||||||
options?: string[];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const EyeDropInput: React.FC<EyeDropInputProps> = ({
|
const EyeDropInput: React.FC<EyeDropInputProps> = ({
|
||||||
label = "Object",
|
label = "Object",
|
||||||
|
value,
|
||||||
onChange,
|
onChange,
|
||||||
}) => {
|
}) => {
|
||||||
const handleEyeDropClick = () => {
|
const handleEyeDropClick = () => {
|
||||||
// Here you would typically implement the eye dropper functionality
|
|
||||||
// For now, we'll just simulate selecting a value
|
|
||||||
const simulatedValue = "picked_value"; // Replace with actual eye dropper logic
|
const simulatedValue = "picked_value"; // Replace with actual eye dropper logic
|
||||||
onChange(simulatedValue);
|
onChange(simulatedValue);
|
||||||
};
|
};
|
||||||
|
@ -24,15 +21,12 @@ const EyeDropInput: React.FC<EyeDropInputProps> = ({
|
||||||
<div className="eye-dropper-input-container">
|
<div className="eye-dropper-input-container">
|
||||||
<div className="label">{label}</div>
|
<div className="label">{label}</div>
|
||||||
<div className="input-container">
|
<div className="input-container">
|
||||||
{/* <input disabled type="text" /> */}
|
<input disabled type="text" value={value}/>
|
||||||
<RegularDropDown
|
{/* <input type="text" value={activeValue ?? "null"} disabled /> */}
|
||||||
header="select object"
|
{/* <input type="button" value="Clear" onClick={handleEyeDropClick}/> */}
|
||||||
options={[]}
|
<button className="eye-picker-button" onClick={handleEyeDropClick}>
|
||||||
onSelect={() => { }}
|
|
||||||
/>
|
|
||||||
<div className="eye-picker-button" onClick={handleEyeDropClick}>
|
|
||||||
<EyeDroperIcon isActive={false} />
|
<EyeDroperIcon isActive={false} />
|
||||||
</div>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
import React, { useState } from "react";
|
import React, { useState } from "react";
|
||||||
import {
|
import {
|
||||||
CartBagIcon,
|
|
||||||
ExpandIcon,
|
ExpandIcon,
|
||||||
IndicationArrow,
|
IndicationArrow,
|
||||||
SimulationStatusIcon,
|
SimulationStatusIcon,
|
||||||
|
@ -107,7 +106,7 @@ const AssetDetailsCard: React.FC<AssetDetailsCardInterface> = ({
|
||||||
<div className="value-container">
|
<div className="value-container">
|
||||||
<div className="progress-bar">
|
<div className="progress-bar">
|
||||||
{[...Array(5)].map((_, i) => {
|
{[...Array(5)].map((_, i) => {
|
||||||
const percentage = (count ?? 0 / totalCapacity) * 100;
|
const percentage = (count! / totalCapacity) * 100;
|
||||||
const start = i * 20;
|
const start = i * 20;
|
||||||
const end = (i + 1) * 20;
|
const end = (i + 1) * 20;
|
||||||
// fill amount: 0 to 100
|
// fill amount: 0 to 100
|
||||||
|
@ -120,7 +119,7 @@ const AssetDetailsCard: React.FC<AssetDetailsCardInterface> = ({
|
||||||
fillPercent = ((percentage - start) / 20) * 100;
|
fillPercent = ((percentage - start) / 20) * 100;
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
<div key={i} className="block">
|
<div key={`block-${i}-${start}-${end}`} className="block">
|
||||||
<div
|
<div
|
||||||
className="fill"
|
className="fill"
|
||||||
style={
|
style={
|
||||||
|
@ -134,7 +133,7 @@ const AssetDetailsCard: React.FC<AssetDetailsCardInterface> = ({
|
||||||
})}
|
})}
|
||||||
</div>
|
</div>
|
||||||
<div className="value">
|
<div className="value">
|
||||||
{Math.round((count ?? 0 / totalCapacity) * 100).toString()}%
|
{Math.round((count! / totalCapacity) * 100).toString()}%
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -3,6 +3,7 @@ import { useSelectedAction, useSelectedEventSphere, useSelectedProduct } from '.
|
||||||
import { useGLTF } from '@react-three/drei';
|
import { useGLTF } from '@react-three/drei';
|
||||||
import { useThree } from '@react-three/fiber';
|
import { useThree } from '@react-three/fiber';
|
||||||
import { useProductStore } from '../../../../store/simulation/useProductStore';
|
import { useProductStore } from '../../../../store/simulation/useProductStore';
|
||||||
|
import { useArmBotStore } from '../../../../store/simulation/useArmBotStore';
|
||||||
import PickDropPoints from './PickDropPoints';
|
import PickDropPoints from './PickDropPoints';
|
||||||
import useDraggableGLTF from './useDraggableGLTF';
|
import useDraggableGLTF from './useDraggableGLTF';
|
||||||
import * as THREE from 'three';
|
import * as THREE from 'three';
|
||||||
|
@ -23,6 +24,7 @@ const ArmBotUI = () => {
|
||||||
const { selectedProduct } = useSelectedProduct();
|
const { selectedProduct } = useSelectedProduct();
|
||||||
const { scene } = useThree();
|
const { scene } = useThree();
|
||||||
const { selectedAction } = useSelectedAction();
|
const { selectedAction } = useSelectedAction();
|
||||||
|
const { armBots } = useArmBotStore();
|
||||||
|
|
||||||
const armUiPick = useGLTF(armPick) as any;
|
const armUiPick = useGLTF(armPick) as any;
|
||||||
const armUiDrop = useGLTF(armDrop) as any;
|
const armUiDrop = useGLTF(armDrop) as any;
|
||||||
|
@ -73,7 +75,7 @@ const ArmBotUI = () => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, [selectedEventSphere, selectedProduct, getEventByModelUuid, selectedAction]);
|
}, [armBots, selectedEventSphere, selectedProduct, getEventByModelUuid, selectedAction]);
|
||||||
|
|
||||||
function getDefaultPositions(modelUuid: string): Positions {
|
function getDefaultPositions(modelUuid: string): Positions {
|
||||||
const modelData = getEventByModelUuid(selectedProduct.productId, modelUuid);
|
const modelData = getEventByModelUuid(selectedProduct.productId, modelUuid);
|
||||||
|
|
|
@ -23,7 +23,7 @@ const VehicleUI = () => {
|
||||||
const prevMousePos = useRef({ x: 0, y: 0 });
|
const prevMousePos = useRef({ x: 0, y: 0 });
|
||||||
const { selectedEventSphere } = useSelectedEventSphere();
|
const { selectedEventSphere } = useSelectedEventSphere();
|
||||||
const { selectedProduct } = useSelectedProduct();
|
const { selectedProduct } = useSelectedProduct();
|
||||||
const { getVehicleById } = useVehicleStore();
|
const { vehicles, getVehicleById } = useVehicleStore();
|
||||||
const { updateEvent } = useProductStore();
|
const { updateEvent } = useProductStore();
|
||||||
const [startPosition, setStartPosition] = useState<[number, number, number]>([
|
const [startPosition, setStartPosition] = useState<[number, number, number]>([
|
||||||
0, 1, 0,
|
0, 1, 0,
|
||||||
|
@ -144,7 +144,7 @@ const VehicleUI = () => {
|
||||||
setSteeringRotation([0, steeringAngle, 0]);
|
setSteeringRotation([0, steeringAngle, 0]);
|
||||||
}
|
}
|
||||||
}, 10);
|
}, 10);
|
||||||
}, [selectedEventSphere, outerGroup.current]);
|
}, [selectedEventSphere, outerGroup.current, vehicles]);
|
||||||
|
|
||||||
const handlePointerDown = (
|
const handlePointerDown = (
|
||||||
e: any,
|
e: any,
|
||||||
|
|
|
@ -58,7 +58,7 @@ const MaterialAnimator = ({
|
||||||
}, [storageModel, storage.currentMaterials]);
|
}, [storageModel, storage.currentMaterials]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<group position={[0, -padding, 0]}>
|
<group {...{ position: [0, -padding, 0] }}>
|
||||||
{hasLoad &&
|
{hasLoad &&
|
||||||
storage.currentMaterials.map((mat, index) => (
|
storage.currentMaterials.map((mat, index) => (
|
||||||
<MaterialModel
|
<MaterialModel
|
||||||
|
|
|
@ -271,6 +271,7 @@
|
||||||
height: calc(100% - 16px);
|
height: calc(100% - 16px);
|
||||||
max-height: 46vh;
|
max-height: 46vh;
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
|
margin: 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -454,7 +455,6 @@
|
||||||
height: calc(100% - 36px);
|
height: calc(100% - 36px);
|
||||||
position: relative;
|
position: relative;
|
||||||
width: 304px;
|
width: 304px;
|
||||||
padding-bottom: 10px;
|
|
||||||
|
|
||||||
.no-event-selected {
|
.no-event-selected {
|
||||||
color: #666;
|
color: #666;
|
||||||
|
@ -780,8 +780,9 @@
|
||||||
.simulations-container,
|
.simulations-container,
|
||||||
.event-proprties-wrapper {
|
.event-proprties-wrapper {
|
||||||
position: relative;
|
position: relative;
|
||||||
max-height: calc(60vh - (47px - 35px));
|
max-height: calc(62vh - (47px - 35px));
|
||||||
width: 304px;
|
width: 304px;
|
||||||
|
border-radius: #{$border-radius-large};
|
||||||
overflow-x: hidden;
|
overflow-x: hidden;
|
||||||
|
|
||||||
.header {
|
.header {
|
||||||
|
@ -1175,8 +1176,8 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.analysis-content-container {
|
.analysis-content-container {
|
||||||
min-height: 50vh;
|
min-height: 48vh;
|
||||||
max-height: 60vh;
|
max-height: 56vh;
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
|
|
||||||
.dropdown-header-container,
|
.dropdown-header-container,
|
||||||
|
|
Loading…
Reference in New Issue