Arik Hadas has uploaded a new change for review.

Change subject: webadmin: fix import-vm from vms grid
......................................................................

webadmin: fix import-vm from vms grid

Class-cast exception occurred when import VM from the VMs grid. This
patch fixes it by changing the code that is executed after triggering
the import operation so that no popup will be displayed when the dialog
is closed. That is ok because we are not used to show such dialogs that
tell the user that there are tasks in the background so we can decide
not to show one for the new import dialog which is triggered from the
VMs-grid.

Change-Id: I4f505975e4301594aadbb16cbda3a613c4390888
Signed-off-by: Arik Hadas <aha...@redhat.com>
---
M 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VmListModel.java
1 file changed, 2 insertions(+), 50 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/10/40110/1

diff --git 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VmListModel.java
 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VmListModel.java
index e7f9d42..ecd172c 100644
--- 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VmListModel.java
+++ 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VmListModel.java
@@ -50,7 +50,6 @@
 import org.ovirt.engine.core.common.queries.VdcQueryType;
 import org.ovirt.engine.core.common.utils.ObjectUtils;
 import org.ovirt.engine.core.compat.Guid;
-import org.ovirt.engine.core.compat.StringHelper;
 import org.ovirt.engine.core.compat.Version;
 import org.ovirt.engine.core.searchbackend.SearchObjects;
 import org.ovirt.engine.ui.frontend.AsyncQuery;
@@ -2549,58 +2548,11 @@
         importVmModel.importVms(
                 new IFrontendMultipleActionAsyncCallback() {
                     @Override
-                    public void executed(
-                            FrontendMultipleActionAsyncResult result) {
-
-                        VmListModel<Void> vmListModel = (VmListModel<Void>) 
result.getState();
-                        vmListModel.stopProgress();
-                        vmListModel.setConfirmWindow(null);
-                        vmListModel.setWindow(null);
-                        vmListModel.clearCachedAssignedVmNames();
-                        List<VdcReturnValueBase> retVals =
-                                result.getReturnValue();
-                        if (retVals != null
-                                && vmListModel.getSelectedItems().size() == 
retVals
-                                        .size()) {
-                            StringBuilder importedVms = new StringBuilder();
-                            int counter = 0;
-                            boolean toShowConfirmWindow = false;
-                            for (Object item : vmListModel.getSelectedItems()) 
{
-                                VM vm = (VM) item;
-                                if (retVals.get(counter) != null
-                                        && 
retVals.get(counter).getCanDoAction()) {
-                                    importedVms.append(vm.getName()).append(", 
"); //$NON-NLS-1$
-                                    toShowConfirmWindow = true;
-                                }
-                                counter++;
-                            }
-                            // show the confirm window only if the import has 
been successfully started for at least one
-                            // VM
-                            if (toShowConfirmWindow) {
-                                ConfirmationModel confirmModel = new 
ConfirmationModel();
-                                vmListModel.setConfirmWindow(confirmModel);
-                                
confirmModel.setTitle(ConstantsManager.getInstance()
-                                        .getConstants()
-                                        .importVirtualMachinesTitle());
-                                
confirmModel.setHelpTag(HelpTag.import_virtual_machine);
-                                
confirmModel.setHashName("import_virtual_machine"); //$NON-NLS-1$
-                                
confirmModel.setMessage(ConstantsManager.getInstance()
-                                        .getMessages()
-                                        
.importProcessHasBegunForVms(StringHelper.trimEnd(importedVms.toString().trim(),
 ',')));
-                                UICommand tempVar2 = new 
UICommand("CancelConfirm", //$NON-NLS-1$
-                                        vmListModel);
-                                
tempVar2.setTitle(ConstantsManager.getInstance().getConstants().close());
-                                tempVar2.setIsDefault(true);
-                                tempVar2.setIsCancel(true);
-                                confirmModel.getCommands().add(tempVar2);
-                            }
-                        }
-
+                    public void executed(FrontendMultipleActionAsyncResult 
result) {
+                        VmListModel.this.setWindow(null);
                     }
                 },
                 cloneObjectMap);
-
-        setWindow(null);
     }
 
     private void onImportVmAsClone(ImportVmFromExportDomainModel importModel) {


-- 
To view, visit https://gerrit.ovirt.org/40110
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4f505975e4301594aadbb16cbda3a613c4390888
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Arik Hadas <aha...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to