Yaniv Bronhaim has uploaded a new change for review. Change subject: Avoid updating fields when uneccessary ......................................................................
Avoid updating fields when uneccessary When filling lists of hosts the change event is raised. To avoid updating fields when we don't need it, do this update only in the right state - if discovered host form is enabled for example, this to avoid overriding the fields while fetching hosts info from foreman. Change-Id: I7de552c03e361b5186c6781eabd6dc4da34f9fb5 Signed-off-by: Yaniv Bronhaim <[email protected]> --- M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/NewHostModel.java 1 file changed, 16 insertions(+), 12 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/59/36159/1 diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/NewHostModel.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/NewHostModel.java index 79f66e2..b05fbc0 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/NewHostModel.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/NewHostModel.java @@ -82,23 +82,27 @@ // Define events: private void hostName_SelectedItemChanged() { - VDS vds = (VDS) getExternalHostName().getSelectedItem(); - if (vds == null) { - vds = new VDS(); + if (Boolean.FALSE.equals(getIsDiscoveredHosts().getEntity())) { + VDS vds = (VDS) getExternalHostName().getSelectedItem(); + if (vds == null) { + vds = new VDS(); + } + updateModelFromVds(vds, null, false, null); } - updateModelFromVds(vds, null, false, null); } private void discoverHostName_SelectedItemChanged() { - ExternalDiscoveredHost dhost = (ExternalDiscoveredHost) getExternalDiscoveredHosts().getSelectedItem(); - ExternalHostGroup dhg = (ExternalHostGroup) getExternalHostGroups().getSelectedItem(); - VDS vds = new VDS(); - if (dhost != null && dhg != null) { - vds.setVdsName(dhost.getName()); - vds.setHostName(dhost.getName() + "." + //$NON-NLS-1$ - (dhg.getDomainName() != null ? dhg.getDomainName() : constants.empty())); + if (Boolean.TRUE.equals(getIsDiscoveredHosts().getEntity())) { + ExternalDiscoveredHost dhost = (ExternalDiscoveredHost) getExternalDiscoveredHosts().getSelectedItem(); + ExternalHostGroup dhg = (ExternalHostGroup) getExternalHostGroups().getSelectedItem(); + VDS vds = new VDS(); + if (dhost != null && dhg != null) { + vds.setVdsName(dhost.getName()); + vds.setHostName(dhost.getName() + "." + //$NON-NLS-1$ + (dhg.getDomainName() != null ? dhg.getDomainName() : constants.empty())); + } + updateModelFromVds(vds, null, false, null); } - updateModelFromVds(vds, null, false, null); } private void externalHostGroups_SelectedItemChanged() { -- To view, visit http://gerrit.ovirt.org/36159 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I7de552c03e361b5186c6781eabd6dc4da34f9fb5 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Yaniv Bronhaim <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
