The list of domains in the Domain Manager must show if the application service (VPS in our scenario) is bound to the domains.
In this document:
In Meta Declaration, you added the ui/plugins/DomainListPlugin.js
file as a view-plugin
that provides information about the application services in the list of domain. The system Domain Management
displays a list of domains, where the Enabled for Services column shows the services a domain is linked with.
In this project, we expect the domain list to show if a domain is linked with at least one VPS.
When showing services assigned to a domain, the Domain Manager calls certain functions of each view-plugin module.
Like other views, a view-plugin may define the init
, onContext
, onShow
,
and onHide
methods.
The Domain Manager passes the mediator
module to the view-plugin and expects from the latter a definition
of the mediator.updateState(domain,state)
method that modifies the state
object for the specified domain
.
The domain
argument contains a list of services implementing the DomainService
type and linked with the specified domain - domain.services
list.
The state
object contains the following child objects that present the application services assigned to a domain:
state.status
- a string that indicates if the application service is assigned to the domain.
Its value can be one of the strings: “Assigned” or “Not Assigned”.
Normally, if the application recognizes its service
in the domain.services
list, it must set the state.status
property to “Assigned”.
state.title
- the title of the application service displayed in the Enabled for Services column.
Continue the demo project from the previous step.
In the mediator.updateState(domain, state)
method, define two properties of the state
object:
state.title
- any string you likestate.status
- “Assigned” or “Not Assigned”The sample ui/plugins/DomainListPlugin.js
looks as follows:
define([
"dojo/_base/declare",
"aps/nav/ViewPlugin"
], function (
declare,
ViewPlugin
) {
return declare(ViewPlugin, {
init: function(mediator) {
mediator.updateState = function(domain, state) {
state.status = "Not Assigned";
state.title = "Virtual Server";
if (domain.services && domain.services.length > 0) {
domain.services.forEach(function (service) {
if (service.aps.type === "http://aps-standard.org/samples/dns1p/vps/1.0")
state.status = "Assigned";
});
}
};
}
});
});
The above code sets the status
to "Assigned"
if it recognizes its APS type in the list of services
linked with the domain
.
On completion of this step, you have the application integrated into the list of domains presented by the Domain Manager
The project file you have created is similar to the respective file in the
sample package
.
In the next project phase, you will complete the UI integration by embedding a custom view-plugin into the domain profile view presented by the Domain Manager.