Alona Kaplan has uploaded a new change for review.

Change subject: webadmin: Add confirm dialog to "save network configuration" 
(#823922)
......................................................................

webadmin: Add confirm dialog to "save network configuration" (#823922)

https://bugzilla.redhat.com/823922

The dialog should be added just to the "save network configuration" action
on SubTabHostInterface, not to the check box on (SetupNetwork, Add/Edit,
detach...)

Change-Id: Ic36412f1075b13ec34a4f959a4ab615ed18ae03e
Signed-off-by: Alona Kaplan <[email protected]>
---
M 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/HostInterfaceListModel.java
M 
frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/Constants.java
2 files changed, 57 insertions(+), 20 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/01/7501/1

diff --git 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/HostInterfaceListModel.java
 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/HostInterfaceListModel.java
index 1e2e499..3f67564 100644
--- 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/HostInterfaceListModel.java
+++ 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/HostInterfaceListModel.java
@@ -1232,8 +1232,7 @@
                                     ((HostManagementNetworkModel) 
hostInterfaceListModel.getcurrentModel()).getCommitChanges();
                             if ((Boolean) commitChanges.getEntity())
                             {
-                                
SaveNetworkConfig(hostInterfaceListModel.getEntity().getId(),
-                                        hostInterfaceListModel);
+                                SaveNetworkConfigInternalAction();
                             }
                             else
                             {
@@ -1594,8 +1593,7 @@
                                         ((HostBondInterfaceModel) 
hostInterfaceListModel.getcurrentModel()).getCommitChanges();
                                 if ((Boolean) commitChanges.getEntity())
                                 {
-                                    
SaveNetworkConfig(hostInterfaceListModel.getEntity().getId(),
-                                            hostInterfaceListModel);
+                                    SaveNetworkConfigInternalAction();
                                 }
                                 else
                                 {
@@ -1678,8 +1676,7 @@
                                         ((HostBondInterfaceModel) 
hostInterfaceListModel.getcurrentModel()).getCommitChanges();
                                 if ((Boolean) commitChanges.getEntity())
                                 {
-                                    
SaveNetworkConfig(hostInterfaceListModel.getEntity().getId(),
-                                            hostInterfaceListModel);
+                                    SaveNetworkConfigInternalAction();
                                 }
                                 else
                                 {
@@ -1765,8 +1762,7 @@
                                             ((HostInterfaceModel) 
hostInterfaceListModel.getcurrentModel()).getCommitChanges();
                                     if ((Boolean) commitChanges.getEntity())
                                     {
-                                        
SaveNetworkConfig(hostInterfaceListModel.getEntity().getId(),
-                                                hostInterfaceListModel);
+                                        SaveNetworkConfigInternalAction();
                                     }
                                     else
                                     {
@@ -1876,8 +1872,7 @@
                                                     ((HostInterfaceModel) 
hostInterfaceListModel.getcurrentModel()).getCommitChanges();
                                             if ((Boolean) 
commitChanges.getEntity())
                                             {
-                                                
SaveNetworkConfig(hostInterfaceListModel.getEntity().getId(),
-                                                        
hostInterfaceListModel);
+                                                
SaveNetworkConfigInternalAction();
                                             }
                                             else
                                             {
@@ -2005,8 +2000,7 @@
                                         ((HostInterfaceModel) 
hostInterfaceListModel.getcurrentModel()).getCommitChanges();
                                 if ((Boolean) commitChanges.getEntity())
                                 {
-                                    
SaveNetworkConfig(hostInterfaceListModel.getEntity().getId(),
-                                            hostInterfaceListModel);
+                                    SaveNetworkConfigInternalAction();
                                 }
                                 else
                                 {
@@ -2026,9 +2020,44 @@
         }
     }
 
-    public void SaveNetworkConfig(Guid vdsId, HostInterfaceListModel 
hostInterfaceListModel)
+    public void SaveNetworkConfig(){
+        if (getWindow() != null)
+        {
+            return;
+        }
+
+        ConfirmationModel model = new ConfirmationModel();
+        setWindow(model);
+        
model.setTitle(ConstantsManager.getInstance().getConstants().saveNetworkConfigurationTitle());
+        model.setHashName("save_network_configuration"); //$NON-NLS-1$
+        
model.setMessage(ConstantsManager.getInstance().getConstants().areYouSureYouWantToMakeTheChangesPersistentMsg());
+
+        UICommand tempVar = new UICommand("OnSaveNetworkConfig", this); 
//$NON-NLS-1$
+        tempVar.setTitle(ConstantsManager.getInstance().getConstants().ok());
+        tempVar.setIsDefault(true);
+        model.getCommands().add(tempVar);
+        UICommand tempVar2 = new UICommand("Cancel", this); //$NON-NLS-1$
+        
tempVar2.setTitle(ConstantsManager.getInstance().getConstants().cancel());
+        tempVar2.setIsCancel(true);
+        model.getCommands().add(tempVar2);
+    }
+
+    public void OnSaveNetworkConfig(){
+        ConfirmationModel model = (ConfirmationModel) getWindow();
+
+        if (model.getProgress() != null)
+        {
+            return;
+        }
+
+        model.StartProgress(null);
+        setcurrentModel(model);
+        SaveNetworkConfigInternalAction();
+    }
+
+    private void SaveNetworkConfigInternalAction()
     {
-        Frontend.RunAction(VdcActionType.CommitNetworkChanges, new 
VdsActionParameters(vdsId),
+        Frontend.RunAction(VdcActionType.CommitNetworkChanges, new 
VdsActionParameters(getEntity().getId()),
                 new IFrontendActionAsyncCallback() {
                     @Override
                     public void Executed(FrontendActionAsyncResult result) {
@@ -2046,7 +2075,7 @@
                         }
 
                     }
-                }, hostInterfaceListModel);
+                }, this);
     }
 
     public void OnConfirmManagementDetach()
@@ -2092,8 +2121,7 @@
                                             ((HostInterfaceModel) 
hostInterfaceListModel.getcurrentModel()).getCommitChanges();
                                     if ((Boolean) commitChanges.getEntity())
                                     {
-                                        
SaveNetworkConfig(hostInterfaceListModel.getEntity().getId(),
-                                                hostInterfaceListModel);
+                                        SaveNetworkConfigInternalAction();
                                     }
                                     else
                                     {
@@ -2184,8 +2212,7 @@
                     EntityModel commitChanges =model.getCommitChanges();
                     if ((Boolean) commitChanges.getEntity())
                     {
-                        SaveNetworkConfig(getEntity().getId(),
-                                HostInterfaceListModel.this);
+                        SaveNetworkConfigInternalAction();
                     }
                     else
                     {
@@ -2324,7 +2351,7 @@
         }
         else if (command == getSaveNetworkConfigCommand())
         {
-            SaveNetworkConfig(getEntity().getId(), this);
+            SaveNetworkConfig();
         }
 
         else if (StringHelper.stringsEqual(command.getName(), "OnSave")) 
//$NON-NLS-1$
@@ -2376,6 +2403,10 @@
         {
             OnSetupNetworks();
         }
+        else if (StringHelper.stringsEqual(command.getName(), 
"OnSaveNetworkConfig")) //$NON-NLS-1$
+        {
+            OnSaveNetworkConfig();
+        }
 
     }
 
diff --git 
a/frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/Constants.java
 
b/frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/Constants.java
index eb9c709..15cc3cc 100644
--- 
a/frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/Constants.java
+++ 
b/frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/Constants.java
@@ -133,6 +133,9 @@
     @DefaultStringValue("Attach/Detach Network to/from Clusters")
     String attachDetachNetworkToFromClustersTitle();
 
+    @DefaultStringValue("Save network configuration")
+    String saveNetworkConfigurationTitle();
+
     @DefaultStringValue("Storage")
     String storageTitle();
 
@@ -590,6 +593,9 @@
     @DefaultStringValue("You are about to attach the network to all the 
selected clusters and to detach the network from all the unselected 
clusters.\n\nAre you sure you want to continue?")
     String youAreAboutToAttachDetachNetworkToFromTheClustersMsg();
 
+    @DefaultStringValue("Changes done to the Networking configuration are 
temporary until explicitly saved.\n\nAre you sure you want to make the changes 
persistent?")
+    String areYouSureYouWantToMakeTheChangesPersistentMsg();
+
     @DefaultStringValue("Are you sure you want to Detach the following 
storage(s)?")
     String areYouSureYouWantDetachFollowingStoragesMsg();
 


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

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

Reply via email to