| | |
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | |
|
| | | import org.apache.wicket.Component;
|
| | | import org.apache.wicket.PageParameters;
|
| | | import org.apache.wicket.extensions.markup.html.repeater.data.sort.OrderByBorder;
|
| | | import org.apache.wicket.extensions.markup.html.repeater.util.SortParam;
|
| | |
| | | import com.gitblit.utils.TimeUtils;
|
| | | import com.gitblit.wicket.GitBlitWebSession;
|
| | | import com.gitblit.wicket.WicketUtils;
|
| | | import com.gitblit.wicket.pages.BasePage;
|
| | | import com.gitblit.wicket.pages.EditRepositoryPage;
|
| | | import com.gitblit.wicket.pages.EmptyRepositoryPage;
|
| | | import com.gitblit.wicket.pages.SummaryPage;
|
| | |
|
| | | public class RepositoriesPanel extends BasePanel {
|
| | |
| | | private static final long serialVersionUID = 1L;
|
| | |
|
| | | public RepositoriesPanel(String wicketId, final boolean showAdmin,
|
| | | List<RepositoryModel> models,
|
| | | List<RepositoryModel> models, boolean enableLinks,
|
| | | final Map<AccessRestrictionType, String> accessRestrictionTranslations) {
|
| | | super(wicketId);
|
| | |
|
| | | final boolean linksActive;
|
| | | final boolean linksActive = enableLinks;
|
| | | final boolean showSize = GitBlit.getBoolean(Keys.web.showRepositorySizes, true);
|
| | |
|
| | | final UserModel user = GitBlitWebSession.get().getUser();
|
| | | if (models == null) {
|
| | | linksActive = true;
|
| | | models = GitBlit.self().getRepositoryModels(user);
|
| | | } else {
|
| | | // disable links if the repositories are already provided
|
| | | // the repositories are most likely from a proposal
|
| | | linksActive = false;
|
| | | }
|
| | |
|
| | | final IDataProvider<RepositoryModel> dp;
|
| | |
|
| | |
| | | item.add(row);
|
| | |
|
| | | // try to strip group name for less cluttered list
|
| | | String repoName = entry.name;
|
| | | String repoName = entry.toString();
|
| | | if (!StringUtils.isEmpty(currGroupName) && (repoName.indexOf('/') > -1)) {
|
| | | repoName = repoName.substring(currGroupName.length() + 1);
|
| | | }
|
| | |
|
| | | |
| | | // repository swatch
|
| | | Label swatch = new Label("repositorySwatch", " ");
|
| | | WicketUtils.setCssBackground(swatch, entry.name);
|
| | | Component swatch = new Label("repositorySwatch", " ").setEscapeModelStrings(false);
|
| | | WicketUtils.setCssBackground(swatch, entry.toString());
|
| | | row.add(swatch);
|
| | | swatch.setVisible(showSwatch);
|
| | |
|
| | | if (entry.hasCommits && linksActive) {
|
| | | if (linksActive) {
|
| | | Class<? extends BasePage> linkPage;
|
| | | if (entry.hasCommits) {
|
| | | // repository has content
|
| | | linkPage = SummaryPage.class;
|
| | | } else {
|
| | | // new/empty repository OR proposed repository
|
| | | linkPage = EmptyRepositoryPage.class;
|
| | | }
|
| | |
|
| | | PageParameters pp = WicketUtils.newRepositoryParameter(entry.name);
|
| | | row.add(new LinkPanel("repositoryName", "list", repoName, SummaryPage.class, pp));
|
| | | row.add(new LinkPanel("repositoryName", "list", repoName, linkPage, pp));
|
| | | row.add(new LinkPanel("repositoryDescription", "list", entry.description,
|
| | | SummaryPage.class, pp));
|
| | | linkPage, pp));
|
| | | } else {
|
| | | // new/empty repository OR proposed repository
|
| | | // no links like on a federation page
|
| | | row.add(new Label("repositoryName", repoName));
|
| | | row.add(new Label("repositoryDescription", entry.description));
|
| | | }
|
| | |
|
| | | if (entry.hasCommits) {
|
| | | // Existing repository
|
| | | row.add(new Label("repositorySize", entry.size).setVisible(showSize));
|