Dashboard Item Example
You can use JSA GUI Application Framework to add a dashboard item to your JSA dashboard.
You might use dashboards to display data that you want to view or use often, for example, you might want to monitor disk usage on your JSA appliances.
The sample dashboard item app adds a basic dashboard item to the JSA Dashboard tab.
The following image is a dashboard example that is created by an app in JSA.

On the Dashboard tab, the sample dashboard item is accessed by using the Add Item menu.
The following image shows the sample dashboard in the Add Item menu.

The dashboard sample app contains the files that are described in the following table:
Table 1: Dashboard Sample App Files
Files/Folders | Description |
---|---|
| The root directory for application files.
The
The |
| Contains the Python virtual environment where the dependencies are installed. |
| Creates an instance of the Flask micro-framework that is used to serve content to JSA. |
| Describes details about the sample Dashboard Example, which JSA uses. |
| Contains instructions to run the code
that is in the |
Manifest.json
The manifest.json
file contains
the following code:
{ "name":"DashBoard Example", "description":"Application to display a new dashboard item", "version":"1.0", "uuid":"558d7935-f00b-42da-a278-c82abdb12d21", "dashboard_items":[ { "text":"QDashBoardExample Item", "description":"Sample dashboard item that is a copy of most recent offenses", "rest_method":"sampleDashboardItem", "required_capabilities":["ADMIN"] } ], "rest_methods": [ { "name":"sampleDashboardItem", "url":"/static/sampleDashboardItemResponse.json", "method":"GET", "argument_names":[] "required_capabilities":["ADMIN"] } ] }
The first four objects, name
, description
, version
, and uuid
, provide basic application
information.
The dashboard_items
object describes
a new item on the JSADashboard tab. These
items are available to users, who can manually add the items to their
dashboard.
The dashboard_items
block contains
the fields that are described in the following table:
Table 2: Dashboard Items Block
Name | Description | Value |
---|---|---|
| The name of the dashboard item that is displayed. | QDashBoardExample Item |
| A description of the dashboard item that is displayed when your mouse hovers over the dashboard item. | Sample dashboard item that is a copy of most recent offenses |
| The name of the REST method to load this item. This method must
be declared in the | sampleDashboardItem |
| Instructs JSA to display the Dashboard Example dashboard item only to users who have administrator privileges. |
|
The rest_methods
block contains the
fields that are described in the following table:
Table 3: REST Methods Block
Name | Description | Value |
---|---|---|
| A unique name for this REST method within the app. | sampleDashboardItem |
| The URL to access the REST method, relative to the application root. Only URLs within their own application are supported. |
|
| Concise text to display that describes the area. Can optionally point at a resource bundle key, if the application is globalized. | GET |
| The names of arguments that this method supports. Arguments are passed to the method URL encoded, as either query string parameters or in the PUT/POST body. | [] |
| This field instructs JSA to display the Dashboard Example dashboard item only to users with Administrator privileges. |
|
Views.py
For this sample app, creates the default routes '/'
and '/index'
, both of
which return a simple string. The index route is declared in the url field of manifest.json
.
__author__ = 'IBM' from app import app @app.route('/') @app.route('/index') def index(): return ""
/app/static/sampleDashboardItemResponse.json
The /app/static/sampleDashboardItemResponse.json
file contains the following code:
{"id":"sampleDashboardItem","title":"Sample Dashboard Item", "HTML":"<div>This item could contain <b><u>any HTML</u></b>!</div>"}
The JSON object that is returned needs the following data:
An ID for the dashboard item you are creating
A title for the dashboard item
HTML to render the dashboard item