Fix RpcStatus to display "Working..." when header is hidden

Simplify the DOM structure and place "Working..." at the top level of
the document, positioned using fixed positioning.  Now it is always
visible when saving a draft comment is slow.

Change-Id: I106dece4265b51b4e38585c03026b158d5876761
This commit is contained in:
Shawn Pearce
2013-10-11 15:22:17 -07:00
parent a1f315bd03
commit 94e77aa846
4 changed files with 7 additions and 22 deletions

View File

@@ -560,7 +560,7 @@ public class Gerrit implements EntryPoint {
};
gBody.add(body);
RpcStatus.INSTANCE = new RpcStatus(topMenu);
RpcStatus.INSTANCE = new RpcStatus();
JsonUtil.addRpcStartHandler(RpcStatus.INSTANCE);
JsonUtil.addRpcCompleteHandler(RpcStatus.INSTANCE);
JsonUtil.setDefaultXsrfManager(new XsrfManager() {

View File

@@ -198,8 +198,6 @@ public interface GerritCss extends CssResource {
String rightBorder();
String rightmost();
String rpcStatus();
String rpcStatusLoading();
String rpcStatusPanel();
String screen();
String screenHeader();
String screenNoHeader();

View File

@@ -14,10 +14,9 @@
package com.google.gerrit.client;
import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.InlineLabel;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.Panel;
import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwtjsonrpc.client.event.RpcCompleteEvent;
import com.google.gwtjsonrpc.client.event.RpcCompleteHandler;
import com.google.gwtjsonrpc.client.event.RpcStartEvent;
@@ -41,17 +40,12 @@ public class RpcStatus implements RpcStartHandler, RpcCompleteHandler {
private final Label loading;
private int activeCalls;
RpcStatus(final Panel p) {
final FlowPanel r = new FlowPanel();
r.setStyleName(Gerrit.RESOURCES.css().rpcStatusPanel());
p.add(r);
RpcStatus() {
loading = new InlineLabel();
loading.setText(Gerrit.C.rpcStatusWorking());
loading.setStyleName(Gerrit.RESOURCES.css().rpcStatus());
loading.addStyleName(Gerrit.RESOURCES.css().rpcStatusLoading());
loading.setVisible(false);
r.add(loading);
RootPanel.get().add(loading);
}
@Override

View File

@@ -360,25 +360,18 @@ a:hover {
}
/** RPC Status **/
.rpcStatusPanel {
position: absolute;
left: 50%;
float: left;
top: 6px;
}
.rpcStatus {
position: fixed;
top: 6px;
left: 50%;
padding-top: 4px;
padding-bottom: 4px;
padding-left: 10px;
padding-right: 10px;
text-align: center;
font-weight: bold;
}
.rpcStatusLoading {
background: #FFF1A8;
z-index: 10;
}