# HG changeset patch # User Mads Kiilerich # Date 1505347686 -7200 # Node ID 6db3122e4d75f0519f5de911413b9eb195fd6cf0 # Parent e81332582fc9c97a2725cc1f8128cd6a5ccbc381 index: show repositories and repository groups in the same table Having two different tables with their own paging and search gave a bad UI. Instead, do like all other UIs that show directory content and show both "folders" and "files" in the same list. The rendering of repo groups is changed to use js data instead of a taking data from an html table. Repository groups are shoe-horned into the repository DataTable. The columns are no perfect match - some of the existing columns are thus given an empty default value. diff -r e81332582fc9 -r 6db3122e4d75 kallithea/controllers/admin/repo_groups.py --- a/kallithea/controllers/admin/repo_groups.py Thu Sep 14 02:08:06 2017 +0200 +++ b/kallithea/controllers/admin/repo_groups.py Thu Sep 14 02:08:06 2017 +0200 @@ -296,13 +296,12 @@ c.group = c.repo_group = RepoGroup.guess_instance(group_name) groups = RepoGroup.query(sorted=True).filter_by(parent_group=c.group).all() - c.groups = self.scm_model.get_repo_groups(groups) + repo_groups_list = self.scm_model.get_repo_groups(groups) repos_list = Repository.query(sorted=True).filter_by(group=c.group).all() - repos_data = RepoModel().get_repos_as_dict(repos_list=repos_list, - admin=False, short_name=True) - # data used to render the grid - c.data = repos_data + c.data = RepoModel().get_repos_as_dict(repos_list=repos_list, + repo_groups_list=repo_groups_list, + admin=False, short_name=True) return render('admin/repo_groups/repo_group_show.html') diff -r e81332582fc9 -r 6db3122e4d75 kallithea/controllers/home.py --- a/kallithea/controllers/home.py Thu Sep 14 02:08:06 2017 +0200 +++ b/kallithea/controllers/home.py Thu Sep 14 02:08:06 2017 +0200 @@ -50,15 +50,14 @@ @LoginRequired() def index(self): - c.groups = self.scm_model.get_repo_groups() c.group = None + repo_groups_list = self.scm_model.get_repo_groups() repos_list = Repository.query(sorted=True).filter_by(group=None).all() - repos_data = RepoModel().get_repos_as_dict(repos_list=repos_list, - admin=False, short_name=True) - # data used to render the grid - c.data = repos_data + c.data = RepoModel().get_repos_as_dict(repos_list=repos_list, + repo_groups_list=repo_groups_list, + admin=False, short_name=True) return render('/index.html') diff -r e81332582fc9 -r 6db3122e4d75 kallithea/model/repo.py --- a/kallithea/model/repo.py Thu Sep 14 02:08:06 2017 +0200 +++ b/kallithea/model/repo.py Thu Sep 14 02:08:06 2017 +0200 @@ -163,7 +163,8 @@ kwargs.update(dict(_=_, h=h, c=c, request=request)) return tmpl.render(*args, **kwargs) - def get_repos_as_dict(self, repos_list=None, admin=False, perm_check=True, + def get_repos_as_dict(self, repos_list=None, repo_groups_list=None, + admin=False, perm_check=True, super_user_actions=False, short_name=False): _render = self._render_datatable from tg import tmpl_context as c @@ -199,6 +200,14 @@ return _render('user_name', owner_id, username) repos_data = [] + + for gr in repo_groups_list or []: + repos_data.append(dict( + raw_name='\0' + gr.name, # sort before repositories + just_name=gr.name, + name=_render('group_name_html', group_name=gr.group_name, name=gr.name), + desc=gr.group_description)) + for repo in repos_list: if perm_check: # check permission at this level diff -r e81332582fc9 -r 6db3122e4d75 kallithea/templates/data_table/_dt_elements.html --- a/kallithea/templates/data_table/_dt_elements.html Thu Sep 14 02:08:06 2017 +0200 +++ b/kallithea/templates/data_table/_dt_elements.html Thu Sep 14 02:08:06 2017 +0200 @@ -125,6 +125,13 @@ +<%def name="group_name_html(group_name,name)"> +
+ + ${name} +
+ + <%def name="repo_group_actions(repo_group_id, repo_group_name, gr_count)">
diff -r e81332582fc9 -r 6db3122e4d75 kallithea/templates/index_base.html --- a/kallithea/templates/index_base.html Thu Sep 14 02:08:06 2017 +0200 +++ b/kallithea/templates/index_base.html Thu Sep 14 02:08:06 2017 +0200 @@ -39,44 +39,12 @@
%endif - %if c.groups: -
- - - - - - ## - - - % for gr in c.groups: - - - - ## this is commented out since for multi nested repos can be HEAVY! - ## in number of executed queries during traversing uncomment at will - ## - - % endfor -
${_('Repository Group')}${_('Description')}${_('Number of Repositories')}
-
- - ${gr.name} -
-
${h.urlify_text(gr.group_description, stylize=c.visual.stylify_metatags)}${gr.repositories_recursive_count}
-
- %endif