Creating views

The IBM® Cognos® Analytics user interface consists of views, such as home, sign-in, authoring, dashboard, and modeling. You can create custom views to augment the built-in views.

Views are defined in a spec.json file that is contained in the root of the view .zip file. Custom views also include an HTML div element that replaces the central pane of the Cognos Analytics user interface. Custom views can also add or remove menus and buttons from the Application and Navigation bars, or remove one or both of these bars altogether. The structure and contents of the spec.json file is described in spec.json description. The high-level structure of the file is show here.

{
	"name": "<name>",
	"schemaVersion": "2.0",
	"extensions": [{
		"perspective":"<view_name>",
		"type":"<home_or_login>",
		"features": [{
			"id": "<id>",
			"toolItems": [<tool_item1>,<tool_item2>,...],
			"collectionItems": [<collection_item1>,<collection_item2>,...],
			"excludeFeatures": [<exclude_feature1>,<exclude_feature2>,...],
			"excludeItems": [<exclude_item1>,<exclude_item2>,...]
			"content": {
				"type":"<path_to_javascript_file>",
				"options": {
					...
					}
				}
			},
			"cssStyles": [
				"<path_to_css_file>"
				]
		}]
	}]
}

Views are packaged as extensions and a view .zip file can contain extension elements as well. For example, the SampleExtensionButtonOpenPerspective.zip sample defines a custom view and also adds a button to the Navigation bar of the home view that displays the custom view.

The content element contains the path to, and the name of, the JavaScript file that runs in order to create the custom view. The options element contains any options required by the JavaScript file. The JavaScript files uses the Asynchronous module definition (AMD) API.

A special type of view is a sign-in view. This type of view allows you to create a custom sign-in page for Cognos Analytics. The value of the type element determines if a view is a sign-in view (value is login) or not (value is home).

Unlike extensions, views have to be explicitly invoked in order for them to open. There are three ways to invoke a view.

  • A button or menu item can be defined to open the view.
  • The view can be opened by using a URL as follows.
    http://<server>:<port>/bi/?perspective=<view_name>
  • The view can be set to be the default home view for a user or for a role, or for all users. For more information, see Managing themes, extensions, views, and parameters.