ONOS-6391: writing API readme's for the following modules:

- dialog
- event
- filter
- force

Change-Id: I38208b1eb0fccfe5300361cd3605b2ea1befe5a1
This commit is contained in:
Simon Hunt 2017-06-08 15:27:00 -07:00
parent 527932667c
commit 9342e38f0f
4 changed files with 144 additions and 4 deletions

View File

@ -5,5 +5,16 @@ Dialog service API.
### Function Descriptions ### Function Descriptions
`foo()` `openDialog()`
* Opens the topology view dialog box
`closeDialog()`
* Closes the topology view dialog box
`createDiv(cls)`
* `cls`: CSS class to assign (optional)
* Creates a (detached) _div_ element
* If `cls` is defined, it is applied as a CSS class
to the _div_
* Returns a D3 selection of that _div_

View File

@ -5,5 +5,12 @@ Event service API.
### Function Descriptions ### Function Descriptions
`foo()` `bindHandlers()`
* Binds the topology view event handlers to the web socket service
`start()`
* Initiates topology view by sending "start" event to server
`stop()`
* Deactivates topology view by sending "stop" event to server

View File

@ -5,5 +5,21 @@ Filter service API.
### Function Descriptions ### Function Descriptions
`foo()` `initFilter(api)`
* `api`: reverse linkage to topoForce module
* `node()`: reference to D3 node selection
* `link()`: reference to D3 link selection
* Initializes this module with a function API to other modules
`clickAction()`
* Increments filter mode index and re-renders nodes and links
to highlight those in the newly selected layer
`selected()`
* Returns the currently selected "layer"
* (`all`, `pkt`, or `opt`)
`inLayer(d, layer)`
* `d`: model data (link, host, device)
* `layer`: layer id (e.g. `pkt`)
* Returns true if the given element is "in" the specified layer

View File

@ -5,5 +5,111 @@ Force service API.
### Function Descriptions ### Function Descriptions
`foo()` `initForce(svg, forceG, uplink, dim, opts)`
* `svg`: D3 selection of _svg_ element for force layout rendering
* `forceG`: D3 selection of force layout _SVG_ group element
* `uplink`: API uplink to main _topo.js_ module
* `showNoDevs(b)` - show or hide _no connected devices_ message
* `projection()` - return ref to map projection object
* `zoomLayer()` - return ref to zoom layer element
* `zoomer()` - return ref to zoomer object
* `opacifyMap(b)` - show or hide map layer
* `topoStartDone()` - callback invoked after topo data
has been received from server
* `dim`: initial dimensions of _SVG_ ... `[w, h]`
* `opts`: options object
* can be used to override default settings
* _gravity_, _friction_, _charge_, _linkDistance_, _linkStrength_
`newDim()`
* `dim`: new dimensions ... `[w, h]`
* Sets new dimensions of force layout
`destroyForce()`
* Frees up all resources, cancels timers, cleans up DOM
`updateDeviceColors()`
* Delegates to _topoD3.js_ function of same name
`toggleHosts(x)`
* `x`: boolean (optional)
* If `x` is not defined, toggles host visibility
* If `x` is defined, sets or clears host visibility
`togglePorts()`
* `x`: boolean (optional)
* If `x` is not defined, toggles port labels visibility
* If `x` is defined, sets or clears port labels visibility
`toggleOffline()`
* `x`: boolean (optional)
* If `x` is not defined, toggles offline devices visibility
* If `x` is defined, sets or clears offline devices visibility
`cycleDeviceLabels()`
* Increments the device label mode and re-renders device labels
`unpin()`
* will _unpin_ a node over which the mouse currently hovers
`showMastership(masterId)`
* `masterId`: ONOS instance identifier (e.g. IP address)
* If `masterId` is defined, will render the display to highlight
those devices mastered by the given cluster member
* If `masterId` is not defined, restores the display
`showBadLinks()`
* Will briefly highlight links for which there is only a single backing link
* Also writes a summary of bad links to the console
`setNodeScale()`
* `scale`: the scale to use
* Rescales the nodes and links (and labels) based on the input parameter
`resetAllLocations()`
* Resets all nodes (hosts, devices) to the configured positions
`addDevice(data)`
* `data`: add-device event payload
* Adds a device to the model (and renders it)
`updateDevice(data)`
* `data`: update-device event payload
* Updates information for a device (re-rendering it)
`removeDevice(data)`
* `data`: remove-device event payload
* Removes a device from the model (and animates its removal)
`addHost(data)`
* `data`: add-host event payload
* Adds a host to the model (and renders it if hosts visible)
`updateHost(data)`
* `data`: update-host event payload
* Updates information for a host (re-rendering it)
`moveHost(data)`
* `data`: move-host event payload
* Updates information for a host to move it to a new location
(re-rendering it if hosts visible)
`removeHost(data)`
* `data`: remove-host event payload
* Removes host from the model (and animates removal if hosts visible)
`addLink(data)`
* `data`: add-link event payload
* Adds a link to the model (and renders it)
`updateLink(data)`
* `data`: update-link event payload
* Updates information for a link (re-rendering it)
`removeLink(data)`
* `data`: remove-link event payload
* Removes link from model (and animates removal)
`topoStartDone()`
* Callback invoked once the server signals that all topology data
has been transferred