Show "File n of N" in diff views
This allows the reviewer to see how many files are still left to review and how many are already done. Change-Id: Id89eb7c85a557708d5de7bf1447747661eb1e3a1 Signed-off-by: Edwin Kempin <ekempin@google.com>
This commit is contained in:
@@ -36,4 +36,6 @@ public interface GerritMessages extends Messages {
|
|||||||
String cannotDownloadPlugin(String scriptPath);
|
String cannotDownloadPlugin(String scriptPath);
|
||||||
|
|
||||||
String parentUpdateFailed(String message);
|
String parentUpdateFailed(String message);
|
||||||
|
|
||||||
|
String fileCount(int fileNumber, int fileCount);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,3 +17,5 @@ pluginFailed = Plugin "{0}" failed to load
|
|||||||
cannotDownloadPlugin = Cannot load plugin from {0}
|
cannotDownloadPlugin = Cannot load plugin from {0}
|
||||||
|
|
||||||
parentUpdateFailed = Setting parent project failed: {0}
|
parentUpdateFailed = Setting parent project failed: {0}
|
||||||
|
|
||||||
|
fileCount = File {0} of {1}
|
||||||
|
|||||||
@@ -74,6 +74,8 @@ public class Header extends Composite {
|
|||||||
@UiField CheckBox reviewed;
|
@UiField CheckBox reviewed;
|
||||||
@UiField Element project;
|
@UiField Element project;
|
||||||
@UiField Element filePath;
|
@UiField Element filePath;
|
||||||
|
@UiField Element fileNumber;
|
||||||
|
@UiField Element fileCount;
|
||||||
|
|
||||||
@UiField Element noDiff;
|
@UiField Element noDiff;
|
||||||
@UiField FlowPanel linkPanel;
|
@UiField FlowPanel linkPanel;
|
||||||
@@ -143,6 +145,9 @@ public class Header extends Composite {
|
|||||||
public void onSuccess(NativeMap<FileInfo> result) {
|
public void onSuccess(NativeMap<FileInfo> result) {
|
||||||
JsArray<FileInfo> files = result.values();
|
JsArray<FileInfo> files = result.values();
|
||||||
FileInfo.sortFileInfoByPath(files);
|
FileInfo.sortFileInfoByPath(files);
|
||||||
|
fileNumber.setInnerText(
|
||||||
|
Integer.toString(Natives.asList(files).indexOf(result.get(path)) + 1));
|
||||||
|
fileCount.setInnerText(Integer.toString(files.length()));
|
||||||
int index = 0; // TODO: Maybe use patchIndex.
|
int index = 0; // TODO: Maybe use patchIndex.
|
||||||
for (int i = 0; i < files.length(); i++) {
|
for (int i = 0; i < files.length(); i++) {
|
||||||
if (path.equals(files.get(i).path())) {
|
if (path.equals(files.get(i).path())) {
|
||||||
|
|||||||
@@ -34,6 +34,11 @@ limitations under the License.
|
|||||||
.path {
|
.path {
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
|
.fileCount {
|
||||||
|
white-space: nowrap;
|
||||||
|
position: relative;
|
||||||
|
bottom: 4px;
|
||||||
|
}
|
||||||
.navigation {
|
.navigation {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 0;
|
top: 0;
|
||||||
@@ -69,6 +74,9 @@ limitations under the License.
|
|||||||
<div class='{style.navigation}'>
|
<div class='{style.navigation}'>
|
||||||
<span ui:field='noDiff' class='{style.nodiff}'><ui:msg>No Differences</ui:msg></span>
|
<span ui:field='noDiff' class='{style.nodiff}'><ui:msg>No Differences</ui:msg></span>
|
||||||
<g:FlowPanel ui:field='linkPanel' styleName='{style.linkPanel}'/>
|
<g:FlowPanel ui:field='linkPanel' styleName='{style.linkPanel}'/>
|
||||||
|
<span class='{style.fileCount}'>
|
||||||
|
<ui:msg>File <span ui:field='fileNumber'/> of <span ui:field='fileCount'/></ui:msg>
|
||||||
|
</span>
|
||||||
<x:InlineHyperlink ui:field='prev' styleName='{res.style.goPrev}'/>
|
<x:InlineHyperlink ui:field='prev' styleName='{res.style.goPrev}'/>
|
||||||
<x:InlineHyperlink ui:field='up'
|
<x:InlineHyperlink ui:field='up'
|
||||||
styleName='{res.style.goUp}'
|
styleName='{res.style.goUp}'
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ import com.google.gwt.user.client.ui.FlowPanel;
|
|||||||
import com.google.gwt.user.client.ui.Grid;
|
import com.google.gwt.user.client.ui.Grid;
|
||||||
import com.google.gwt.user.client.ui.HTMLTable.CellFormatter;
|
import com.google.gwt.user.client.ui.HTMLTable.CellFormatter;
|
||||||
import com.google.gwt.user.client.ui.HasHorizontalAlignment;
|
import com.google.gwt.user.client.ui.HasHorizontalAlignment;
|
||||||
|
import com.google.gwt.user.client.ui.Label;
|
||||||
import com.google.gwtexpui.globalkey.client.KeyCommand;
|
import com.google.gwtexpui.globalkey.client.KeyCommand;
|
||||||
import com.google.gwtexpui.globalkey.client.KeyCommandSet;
|
import com.google.gwtexpui.globalkey.client.KeyCommandSet;
|
||||||
import com.google.gwtexpui.safehtml.client.SafeHtml;
|
import com.google.gwtexpui.safehtml.client.SafeHtml;
|
||||||
@@ -35,7 +36,7 @@ import java.util.List;
|
|||||||
class NavLinks extends Composite {
|
class NavLinks extends Composite {
|
||||||
public enum Nav {
|
public enum Nav {
|
||||||
PREV (0, '[', PatchUtil.C.previousFileHelp(), 0),
|
PREV (0, '[', PatchUtil.C.previousFileHelp(), 0),
|
||||||
NEXT (3, ']', PatchUtil.C.nextFileHelp(), 1);
|
NEXT (4, ']', PatchUtil.C.nextFileHelp(), 1);
|
||||||
|
|
||||||
public int col; // Table Cell column to display link in
|
public int col; // Table Cell column to display link in
|
||||||
public int key; // key code shortcut to activate link
|
public int key; // key code shortcut to activate link
|
||||||
@@ -59,7 +60,7 @@ class NavLinks extends Composite {
|
|||||||
NavLinks(KeyCommandSet kcs, PatchSet.Id forPatch) {
|
NavLinks(KeyCommandSet kcs, PatchSet.Id forPatch) {
|
||||||
patchSetId = forPatch;
|
patchSetId = forPatch;
|
||||||
keys = kcs;
|
keys = kcs;
|
||||||
table = new Grid(1, 4);
|
table = new Grid(1, 5);
|
||||||
initWidget(table);
|
initWidget(table);
|
||||||
|
|
||||||
final CellFormatter fmt = table.getCellFormatter();
|
final CellFormatter fmt = table.getCellFormatter();
|
||||||
@@ -68,6 +69,7 @@ class NavLinks extends Composite {
|
|||||||
fmt.setHorizontalAlignment(0, 1, HasHorizontalAlignment.ALIGN_CENTER);
|
fmt.setHorizontalAlignment(0, 1, HasHorizontalAlignment.ALIGN_CENTER);
|
||||||
fmt.setHorizontalAlignment(0, 2, HasHorizontalAlignment.ALIGN_RIGHT);
|
fmt.setHorizontalAlignment(0, 2, HasHorizontalAlignment.ALIGN_RIGHT);
|
||||||
fmt.setHorizontalAlignment(0, 3, HasHorizontalAlignment.ALIGN_RIGHT);
|
fmt.setHorizontalAlignment(0, 3, HasHorizontalAlignment.ALIGN_RIGHT);
|
||||||
|
fmt.setHorizontalAlignment(0, 4, HasHorizontalAlignment.ALIGN_RIGHT);
|
||||||
|
|
||||||
final ChangeLink up = new ChangeLink("", patchSetId);
|
final ChangeLink up = new ChangeLink("", patchSetId);
|
||||||
SafeHtml.set(up, SafeHtml.asis(Util.C.upToChangeIconLink()));
|
SafeHtml.set(up, SafeHtml.asis(Util.C.upToChangeIconLink()));
|
||||||
@@ -77,6 +79,10 @@ class NavLinks extends Composite {
|
|||||||
void display(int patchIndex, PatchTable fileList,
|
void display(int patchIndex, PatchTable fileList,
|
||||||
List<InlineHyperlink> links, List<WebLinkInfo> webLinks) {
|
List<InlineHyperlink> links, List<WebLinkInfo> webLinks) {
|
||||||
if (fileList != null) {
|
if (fileList != null) {
|
||||||
|
Label fileCountLabel =
|
||||||
|
new Label(Gerrit.M.fileCount(patchIndex + 1, fileList.size()));
|
||||||
|
fileCountLabel.setStyleName(Gerrit.RESOURCES.css().nowrap());
|
||||||
|
table.setWidget(0, 3, fileCountLabel);
|
||||||
setupNav(Nav.PREV, fileList.getPreviousPatchLink(patchIndex));
|
setupNav(Nav.PREV, fileList.getPreviousPatchLink(patchIndex));
|
||||||
setupNav(Nav.NEXT, fileList.getNextPatchLink(patchIndex));
|
setupNav(Nav.NEXT, fileList.getNextPatchLink(patchIndex));
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -102,6 +102,10 @@ class PatchTable extends Composite {
|
|||||||
return i != null ? i : -1;
|
return i != null ? i : -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int size() {
|
||||||
|
return patchMap.size();
|
||||||
|
}
|
||||||
|
|
||||||
private Map<Patch.Key, Integer> patchMap() {
|
private Map<Patch.Key, Integer> patchMap() {
|
||||||
if (patchMap == null) {
|
if (patchMap == null) {
|
||||||
patchMap = new HashMap<>();
|
patchMap = new HashMap<>();
|
||||||
|
|||||||
Reference in New Issue
Block a user