Continue the development of the presentation level.
Basic view-plugin contains definition of the predefined set of properties.
In this document:
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
});
});
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
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"
});
});
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.