Tal Nisan has uploaded a new change for review.

Change subject: webadmin: Add ISO domain option in data center "Guide me" is 
missing
......................................................................

webadmin: Add ISO domain option in data center "Guide me" is missing

A bug in the guide me model caused the add ISO domain option in the data
center guide me to be only visible in case there is no ISO domain in the
whole setup, this is wrong since the user should be able to add a new ISO
to a data center regardless to whether another ISO already exists in the
system

Change-Id: I76c61f65e6cf7dbdaf631e2c9b7663f9dfffd16a
Bug-Url: https://bugzilla.redhat.com/1070152
Signed-off-by: Tal Nisan <[email protected]>
---
M 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/datacenters/DataCenterGuideModel.java
1 file changed, 23 insertions(+), 25 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/71/25171/1

diff --git 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/datacenters/DataCenterGuideModel.java
 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/datacenters/DataCenterGuideModel.java
index 950deb7..9e4a687 100644
--- 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/datacenters/DataCenterGuideModel.java
+++ 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/datacenters/DataCenterGuideModel.java
@@ -405,16 +405,6 @@
             getOptionalActions().add(attachDataStorageAction);
         }
 
-        UICommand addIsoStorageAction = new UICommand("AddIsoStorage", this); 
//$NON-NLS-1$
-        
addIsoStorageAction.getExecuteProhibitionReasons().add(NoDataDomainAttachedReason);
-        addIsoStorageAction.setIsExecutionAllowed(getEntity().getStatus() == 
StoragePoolStatus.Up);
-
-        if (isoStorageDomains.isEmpty())
-        {
-            addIsoStorageAction.setTitle(DataCenterConfigureISOLibraryAction);
-            getOptionalActions().add(addIsoStorageAction);
-        }
-
         // Attach ISO storage action.
         // Allow to attach ISO domain only when there are Data storages 
attached
         // and there ISO storages to attach and ther are no ISO storages 
actually
@@ -428,26 +418,34 @@
             }
         }
 
-        boolean attachIsoAllowed =
-                (attachedDataStorages.size() > 0 && 
Linq.isAnyStorageDomainIsMasterAndActive(attachedDataStorages)
-                        && isoStorageDomains.size() > 0 && 
attachedIsoStorages.isEmpty() && upHosts.size() > 0);
+        boolean attachOrAddIsoAvailable = attachedIsoStorages.isEmpty();
+        boolean masterStorageExistsAndRunning = 
Linq.isAnyStorageDomainIsMasterAndActive(attachedDataStorages);
+        boolean addIsoAllowed =
+                (attachedDataStorages.size() > 0 && 
masterStorageExistsAndRunning
+                        && attachedIsoStorages.isEmpty() && upHosts.size() > 
0);
 
-        // The action is available if there are no storages attached to the
-        // Data Center. It will not always be allowed.
-        boolean attachIsoAvailable = attachedIsoStorages.isEmpty();
 
-        UICommand attachIsoStorageAction = new UICommand("AttachIsoStorage", 
this); //$NON-NLS-1$
-        attachIsoStorageAction.setIsAvailable(attachIsoAvailable);
-        if (upHosts.isEmpty())
-        {
-            
attachIsoStorageAction.getExecuteProhibitionReasons().add(NoUpHostReason);
-        }
-        attachIsoStorageAction.setIsExecutionAllowed(attachIsoAllowed);
+        if (attachOrAddIsoAvailable) {
+            UICommand addIsoStorageAction = new UICommand("AddIsoStorage", 
this); //$NON-NLS-1$
+            addIsoStorageAction.setTitle(DataCenterConfigureISOLibraryAction);
+            getOptionalActions().add(addIsoStorageAction);
 
-        if (attachIsoAvailable)
-        {
+            UICommand attachIsoStorageAction = new 
UICommand("AttachIsoStorage", this); //$NON-NLS-1$
             attachIsoStorageAction.setTitle(DataCenterAttachISOLibraryAction);
             getOptionalActions().add(attachIsoStorageAction);
+
+            if (!masterStorageExistsAndRunning) {
+                
addIsoStorageAction.getExecuteProhibitionReasons().add(NoDataDomainAttachedReason);
+                
attachIsoStorageAction.getExecuteProhibitionReasons().add(NoDataDomainAttachedReason);
+            }
+
+            if (upHosts.isEmpty()) {
+                
addIsoStorageAction.getExecuteProhibitionReasons().add(NoUpHostReason);
+                
attachIsoStorageAction.getExecuteProhibitionReasons().add(NoUpHostReason);
+            }
+
+            addIsoStorageAction.setIsExecutionAllowed(addIsoAllowed);
+            attachIsoStorageAction.setIsExecutionAllowed(addIsoAllowed && 
isoStorageDomains.size() > 0);
         }
 
         stopProgress();


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

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

Reply via email to