You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by he...@apache.org on 2015/10/28 19:01:51 UTC

[29/50] [abbrv] allura git commit: [#7919] Fix endpoint to show installable tools for a given project

[#7919] Fix endpoint to show installable tools for a given project


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

Branch: refs/heads/hs/7919
Commit: 25e7e7b4bb5a19e7dd8a0cb4871b1711352e37cd
Parents: e2bf274
Author: Heith Seewald <hs...@hsmb.local>
Authored: Mon Oct 12 13:43:12 2015 -0400
Committer: Heith Seewald <hs...@hsmb.local>
Committed: Wed Oct 28 14:00:45 2015 -0400

----------------------------------------------------------------------
 Allura/allura/ext/admin/admin_main.py | 32 ++++++++++++++++++++++++++++--
 1 file changed, 30 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/25e7e7b4/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 56536fb..013bf99 100644
--- a/Allura/allura/ext/admin/admin_main.py
+++ b/Allura/allura/ext/admin/admin_main.py
@@ -797,7 +797,7 @@ class ProjectAdminRestController(BaseController):
 
     @expose('json:')
     def installable_tools(self, **kw):
-        """ List of installable tools
+        """ List of installable tools and their default options.
         """
         response.content_type = 'application/json'
         tools = []
@@ -809,7 +809,8 @@ class ProjectAdminRestController(BaseController):
                 'defaults': {
                     'default_options': tool['app'].default_options(),
                     'default_mount_label': tool['app'].default_mount_label,
-                    'default_mount_point': tool['app'].default_mount_point,
+                    'default_mount_point': tool['app'].admin_menu_delete_button,
+                    'modal': tool['app'].admin_modal,
                 }
             })
 
@@ -860,6 +861,32 @@ class ProjectAdminRestController(BaseController):
         }
 
     @expose('json:')
+    @require_post()
+    def mount_point(self, mount_point=None, **kw):
+        """
+        Returns a tool from a given mount point
+        """
+        response.content_type = 'application/json'
+
+        tool = c.project.app_instance(mount_point)
+
+        if tool is None:
+            return {
+                'exists': False,
+                'info': 'Mount point does not exists.',
+            }
+
+        try:
+            info = json.dumps(tool)
+        except TypeError:
+            info = "Could not serialize tool."
+
+        return {
+            'exist': True,
+            'info': info
+        }
+
+    @expose('json:')
     def export_status(self, **kw):
         """
         Check the status of a bulk export.
@@ -900,6 +927,7 @@ class ProjectAdminRestController(BaseController):
 
         """
         controller = ProjectAdminController()
+        ordinal = 0
 
         if not tool or not mount_point or not mount_label:
             return {