Case (in)sensitive labels
Author Name: Abel Coronado (Abel Coronado) Original Redmine Issue: 5381, https://dev.opennebula.org/issues/5381 Original Date: 2017-09-21 Original Assignee: Abel Coronado
It is possible to add labels to images, templates, and VMs. Sunstone labeling seems to be case-sensitive: I can add label “MYLABEL1” to one VM, and “MyLabel1” to another one. These two labels are then displayed in the left panel of Sunstone under the “Instances/VMs” link.
However, using the label as filter apparently is case insensitive: when I click either on “MYLABEL1” or “MyLabel1”, the resulting sub-list contains VMs which have any of these labels.
I think labels should either be case-insensitive in the whole SunStone UI, or case-sensitive everywhere.
Original Redmine Comment Author Name: Abel Coronado (Abel Coronado) Original Date: 2017-09-21T09:30:35Z
Explained in https://forum.opennebula.org/t/case-in-sensitive-labels/4956
Hello, this issue is apparently not fixed in 5.6.1 - I can still create two distinct tags "MYLABEL1" and "MyLabel1" as before.
Hello @Yenya , do you add the label via sunstone, right? I can't reproduce the problem. Could there be spaces in the string?
@abelCoronado93: Yes, I added both labels via Sunstone - as oneadmin, probably in the admin view, I click on the "Instances->VMs" in the left column, click on the topmost VM, then on the label icon in the top row, add a entirely new label "testtag", press enter, go back to the list of VMs, click on the second VM from the top, and add label "TestTag" to it. Two labels with two distinct colors get created. No whitespace at all.
I can even add a label "TestTag" to a VM which already has tag "testtag".
Hope this helps. If not, I might be able to create a screencast, if I find some tool to do it.
One more thing: can it be dependent on a DB backend? FWIW, I use MySQL.
The strings checking is in JS sunstone/public/app/utils/labels/utils.js (existInArrInsensitive function), so we can discard the backend.
I check your strings specifically:
existInArrInsensitive("TestTag", ["testtag"])
The function returns true, so it should not add the new label.
I guess @Yenya is complaining there can exist similar labels with different casing on different VMs. As the check in the Sunstone is done (I guess) only among the labels of current VM. So, maybe the problem is different -- we show labels in the left bar and respect the casing instead of groupping them:

Yes. Altough I can add both labels to the same VM later, after they are created. In the main screen of the VM in the "Info" tab, section "Attributes" there is then a line saying "LABELS testtag,TestTag [edit] [delete]".