auth-plugins: updated UI for authentication plugins, and allow unsorted (in order of registration) display of plugins.
This commit is contained in:
parent
3947a873c5
commit
a7a5fe4247
3 changed files with 43 additions and 32 deletions
|
|
@ -19,6 +19,7 @@
|
|||
# and proprietary license terms, please see https://rhodecode.com/licenses/
|
||||
|
||||
import logging
|
||||
import collections
|
||||
|
||||
from pyramid.exceptions import ConfigurationError
|
||||
|
||||
|
|
@ -55,7 +56,7 @@ class AuthnRootResource(AuthnResourceBase):
|
|||
"""
|
||||
|
||||
def __init__(self):
|
||||
self._store = {}
|
||||
self._store = collections.OrderedDict()
|
||||
self._resource_name_map = {}
|
||||
self.display_name = _('Global')
|
||||
|
||||
|
|
@ -97,13 +98,17 @@ class AuthnRootResource(AuthnResourceBase):
|
|||
active = [item for item in self]
|
||||
return sorted(active, key=sort_key)
|
||||
|
||||
def get_nav_list(self):
|
||||
def get_nav_list(self, sort=True):
|
||||
"""
|
||||
Returns a sorted list of resources for displaying the navigation.
|
||||
"""
|
||||
list = self.get_sorted_list()
|
||||
list.insert(0, self)
|
||||
return list
|
||||
if sort:
|
||||
nav_list = self.get_sorted_list()
|
||||
else:
|
||||
nav_list = [item for item in self]
|
||||
|
||||
nav_list.insert(0, self)
|
||||
return nav_list
|
||||
|
||||
def add_authn_resource(self, config, plugin_id, resource):
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@
|
|||
|
||||
<div class="sidebar">
|
||||
<ul class="nav nav-pills nav-stacked">
|
||||
% for item in resource.get_root().get_nav_list():
|
||||
% for item in resource.get_root().get_nav_list(sort=False):
|
||||
<li ${'class=active' if item == resource else ''}>
|
||||
<a href="${request.resource_path(item, route_name='auth_home')}">${item.display_name}</a>
|
||||
</li>
|
||||
|
|
@ -39,48 +39,54 @@
|
|||
|
||||
<div class="main-content-full-width">
|
||||
${h.secure_form(request.resource_path(resource, route_name='auth_home'), request=request)}
|
||||
<div class="form">
|
||||
|
||||
<div class="panel panel-default">
|
||||
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title">${_("Enabled and Available Plugins")}</h3>
|
||||
</div>
|
||||
|
||||
<div class="fields panel-body">
|
||||
<div class="panel-body">
|
||||
|
||||
<div class="field">
|
||||
<div class="label">${_("Enabled Plugins")}</div>
|
||||
|
||||
<div class="label">${_("Ordered Enabled Plugins")}</div>
|
||||
<div class="textarea text-area editor">
|
||||
${h.textarea('auth_plugins',cols=23,rows=5,class_="medium")}
|
||||
${h.textarea('auth_plugins',cols=120,rows=20,class_="medium")}
|
||||
</div>
|
||||
<p class="help-block pre-formatting">${_('List of plugins, separated by commas.'
|
||||
<div class="field">
|
||||
<p class="help-block pre-formatting">${_('List of plugins, separated by commas.'
|
||||
'\nThe order of the plugins is also the order in which '
|
||||
'RhodeCode Enterprise will try to authenticate a user.')}</p>
|
||||
</div>
|
||||
'RhodeCode Enterprise will try to authenticate a user.')}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="field">
|
||||
<div class="label">${_('Available Built-in Plugins')}</div>
|
||||
<ul class="auth_plugins">
|
||||
%for plugin in available_plugins:
|
||||
<li>
|
||||
<div class="auth_buttons">
|
||||
<span plugin_id="${plugin.get_id()}" class="toggle-plugin btn ${'btn-success' if plugin.get_id() in enabled_plugins else ''}">
|
||||
${_('enabled') if plugin.get_id() in enabled_plugins else _('disabled')}
|
||||
</span>
|
||||
${plugin.get_display_name()} (${plugin.get_id()})
|
||||
</div>
|
||||
</li>
|
||||
%endfor
|
||||
</ul>
|
||||
</div>
|
||||
<table class="rctable">
|
||||
<th>${_('Activate')}</th>
|
||||
<th>${_('Plugin Name')}</th>
|
||||
<th>${_('Documentation')}</th>
|
||||
<th>${_('Plugin ID')}</th>
|
||||
%for plugin in available_plugins:
|
||||
<tr>
|
||||
<td>
|
||||
<span plugin_id="${plugin.get_id()}" class="toggle-plugin btn ${'btn-success' if plugin.get_id() in enabled_plugins else ''}">
|
||||
${_('enabled') if plugin.get_id() in enabled_plugins else _('disabled')}
|
||||
</span>
|
||||
</td>
|
||||
<td>${plugin.get_display_name()}</td>
|
||||
<td>
|
||||
% if plugin.docs():
|
||||
<a href="${plugin.docs()}">docs</a>
|
||||
% endif
|
||||
</td>
|
||||
<td>${plugin.get_id()}</td>
|
||||
</tr>
|
||||
%endfor
|
||||
</table>
|
||||
|
||||
<div class="buttons">
|
||||
${h.submit('save',_('Save'),class_="btn")}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
${h.end_form()}
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -263,7 +263,7 @@ $(document).ready(function(e) {
|
|||
// Alternative logo from static folder
|
||||
$('.sign-in-image').attr("src", "/_static/rhodecode/images/RhodeCode_Logo_Black.png");
|
||||
|
||||
// set width/height
|
||||
// option to set width/height, adjust if required to make your image look good.
|
||||
$('.sign-in-image').css({"width": "300px", "height": "345px"});
|
||||
|
||||
// 2) Header logo on top bar
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue