supporting textareas as inputs
parent
6cf5848378
commit
57a27737d2
|
@ -32,6 +32,7 @@ import {
|
||||||
LockOutlined,
|
LockOutlined,
|
||||||
} from "@ant-design/icons";
|
} from "@ant-design/icons";
|
||||||
import { StlViewer } from "react-stl-viewer";
|
import { StlViewer } from "react-stl-viewer";
|
||||||
|
import TextArea from "antd/es/input/TextArea";
|
||||||
|
|
||||||
export default function GroupTasksViewModal({ isOpen }) {
|
export default function GroupTasksViewModal({ isOpen }) {
|
||||||
const webSocketContext = useContext(WebSocketContext);
|
const webSocketContext = useContext(WebSocketContext);
|
||||||
|
@ -155,6 +156,26 @@ export default function GroupTasksViewModal({ isOpen }) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const specifiedTaskTextareas =
|
||||||
|
groupTasksViewModalRequiredInputsForm.getElementsByTagName("textarea");
|
||||||
|
|
||||||
|
if (specifiedTaskTextareas.length > 0) {
|
||||||
|
for (let i = 0; i < specifiedTaskTextareas.length; i++) {
|
||||||
|
if (specifiedTaskTextareas[i].value === "") {
|
||||||
|
canTaskContinued = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
taskInputs.push({
|
||||||
|
parameterName:
|
||||||
|
specifiedTaskTextareas[i].id.split(
|
||||||
|
"-"
|
||||||
|
)[6] /* Format: UUID-STEP-PARAMETER_NAME */,
|
||||||
|
value: specifiedTaskTextareas[i].value,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!canTaskContinued) {
|
if (!canTaskContinued) {
|
||||||
|
@ -659,7 +680,6 @@ function InputRequiredHandler({
|
||||||
required
|
required
|
||||||
>
|
>
|
||||||
<Input
|
<Input
|
||||||
key={"input-" + groupTaskParameter.parameterName}
|
|
||||||
id={`${currentGroupTask.Id}-${step}-${groupTaskParameter.parameterName}`}
|
id={`${currentGroupTask.Id}-${step}-${groupTaskParameter.parameterName}`}
|
||||||
defaultValue={getDefaultValue(groupTaskParameter)}
|
defaultValue={getDefaultValue(groupTaskParameter)}
|
||||||
disabled={taskLockedByUserId !== ""}
|
disabled={taskLockedByUserId !== ""}
|
||||||
|
@ -685,7 +705,6 @@ function InputRequiredHandler({
|
||||||
required
|
required
|
||||||
>
|
>
|
||||||
<InputNumber
|
<InputNumber
|
||||||
key={"fitem-" + groupTaskParameter.parameterName}
|
|
||||||
id={`${currentGroupTask.Id}-${step}-${groupTaskParameter.parameterName}`}
|
id={`${currentGroupTask.Id}-${step}-${groupTaskParameter.parameterName}`}
|
||||||
style={{ width: "100%" }}
|
style={{ width: "100%" }}
|
||||||
defaultValue={getDefaultValue(groupTaskParameter)}
|
defaultValue={getDefaultValue(groupTaskParameter)}
|
||||||
|
@ -702,6 +721,32 @@ function InputRequiredHandler({
|
||||||
/>
|
/>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
);
|
);
|
||||||
|
case "textarea":
|
||||||
|
return (
|
||||||
|
<Form.Item
|
||||||
|
key={"fitem-" + groupTaskParameter.parameterName}
|
||||||
|
label={getLabel(
|
||||||
|
groupTaskParameter.displayName,
|
||||||
|
groupTaskParameter
|
||||||
|
)}
|
||||||
|
required
|
||||||
|
>
|
||||||
|
<TextArea
|
||||||
|
id={`${currentGroupTask.Id}-${step}-${groupTaskParameter.parameterName}`}
|
||||||
|
defaultValue={getDefaultValue(groupTaskParameter)}
|
||||||
|
disabled={taskLockedByUserId !== ""}
|
||||||
|
onChange={(e) =>
|
||||||
|
onInputChange(
|
||||||
|
e.target.value,
|
||||||
|
currentGroupTask.Id,
|
||||||
|
groupTaskParameter.parameterName
|
||||||
|
)
|
||||||
|
}
|
||||||
|
value={inputFields[groupTaskParameter.parameterName]}
|
||||||
|
/>
|
||||||
|
</Form.Item>
|
||||||
|
);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
notificationApi["error"]({
|
notificationApi["error"]({
|
||||||
message: `Type ${groupTaskParameter.type} not implemented`,
|
message: `Type ${groupTaskParameter.type} not implemented`,
|
||||||
|
@ -709,8 +754,8 @@ function InputRequiredHandler({
|
||||||
});
|
});
|
||||||
return (
|
return (
|
||||||
<p>
|
<p>
|
||||||
Type ${groupTaskParameter.type} not implemented. Was specified
|
Type <b>{groupTaskParameter.type}</b> not implemented. Was
|
||||||
in: ${groupTaskParameter.displayName}
|
specified in: <b>{groupTaskParameter.displayName}</b>
|
||||||
</p>
|
</p>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,6 +13,7 @@ import {
|
||||||
import { WebSocketContext, SentMessagesCommands } from "../../utils";
|
import { WebSocketContext, SentMessagesCommands } from "../../utils";
|
||||||
import { useContext } from "react";
|
import { useContext } from "react";
|
||||||
import { InfoCircleOutlined } from "@ant-design/icons";
|
import { InfoCircleOutlined } from "@ant-design/icons";
|
||||||
|
import TextArea from "antd/es/input/TextArea";
|
||||||
|
|
||||||
export default function GroupTypeSelectionModal({
|
export default function GroupTypeSelectionModal({
|
||||||
isOpen,
|
isOpen,
|
||||||
|
@ -82,6 +83,23 @@ export default function GroupTypeSelectionModal({
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const userSpecifiedGlobalTextareas =
|
||||||
|
userSpecifiedGlobalInputForm.getElementsByTagName("textarea");
|
||||||
|
|
||||||
|
if (userSpecifiedGlobalTextareas.length > 0) {
|
||||||
|
for (let i = 0; i < userSpecifiedGlobalTextareas.length; i++) {
|
||||||
|
if (userSpecifiedGlobalTextareas[i].value === "") {
|
||||||
|
canTaskBeStarted = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
globalInputs.push({
|
||||||
|
parameterName: userSpecifiedGlobalTextareas[i].id,
|
||||||
|
value: userSpecifiedGlobalTextareas[i].value,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!canTaskBeStarted) {
|
if (!canTaskBeStarted) {
|
||||||
|
@ -221,10 +239,7 @@ function GroupGlobalInputs({
|
||||||
label={getLabel(globalInput.displayName)}
|
label={getLabel(globalInput.displayName)}
|
||||||
required
|
required
|
||||||
>
|
>
|
||||||
<Input
|
<Input id={globalInput.parameterName} />
|
||||||
key={"input-" + globalInput.parameterName}
|
|
||||||
id={globalInput.parameterName}
|
|
||||||
/>
|
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
|
@ -236,13 +251,24 @@ function GroupGlobalInputs({
|
||||||
required
|
required
|
||||||
>
|
>
|
||||||
<InputNumber
|
<InputNumber
|
||||||
key={"input-" + globalInput.parameterName}
|
|
||||||
style={{ width: "100%" }}
|
style={{ width: "100%" }}
|
||||||
|
max={Number.MAX_SAFE_INTEGER}
|
||||||
id={globalInput.parameterName}
|
id={globalInput.parameterName}
|
||||||
/>
|
/>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
|
case "textarea":
|
||||||
|
elements.push(
|
||||||
|
<Form.Item
|
||||||
|
key={"fitem-" + globalInput.parameterName}
|
||||||
|
label={getLabel(globalInput.displayName)}
|
||||||
|
required
|
||||||
|
>
|
||||||
|
<TextArea id={globalInput.parameterName} />
|
||||||
|
</Form.Item>
|
||||||
|
);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
notificationApi["error"]({
|
notificationApi["error"]({
|
||||||
message: `Type ${globalInput.type} not implemented`,
|
message: `Type ${globalInput.type} not implemented`,
|
||||||
|
|
Loading…
Reference in New Issue