Kanagaraj M has uploaded a new change for review.

Change subject: webadmin: manage gluster swift services
......................................................................

webadmin: manage gluster swift services

.

Change-Id: I43681486dd8f1e1d380a68c45f2e094a5c128ade
Signed-off-by: Kanagaraj M <kmayi...@redhat.com>
---
M 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/clusters/ClusterGeneralModel.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/tab/cluster/ClusterGeneralModelForm.java
M 
frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/tab/cluster/SubTabClusterGeneralView.java
M 
frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/tab/cluster/SubTabClusterGeneralView.ui.xml
5 files changed, 103 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/63/15263/1

diff --git 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/clusters/ClusterGeneralModel.java
 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/clusters/ClusterGeneralModel.java
index 5a4c858..7fdd725 100644
--- 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/clusters/ClusterGeneralModel.java
+++ 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/clusters/ClusterGeneralModel.java
@@ -11,6 +11,7 @@
 import org.ovirt.engine.core.common.businessentities.MigrateOnErrorOptions;
 import org.ovirt.engine.core.common.businessentities.VDS;
 import org.ovirt.engine.core.common.businessentities.VDSGroup;
+import 
org.ovirt.engine.core.common.businessentities.gluster.GlusterServiceStatus;
 import org.ovirt.engine.core.common.businessentities.gluster.GlusterStatus;
 import 
org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity;
 import org.ovirt.engine.core.common.queries.IdQueryParameters;
@@ -62,6 +63,26 @@
 
     public void setNoOfVolumesDown(Integer noOfVolumesDown) {
         this.noOfVolumesDown = noOfVolumesDown;
+    }
+
+    private GlusterServiceStatus glusterSwiftStatus;
+
+    public GlusterServiceStatus getGlusterSwiftStatus() {
+        return glusterSwiftStatus;
+    }
+
+    public void setGlusterSwiftStatus(GlusterServiceStatus glusterSwiftStatus) 
{
+        this.glusterSwiftStatus = glusterSwiftStatus;
+    }
+
+    private UICommand manageGlusterSwiftCommand;
+
+    public UICommand getManageGlusterSwiftCommand() {
+        return manageGlusterSwiftCommand;
+    }
+
+    public void setManageGlusterSwiftCommand(UICommand 
manageGlusterSwiftCommand) {
+        this.manageGlusterSwiftCommand = manageGlusterSwiftCommand;
     }
 
     private boolean hasAnyAlert;
@@ -160,6 +181,8 @@
         setNoOfVolumesTotal(0);
         setNoOfVolumesUp(0);
         setNoOfVolumesDown(0);
+        setGlusterSwiftStatus(GlusterServiceStatus.UNKNOWN);
+        setManageGlusterSwiftCommand(new UICommand("ManageGlusterSwift", 
this)); //$NON-NLS-1$
 
         setConsoleAddressPartiallyOverridden(false);
         setImportNewGlusterHostsCommand(new UICommand("ImportGlusterHosts", 
this)); //$NON-NLS-1$
@@ -173,7 +196,7 @@
 
         if (getEntity() != null)
         {
-            updateVolumeDetails();
+            updateGlusterDetails();
             updateAlerts();
             updateConsoleAddressPartiallyOverridden(getEntity());
             updateProperties();
@@ -211,6 +234,10 @@
                 new IdQueryParameters(cluster.getId()),
                 query
                 );
+    }
+
+    private void manageGlusterSwiftServices() {
+
     }
 
     public void fetchAndImportNewGlusterHosts() {
@@ -407,7 +434,7 @@
     }
 
 
-    private void updateVolumeDetails()
+    private void updateGlusterDetails()
     {
         AsyncQuery _asyncQuery = new AsyncQuery();
         _asyncQuery.setModel(this);
@@ -435,6 +462,8 @@
             }
         };
         AsyncDataProvider.getVolumeList(_asyncQuery, getEntity().getname());
+
+        setGlusterSwiftStatus(GlusterServiceStatus.RUNNING);
     }
 
     private void updateAlerts()
@@ -475,7 +504,11 @@
     {
         super.executeCommand(command);
 
-        if (command == getImportNewGlusterHostsCommand())
+        if (command == getManageGlusterSwiftCommand())
+        {
+            manageGlusterSwiftServices();
+        }
+        else if (command == getImportNewGlusterHostsCommand())
         {
             fetchAndImportNewGlusterHosts();
         }
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 6f09656..4847ca1 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
@@ -691,6 +691,12 @@
     @DefaultStringValue("No. Of Volumes Down")
     String clusterVolumesDownLabel();
 
+    @DefaultStringValue("Gluster Swift Status: ")
+    String clusterGlusterSwiftLabel();
+
+    @DefaultStringValue("Manage")
+    String clusterGlusterSwiftManageLabel();
+
     @DefaultStringValue("Policy:")
     String clusterPolicyPolicyLabel();
 
diff --git 
a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/tab/cluster/ClusterGeneralModelForm.java
 
b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/tab/cluster/ClusterGeneralModelForm.java
index 787b80f..ecc1233 100644
--- 
a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/tab/cluster/ClusterGeneralModelForm.java
+++ 
b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/tab/cluster/ClusterGeneralModelForm.java
@@ -1,11 +1,13 @@
 package org.ovirt.engine.ui.webadmin.section.main.view.tab.cluster;
 
+import 
org.ovirt.engine.core.common.businessentities.gluster.GlusterServiceStatus;
 import org.ovirt.engine.core.common.mode.ApplicationMode;
 import org.ovirt.engine.ui.common.uicommon.model.ModelProvider;
 import org.ovirt.engine.ui.common.widget.form.FormItem;
 import org.ovirt.engine.ui.common.widget.form.FormItem.DefaultValueCondition;
 import org.ovirt.engine.ui.common.widget.label.BooleanLabel;
 import org.ovirt.engine.ui.common.widget.label.ClusterTypeLabel;
+import org.ovirt.engine.ui.common.widget.label.EnumLabel;
 import org.ovirt.engine.ui.common.widget.label.MemorySizeLabel;
 import org.ovirt.engine.ui.common.widget.label.ResiliencePolicyLabel;
 import org.ovirt.engine.ui.common.widget.label.TextBoxLabel;
@@ -33,6 +35,7 @@
     TextBoxLabel noOfVolumesTotal = new TextBoxLabel();
     TextBoxLabel noOfVolumesUp = new TextBoxLabel();
     TextBoxLabel noOfVolumesDown = new TextBoxLabel();
+    EnumLabel<GlusterServiceStatus> glusterSwiftStatus = new 
EnumLabel<GlusterServiceStatus>();
     TextBoxLabel compatibilityVersion = new TextBoxLabel();
 
     private final Driver driver = GWT.create(Driver.class);
diff --git 
a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/tab/cluster/SubTabClusterGeneralView.java
 
b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/tab/cluster/SubTabClusterGeneralView.java
index cd83a1c..34ab948 100644
--- 
a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/tab/cluster/SubTabClusterGeneralView.java
+++ 
b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/tab/cluster/SubTabClusterGeneralView.java
@@ -5,6 +5,8 @@
 import org.ovirt.engine.core.common.businessentities.VDSGroup;
 import org.ovirt.engine.ui.common.uicommon.model.DetailModelProvider;
 import org.ovirt.engine.ui.common.view.AbstractSubTabFormView;
+import org.ovirt.engine.ui.common.widget.UiCommandButton;
+import org.ovirt.engine.ui.common.widget.editor.EntityModelLabelEditor;
 import org.ovirt.engine.ui.common.widget.form.FormBuilder;
 import org.ovirt.engine.ui.uicommonweb.models.clusters.ClusterGeneralModel;
 import org.ovirt.engine.ui.uicommonweb.models.clusters.ClusterListModel;
@@ -19,10 +21,14 @@
 import com.google.gwt.core.client.GWT;
 import com.google.gwt.editor.client.Editor;
 import com.google.gwt.editor.client.SimpleBeanEditorDriver;
+import com.google.gwt.event.dom.client.ClickEvent;
+import com.google.gwt.event.dom.client.ClickHandler;
+import com.google.gwt.resources.client.CssResource;
 import com.google.gwt.uibinder.client.UiBinder;
 import com.google.gwt.uibinder.client.UiField;
 import com.google.gwt.user.client.ui.FlowPanel;
 import com.google.gwt.user.client.ui.HTMLPanel;
+import com.google.gwt.user.client.ui.HorizontalPanel;
 import com.google.gwt.user.client.ui.Widget;
 
 public class SubTabClusterGeneralView extends AbstractSubTabFormView<VDSGroup, 
ClusterListModel, ClusterGeneralModel>
@@ -38,11 +44,23 @@
     // to find the icon for alert messages:
     private final ApplicationResources resources;
 
+    @UiField
+    WidgetStyle style;
+
     @UiField(provided = true)
     @Ignore
     ClusterGeneralModelForm form;
 
     FormBuilder formBuilder;
+
+    @UiField
+    HorizontalPanel glusterSwiftPanel;
+
+    @UiField
+    EntityModelLabelEditor glusterSwiftStatusEditor;
+
+    @UiField
+    UiCommandButton manageGlusterSwiftButton;
 
     @UiField
     HTMLPanel alertsPanel;
@@ -67,6 +85,8 @@
         this.form = new ClusterGeneralModelForm(modelProvider, constants);
 
         initWidget(ViewUiBinder.uiBinder.createAndBindUi(this));
+        localize();
+        addStyles();
 
         modelProvider.getModel().getEntityChangedEvent().addListener(new 
IEventListener() {
             @Override
@@ -79,13 +99,31 @@
             }
         });
 
+        manageGlusterSwiftButton.addClickHandler(new ClickHandler() {
+            @Override
+            public void onClick(ClickEvent event) {
+                if (getDetailModel() != null) {
+                    getDetailModel().getManageGlusterSwiftCommand().execute();
+                }
+            }
+        });
         driver.initialize(this);
+    }
+
+    private void localize() {
+        
glusterSwiftStatusEditor.setLabel(constants.clusterGlusterSwiftLabel());
+        
manageGlusterSwiftButton.setLabel(constants.clusterGlusterSwiftManageLabel());
+    }
+
+    private void addStyles() {
+        
glusterSwiftStatusEditor.addContentWidgetStyleName(style.glusterSwiftStatus());
     }
 
     @Override
     public void setMainTabSelectedItem(VDSGroup selectedItem) {
         driver.edit(getDetailModel());
         form.update();
+        glusterSwiftPanel.setVisible(selectedItem.supportsGlusterService());
     }
 
     @Override
@@ -105,4 +143,7 @@
         }
     }
 
+    interface WidgetStyle extends CssResource {
+        String glusterSwiftStatus();
+    }
 }
diff --git 
a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/tab/cluster/SubTabClusterGeneralView.ui.xml
 
b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/tab/cluster/SubTabClusterGeneralView.ui.xml
index 5bd3466..e5c8782 100644
--- 
a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/tab/cluster/SubTabClusterGeneralView.ui.xml
+++ 
b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/tab/cluster/SubTabClusterGeneralView.ui.xml
@@ -3,11 +3,12 @@
 <ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder" 
xmlns:g="urn:import:com.google.gwt.user.client.ui"
        xmlns:f="urn:import:org.ovirt.engine.ui.common.widget.form"
        xmlns:w="urn:import:org.ovirt.engine.ui.common.widget"
-       
xmlns:c="urn:import:org.ovirt.engine.ui.webadmin.section.main.view.tab.cluster">
+       
xmlns:c="urn:import:org.ovirt.engine.ui.webadmin.section.main.view.tab.cluster"
+       xmlns:e="urn:import:org.ovirt.engine.ui.common.widget.editor">
 
        <ui:with field='constants' 
type='org.ovirt.engine.ui.webadmin.ApplicationConstants' />
 
-       <ui:style>
+       <ui:style 
type="org.ovirt.engine.ui.webadmin.section.main.view.tab.cluster.SubTabClusterGeneralView.WidgetStyle">
                @external alertsPanel;
                .alertsPanel {
                        padding-top: 5px;
@@ -18,10 +19,24 @@
                        color: black;
                        text-decoration: underline;
                }
+               .glusterSwiftPanel {
+                       padding-left: 15px;
+                       padding-top: 15px;
+               }
+               .glusterSwiftStatus{
+                       width: 80px;
+               }
+               .manageGlusterSwift{
+                       padding-top: 5px;
+               }
        </ui:style>
 
        <g:FlowPanel>
                <c:ClusterGeneralModelForm ui:field="form"/>
+               <g:HorizontalPanel ui:field="glusterSwiftPanel" 
addStyleNames="{style.glusterSwiftPanel}">
+                       <e:EntityModelLabelEditor 
ui:field="glusterSwiftStatusEditor"/>
+                       <w:UiCommandButton ui:field="manageGlusterSwiftButton" 
addStyleNames="{style.manageGlusterSwift}"/>
+               </g:HorizontalPanel>
                <g:HTMLPanel ui:field="alertsPanel" 
addStyleNames="{style.alertsPanel}">
                        <div>
                                <b>


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

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

Reply via email to