Skip to content

The Unified and Autonomous Development Platform

midwork

robin shine56fab5ad1dfb
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/branches/DepotBranchesPage.html b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/branches/DepotBranchesPage.html
index 37ee5eddee..a4277e8bac 100644
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/branches/DepotBranchesPage.html
+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/branches/DepotBranchesPage.html
@@ -16,7 +16,7 @@
</div>
<a wicket:id="createBranch" class="pull-left btn btn-default"><i class="fa fa-plus"></i> Create Branch</a>
</div>
- <table wicket:id="branchesContainer" class="table table-hover table-condensed">
+ <table wicket:id="branches" class="table table-hover table-condensed">
<tr wicket:id="branches">
<td class="detail">
<a wicket:id="branchLink" class="name"><span wicket:id="name"></span></a> <span class="label label-default" wicket:id="default">default</span>
@@ -53,6 +53,7 @@
</tr>
</table>
<div class="center"><ul wicket:id="branchesPageNav"></ul></div>
+ <div wicket:id="noBranches" class="alert alert-warning">No branches found</div>
<div class="help-block">
<i class="fa fa-info-circle"></i> Yellow bars
<span class="bar request">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/branches/DepotBranchesPage.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/branches/DepotBranchesPage.java
index 8b22b922d1..4c3da53060 100644
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/branches/DepotBranchesPage.java
+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/branches/DepotBranchesPage.java
@@ -35,7 +35,6 @@ import org.apache.wicket.markup.html.link.Link;
import org.apache.wicket.markup.html.list.ListItem;
import org.apache.wicket.markup.html.list.PageableListView;
import org.apache.wicket.markup.html.panel.Fragment;
-import org.apache.wicket.model.AbstractReadOnlyModel;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.LoadableDetachableModel;
import org.apache.wicket.model.Model;
@@ -94,12 +93,12 @@ public class DepotBranchesPage extends DepotPage {
private String baseBranch;
- private IModel<List<Ref>> branchesModel = new AbstractReadOnlyModel<List<Ref>>() {
+ private IModel<List<Ref>> branchesModel = new LoadableDetachableModel<List<Ref>>() {
@Override
- public List<Ref> getObject() {
+ protected List<Ref> load() {
List<Ref> refs = getDepot().getBranchRefs();
- String searchFor = searchInput.getModelObject();
+ String searchFor = searchField.getModelObject();
if (StringUtils.isNotBlank(searchFor)) {
searchFor = searchFor.trim().toLowerCase();
for (Iterator<Ref> it = refs.iterator(); it.hasNext();) {
@@ -121,7 +120,9 @@ public class DepotBranchesPage extends DepotPage {
private WebMarkupContainer branchesContainer;
- private TextField<String> searchInput;
+ private WebMarkupContainer noBranchesContainer;
+
+ private TextField<String> searchField;
private final IModel<Map<ObjectId, AheadBehind>> aheadBehindsModel =
new LoadableDetachableModel<Map<ObjectId, AheadBehind>>() {
@@ -293,16 +294,17 @@ public class DepotBranchesPage extends DepotPage {
protected void onUpdate(AjaxRequestTarget target) {
target.add(branchesContainer);
target.add(pagingNavigator);
- searchInput.setModelObject(null);
- target.add(searchInput);
+ target.add(noBranchesContainer);
+ searchField.setModelObject(null);
+ target.add(searchField);
pushState(target);
}
});
- add(searchInput = new ClearableTextField<String>("searchBranches", Model.of("")));
- searchInput.add(new OnSearchingBehavior());
+ add(searchField = new ClearableTextField<String>("searchBranches", Model.of("")));
+ searchField.add(new OnSearchingBehavior());
add(new ModalLink("createBranch") {
@@ -384,8 +386,9 @@ public class DepotBranchesPage extends DepotPage {
close(target);
target.add(branchesContainer);
target.add(pagingNavigator);
- searchInput.setModelObject(null);
- target.add(searchInput);
+ target.add(noBranchesContainer);
+ searchField.setModelObject(null);
+ target.add(searchField);
}
}
@@ -404,9 +407,16 @@ public class DepotBranchesPage extends DepotPage {
});
- branchesContainer = new WebMarkupContainer("branchesContainer");
- branchesContainer.setOutputMarkupId(true);
- add(branchesContainer);
+ add(branchesContainer = new WebMarkupContainer("branches") {
+
+ @Override
+ protected void onConfigure() {
+ super.onConfigure();
+ setVisible(!branchesModel.getObject().isEmpty());
+ }
+
+ });
+ branchesContainer.setOutputMarkupPlaceholderTag(true);
branchesContainer.add(branchesView = new PageableListView<Ref>("branches", branchesModel, PAGE_SIZE) {
@@ -629,6 +639,7 @@ public class DepotBranchesPage extends DepotPage {
}
target.add(pagingNavigator);
target.add(branchesContainer);
+ target.add(noBranchesContainer);
}
@Override
@@ -669,6 +680,17 @@ public class DepotBranchesPage extends DepotPage {
});
pagingNavigator.setOutputMarkupPlaceholderTag(true);
+
+ add(noBranchesContainer = new WebMarkupContainer("noBranches") {
+
+ @Override
+ protected void onConfigure() {
+ super.onConfigure();
+ setVisible(branchesModel.getObject().isEmpty());
+ }
+
+ });
+ noBranchesContainer.setOutputMarkupPlaceholderTag(true);
}
private String getBaseBranch() {
@@ -707,6 +729,7 @@ public class DepotBranchesPage extends DepotPage {
protected void onTypingDone(AjaxRequestTarget target) {
target.add(branchesContainer);
target.add(pagingNavigator);
+ target.add(noBranchesContainer);
}
@Override
@@ -728,6 +751,7 @@ public class DepotBranchesPage extends DepotPage {
baseBranch = (String) data;
target.add(baseChoice);
target.add(branchesContainer);
+ target.add(noBranchesContainer);
target.add(pagingNavigator);
}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/tags/DepotTagsPage.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/tags/DepotTagsPage.java
index 116dcd5649..fc0aa65ab3 100644
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/tags/DepotTagsPage.java
+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/tags/DepotTagsPage.java
@@ -243,7 +243,7 @@ public class DepotTagsPage extends DepotPage {
};
- tagsContainer = new WebMarkupContainer("tagsContainer") {
+ add(tagsContainer = new WebMarkupContainer("tagsContainer") {
@Override
protected void onConfigure() {
@@ -251,9 +251,8 @@ public class DepotTagsPage extends DepotPage {
setVisible(!tagsModel.getObject().isEmpty());
}
- };
- tagsContainer.setOutputMarkupId(true);
- add(tagsContainer);
+ });
+ tagsContainer.setOutputMarkupPlaceholderTag(true);
PageableListView<Ref> tagsView;
@@ -401,6 +400,7 @@ public class DepotTagsPage extends DepotPage {
}
});
+ noTagsContainer.setOutputMarkupPlaceholderTag(true);
}
@Override