Merge "Fixed RebaseDialog usability improvements"
This commit is contained in:
commit
7bbcb15702
@ -65,6 +65,8 @@ class Actions extends Composite {
|
||||
private String branch;
|
||||
private String key;
|
||||
|
||||
private boolean rebaseParentNotCurrent = true;
|
||||
|
||||
Actions() {
|
||||
initWidget(uiBinder.createAndBindUi(this));
|
||||
getElement().setId("change_actions");
|
||||
@ -129,8 +131,11 @@ class Actions extends Composite {
|
||||
|
||||
a2b(actions, "cherrypick", cherrypick);
|
||||
a2b(actions, "rebase", rebase);
|
||||
|
||||
// The rebase button on change screen is always enabled.
|
||||
// It is the "Rebase" button in the RebaseDialog that might be disabled.
|
||||
rebaseParentNotCurrent = rebase.isEnabled();
|
||||
if (rebase.isVisible()) {
|
||||
// it is the rebase button in RebaseDialog that the server wants to disable
|
||||
rebase.setEnabled(true);
|
||||
}
|
||||
RevisionInfo revInfo = changeInfo.revision(revision);
|
||||
@ -178,16 +183,8 @@ class Actions extends Composite {
|
||||
|
||||
@UiHandler("rebase")
|
||||
void onRebase(@SuppressWarnings("unused") ClickEvent e) {
|
||||
boolean enabled = true;
|
||||
RevisionInfo revInfo = changeInfo.revision(revision);
|
||||
if (revInfo.has_actions()) {
|
||||
NativeMap<ActionInfo> actions = revInfo.actions();
|
||||
if (actions.containsKey("rebase")) {
|
||||
enabled = actions.get("rebase").enabled();
|
||||
}
|
||||
}
|
||||
RebaseAction.call(rebase, project, changeInfo.branch(), changeId, revision,
|
||||
enabled);
|
||||
rebaseParentNotCurrent);
|
||||
}
|
||||
|
||||
@UiHandler("submit")
|
||||
|
@ -1180,6 +1180,8 @@ public class ChangeScreen extends Screen {
|
||||
private void renderRevisionInfo(ChangeInfo info,
|
||||
NativeMap<ActionInfo> actionMap) {
|
||||
initRevisionsAction(info, revision, actionMap);
|
||||
commit.setParentNotCurrent(actionMap.containsKey("rebase")
|
||||
&& actionMap.get("rebase").enabled());
|
||||
actions.reloadRevisionActions(actionMap);
|
||||
}
|
||||
|
||||
|
@ -20,12 +20,10 @@ import com.google.gerrit.client.Gerrit;
|
||||
import com.google.gerrit.client.GitwebLink;
|
||||
import com.google.gerrit.client.WebLinkInfo;
|
||||
import com.google.gerrit.client.account.AccountInfo;
|
||||
import com.google.gerrit.client.actions.ActionInfo;
|
||||
import com.google.gerrit.client.changes.ChangeInfo;
|
||||
import com.google.gerrit.client.changes.ChangeInfo.CommitInfo;
|
||||
import com.google.gerrit.client.changes.ChangeInfo.GitPerson;
|
||||
import com.google.gerrit.client.changes.ChangeInfo.RevisionInfo;
|
||||
import com.google.gerrit.client.rpc.NativeMap;
|
||||
import com.google.gerrit.client.rpc.Natives;
|
||||
import com.google.gerrit.client.ui.CommentLinkProcessor;
|
||||
import com.google.gerrit.client.ui.InlineHyperlink;
|
||||
@ -127,15 +125,10 @@ class CommitBox extends Composite {
|
||||
}
|
||||
|
||||
setParents(change.project(), revInfo.commit().parents());
|
||||
}
|
||||
|
||||
void setParentNotCurrent(boolean parentNotCurrent) {
|
||||
// display the orange ball if parent has moved on (not current)
|
||||
boolean parentNotCurrent = false;
|
||||
if (revInfo.has_actions()) {
|
||||
NativeMap<ActionInfo> actions = revInfo.actions();
|
||||
if (actions.containsKey("rebase")) {
|
||||
parentNotCurrent = actions.get("rebase").enabled();
|
||||
}
|
||||
}
|
||||
UIObject.setVisible(parentNotCurrentText, parentNotCurrent);
|
||||
parentNotCurrentText.setInnerText(parentNotCurrent ? "\u25CF" : "");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user