Daniel Erez has uploaded a new change for review.

Change subject: webadmin: About dialog - remove redundant code
......................................................................

webadmin: About dialog - remove redundant code

Removing dead code from AboutModel/AboutPopup.

Change-Id: I82e99e5b48866be7c40d5085195eea3298de36aa
Signed-off-by: Daniel Erez <[email protected]>
---
M 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/CommonModel.java
M 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/LoginModel.java
M 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/common/AboutModel.java
M 
frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/section/main/presenter/AboutPopupPresenterWidget.java
M 
frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/presenter/AboutPopupPresenterWidget.java
5 files changed, 2 insertions(+), 324 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/56/12956/1

diff --git 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/CommonModel.java
 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/CommonModel.java
index 33dff35..90db2ec 100644
--- 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/CommonModel.java
+++ 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/CommonModel.java
@@ -710,7 +710,6 @@
 
         AboutModel model = new AboutModel();
         setWindow(model);
-        model.setShowOnlyVersion(false);
         
model.setTitle(ConstantsManager.getInstance().getConstants().aboutOVirtEngineTitle());
         model.setHashName("about_rhev_manager"); //$NON-NLS-1$
 
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 7017039..5e3a212 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
@@ -364,7 +364,6 @@
         setWindow(model);
         
model.setTitle(ConstantsManager.getInstance().getConstants().aboutOVirtEngineTitle());
         model.setHashName("about_rhev_manager"); //$NON-NLS-1$
-        model.setShowOnlyVersion(true);
 
         UICommand tempVar = new UICommand("Cancel", this); //$NON-NLS-1$
         
tempVar.setTitle(ConstantsManager.getInstance().getConstants().close());
diff --git 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/common/AboutModel.java
 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/common/AboutModel.java
index 5f81d7f..459c349 100644
--- 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/common/AboutModel.java
+++ 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/common/AboutModel.java
@@ -1,309 +1,10 @@
 package org.ovirt.engine.ui.uicommonweb.models.common;
 
-import java.util.ArrayList;
-import java.util.List;
-
-import org.ovirt.engine.core.common.businessentities.VDS;
-import org.ovirt.engine.core.compat.StringHelper;
-import org.ovirt.engine.ui.frontend.AsyncQuery;
-import org.ovirt.engine.ui.frontend.INewAsyncCallback;
-import org.ovirt.engine.ui.uicommonweb.UICommand;
-import org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider;
 import org.ovirt.engine.ui.uicommonweb.models.Model;
-import org.ovirt.engine.ui.uicompat.Clipboard;
-import org.ovirt.engine.ui.uicompat.ConstantsManager;
-import org.ovirt.engine.ui.uicompat.PropertyChangedEventArgs;
 
-@SuppressWarnings("unused")
-public class AboutModel extends Model
-{
+public class AboutModel extends Model {
 
-    private List<HostInfo> hosts;
-
-    public List<HostInfo> getHosts()
-    {
-        return hosts;
+    public AboutModel() {
     }
 
-    public void setHosts(List<HostInfo> value)
-    {
-        if (hosts != value)
-        {
-            hosts = value;
-            OnPropertyChanged(new PropertyChangedEventArgs("Hosts")); 
//$NON-NLS-1$
-        }
-    }
-
-    private boolean showOnlyVersion;
-
-    public boolean getShowOnlyVersion()
-    {
-        return showOnlyVersion;
-    }
-
-    public void setShowOnlyVersion(boolean value)
-    {
-        if (showOnlyVersion != value)
-        {
-            showOnlyVersion = value;
-            ShowOnlyVersionChanged();
-            OnPropertyChanged(new 
PropertyChangedEventArgs("ShowOnlyVersion")); //$NON-NLS-1$
-        }
-    }
-
-    private String productVersion;
-
-    public String getProductVersion()
-    {
-        return productVersion;
-    }
-
-    public void setProductVersion(String value)
-    {
-        if (!StringHelper.stringsEqual(productVersion, value))
-        {
-            productVersion = value;
-            OnPropertyChanged(new PropertyChangedEventArgs("ProductVersion")); 
//$NON-NLS-1$
-        }
-    }
-
-    // public string Enterprise { get; private set; }
-
-    // public string Description { get; private set; }
-
-    // public string CustomerId { get; private set; }
-
-    // public string Limitations { get; private set; }
-
-    // public string TimeLimit { get; private set; }
-
-    // public string CPUSockets { get; private set; }
-
-    private UICommand privateCopyToClipboardCommand;
-
-    public UICommand getCopyToClipboardCommand()
-    {
-        return privateCopyToClipboardCommand;
-    }
-
-    public void setCopyToClipboardCommand(UICommand value)
-    {
-        privateCopyToClipboardCommand = value;
-    }
-
-    public AboutModel()
-    {
-        // var licenseProperties = DataProvider.GetLicenseProperties();
-        // Enterprise = licenseProperties.ContainsKey("EnterpriseProperty") ? 
licenseProperties["EnterpriseProperty"] :
-        // string.Empty;
-        // Description = licenseProperties.ContainsKey("DescriptionProperty") 
? licenseProperties["DescriptionProperty"]
-        // : string.Empty;
-        // CustomerId = licenseProperties.ContainsKey("CustomerIdProperty") ? 
licenseProperties["CustomerIdProperty"] :
-        // string.Empty;
-
-        // //Build limitations text.
-        // int allowedConcurrentDesktops =
-        // 
licenseProperties.ContainsKey("MaxConcurrentlyRunningDesktopsProperty") &&
-        // 
!string.IsNullOrEmpty(licenseProperties["MaxConcurrentlyRunningDesktopsProperty"])
 ?
-        // 
Convert.ToInt32(licenseProperties["MaxConcurrentlyRunningDesktopsProperty"]) :
-        // 0;
-
-        // var returnValue = Frontend.RunQuery(VdcQueryType.GetResourceUsage,
-        // new GetResourceUsageParameters("MaxConcurrentlyRunningDesktops"));
-
-        // int currentConcurrentDesktops = (returnValue != null && 
returnValue.Succeeded)
-        // ? (Integer)returnValue.ReturnValue
-        // : 0;
-
-        // if (allowedConcurrentDesktops > 0)
-        // {
-        // Limitations = StringFormat.format("There are currently {0} running 
Virtual Machines out of possible {1}.",
-        // currentConcurrentDesktops,
-        // allowedConcurrentDesktops
-        // );
-        // }
-
-        // //Build time limit text.
-        // bool isProduct = licenseProperties.ContainsKey("IsProductProperty") 
&&
-        // !string.IsNullOrEmpty(licenseProperties["IsProductProperty"])
-        // ? Convert.ToBoolean(licenseProperties["IsProductProperty"])
-        // : false;
-
-        // if (licenseProperties.ContainsKey("TimeLimitProperty") &&
-        // !string.IsNullOrEmpty(licenseProperties["TimeLimitProperty"]))
-        // {
-
-        // DateTime timeLimit = DateTime.Now;
-        // if (licenseProperties["TimeLimitProperty"].Equals("0"))
-        // {
-        // TimeLimit = "Product Support period is unlimited.";
-        // }
-        // else
-        // {
-        // try
-        // {
-        // timeLimit = 
Convert.ToDateTime(licenseProperties["TimeLimitProperty"]);
-        // }
-        // catch {
-        // QLogger.getInstance().ErrorFormat("AboutModel(AboutView view): 
cannot convert {0} cause bugous license expire date received",
-        // licenseProperties["TimeLimitProperty"]); }
-        // if (isProduct)
-        // {
-        // bool isSupported = 
licenseProperties.ContainsKey("IsSupportedProperty")
-        // ? Convert.ToBoolean(licenseProperties["IsSupportedProperty"])
-        // : false;
-
-        // TimeLimit = isSupported
-        // ? StringFormat.format("Product Support period will expire at {0}.", 
timeLimit)
-        // : StringFormat.format("Product Support period has expired at {0}.", 
timeLimit);
-        // }
-        // else
-        // {
-        // TimeLimit = StringFormat.format("This evaluation version will 
expire at {0}.", timeLimit);
-        // }
-        // }
-        // }
-
-        // if (licenseProperties.ContainsKey("MaxHostSocketsProperty") &&
-        // !string.IsNullOrEmpty(licenseProperties["MaxHostSocketsProperty"]))
-        // {
-        // VdcQueryReturnValue ret = 
Frontend.RunQuery(VdcQueryType.GetResourceUsage, new
-        // GetResourceUsageParameters("MaxHostSockets"));
-        // if (ret != null && ret.Succeeded)
-        // {
-        // if 
(string.IsNullOrEmpty(licenseProperties["MaxHostSocketsProperty"]) ||
-        // int.Parse(licenseProperties["MaxHostSocketsProperty"]) == 0)
-        // {
-        // CPUSockets = StringFormat.format("{0}(unlimited)", 
(int)ret.ReturnValue);
-        // }
-        // else
-        // {
-        // CPUSockets = StringFormat.format("{0}(out of {1} supported by 
license)", (int)ret.ReturnValue,
-        // licenseProperties["MaxHostSocketsProperty"]);
-        // }
-        // }
-        // }
-
-        UICommand command = new UICommand("CopyToClipboard", this); 
//$NON-NLS-1$
-        
command.setTitle(ConstantsManager.getInstance().getConstants().copytoClipboardTitle());
-        command.setIsAvailable(true);
-        setCopyToClipboardCommand(command);
-        getCommands().add(getCopyToClipboardCommand());
-
-        setShowOnlyVersion(true);
-
-        AsyncDataProvider.GetRpmVersionViaPublic(new AsyncQuery(this, new 
INewAsyncCallback() {
-            @Override
-            public void OnSuccess(Object model, Object returnValue) {
-
-                AboutModel aboutModel = (AboutModel) model;
-                aboutModel.setProductVersion((String) returnValue);
-            }
-        }));
-    }
-
-    private void ShowOnlyVersionChanged() {
-
-        if (!getShowOnlyVersion()) {
-
-            AsyncDataProvider.GetHostList(new AsyncQuery(this, new 
INewAsyncCallback() {
-                @Override
-                public void OnSuccess(Object model, Object returnValue) {
-
-                    AboutModel aboutModel = (AboutModel) model;
-                    ArrayList<HostInfo> list = new ArrayList<HostInfo>();
-
-                    for (VDS a : (List<VDS>) returnValue) {
-
-                        HostInfo item = new HostInfo();
-                        item.setHostName(a.getName() + ":"); //$NON-NLS-1$
-
-                        if (!StringHelper.isNullOrEmpty(a.getHostOs())) {
-                            
item.setOSVersion(ConstantsManager.getInstance().getConstants().osVersionAbout()
-                                + " " + a.getHostOs()); //$NON-NLS-1$
-                        }
-
-                        if (a.getVersion() != null) {
-                            
item.setVDSMVersion(ConstantsManager.getInstance().getConstants().VDSMVersionAbout()
 + " " //$NON-NLS-1$
-                                + a.getVersion().getRpmName() + " " 
//$NON-NLS-1$
-                                + a.getVersion());
-                        }
-
-                        list.add(item);
-                    }
-                    aboutModel.setHosts(list);
-                }
-            }));
-        }
-    }
-
-    public void CopyToClipboard() {
-        String data = BuildClipboardData();
-        CopyToClipboard(data);
-    }
-
-    private String BuildClipboardData()
-    {
-        StringBuilder sb = new StringBuilder();
-        sb.append(getRpmVersion());
-        if (getShowOnlyVersion() == false)
-        {
-            sb.append("\n"); //$NON-NLS-1$
-            sb.append(ConstantsManager.getInstance()
-                    .getConstants()
-                    
.oVirtEnterpriseVirtualizationEngineHypervisorHostsAbout());
-
-            if (getHosts() != null && getHosts().size() > 0)
-            {
-                for (HostInfo item : getHosts())
-                {
-                    sb.append("\t" + item.getHostName() //$NON-NLS-1$
-                            + "\t" + item.getOSVersion() //$NON-NLS-1$
-                            + "\t" + item.getVDSMVersion()); //$NON-NLS-1$
-                    sb.append("\n"); //$NON-NLS-1$
-                }
-            }
-            else
-            {
-                
sb.append(ConstantsManager.getInstance().getConstants().noHostsAbout());
-            }
-
-            // sb.append();
-            // sb.append("License Information:");
-            // sb.Append("\tEnterprise:\t").append(Enterprise);
-            // sb.Append("\tDescription:\t").append(Description);
-            // sb.Append("\tLicense ID:\t").append(CustomerId);
-            // sb.Append("\tUsed CPU Sockets:\t").append(CPUSockets);
-            // if (Limitations != null)
-            // {
-            // sb.Append("\tLimitations:\t").append(Limitations);
-            // }
-            // sb.append();
-            // sb.append(TimeLimit);
-
-        }
-        return sb.toString();
-    }
-
-    protected void CopyToClipboard(String data)
-    {
-        Clipboard.SetDataObject(data);
-    }
-
-    @Override
-    public void ExecuteCommand(UICommand command)
-    {
-        super.ExecuteCommand(command);
-
-        if (command == getCopyToClipboardCommand())
-        {
-            CopyToClipboard();
-        }
-    }
-
-    private String getRpmVersion()
-    {
-        return 
ConstantsManager.getInstance().getConstants().oVirtEngineForServersAndDesktopsAbout()
-                + " " + getProductVersion(); //$NON-NLS-1$
-    }
 }
diff --git 
a/frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/section/main/presenter/AboutPopupPresenterWidget.java
 
b/frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/section/main/presenter/AboutPopupPresenterWidget.java
index 8d66d31..f820a4e 100644
--- 
a/frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/section/main/presenter/AboutPopupPresenterWidget.java
+++ 
b/frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/section/main/presenter/AboutPopupPresenterWidget.java
@@ -1,11 +1,7 @@
 package org.ovirt.engine.ui.userportal.section.main.presenter;
 
-import org.ovirt.engine.core.common.queries.ConfigurationValues;
-import org.ovirt.engine.core.common.queries.GetConfigurationValueParameters;
-import org.ovirt.engine.core.common.queries.VdcQueryType;
 import org.ovirt.engine.ui.common.presenter.AbstractPopupPresenterWidget;
 import org.ovirt.engine.ui.frontend.AsyncQuery;
-import org.ovirt.engine.ui.frontend.Frontend;
 import org.ovirt.engine.ui.frontend.INewAsyncCallback;
 import org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider;
 
@@ -31,12 +27,6 @@
     @Override
     protected void onReveal() {
         super.onReveal();
-
-        AsyncQuery aQuery = new AsyncQuery();
-
-        Frontend.RunPublicQuery(VdcQueryType.GetConfigurationValue,
-                new 
GetConfigurationValueParameters(ConfigurationValues.VdcVersion, 
AsyncDataProvider.getDefaultConfigurationVersion()),
-                aQuery);
 
         AsyncQuery _asyncQuery = new AsyncQuery();
         _asyncQuery.setModel(this);
diff --git 
a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/presenter/AboutPopupPresenterWidget.java
 
b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/presenter/AboutPopupPresenterWidget.java
index c463b98..13d9036 100644
--- 
a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/presenter/AboutPopupPresenterWidget.java
+++ 
b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/presenter/AboutPopupPresenterWidget.java
@@ -1,11 +1,7 @@
 package org.ovirt.engine.ui.webadmin.section.main.presenter;
 
-import org.ovirt.engine.core.common.queries.ConfigurationValues;
-import org.ovirt.engine.core.common.queries.GetConfigurationValueParameters;
-import org.ovirt.engine.core.common.queries.VdcQueryType;
 import org.ovirt.engine.ui.common.presenter.AbstractPopupPresenterWidget;
 import org.ovirt.engine.ui.frontend.AsyncQuery;
-import org.ovirt.engine.ui.frontend.Frontend;
 import org.ovirt.engine.ui.frontend.INewAsyncCallback;
 import org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider;
 
@@ -31,13 +27,6 @@
     @Override
     protected void onReveal() {
         super.onReveal();
-
-        AsyncQuery aQuery = new AsyncQuery();
-
-        Frontend.RunPublicQuery(VdcQueryType.GetConfigurationValue,
-                new 
GetConfigurationValueParameters(ConfigurationValues.VdcVersion,
-                        AsyncDataProvider.getDefaultConfigurationVersion()),
-                aQuery);
 
         AsyncQuery _asyncQuery = new AsyncQuery();
         _asyncQuery.setModel(this);


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

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

Reply via email to