Workspace Templates

You have the ability to create new workspaces through templates. Essentially, instead of creating an empty workspace, workspaces can be derived from pre-defined template definitions. Any Finsemble user or administrator can create new templates. But default, only the "Blank Template" is defined.

To create a template definition:

  1. Use the "User Preferences Menu" to select a workspace from which to create the template.
  2. Then, select "Save Template." This will export a template definition into a JSON file based on the selected workspace.

There are two ways to use a saved workspace template.

  • The save template definition can be directly included in the Finsemble config.
  • The saved template files can be shared between users, then imported using the "User Preferences Menu". After a template is imported, it will show up in the "New Workspace" dialog.

Note: Although an exported template definition is exported as JSON, it should be treated as an internal Finsemble definition. This means templates can be exported (i.e., saved) from Finsemble and imported back into Finsemble, but should not be used or accessed for other purposes. The underlying motivation is that template definitions are big and complex, based on their internal representation.

Importing using the "User Preferences Menu"

The "User Preferences Menu" can be used to import. This "New Workspace" dialog utilizes the Input and Selection Dialog presentation component for creating a workspace.

Importing a template using config

  1. First, export a template definition from the "User Preferences Menu." For this example, let’s assume the template saved to file workspaceConfig-Workspace 2-template.json.
  2. Move workspaceConfig-Workspace 2-template.json to where Finsemble’s config is maintained. For example, the template file can be stored under config/other/workspaceConfig-Workspace 2-template.json.
  3. Then import the template definition from the main config using something like the below:
     "importConfig": [
        "$applicationRoot/configs/application/services.json",
        "$applicationRoot/components/sampleComponents.json",
        "$applicationRoot/configs/application/systemComponents.json",
        "$applicationRoot/configs/other/workspaceConfig-Workspace 2-template.json"
    ]

URLs and templates

It is important to understand saved templates include URLs from the workspace it is cloned from. This is correct as long as the template will be used on the same server (i.e., the server referenced by the URLs). However, if the template is created in a development environment or on a different server environment, then the URLs in the the template file must be manually replaced with the correct URL values. This can be done using a text editor’s global replacement function). The new URL values can be either a standard URL string or it can included a configuration-macro value—examples are shown below.

If the template was created when running Finsemble on server1, the URLs contained within might look like the following. "someURL": "https://server1.com/components/premium/simpleChart/simpleChart.html"

To use the template running Finsemble on server2, a global replacement in the file would leave the URL like the following: "someURL": "https://server2.com/components/premium/simpleChart/simpleChart.html"

Or if the template is run in different environments, the new URL might look like the following: "someURL": "$applicationRoot/components/premium/simpleChart/simpleChart.html"

Note: When replacing URL with macros that overlap, to maintain macro consistency, first do a replacement with the most specific macro value. For example consider the following two common macros.

  • "applicationRoot": "https://Finsemble.chartiq.com/",

  • "moduleRoot": "https://Finsemble.chartiq.com/Finsemble/",

Because their paths overlap, first replace "https://Finsemble.chartiq.com/Finsemble/" with "$moduleRoot", then replace "https://Finsemble.chartiq.com/ with "$applicationRoot".


check   A user or administrator can create definitions for new workspace templates.
 


Further reading

Read the Workspace Client API documentation for more information about workspaces under the hood.

Read the Workspace tutorial for an overview of this topic.