Lior Vernia has uploaded a new change for review. Change subject: webadmin: Fixed NIC sorting in Setup Networks popup ......................................................................
webadmin: Fixed NIC sorting in Setup Networks popup Added NIC sorting to Setup Networks popup window model using LexoNumericComparator, and removed lexicographic sorting in the corresponding view that would override the sensible ordering. Change-Id: I39928e5c56d110c9c36694e4fc78a2c943023961 Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=883269 Signed-off-by: Lior Vernia <[email protected]> --- M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/HostSetupNetworksModel.java M frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/host/HostSetupNetworksPopupView.java 2 files changed, 14 insertions(+), 1 deletion(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/49/12149/1 diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/HostSetupNetworksModel.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/HostSetupNetworksModel.java index 9eb6691..1a2be25 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/HostSetupNetworksModel.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/HostSetupNetworksModel.java @@ -3,6 +3,8 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; +import java.util.Collections; +import java.util.Comparator; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -17,6 +19,7 @@ import org.ovirt.engine.core.common.queries.IdQueryParameters; import org.ovirt.engine.core.common.queries.VdcQueryReturnValue; import org.ovirt.engine.core.common.queries.VdcQueryType; +import org.ovirt.engine.core.common.utils.LexoNumericComparator; import org.ovirt.engine.core.compat.KeyValuePairCompat; import org.ovirt.engine.core.compat.StringHelper; import org.ovirt.engine.ui.frontend.AsyncQuery; @@ -555,6 +558,17 @@ Map<String, List<String>> bondToNic = new HashMap<String, List<String>>(); Map<String, List<String>> nicToNetwork = new HashMap<String, List<String>>(); + Collections.sort(allNics, new Comparator<VdsNetworkInterface>() { + + private LexoNumericComparator lexoNumeric = new LexoNumericComparator(); + + @Override + public int compare(VdsNetworkInterface nic1, VdsNetworkInterface nic2) { + return lexoNumeric.compare(nic1.getName(), nic2.getName()); + } + + }); + // map all nics for (VdsNetworkInterface nic : allNics) { nicMap.put(nic.getName(), nic); diff --git a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/host/HostSetupNetworksPopupView.java b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/host/HostSetupNetworksPopupView.java index 0a73ad8..c3c0cd6 100644 --- a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/host/HostSetupNetworksPopupView.java +++ b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/host/HostSetupNetworksPopupView.java @@ -159,7 +159,6 @@ private void updateNics(List<NetworkInterfaceModel> nics) { nicList.clear(); - Collections.sort(nics); List<NetworkGroup> groups = new ArrayList<NetworkGroup>(); for (NetworkInterfaceModel nic : nics) { groups.add(new NetworkGroup(nic, style)); -- To view, visit http://gerrit.ovirt.org/12149 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I39928e5c56d110c9c36694e4fc78a2c943023961 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Lior Vernia <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
