allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hei...@apache.org
Subject [28/50] [abbrv] allura git commit: [#7919] Add additional fields to the rest api
Date Wed, 28 Oct 2015 18:01:50 GMT
[#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/e2bf2746
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/e2bf2746
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/e2bf2746

Branch: refs/heads/hs/7919
Commit: e2bf27466f94b4a4ba0bff890a8a8873c23b9673
Parents: e40433e
Author: Heith Seewald <hseewald@hsmb.local>
Authored: Wed Oct 7 14:38:40 2015 -0400
Committer: Heith Seewald <hseewald@hsmb.local>
Committed: Wed Oct 28 14:00:45 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/e2bf2746/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/e2bf2746/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}
 


Mime
View raw message