From 9342e38f0f546c0c2ea2f8d04ac677360e4aaa0c Mon Sep 17 00:00:00 2001 From: Simon Hunt Date: Thu, 8 Jun 2017 15:27:00 -0700 Subject: [PATCH] ONOS-6391: writing API readme's for the following modules: - dialog - event - filter - force Change-Id: I38208b1eb0fccfe5300361cd3605b2ea1befe5a1 --- .../webapp/_doc/view/topo/README.dialog.md | 13 ++- .../webapp/_doc/view/topo/README.event.md | 9 +- .../webapp/_doc/view/topo/README.filter.md | 18 ++- .../webapp/_doc/view/topo/README.force.md | 108 +++++++++++++++++- 4 files changed, 144 insertions(+), 4 deletions(-) diff --git a/web/gui/src/main/webapp/_doc/view/topo/README.dialog.md b/web/gui/src/main/webapp/_doc/view/topo/README.dialog.md index 9089999e4f..33f8d5e95d 100644 --- a/web/gui/src/main/webapp/_doc/view/topo/README.dialog.md +++ b/web/gui/src/main/webapp/_doc/view/topo/README.dialog.md @@ -5,5 +5,16 @@ Dialog service API. ### 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_ diff --git a/web/gui/src/main/webapp/_doc/view/topo/README.event.md b/web/gui/src/main/webapp/_doc/view/topo/README.event.md index 0894c09203..9c3a1ead6b 100644 --- a/web/gui/src/main/webapp/_doc/view/topo/README.event.md +++ b/web/gui/src/main/webapp/_doc/view/topo/README.event.md @@ -5,5 +5,12 @@ Event service API. ### 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 diff --git a/web/gui/src/main/webapp/_doc/view/topo/README.filter.md b/web/gui/src/main/webapp/_doc/view/topo/README.filter.md index 4cc446657d..eb9b47e3f5 100644 --- a/web/gui/src/main/webapp/_doc/view/topo/README.filter.md +++ b/web/gui/src/main/webapp/_doc/view/topo/README.filter.md @@ -5,5 +5,21 @@ Filter service API. ### 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 diff --git a/web/gui/src/main/webapp/_doc/view/topo/README.force.md b/web/gui/src/main/webapp/_doc/view/topo/README.force.md index b13b914700..bbdfc45226 100644 --- a/web/gui/src/main/webapp/_doc/view/topo/README.force.md +++ b/web/gui/src/main/webapp/_doc/view/topo/README.force.md @@ -5,5 +5,111 @@ Force service API. ### 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