Premium Feature — This feature is available with the Professional and Enterprise Editions of LabKey Server. It requires the addition of the moduleEditor module to your distribution. Learn more or contact LabKey.

Edit module-based resources directly within the user interface of a LabKey Server running in development mode. As long as the module is loaded and the server can find the source root, you can edit module-based resources like SQL queries and R reports within it without stopping and starting your server.

Built-in SQL queries and queries defined via the user interface can already be edited following the instructions in this topic: Edit SQL Query Source. The module editing feature described here allows you to edit resources provided in modules that would otherwise need to be edited offline and reloaded. Using this feature streamlines the development of custom modules for many applications.

Set Up for Module Editing

1. Prerequisites: To be able to edit module-based resources "live":

  • LabKey Server must be running in Development mode.
  • The ModuleEditor module must be deployed on your server.
  • You must have the necessary permissions to edit the same resources when they are not module-based:
    • SQL Queries: "Editor" or higher
    • R Reports: "Platform Developer" or "Trusted Analyst"
2. Deploy the module containing the resources you want to edit in the traditional method. You cannot edit it if you load it through the server UI. If you would like an example module to help you get started, you can use this one: 3. Navigate to the folder where you want to be able to use and edit your module-based resources. If you want to use our example "aloadingdemo.module" which contains a few simple queries and reports, first install the example study you can download from this page: Rename the archive to end in .zip, 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. To deploy it on the server run:
./gradlew deployApp

4. In your working folder, enable your module:

  • Select (Admin) > Folder > Management.
  • Click the Folder Type tab.
  • Check the box for your module, and make sure the ModuleEditor module is also enabled in the folder.
  • Click Update Folder.

Edit SQL Queries

SQL queries contained in your module can be edited 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.

  • Select (Admin) > Go To Module > Query.
  • Click the schema where your query is defined.
  • Click the name of the module-defined query. If you are using our example, you can use the study > Master Dashboard query.
  • In the upper right, you will see a note about where the module is defined, plus options for editing:

Edit Source

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:

  • Save & Finish: Save changes and exit the edit interface
  • Save: Save, but keep editing
  • Execute Query: See your work in progress
  • Edit Properties
  • Edit Metadata
  • Help: See keyboard shortcuts and a link to the SQL Reference.
Changes to will be saved to the module.

Edit Properties

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.

Edit Metadata

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.

Edit R Reports

R reports created in the UI using the R report builder can already be edited. With the ModuleEditor module 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.

Moving Edited Resources to Production

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.

Related Topics

Was this content helpful?

Log in or register an account to provide feedback


previousnext
 
expand allcollapse all