
122 vFoglight
Web Component Tutorial
Task Components
There are three tasks, one each for adding a host, removing a host, and editing a host’s
annotation property.
• Add a host—A groovy script that passes two context values, one for host name
and one for operating system name, to the underlying topology service to create a
new node. It requires two context entries, hostName and operatingSystem.
• Remove Host—A groovy script that takes the selected value from the table of
hosts and passes it to the delete method of the topology service. It requires a
context entry for the currently-selected row called hostSelected.
• Add annotation—A groovy script that takes the context value for the annotation
text and replaces the selected host’s annotation field. It requires two context
entries, hostId, which is the unique Id for the currently-selected host, and
newAnnotation, which is the Va lue derived from the contents of the text field used
to collect the annotation string.
Order of Construction
The views listed in “View Components” on page 121 have been chosen to facilitate the
creation of a new host node, which requires manipulating the underlying topology
model. One of the ways of accomplishing this kind of low level work is to construct
Groovy scripts that can access the objects that can access the model. You have to create
the scripts first so that you can attach them to the component’s flow action.
You are going to establish a flow from the table of hosts to a Grid component called Add
a host form, so you need to construct the grid before you construct the table.
Notes on the Context Flow
The next few paragraphs contain comments on how context is used to supply
information to the Topology Service that manages vFoglight’s host model. Please keep
these remarks in mind as you construct the tasks and views in this tutorial.
Add host
Choosing Add in the table’s menu causes the Add a host form Grid to pop up. Typing a
name for the new host and choosing its operating system from the drop-down list, sets
two context keys, hostName and operatingSystem. These are passed to the Add a host
task, which creates a new host entry in the data model.
Kommentare zu diesen Handbüchern