repos.jspf revision fd69097910ff7088bdb89229aa52193803ac05c5
888273610a036b1d0d39339d0057352922648a5bVladimir KotalCDDL HEADER START
888273610a036b1d0d39339d0057352922648a5bVladimir KotalThe contents of this file are subject to the terms of the
888273610a036b1d0d39339d0057352922648a5bVladimir KotalCommon Development and Distribution License (the "License").
888273610a036b1d0d39339d0057352922648a5bVladimir KotalYou may not use this file except in compliance with the License.
888273610a036b1d0d39339d0057352922648a5bVladimir KotalSee LICENSE.txt included in this distribution for the specific
888273610a036b1d0d39339d0057352922648a5bVladimir Kotallanguage governing permissions and limitations under the License.
888273610a036b1d0d39339d0057352922648a5bVladimir KotalWhen distributing Covered Code, include this CDDL HEADER in each
888273610a036b1d0d39339d0057352922648a5bVladimir Kotalfile and include the License file at LICENSE.txt.
888273610a036b1d0d39339d0057352922648a5bVladimir KotalIf applicable, add the following below this CDDL HEADER, with the
888273610a036b1d0d39339d0057352922648a5bVladimir Kotalfields enclosed by brackets "[]" replaced with your own identifying
888273610a036b1d0d39339d0057352922648a5bVladimir Kotalinformation: Portions Copyright [yyyy] [name of copyright owner]
888273610a036b1d0d39339d0057352922648a5bVladimir KotalCDDL HEADER END
888273610a036b1d0d39339d0057352922648a5bVladimir KotalCopyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
d470e59c0405a31b7e5f194bd9b705e91b12bf0aKryštof Tulinger<%@page import="org.json.simple.JSONArray"%>
d470e59c0405a31b7e5f194bd9b705e91b12bf0aKryštof Tulinger<%@page import="org.opensolaris.opengrok.configuration.messages.Message"%>
d470e59c0405a31b7e5f194bd9b705e91b12bf0aKryštof Tulinger<%@page import="java.util.SortedSet"%>
d470e59c0405a31b7e5f194bd9b705e91b12bf0aKryštof Tulinger<%@page import="java.util.SortedSet"%>
888273610a036b1d0d39339d0057352922648a5bVladimir Kotal<%@page import="java.util.Set"%>
888273610a036b1d0d39339d0057352922648a5bVladimir Kotal<%@page import="java.util.ArrayList"%>
888273610a036b1d0d39339d0057352922648a5bVladimir Kotal<%@page import="java.util.Date"%>
888273610a036b1d0d39339d0057352922648a5bVladimir Kotal<%@page import="org.opensolaris.opengrok.web.Prefix"%>
888273610a036b1d0d39339d0057352922648a5bVladimir Kotal<%@page import="org.opensolaris.opengrok.web.ProjectHelper"%>
888273610a036b1d0d39339d0057352922648a5bVladimir Kotal<%@page import="java.util.LinkedList"%>
888273610a036b1d0d39339d0057352922648a5bVladimir Kotal<%@page import="java.util.Collections"%>
888273610a036b1d0d39339d0057352922648a5bVladimir Kotal<%@page import="java.util.Comparator"%>
d470e59c0405a31b7e5f194bd9b705e91b12bf0aKryštof Tulinger<%@page import="java.util.Collection"%>
888273610a036b1d0d39339d0057352922648a5bVladimir Kotal<%@page import="java.io.File"%>
888273610a036b1d0d39339d0057352922648a5bVladimir Kotal<%@page import="org.opensolaris.opengrok.configuration.RuntimeEnvironment"%>
888273610a036b1d0d39339d0057352922648a5bVladimir Kotal<%@page import="org.opensolaris.opengrok.history.RepositoryInfo"%>
888273610a036b1d0d39339d0057352922648a5bVladimir Kotal<%@page import="org.opensolaris.opengrok.history.Repository"%>
888273610a036b1d0d39339d0057352922648a5bVladimir Kotal<%@page import="org.opensolaris.opengrok.web.Util"%>
888273610a036b1d0d39339d0057352922648a5bVladimir Kotal<%@page import="org.opensolaris.opengrok.configuration.Project"%>
888273610a036b1d0d39339d0057352922648a5bVladimir Kotal<%@page import="org.opensolaris.opengrok.configuration.Group"%>
888273610a036b1d0d39339d0057352922648a5bVladimir Kotal<%@page import="java.util.List"%>
888273610a036b1d0d39339d0057352922648a5bVladimir Kotal<%@page import="org.opensolaris.opengrok.web.PageConfig"%>
d470e59c0405a31b7e5f194bd9b705e91b12bf0aKryštof Tulinger<script src="<%=request.getContextPath()%>/js/repos.js" type="text/javascript"></script>
d470e59c0405a31b7e5f194bd9b705e91b12bf0aKryštof Tulinger PageConfig cfg = PageConfig.get(request);
d470e59c0405a31b7e5f194bd9b705e91b12bf0aKryštof Tulinger Util.printMessages(out, cfg.getMessages());
d470e59c0405a31b7e5f194bd9b705e91b12bf0aKryštof Tulinger Comparator<RepositoryInfo> comparatorRepo = new Comparator<RepositoryInfo>() {
888273610a036b1d0d39339d0057352922648a5bVladimir Kotal public int compare(RepositoryInfo r1, RepositoryInfo r2) {
d470e59c0405a31b7e5f194bd9b705e91b12bf0aKryštof Tulinger return r1.getDirectoryName().compareTo(r2.getDirectoryName());
d470e59c0405a31b7e5f194bd9b705e91b12bf0aKryštof Tulinger ProjectHelper pHelper = cfg.getProjectHelper();
d470e59c0405a31b7e5f194bd9b705e91b12bf0aKryštof Tulinger if (pHelper.getAllProjects().size() > 0) {
d470e59c0405a31b7e5f194bd9b705e91b12bf0aKryštof Tulinger Set<Group> groups = pHelper.getGroups();
d470e59c0405a31b7e5f194bd9b705e91b12bf0aKryštof Tulinger Set<Project> repositories = pHelper.getUngroupedRepositories();
d470e59c0405a31b7e5f194bd9b705e91b12bf0aKryštof Tulinger // recursively print all groups
d470e59c0405a31b7e5f194bd9b705e91b12bf0aKryštof Tulinger <div class="panel-group projects">
d470e59c0405a31b7e5f194bd9b705e91b12bf0aKryštof Tulinger <div class="toggle-buttons">
888273610a036b1d0d39339d0057352922648a5bVladimir Kotal <a href="#" class="accordion_show_all">
d470e59c0405a31b7e5f194bd9b705e91b12bf0aKryštof Tulinger <button>Show all</button>
888273610a036b1d0d39339d0057352922648a5bVladimir Kotal <a href="#" class="accordion_hide_all">
d470e59c0405a31b7e5f194bd9b705e91b12bf0aKryštof Tulinger <button>Hide all</button>
d470e59c0405a31b7e5f194bd9b705e91b12bf0aKryštof Tulinger LinkedList<Group> stack = new LinkedList<Group>();
d470e59c0405a31b7e5f194bd9b705e91b12bf0aKryštof Tulinger for ( Group x : groups ) {
d470e59c0405a31b7e5f194bd9b705e91b12bf0aKryštof Tulinger if (x.getParent() == null && (pHelper.hasAllowedSubgroup(x) || cfg.isAllowed(x))) {
d470e59c0405a31b7e5f194bd9b705e91b12bf0aKryštof Tulinger Group group = stack.element();
d470e59c0405a31b7e5f194bd9b705e91b12bf0aKryštof Tulinger // already processed
d470e59c0405a31b7e5f194bd9b705e91b12bf0aKryštof Tulinger %></div><!-- body -->
d470e59c0405a31b7e5f194bd9b705e91b12bf0aKryštof Tulinger </div><!-- panel --><%
d470e59c0405a31b7e5f194bd9b705e91b12bf0aKryštof Tulinger for (Group x : pHelper.getSubgroups(group)) {
d470e59c0405a31b7e5f194bd9b705e91b12bf0aKryštof Tulinger if (cfg.isAllowed(x) || pHelper.hasAllowedSubgroup(x)) {
d470e59c0405a31b7e5f194bd9b705e91b12bf0aKryštof Tulinger %><div class="panel">
d470e59c0405a31b7e5f194bd9b705e91b12bf0aKryštof Tulinger <div class="panel-heading-accordion">
d470e59c0405a31b7e5f194bd9b705e91b12bf0aKryštof Tulinger <h4 class="clearfix">
d470e59c0405a31b7e5f194bd9b705e91b12bf0aKryštof Tulinger <span class="pull-left">
d470e59c0405a31b7e5f194bd9b705e91b12bf0aKryštof Tulinger <span class="name"><%= Util.htmlize(group.getName())%></span>
d470e59c0405a31b7e5f194bd9b705e91b12bf0aKryštof Tulinger [<a href="#" class="projects_select_all">select all</a>]
d470e59c0405a31b7e5f194bd9b705e91b12bf0aKryštof Tulinger (<span title="Number of groups directly in this group"><%= pHelper.getSubgroups(group).size() %></span> +
d470e59c0405a31b7e5f194bd9b705e91b12bf0aKryštof Tulinger <span title="Number of repositories directly in this group"><%= pHelper.getRepositories(group).size() %></span>)
d470e59c0405a31b7e5f194bd9b705e91b12bf0aKryštof Tulinger <span class="pull-right">
d470e59c0405a31b7e5f194bd9b705e91b12bf0aKryštof Tulinger <span class="fold <%= pHelper.hasFavourite(group) ? "fold-up" : "fold-down"%>"></span>
d470e59c0405a31b7e5f194bd9b705e91b12bf0aKryštof Tulinger <div class="panel-body-accordion<% if (pHelper.hasFavourite(group)) { %> favourite<% } %>"
d470e59c0405a31b7e5f194bd9b705e91b12bf0aKryštof Tulinger <% if (pHelper.hasFavourite(group) || pHelper.getRepositories(group).size() < 5) { %>data-accordion-visible="true"<% } %>>
d470e59c0405a31b7e5f194bd9b705e91b12bf0aKryštof Tulinger if (pHelper.getRepositories(group).size() > 0 ) {
d470e59c0405a31b7e5f194bd9b705e91b12bf0aKryštof Tulinger <td><b>Mirror</b></td>
d470e59c0405a31b7e5f194bd9b705e91b12bf0aKryštof Tulinger <td><b>SCM type</b></td>
d470e59c0405a31b7e5f194bd9b705e91b12bf0aKryštof Tulinger <td><b>Parent (branch)</b></td>
d470e59c0405a31b7e5f194bd9b705e91b12bf0aKryštof Tulinger <td><b>Current version</b></td>
d470e59c0405a31b7e5f194bd9b705e91b12bf0aKryštof Tulinger for ( Project project : pHelper.getRepositories(group)) {
d470e59c0405a31b7e5f194bd9b705e91b12bf0aKryštof Tulinger List<RepositoryInfo> repos = pHelper.getRepositoryInfo(project);
d470e59c0405a31b7e5f194bd9b705e91b12bf0aKryštof Tulinger String projDesc = project.getDescription();
d470e59c0405a31b7e5f194bd9b705e91b12bf0aKryštof Tulinger Integer cnt = 0;
d470e59c0405a31b7e5f194bd9b705e91b12bf0aKryštof Tulinger Collections.sort(repos, comparatorRepo);
d470e59c0405a31b7e5f194bd9b705e91b12bf0aKryštof Tulinger for (RepositoryInfo ri : repos) {
d470e59c0405a31b7e5f194bd9b705e91b12bf0aKryštof Tulinger if (cnt > 0 && ri.getParent() == null)
6d0bbc3c98687adba7128b171c9a3ed2a4daf5b8Vladimir Kotal // discard repositories without a parent url
d470e59c0405a31b7e5f194bd9b705e91b12bf0aKryštof Tulinger if (cnt != 0) {
d470e59c0405a31b7e5f194bd9b705e91b12bf0aKryštof Tulinger .replace(cfg.getSourceRootPath() + File.separator, "");
d470e59c0405a31b7e5f194bd9b705e91b12bf0aKryštof Tulinger <td class="name <%= cnt > 0 ? "subrepository" : "repository" %>">
d470e59c0405a31b7e5f194bd9b705e91b12bf0aKryštof Tulinger <a href="<%= request.getContextPath() + Prefix.XREF_P + "/" + projDesc%>"
d470e59c0405a31b7e5f194bd9b705e91b12bf0aKryštof Tulinger title="Xref for project <%= Util.htmlize(projDesc) %>">
d470e59c0405a31b7e5f194bd9b705e91b12bf0aKryštof Tulinger <%= Util.htmlize(projDesc) %>
d470e59c0405a31b7e5f194bd9b705e91b12bf0aKryštof Tulinger JSONArray messages = Util.messagesToJson(project.getDescription());
d470e59c0405a31b7e5f194bd9b705e91b12bf0aKryštof Tulinger <span class="important-note important-note-rounded" data-messages='<%= messages %>'>!</span>
d470e59c0405a31b7e5f194bd9b705e91b12bf0aKryštof Tulinger String parent = ri.getParent();
d470e59c0405a31b7e5f194bd9b705e91b12bf0aKryštof Tulinger if (parent == null) {
d470e59c0405a31b7e5f194bd9b705e91b12bf0aKryštof Tulinger parent = "N/A";
d470e59c0405a31b7e5f194bd9b705e91b12bf0aKryštof Tulinger String type = ri.getType();
d470e59c0405a31b7e5f194bd9b705e91b12bf0aKryštof Tulinger if (type == null) {
d470e59c0405a31b7e5f194bd9b705e91b12bf0aKryštof Tulinger type = "N/A";
d470e59c0405a31b7e5f194bd9b705e91b12bf0aKryštof Tulinger String branch = ri.getBranch();
d470e59c0405a31b7e5f194bd9b705e91b12bf0aKryštof Tulinger if (branch == null) {
d470e59c0405a31b7e5f194bd9b705e91b12bf0aKryštof Tulinger branch = "N/A";
d470e59c0405a31b7e5f194bd9b705e91b12bf0aKryštof Tulinger String currentVersion = ri.getCurrentVersion();
d470e59c0405a31b7e5f194bd9b705e91b12bf0aKryštof Tulinger if (currentVersion == null) {
d470e59c0405a31b7e5f194bd9b705e91b12bf0aKryštof Tulinger currentVersion = "N/A";
d470e59c0405a31b7e5f194bd9b705e91b12bf0aKryštof Tulinger %><td><%= Util.htmlize(type) %></td><%
d470e59c0405a31b7e5f194bd9b705e91b12bf0aKryštof Tulinger %><td><%= Util.htmlize(parent) %> (<%= Util.htmlize(branch) %>)</td><%
d470e59c0405a31b7e5f194bd9b705e91b12bf0aKryštof Tulinger // Current index collapse threshold minimum of 10
d470e59c0405a31b7e5f194bd9b705e91b12bf0aKryštof Tulinger int summaryLength = Math.max(10, cfg.getCurrentIndexedCollapseThreshold());
d470e59c0405a31b7e5f194bd9b705e91b12bf0aKryštof Tulinger String cout = Util.htmlize(currentVersion);
d470e59c0405a31b7e5f194bd9b705e91b12bf0aKryštof Tulinger boolean showSummary = false;
d470e59c0405a31b7e5f194bd9b705e91b12bf0aKryštof Tulinger String coutSummary = currentVersion;
d470e59c0405a31b7e5f194bd9b705e91b12bf0aKryštof Tulinger if (coutSummary.length() > summaryLength) {
d470e59c0405a31b7e5f194bd9b705e91b12bf0aKryštof Tulinger showSummary = true;
d470e59c0405a31b7e5f194bd9b705e91b12bf0aKryštof Tulinger coutSummary = coutSummary.substring(0, summaryLength - 1);
d470e59c0405a31b7e5f194bd9b705e91b12bf0aKryštof Tulinger coutSummary = Util.htmlize(coutSummary);
d470e59c0405a31b7e5f194bd9b705e91b12bf0aKryštof Tulinger if (showSummary) {
d470e59c0405a31b7e5f194bd9b705e91b12bf0aKryštof Tulinger <span class="rev-message-summary"><%= coutSummary %></span>
d470e59c0405a31b7e5f194bd9b705e91b12bf0aKryštof Tulinger <span class="rev-message-full rev-message-hidden"><%= cout %></span>
d470e59c0405a31b7e5f194bd9b705e91b12bf0aKryštof Tulinger <span data-toggle-state="less"><a class="rev-toggle-a rev-message-toggle " href="#">show more ... </a></span>
d470e59c0405a31b7e5f194bd9b705e91b12bf0aKryštof Tulinger %><span class="rev-message-full"><%= cout %></span><%
d470e59c0405a31b7e5f194bd9b705e91b12bf0aKryštof Tulinger } else if ( pHelper.getRepositories(group).size() <= 0 && !pHelper.hasAllowedSubgroup(group) ) {
d470e59c0405a31b7e5f194bd9b705e91b12bf0aKryštof Tulinger %>No projects<%
d470e59c0405a31b7e5f194bd9b705e91b12bf0aKryštof Tulinger // print the rest of projects which don't have a group
d470e59c0405a31b7e5f194bd9b705e91b12bf0aKryštof Tulinger <div class="panel-group projects">
d470e59c0405a31b7e5f194bd9b705e91b12bf0aKryštof Tulinger <% if (groups.size() > 0) { %>
d470e59c0405a31b7e5f194bd9b705e91b12bf0aKryštof Tulinger <div class="toggle-buttons">
d470e59c0405a31b7e5f194bd9b705e91b12bf0aKryštof Tulinger <a href="#" class="accordion_show_all">
d470e59c0405a31b7e5f194bd9b705e91b12bf0aKryštof Tulinger <button>Show all</button>
888273610a036b1d0d39339d0057352922648a5bVladimir Kotal <a href="#" class="accordion_hide_all">
888273610a036b1d0d39339d0057352922648a5bVladimir Kotal <button>Hide all</button>
888273610a036b1d0d39339d0057352922648a5bVladimir Kotal <div class="panel">
<% if (groups.size() > 0) {%>
(<span title="Number of repositories inside"><%= repositories.size() %></span>)
<span class="fold <%= pHelper.hasUngroupedFavourite() ? "fold-up" : "fold-down"%>"></span>
<div class="panel-body<% if (groups.size() > 0) {%>-accordion<% } %> <% if (pHelper.hasUngroupedFavourite()) { %> favourite<% } %>"
<% if (pHelper.hasUngroupedFavourite()) { %>data-accordion-visible="true"<% } %>>
List<RepositoryInfo> repos = pHelper.getRepositoryInfo(proj);
String projDesc = proj.getDescription();
Collections.sort(repos, comparatorRepo);
if (cnt > 0 && ri.getParent() == null)
projDesc = ri.getDirectoryName()
title="Xref for project <%= Util.htmlize(projDesc) %>">
<%= Util.htmlize(projDesc) %>
if (!messages.isEmpty()) { %>
String parent = ri.getParent();
String type = ri.getType();
String branch = ri.getBranch();
String currentVersion = ri.getCurrentVersion();
%><td><%= Util.htmlize(type) %></td><%
String cout = Util.htmlize(currentVersion);
if (coutSummary.length() > summaryLength) {
coutSummary = coutSummary.substring(0, summaryLength - 1);
coutSummary = Util.htmlize(coutSummary);