show displayName instead of parameterName for global inputs in task view
parent
8d93066e5f
commit
9aeff64a8b
|
@ -21,6 +21,7 @@ import {
|
||||||
GetDuration,
|
GetDuration,
|
||||||
MyAvatar,
|
MyAvatar,
|
||||||
getUserId,
|
getUserId,
|
||||||
|
GroupTasksStepsLockedAndUserUpdateInputValueRememberId,
|
||||||
} from "../../utils";
|
} from "../../utils";
|
||||||
import { InfoCircleOutlined, LockOutlined } from "@ant-design/icons";
|
import { InfoCircleOutlined, LockOutlined } from "@ant-design/icons";
|
||||||
|
|
||||||
|
@ -464,7 +465,7 @@ export default function GroupTasksViewModal({ isOpen }) {
|
||||||
Specified Global Inputs
|
Specified Global Inputs
|
||||||
</h2>
|
</h2>
|
||||||
|
|
||||||
<p>
|
<span>
|
||||||
{JSON.parse(currentGroupTask.GlobalInputs).map(
|
{JSON.parse(currentGroupTask.GlobalInputs).map(
|
||||||
(globalInput) => {
|
(globalInput) => {
|
||||||
return (
|
return (
|
||||||
|
@ -475,7 +476,24 @@ export default function GroupTasksViewModal({ isOpen }) {
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
<span style={{ fontWeight: "bold" }}>
|
<span style={{ fontWeight: "bold" }}>
|
||||||
{globalInput.parameterName}:{" "}
|
{
|
||||||
|
webSocketContext.CategoryGroups.find(
|
||||||
|
(categoryGroup) =>
|
||||||
|
categoryGroup.category ===
|
||||||
|
currentGroupTask.Category
|
||||||
|
)
|
||||||
|
.groups.find(
|
||||||
|
(group) =>
|
||||||
|
group.id ===
|
||||||
|
currentGroupTask.GroupId
|
||||||
|
)
|
||||||
|
.globalInputs.find(
|
||||||
|
(gI) =>
|
||||||
|
gI.parameterName ===
|
||||||
|
globalInput.parameterName
|
||||||
|
).displayName
|
||||||
|
}
|
||||||
|
:{" "}
|
||||||
</span>
|
</span>
|
||||||
<span>
|
<span>
|
||||||
{globalInput.value !== ""
|
{globalInput.value !== ""
|
||||||
|
@ -487,7 +505,7 @@ export default function GroupTasksViewModal({ isOpen }) {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
)}
|
)}
|
||||||
</p>
|
</span>
|
||||||
</>
|
</>
|
||||||
) : null}
|
) : null}
|
||||||
</>
|
</>
|
||||||
|
@ -602,6 +620,7 @@ function InputRequiredHandler({
|
||||||
lockedByUserId: getUserId(),
|
lockedByUserId: getUserId(),
|
||||||
groupTaskId: currentGroupTaskId,
|
groupTaskId: currentGroupTaskId,
|
||||||
step: step,
|
step: step,
|
||||||
|
rememberId: GroupTasksStepsLockedAndUserUpdateInputValueRememberId,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -617,6 +636,7 @@ function InputRequiredHandler({
|
||||||
parameterName: groupTaskParameterName,
|
parameterName: groupTaskParameterName,
|
||||||
value: inputValue,
|
value: inputValue,
|
||||||
step: step,
|
step: step,
|
||||||
|
rememberId: GroupTasksStepsLockedAndUserUpdateInputValueRememberId,
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}, 500);
|
}, 500);
|
||||||
|
|
38
src/utils.js
38
src/utils.js
|
@ -39,6 +39,13 @@ export const Constants = {
|
||||||
GROUP_TASK_LOCKED_TIME: 3 * 1000,
|
GROUP_TASK_LOCKED_TIME: 3 * 1000,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
This ID is needed because the message is sent to all clients connected to the backend server when a task is locked and unlocked.
|
||||||
|
With this ID the client checks if the respective browser tab of the user is the initiator of the lock.
|
||||||
|
*/
|
||||||
|
export const GroupTasksStepsLockedAndUserUpdateInputValueRememberId =
|
||||||
|
window.crypto.randomUUID();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* user session
|
* user session
|
||||||
*/
|
*/
|
||||||
|
@ -148,7 +155,6 @@ export function WebSocketProvider({
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const StartGroupTasksOpenModalRememberIdRef = useRef(null);
|
const StartGroupTasksOpenModalRememberIdRef = useRef(null);
|
||||||
|
|
||||||
//let socket = null;
|
|
||||||
const ws = useRef(null);
|
const ws = useRef(null);
|
||||||
|
|
||||||
const connect = () => {
|
const connect = () => {
|
||||||
|
@ -312,6 +318,12 @@ export function WebSocketProvider({
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case ReceivedMessagesCommands.TaskLocked:
|
case ReceivedMessagesCommands.TaskLocked:
|
||||||
|
if (
|
||||||
|
body.rememberId ===
|
||||||
|
GroupTasksStepsLockedAndUserUpdateInputValueRememberId
|
||||||
|
)
|
||||||
|
break;
|
||||||
|
|
||||||
setGroupTasksSteps((arr) => {
|
setGroupTasksSteps((arr) => {
|
||||||
const newArr = [...arr];
|
const newArr = [...arr];
|
||||||
|
|
||||||
|
@ -327,6 +339,12 @@ export function WebSocketProvider({
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case ReceivedMessagesCommands.TaskUnlocked:
|
case ReceivedMessagesCommands.TaskUnlocked:
|
||||||
|
if (
|
||||||
|
body.rememberId ===
|
||||||
|
GroupTasksStepsLockedAndUserUpdateInputValueRememberId
|
||||||
|
)
|
||||||
|
break;
|
||||||
|
|
||||||
setGroupTasksSteps((arr) => {
|
setGroupTasksSteps((arr) => {
|
||||||
const newArr = [...arr];
|
const newArr = [...arr];
|
||||||
|
|
||||||
|
@ -342,6 +360,12 @@ export function WebSocketProvider({
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case ReceivedMessagesCommands.UpdateGroupTaskStepUserInputValue:
|
case ReceivedMessagesCommands.UpdateGroupTaskStepUserInputValue:
|
||||||
|
if (
|
||||||
|
body.rememberId ===
|
||||||
|
GroupTasksStepsLockedAndUserUpdateInputValueRememberId
|
||||||
|
)
|
||||||
|
break;
|
||||||
|
|
||||||
// html based DOM manipulation
|
// html based DOM manipulation
|
||||||
const foundInput = document.getElementById(body.element);
|
const foundInput = document.getElementById(body.element);
|
||||||
|
|
||||||
|
@ -456,18 +480,6 @@ export function WebSocketProvider({
|
||||||
</WebSocketContext.Provider>
|
</WebSocketContext.Provider>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
function doEvent(obj, event) {
|
|
||||||
var event = new Event(event, { target: obj, bubbles: true });
|
|
||||||
event.simulated = true;
|
|
||||||
|
|
||||||
let tracker = obj._valueTracker;
|
|
||||||
if (tracker) {
|
|
||||||
tracker.setValue(lastValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
return obj ? obj.dispatchEvent(event) : false;
|
|
||||||
} */
|
|
||||||
|
|
||||||
// https://stackoverflow.com/a/52486921
|
// https://stackoverflow.com/a/52486921
|
||||||
function setNativeValue(element, value) {
|
function setNativeValue(element, value) {
|
||||||
|
|
Loading…
Reference in New Issue