Structure of an Add-On

A valid Operations Monitor add-on consists of a manifest.json file and a set of files that will be exposed to the client. The manifest.json file must be a valid JSON file and include the fields found in Table 12-1:

Table 12-1 manifest.json File Required Fields

Field Description

api_version

The current supported API version is "0.1.0".

Description Describes the functions of the add-on.
name Name of the extension. This name will be used as the extension files path in the server

Example:

{    "api_version":
        "0.1.0",    "description": "Display Blue
        style",    "name":
      "p1_ojet"
    }

Creating Customized Add-ons

Starting with the Session Monitor 5.0 release, the working functionality of the custom add-ons has changed.

Here is a sample demonstration of an add-on where you can add a simple text on the header of Operations Monitor GUI.
  1. As an example, create a simple add-on on the header of the OCOM.
  2. Open the file header.js. You can find the file under in the path for the JavaScript code: /opt/oracle/ocsm/usr/share/acme/public/web/js/viewModels/child. This is the Javascript file.
    self.headerAddonFlag = ko.observable(false);
    self.sampleAddonFunction = function(){
        if (self.psaArrayFromController.includes('sampleaddon')) {
                self.headerAddonFlag(true);
                console.log ("Simple custom addon on OCOM 5.0")
        }
        else{
             self.headerAddonFlag(false);
            }
    }
    self.sampleAddonFunction();
  3. Add the above function and call it. Check if the sampleaddon is enabled. If it is enabled then make a flag true and text is visible on the header.
  4. For the HTML, code file is header.html: /opt/oracle/ocsm/usr/share/acme/public/web/js/view/child.
    <oj-bind-if test="[[headerAddonFlag()]]">
        <div>
            <h3>
                <div style="background-color:powderblue;">
                        <oj-bind-text style="color: blueviolet;" value="Sample       custom addon">
    </oj-bind-text>
                </div>
            </h3>
        </div>
    </oj-bind-if>

    Note:

    Write the above OJET code exactly where you want to have the text of addon. In this case, we are adding in the Header.
  5. Create a file called manifest.json and its content is as follows:
    {
        "api_version": "0.1.0",
        "description": "Demonstration of an addon",
         "name": "sampleaddon"
    }

    Note:

    Ensure that the name of the add-on is the same as the name written in the code - sampleaddon.
  6. Create a folder and compress the contents of the folder into .zip file. This .zip file contains the manifest.json file,
  7. Upload the .zip package in the PSA-Add-on and then enable it. If you disable it, it should not be visible.

    Note:

    The files will change if we are working on different regions of OCOM.
    Here's a screen grab of the custom add-on.

    Figure 12-1 Sample add-on


    Sample add-on