| | |
| | | import com.gitblit.models.RepositoryModel;
|
| | | import com.gitblit.models.UserModel;
|
| | | import com.gitblit.utils.StringUtils;
|
| | | import com.gitblit.utils.TimeUtils;
|
| | | import com.gitblit.wicket.GitBlitWebSession;
|
| | | import com.gitblit.wicket.WicketUtils;
|
| | | import com.gitblit.wicket.pages.BasePage;
|
| | |
| | | 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
|
| | | Component swatch = new Label("repositorySwatch", " ").setEscapeModelStrings(false);
|
| | | WicketUtils.setCssBackground(swatch, entry.name);
|
| | | Component swatch;
|
| | | if (entry.isBare){
|
| | | swatch = new Label("repositorySwatch", " ").setEscapeModelStrings(false);
|
| | | } else {
|
| | | swatch = new Label("repositorySwatch", "!");
|
| | | WicketUtils.setHtmlTooltip(swatch, getString("gb.workingCopyWarning"));
|
| | | }
|
| | | WicketUtils.setCssBackground(swatch, entry.toString());
|
| | | row.add(swatch);
|
| | | swatch.setVisible(showSwatch);
|
| | |
|
| | |
| | | row.add(new Label("repositorySize", entry.size).setVisible(showSize));
|
| | | } else {
|
| | | // New repository
|
| | | row.add(new Label("repositorySize", "<span class='empty'>(empty)</span>")
|
| | | row.add(new Label("repositorySize", "<span class='empty'>(" + getString("gb.empty") + ")</span>")
|
| | | .setEscapeModelStrings(false));
|
| | | }
|
| | |
|
| | |
| | | if (entry.lastChange.getTime() == 0) {
|
| | | lastChange = "--";
|
| | | } else {
|
| | | lastChange = TimeUtils.timeAgo(entry.lastChange);
|
| | | lastChange = getTimeUtils().timeAgo(entry.lastChange);
|
| | | }
|
| | | Label lastChangeLabel = new Label("repositoryLastChange", lastChange);
|
| | | row.add(lastChangeLabel);
|
| | | WicketUtils.setCssClass(lastChangeLabel, TimeUtils.timeAgoCss(entry.lastChange));
|
| | | WicketUtils.setCssClass(lastChangeLabel, getTimeUtils().timeAgoCss(entry.lastChange));
|
| | |
|
| | | boolean showOwner = user != null && user.username.equalsIgnoreCase(entry.owner);
|
| | | if (showAdmin) {
|
| | |
| | | @Override
|
| | | public void onClick() {
|
| | | if (GitBlit.self().deleteRepositoryModel(entry)) {
|
| | | info(MessageFormat.format("Repository ''{0}'' deleted.", entry));
|
| | | info(MessageFormat.format(getString("gb.repositoryDeleted"), entry));
|
| | | if (dp instanceof SortableRepositoriesProvider) {
|
| | | ((SortableRepositoriesProvider) dp).remove(entry);
|
| | | } else {
|
| | | ((RepositoriesProvider) dp).remove(entry);
|
| | | }
|
| | | } else {
|
| | | error(MessageFormat.format("Failed to delete repository ''{0}''!",
|
| | | entry));
|
| | | error(MessageFormat.format(getString("gb.repositoryDeleteFailed"), entry));
|
| | | }
|
| | | }
|
| | | };
|
| | | deleteLink.add(new JavascriptEventConfirmation("onclick", MessageFormat.format(
|
| | | "Delete repository \"{0}\"?", entry)));
|
| | | getString("gb.deleteRepository"), entry)));
|
| | | repositoryLinks.add(deleteLink);
|
| | | row.add(repositoryLinks);
|
| | | } else if (showOwner) {
|