-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Select rented node in automated selection in case of its existence #3749
base: development
Are you sure you want to change the base?
Conversation
const profileManager = useProfileManager(); | ||
let node; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no need to include the profile manager here, we can pass it from the caller component TfAutoNodeSelector
as it already has the gridstore.grid.twinID
node = nodes.find(n => { | ||
return n.rentedByTwinId === profileManager?.profile?.twinId; | ||
}); | ||
|
||
if (node && isNodeValid(getFarm, node, selectedMachines, filters)) { | ||
if (nodesLock && !locked) { | ||
release(nodesLock); | ||
} | ||
return node; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in this case we will always override the old selected node if there is a rented node is that the required case ?
and i suggest for reduce code redundancy :
const rentedNode = nodes.find(n => n.rentedByTwinId == twinId);
if (oldSelectedNodeId || rentedNode) {
const node = rentedNode || nodes.find(n => n.nodeId === oldSelectedNodeId);
if (node && isNodeValid(getFarm, node, selectedMachines, filters)) {
if (nodesLock && !locked) {
release(nodesLock);
}
return node;
}
}
please fix build error |
it shows the rented node (id 271) at the top of the list but then it autoscrolls to another node |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update test scenarios:
- test if more than one rented node is available (maybe two or three)
- test if the user has more than one rented, which one will be suggested and on which conditions.
- un-reserv one or more rented node and the automation selection should get back to the normal behavior.
- test if the rented node is in grace period; (should not be selected in this case)
Was node 271 rented by you? |
Yes |
if (oldSelectedNodeId) { | ||
const node = nodes.find(n => n.nodeId === oldSelectedNodeId); | ||
if (oldSelectedNodeId || rentedNode) { | ||
const node = rentedNode || nodes.find(n => n.nodeId === oldSelectedNodeId); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we need to keep the old selected node if it exists.
const node = rentedNode || nodes.find(n => n.nodeId === oldSelectedNodeId); | |
const node = nodes.find(n => n.nodeId === oldSelectedNodeId) || rentedNode ; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I remember in Th BAM we agreed on always choosing the rented node, @AhmedHanafy725 can you confirm that we'll choose the old selected node even if there's a rented node?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes we should select the old selected node
…old selected node will be picked
Description
Select rented node in automated selection in case of its existence
Related Issues
Tested Scenarios
Checklist