API and other questions

LabKey Support Forum (Inactive)
API and other questions Leo Dashevskiy  2014-07-23 16:59
Status: Closed
 
Good day!

Is there a way to programmatically:

1) in a folder of type Study add a new tab with a particular name to the tab panel: I see the link being javascript:LABKEY.Portal.addTab() but no associated public API for it

Ok, upon examining the function, I see that seems like I need the following call:

 LABKEY.Ajax.request({
                    url: LABKEY.ActionURL.buildURL('admin', 'addTab'),
                    method: 'POST',
                    jsonData: {tabName: name},
                    success: function(response)
                    {
                        var jsonResp = LABKEY.Utils.decode(response.responseText);
                        if (jsonResp && jsonResp.success)
                        {
                        ...
                        }
                    }


2) set the newly created tab's visibility
I see the link being:
http://...<encoded subfolder path>/hidePortalPage.view?pageId=<encoded page ID>&returnURL=<encoded path to go to afterwards>
so this needs to be called?

3) add one of the activated modules' WebParts to this newly created, but hidden tab
I see the action being:
http://...<encoded subfolder path>/addWebPart.view?pageId=<encoded page ID>&location=%21content&returnUrl=<encoded path to go to afterwards>&name=<encoded WebPart name to add>
This needs to be called? How?


May be there are other ways of achieving what we need.

We have a handful of Study folders (with more and more coming), each of which has a set of custom modules enabled, this set varies from folder to folder.

Initially, in each of the folders we manually created a tab for each of the active modules and then added the corresponding web part to each of those tabs.

We do not like this approach anymore, since we have lots of modules (new ones being added as we go) and the tab bar gets long and then overflows.

Our idea was to create a tab 'Modules', which would have a wiki, which would dynamically generate a list of active modules as links, each link taking the user to a hidden tab with the WebPart for that particular module (hence my 3 questions above).

Thanks.
-Leo
 
 
Greg Taylor responded:  2014-07-31 16:27
Hi Leo,

You are free to use and manipulate LabKey's actions however be aware that these actions are not part of our API and therefore are subject to change in subsequent versions. If you would like us to prioritize development of the 'addTab' function and include it as part of the public API (it looks close), let us know.

Greg
 
Leo Dashevskiy responded:  2014-07-31 18:22
Ok, thanks Greg!

I think, I will attempt to use some of these actions to automate some of our tasks, but we also hopefully came up with an alternative approach to organizing our layout with custom modules.