diff options
author | Eddy Young <jeyoung@priscimon.com> | 2015-05-18 21:11:27 +0100 |
---|---|---|
committer | Eddy Young <jeyoung@priscimon.com> | 2015-05-18 21:11:27 +0100 |
commit | dcb6c5ac7494eddf7435d09353533cf605464bb5 (patch) | |
tree | dce3ca8fe1062f6859ae8ab3a6876f77fdc5409d | |
parent | c9afc9ed01dbc6b74ecb2734d2cd7ed943b5d643 (diff) | |
download | gitblit-dcb6c5ac7494eddf7435d09353533cf605464bb5.tar.gz gitblit-dcb6c5ac7494eddf7435d09353533cf605464bb5.zip |
Initial changes for ticket-57
Added tags to .gitignore
-rw-r--r-- | .classpath | 2 | ||||
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | gitblit.iml | 6 | ||||
-rw-r--r-- | src/main/distrib/data/gitblit.properties | 3 | ||||
-rw-r--r-- | src/main/java/com/gitblit/wicket/pages/MyTicketsPage.html | 10 | ||||
-rw-r--r-- | src/main/java/com/gitblit/wicket/pages/MyTicketsPage.java | 64 |
6 files changed, 71 insertions, 15 deletions
@@ -15,7 +15,7 @@ <classpathentry kind="lib" path="ext/slf4j-log4j12-1.7.5.jar" sourcepath="ext/src/slf4j-log4j12-1.7.5.jar" /> <classpathentry kind="lib" path="ext/javax.mail-1.5.1.jar" sourcepath="ext/src/javax.mail-1.5.1.jar" /> <classpathentry kind="lib" path="ext/javax.servlet-api-3.1.0.jar" sourcepath="ext/src/javax.servlet-api-3.1.0.jar" /> - <classpathentry kind="lib" path="ext/jetty-all-9.2.3.v20140905.jar" sourcepath="ext/src/jetty-all-9.2.3.v20140905.jar" /> + <classpathentry kind="lib" path="ext/jetty-all-9.2.9.v20150224.jar" sourcepath="ext/src/jetty-all-9.2.9.v20150224.jar" /> <classpathentry kind="lib" path="ext/wicket-1.4.21.jar" sourcepath="ext/src/wicket-1.4.21.jar" /> <classpathentry kind="lib" path="ext/wicket-auth-roles-1.4.21.jar" sourcepath="ext/src/wicket-auth-roles-1.4.21.jar" /> <classpathentry kind="lib" path="ext/wicket-extensions-1.4.21.jar" sourcepath="ext/src/wicket-extensions-1.4.21.jar" /> @@ -1,3 +1,4 @@ +tags /temp /lib /ext diff --git a/gitblit.iml b/gitblit.iml index d6f84df7..c2cb93f7 100644 --- a/gitblit.iml +++ b/gitblit.iml @@ -124,13 +124,13 @@ </library> </orderEntry> <orderEntry type="module-library"> - <library name="jetty-all-9.2.3.v20140905.jar"> + <library name="jetty-all-9.2.9.v20150224.jar"> <CLASSES> - <root url="jar://$MODULE_DIR$/ext/jetty-all-9.2.3.v20140905.jar!/" /> + <root url="jar://$MODULE_DIR$/ext/jetty-all-9.2.9.v20150224.jar!/" /> </CLASSES> <JAVADOC /> <SOURCES> - <root url="jar://$MODULE_DIR$/ext/src/jetty-all-9.2.3.v20140905.jar!/" /> + <root url="jar://$MODULE_DIR$/ext/src/jetty-all-9.2.9.v20150224.jar!/" /> </SOURCES> </library> </orderEntry> diff --git a/src/main/distrib/data/gitblit.properties b/src/main/distrib/data/gitblit.properties index f53cc112..7e7e1f4e 100644 --- a/src/main/distrib/data/gitblit.properties +++ b/src/main/distrib/data/gitblit.properties @@ -497,7 +497,8 @@ git.maxPackSizeLimit = -1 # # SINCE 1.4.0 # RESTART REQUIRED -tickets.service = +tickets.service = com.gitblit.tickets.FileTicketService +# # Globally enable or disable creation of new bug, enhancement, task, etc tickets # for all repositories. diff --git a/src/main/java/com/gitblit/wicket/pages/MyTicketsPage.html b/src/main/java/com/gitblit/wicket/pages/MyTicketsPage.html index b0bc1949..d4dd3bc0 100644 --- a/src/main/java/com/gitblit/wicket/pages/MyTicketsPage.html +++ b/src/main/java/com/gitblit/wicket/pages/MyTicketsPage.html @@ -62,6 +62,14 @@ </ul> </div> + // TODO implement repositories list + <div class="btn-group"> + <a class="btn dropdown-toggle" data-toggle="dropdown" href="#"> <wicket:message key="gb.repository"></wicket:message>: <span style="font-weight:bold;" wicket:id="currentRepository"></span> <span class="caret"></span></a> + <ul class="dropdown-menu"> + <li wicket:id="repository"><span wicket:id="repositoryLink"></span></li> + </ul> + </div> + <div class="btn-group pull-right"> <div class="pagination pagination-right pagination-small"> <ul> @@ -81,4 +89,4 @@ </wicket:extend> </body> -</html>
\ No newline at end of file +</html> diff --git a/src/main/java/com/gitblit/wicket/pages/MyTicketsPage.java b/src/main/java/com/gitblit/wicket/pages/MyTicketsPage.java index c207d561..6adf394c 100644 --- a/src/main/java/com/gitblit/wicket/pages/MyTicketsPage.java +++ b/src/main/java/com/gitblit/wicket/pages/MyTicketsPage.java @@ -27,6 +27,7 @@ import org.apache.wicket.markup.repeater.data.DataView; import org.apache.wicket.markup.repeater.data.ListDataProvider; import com.gitblit.Keys; +import com.gitblit.models.RepositoryModel; import com.gitblit.models.TicketModel; import com.gitblit.models.TicketModel.Status; import com.gitblit.models.UserModel; @@ -74,6 +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) ? "" : Lucene.fromString(params.getString("repository", Lucene.repository.name())).name(); final boolean desc = (params == null) ? true : !"asc".equals(params.getString("direction", "desc")); // add the user title panel @@ -91,6 +93,7 @@ public class MyTicketsPage extends RootPage { assignedToParam, sortBy, desc, + repository, 1))); add(new BookmarkablePageLink<Void>("bugsQuery", MyTicketsPage.class, @@ -101,6 +104,7 @@ public class MyTicketsPage extends RootPage { assignedToParam, sortBy, desc, + repository, 1))); add(new BookmarkablePageLink<Void>("enhancementsQuery", MyTicketsPage.class, @@ -111,6 +115,7 @@ public class MyTicketsPage extends RootPage { assignedToParam, sortBy, desc, + repository, 1))); add(new BookmarkablePageLink<Void>("tasksQuery", MyTicketsPage.class, @@ -121,6 +126,7 @@ public class MyTicketsPage extends RootPage { assignedToParam, sortBy, desc, + repository, 1))); add(new BookmarkablePageLink<Void>("questionsQuery", MyTicketsPage.class, @@ -131,6 +137,7 @@ public class MyTicketsPage extends RootPage { assignedToParam, sortBy, desc, + repository, 1))); add(new BookmarkablePageLink<Void>("resetQuery", MyTicketsPage.class, @@ -141,6 +148,7 @@ public class MyTicketsPage extends RootPage { null, null, true, + null, 1))); add(new Label("userDivider")); @@ -152,6 +160,7 @@ public class MyTicketsPage extends RootPage { assignedToParam, sortBy, desc, + repository, 1))); add(new BookmarkablePageLink<Void>("watchedQuery", MyTicketsPage.class, @@ -162,6 +171,7 @@ public class MyTicketsPage extends RootPage { assignedToParam, sortBy, desc, + repository, 1))); add(new BookmarkablePageLink<Void>("mentionsQuery", MyTicketsPage.class, queryParameters( @@ -171,6 +181,7 @@ public class MyTicketsPage extends RootPage { assignedToParam, sortBy, desc, + repository, 1))); add(new BookmarkablePageLink<Void>("responsibleQuery", MyTicketsPage.class, queryParameters( @@ -180,6 +191,7 @@ public class MyTicketsPage extends RootPage { assignedToParam, sortBy, desc, + repository, 1))); // states @@ -188,9 +200,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, 1))); - add(new BookmarkablePageLink<Void>("closedTickets", MyTicketsPage.class, queryParameters(queryParam, milestoneParam, TicketsUI.closedStatii, assignedToParam, sortBy, desc, 1))); - add(new BookmarkablePageLink<Void>("allTickets", MyTicketsPage.class, queryParameters(queryParam, milestoneParam, null, assignedToParam, sortBy, desc, 1))); + 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))); // by status List<Status> statii = new ArrayList<Status>(Arrays.asList(Status.values())); @@ -202,13 +214,14 @@ 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, 1); + PageParameters p = queryParameters(queryParam, milestoneParam, new String [] { status.name().toLowerCase() }, assignedToParam, sortBy, desc, repository, 1); String css = TicketsUI.getStatusClass(status); item.add(new LinkPanel("statusLink", css, status.toString(), MyTicketsPage.class, p).setRenderBodyOnly(true)); } }; add(statiiLinks); + // by sort List<TicketSort> sortChoices = new ArrayList<TicketSort>(); sortChoices.add(new TicketSort(getString("gb.sortNewest"), Lucene.created.name(), true)); sortChoices.add(new TicketSort(getString("gb.sortOldest"), Lucene.created.name(), false)); @@ -237,12 +250,39 @@ 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, 1); + PageParameters params = queryParameters(queryParam, milestoneParam, statiiParam, assignedToParam, ts.sortBy, ts.desc, repository, 1); item.add(new LinkPanel("sortLink", null, ts.name, MyTicketsPage.class, params).setRenderBodyOnly(true)); } }; add(sortMenu); + // by repository + List<RepositoryModel> repositoryChoices = new ArrayList<RepositoryModel>(); + // todo add repository choices here + + RepositoryModel currentRepository = repositoryChoices.size() > 0 ? repositoryChoices.get(0) : null; + for (RepositoryModel r : repositoryChoices) { + if (r.name.equals(repository)) { + currentRepository = r; + break; + } + } + add(new Label("currentRepository", currentRepository == null ? "none" : currentRepository.name)); + + ListDataProvider<RepositoryModel> repositoryChoicesDp = new ListDataProvider<RepositoryModel>(repositoryChoices); + DataView<RepositoryModel> repositoryMenu = new DataView<RepositoryModel>("repository", repositoryChoicesDp) { + private static final long serialVersionUID = 1L; + + @Override + public void populateItem(final Item<RepositoryModel> item) { + final RepositoryModel r = item.getModelObject(); + // todo add repository parameter + PageParameters params = queryParameters(queryParam, milestoneParam, statiiParam, assignedToParam, sortBy, desc, r.name, 1); + item.add(new LinkPanel("repositoryLink", null, r.name, MyTicketsPage.class, params).setRenderBodyOnly(true)); + } + }; + add(repositoryMenu); + // Build Query here QueryBuilder qb = new QueryBuilder(queryParam); if (!qb.containsField(Lucene.status.name()) && !ArrayUtils.isEmpty(statiiParam)) { @@ -292,12 +332,13 @@ public class MyTicketsPage extends RootPage { } int totalResults = results.size() == 0 ? 0 : results.get(0).totalResults; - buildPager(queryParam, milestoneParam, statiiParam, assignedToParam, sortBy, desc, page, pageSize, results.size(), totalResults); + buildPager(queryParam, milestoneParam, statiiParam, assignedToParam, sortBy, desc, repository, page, pageSize, results.size(), totalResults); final boolean showSwatch = app().settings().getBoolean(Keys.web.repositoryListSwatches, true); add(new TicketListPanel("ticketList", results, showSwatch, true)); } + // todo add repository name here protected PageParameters queryParameters( String query, String milestone, @@ -305,6 +346,7 @@ public class MyTicketsPage extends RootPage { String assignedTo, String sort, boolean descending, + String repository, int page) { PageParameters params = WicketUtils.newRepositoryParameter(""); @@ -328,6 +370,9 @@ public class MyTicketsPage extends RootPage { if (!descending) { params.add("direction", "asc"); } + if (!StringUtils.isEmpty(repository)) { + params.add("repository", repository); + } if (page > 1) { params.add("pg", "" + page); } @@ -341,6 +386,7 @@ public class MyTicketsPage extends RootPage { final String assignedTo, final String sort, final boolean desc, + final String repository, final int page, int pageSize, int count, @@ -349,8 +395,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, page - 1)).setEnabled(allowPrev).setVisible(showNav)); - add(new BookmarkablePageLink<Void>("nextLink", MyTicketsPage.class, queryParameters(query, milestone, states, assignedTo, sort, desc, page + 1)).setEnabled(allowNext).setVisible(showNav)); + 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)); if (total <= pageSize) { add(new Label("pageLink").setVisible(false)); @@ -379,7 +425,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, i)); + LinkPanel link = new LinkPanel("page", null, "" + i, MyTicketsPage.class, queryParameters(query, milestone, states, assignedTo, sort, desc, repository, i)); link.setRenderBodyOnly(true); if (i == page) { WicketUtils.setCssClass(item, "active"); |