Gilad Chaplik has uploaded a new change for review. Change subject: frontend: remove useless server call at login ......................................................................
frontend: remove useless server call at login The webadmin login calls the async method IsBackendAvailable, which implemented by getDomainList Via Public, after this call we also call getDomainList ViaPublic, for actual domains. so the first call is redundant. Change-Id: I36be3aec58151fae408011ceab8155e3be672aec Signed-off-by: Gilad Chaplik <gchap...@redhat.com> --- M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/dataprovider/AsyncDataProvider.java M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/LoginModel.java 2 files changed, 17 insertions(+), 38 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/63/9663/1 diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/dataprovider/AsyncDataProvider.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/dataprovider/AsyncDataProvider.java index 35dba16..369ffa6 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/dataprovider/AsyncDataProvider.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/dataprovider/AsyncDataProvider.java @@ -139,19 +139,6 @@ Frontend.RunPublicQuery(VdcQueryType.GetDomainList, tempVar, aQuery); } - public static void IsBackendAvailable(AsyncQuery aQuery) { - aQuery.converterCallback = new IAsyncConverter() { - @Override - public Object Convert(Object source, AsyncQuery _asyncQuery) - { - return source != null; - } - }; - GetDomainListParameters tempVar = new GetDomainListParameters(); - tempVar.setFilterInternalDomain(true); - Frontend.RunPublicQuery(VdcQueryType.GetDomainList, tempVar, aQuery); - } - public static void IsCustomPropertiesAvailable(AsyncQuery aQuery, String version) { aQuery.converterCallback = new IAsyncConverter() { @Override diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/LoginModel.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/LoginModel.java index 92ec833..2410d4d 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/LoginModel.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/LoginModel.java @@ -176,12 +176,14 @@ setIsConnecting(true); AsyncQuery _asyncQuery = new AsyncQuery(); - _asyncQuery.setHandleFailure(true); + _asyncQuery.setModel(this); + _asyncQuery.setHandleFailure(true); _asyncQuery.asyncCallback = new INewAsyncCallback() { @Override public void OnSuccess(Object model, Object ReturnValue) { + setIsConnecting(false); LoginModel loginModel = (LoginModel) model; @@ -192,35 +194,25 @@ .couldNotConnectToOvirtEngineServiceMsg()); return; } - AsyncQuery _asyncQuery1 = new AsyncQuery(); - _asyncQuery1.setModel(loginModel); - _asyncQuery1.asyncCallback = new INewAsyncCallback() { - @Override - public void OnSuccess(Object model1, Object ReturnValue1) - { - LoginModel loginModel1 = (LoginModel) model1; - if (!loggingInAutomatically) { - // Don't enable the screen when we are in the process of logging in automatically. - // If this happens to be executed before the AutoLogin() is executed, - // it is not a problem, as the AutoLogin() will disable the screen by itself. - loginModel1.getLoginCommand().setIsExecutionAllowed(true); - loginModel1.getAboutCommand().setIsExecutionAllowed(true); - loginModel1.getUserName().setIsChangable(true); - loginModel1.getPassword().setIsChangable(true); - loginModel1.getDomain().setIsChangable(true); - } + if (!loggingInAutomatically) { + // Don't enable the screen when we are in the process of logging in automatically. + // If this happens to be executed before the AutoLogin() is executed, + // it is not a problem, as the AutoLogin() will disable the screen by itself. + loginModel.getLoginCommand().setIsExecutionAllowed(true); + loginModel.getAboutCommand().setIsExecutionAllowed(true); + loginModel.getUserName().setIsChangable(true); + loginModel.getPassword().setIsChangable(true); + loginModel.getDomain().setIsChangable(true); + } - List<String> domains = (List<String>) ReturnValue1; - loginModel1.getDomain().setSelectedItem(Linq.FirstOrDefault(domains)); - loginModel1.getDomain().setItems(domains); + List<String> domains = (List<String>) ReturnValue; + loginModel.getDomain().setSelectedItem(Linq.FirstOrDefault(domains)); + loginModel.getDomain().setItems(domains); - } - }; - AsyncDataProvider.GetDomainListViaPublic(_asyncQuery1, false); } }; - AsyncDataProvider.IsBackendAvailable(_asyncQuery); + AsyncDataProvider.GetDomainListViaPublic(_asyncQuery, false); } @Override -- To view, visit http://gerrit.ovirt.org/9663 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I36be3aec58151fae408011ceab8155e3be672aec Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Gilad Chaplik <gchap...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches