You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by br...@apache.org on 2015/10/29 15:36:56 UTC
[14/50] [abbrv] allura git commit: [#7919] Add rest endpoints for
NavBar grouping and reordering
[#7919] Add rest endpoints for NavBar grouping and reordering
Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/c2b91c55
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/c2b91c55
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/c2b91c55
Branch: refs/heads/db/7919
Commit: c2b91c55e5618d7db109bf47fd1c90be05144783
Parents: 4903efc
Author: Heith Seewald <hs...@hsmb.local>
Authored: Tue Oct 6 03:02:55 2015 -0400
Committer: Heith Seewald <hs...@hsmb.local>
Committed: Wed Oct 28 14:00:42 2015 -0400
----------------------------------------------------------------------
Allura/allura/ext/admin/admin_main.py | 45 ++++++++++++++++++++++++++++++
1 file changed, 45 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/allura/blob/c2b91c55/Allura/allura/ext/admin/admin_main.py
----------------------------------------------------------------------
diff --git a/Allura/allura/ext/admin/admin_main.py b/Allura/allura/ext/admin/admin_main.py
index 43cdf55..db18ad2 100644
--- a/Allura/allura/ext/admin/admin_main.py
+++ b/Allura/allura/ext/admin/admin_main.py
@@ -762,6 +762,51 @@ class ProjectAdminRestController(BaseController):
@expose('json:')
@require_post()
+ def mount_order(self, subs=None, tools=None, **kw):
+ if kw:
+ for ordinal, mount_point in kw.iteritems():
+ try:
+ c.project.app_config(mount_point).options.ordinal = int(ordinal)
+ except AttributeError as e:
+ # Handle subproject
+ print("Handle subproject", mount_point)
+ p = M.Project.query.get(shortname="{}/{}".format(c.project.shortname, mount_point),
+ neighborhood_id=c.project.neighborhood_id)
+ if p:
+ p.ordinal = int(ordinal)
+ M.AuditLog.log('Updated NavBar mount order for {}'.format(c.project.name))
+ return {'status': 'ok'}
+
+
+ @expose('json:')
+ @require_post()
+ def configure_tool_grouping(self, grouping_threshold='1', **kw):
+ try:
+ grouping_threshold = int(grouping_threshold)
+ if grouping_threshold < 1:
+ raise ValueError('Invalid threshold')
+ c.project.set_tool_data(
+ 'allura', grouping_threshold=grouping_threshold)
+ except ValueError:
+ return {
+ 'status': 'error',
+ 'msg': 'Invalid threshold'
+ }
+ M.AuditLog.log('Updated grouping threshold for {}'.format(c.project.name))
+ return {'status': 'ok'}
+
+ @expose('json:')
+ def tools(self, **kw):
+ """ List of installable tools
+
+ """
+ response.content_type = 'application/json'
+ tools_names = [t['name'] for t in AdminApp.installable_tools_for(c.project)]
+
+ return {'status': 'ok'}
+
+ @expose('json:')
+ @require_post()
def export(self, tools=None, send_email=False, **kw):
"""
Initiate a bulk export of the project data.