Application Packaging Standard

Last updated 18-Mar-2019

Basic View-Plugin

Continue the development of the presentation level.

../../../../_images/dash-step-meta.png ../../../../_images/dash-step-presentation-b.png ../../../../_images/dash-step-deploy.png ../../../../_images/dash-step-provisioning.png ../../../../_images/dash-step-announce.png

Basic view-plugin contains definition of the predefined set of properties.

../../../../_images/dash-presentation-step-basic-b.png ../../../../_images/dash-presentation-step-adv.png

Source Structure

The view-plugin source must declare a new module inherited from aps/nav/ViewPlugin and assign application specific values to a set of properties. The Home dashboard service processes the assigned view-plugin properties to display the application service in a tile. The structure of the view-plugin source looks as follows:

define([
    "dojo/_base/declare",
    "aps/nav/ViewPlugin"
], function (declare, ViewPlugin) {
    return declare(ViewPlugin, {
      /* Assign view-plugin properties here */
      apsType: "<APS type ID>",  // The only mandatory property
      // ... other properties
    });
});

Properties

In the view-plugin source, it is necessary to assign application specific values to a set of properties that is a part of the full set of properties.

  • apsType - APS type ID of the resources managed by the application service
  • addResourceLabel - Label on the button
  • addResourceViewId- View ID of the target view for the button
  • noResourcesText - The text printed out when no resources of the specified APS type were found
  • entryViewId - Destination view ID where users will be directed to if they click on the tile body

Continue Your Demo

This section continues the demo project from its previous step.

Create the ui/plugins/vpsDashboardPlugin.js file that defines the mentioned above properties as in the following example:

define([
  "dojo/_base/declare",
  "aps/common",
  "aps/i18n",
  "aps/nav/ViewPlugin"
], function(declare, common, i18n, ViewPlugin) {

   return declare(ViewPlugin, {
      /* Displayed resources */
      apsType:    "http://aps-standard.org/samples/basic1pdash/vps",

      /* Button label */
      addResourceLabel: "Create new VPS",

      /* Message displayed when there are no resources to show */
      noResourcesText: "No virtual servers discovered",

      /* On button click - go to 'Add Resource' view */
      addResourceViewId: "http://aps-standard.org/samples/basic1pdash#vps-wizard",

      /* On tile click - go to the servers list */
      entryViewId:  "http://aps-standard.org/samples/basic1pdash#servers"
   });
});

Conclusion

This completes development of a view-plugin using a basic method. You can find a similar file in the sample package.

The next section explains an alternative method to define a view-plugin. If you are not interested in it, proceed directly to the Deployment phase.