artifacts: added missing code for CE views and admin artifacts.

This commit is contained in:
Milka Kuzminski 2021-04-06 22:23:41 +02:00
parent 3d757cad5c
commit 0421a6054d
3 changed files with 108 additions and 0 deletions

View file

@ -27,6 +27,7 @@ def admin_routes(config):
Admin prefixed routes
"""
from rhodecode.apps.admin.views.audit_logs import AdminAuditLogsView
from rhodecode.apps.admin.views.artifacts import AdminArtifactsView
from rhodecode.apps.admin.views.defaults import AdminDefaultSettingsView
from rhodecode.apps.admin.views.exception_tracker import ExceptionsTrackerView
from rhodecode.apps.admin.views.main_views import AdminMainView
@ -60,6 +61,34 @@ def admin_routes(config):
route_name='admin_audit_log_entry', request_method='GET',
renderer='rhodecode:templates/admin/admin_audit_log_entry.mako')
# Artifacts EE feature
config.add_route(
'admin_artifacts',
pattern=ADMIN_PREFIX + '/artifacts')
config.add_route(
'admin_artifacts_show_all',
pattern=ADMIN_PREFIX + '/artifacts')
config.add_view(
AdminArtifactsView,
attr='artifacts',
route_name='admin_artifacts', request_method='GET',
renderer='rhodecode:templates/admin/artifacts/artifacts.mako')
config.add_view(
AdminArtifactsView,
attr='artifacts',
route_name='admin_artifacts_show_all', request_method='GET',
renderer='rhodecode:templates/admin/artifacts/artifacts.mako')
# EE views
config.add_route(
name='admin_artifacts_show_info',
pattern=ADMIN_PREFIX + '/artifacts/{uid}')
config.add_route(
name='admin_artifacts_delete',
pattern=ADMIN_PREFIX + '/artifacts/{uid}/delete')
config.add_route(
name='admin_artifacts_update',
pattern=ADMIN_PREFIX + '/artifacts/{uid}/update')
config.add_route(
name='admin_settings_open_source',
pattern='/settings/open_source')

View file

@ -0,0 +1,40 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2016-2020 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 rhodecode.apps._base import BaseAppView, DataGridAppView
from rhodecode.lib.auth import LoginRequired, HasPermissionAllDecorator
log = logging.getLogger(__name__)
class AdminArtifactsView(BaseAppView, DataGridAppView):
def load_default_context(self):
c = self._get_local_tmpl_context()
return c
@LoginRequired()
@HasPermissionAllDecorator('hg.admin')
def artifacts(self):
c = self.load_default_context()
c.active = 'artifacts'
return self._get_template_context(c)

View file

@ -0,0 +1,39 @@
## -*- coding: utf-8 -*-
<%inherit file="/base/base.mako"/>
<%def name="title()">
${_('Artifacts Admin')}
%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='admin')}
</%def>
<%def name="menu_bar_subnav()">
${self.admin_menu(active='artifacts')}
</%def>
<%def name="main()">
<div class="box">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">${_('Artifacts Administration.')}</h3>
</div>
<div class="panel-body">
<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>
</div>
</div>
</div>
</%def>