Dec 6, 2018

How Plugins work

What is a plugin?

A plugin is a functionality that you can add to Arc. Arc comes with a few plugins, you can see the full list in Arc/plugins folder:

There are two types of plugins in Arc: pages and menu items.

Page Plugin

A page plugin can be used to building nearly anything you want, it has full access to the REST API and is only limited by your imagination. It is created by building an Angular directive, you really don’t need to know much about this, start by copying an existing plugin. All page plugins will apear under Tools in the left bar menu:

The pages you create can be used either for all TM1 instances or can be designed for a specific application. Some examples of what you can build are:

  • Manage security

  • Retrieve and update security

  • REST API explorer

  • Administration page with links to important TI or processes that you run each month.

  • Bedrock admin page with descriptions of TI easy execution.

  • Apliqode admin pages to provide a custom UI to all of the cool stuff in Apliqode.

Menu Plugin

The menu plugins appear as a sub item on the menu. The menu plugins can be configured to appear by object type, instance and/or object name. It can be used to customise the Arc interface so it is quick and easy to do your common day to day tasks. If you are doing things each day or month consider building a plugin.

For example, a plugin already exists Bedrock Clone which is going to run the Bedrock.Clone process for the specific dimension:

There are lots of things you could use the plugin for such as:

  • Add a sub menu to each process to execute it.

  • Add a sub menu to clone an object.

  • Add a sub menu to rename objects.

  • Add a sub menu to delete objects.

  • Add all of the related load processes for a cube as a sub menu. (see, general-ledger-load plugin).

The important part of the menu plugin is the function this.execute(instance, name), each menu plugin must contain this function. It is executed when you click on the menu item and passes through to the plugin the name of TM1 instance and the name of the TM1 object.

For example if you open the C:Arcpluginsbedrock-dimension-cloneplugin.js file, you can see that the this.execute command run the process Bedrock.Dim.Clone process:

How Plugins are loaded

The plugins are loaded from the plugin directory in the same location as Arc. The plugins are processed in the following way:

  1. The Arc application is loaded in the browser or refreshed.

  2. Any plugin.js files in the plugins directory and its sub-directories are combined and loaded with the Arc application. You can disable loading of a particular plugin via the plugins.yml in the plugins directory.

  3. Calling $rootScope.plugin function adds the plugin to Arc.

  4. The directive or service is added to Arc app.

  5. For page plugins they are added to the menu, menu items are added as a sub menu based on the criteria in the plugin.

Plugins are loaded from file each time you refresh your browser so development is easy, change the file, refresh the page and see if it works. You can also use your favourite browser developer tools to debug your plugin in the browser, in Chrome press F12 and go to the Sources tab, there you will see the plugins file by expanding the _ folder. The plugins fileis named plugins_{version}.js

Related content

Loading related content