# HG changeset patch # User Marcin Kuzminski # Date 2019-12-19 14:27:28 # Node ID 554d4203ae673aaa4c6a7daa6da7ae42d10e75e9 # Parent 117ca338be9d3ec0a54f2179c5dc02431028767c grids: columns and sorting fixes diff --git a/rhodecode/apps/admin/views/repo_groups.py b/rhodecode/apps/admin/views/repo_groups.py --- a/rhodecode/apps/admin/views/repo_groups.py +++ b/rhodecode/apps/admin/views/repo_groups.py @@ -111,9 +111,9 @@ class AdminRepoGroupsView(BaseAppView, D def repo_group_list_data(self): self.load_default_context() column_map = { - 'name_raw': 'group_name_hash', + 'name': 'group_name_hash', 'desc': 'group_description', - 'last_change_raw': 'updated_on', + 'last_change': 'updated_on', 'top_level_repos': 'repos_total', 'owner': 'user_username', } @@ -223,9 +223,8 @@ class AdminRepoGroupsView(BaseAppView, D row = { "menu": quick_menu(repo_gr.group_name), "name": repo_group_lnk(repo_gr.group_name), - "name_raw": repo_gr.group_name, + "last_change": last_change(repo_gr.updated_on), - "last_change_raw": datetime_to_time(repo_gr.updated_on), "last_changeset": "", "last_changeset_raw": "", diff --git a/rhodecode/apps/admin/views/repositories.py b/rhodecode/apps/admin/views/repositories.py --- a/rhodecode/apps/admin/views/repositories.py +++ b/rhodecode/apps/admin/views/repositories.py @@ -81,9 +81,9 @@ class AdminReposView(BaseAppView, DataGr def repository_list_data(self): self.load_default_context() column_map = { - 'name_raw': 'repo_name', + 'name': 'repo_name', 'desc': 'description', - 'last_change_raw': 'updated_on', + 'last_change': 'updated_on', 'owner': 'user_username', } draw, start, limit = self._extract_chunk(self.request) diff --git a/rhodecode/apps/admin/views/user_groups.py b/rhodecode/apps/admin/views/user_groups.py --- a/rhodecode/apps/admin/views/user_groups.py +++ b/rhodecode/apps/admin/views/user_groups.py @@ -171,7 +171,6 @@ class AdminUserGroupsView(BaseAppView, D for user_gr in auth_user_group_list: row = { "users_group_name": user_group_name(user_gr.users_group_name), - "name_raw": h.escape(user_gr.users_group_name), "description": h.escape(user_gr.user_group_description), "members": user_gr.member_count, # NOTE(marcink): because of advanced query we diff --git a/rhodecode/apps/home/views.py b/rhodecode/apps/home/views.py --- a/rhodecode/apps/home/views.py +++ b/rhodecode/apps/home/views.py @@ -685,9 +685,9 @@ class HomeView(BaseAppView, DataGridAppV def _main_page_repo_groups_data(self, repo_group_id): column_map = { - 'name_raw': 'group_name_hash', + 'name': 'group_name_hash', 'desc': 'group_description', - 'last_change_raw': 'updated_on', + 'last_change': 'updated_on', 'owner': 'user_username', } draw, start, limit = self._extract_chunk(self.request) @@ -700,9 +700,9 @@ class HomeView(BaseAppView, DataGridAppV def _main_page_repos_data(self, repo_group_id): column_map = { - 'name_raw': 'repo_name', + 'name': 'repo_name', 'desc': 'description', - 'last_change_raw': 'updated_on', + 'last_change': 'updated_on', 'owner': 'user_username', } draw, start, limit = self._extract_chunk(self.request) diff --git a/rhodecode/model/repo.py b/rhodecode/model/repo.py --- a/rhodecode/model/repo.py +++ b/rhodecode/model/repo.py @@ -251,18 +251,16 @@ class RepoModel(BaseModel): # NOTE(marcink): because we use only raw column we need to load it like that changeset_cache = Repository._load_changeset_cache( repo.repo_id, repo._changeset_cache) - last_commit_change = Repository._load_commit_change(changeset_cache) row = { "menu": quick_menu(repo.repo_name), "name": repo_lnk(repo.repo_name, repo.repo_type, repo.repo_state, repo.private, repo.archived, repo.fork), - "name_raw": repo.repo_name.lower(), + "desc": desc(repo.description), - "last_change": last_change(last_commit_change), - "last_change_raw": datetime_to_time(last_commit_change), + "last_change": last_change(repo.updated_on), "last_changeset": last_rev(repo.repo_name, changeset_cache), "last_changeset_raw": changeset_cache.get('revision'), diff --git a/rhodecode/model/repo_group.py b/rhodecode/model/repo_group.py --- a/rhodecode/model/repo_group.py +++ b/rhodecode/model/repo_group.py @@ -749,7 +749,6 @@ class RepoGroupModel(BaseModel): "name_raw": group.group_name, "last_change": last_change(last_commit_change), - "last_change_raw": datetime_to_time(last_commit_change), "last_changeset": "", "last_changeset_raw": "", diff --git a/rhodecode/templates/admin/repo_groups/repo_groups.mako b/rhodecode/templates/admin/repo_groups/repo_groups.mako --- a/rhodecode/templates/admin/repo_groups/repo_groups.mako +++ b/rhodecode/templates/admin/repo_groups/repo_groups.mako @@ -71,12 +71,12 @@ order: [[ 0, "asc" ]], columns: [ { data: {"_": "name", - "sort": "name_raw"}, title: "${_('Name')}", className: "td-componentname" }, + "sort": "name"}, title: "${_('Name')}", className: "td-componentname" }, { data: 'menu', "bSortable": false, className: "quick_repo_menu" }, { data: {"_": "desc", "sort": "desc"}, title: "${_('Description')}", className: "td-description" }, { data: {"_": "last_change", - "sort": "last_change_raw", + "sort": "last_change", "type": Number}, title: "${_('Last Change')}", className: "td-time" }, { data: {"_": "top_level_repos", "sort": "top_level_repos"}, title: "${_('Number of top level repositories')}" }, diff --git a/rhodecode/templates/admin/repos/repos.mako b/rhodecode/templates/admin/repos/repos.mako --- a/rhodecode/templates/admin/repos/repos.mako +++ b/rhodecode/templates/admin/repos/repos.mako @@ -72,7 +72,7 @@ { data: { "_": "name", - "sort": "name_raw" + "sort": "name" }, title: "${_('Name')}", className: "td-componentname" }, { @@ -86,7 +86,7 @@ { data: { "_": "last_change", - "sort": "last_change_raw", + "sort": "last_change", "type": Number }, title: "${_('Last Change')}", className: "td-time" }, diff --git a/rhodecode/templates/index_base.mako b/rhodecode/templates/index_base.mako --- a/rhodecode/templates/index_base.mako +++ b/rhodecode/templates/index_base.mako @@ -58,10 +58,12 @@ { data: { "_": "name", - "sort": "name_raw" + "sort": "name" }, title: "${_('Name')}", className: "truncate-wrap td-grid-name" }, - {data: 'menu', "bSortable": false, className: "quick_repo_menu"}, + { + data: 'menu', "bSortable": false, className: "quick_repo_menu" + }, { data: { "_": "desc", @@ -71,7 +73,7 @@ { data: { "_": "last_change", - "sort": "last_change_raw", + "sort": "last_change", "type": Number }, title: "${_('Last Change')}", className: "td-time" }, @@ -80,7 +82,7 @@ "_": "last_changeset", "sort": "last_changeset_raw", "type": Number - }, title: "", className: "td-hash" + }, title: "", className: "td-hash", orderable: false }, { data: { @@ -147,7 +149,7 @@ { data: { "_": "name", - "sort": "name_raw" + "sort": "name" }, title: "${_('Name')}", className: "truncate-wrap td-grid-name" }, { @@ -162,16 +164,16 @@ { data: { "_": "last_change", - "sort": "last_change_raw", + "sort": "last_change", "type": Number - }, title: "${_('Last Change')}", className: "td-time", orderable: false + }, title: "${_('Last Change')}", className: "td-time" }, { data: { "_": "last_changeset", "sort": "last_changeset_raw", "type": Number - }, title: "${_('Commit')}", className: "td-hash" + }, title: "${_('Commit')}", className: "td-hash", orderable: false }, { data: {