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/30 21:55:37 UTC

[18/50] [abbrv] allura git commit: [#7919] Add additional fields to the rest api

[#7919] Add additional fields to the rest api


Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/e2d33127
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/e2d33127
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/e2d33127

Branch: refs/heads/db/7919
Commit: e2d33127bda686c21d698e5264673e6237aaeed9
Parents: 1104e29
Author: Heith Seewald <hs...@hsmb.local>
Authored: Wed Oct 7 14:38:40 2015 -0400
Committer: Heith Seewald <hs...@hsmb.local>
Committed: Thu Oct 29 20:21:33 2015 -0400

----------------------------------------------------------------------
 Allura/allura/app.py                  | 24 +++++++++++++++++++++---
 Allura/allura/ext/admin/admin_main.py | 13 ++++++++++++-
 2 files changed, 33 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/e2d33127/Allura/allura/app.py
----------------------------------------------------------------------
diff --git a/Allura/allura/app.py b/Allura/allura/app.py
index 4cc47b1..3096e79 100644
--- a/Allura/allura/app.py
+++ b/Allura/allura/app.py
@@ -190,6 +190,18 @@ class SitemapEntry(object):
         return self.url in request.upath_info or any([
             url in request.upath_info for url in self.matching_urls])
 
+    def __json__(self):
+        return dict(
+            label=self.label,
+            className=self.className,
+            url=self.url,
+            small=self.small,
+            ui_icon=self.ui_icon,
+            children=self.children,
+            tool_name=self.tool_name,
+            matching_urls=self.matching_urls,
+            extra_html_attrs=self.extra_html_attrs,
+        )
 
 class Application(object):
 
@@ -757,9 +769,15 @@ class Application(object):
 
         Returns dict that will be included in project's API under tools key.
         """
-        return {'name': self.config.tool_name,
-                'mount_point': self.config.options.mount_point,
-                'label': self.config.options.mount_label}
+        return {
+            'name': self.config.tool_name,
+            'mount_point': self.config.options.mount_point,
+            'url': self.config.url(),
+            'icons': self.icons,
+            'installable': self.installable,
+            'tool_label': self.tool_label,
+            'mount_label': self.config.options.mount_label
+        }
 
 
 class AdminControllerMixin(object):

http://git-wip-us.apache.org/repos/asf/allura/blob/e2d33127/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 7b26815..56536fb 100644
--- a/Allura/allura/ext/admin/admin_main.py
+++ b/Allura/allura/ext/admin/admin_main.py
@@ -800,7 +800,18 @@ class ProjectAdminRestController(BaseController):
         """ List of installable tools
         """
         response.content_type = 'application/json'
-        tools = [t['name'] for t in AdminApp.installable_tools_for(c.project)]
+        tools = []
+        for tool in AdminApp.installable_tools_for(c.project):
+            tools.append({
+                'name': tool['name'],
+                'description': " ".join(tool['app'].tool_description.split()),
+                'icons': tool['app'].icons,
+                'defaults': {
+                    'default_options': tool['app'].default_options(),
+                    'default_mount_label': tool['app'].default_mount_label,
+                    'default_mount_point': tool['app'].default_mount_point,
+                }
+            })
 
         return {'tools': tools}