Topo2 - Removed old code carried over from clasic topo
- Removed Map Dialog and Filters
Change-Id: Id8d2791b7e13b0eedf7de1ed484edc7678e2bb77
diff --git a/web/gui/src/main/webapp/app/view/topo2/topo2.js b/web/gui/src/main/webapp/app/view/topo2/topo2.js
index 1ecd420..c798927 100644
--- a/web/gui/src/main/webapp/app/view/topo2/topo2.js
+++ b/web/gui/src/main/webapp/app/view/topo2/topo2.js
@@ -31,9 +31,7 @@
var ovtopo2, svg, defs, zoomLayer, forceG;
// Internal state
- var zoomer,
- currentLayoutId = 'root'; // NOTE: see UiTopoLayoutId.DEFAULT_STR
-
+ var zoomer;
// --- Glyphs, Icons, and the like -----------------------------------
@@ -47,14 +45,9 @@
// callback invoked when the SVG view has been resized..
function svgResized(s) {
- $log.debug('topo2 view resized', s);
t2fs.newDim([s.width, s.height]);
}
- function setUpKeys(overlayKeys) {
- $log.debug('topo2: set up keys....');
- }
-
// --- Pan and Zoom --------------------------------------------------
// zoom enabled predicate. ev is a D3 source event.
@@ -124,12 +117,8 @@
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,
};
$scope = _$scope_;
@@ -192,7 +181,6 @@
dim = [wh.width, wh.height];
// set up our keyboard shortcut bindings
- setUpKeys();
setUpZoom();
setUpDefs();
@@ -207,28 +195,14 @@
t2fs.init(svg, forceG, uplink, dim, zoomer);
// === ORIGINAL CODE ===
-
- // setUpToolbar();
- // setUpNoDevs();
-
- // 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.ovid);
- // $log.debug('registered overlays...', tov.list());
-
summaryPanel.init(detailsPanel);
detailsPanel.init(summaryPanel);
// Now that we are initialized, ask the server for what we
- // need to show.
+ // need to show.
t2es.start();
$log.log('OvTopo2Ctrl has been created');
diff --git a/web/gui/src/main/webapp/app/view/topo2/topo2Breadcrumb.js b/web/gui/src/main/webapp/app/view/topo2/topo2Breadcrumb.js
index 6e80613..49a68a1 100644
--- a/web/gui/src/main/webapp/app/view/topo2/topo2Breadcrumb.js
+++ b/web/gui/src/main/webapp/app/view/topo2/topo2Breadcrumb.js
@@ -31,7 +31,6 @@
layout;
function init() {
- $log.debug("Topo2BreadcrumbService Initiated");
breadcrumbs = [];
breadcrumbContainer = d3.select('#breadcrumbs');
diff --git a/web/gui/src/main/webapp/app/view/topo2/topo2Collection.js b/web/gui/src/main/webapp/app/view/topo2/topo2Collection.js
index ae96acb..369da23 100644
--- a/web/gui/src/main/webapp/app/view/topo2/topo2Collection.js
+++ b/web/gui/src/main/webapp/app/view/topo2/topo2Collection.js
@@ -26,7 +26,7 @@
function Collection(models, options) {
- var opts = options || (options = {});
+ var opts = options || {};
this.models = [];
this._reset();
diff --git a/web/gui/src/main/webapp/app/view/topo2/topo2D3.js b/web/gui/src/main/webapp/app/view/topo2/topo2D3.js
deleted file mode 100644
index 6a3964a..0000000
--- a/web/gui/src/main/webapp/app/view/topo2/topo2D3.js
+++ /dev/null
@@ -1,44 +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 Layout Module.
-Module that contains the d3.force.layout logic
-*/
-
-(function () {
- 'use strict';
-
- function nodeEnter(node) {
- node.onEnter(this, node);
- }
-
- function nodeExit(node) {
- node.onExit(this, node);
- }
-
- angular.module('ovTopo2')
- .factory('Topo2D3Service', [
-
- function (_is_) {
- return {
- nodeEnter: nodeEnter,
- nodeExit: nodeExit
- };
- }
- ]
-);
-})();
diff --git a/web/gui/src/main/webapp/app/view/topo2/topo2Device.js b/web/gui/src/main/webapp/app/view/topo2/topo2Device.js
index e459ed4..8f7edd9 100644
--- a/web/gui/src/main/webapp/app/view/topo2/topo2Device.js
+++ b/web/gui/src/main/webapp/app/view/topo2/topo2Device.js
@@ -29,7 +29,7 @@
virtual: 'cord'
};
- function createDeviceCollection(data, region) {
+ function createDeviceCollection(data) {
var DeviceCollection = Collection.extend({
model: Model
@@ -65,7 +65,7 @@
this.super = this.constructor.__super__;
this.super.initialize.apply(this, arguments);
},
- onChange: function (change) {
+ onChange: function () {
if (this.el) {
this.el.attr('class', this.svgClassName());
var rect = this.el.select('.icon-rect');
diff --git a/web/gui/src/main/webapp/app/view/topo2/topo2Dialog.js b/web/gui/src/main/webapp/app/view/topo2/topo2Dialog.js
deleted file mode 100644
index 71a33d2..0000000
--- a/web/gui/src/main/webapp/app/view/topo2/topo2Dialog.js
+++ /dev/null
@@ -1,46 +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 Dialog Module.
- Creates a dialog box for the topology view.
- */
-
-(function () {
- 'use strict';
-
- // constants
- var idDialog = 'topo2-p-dialog',
- opts = {
- cssCls: 'topo2-p'
- };
-
- // ==========================
-
- angular.module('ovTopo2')
- .factory('Topo2DialogService', [
- 'DialogService',
-
- function (ds) {
- return {
- openDialog: function () {
- return ds.openDialog(idDialog, opts);
- },
- closeDialog: ds.closeDialog,
- createDiv: ds.createDiv
- };
- }]);
-})();
diff --git a/web/gui/src/main/webapp/app/view/topo2/topo2Layout.js b/web/gui/src/main/webapp/app/view/topo2/topo2Layout.js
index d1747a3..2a8e95d 100644
--- a/web/gui/src/main/webapp/app/view/topo2/topo2Layout.js
+++ b/web/gui/src/main/webapp/app/view/topo2/topo2Layout.js
@@ -79,14 +79,13 @@
.factory('Topo2LayoutService',
[
'$log', '$timeout', 'WebSocketService', 'SvgUtilService', 'Topo2RegionService',
- 'Topo2D3Service', 'Topo2ViewService', 'Topo2SelectService', 'Topo2ZoomService',
+ 'Topo2ViewService', 'Topo2SelectService', 'Topo2ZoomService',
'Topo2ViewController',
- function ($log, $timeout, wss, sus, t2rs, t2d3, t2vs, t2ss, t2zs,
+ function ($log, $timeout, wss, sus, t2rs, t2vs, t2ss, t2zs,
ViewController) {
var Layout = ViewController.extend({
init: function (svg, forceG, uplink, dim, zoomer, opts) {
- $log.debug('initialize Layout');
instance = this;
this.svg = svg;
@@ -94,7 +93,6 @@
// Append all the SVG Group elements to the forceG object
this.createForceElements();
- this.uplink = uplink;
this.dim = dim;
this.zoomer = zoomer;
@@ -219,10 +217,7 @@
.transition()
.attr('opacity', 1);
- entering.filter('.device').each(t2d3.nodeEnter);
- entering.filter('.sub-region').each(t2d3.nodeEnter);
- entering.filter('.host').each(t2d3.nodeEnter);
- entering.filter('.peer-region').each(t2d3.nodeEnter);
+ entering.each(function (d) { d.onEnter(this, d) });
this.force.nodes(regionNodes);
},
@@ -246,7 +241,7 @@
'stroke-width': linkConfig.inWidth
});
- entering.each(t2d3.nodeEnter);
+ entering.each(function (d) { d.onEnter(this, d) });
// operate on exiting links:
this.link.exit()
diff --git a/web/gui/src/main/webapp/app/view/topo2/topo2Link.js b/web/gui/src/main/webapp/app/view/topo2/topo2Link.js
index 89c40b8..d68b689 100644
--- a/web/gui/src/main/webapp/app/view/topo2/topo2Link.js
+++ b/web/gui/src/main/webapp/app/view/topo2/topo2Link.js
@@ -31,8 +31,6 @@
.domain([1, 12])
.range([widthRatio, 12 * widthRatio])
.clamp(true),
- allLinkTypes = 'direct optical tunnel UiDeviceLink',
- allLinkSubTypes = 'not-permitted',
labelDim = 30;
// configuration
@@ -306,50 +304,26 @@
return { x: k * dx + nearX, y: k * dy + nearY };
},
- restyleLinkElement: function (immediate) {
- // this fn's job is to look at raw links and decide what svg classes
- // need to be applied to the line element in the DOM
- var th = ts.theme(),
- el = this.el,
- type = this.get('type'),
- online = this.online(),
- modeCls = this.expected() ? '-inactive' : 'not-permitted',
- delay = immediate ? 0 : 1000;
-
- // NOTE: understand why el is sometimes undefined on addLink events...
- // Investigated:
- // el is undefined when it's a reverse link that is being added.
- // updateLinks (which sets ldata.el) isn't called before this is called.
- // Calling _updateLinks in addLinkUpdate fixes it, but there might be
- // a more efficient way to fix it.
- if (el && !el.empty()) {
- el.classed('link', true);
- el.classed(allLinkSubTypes, false);
- el.classed(modeCls, !online);
- el.classed(allLinkTypes, false);
- if (type) {
- el.classed(type, true);
- }
- el.transition()
- .duration(delay)
- .attr('stroke', linkConfig[th].baseColor);
-
- this.setScale();
- }
- },
onEnter: function (el) {
- var link = d3.select(el);
+ var link = d3.select(el),
+ th = ts.theme(),
+ delay = 1000;
this.el = link;
- this.restyleLinkElement();
+
+ link.transition()
+ .duration(delay)
+ .attr('stroke', linkConfig[th].baseColor);
+
this.setVisibility();
+ this.setScale();
},
setScale: function () {
if (!this.el) return;
var width = linkScale(widthRatio) / t2zs.scale();
- this.el.style('stroke-width', width + 'px');
+ this.el.attr('stroke-width', width + 'px');
var labelScale = labelDim / (labelDim * t2zs.scale());
diff --git a/web/gui/src/main/webapp/app/view/topo2/topo2Map.js b/web/gui/src/main/webapp/app/view/topo2/topo2Map.js
index c4b7912..002ca69 100644
--- a/web/gui/src/main/webapp/app/view/topo2/topo2Map.js
+++ b/web/gui/src/main/webapp/app/view/topo2/topo2Map.js
@@ -25,9 +25,6 @@
// Injected Services
var $log, $loc, ps, ms, flash, sus, t2zs, countryFilters;
- // Injected Classes
- var MapSelectionDialog;
-
// internal state
var instance, mapG, zoomLayer, zoomer, currentMap;
@@ -67,24 +64,6 @@
return promise;
}
- // TODO: deprecated - maps are defined per layout on the server side.
- function setMap(map) {
- ps.setPrefs('topo2_mapid', map);
- return setUpMap.bind(this)();
- }
-
- // TODO: deprecated - map selection does not make sense in Topo2
- function openMapSelection() {
- $log.warn('openMapSelection DISABLED');
-
- // MapSelectionDialog.prototype.currentMap = currentMap;
- //
- // new MapSelectionDialog({
- // okHandler: function (preferences) {
- // setMap(preferences);
- // }
- // }).open();
- }
function resetZoom() {
zoomer.reset();
@@ -102,12 +81,10 @@
angular.module('ovTopo2')
.factory('Topo2MapService', [
'$log', '$location', 'Topo2ViewController', 'PrefsService',
- 'MapService', 'FlashService', 'SvgUtilService', 'Topo2CountryFilters',
- 'Topo2MapDialog', 'Topo2ZoomService',
+ 'MapService', 'FlashService', 'SvgUtilService', 'Topo2ZoomService',
function (_$log_, _$loc_, ViewController, _ps_,
- _ms_, _flash_, _sus_, _t2cf_,
- _t2md_, _t2zs_) {
+ _ms_, _flash_, _sus_, _t2zs_) {
$log = _$log_;
$loc = _$loc_;
@@ -115,8 +92,6 @@
ms = _ms_;
flash = _flash_;
sus = _sus_;
- countryFilters = _t2cf_;
- MapSelectionDialog = _t2md_;
t2zs = _t2zs_;
var MapLayer = ViewController.extend({
@@ -125,9 +100,7 @@
displayName: 'Map',
init: init,
- setMap: setMap,
setUpMap: setUpMap,
- openMapSelection: openMapSelection,
resetZoom: resetZoom,
zoomCallback: zoomCallback,
getCurrentMap: getCurrentMap
diff --git a/web/gui/src/main/webapp/app/view/topo2/topo2MapCountryFilters.js b/web/gui/src/main/webapp/app/view/topo2/topo2MapCountryFilters.js
deleted file mode 100644
index a3c10e4..0000000
--- a/web/gui/src/main/webapp/app/view/topo2/topo2MapCountryFilters.js
+++ /dev/null
@@ -1,61 +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';
-
- angular.module('ovTopo2')
- .factory('Topo2CountryFilters', [
- function (_$log_, _wss_, _t2ds_) {
- return {
- s_america: function (c) {
- return c.properties.continent === 'South America';
- },
- ns_america: function (c) {
- return c.properties.custom === 'US-cont' ||
- c.properties.subregion === 'Central America' ||
- c.properties.continent === 'South America';
- },
- japan: function (c) {
- return c.properties.geounit === 'Japan';
- },
- europe: function (c) {
- return c.properties.continent === 'Europe';
- },
- italy: function (c) {
- return c.properties.geounit === 'Italy';
- },
- uk: function (c) {
- // technically, Ireland is not part of the United Kingdom,
- // but the map looks weird without it showing.
- return c.properties.adm0_a3 === 'GBR' ||
- c.properties.adm0_a3 === 'IRL';
- },
- s_korea: function (c) {
- return c.properties.adm0_a3 === 'KOR';
- },
- australia: function (c) {
- return c.properties.adm0_a3 === 'AUS';
- }
- };
- }
- ]);
-})();
diff --git a/web/gui/src/main/webapp/app/view/topo2/topo2MapDialog.js b/web/gui/src/main/webapp/app/view/topo2/topo2MapDialog.js
deleted file mode 100644
index cf93883..0000000
--- a/web/gui/src/main/webapp/app/view/topo2/topo2MapDialog.js
+++ /dev/null
@@ -1,131 +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 Map Dialog
- Display of the dialog window to select a background map for the current topology view
- NOTE: This will be deprecated in the future
- */
-
-(function () {
- 'use strict';
-
- // Injected
- var $log, wss, t2ds;
-
- // Constants
- var mapRequest = 'mapSelectorRequest';
-
- // State
- var order, maps, map, mapItems;
-
- var Dialog = function (options) {
-
- this.okHandlerCallback = options.okHandler;
- this.closeHandlerCallback = options.closeHandler;
-
- wss.bindHandlers({
- mapSelectorResponse: this.handleMapResponse.bind(this)
- });
- };
-
- Dialog.prototype = {
- handleMapResponse: function (data) {
- $log.info('Got response', data);
- order = data.order;
- maps = data.maps;
-
- t2ds.openDialog()
- .setTitle('Select Map')
- .addContent(this.render.bind(this)())
- .addOk(this.okHandler.bind(this), 'OK')
- .addCancel(this.closeHandler.bind(this), 'Close')
- .bindKeys();
- },
-
- open: function () {
- wss.sendEvent(mapRequest);
- },
- close: function () {
- wss.unbindHandlers({
- mapSelectorResponse: this.handleMapResponse.bind(this)
- });
- },
-
- selectedMap: function () {
- map = maps[this.options[this.selectedIndex].value];
- $log.info('Selected map', map);
- },
-
- okHandler: function () {
-
- var p = {
- mapid: map.id,
- mapscale: map.scale,
- mapfilepath: map.filePath,
- tint: 'off'
- // tint: tintCheck.property('checked') ? 'on' : 'off'
- };
-
- if (this.okHandlerCallback) {
- this.okHandlerCallback(p);
- }
-
- this.close();
- },
- closeHandler: function () {
-
- if (this.closeHandlerCallback) {
- this.closeHandlerCallback();
- }
-
- this.close();
- },
-
- render: function () {
-
- var content = t2ds.createDiv('map-list'),
- form = content.append('form'),
- current = this.currentMap();
-
- map = maps[current.mapid];
- mapItems = form.append('select').on('change', this.selectedMap);
-
- order.forEach(function (id) {
- var m = maps[id];
- mapItems.append('option')
- .attr('value', m.id)
- .attr('selected', m.id === current.mapid ? true : null)
- .text(m.description);
- });
-
- return content;
- }
- };
-
- angular.module('ovTopo2')
- .factory('Topo2MapDialog', [
- '$log', 'WebSocketService', 'Topo2DialogService',
- function (_$log_, _wss_, _t2ds_) {
-
- $log = _$log_;
- wss = _wss_;
- t2ds = _t2ds_;
-
- return Dialog;
- }
- ]);
-})();
diff --git a/web/gui/src/main/webapp/app/view/topo2/topo2NodeModel.js b/web/gui/src/main/webapp/app/view/topo2/topo2NodeModel.js
index 006e4be..8e39922 100644
--- a/web/gui/src/main/webapp/app/view/topo2/topo2NodeModel.js
+++ b/web/gui/src/main/webapp/app/view/topo2/topo2NodeModel.js
@@ -55,7 +55,7 @@
'SvgUtilService', 'IconService', 'ThemeService',
'Topo2MapConfigService', 'Topo2ZoomService', 'Topo2NodePositionService',
'Topo2SelectService', 'Topo2MastershipService',
- function (Model, _fn_, _ps_, _sus_, _is_, _ts_,
+ function (Model, _fn_, _t2ps_, _sus_, _is_, _ts_,
_t2mcs_, zoomService, _t2nps_, t2ss, t2mss) {
ts = _ts_;
diff --git a/web/gui/src/main/webapp/app/view/topo2/topo2Theme.js b/web/gui/src/main/webapp/app/view/topo2/topo2Theme.js
deleted file mode 100644
index e69de29..0000000
--- a/web/gui/src/main/webapp/app/view/topo2/topo2Theme.js
+++ /dev/null
diff --git a/web/gui/src/main/webapp/index.html b/web/gui/src/main/webapp/index.html
index 06d5a31..d778f39 100644
--- a/web/gui/src/main/webapp/index.html
+++ b/web/gui/src/main/webapp/index.html
@@ -135,8 +135,6 @@
<script src="app/view/topo2/topo2Breadcrumb.js"></script>
<script src="app/view/topo2/topo2Background.js"></script>
<script src="app/view/topo2/topo2Collection.js"></script>
- <script src="app/view/topo2/topo2D3.js"></script>
- <script src="app/view/topo2/topo2Dialog.js"></script>
<script src="app/view/topo2/topo2DetailsPanel.js"></script>
<script src="app/view/topo2/topo2Device.js"></script>
<script src="app/view/topo2/topo2DeviceDetailsPanel.js"></script>
@@ -150,9 +148,7 @@
<script src="app/view/topo2/topo2Link.js"></script>
<script src="app/view/topo2/topo2LinkPanel.js"></script>
<script src="app/view/topo2/topo2Map.js"></script>
- <script src="app/view/topo2/topo2MapCountryFilters.js"></script>
<script src="app/view/topo2/topo2MapConfig.js"></script>
- <script src="app/view/topo2/topo2MapDialog.js"></script>
<script src="app/view/topo2/topo2Mastership.js"></script>
<script src="app/view/topo2/topo2Model.js"></script>
<script src="app/view/topo2/topo2NodeModel.js"></script>
@@ -167,7 +163,6 @@
<script src="app/view/topo2/topo2SummaryPanel.js"></script>
<script src="app/view/topo2/topo2SubRegion.js"></script>
<script src="app/view/topo2/topo2SubRegionPanel.js"></script>
- <script src="app/view/topo2/topo2Theme.js"></script>
<script src="app/view/topo2/topo2Toolbar.js"></script>
<script src="app/view/topo2/topo2View.js"></script>
<script src="app/view/topo2/topo2ViewController.js"></script>