Fix link behaviour inconsistencies in change info panel
In the change info panel there are links on the project name, branch name, and topic name. They all behave differently: project: opens the project admin page branch: opens a query for changes on the branch and topic topic: opens a dialog to edit the topic name Also, next to the project is a query icon that opens the project default dashboard which is a query for recent changes. These inconsistent links reduce the useability of the UI. With this change, they are made more consistent: project: opens the project default dashboard branch: opens a query for changes on the branch (without topic) topic: opens a query for changes on the topic The project query icon is replaced with a settings icon that opens the project admin page. The topic can still be edited by clicking on the edit icon. Change-Id: I09c36bf80949efd8a6237669c8284275c3372d9c
This commit is contained in:
@@ -139,7 +139,7 @@ public class ChangeScreen2 extends Screen {
|
|||||||
@UiField Reviewers reviewers;
|
@UiField Reviewers reviewers;
|
||||||
@UiField InlineHyperlink ownerLink;
|
@UiField InlineHyperlink ownerLink;
|
||||||
@UiField Element statusText;
|
@UiField Element statusText;
|
||||||
@UiField Image projectQuery;
|
@UiField Image projectSettings;
|
||||||
@UiField InlineHyperlink projectLink;
|
@UiField InlineHyperlink projectLink;
|
||||||
@UiField InlineHyperlink branchLink;
|
@UiField InlineHyperlink branchLink;
|
||||||
@UiField Element strategy;
|
@UiField Element strategy;
|
||||||
@@ -356,16 +356,16 @@ public class ChangeScreen2 extends Screen {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void initProjectLinks(final ChangeInfo info) {
|
private void initProjectLinks(final ChangeInfo info) {
|
||||||
projectQuery.addDomHandler(new ClickHandler() {
|
projectSettings.addDomHandler(new ClickHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(ClickEvent event) {
|
public void onClick(ClickEvent event) {
|
||||||
Gerrit.display(
|
Gerrit.display(
|
||||||
PageLinks.toProjectDefaultDashboard(info.project_name_key()));
|
PageLinks.toProject(info.project_name_key()));
|
||||||
}
|
}
|
||||||
}, ClickEvent.getType());
|
}, ClickEvent.getType());
|
||||||
projectLink.setText(info.project());
|
projectLink.setText(info.project());
|
||||||
projectLink.setTargetHistoryToken(
|
projectLink.setTargetHistoryToken(
|
||||||
PageLinks.toProject(info.project_name_key()));
|
PageLinks.toProjectDefaultDashboard(info.project_name_key()));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initBranchLink(ChangeInfo info) {
|
private void initBranchLink(ChangeInfo info) {
|
||||||
@@ -376,7 +376,7 @@ public class ChangeScreen2 extends Screen {
|
|||||||
info.project_name_key(),
|
info.project_name_key(),
|
||||||
info.status(),
|
info.status(),
|
||||||
info.branch(),
|
info.branch(),
|
||||||
info.topic())));
|
null)));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initEditMessageAction(ChangeInfo info, String revision) {
|
private void initEditMessageAction(ChangeInfo info, String revision) {
|
||||||
|
|||||||
@@ -161,7 +161,7 @@ limitations under the License.
|
|||||||
padding: 0 5px 0 0;
|
padding: 0 5px 0 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.queryProject {
|
.projectSettings {
|
||||||
float: right;
|
float: right;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
@@ -383,14 +383,14 @@ limitations under the License.
|
|||||||
<tr>
|
<tr>
|
||||||
<th><ui:msg>Project</ui:msg></th>
|
<th><ui:msg>Project</ui:msg></th>
|
||||||
<td><x:InlineHyperlink ui:field='projectLink'
|
<td><x:InlineHyperlink ui:field='projectLink'
|
||||||
title='Go to project'>
|
title='Search for changes on this project'>
|
||||||
<ui:attribute name='title'/>
|
<ui:attribute name='title'/>
|
||||||
</x:InlineHyperlink>
|
</x:InlineHyperlink>
|
||||||
<g:Image
|
<g:Image
|
||||||
ui:field='projectQuery'
|
ui:field='projectSettings'
|
||||||
resource='{ico.queryIcon}'
|
resource='{ico.gear}'
|
||||||
styleName='{style.queryProject}'
|
styleName='{style.projectSettings}'
|
||||||
title='Search for changes on this project'>
|
title='Go to project'>
|
||||||
<ui:attribute name='title'/>
|
<ui:attribute name='title'/>
|
||||||
</g:Image>
|
</g:Image>
|
||||||
</td>
|
</td>
|
||||||
|
|||||||
@@ -18,6 +18,8 @@ import com.google.gerrit.client.Gerrit;
|
|||||||
import com.google.gerrit.client.changes.ChangeApi;
|
import com.google.gerrit.client.changes.ChangeApi;
|
||||||
import com.google.gerrit.client.changes.ChangeInfo;
|
import com.google.gerrit.client.changes.ChangeInfo;
|
||||||
import com.google.gerrit.client.rpc.GerritCallback;
|
import com.google.gerrit.client.rpc.GerritCallback;
|
||||||
|
import com.google.gerrit.client.ui.BranchLink;
|
||||||
|
import com.google.gerrit.client.ui.InlineHyperlink;
|
||||||
import com.google.gerrit.common.PageLinks;
|
import com.google.gerrit.common.PageLinks;
|
||||||
import com.google.gerrit.reviewdb.client.PatchSet;
|
import com.google.gerrit.reviewdb.client.PatchSet;
|
||||||
import com.google.gwt.core.client.GWT;
|
import com.google.gwt.core.client.GWT;
|
||||||
@@ -31,10 +33,8 @@ import com.google.gwt.uibinder.client.UiField;
|
|||||||
import com.google.gwt.uibinder.client.UiHandler;
|
import com.google.gwt.uibinder.client.UiHandler;
|
||||||
import com.google.gwt.user.client.ui.Button;
|
import com.google.gwt.user.client.ui.Button;
|
||||||
import com.google.gwt.user.client.ui.Composite;
|
import com.google.gwt.user.client.ui.Composite;
|
||||||
import com.google.gwt.user.client.ui.FlowPanel;
|
|
||||||
import com.google.gwt.user.client.ui.HTMLPanel;
|
import com.google.gwt.user.client.ui.HTMLPanel;
|
||||||
import com.google.gwt.user.client.ui.Image;
|
import com.google.gwt.user.client.ui.Image;
|
||||||
import com.google.gwt.user.client.ui.InlineLabel;
|
|
||||||
import com.google.gwt.user.client.ui.UIObject;
|
import com.google.gwt.user.client.ui.UIObject;
|
||||||
import com.google.gwtexpui.globalkey.client.NpTextBox;
|
import com.google.gwtexpui.globalkey.client.NpTextBox;
|
||||||
|
|
||||||
@@ -46,8 +46,8 @@ class Topic extends Composite {
|
|||||||
private PatchSet.Id psId;
|
private PatchSet.Id psId;
|
||||||
private boolean canEdit;
|
private boolean canEdit;
|
||||||
|
|
||||||
@UiField FlowPanel show;
|
@UiField Element show;
|
||||||
@UiField InlineLabel text;
|
@UiField InlineHyperlink text;
|
||||||
@UiField Image editIcon;
|
@UiField Image editIcon;
|
||||||
|
|
||||||
@UiField Element form;
|
@UiField Element form;
|
||||||
@@ -57,7 +57,7 @@ class Topic extends Composite {
|
|||||||
|
|
||||||
Topic() {
|
Topic() {
|
||||||
initWidget(uiBinder.createAndBindUi(this));
|
initWidget(uiBinder.createAndBindUi(this));
|
||||||
show.addDomHandler(
|
editIcon.addDomHandler(
|
||||||
new ClickHandler() {
|
new ClickHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(ClickEvent event) {
|
public void onClick(ClickEvent event) {
|
||||||
@@ -76,20 +76,30 @@ class Topic extends Composite {
|
|||||||
info.legacy_id(),
|
info.legacy_id(),
|
||||||
info.revisions().get(revision)._number());
|
info.revisions().get(revision)._number());
|
||||||
|
|
||||||
text.setText(info.topic());
|
initTopicLink(info);
|
||||||
editIcon.setVisible(canEdit);
|
editIcon.setVisible(canEdit);
|
||||||
if (!canEdit) {
|
if (!canEdit) {
|
||||||
show.setTitle(null);
|
show.setTitle(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void initTopicLink(ChangeInfo info) {
|
||||||
|
text.setText(info.topic());
|
||||||
|
text.setTargetHistoryToken(
|
||||||
|
PageLinks.toChangeQuery(
|
||||||
|
BranchLink.query(
|
||||||
|
info.project_name_key(),
|
||||||
|
info.status(),
|
||||||
|
info.branch(),
|
||||||
|
info.topic())));
|
||||||
|
}
|
||||||
|
|
||||||
boolean canEdit() {
|
boolean canEdit() {
|
||||||
return canEdit;
|
return canEdit;
|
||||||
}
|
}
|
||||||
|
|
||||||
void onEdit() {
|
void onEdit() {
|
||||||
if (canEdit) {
|
if (canEdit) {
|
||||||
show.setVisible(false);
|
|
||||||
UIObject.setVisible(form, true);
|
UIObject.setVisible(form, true);
|
||||||
|
|
||||||
input.setText(text.getText());
|
input.setText(text.getText());
|
||||||
@@ -100,7 +110,6 @@ class Topic extends Composite {
|
|||||||
@UiHandler("cancel")
|
@UiHandler("cancel")
|
||||||
void onCancel(ClickEvent e) {
|
void onCancel(ClickEvent e) {
|
||||||
input.setFocus(false);
|
input.setFocus(false);
|
||||||
show.setVisible(true);
|
|
||||||
UIObject.setVisible(form, false);
|
UIObject.setVisible(form, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,8 @@ limitations under the License.
|
|||||||
<ui:UiBinder
|
<ui:UiBinder
|
||||||
xmlns:ui='urn:ui:com.google.gwt.uibinder'
|
xmlns:ui='urn:ui:com.google.gwt.uibinder'
|
||||||
xmlns:c='urn:import:com.google.gwtexpui.globalkey.client'
|
xmlns:c='urn:import:com.google.gwtexpui.globalkey.client'
|
||||||
xmlns:g='urn:import:com.google.gwt.user.client.ui'>
|
xmlns:g='urn:import:com.google.gwt.user.client.ui'
|
||||||
|
xmlns:x='urn:import:com.google.gerrit.client.ui'>
|
||||||
<ui:with field='ico' type='com.google.gerrit.client.GerritResources'/>
|
<ui:with field='ico' type='com.google.gerrit.client.GerritResources'/>
|
||||||
<ui:with field='res' type='com.google.gerrit.client.change.Resources'/>
|
<ui:with field='res' type='com.google.gerrit.client.change.Resources'/>
|
||||||
<ui:style>
|
<ui:style>
|
||||||
@@ -25,15 +26,14 @@ limitations under the License.
|
|||||||
.edit, .cancel { float: right; }
|
.edit, .cancel { float: right; }
|
||||||
</ui:style>
|
</ui:style>
|
||||||
<g:HTMLPanel>
|
<g:HTMLPanel>
|
||||||
<g:FlowPanel ui:field='show'
|
<div ui:field='show' styleName='{style.show}'>
|
||||||
styleName='{style.show}'
|
<x:InlineHyperlink ui:field='text'
|
||||||
title='Click to edit topic (Shortcut: t)'>
|
title='Search for changes on this topic'/>
|
||||||
<ui:attribute name='title'/>
|
|
||||||
<g:InlineLabel ui:field='text'/>
|
|
||||||
<g:Image ui:field='editIcon'
|
<g:Image ui:field='editIcon'
|
||||||
resource='{ico.edit}'
|
resource='{ico.edit}'
|
||||||
styleName='{style.edit}'/>
|
styleName='{style.edit}'
|
||||||
</g:FlowPanel>
|
title='Click to edit topic (Shortcut: t)'/>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div ui:field='form' style='display: none' aria-hidden='true'>
|
<div ui:field='form' style='display: none' aria-hidden='true'>
|
||||||
<div>
|
<div>
|
||||||
|
|||||||
Reference in New Issue
Block a user