mirror of
https://github.com/opennetworkinglab/onos.git
synced 2025-10-29 07:11:49 +01:00
Remove obsolete harness code (TopoX)
Change-Id: Icf4c8fe0f29e90bccd8ca0d58e3b1245ce383d9e
This commit is contained in:
parent
bbd0f4691e
commit
7ee9f083f7
@ -136,7 +136,6 @@ public class UiExtensionManager
|
|||||||
// FIXME: leave commented out for now, while still under development
|
// FIXME: leave commented out for now, while still under development
|
||||||
// (remember to also comment out inclusions in index.html)
|
// (remember to also comment out inclusions in index.html)
|
||||||
// new UiView(NETWORK, "topo2", "New-Topo"),
|
// new UiView(NETWORK, "topo2", "New-Topo"),
|
||||||
// new UiView(NETWORK, "topoX", "Topo-X"),
|
|
||||||
|
|
||||||
new UiView(NETWORK, "device", "Devices", "nav_devs"),
|
new UiView(NETWORK, "device", "Devices", "nav_devs"),
|
||||||
new UiViewHidden("flow"),
|
new UiViewHidden("flow"),
|
||||||
|
|||||||
@ -1,62 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2016-present Open Networking Laboratory
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Copyright 2016-present Open Networking Laboratory
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
ONOS GUI -- Topology View (theme) -- CSS file
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* --- Base SVG Layer --- */
|
|
||||||
|
|
||||||
#ov-topoX svg {
|
|
||||||
/*background-color: #f4f4f4;*/
|
|
||||||
background-color: goldenrod; /* just for testing */
|
|
||||||
}
|
|
||||||
|
|
||||||
/* --- "No Devices" Layer --- */
|
|
||||||
|
|
||||||
#ov-topoX svg .noDevsBird {
|
|
||||||
fill: #db7773;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ov-topoX svg #topoX-noDevsLayer text {
|
|
||||||
fill: #7e9aa8;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* --- Topo Map --- */
|
|
||||||
|
|
||||||
#ov-topoX svg #topoX-map {
|
|
||||||
stroke-width: 2px;
|
|
||||||
stroke: #f4f4f4;
|
|
||||||
fill: #e5e5e6;
|
|
||||||
}
|
|
||||||
|
|
||||||
@ -1,67 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2016-present Open Networking Laboratory
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
ONOS GUI -- Topology View (test layout) -- CSS file
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* --- Base SVG Layer --- */
|
|
||||||
|
|
||||||
#ov-topoX svg {
|
|
||||||
/* prevents the little cut/copy/paste square that would appear on iPad */
|
|
||||||
-webkit-user-select: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
#topoXtmp {
|
|
||||||
height: 700px;
|
|
||||||
width: 98%;
|
|
||||||
overflow-y: scroll;
|
|
||||||
}
|
|
||||||
|
|
||||||
#topoXtmp div {
|
|
||||||
padding: 2px 24px;
|
|
||||||
margin: 6px;
|
|
||||||
background-color: #ddddff;
|
|
||||||
}
|
|
||||||
#topoXtmp div div {
|
|
||||||
padding: 0 10px;
|
|
||||||
}
|
|
||||||
#topoXtmp div div span {
|
|
||||||
color: purple;
|
|
||||||
font-style: italic;
|
|
||||||
font-weight: bold;
|
|
||||||
}
|
|
||||||
|
|
||||||
#topoXtmp h4 {
|
|
||||||
margin: 0
|
|
||||||
}
|
|
||||||
#topoXtmp p {
|
|
||||||
margin: 0
|
|
||||||
}
|
|
||||||
#topoXtmp .nav-me:hover {
|
|
||||||
background-color: #bbbbdd;
|
|
||||||
}
|
|
||||||
#topoXtmp .nav-me {
|
|
||||||
font-weight: bold;
|
|
||||||
text-decoration: underline;
|
|
||||||
cursor: pointer;
|
|
||||||
color: blue;
|
|
||||||
}
|
|
||||||
|
|
||||||
.subRegions div p {
|
|
||||||
width: 40px;
|
|
||||||
}
|
|
||||||
@ -1,53 +0,0 @@
|
|||||||
<!-- Topology View partial HTML -->
|
|
||||||
<div id="ov-topoX">
|
|
||||||
<div id="topoXtmp">
|
|
||||||
<div class="instances">
|
|
||||||
<h4>Instances</h4>
|
|
||||||
<div></div>
|
|
||||||
</div>
|
|
||||||
<div class="layoutData">
|
|
||||||
|
|
||||||
<h4>Layout Data</h4>
|
|
||||||
|
|
||||||
<div class="l_id">
|
|
||||||
Layout ID: <span> - </span>
|
|
||||||
</div>
|
|
||||||
<div class="l_parent">
|
|
||||||
Layout Parent: <span> - </span>
|
|
||||||
</div>
|
|
||||||
<div class="l_region">
|
|
||||||
Region ID: <span> - </span>
|
|
||||||
</div>
|
|
||||||
<div class="l_regionName">
|
|
||||||
Region Name: <span> - </span>
|
|
||||||
</div>
|
|
||||||
<div class="l_crumbs">
|
|
||||||
Breadcrumbs: <span> </span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<div class="thisRegion">
|
|
||||||
<b>This Region ID:</b> <span></span>
|
|
||||||
</div>
|
|
||||||
<div class="subRegions">
|
|
||||||
<h4>Subregions</h4>
|
|
||||||
<div></div>
|
|
||||||
</div>
|
|
||||||
<div class="devices">
|
|
||||||
<h4>Devices</h4>
|
|
||||||
<div></div>
|
|
||||||
</div>
|
|
||||||
<div class="hosts">
|
|
||||||
<h4>Hosts</h4>
|
|
||||||
<div></div>
|
|
||||||
</div>
|
|
||||||
<div class="links">
|
|
||||||
<h4>Links</h4>
|
|
||||||
<div></div>
|
|
||||||
</div>
|
|
||||||
<div class="peers">
|
|
||||||
<h4>Peers</h4>
|
|
||||||
<div></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
@ -1,214 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2016-present Open Networking Laboratory
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Copyright 2016-present Open Networking Laboratory
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
ONOS GUI -- Topology View Module
|
|
||||||
|
|
||||||
NOTE: currently under development to support Regions.
|
|
||||||
*/
|
|
||||||
|
|
||||||
(function () {
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
// references to injected services
|
|
||||||
var $scope, $log, $loc,
|
|
||||||
fs, mast, ks, zs,
|
|
||||||
gs, ms, sus, flash,
|
|
||||||
wss, ps, th,
|
|
||||||
tXes, tXfs;
|
|
||||||
|
|
||||||
// DOM elements
|
|
||||||
var ovtopoX, svg, defs, zoomLayer, mapG, spriteG, forceG, noDevsLayer;
|
|
||||||
|
|
||||||
// Internal state
|
|
||||||
var zoomer, actionMap;
|
|
||||||
|
|
||||||
|
|
||||||
// === Helper Functions
|
|
||||||
|
|
||||||
// callback invoked when the SVG view has been resized..
|
|
||||||
function svgResized(s) {
|
|
||||||
$log.debug("topoX view resized", s);
|
|
||||||
}
|
|
||||||
|
|
||||||
function setUpKeys(overlayKeys) {
|
|
||||||
$log.debug('topoX: set up keys....');
|
|
||||||
}
|
|
||||||
|
|
||||||
// === Controller Definition -----------------------------------------
|
|
||||||
|
|
||||||
angular.module('ovTopoX', ['onosUtil', 'onosSvg', 'onosRemote'])
|
|
||||||
.controller('OvTopoXCtrl',
|
|
||||||
['$scope', '$log', '$location',
|
|
||||||
'FnService', 'MastService', 'KeyService', 'ZoomService',
|
|
||||||
'GlyphService', 'MapService', 'SvgUtilService', 'FlashService',
|
|
||||||
'WebSocketService', 'PrefsService', 'ThemeService',
|
|
||||||
'TopoXEventService', 'TopoXForceService',
|
|
||||||
|
|
||||||
function (_$scope_, _$log_, _$loc_,
|
|
||||||
_fs_, _mast_, _ks_, _zs_,
|
|
||||||
_gs_, _ms_, _sus_, _flash_,
|
|
||||||
_wss_, _ps_, _th_,
|
|
||||||
_tXes_, _tXfs_) {
|
|
||||||
|
|
||||||
var params = _$loc_.search(),
|
|
||||||
projection,
|
|
||||||
dim,
|
|
||||||
wh,
|
|
||||||
uplink = {
|
|
||||||
// provides function calls back into this space
|
|
||||||
// showNoDevs: showNoDevs,
|
|
||||||
// projection: function () { return projection; },
|
|
||||||
// zoomLayer: function () { return zoomLayer; },
|
|
||||||
// zoomer: function () { return zoomer; },
|
|
||||||
// opacifyMap: opacifyMap,
|
|
||||||
// topoStartDone: topoStartDone
|
|
||||||
};
|
|
||||||
|
|
||||||
$scope = _$scope_;
|
|
||||||
$log = _$log_;
|
|
||||||
$loc = _$loc_;
|
|
||||||
|
|
||||||
fs = _fs_;
|
|
||||||
mast = _mast_;
|
|
||||||
ks = _ks_;
|
|
||||||
zs = _zs_;
|
|
||||||
|
|
||||||
gs = _gs_;
|
|
||||||
ms = _ms_;
|
|
||||||
sus = _sus_;
|
|
||||||
flash = _flash_;
|
|
||||||
|
|
||||||
wss = _wss_;
|
|
||||||
ps = _ps_;
|
|
||||||
th = _th_;
|
|
||||||
|
|
||||||
tXes = _tXes_;
|
|
||||||
tXfs = _tXfs_;
|
|
||||||
|
|
||||||
// capture selected intent parameters (if they are set in the
|
|
||||||
// query string) so that the traffic overlay can highlight
|
|
||||||
// the path for that intent
|
|
||||||
if (params.intentKey && params.intentAppId && params.intentAppName) {
|
|
||||||
$scope.intentData = {
|
|
||||||
key: params.intentKey,
|
|
||||||
appId: params.intentAppId,
|
|
||||||
appName: params.intentAppName
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
$scope.notifyResize = function () {
|
|
||||||
svgResized(fs.windowSize(mast.mastHeight()));
|
|
||||||
};
|
|
||||||
|
|
||||||
// Cleanup on destroyed scope..
|
|
||||||
$scope.$on('$destroy', function () {
|
|
||||||
$log.log('OvTopoXCtrl is saying Buh-Bye!');
|
|
||||||
tXes.stop();
|
|
||||||
ks.unbindKeys();
|
|
||||||
tXfs.destroy();
|
|
||||||
});
|
|
||||||
|
|
||||||
// svg layer and initialization of components
|
|
||||||
ovtopoX = d3.select('#ov-topoX');
|
|
||||||
svg = ovtopoX.select('svg');
|
|
||||||
// set the svg size to match that of the window, less the masthead
|
|
||||||
wh = fs.windowSize(mast.mastHeight());
|
|
||||||
$log.debug('setting topo SVG size to', wh);
|
|
||||||
svg.attr(wh);
|
|
||||||
dim = [wh.width, wh.height];
|
|
||||||
|
|
||||||
|
|
||||||
// set up our keyboard shortcut bindings
|
|
||||||
setUpKeys();
|
|
||||||
|
|
||||||
// make sure we can respond to topology events from the server
|
|
||||||
tXes.bindHandlers();
|
|
||||||
|
|
||||||
// initialize the force layout, ready to render the topology
|
|
||||||
tXfs.init();
|
|
||||||
|
|
||||||
|
|
||||||
// =-=-=-=-=-=-=-=-
|
|
||||||
// TODO: in future, we will load background map data
|
|
||||||
// asynchronously (hence the promise) and then chain off
|
|
||||||
// there to send the topoXstart event to the server.
|
|
||||||
// For now, we'll send the event inline...
|
|
||||||
tXes.start();
|
|
||||||
|
|
||||||
|
|
||||||
// === ORIGINAL CODE ===
|
|
||||||
|
|
||||||
// setUpKeys();
|
|
||||||
// setUpToolbar();
|
|
||||||
// setUpDefs();
|
|
||||||
// setUpZoom();
|
|
||||||
// setUpNoDevs();
|
|
||||||
/*
|
|
||||||
setUpMap().then(
|
|
||||||
function (proj) {
|
|
||||||
var z = ps.getPrefs('topo_zoom', { tx:0, ty:0, sc:1 });
|
|
||||||
zoomer.panZoom([z.tx, z.ty], z.sc);
|
|
||||||
$log.debug('** Zoom restored:', z);
|
|
||||||
|
|
||||||
projection = proj;
|
|
||||||
$log.debug('** We installed the projection:', proj);
|
|
||||||
flash.enable(false);
|
|
||||||
toggleMap(prefsState.bg);
|
|
||||||
flash.enable(true);
|
|
||||||
mapShader(true);
|
|
||||||
|
|
||||||
// now we have the map projection, we are ready for
|
|
||||||
// the server to send us device/host data...
|
|
||||||
tes.start();
|
|
||||||
// need to do the following so we immediately get
|
|
||||||
// the summary panel data back from the server
|
|
||||||
restoreSummaryFromPrefs();
|
|
||||||
}
|
|
||||||
);
|
|
||||||
*/
|
|
||||||
// tes.bindHandlers();
|
|
||||||
// setUpSprites();
|
|
||||||
|
|
||||||
// forceG = zoomLayer.append('g').attr('id', 'topo-force');
|
|
||||||
// tfs.initForce(svg, forceG, uplink, dim);
|
|
||||||
// tis.initInst({ showMastership: tfs.showMastership });
|
|
||||||
// tps.initPanels();
|
|
||||||
|
|
||||||
// restoreConfigFromPrefs();
|
|
||||||
// ttbs.setDefaultOverlay(prefsState.ovidx);
|
|
||||||
|
|
||||||
// $log.debug('registered overlays...', tov.list());
|
|
||||||
|
|
||||||
$log.log('OvTopoXCtrl has been created');
|
|
||||||
}]);
|
|
||||||
}());
|
|
||||||
@ -1,101 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2016-present Open Networking Laboratory
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
ONOS GUI -- Topology Event Module.
|
|
||||||
|
|
||||||
Defines the conduit between the client and the server:
|
|
||||||
- provides a clean API for sending events to the server
|
|
||||||
- dispatches incoming events from the server to the appropriate sub-module
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
(function () {
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
// injected refs
|
|
||||||
var $log, wss, tXfs;
|
|
||||||
|
|
||||||
// internal state
|
|
||||||
var handlerMap,
|
|
||||||
openListener;
|
|
||||||
|
|
||||||
// ========================== Helper Functions
|
|
||||||
|
|
||||||
function createHandlerMap() {
|
|
||||||
handlerMap = {
|
|
||||||
topo2AllInstances: tXfs,
|
|
||||||
topo2CurrentLayout: tXfs,
|
|
||||||
topo2CurrentRegion: tXfs,
|
|
||||||
topo2PeerRegions: tXfs,
|
|
||||||
topo2StartDone: tXfs
|
|
||||||
|
|
||||||
// Add further event names / module references as needed
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
function wsOpen(host, url) {
|
|
||||||
$log.debug('topoXEvent: WSopen - cluster node:', host, 'URL:', url);
|
|
||||||
// tell the server we are ready to receive topo events
|
|
||||||
wss.sendEvent('topo2Start');
|
|
||||||
}
|
|
||||||
|
|
||||||
// bind our event handlers to the web socket service, so that our
|
|
||||||
// callbacks get invoked for incoming events
|
|
||||||
function bindHandlers() {
|
|
||||||
wss.bindHandlers(handlerMap);
|
|
||||||
$log.debug('topoX event handlers bound');
|
|
||||||
}
|
|
||||||
|
|
||||||
// tell the server we are ready to receive topology events
|
|
||||||
function start() {
|
|
||||||
// in case we fail over to a new server,
|
|
||||||
// listen for wsock-open events
|
|
||||||
openListener = wss.addOpenListener(wsOpen);
|
|
||||||
wss.sendEvent('topo2Start');
|
|
||||||
$log.debug('topoX comms started');
|
|
||||||
}
|
|
||||||
|
|
||||||
// tell the server we no longer wish to receive topology events
|
|
||||||
function stop() {
|
|
||||||
wss.sendEvent('topo2Stop');
|
|
||||||
wss.unbindHandlers(handlerMap);
|
|
||||||
wss.removeOpenListener(openListener);
|
|
||||||
openListener = null;
|
|
||||||
$log.debug('topoX comms stopped');
|
|
||||||
}
|
|
||||||
|
|
||||||
// ========================== Main Service Definition
|
|
||||||
|
|
||||||
angular.module('ovTopoX')
|
|
||||||
.factory('TopoXEventService',
|
|
||||||
['$log', 'WebSocketService', 'TopoXForceService',
|
|
||||||
|
|
||||||
function (_$log_, _wss_, _tXfs_) {
|
|
||||||
$log = _$log_;
|
|
||||||
wss = _wss_;
|
|
||||||
tXfs = _tXfs_;
|
|
||||||
|
|
||||||
// deferred creation of handler map, so module references are good
|
|
||||||
createHandlerMap();
|
|
||||||
|
|
||||||
return {
|
|
||||||
bindHandlers: bindHandlers,
|
|
||||||
start: start,
|
|
||||||
stop: stop
|
|
||||||
};
|
|
||||||
}]);
|
|
||||||
}());
|
|
||||||
@ -1,207 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2016-present Open Networking Laboratory
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
ONOS GUI -- Topology Force Module.
|
|
||||||
Visualization of the topology in an SVG layer, using a D3 Force Layout.
|
|
||||||
*/
|
|
||||||
|
|
||||||
(function () {
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
// injected refs
|
|
||||||
var $log, wss;
|
|
||||||
|
|
||||||
// selected DOM refs
|
|
||||||
var topdiv;
|
|
||||||
|
|
||||||
// ========================== Helper Functions
|
|
||||||
|
|
||||||
function init() {
|
|
||||||
topdiv = d3.select('#topoXtmp');
|
|
||||||
$log.debug('Initialize topo force layout');
|
|
||||||
}
|
|
||||||
|
|
||||||
function destroy() {
|
|
||||||
$log.debug('Destroy topo force layout');
|
|
||||||
}
|
|
||||||
|
|
||||||
function rmP(div) {
|
|
||||||
div.selectAll('p').remove();
|
|
||||||
}
|
|
||||||
|
|
||||||
function navRequest(rid) {
|
|
||||||
wss.sendEvent('topo2navRegion', {
|
|
||||||
rid: rid
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function doTmpInstances(data) {
|
|
||||||
var idiv = topdiv.select('.instances').select('div');
|
|
||||||
data.members.forEach(function (m) {
|
|
||||||
idiv.append('div').text(m.id);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function doTmpCurrentLayout(data) {
|
|
||||||
var ldDiv = topdiv.select('.layoutData'),
|
|
||||||
bcs = ldDiv.select('.l_crumbs');
|
|
||||||
|
|
||||||
function setSpan(v, val) {
|
|
||||||
var cls = '.l_' + v,
|
|
||||||
span = ldDiv.select(cls).select('span'),
|
|
||||||
value = val || data[v];
|
|
||||||
span.html(value);
|
|
||||||
}
|
|
||||||
|
|
||||||
setSpan('id');
|
|
||||||
setSpan('parent');
|
|
||||||
setSpan('region');
|
|
||||||
setSpan('regionName');
|
|
||||||
|
|
||||||
addCrumbNav(bcs, data.crumbs, data.region);
|
|
||||||
}
|
|
||||||
|
|
||||||
function addCrumbNav(span, array, id) {
|
|
||||||
var rev = [];
|
|
||||||
|
|
||||||
span.selectAll('span').remove();
|
|
||||||
|
|
||||||
array.forEach(function (a) {
|
|
||||||
rev.unshift(a.id);
|
|
||||||
});
|
|
||||||
|
|
||||||
rev.forEach(function (rid, idx) {
|
|
||||||
if (idx) {
|
|
||||||
span.append('span').text(' +++ ');
|
|
||||||
}
|
|
||||||
if (rid != id) {
|
|
||||||
addNavigable(span, 'span', rid);
|
|
||||||
} else {
|
|
||||||
span.append('span').text(rid);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function addNavigable(span, what, rid) {
|
|
||||||
span.append(what).classed('nav-me', true)
|
|
||||||
.text(rid)
|
|
||||||
.on('click', function () { navRequest(rid); });
|
|
||||||
}
|
|
||||||
|
|
||||||
function doTmpCurrentRegion(data) {
|
|
||||||
var span = topdiv.select('.thisRegion').select('span');
|
|
||||||
var div;
|
|
||||||
span.text(data.id);
|
|
||||||
|
|
||||||
div = topdiv.select('.subRegions').select('div');
|
|
||||||
rmP(div);
|
|
||||||
data.subregions.forEach(function (r) {
|
|
||||||
addNavigable(div, 'p', r.id);
|
|
||||||
});
|
|
||||||
|
|
||||||
div = topdiv.select('.devices').select('div');
|
|
||||||
rmP(div);
|
|
||||||
data.layerOrder.forEach(function (tag, idx) {
|
|
||||||
var devs = data.devices[idx];
|
|
||||||
devs.forEach(function (d) {
|
|
||||||
div.append('p')
|
|
||||||
.text('[' + tag + '] ' + d.id);
|
|
||||||
});
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
div = topdiv.select('.hosts').select('div');
|
|
||||||
rmP(div);
|
|
||||||
data.layerOrder.forEach(function (tag, idx) {
|
|
||||||
var hosts = data.hosts[idx];
|
|
||||||
hosts.forEach(function (h) {
|
|
||||||
div.append('p')
|
|
||||||
.text('[' + tag + '] ' + h.id);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
div = topdiv.select('.links').select('div');
|
|
||||||
rmP(div);
|
|
||||||
data.links.forEach(function (lnk) {
|
|
||||||
div.append('p')
|
|
||||||
.text(lnk.id);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function doTmpPeerRegions(data) {
|
|
||||||
var peerDiv = topdiv.select('.peers').select('div');
|
|
||||||
rmP(peerDiv);
|
|
||||||
|
|
||||||
function logPeer(p) {
|
|
||||||
var o = peerDiv.append('p'),
|
|
||||||
id = p.id,
|
|
||||||
nt = p.nodeType;
|
|
||||||
o.text('[' + nt + '] id = ' + id);
|
|
||||||
}
|
|
||||||
|
|
||||||
data.peers.forEach(function (p) {
|
|
||||||
logPeer(p);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// ========================== Event Handlers
|
|
||||||
|
|
||||||
function allInstances(data) {
|
|
||||||
$log.debug('>> topo2AllInstances event:', data);
|
|
||||||
doTmpInstances(data);
|
|
||||||
}
|
|
||||||
|
|
||||||
function currentLayout(data) {
|
|
||||||
$log.debug('>> topo2CurrentLayout event:', data);
|
|
||||||
doTmpCurrentLayout(data);
|
|
||||||
}
|
|
||||||
|
|
||||||
function currentRegion(data) {
|
|
||||||
$log.debug('>> topo2CurrentRegion event:', data);
|
|
||||||
doTmpCurrentRegion(data);
|
|
||||||
}
|
|
||||||
|
|
||||||
function peerRegions(data) {
|
|
||||||
$log.debug('>> topo2PeerRegions event:', data);
|
|
||||||
doTmpPeerRegions(data);
|
|
||||||
}
|
|
||||||
|
|
||||||
function startDone(data) {
|
|
||||||
$log.debug('>> topo2StartDone event:', data);
|
|
||||||
}
|
|
||||||
|
|
||||||
// ========================== Main Service Definition
|
|
||||||
|
|
||||||
angular.module('ovTopoX')
|
|
||||||
.factory('TopoXForceService',
|
|
||||||
['$log', 'WebSocketService',
|
|
||||||
|
|
||||||
function (_$log_, _wss_) {
|
|
||||||
$log = _$log_;
|
|
||||||
wss = _wss_;
|
|
||||||
|
|
||||||
return {
|
|
||||||
init: init,
|
|
||||||
destroy: destroy,
|
|
||||||
topo2AllInstances: allInstances,
|
|
||||||
topo2CurrentLayout: currentLayout,
|
|
||||||
topo2CurrentRegion: currentRegion,
|
|
||||||
topo2PeerRegions: peerRegions,
|
|
||||||
topo2StartDone: startDone
|
|
||||||
};
|
|
||||||
}]);
|
|
||||||
}());
|
|
||||||
@ -167,11 +167,6 @@
|
|||||||
<link rel="stylesheet" href="app/view/topo2/topo2.css">
|
<link rel="stylesheet" href="app/view/topo2/topo2.css">
|
||||||
<link rel="stylesheet" href="app/view/topo2/topo2-theme.css">-->
|
<link rel="stylesheet" href="app/view/topo2/topo2-theme.css">-->
|
||||||
|
|
||||||
<!-- <script src="app/view/topoX/topoX.js"></script>
|
|
||||||
<script src="app/view/topoX/topoXEvent.js"></script>
|
|
||||||
<script src="app/view/topoX/topoXForce.js"></script>
|
|
||||||
<link rel="stylesheet" href="app/view/topoX/topoX.css">
|
|
||||||
<link rel="stylesheet" href="app/view/topoX/topoX-theme.css">-->
|
|
||||||
|
|
||||||
<!-- Builtin views javascript. -->
|
<!-- Builtin views javascript. -->
|
||||||
<script src="app/view/topo/topo.js"></script>
|
<script src="app/view/topo/topo.js"></script>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user