Skip to content

Commit

Permalink
feat: Show project description in project list (OD-2052)
Browse files Browse the repository at this point in the history
  • Loading branch information
robinshine committed Sep 7, 2024
1 parent 0418d25 commit a9e3267
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 14 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.project-info {
min-width: 360px;
max-width: 600px;
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
</a>
<span wicket:id="labels" class="mr-2"></span>
</div>
<div wicket:id="description" class="mt-1 font-size-sm text-muted"></div>
<div class="d-flex flex-wrap project-summary">
<div wicket:id="codeStats" class="code-stats mt-2 d-flex align-items-center flex-wrap mr-3"></div>
<div wicket:id="pullRequestStats" class="pull-request-stats mt-2 d-flex align-items-center flex-wrap"></div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@
@SuppressWarnings("serial")
public class ProjectListPanel extends Panel {

private static final int MAX_DESCRIPTION_LEN = 120;

private final IModel<String> queryStringModel;

private final int expectedCount;
Expand Down Expand Up @@ -1086,24 +1088,29 @@ protected void doBeforeNav(AjaxRequestTarget target) {
fragment.add(projectLink);

fragment.add(new EntityLabelsPanel<>("labels", rowModel));
if (project.getDescription() != null) {
fragment.add(new Label("description", StringUtils.abbreviate(project.getDescription(), MAX_DESCRIPTION_LEN)));
} else {
fragment.add(new WebMarkupContainer("description").setVisible(false));
}

if (!project.isPendingDelete() && project.getActiveServer(false) != null) {
if (project.isCodeManagement() && SecurityUtils.canReadCode(project)) {
fragment.add(new CodeStatsPanel("codeStats", rowModel));
fragment.add(new PullRequestStatsPanel("pullRequestStats", rowModel,
new LoadableDetachableModel<Map<PullRequest.Status, Long>>() {
@Override
protected Map<PullRequest.Status, Long> load() {
Map<PullRequest.Status, Long> statusCounts = new LinkedHashMap<>();
for (ProjectPullRequestStatusStat stats: pullRequestStatsModel.getObject()) {
if (stats.getProjectId().equals(projectId))
statusCounts.put(stats.getPullRequestStatus(), stats.getStatusCount());
}
return statusCounts;
}
}));
fragment.add(new PullRequestStatsPanel("pullRequestStats", rowModel,
new LoadableDetachableModel<>() {

@Override
protected Map<PullRequest.Status, Long> load() {
Map<PullRequest.Status, Long> statusCounts = new LinkedHashMap<>();
for (ProjectPullRequestStatusStat stats : pullRequestStatsModel.getObject()) {
if (stats.getProjectId().equals(projectId))
statusCounts.put(stats.getPullRequestStatus(), stats.getStatusCount());
}
return statusCounts;
}

}));
} else {
fragment.add(new WebMarkupContainer("codeStats").setVisible(false));
fragment.add(new WebMarkupContainer("pullRequestStats").setVisible(false));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
.project-list .row-selector {
padding-top: 16px;
}
.project-list .description {
text-overflow: ellipsis;
}
.project-list .project-summary {
margin-left: 2px;
}
Expand Down

0 comments on commit a9e3267

Please sign in to comment.