Edit module-based resources directly within the user interface of a LabKey Server running in development mode. With the moduleEditor module enabled, you can edit many module-based resources without stopping and starting your server.
Using this feature on a shared development server lets developers iterate on a module in an environment that may not be convenient to configure on an individual developer's machine, and is well-suited for a shared pre-production testing deployment. It requires that the module's source root is available to the server, in addition to having its built .module deployed. It streamlines the development and maintenance of module-based resources by bypassing the need to edit offline and reload to see each change.
With Module Editing enabled, two new capabilities are unlocked:
1. Prerequisites: To be able to edit module-based resources "live":
If you would like an example module to help you get started, you can use this one:
Download and unzip it, then place the "aloadingdemo" folder in your development machine enlistment's "server/modules". If this were not a purely file-based module, you would need to build it as usual.3. Deploy it on the server by running:
./gradlew deployApp
4. Navigate to the folder where you want to be able to use your module-based resources. If you are using our example "aloadingdemo" module which contains a few simple queries and reports, first install the example study you can download from this page:
5. In your working folder, enable your module:Open the module editor by selecting (Admin) > Developer Links > Module Editor. You'll see the list of modules in the left hand tree panel, each represented by a folder.
Expand the module folders to see the module directory structure and resources inside. You can use the Show Module dropdown to focus on a single module.
Click any folder or resource to open it for editing in the right hand panel. Your selection is shown in darker type.
In the case of resources like the SQL query shown above, you can directly edit the query text in the window and click Save Changes. You could also Move File or Delete File.
If you select a folder within the module tree, you have options like creating new subfolders, adding files, and moving or deleting the entire directory.
In the above example, we've selected the queries folder. Adding a new subfolder would give us a place to define queries on other schemas (so far there are only queries on the study schema in this module).
You can edit a wide variety of module based resources, including but not limited to:
You cannot delete, edit, rename, or upload content directly within the top level of a module.
SQL queries contained in your module can be edited directly in the module editor above, or also via the query browser, as long as the server has access to the module's source. To be able to edit, you need "Editor" or "Trusted Analyst" permissions. You must also first enable both the ModuleEditor module and the module containing the resources via the (Admin) > Folder > Management > Folder Type tab.
Click Edit Source to see the SQL source for your query in the same query editor as when you create a new query. A note will remind you where the query is defined and that changing a module-based query in this folder will also change it in any other folder that uses the same module.
From this page you can:
Click Edit Properties to adjust the name, description, availability in child folders, and whether the query is hidden. As with editing of source, be aware that your changes made to the module-resource here will impact all users on the site.
Click Edit Metadata to adjust the fields and properties that comprise your query using the field editor. You cannot change the names of fields via this interface, but can set properties, adjust lookups, etc.
R reports created in the UI using the R report builder can already be edited. With the ModuleEditor module and the module containing the reports enabled, you can now also edit module-based R reports.
Open your R report for editing. If you are using our example module, open the "LymphCD4" report on the Clinical and Assay Data tab. The R Report Builder allows you to edit the report on the Source tab. A message in the UI will alert you that you are editing a module based resource and any changes you make here will be reflected in all other folders where this module is in use.
When saved, your report changes will be stored in the original module resources.
The changes you make to module-based queries and reports via the UI are stored in the root of the module so that you can move the final module to production when ready.
Package the module from the development deployment and redeploy on your production server. Learn how in this topic: Deploy Modules to a Production Server