Alona Kaplan has uploaded a new change for review.

Change subject: webadmin: Nic labels should be sorted
......................................................................

webadmin: Nic labels should be sorted

Nic labels should be presented according to LexoNumeric order.

There are two places that should be sorted-
1. Setup Networks- edit nic dialog- the current labels.
2. Host interface subtab- the labels tooltip (on nic or bond).

Note-
Setup Networks->edit nic dialog->suggested labels- are already
sorted. HostSetupNetworksModel.getFreeLabels() takes care of it.

Change-Id: I28fb7750504bffdadd9d92f00565e21c272127ff
Bug-Url: https://bugzilla.redhat.com/1091674
Signed-off-by: Alona Kaplan <[email protected]>
---
M 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/NicLabelModel.java
M 
frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/host/InterfaceLabelWithToolTip.java
2 files changed, 10 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/85/28885/1

diff --git 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/NicLabelModel.java
 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/NicLabelModel.java
index 3a7fb53..a86a314 100644
--- 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/NicLabelModel.java
+++ 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/NicLabelModel.java
@@ -2,8 +2,10 @@
 
 import java.util.ArrayList;
 import java.util.Collection;
+import java.util.Collections;
 import java.util.HashSet;
 import java.util.LinkedList;
+import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
@@ -17,7 +19,7 @@
 
     private final Collection<VdsNetworkInterface> srcIfaces; // original 
interfaces composing this interface (more than one in case this is a bond)
     private final Set<String> containedIfaces; // names of the original 
interfaces
-    private final Collection<String> originalLabels; // union of labels 
attached originally to original interface(s)
+    private final List<String> originalLabels; // union of labels attached 
originally to original interface(s)
     private final Collection<String> suggestedLabels; // pre-existing DC 
labels that aren't yet assigned to an interface
     private final Map<String, String> labelToIface; // map from each label to 
the name of the interface that uses it (possibly null)
     private final Set<String> flushedLabels; // actual labels, as edited in 
the view
@@ -44,6 +46,7 @@
             containedIfaces.add(iface.getName());
         }
 
+        Collections.sort(originalLabels);
         LinkedList<ListModel<String>> items = new 
LinkedList<ListModel<String>>();
         for (String label : originalLabels) {
             ListModel<String> labelModel = new ListModel<String>();
diff --git 
a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/host/InterfaceLabelWithToolTip.java
 
b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/host/InterfaceLabelWithToolTip.java
index bbd060f..6687269 100644
--- 
a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/host/InterfaceLabelWithToolTip.java
+++ 
b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/host/InterfaceLabelWithToolTip.java
@@ -1,5 +1,7 @@
 package org.ovirt.engine.ui.webadmin.widget.host;
 
+import java.util.Arrays;
+import java.util.Collections;
 import java.util.Set;
 
 import 
org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface;
@@ -45,7 +47,10 @@
             return null;
         }
 
-        for (String label : labels) {
+        String[] sortedLabels = labels.toArray(new String[] {});
+        Arrays.sort(sortedLabels);
+
+        for (String label : sortedLabels) {
             if (isFirst) {
                 isFirst = false;
             } else {


-- 
To view, visit http://gerrit.ovirt.org/28885
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I28fb7750504bffdadd9d92f00565e21c272127ff
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Alona Kaplan <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to