Lior Vernia has uploaded a new change for review.

Change subject: webadmin: Color Setup Networks label when operation invalid
......................................................................

webadmin: Color Setup Networks label when operation invalid

To make the status label more noticeable in case of an error, colored it
with a red palette in such a case.

Change-Id: Idbc6a77c1111dbad0c89a3c7f38b537eb1673c3e
Signed-off-by: Lior Vernia <lver...@redhat.com>
---
M 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/HostSetupNetworksModel.java
M 
frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/host/HostSetupNetworksPopupView.java
M 
frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/host/HostSetupNetworksPopupView.ui.xml
M 
frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/host/panels/NetworkPanelsStyle.java
4 files changed, 61 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/38/14038/1

diff --git 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/HostSetupNetworksModel.java
 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/HostSetupNetworksModel.java
index 550ad05..bd955d7 100644
--- 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/HostSetupNetworksModel.java
+++ 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/HostSetupNetworksModel.java
@@ -96,7 +96,12 @@
     private static final EventDefinition OPERATION_CANDIDATE_EVENT_DEFINITION =
             new EventDefinition("OperationCandidate", 
NetworkOperationFactory.class); //$NON-NLS-1$
 
+    private static final EventDefinition NULL_OPERATION_EVENT_DEFINITION =
+            new EventDefinition("NullOperation", 
NetworkOperationFactory.class); //$NON-NLS-1$
+
     private Event privateOperationCandidateEvent;
+
+    private Event privateNullOperationEvent;
 
     private Event privateNicsChangedEvent;
 
@@ -139,6 +144,7 @@
         setNicsChangedEvent(new Event(NICS_CHANGED_EVENT_DEFINITION));
         setNetworksChangedEvent(new Event(NETWORKS_CHANGED_EVENT_DEFINITION));
         setOperationCandidateEvent(new 
Event(OPERATION_CANDIDATE_EVENT_DEFINITION));
+        setNullOperationEvent(new Event(NULL_OPERATION_EVENT_DEFINITION));
         setCheckConnectivity(new EntityModel());
         getCheckConnectivity().setEntity(true);
         setConnectivityTimeout(new EntityModel());
@@ -188,6 +194,9 @@
         NetworkOperation candidate = NetworkOperationFactory.operationFor(op1, 
op2, true);
 
         if (drop) {
+            if (candidate.isNullOperation()) {
+                getNullOperationEvent().raise(this, null);
+            }
             onOperation(candidate, candidate.getCommand(op1, op2, allNics));
         } else {
             // raise the candidate event only if it was changed
@@ -227,6 +236,10 @@
 
     public Event getOperationCandidateEvent() {
         return privateOperationCandidateEvent;
+    }
+
+    public Event getNullOperationEvent() {
+        return privateNullOperationEvent;
     }
 
     public void onEdit(NetworkItemModel<?> item) {
@@ -723,6 +736,10 @@
         privateOperationCandidateEvent = event;
     }
 
+    private void setNullOperationEvent(Event event) {
+        privateNullOperationEvent = event;
+    }
+
     private void validate() {
         // check if management network is attached
         LogicalNetworkModel mgmtNetwork = 
networkMap.get(HostInterfaceListModel.ENGINE_NETWORK_NAME);
diff --git 
a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/host/HostSetupNetworksPopupView.java
 
b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/host/HostSetupNetworksPopupView.java
index 6ced9d7..d05c362 100644
--- 
a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/host/HostSetupNetworksPopupView.java
+++ 
b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/host/HostSetupNetworksPopupView.java
@@ -35,6 +35,7 @@
 import com.google.gwt.event.shared.EventBus;
 import com.google.gwt.uibinder.client.UiBinder;
 import com.google.gwt.uibinder.client.UiField;
+import com.google.gwt.user.client.ui.SimplePanel;
 import com.google.inject.Inject;
 
 public class HostSetupNetworksPopupView extends 
AbstractModelBoundPopupView<HostSetupNetworksModel> implements 
HostSetupNetworksPopupPresenterWidget.ViewDef {
@@ -54,6 +55,9 @@
 
     @UiField
     AnimatedVerticalPanel nicList;
+
+    @UiField
+    SimplePanel statusPanel;
 
     @UiField(provided = true)
     @Ignore
@@ -90,7 +94,7 @@
         checkConnInfo = new 
InfoIcon(templates.italicTwoLines(constants.checkConnectivityInfoPart1(), 
constants.checkConnectivityInfoPart2()), resources);
         commitChangesInfo = new 
InfoIcon(templates.italicTwoLines(constants.commitChangesInfoPart1(), 
constants.commitChangesInfoPart2()), resources);
         initWidget(ViewUiBinder.uiBinder.createAndBindUi(this));
-        status.setStylePrimaryName(style.statusLabel());
+        setStatusStyle(true);
         checkConnectivity.setContentWidgetStyleName(style.checkCon());
         commitChanges.setContentWidgetStyleName(style.commitChanges());
         initUnassignedNetworksPanel();
@@ -106,6 +110,16 @@
     private void localize(){
         checkConnectivity.setLabel(constants.checkConHostPopup()); 
//$NON-NLS-1$
         commitChanges.setLabel(constants.saveNetConfigHostPopup());
+    }
+
+    private void setStatusStyle(boolean valid) {
+        if (valid) {
+            statusPanel.setStylePrimaryName(style.statusPanel());
+            status.setStylePrimaryName(style.statusLabel());
+        } else {
+            statusPanel.setStylePrimaryName(style.errorPanel());
+            status.setStylePrimaryName(style.errorLabel());
+        }
     }
 
     @Override
@@ -134,6 +148,14 @@
                 NetworkItemModel<?> op1 = evtArgs.getOp1();
                 NetworkItemModel<?> op2 = evtArgs.getOp2();
                 status.setFadeText(candidate != null ? 
candidate.getMessage(op1, op2) : constants.noValidActionSetupNetwork());
+                setStatusStyle(true);
+            }
+        });
+
+        uicommonModel.getNullOperationEvent().addListener(new IEventListener() 
{
+            @Override
+            public void eventRaised(Event ev, Object sender, EventArgs args) {
+                setStatusStyle(false);
             }
         });
 
diff --git 
a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/host/HostSetupNetworksPopupView.ui.xml
 
b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/host/HostSetupNetworksPopupView.ui.xml
index 44160fc..08b02c1 100644
--- 
a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/host/HostSetupNetworksPopupView.ui.xml
+++ 
b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/host/HostSetupNetworksPopupView.ui.xml
@@ -36,6 +36,14 @@
                        padding-top: 5px;
                }
 
+               .errorLabel {
+                       font-size: 15px;
+                       font-weight: bold;
+                       color: red;
+                       padding-left: 20px;
+                       padding-top: 5px;
+               }
+
                .itemPanel {
                        border-width: 1px;
                        border-style: solid;
@@ -143,6 +151,12 @@
                        border-bottom: 1px solid #C5C5C5;
                }
 
+               .errorPanel{
+                       background-color: pink;
+                       height: 30px;
+                       border-bottom: 1px solid #C5C5C5;
+               }               
+
                .checkBoxesPanel{
                        border-top: 1px solid #C5C5C5;
                        width: 100%;
@@ -175,7 +189,7 @@
        <d:SimpleDialogPanel width="900px" height="600px">
                <d:content>
                        <g:HTMLPanel>
-                               <g:SimplePanel styleName="{style.statusPanel}">
+                               <g:SimplePanel ui:field="statusPanel">
                                        <f:StatusLabel ui:field="status"/>
                                </g:SimplePanel>
                                <g:HorizontalPanel spacing="10" width="100%" 
height="79%" verticalAlignment="ALIGN_TOP">
diff --git 
a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/host/panels/NetworkPanelsStyle.java
 
b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/host/panels/NetworkPanelsStyle.java
index 29f5383..244ac63 100644
--- 
a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/host/panels/NetworkPanelsStyle.java
+++ 
b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/host/panels/NetworkPanelsStyle.java
@@ -27,8 +27,14 @@
 
     String nicPanel();
 
+    String statusPanel();
+
+    String errorPanel();
+
     String statusLabel();
 
+    String errorLabel();
+
     String checkCon();
 
     String commitChanges();


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

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

Reply via email to