Remove query limit when drilling down from a dashboard to a query
By clicking on the section header in a custom dashboard one can
navigate to the query of that section. In a dashboard space is limited
which is why the section queries often have a limit operator so that a
section cannot grow too big. Sometimes it makes sense to drill down
into a query and look at the complete query result. Remove any limit
operator automatically when drilling down into a section query.
Change-Id: Ic346f66fb7dec3911e9798f03f9301e87af4d7c0
Signed-off-by: Edwin Kempin <edwin.kempin@sap.com>
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/DashboardTable.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/DashboardTable.java
index 3002e48..6b5fc2a 100644
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/DashboardTable.java
+++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/DashboardTable.java
@@ -67,12 +67,24 @@
int i = 0;
for (String title : titles) {
Section s = new Section();
- s.setTitleWidget(new InlineHyperlink(title, PageLinks.toChangeQuery(queries.get(i++))));
+ String query = removeLimit(queries.get(i++));
+ s.setTitleWidget(new InlineHyperlink(title, PageLinks.toChangeQuery(query)));
addSection(s);
sections.add(s);
}
}
+ private String removeLimit(String query) {
+ StringBuilder unlimitedQuery = new StringBuilder();
+ String[] operators = query.split(" ");
+ for (String o : operators) {
+ if (!o.startsWith("limit:")) {
+ unlimitedQuery.append(o).append(" ");
+ }
+ }
+ return unlimitedQuery.toString().trim();
+ }
+
public String getTitle() {
return title;
}