Ramesh N has uploaded a new change for review.

Change subject: gluster: show warning in rebalance and remove brick
......................................................................

gluster: show warning in rebalance and remove brick

  Show a data loss warning message when users starts
rebalance or remove-brick.

Change-Id: I8cbf4043c848a26bdbc2a796ebe79f5af87b31f5
Bug-Url: https://bugzilla.redhat.com/1119629
Signed-off-by: Ramesh Nachimuthu <rnach...@redhat.com>
---
M 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/help/HelpTag.java
M 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/volumes/VolumeListModel.java
M 
frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/UIConstants.java
M 
frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/ApplicationConstants.java
M 
frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/gluster/RemoveBrickPopupView.java
M 
frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/gluster/RemoveBrickPopupView.ui.xml
6 files changed, 59 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/99/30199/1

diff --git 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/help/HelpTag.java
 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/help/HelpTag.java
index 9857a1c..b1b300e 100644
--- 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/help/HelpTag.java
+++ 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/help/HelpTag.java
@@ -432,6 +432,8 @@
 
     vnicProfiles("vnicProfiles", HelpTagType.UNKNOWN), //$NON-NLS-1$
 
+    rebalance_volume("rebalance_volume", HelpTagType.WEBADMIN, "Volumes Tab > 
Rebalance Volume"), //$NON-NLS-1$ //$NON-NLS-2$
+
     volume_rebalance_status("volume_rebalance_status", HelpTagType.WEBADMIN, 
"[gluster] Volumes main tab -> Show Rebalance Status dialog"), //$NON-NLS-1$ 
//$NON-NLS-2$
 
     volume_profile_statistics("volume_profile_statistics", 
HelpTagType.WEBADMIN, "[gluster] Volumes Main tab -> Profiling -> Details"), 
//$NON-NLS-1$ //$NON-NLS-2$
diff --git 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/volumes/VolumeListModel.java
 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/volumes/VolumeListModel.java
index 8d66440..8b81047 100644
--- 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/volumes/VolumeListModel.java
+++ 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/volumes/VolumeListModel.java
@@ -350,6 +350,39 @@
         model.getCommands().add(tempVar2);
     }
 
+    private void rebalanceVolume() {
+        if (getWindow() != null)
+        {
+            return;
+        }
+
+        ConfirmationModel model = new ConfirmationModel();
+        setWindow(model);
+        
model.setTitle(ConstantsManager.getInstance().getConstants().rebalanceVolumesTitle());
+        model.setHelpTag(HelpTag.rebalance_volume);
+        model.setHashName("rebalance_volume"); //$NON-NLS-1$
+        
model.setMessage(ConstantsManager.getInstance().getConstants().rebalanceVolumesMessage());
+        if (getSelectedItems() == null) {
+            return;
+        }
+
+        ArrayList<String> list = new ArrayList<String>();
+        for (GlusterVolumeEntity item : Linq.<GlusterVolumeEntity> 
cast(getSelectedItems()))
+        {
+            list.add(item.getName());
+        }
+        model.setItems(list);
+
+        UICommand onRebalanceCommand = new UICommand("OnRebalance", this); 
//$NON-NLS-1$
+        
onRebalanceCommand.setTitle(ConstantsManager.getInstance().getConstants().ok());
+        onRebalanceCommand.setIsDefault(true);
+        model.getCommands().add(onRebalanceCommand);
+        UICommand cancelCommand = new UICommand("Cancel", this); //$NON-NLS-1$
+        
cancelCommand.setTitle(ConstantsManager.getInstance().getConstants().cancel());
+        cancelCommand.setIsCancel(true);
+        model.getCommands().add(cancelCommand);
+    }
+
     private void onRemoveVolume() {
         if (getWindow() == null)
         {
@@ -569,6 +602,8 @@
         } else if (command.equals(getStopCommand())) {
             stop();
         } else if (command.equals(getStartRebalanceCommand())) {
+            rebalanceVolume();
+        } else if (command.equals("OnRebalance")) {  //$NON-NLS-1$
             startRebalance();
         } else if (command.equals(getStopRebalanceCommand())) {
             stopRebalance();
diff --git 
a/frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/UIConstants.java
 
b/frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/UIConstants.java
index ab3bfbb..74d3317 100644
--- 
a/frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/UIConstants.java
+++ 
b/frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/UIConstants.java
@@ -1,6 +1,5 @@
 package org.ovirt.engine.ui.uicompat;
 
-
 import com.google.gwt.i18n.client.Constants;
 import org.ovirt.engine.core.common.businessentities.VmPool;
 
@@ -1688,6 +1687,12 @@
     @DefaultStringValue("Stop Rebalance")
     String confirmStopVolumeRebalanceTitle();
 
+    @DefaultStringValue("Rebalance Volume")
+    String rebalanceVolumesTitle();
+
+    @DefaultStringValue("Rebalancing volume may result in data loss.\nAre you 
sure you want to rebalance the following Volume(s)?")
+    String rebalanceVolumesMessage();
+
     @DefaultStringValue("Disable Gluster Hooks")
     String confirmDisableGlusterHooks();
 
diff --git 
a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/ApplicationConstants.java
 
b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/ApplicationConstants.java
index 1f3d289..a3d67e3 100644
--- 
a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/ApplicationConstants.java
+++ 
b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/ApplicationConstants.java
@@ -2927,6 +2927,9 @@
     @DefaultStringValue("Please note that data will be lost if you choose not 
to migrate")
     String removeBricksWarning();
 
+    @DefaultStringValue("NOTE: Removing bricks with migration may result in 
data loss.")
+    String removeBrickDataMigrationWarning();
+
     // Volume Brick Details
     @DefaultStringValue("General")
     String generalBrickAdvancedPopupLabel();
diff --git 
a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/gluster/RemoveBrickPopupView.java
 
b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/gluster/RemoveBrickPopupView.java
index 6e6bbb1..8b00011 100644
--- 
a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/gluster/RemoveBrickPopupView.java
+++ 
b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/gluster/RemoveBrickPopupView.java
@@ -68,6 +68,8 @@
 
     private final Driver driver = GWT.create(Driver.class);
 
+    private final ApplicationConstants constants;
+
     @Inject
     public RemoveBrickPopupView(EventBus eventBus,
             ApplicationResources resources,
@@ -77,7 +79,8 @@
         initEditors(constants, resources, templates);
         initWidget(ViewUiBinder.uiBinder.createAndBindUi(this));
         ViewIdHandler.idHandler.generateAndSetIds(this);
-        localize(constants);
+        this.constants = constants;
+        localize();
         addStyles();
         driver.initialize(this);
     }
@@ -93,9 +96,9 @@
         migrateEditor.addContentWidgetStyleName(style.migrateOption());
     }
 
-    private void localize(ApplicationConstants constants) {
-        warningLabel.setText(constants.removeBricksWarning());
-        migrateEditor.setLabel(constants.removeBricksMigrateData());
+    private void localize() {
+        warningLabel.setText(this.constants.removeBricksWarning());
+        migrateEditor.setLabel(this.constants.removeBricksMigrateData());
     }
 
     @Override
@@ -127,7 +130,11 @@
         object.getMigrateData().getEntityChangedEvent().addListener(new 
IEventListener() {
             @Override
             public void eventRaised(Event ev, Object sender, EventArgs args) {
-                warningLabel.setVisible(!(Boolean) 
object.getMigrateData().getEntity());
+                if(object.getMigrateData().getEntity()){
+                    
warningLabel.setText(RemoveBrickPopupView.this.constants.removeBrickDataMigrationWarning());
+                }else{
+                    
warningLabel.setText(RemoveBrickPopupView.this.constants.removeBricksWarning());
+                }
             }
         });
     }
diff --git 
a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/gluster/RemoveBrickPopupView.ui.xml
 
b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/gluster/RemoveBrickPopupView.ui.xml
index 73fb09e..7227dbb 100644
--- 
a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/gluster/RemoveBrickPopupView.ui.xml
+++ 
b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/gluster/RemoveBrickPopupView.ui.xml
@@ -13,6 +13,7 @@
                .warningLabel {
                        color: #FF0000;
                        left: 10px;
+                       padding-top: 5px;
                }
 
                .itemsPanel {


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

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

Reply via email to