repo: added base CE display of new artifacts

This commit is contained in:
Marcin Kuzminski 2019-05-13 15:56:03 +02:00
parent 4ff7ba8955
commit 2442fe4719
4 changed files with 83 additions and 0 deletions

View file

@ -312,6 +312,11 @@ def includeme(config):
pattern='/{repo_name:.*?[^/]}/pull-request/{pull_request_id:\d+}/comment/{comment_id}/delete',
repo_route=True, repo_accepted_types=['hg', 'git'])
# Artifacts, (EE feature)
config.add_route(
name='repo_artifacts_list',
pattern='/{repo_name:.*?[^/]}/artifacts', repo_route=True)
# Settings
config.add_route(
name='edit_repo',

View file

@ -0,0 +1,48 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2011-2019 RhodeCode GmbH
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License, version 3
# (only), as published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# This program is dual-licensed. If you wish to learn more about the
# RhodeCode Enterprise Edition, including its added features, Support services,
# and proprietary license terms, please see https://rhodecode.com/licenses/
import logging
from pyramid.view import view_config
from rhodecode.apps._base import RepoAppView
from rhodecode.lib.auth import (
LoginRequired, HasRepoPermissionAnyDecorator)
log = logging.getLogger(__name__)
class RepoArtifactsView(RepoAppView):
def load_default_context(self):
c = self._get_local_tmpl_context(include_app_defaults=True)
c.rhodecode_repo = self.rhodecode_vcs_repo
return c
@LoginRequired()
@HasRepoPermissionAnyDecorator(
'repository.read', 'repository.write', 'repository.admin')
@view_config(
route_name='repo_artifacts_list', request_method='GET',
renderer='rhodecode:templates/artifacts/artifact_list.mako')
def repo_artifacts(self):
c = self.load_default_context()
c.active = 'artifacts'
return self._get_template_context(c)

View file

@ -0,0 +1,28 @@
## -*- coding: utf-8 -*-
<%inherit file="/base/base.mako"/>
<%def name="title()">
${_('{} Artifacts').format(c.repo_name)}
%if c.rhodecode_name:
&middot; ${h.branding(c.rhodecode_name)}
%endif
</%def>
<%def name="breadcrumbs_links()"></%def>
<%def name="menu_bar_nav()">
${self.menu_items(active='repositories')}
</%def>
<%def name="menu_bar_subnav()">
${self.repo_menu(active='artifacts')}
</%def>
<%def name="main()">
<div class="box">
<h4>${_('This feature is available in RhodeCode EE edition only. Contact {sales_email} to obtain a trial license.').format(sales_email='<a href="mailto:sales@rhodecode.com">sales@rhodecode.com</a>')|n}</h4>
<img style="width: 100%; height: 100%" src="${h.asset('images/ee_features/repo_artifacts.png')}"/>
</div>
</%def>

View file

@ -301,6 +301,8 @@
</li>
%endif
<li class="${is_active('artifacts')}"><a class="menulink" href="${h.route_path('repo_artifacts_list',repo_name=c.repo_name)}"><div class="menulabel">${_('Artifacts')}</div></a></li>
%if h.HasRepoPermissionAll('repository.admin')(c.repo_name):
<li class="${is_active('settings')}"><a class="menulink" href="${h.route_path('edit_repo',repo_name=c.repo_name)}"><div class="menulabel">${_('Repository Settings')}</div></a></li>
%endif