Allow to set topic on new change created from UI
Change-Id: I8b6a8728651174294d204d876f4620725ff35d51
This commit is contained in:
@@ -38,6 +38,7 @@ class CreateChangeAction {
|
||||
@Override
|
||||
public void onSend() {
|
||||
ChangeApi.createChange(project, getDestinationBranch(),
|
||||
getDestinationTopic(),
|
||||
message.getText(), null,
|
||||
new GerritCallback<ChangeInfo>() {
|
||||
@Override
|
||||
|
@@ -27,7 +27,7 @@ public class EditConfigAction {
|
||||
static void call(final Button b, final String project) {
|
||||
b.setEnabled(false);
|
||||
|
||||
ChangeApi.createChange(project, RefNames.REFS_CONFIG,
|
||||
ChangeApi.createChange(project, RefNames.REFS_CONFIG, null,
|
||||
Util.C.editConfigMessage(), null, new GerritCallback<ChangeInfo>() {
|
||||
@Override
|
||||
public void onSuccess(ChangeInfo result) {
|
||||
|
@@ -35,7 +35,7 @@ class FollowUpAction extends ActionMessageBox {
|
||||
|
||||
@Override
|
||||
void send(String message) {
|
||||
ChangeApi.createChange(project, branch, message, base,
|
||||
ChangeApi.createChange(project, branch, null, message, base,
|
||||
new GerritCallback<ChangeInfo>() {
|
||||
@Override
|
||||
public void onSuccess(ChangeInfo result) {
|
||||
|
@@ -45,11 +45,12 @@ public class ChangeApi {
|
||||
* new change is created as NEW.
|
||||
*
|
||||
*/
|
||||
public static void createChange(String project, String branch,
|
||||
public static void createChange(String project, String branch, String topic,
|
||||
String subject, String base, AsyncCallback<ChangeInfo> cb) {
|
||||
CreateChangeInput input = CreateChangeInput.create();
|
||||
input.project(emptyToNull(project));
|
||||
input.branch(emptyToNull(branch));
|
||||
input.topic(emptyToNull(topic));
|
||||
input.subject(emptyToNull(subject));
|
||||
input.baseChange(emptyToNull(base));
|
||||
|
||||
@@ -249,6 +250,7 @@ public class ChangeApi {
|
||||
}
|
||||
|
||||
public final native void branch(String b) /*-{ if(b)this.branch=b; }-*/;
|
||||
public final native void topic(String t) /*-{ if(t)this.topic=t; }-*/;
|
||||
public final native void project(String p) /*-{ if(p)this.project=p; }-*/;
|
||||
public final native void subject(String s) /*-{ if(s)this.subject=s; }-*/;
|
||||
public final native void baseChange(String b) /*-{ if(b)this.base_change=b; }-*/;
|
||||
|
@@ -24,6 +24,7 @@ import com.google.gwt.core.client.JsArray;
|
||||
import com.google.gwt.user.client.ui.FlowPanel;
|
||||
import com.google.gwt.user.client.ui.SuggestBox;
|
||||
import com.google.gwt.user.client.ui.SuggestOracle.Suggestion;
|
||||
import com.google.gwt.user.client.ui.TextBox;
|
||||
import com.google.gwtexpui.globalkey.client.GlobalKey;
|
||||
import com.google.gwtexpui.safehtml.client.HighlightSuggestOracle;
|
||||
|
||||
@@ -33,6 +34,7 @@ import java.util.List;
|
||||
public abstract class CreateChangeDialog extends TextAreaActionDialog {
|
||||
private SuggestBox newChange;
|
||||
private List<BranchInfo> branches;
|
||||
private TextBox topic;
|
||||
|
||||
public CreateChangeDialog(Project.NameKey project) {
|
||||
super(Util.C.dialogCreateChangeTitle(),
|
||||
@@ -45,6 +47,15 @@ public abstract class CreateChangeDialog extends TextAreaActionDialog {
|
||||
}
|
||||
});
|
||||
|
||||
topic = new TextBox();
|
||||
topic.setWidth("100%");
|
||||
topic.getElement().getStyle().setProperty("boxSizing", "border-box");
|
||||
FlowPanel newTopicPanel = new FlowPanel();
|
||||
newTopicPanel.setStyleName(Gerrit.RESOURCES.css().commentedActionMessage());
|
||||
newTopicPanel.add(topic);
|
||||
panel.insert(newTopicPanel, 0);
|
||||
panel.insert(new SmallHeading(Util.C.newChangeTopicSuggestion()), 0);
|
||||
|
||||
newChange = new SuggestBox(new HighlightSuggestOracle() {
|
||||
@Override
|
||||
protected void onRequestSuggestions(Request request, Callback done) {
|
||||
@@ -60,14 +71,13 @@ public abstract class CreateChangeDialog extends TextAreaActionDialog {
|
||||
|
||||
newChange.setWidth("100%");
|
||||
newChange.getElement().getStyle().setProperty("boxSizing", "border-box");
|
||||
message.setCharacterWidth(70);
|
||||
|
||||
FlowPanel mwrap = new FlowPanel();
|
||||
mwrap.setStyleName(Gerrit.RESOURCES.css().commentedActionMessage());
|
||||
mwrap.add(newChange);
|
||||
|
||||
panel.insert(mwrap, 0);
|
||||
FlowPanel newChangePanel = new FlowPanel();
|
||||
newChangePanel.setStyleName(Gerrit.RESOURCES.css().commentedActionMessage());
|
||||
newChangePanel.add(newChange);
|
||||
panel.insert(newChangePanel, 0);
|
||||
panel.insert(new SmallHeading(Util.C.newChangeBranchSuggestion()), 0);
|
||||
|
||||
message.setCharacterWidth(70);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -81,6 +91,10 @@ public abstract class CreateChangeDialog extends TextAreaActionDialog {
|
||||
return newChange.getText();
|
||||
}
|
||||
|
||||
public String getDestinationTopic() {
|
||||
return topic.getText();
|
||||
}
|
||||
|
||||
static class BranchSuggestion implements Suggestion {
|
||||
private BranchInfo branch;
|
||||
|
||||
|
@@ -29,4 +29,5 @@ public interface UIConstants extends Constants {
|
||||
String dialogCreateChangeTitle();
|
||||
String dialogCreateChangeHeading();
|
||||
String newChangeBranchSuggestion();
|
||||
String newChangeTopicSuggestion();
|
||||
}
|
||||
|
@@ -10,3 +10,4 @@ projectStateHelp = State
|
||||
dialogCreateChangeTitle = Create Change
|
||||
dialogCreateChangeHeading = Description
|
||||
newChangeBranchSuggestion = Select branch for new change
|
||||
newChangeTopicSuggestion = Enter topic for new change
|
||||
|
Reference in New Issue
Block a user