Closed ankurankan closed 10 years ago
Firstly, there would not be any issue with our back-end processing of data as it involves use of only "id" of node and never the name for identifying them. So as far as the bug is concerned, it can cause conflict with pre-existing node name. As a solution, the button for saving the node name can be disabled if the name is conflicting.
For the second case, a global variable can be used to maintain the no. of default named nodes.
I think a better solution would be to increment the default name if the name is conflicting. I didn't mean to have a global variable. What I meant was that let's say the user puts a name for the first node then the second node's default name should be node0
not node1
.
What do you think?
The problem with that would be if the user does a mistake and gives conflicting names, the default name would be saved automatically. So, I was suggesting to use some validation such that only non-conflicting names are saved. Also, we would need the variable to generate the default name, which is currently being done using the no. of nodes in the graph.
How about this:
while(check(defName)){
defName = "node"+ n++; //n is a variable for available smallest default name
}
function check(defName){
//check whether name is conflicting
if(/*defName conflicting*/)
return true;
else
return false;
}
Then, I guess some validation that would show the user that there's a conflict in the name would be the best solution.
I also agree with having a validation for duplicate names. What if user himself uses the same name twice. @ankurankan I think incrementing the default name only in conflicting cases will be confusing. Having a node name node x
where x has no connection with the node is confusing.
I agree with @gargshashank5 about the default name. I will add a validator which will disable the submit button if the name is conflicting and also disallow any name of format "nodex",x being any integer.
@e55k4y I don't think we should disallow any type of names. If user himself is giving nodeX
kind of names then he may have some purpose. Related to name what we should do is:
node X
as the default name where X is one more than current number of nodes, i.e. node 1
for 1st node and so on. node 9
, The default name for 9th node will still appear as node 9
but submitting this name will be disabled.nodex
kind of names will not work as there are several many similar ways to give such names. nodeX
, node X
, node-X
. So disabling any one kind and allowing others will defeat the purpose. All the said changes are done. Please close this issue.
If the user doesn't enter the name of the node, the node is created by the default name. Let's assume that the user inputs the name of the first node to be
node10
which is the default name for 10th node, and then creates the 10th node with its default name. What will happen in this case? Also don't you think it would be better if we increase the default node name only when the earlier name has been used?