summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--docs/04_releases.mkd1
-rw-r--r--src/com/gitblit/wicket/pages/RootPage.java17
2 files changed, 14 insertions, 4 deletions
diff --git a/docs/04_releases.mkd b/docs/04_releases.mkd
index 5c89d9a4..af70dff5 100644
--- a/docs/04_releases.mkd
+++ b/docs/04_releases.mkd
@@ -11,6 +11,7 @@ If you are updating from an earlier release AND you have indexed branches with t
#### fixes
+- Eliminated an unnecessary reopsitory enumeration call on the root page which should result in faster page loads (issue 103)
- Gitblit could not delete a Lucene index in a working copy on index upgrade
- Do not index submodule links (issue 119)
- Restore original user or team object on failure to update (issue 118)
diff --git a/src/com/gitblit/wicket/pages/RootPage.java b/src/com/gitblit/wicket/pages/RootPage.java
index 636ed00e..eaa25425 100644
--- a/src/com/gitblit/wicket/pages/RootPage.java
+++ b/src/com/gitblit/wicket/pages/RootPage.java
@@ -64,6 +64,7 @@ public abstract class RootPage extends BasePage {
IModel<String> username = new Model<String>("");
IModel<String> password = new Model<String>("");
+ List<RepositoryModel> repositoryModels = new ArrayList<RepositoryModel>();
public RootPage() {
super();
@@ -223,6 +224,15 @@ public abstract class RootPage extends BasePage {
}
}
}
+
+ protected List<RepositoryModel> getRepositoryModels() {
+ if (repositoryModels.isEmpty()) {
+ final UserModel user = GitBlitWebSession.get().getUser();
+ List<RepositoryModel> repositories = GitBlit.self().getRepositoryModels(user);
+ repositoryModels.addAll(repositories);
+ }
+ return repositoryModels;
+ }
protected void addDropDownMenus(List<PageRegistration> pages) {
@@ -231,7 +241,7 @@ public abstract class RootPage extends BasePage {
protected List<DropDownMenuItem> getRepositoryFilterItems(PageParameters params) {
final UserModel user = GitBlitWebSession.get().getUser();
Set<DropDownMenuItem> filters = new LinkedHashSet<DropDownMenuItem>();
- List<RepositoryModel> repositories = GitBlit.self().getRepositoryModels(user);
+ List<RepositoryModel> repositories = getRepositoryModels();
// accessible repositories by federation set
Map<String, AtomicInteger> setMap = new HashMap<String, AtomicInteger>();
@@ -307,9 +317,8 @@ public abstract class RootPage extends BasePage {
}
protected List<RepositoryModel> getRepositories(PageParameters params) {
- final UserModel user = GitBlitWebSession.get().getUser();
if (params == null) {
- return GitBlit.self().getRepositoryModels(user);
+ return getRepositoryModels();
}
boolean hasParameter = false;
@@ -319,7 +328,7 @@ public abstract class RootPage extends BasePage {
String team = WicketUtils.getTeam(params);
int daysBack = params.getInt("db", 0);
- List<RepositoryModel> availableModels = GitBlit.self().getRepositoryModels(user);
+ List<RepositoryModel> availableModels = getRepositoryModels();
Set<RepositoryModel> models = new HashSet<RepositoryModel>();
if (!StringUtils.isEmpty(repositoryName)) {