diff options
author | Eddy Young <jeyoung@priscimon.com> | 2015-05-22 11:08:26 +0100 |
---|---|---|
committer | Eddy Young <jeyoung@priscimon.com> | 2015-05-22 11:08:26 +0100 |
commit | 4cb1a97509b9b42ca7efb4fa0f727b89b044202d (patch) | |
tree | 0a1fb4e10cac9a0a5042752620cc50f2eaad5170 /src | |
parent | 410c92f5c71c93cd2b4b0a1d9ee4067c34b80c66 (diff) | |
download | gitblit-4cb1a97509b9b42ca7efb4fa0f727b89b044202d.tar.gz gitblit-4cb1a97509b9b42ca7efb4fa0f727b89b044202d.zip |
Replaced repository name as search criterion with repository id
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/com/gitblit/wicket/pages/MyTicketsPage.java | 59 |
1 files changed, 29 insertions, 30 deletions
diff --git a/src/main/java/com/gitblit/wicket/pages/MyTicketsPage.java b/src/main/java/com/gitblit/wicket/pages/MyTicketsPage.java index ec0648a1..4da1dcde 100644 --- a/src/main/java/com/gitblit/wicket/pages/MyTicketsPage.java +++ b/src/main/java/com/gitblit/wicket/pages/MyTicketsPage.java @@ -27,7 +27,6 @@ import org.apache.wicket.markup.repeater.data.DataView; import org.apache.wicket.markup.repeater.data.ListDataProvider; import com.gitblit.Keys; -import com.gitblit.client.Translation; import com.gitblit.models.RepositoryModel; import com.gitblit.models.TicketModel; import com.gitblit.models.TicketModel.Status; @@ -76,7 +75,7 @@ public class MyTicketsPage extends RootPage { final String queryParam = (params == null || StringUtils.isEmpty(params.getString("q", null))) ? "watchedby:" + username : params.getString("q", null); final String searchParam = (params == null) ? "" : params.getString("s", null); final String sortBy = (params == null) ? "" : Lucene.fromString(params.getString("sort", Lucene.created.name())).name(); - final String repository = (params == null) ? "" : params.getString("repository", null); + final String repositoryId = (params == null) ? "" : params.getString(Lucene.rid.name(), null); final boolean desc = (params == null) ? true : !"asc".equals(params.getString("direction", "desc")); // add the user title panel @@ -94,7 +93,7 @@ public class MyTicketsPage extends RootPage { assignedToParam, sortBy, desc, - repository, + repositoryId, 1))); add(new BookmarkablePageLink<Void>("bugsQuery", MyTicketsPage.class, @@ -105,7 +104,7 @@ public class MyTicketsPage extends RootPage { assignedToParam, sortBy, desc, - repository, + repositoryId, 1))); add(new BookmarkablePageLink<Void>("enhancementsQuery", MyTicketsPage.class, @@ -116,7 +115,7 @@ public class MyTicketsPage extends RootPage { assignedToParam, sortBy, desc, - repository, + repositoryId, 1))); add(new BookmarkablePageLink<Void>("tasksQuery", MyTicketsPage.class, @@ -127,7 +126,7 @@ public class MyTicketsPage extends RootPage { assignedToParam, sortBy, desc, - repository, + repositoryId, 1))); add(new BookmarkablePageLink<Void>("questionsQuery", MyTicketsPage.class, @@ -138,7 +137,7 @@ public class MyTicketsPage extends RootPage { assignedToParam, sortBy, desc, - repository, + repositoryId, 1))); add(new BookmarkablePageLink<Void>("maintenanceQuery", MyTicketsPage.class, @@ -149,7 +148,7 @@ public class MyTicketsPage extends RootPage { assignedToParam, sortBy, desc, - repository, + repositoryId, 1))); add(new BookmarkablePageLink<Void>("resetQuery", MyTicketsPage.class, @@ -172,7 +171,7 @@ public class MyTicketsPage extends RootPage { assignedToParam, sortBy, desc, - repository, + repositoryId, 1))); add(new BookmarkablePageLink<Void>("watchedQuery", MyTicketsPage.class, @@ -183,7 +182,7 @@ public class MyTicketsPage extends RootPage { assignedToParam, sortBy, desc, - repository, + repositoryId, 1))); add(new BookmarkablePageLink<Void>("mentionsQuery", MyTicketsPage.class, queryParameters( @@ -193,7 +192,7 @@ public class MyTicketsPage extends RootPage { assignedToParam, sortBy, desc, - repository, + repositoryId, 1))); add(new BookmarkablePageLink<Void>("responsibleQuery", MyTicketsPage.class, queryParameters( @@ -203,7 +202,7 @@ public class MyTicketsPage extends RootPage { assignedToParam, sortBy, desc, - repository, + repositoryId, 1))); // states @@ -212,9 +211,9 @@ public class MyTicketsPage extends RootPage { } else { add(new Label("selectedStatii", StringUtils.flattenStrings(Arrays.asList(statiiParam), ","))); } - add(new BookmarkablePageLink<Void>("openTickets", MyTicketsPage.class, queryParameters(queryParam, milestoneParam, TicketsUI.openStatii, assignedToParam, sortBy, desc, repository, 1))); - add(new BookmarkablePageLink<Void>("closedTickets", MyTicketsPage.class, queryParameters(queryParam, milestoneParam, TicketsUI.closedStatii, assignedToParam, sortBy, desc, repository, 1))); - add(new BookmarkablePageLink<Void>("allTickets", MyTicketsPage.class, queryParameters(queryParam, milestoneParam, null, assignedToParam, sortBy, desc, repository, 1))); + add(new BookmarkablePageLink<Void>("openTickets", MyTicketsPage.class, queryParameters(queryParam, milestoneParam, TicketsUI.openStatii, assignedToParam, sortBy, desc, repositoryId, 1))); + add(new BookmarkablePageLink<Void>("closedTickets", MyTicketsPage.class, queryParameters(queryParam, milestoneParam, TicketsUI.closedStatii, assignedToParam, sortBy, desc, repositoryId, 1))); + add(new BookmarkablePageLink<Void>("allTickets", MyTicketsPage.class, queryParameters(queryParam, milestoneParam, null, assignedToParam, sortBy, desc, repositoryId, 1))); // by status List<Status> statii = new ArrayList<Status>(Arrays.asList(Status.values())); @@ -226,7 +225,7 @@ public class MyTicketsPage extends RootPage { @Override public void populateItem(final Item<Status> item) { final Status status = item.getModelObject(); - PageParameters p = queryParameters(queryParam, milestoneParam, new String [] { status.name().toLowerCase() }, assignedToParam, sortBy, desc, repository, 1); + PageParameters p = queryParameters(queryParam, milestoneParam, new String [] { status.name().toLowerCase() }, assignedToParam, sortBy, desc, repositoryId, 1); String css = TicketsUI.getStatusClass(status); item.add(new LinkPanel("statusLink", css, status.toString(), MyTicketsPage.class, p).setRenderBodyOnly(true)); } @@ -266,7 +265,7 @@ public class MyTicketsPage extends RootPage { @Override public void populateItem(final Item<TicketSort> item) { final TicketSort ts = item.getModelObject(); - PageParameters params = queryParameters(queryParam, milestoneParam, statiiParam, assignedToParam, ts.sortBy, ts.desc, repository, 1); + PageParameters params = queryParameters(queryParam, milestoneParam, statiiParam, assignedToParam, ts.sortBy, ts.desc, repositoryId, 1); item.add(new LinkPanel("sortLink", null, ts.name, MyTicketsPage.class, params).setRenderBodyOnly(true)); } }; @@ -275,11 +274,11 @@ public class MyTicketsPage extends RootPage { // by repository List<RepositoryModel> repositoryChoices = getRepositoryModels(); RepositoryModel noneChoice = new RepositoryModel(); - noneChoice.name = Translation.get("gb.all"); + noneChoice.name = getString("gb.all"); repositoryChoices.add(0, noneChoice); RepositoryModel currentRepository = repositoryChoices.size() > 0 ? repositoryChoices.get(0) : null; for (RepositoryModel r : repositoryChoices) { - if (r.name.equals(repository)) { + if (r.getRID().equals(repositoryId)) { currentRepository = r; break; } @@ -293,7 +292,7 @@ public class MyTicketsPage extends RootPage { @Override public void populateItem(final Item<RepositoryModel> item) { final RepositoryModel r = item.getModelObject(); - PageParameters params = queryParameters(queryParam, milestoneParam, statiiParam, assignedToParam, sortBy, desc, r.name, 1); + PageParameters params = queryParameters(queryParam, milestoneParam, statiiParam, assignedToParam, sortBy, desc, r.getRID(), 1); item.add(new LinkPanel("repositoryLink", null, r.toString(), MyTicketsPage.class, params).setRenderBodyOnly(true)); } }; @@ -320,9 +319,9 @@ public class MyTicketsPage extends RootPage { } } - if (!qb.containsField(Lucene.repository.name()) && !StringUtils.isEmpty(repository)) { + if (noneChoice != currentRepository && !qb.containsField(Lucene.rid.name())) { QueryBuilder q1 = new QueryBuilder(); - q1.and(Lucene.repository.matches(repository)); + q1.and(Lucene.rid.matches(repositoryId)); qb.and(q1.toSubquery().toString()); } @@ -354,7 +353,7 @@ public class MyTicketsPage extends RootPage { } int totalResults = results.size() == 0 ? 0 : results.get(0).totalResults; - buildPager(queryParam, milestoneParam, statiiParam, assignedToParam, sortBy, desc, repository, page, pageSize, results.size(), totalResults); + buildPager(queryParam, milestoneParam, statiiParam, assignedToParam, sortBy, desc, repositoryId, page, pageSize, results.size(), totalResults); final boolean showSwatch = app().settings().getBoolean(Keys.web.repositoryListSwatches, true); add(new TicketListPanel("ticketList", results, showSwatch, true)); @@ -367,7 +366,7 @@ public class MyTicketsPage extends RootPage { String assignedTo, String sort, boolean descending, - String repository, + String repositoryId, int page) { PageParameters params = WicketUtils.newRepositoryParameter(""); @@ -391,8 +390,8 @@ public class MyTicketsPage extends RootPage { if (!descending) { params.add("direction", "asc"); } - if (!StringUtils.isEmpty(repository)) { - params.add(Lucene.repository.name(), repository); + if (!StringUtils.isEmpty(repositoryId)) { + params.add(Lucene.rid.name(), repositoryId); } if (page > 1) { params.add("pg", "" + page); @@ -407,7 +406,7 @@ public class MyTicketsPage extends RootPage { final String assignedTo, final String sort, final boolean desc, - final String repository, + final String repositoryId, final int page, int pageSize, int count, @@ -416,8 +415,8 @@ public class MyTicketsPage extends RootPage { boolean showNav = total > (2 * pageSize); boolean allowPrev = page > 1; boolean allowNext = (pageSize * (page - 1) + count) < total; - add(new BookmarkablePageLink<Void>("prevLink", MyTicketsPage.class, queryParameters(query, milestone, states, assignedTo, sort, desc, repository, page - 1)).setEnabled(allowPrev).setVisible(showNav)); - add(new BookmarkablePageLink<Void>("nextLink", MyTicketsPage.class, queryParameters(query, milestone, states, assignedTo, sort, desc, repository, page + 1)).setEnabled(allowNext).setVisible(showNav)); + add(new BookmarkablePageLink<Void>("prevLink", MyTicketsPage.class, queryParameters(query, milestone, states, assignedTo, sort, desc, repositoryId, page - 1)).setEnabled(allowPrev).setVisible(showNav)); + add(new BookmarkablePageLink<Void>("nextLink", MyTicketsPage.class, queryParameters(query, milestone, states, assignedTo, sort, desc, repositoryId, page + 1)).setEnabled(allowNext).setVisible(showNav)); if (total <= pageSize) { add(new Label("pageLink").setVisible(false)); @@ -446,7 +445,7 @@ public class MyTicketsPage extends RootPage { @Override public void populateItem(final Item<Integer> item) { final Integer i = item.getModelObject(); - LinkPanel link = new LinkPanel("page", null, "" + i, MyTicketsPage.class, queryParameters(query, milestone, states, assignedTo, sort, desc, repository, i)); + LinkPanel link = new LinkPanel("page", null, "" + i, MyTicketsPage.class, queryParameters(query, milestone, states, assignedTo, sort, desc, repositoryId, i)); link.setRenderBodyOnly(true); if (i == page) { WicketUtils.setCssClass(item, "active"); |