ChangeScreen2: linkify branch and project name
Bug: issue 2075 Change-Id: I6ddef6f1417b53e6a1e2b795ac9b67309d39abb6
This commit is contained in:
@@ -39,15 +39,18 @@ import com.google.gerrit.client.rpc.NativeString;
|
||||
import com.google.gerrit.client.rpc.Natives;
|
||||
import com.google.gerrit.client.rpc.RestApi;
|
||||
import com.google.gerrit.client.rpc.ScreenLoadCallback;
|
||||
import com.google.gerrit.client.ui.BranchLink;
|
||||
import com.google.gerrit.client.ui.ChangeLink;
|
||||
import com.google.gerrit.client.ui.CommentLinkProcessor;
|
||||
import com.google.gerrit.client.ui.InlineHyperlink;
|
||||
import com.google.gerrit.client.ui.Screen;
|
||||
import com.google.gerrit.client.ui.UserActivityMonitor;
|
||||
import com.google.gerrit.common.PageLinks;
|
||||
import com.google.gerrit.common.changes.ListChangesOption;
|
||||
import com.google.gerrit.reviewdb.client.Change;
|
||||
import com.google.gerrit.reviewdb.client.Change.Status;
|
||||
import com.google.gerrit.reviewdb.client.PatchSet;
|
||||
import com.google.gerrit.reviewdb.client.Project;
|
||||
import com.google.gerrit.reviewdb.client.Change.Status;
|
||||
import com.google.gerrit.reviewdb.client.Project.SubmitType;
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.core.client.JsArray;
|
||||
@@ -135,8 +138,8 @@ public class ChangeScreen2 extends Screen {
|
||||
@UiField Element changeIdText;
|
||||
@UiField Element ownerText;
|
||||
@UiField Element statusText;
|
||||
@UiField Element projectText;
|
||||
@UiField Element branchText;
|
||||
@UiField InlineHyperlink projectLink;
|
||||
@UiField InlineHyperlink branchLink;
|
||||
@UiField Element submitActionText;
|
||||
@UiField Element notMergeable;
|
||||
@UiField CopyableLabel idText;
|
||||
@@ -291,6 +294,26 @@ public class ChangeScreen2 extends Screen {
|
||||
style, headerLine, download);
|
||||
}
|
||||
|
||||
private void initProjectLink(ChangeInfo info) {
|
||||
projectLink.setText(info.project());
|
||||
projectLink.setTargetHistoryToken(
|
||||
PageLinks.toChangeQuery(
|
||||
PageLinks.projectQuery(
|
||||
info.project_name_key(),
|
||||
info.status())));
|
||||
}
|
||||
|
||||
private void initBranchLink(ChangeInfo info) {
|
||||
branchLink.setText(info.branch());
|
||||
branchLink.setTargetHistoryToken(
|
||||
PageLinks.toChangeQuery(
|
||||
BranchLink.query(
|
||||
info.project_name_key(),
|
||||
info.status(),
|
||||
info.branch(),
|
||||
info.topic())));
|
||||
}
|
||||
|
||||
private void initEditMessageAction(ChangeInfo info, String revision) {
|
||||
NativeMap<ActionInfo> actions = info.revision(revision).actions();
|
||||
if (actions != null && actions.containsKey("message")) {
|
||||
@@ -636,13 +659,13 @@ public class ChangeScreen2 extends Screen {
|
||||
initIncludedInAction(info);
|
||||
initRevisionsAction(info, revision);
|
||||
initDownloadAction(info, revision);
|
||||
initProjectLink(info);
|
||||
initBranchLink(info);
|
||||
actions.display(info, revision);
|
||||
|
||||
star.setValue(info.starred());
|
||||
permalink.setHref(ChangeLink.permalink(changeId));
|
||||
changeIdText.setInnerText(String.valueOf(info.legacy_id()));
|
||||
projectText.setInnerText(info.project());
|
||||
branchText.setInnerText(info.branch());
|
||||
idText.setText("Change-Id: " + info.change_id());
|
||||
idText.setPreviewText(info.change_id());
|
||||
reload.set(info);
|
||||
|
||||
@@ -18,6 +18,7 @@ limitations under the License.
|
||||
xmlns:ui='urn:ui:com.google.gwt.uibinder'
|
||||
xmlns:c='urn:import:com.google.gerrit.client.change'
|
||||
xmlns:g='urn:import:com.google.gwt.user.client.ui'
|
||||
xmlns:x='urn:import:com.google.gerrit.client.ui'
|
||||
xmlns:clippy='urn:import:com.google.gwtexpui.clippy.client'>
|
||||
<ui:with field='res' type='com.google.gerrit.client.change.Resources'/>
|
||||
<ui:style type='com.google.gerrit.client.change.ChangeScreen2.Style'>
|
||||
@@ -316,11 +317,19 @@ limitations under the License.
|
||||
</tr>
|
||||
<tr>
|
||||
<th><ui:msg>Project</ui:msg></th>
|
||||
<td ui:field='projectText'/>
|
||||
<td><x:InlineHyperlink ui:field='projectLink'
|
||||
title='Search for changes on this project'>
|
||||
<ui:attribute name='title'/>
|
||||
</x:InlineHyperlink>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><ui:msg>Branch</ui:msg></th>
|
||||
<td ui:field='branchText'/>
|
||||
<td><x:InlineHyperlink ui:field='branchLink'
|
||||
title='Search for changes on this branch'>
|
||||
<ui:attribute name='title'/>
|
||||
</x:InlineHyperlink>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><ui:msg>Strategy</ui:msg></th>
|
||||
|
||||
@@ -57,7 +57,7 @@ public class BranchLink extends InlineHyperlink {
|
||||
}
|
||||
}
|
||||
|
||||
private static String query(Project.NameKey project, Change.Status status,
|
||||
public static String query(Project.NameKey project, Change.Status status,
|
||||
String branch, String topic) {
|
||||
String query = PageLinks.projectQuery(project, status);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user