diff --git a/rhodecode/apps/_base/__init__.py b/rhodecode/apps/_base/__init__.py --- a/rhodecode/apps/_base/__init__.py +++ b/rhodecode/apps/_base/__init__.py @@ -225,6 +225,7 @@ class RepoAppView(BaseAppView): self.db_repo = request.db_repo self.db_repo_name = self.db_repo.repo_name self.db_repo_pull_requests = ScmModel().get_pull_requests(self.db_repo) + self.db_repo_artifacts = ScmModel().get_artifacts(self.db_repo) def _handle_missing_requirements(self, error): log.error( @@ -240,6 +241,7 @@ class RepoAppView(BaseAppView): c.rhodecode_db_repo = self.db_repo c.repo_name = self.db_repo_name c.repository_pull_requests = self.db_repo_pull_requests + c.repository_artifacts = self.db_repo_artifacts c.repository_is_user_following = ScmModel().is_following_repo( self.db_repo_name, self._rhodecode_user.user_id) self.path_filter = PathFilter(None) diff --git a/rhodecode/integrations/views.py b/rhodecode/integrations/views.py --- a/rhodecode/integrations/views.py +++ b/rhodecode/integrations/views.py @@ -402,6 +402,7 @@ class RepoIntegrationsView(IntegrationSe c.rhodecode_db_repo = self.repo c.repo_name = self.db_repo.repo_name c.repository_pull_requests = ScmModel().get_pull_requests(self.repo) + c.repository_artifacts = ScmModel().get_artifacts(self.repo) c.repository_is_user_following = ScmModel().is_following_repo( c.repo_name, self._rhodecode_user.user_id) c.has_origin_repo_read_perm = False diff --git a/rhodecode/model/scm.py b/rhodecode/model/scm.py --- a/rhodecode/model/scm.py +++ b/rhodecode/model/scm.py @@ -47,8 +47,9 @@ from rhodecode.lib.utils2 import (safe_s from rhodecode.lib.system_info import get_system_info from rhodecode.model import BaseModel from rhodecode.model.db import ( + or_, false, Repository, CacheKey, UserFollowing, UserLog, User, RepoGroup, - PullRequest) + PullRequest, FileStore) from rhodecode.model.settings import VcsSettingsModel from rhodecode.model.validation_schema.validators import url_validator, InvalidCloneUrl @@ -364,6 +365,12 @@ class ScmModel(BaseModel): .filter(PullRequest.target_repo == repo)\ .filter(PullRequest.status != PullRequest.STATUS_CLOSED).count() + def get_artifacts(self, repo): + repo = self._get_repo(repo) + return self.sa.query(FileStore)\ + .filter(FileStore.repo == repo)\ + .filter(or_(FileStore.hidden == None, FileStore.hidden == false())).count() + def mark_as_fork(self, repo, fork, user): repo = self._get_repo(repo) fork = self._get_repo(fork) diff --git a/rhodecode/public/css/navigation.less b/rhodecode/public/css/navigation.less --- a/rhodecode/public/css/navigation.less +++ b/rhodecode/public/css/navigation.less @@ -128,6 +128,16 @@ // for this specifically we do not use a variable } + .menulink-counter { + border: 1px solid @grey2; + border-radius: @border-radius; + background: @grey7; + display: inline-block; + padding: 0px 4px; + text-align: center; + font-size: 12px; + } + .pr_notifications { padding-left: .5em; } diff --git a/rhodecode/templates/base/base.mako b/rhodecode/templates/base/base.mako --- a/rhodecode/templates/base/base.mako +++ b/rhodecode/templates/base/base.mako @@ -301,17 +301,19 @@