one icon indicating copy to clipboard operation
one copied to clipboard

Case (in)sensitive labels

Open OpenNebulaProject opened this issue 9 years ago • 8 comments


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.

OpenNebulaProject avatar Nov 20 '17 12:11 OpenNebulaProject


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

OpenNebulaProject avatar Nov 20 '17 12:11 OpenNebulaProject

Hello, this issue is apparently not fixed in 5.6.1 - I can still create two distinct tags "MYLABEL1" and "MyLabel1" as before.

Yenya avatar Oct 01 '18 12:10 Yenya

Hello @Yenya , do you add the label via sunstone, right? I can't reproduce the problem. Could there be spaces in the string?

abelCoronado93 avatar Oct 03 '18 09:10 abelCoronado93

@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.

Yenya avatar Oct 03 '18 10:10 Yenya

One more thing: can it be dependent on a DB backend? FWIW, I use MySQL.

Yenya avatar Oct 03 '18 10:10 Yenya

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.

abelCoronado93 avatar Oct 04 '18 10:10 abelCoronado93

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:

image

vholer avatar Oct 04 '18 11:10 vholer

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]".

Yenya avatar Oct 04 '18 11:10 Yenya