You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ea...@apache.org on 2017/09/27 18:18:58 UTC
qpid-dispatch git commit: DISPATCH-833 Removed 'Add new router' from
stand-alone console
Repository: qpid-dispatch
Updated Branches:
refs/heads/master 3c86ad6e9 -> c77203e6f
DISPATCH-833 Removed 'Add new router' from stand-alone console
Project: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/commit/c77203e6
Tree: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/tree/c77203e6
Diff: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/diff/c77203e6
Branch: refs/heads/master
Commit: c77203e6f6720ac5b9e736aa14c208d8fb16aee0
Parents: 3c86ad6
Author: Ernest Allen <ea...@redhat.com>
Authored: Wed Sep 27 14:18:41 2017 -0400
Committer: Ernest Allen <ea...@redhat.com>
Committed: Wed Sep 27 14:18:41 2017 -0400
----------------------------------------------------------------------
console/stand-alone/index.html | 1 -
console/stand-alone/plugin/css/dispatch.css | 12 -
.../stand-alone/plugin/html/qdrTopology.html | 134 +-----
console/stand-alone/plugin/js/qdrNewNode.js | 445 -------------------
console/stand-alone/plugin/js/qdrTopology.js | 274 +-----------
5 files changed, 2 insertions(+), 864 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/c77203e6/console/stand-alone/index.html
----------------------------------------------------------------------
diff --git a/console/stand-alone/index.html b/console/stand-alone/index.html
index b1b5fec..706022d 100644
--- a/console/stand-alone/index.html
+++ b/console/stand-alone/index.html
@@ -125,7 +125,6 @@ under the License.
<script type="text/javascript" src="plugin/js/qdrService.js"></script>
<script type="text/javascript" src="plugin/js/qdrChartService.js"></script>
<script type="text/javascript" src="plugin/js/qdrTopology.js"></script>
- <script type="text/javascript" src="plugin/js/qdrNewNode.js"></script>
<script type="text/javascript" src="plugin/js/qdrSettings.js"></script>
<script type="text/javascript" src="plugin/lib/rhea-min.js"></script>
http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/c77203e6/console/stand-alone/plugin/css/dispatch.css
----------------------------------------------------------------------
diff --git a/console/stand-alone/plugin/css/dispatch.css b/console/stand-alone/plugin/css/dispatch.css
index d0ff9a7..5c946bd 100644
--- a/console/stand-alone/plugin/css/dispatch.css
+++ b/console/stand-alone/plugin/css/dispatch.css
@@ -50,13 +50,6 @@ svg:not(.active):not(.ctrl) path.link {
cursor: pointer;
}
-path.link.temp {
- opacity: 0.3;
-}
-path.link.temp.over {
- opacity: 0.8;
- stroke-dasharray: 10,2;
-}
path.link.small {
stroke-width: 2.5;
stroke: darkgray;
@@ -119,11 +112,6 @@ circle.node.on-demand.artemis {
circle.node.fixed {
stroke-dasharray: 10,2;
}
-circle.node.temp {
- stroke: #f80;
- fill: #f0f0ff;
-}
-
text {
font: 12px sans-serif;
pointer-events: none;
http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/c77203e6/console/stand-alone/plugin/html/qdrTopology.html
----------------------------------------------------------------------
diff --git a/console/stand-alone/plugin/html/qdrTopology.html b/console/stand-alone/plugin/html/qdrTopology.html
index 1b83084..851c724 100644
--- a/console/stand-alone/plugin/html/qdrTopology.html
+++ b/console/stand-alone/plugin/html/qdrTopology.html
@@ -27,50 +27,19 @@ under the License.
<h4>Connection Info</h4>
<div class="gridStyle" ng-grid="topoGridOptions"></div>
</div>
- <div id="addNodeForm" ng-if="form == 'add'">
- <h4>Add a new router</h4>
- <ul>
- <li>Click on an existing router to create a connection to the new router</li>
- <li>Double-click on the new router to <button ng-click="editNewRouter()">edit</button> its properties</li>
- <li ng-show="addingNode.hasLink" >Right-click on a new connection to edit its properties</li>
- </ul>
- <button ng-click="cancel()">Cancel</button>
- </div>
</div>
<button ng-if="panelVisible" ng-click="hideLeftPane()" class="hideLeft" title="Hide"><i class="icon-step-backward"></i></button>
<button ng-if="!panelVisible" ng-click="showLeftPane()" class="hideLeft" title="Show"><i class="icon-step-forward"></i></button>
</div>
<div class="panel-adjacent">
- <!--
- <ul class="nav nav-tabs ng-scope qdrTopoModes">
- <li ng-repeat="mode in modes" ng-class="{active : isModeActive(mode.name), 'pull-right' : isRight(mode)}" ng-click="selectMode('{{mode.name}}')" >
- <a data-placement="bottom" class="ng-binding"> {{mode.name}} </a></li>
- </ul>
- -->
- <div id="topology" ng-show="mode == 'Diagram'"><!-- d3 toplogy here --></div>
- <div id="geology" ng-show="mode == 'Globe'"><!-- d3 globe here --></div>
+ <div id="topology"><!-- d3 toplogy here --></div>
<div id="crosssection"><!-- d3 pack here --></div>
- <!-- <div id="addRouter" ng-show="mode == 'Add Node'"></div> -->
<div id="node_context_menu" class="contextMenu">
<ul>
- <li class="na" ng-class="{new: contextNode.cls == 'temp'}" ng-click="addingNode.trigger = 'editNode'">Edit...</li>
- <li class="na" ng-class="{adding: addingNode.step > 0}" ng-click="addingNode.step = 0">Cancel add</li>
- <li class="context-separator"></li>
<li class="na" ng-class="{'force-display': !isFixed()}" ng-click="setFixed(true)">Freeze in place</li>
<li class="na" ng-class="{'force-display': isFixed()}" ng-click="setFixed(false)">Unfreeze</li>
</ul>
</div>
- <div id="svg_context_menu" class="contextMenu">
- <ul>
- <li ng-click="addingNode.step = 2">Add a new router</li>
- </ul>
- </div>
- <div id="link_context_menu" class="contextMenu">
- <ul>
- <li ng-click="reverseLink()">Reverse connection direction</li>
- <li ng-click="removeLink()">Remove connection</li>
- </ul>
- </div>
<div id="svg_legend"></div>
<div id="multiple_details">
<h4 class="grid-title">Connections</h4>
@@ -94,104 +63,3 @@ under the License.
<script type="text/ng-template" id="titleCellTemplate.html">
<div title="{{row.entity[col.field]}}" class="ngCellText">{{row.entity[col.field]}}</div>
</script>
-
-<!--
- This is the template for the node edit dialog that is displayed.
--->
-<script type="text/ng-template" id="node-config-template.html">
- <div class="modal-header">
- <h3 class="modal-title">Configure new router</h3>
- </div>
- <div class="modal-body">
- <form novalidate name="editForm">
-
- <tabset vertical="true" class="tabs-left">
- <tab ng-repeat="entity in entities"> <!-- ng-class="{separated: entity.tabName == 'listener0'}" -->
- <tab-heading>
- <i ng-if="entity.icon !== ''" ng-class="entity.icon ? 'ui-icon-arrowthick-1-w' : 'ui-icon-arrowthick-1-e'" class="ui-icon"></i>{{entity.humanName}}
- </tab-heading>
- <div class="entity-description">{{entity.description}}</div>
- <fieldset>
- <div ng-mouseenter="showDescription(attribute, $event)" ng-repeat="attribute in entity.attributes">
- <label for="{{attribute.name}}">{{attribute.humanName}}</label>
-<!-- we can't do <input type="{angular expression}"> because... jquery throws an exception because... -->
- <div ng-if="attribute.input == 'input'">
- <!-- ng-pattern="testPattern(attribute)" -->
- <input ng-if="attribute.type == 'number'" type="number" name="{{attribute.name}}" id="{{attribute.name}}" ng-model="attribute.value" ng-required="attribute.required" class="ui-widget-content ui-corner-all"/>
- <input ng-if="attribute.type == 'text'" type="text" name="{{attribute.name}}" id="{{attribute.name}}" ng-model="attribute.value" ng-required="attribute.required" class="ui-widget-content ui-corner-all"/>
- </div>
- <div ng-if="attribute.input == 'select'">
- <select id="{{attribute.name}}" ng-model="attribute.selected" ng-options="item for item in attribute.rawtype"></select>
- </div>
- <div ng-if="attribute.input == 'boolean'" class="boolean">
- <label><input type="radio" ng-model="attribute.value" value="true"> True</label>
- <label><input type="radio" ng-model="attribute.value" value="false"> False</label>
- </div>
- </div>
- </fieldset>
- <div class="attr-description">{{attributeDescription}}
- <div class="attr-type">{{attributeType}}</div>
- <div class="attr-required">{{attributeRequired}}</div>
- <div class="attr-unique">{{attributeUnique}}</div>
- </div>
- <div class="attr-annotations" ng-repeat="annotation in entity.annotatedBy">
- <span>You can also enter the <button ng-click="selectAnnotationTab(annotation)">{{annotation}}</button> values.</span>
- </div>
- </tab>
- </tabset>
-
-
- </form>
- </div>
- <div class="modal-footer">
- <button class="btn btn-primary" type="button" ng-click="download()">Download</button>
- <button class="btn btn-warning" type="button" ng-click="cancel()">Cancel</button>
- </div>
-</script>
-
-<script type="text/ng-template" id="config-file-header.html">##
-## Licensed to the Apache Software Foundation (ASF) under one
-## or more contributor license agreements. See the NOTICE file
-## distributed with this work for additional information
-## regarding copyright ownership. The ASF licenses this file
-## to you 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
-##
-</script>
-
-<script type="text/ng-template" id="download-dialog-template.html">
- <div class="modal-header">
- <h3 class="modal-title">Configure new router</h3>
- </div>
- <div class="modal-body">
-
- <label title="Show descriptions and default values in confile files"><input type="checkbox" ng-model="verbose"> Verbose output</label>
- <div>
- <button ng-click="download()">Download</button>
- <button class="btn" zero-clipboard data-clipboard-text="{{output}}" title="Copy to clipboard">
- <i class="icon-copy"></i>
- </button> configuration file for {{newRouterName}}
- </div>
- <div ng-repeat="part in parts">
- <button ng-click="downloadPart(part)">Download</button>
- <button class="btn" zero-clipboard data-clipboard-text="{{part.output}}" title="Copy to clipboard">
- <i class="icon-copy"></i>
- </button> connector section for {{part.name}}
- </div>
-
- </div>
- <div class="modal-footer">
- <button class="btn btn-primary" type="button" ng-click="done()">Done</button>
- </div>
-</script>
-
http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/c77203e6/console/stand-alone/plugin/js/qdrNewNode.js
----------------------------------------------------------------------
diff --git a/console/stand-alone/plugin/js/qdrNewNode.js b/console/stand-alone/plugin/js/qdrNewNode.js
deleted file mode 100644
index 48af70f..0000000
--- a/console/stand-alone/plugin/js/qdrNewNode.js
+++ /dev/null
@@ -1,445 +0,0 @@
-/*
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements. See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership. The ASF licenses this file
-to you 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.
-*/
-/**
- * @module QDR
- */
-var QDR = (function(QDR) {
-
- QDR.module.controller("QDR.NodeDialogController", function($scope, QDRService, $uibModalInstance, newname) {
- var schema = QDRService.schema;
- var myEntities = ['router', 'log', 'listener'];
- var typeMap = {
- integer: 'number',
- string: 'text',
- path: 'text',
- boolean: 'boolean'
- };
- var newLinks = $('path.temp').toArray(); // jquery array of new links for the added router
- var nodeInfo = QDRService.topology.nodeInfo();
- var separatedEntities = []; // additional entities required if a link is reversed
- var myPort = 0,
- myAddr = '0.0.0.0'; // port and address for new router
- $scope.entities = [];
-
- // find max port number that is used in all the listeners
- var getMaxPort = function(nodeInfo) {
- var maxPort = 5674;
- for (var key in nodeInfo) {
- var node = nodeInfo[key];
- var listeners = node['.listener'];
- var attrs = listeners.attributeNames;
- for (var i = 0; i < listeners.results.length; ++i) {
- var res = listeners.results[i];
- var port = QDRService.valFor(attrs, res, 'port');
- if (parseInt(port, 10) > maxPort)
- maxPort = parseInt(port, 10);
- }
- }
- return maxPort;
- }
- var maxPort = getMaxPort(nodeInfo);
-
- // construct an object that contains all the info needed for a single tab's fields
- var entity = function(actualName, tabName, humanName, ent, icon, link) {
- var nameIndex = -1; // the index into attributes that the name field was placed
- var index = 0;
- var info = {
- actualName: actualName,
- tabName: tabName,
- humanName: humanName,
- description: ent.description,
- icon: angular.isDefined(icon) ? icon : '',
- references: ent.references,
- link: link,
-
- attributes: $.map(ent.attributes, function(value, key) {
- // skip identity and depricated fields
- if (key == 'identity' || value.description.startsWith('Deprecated'))
- return null;
- var val = value['default'];
- if (key == 'name')
- nameIndex = index;
- index++;
- return {
- name: key,
- humanName: QDRService.humanify(key),
- description: value.description,
- type: typeMap[value.type],
- rawtype: value.type,
- input: typeof value.type == 'string' ? value.type == 'boolean' ? 'boolean' : 'input' : 'select',
- selected: val ? val : undefined,
- 'default': value['default'],
- value: val,
- required: value.required,
- unique: value.unique
- };
- })
- }
- // move the 'name' attribute to the 1st position
- if (nameIndex > -1) {
- var tmp = info.attributes[0];
- info.attributes[0] = info.attributes[nameIndex];
- info.attributes[nameIndex] = tmp;
- }
- return info;
- }
-
- // remove the annotation fields
- var stripAnnotations = function(entityName, ent, annotations) {
- if (ent.references) {
- var newEnt = {
- attributes: {}
- };
- ent.references.forEach(function(annoKey) {
- if (!annotations[annoKey])
- annotations[annoKey] = {};
- annotations[annoKey][entityName] = true; // create the key/consolidate duplicates
- var keys = Object.keys(schema.annotations[annoKey].attributes);
- for (var attrib in ent.attributes) {
- if (keys.indexOf(attrib) == -1) {
- newEnt.attributes[attrib] = ent.attributes[attrib];
- }
- }
- // add a field for the reference name
- newEnt.attributes[annoKey] = {
- type: 'string',
- description: 'Name of the ' + annoKey + ' section.',
- 'default': annoKey,
- required: true
- };
- })
- newEnt.references = ent.references;
- newEnt.description = ent.description;
- return newEnt;
- }
- return ent;
- }
-
- var annotations = {};
- myEntities.forEach(function(entityName) {
- var ent = schema.entityTypes[entityName];
- var hName = QDRService.humanify(entityName);
- if (entityName == 'listener')
- hName = "Listener for clients";
- var noAnnotations = stripAnnotations(entityName, ent, annotations);
- var ediv = entity(entityName, entityName, hName, noAnnotations, undefined);
- if (ediv.actualName == 'router') {
- ediv.attributes.filter(function(attr) {
- return attr.name == 'name'
- })[0].value = newname;
- // if we have any new links (connectors), then the router's mode should be interior
- if (newLinks.length) {
- var roleAttr = ediv.attributes.filter(function(attr) {
- return attr.name == 'mode'
- })[0];
- roleAttr.value = roleAttr.selected = "interior";
- }
- }
- if (ediv.actualName == 'container') {
- ediv.attributes.filter(function(attr) {
- return attr.name == 'containerName'
- })[0].value = newname + "-container";
- }
- if (ediv.actualName == 'listener') {
- // find max port number that is used in all the listeners
- ediv.attributes.filter(function(attr) {
- return attr.name == 'port'
- })[0].value = ++maxPort;
- }
- // special case for required log.module since it doesn't have a default
- if (ediv.actualName == 'log') {
- var moduleAttr = ediv.attributes.filter(function(attr) {
- return attr.name == 'module'
- })[0];
- moduleAttr.value = moduleAttr.selected = "DEFAULT";
- }
- $scope.entities.push(ediv);
- })
-
- // add a tab for each annotation that was found
- var annotationEnts = [];
- for (var key in annotations) {
- ent = angular.copy(schema.annotations[key]);
- ent.attributes.name = {
- type: "string",
- unique: true,
- description: "Unique name that is used to refer to this set of attributes."
- }
- var ediv = entity(key, key + 'tab', QDRService.humanify(key), ent, undefined);
- ediv.attributes.filter(function(attr) {
- return attr.name == 'name'
- })[0].value = key;
- $scope.entities.push(ediv);
- annotationEnts.push(ediv);
- }
-
- // add an additional listener tab if any links are reversed
- ent = schema.entityTypes['listener'];
- newLinks.some(function(link) {
- if (link.__data__.right) {
- var noAnnotations = stripAnnotations('listener', ent, annotations);
- var ediv = entity("listener", "listener0", "Listener (internal)", noAnnotations, undefined);
- ediv.attributes.filter(function(attr) {
- return attr.name == 'port'
- })[0].value = ++maxPort;
- // connectors from other routers need to connect to this addr:port
- myPort = maxPort;
- myAddr = ediv.attributes.filter(function(attr) {
- return attr.name == 'host'
- })[0].value
-
- // override the role. 'normal' is the default, but we want inter-router
- ediv.attributes.filter(function(attr) {
- return attr.name == 'role'
- })[0].selected = 'inter-router';
- separatedEntities.push(ediv);
- return true; // stop looping
- }
- return false; // continue looping
- })
-
- // Add connector tabs for each new link on the topology graph
- ent = schema.entityTypes['connector'];
- newLinks.forEach(function(link, i) {
- var noAnnotations = stripAnnotations('connector', ent, annotations);
- var ediv = entity('connector', 'connector' + i, " " + link.__data__.source.name, noAnnotations, link.__data__.right, link)
-
- // override the connector role. 'normal' is the default, but we want inter-router
- ediv.attributes.filter(function(attr) {
- return attr.name == 'role'
- })[0].selected = 'inter-router';
-
- // find the addr:port of the inter-router listener to use
- var listener = nodeInfo[link.__data__.source.key]['.listener'];
- var attrs = listener.attributeNames;
- for (var i = 0; i < listener.results.length; ++i) {
- var res = listener.results[i];
- var role = QDRService.valFor(attrs, res, 'role');
- if (role == 'inter-router') {
- ediv.attributes.filter(function(attr) {
- return attr.name == 'host'
- })[0].value =
- QDRService.valFor(attrs, res, 'host')
- ediv.attributes.filter(function(attr) {
- return attr.name == 'port'
- })[0].value =
- QDRService.valFor(attrs, res, 'port')
- break;
- }
- }
- if (link.__data__.right) {
- // connectors from other nodes need to connect to the new router's listener addr:port
- ediv.attributes.filter(function(attr) {
- return attr.name == 'port'
- })[0].value = myPort;
- ediv.attributes.filter(function(attr) {
- return attr.name == 'host'
- })[0].value = myAddr;
-
- separatedEntities.push(ediv)
- } else
- $scope.entities.push(ediv);
- })
- Array.prototype.push.apply($scope.entities, separatedEntities);
-
- // update the description on all the annotation tabs
- annotationEnts.forEach(function(ent) {
- var shared = Object.keys(annotations[ent.actualName]);
- ent.description += " These fields are shared by " + shared.join(" and ") + ".";
-
- })
-
- $scope.testPattern = function(attr) {
- if (attr.rawtype == 'path')
- return /^(\/)?([^/\0]+(\/)?)+$/;
- //return /^(.*\/)([^/]*)$/;
- return /(.*?)/;
- }
-
- $scope.attributeDescription = '';
- $scope.attributeType = '';
- $scope.attributeRequired = '';
- $scope.attributeUnique = '';
- $scope.active = 'router'
- $scope.fieldsetDivs = "/fieldsetDivs.html"
- $scope.setActive = function(tabName) {
- $scope.active = tabName
- }
- $scope.isActive = function(tabName) {
- return $scope.active === tabName
- }
- $scope.showDescription = function(attr, e) {
- $scope.attributeDescription = attr.description;
- var offset = jQuery(e.currentTarget).offset()
- jQuery('.attr-description').offset({
- top: offset.top
- })
-
- $scope.attributeType = "Type: " + JSON.stringify(attr.rawtype);
- $scope.attributeRequired = attr.required ? 'required' : '';
- $scope.attributeUnique = attr.unique ? 'Must be unique' : '';
- }
- // handle the download button click
- // copy the dialog's values to the original node
- $scope.download = function() {
- $uibModalInstance.close({
- entities: $scope.entities,
- annotations: annotations
- });
- }
- $scope.cancel = function() {
- $uibModalInstance.close()
- };
-
- $scope.selectAnnotationTab = function(tabName) {
- var tabs = $("#tabs").tabs();
- tabs.tabs("select", tabName);
- }
-
- var initTabs = function() {
- var div = angular.element("#tabs");
- if (!div.width()) {
- setTimeout(initTabs, 100);
- return;
- }
- $("#tabs")
- .tabs()
- .addClass('ui-tabs-vertical ui-helper-clearfix');
- }
- // start the update loop
- initTabs();
-
- });
-
- QDR.module.controller("QDR.DownloadDialogController", function($scope, QDRService, $templateCache, $window, $uibModalInstance, results) {
- var result = results.entities;
- var annotations = results.annotations;
- var annotationKeys = Object.keys(annotations);
- var annotationSections = {};
-
- // use the router's name as the file name if present
- $scope.newRouterName = 'router';
- result.forEach(function(e) {
- if (e.actualName == 'router') {
- e.attributes.forEach(function(a) {
- if (a.name == 'name') {
- $scope.newRouterName = a.value;
- }
- })
- }
- })
- $scope.newRouterName = $scope.newRouterName + ".conf";
-
- var template = $templateCache.get('config-file-header.html');
- $scope.verbose = true;
- $scope.$watch('verbose', function(newVal) {
- if (newVal !== undefined) {
- // recreate output using current verbose setting
- getOutput();
- }
- })
-
- var getOutput = function() {
- $scope.output = template + '\n';
- $scope.parts = [];
- var commentChar = '#'
- result.forEach(function(entity) {
- // don't output a section for annotations, they get flattened into the entities
- var section = "";
- if (entity.icon) {
- section += "##\n## Add to " + entity.link.__data__.source.name + "'s configuration file\n##\n";
- }
- section += "##\n## " + QDRService.humanify(entity.actualName) + " - " + entity.description + "\n##\n";
- section += entity.actualName + " {\n";
- entity.attributes.forEach(function(attribute) {
- if (attribute.input == 'select')
- attribute.value = attribute.selected;
-
- // treat values with all spaces and empty strings as undefined
- attribute.value = String(attribute.value).trim();
- if (attribute.value === 'undefined' || attribute.value === '')
- attribute.value = undefined;
-
- if ($scope.verbose) {
- commentChar = attribute.required || attribute.value != attribute['default'] ? ' ' : '#';
- if (!attribute.value) {
- commentChar = '#';
- attribute.value = '';
- }
- section += commentChar + " " + attribute.name + ":" + Array(Math.max(20 - attribute.name.length, 1)).join(" ") + attribute.value + Array(Math.max(20 - ((attribute.value) + "").length, 1)).join(" ") + '# ' + attribute.description + "\n";
- } else {
- if (attribute.value) {
- if (attribute.value != attribute['default'] || attribute.required)
- section += " " + attribute.name + ":" + Array(20 - attribute.name.length).join(" ") + attribute.value + "\n";
-
- }
- }
- })
- section += "}\n\n";
- // if entity.icon is true, this is a connector intended for another router
- if (entity.icon)
- $scope.parts.push({
- output: section,
- link: entity.link,
- name: entity.link.__data__.source.name,
- references: entity.references
- });
- else
- $scope.output += section;
-
- // if this section is actually an annotation
- if (annotationKeys.indexOf(entity.actualName) > -1) {
- annotationSections[entity.actualName] = section;
- }
- })
- // go back and add annotation sections to the parts
- $scope.parts.forEach(function(part) {
- for (var section in annotationSections) {
- if (part.references.indexOf(section) > -1) {
- part.output += annotationSections[section];
- }
- }
- })
- QDR.log.debug($scope.output);
- }
-
- // handle the download button click
- $scope.download = function() {
- var output = $scope.output + "\n\n"
- var blob = new Blob([output], {
- type: 'text/plain;charset=utf-16'
- });
- saveAs(blob, $scope.newRouterName);
- }
-
- $scope.downloadPart = function(part) {
- var linkName = part.link.__data__.source.name + 'additional.conf';
- var blob = new Blob([part.output], {
- type: 'text/plain;charset=utf-16'
- });
- saveAs(blob, linkName);
- }
-
- $scope.done = function() {
- $uibModalInstance.close();
- }
- });
-
- return QDR;
-}(QDR || {}));
http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/c77203e6/console/stand-alone/plugin/js/qdrTopology.js
----------------------------------------------------------------------
diff --git a/console/stand-alone/plugin/js/qdrTopology.js b/console/stand-alone/plugin/js/qdrTopology.js
index a5bc80a..71516b5 100644
--- a/console/stand-alone/plugin/js/qdrTopology.js
+++ b/console/stand-alone/plugin/js/qdrTopology.js
@@ -57,9 +57,6 @@ var QDR = (function(QDR) {
$scope.attributes = attributes;
$scope.form = args.entity;
})
- $scope.$on('showAddForm', function(event) {
- $scope.form = 'add';
- })
})
/**
* @method TopologyController
@@ -308,20 +305,6 @@ var QDR = (function(QDR) {
urlPrefix = urlPrefix.split("#")[0]
QDR.log.debug("started QDR.TopologyController with urlPrefix: " + urlPrefix);
- $scope.addingNode = {
- step: 0,
- hasLink: false,
- trigger: ''
- };
-
- $scope.cancel = function() {
- $scope.addingNode.step = 0;
- }
- $scope.editNewRouter = function() {
- $scope.addingNode.trigger = 'editNode';
- }
-
- var NewRouterName = "__NEW__";
// mouse event vars
var selected_node = null,
selected_link = null,
@@ -333,149 +316,11 @@ var QDR = (function(QDR) {
$scope.schema = "Not connected";
- $scope.modes = [{
- title: 'Topology view',
- name: 'Diagram',
- right: false
- },
- /* {title: 'Add a new router node', name: 'Add Router', right: true} */
- ];
- $scope.mode = "Diagram";
$scope.contextNode = null; // node that is associated with the current context menu
- $scope.isModeActive = function(name) {
- if ((name == 'Add Router' || name == 'Diagram') && $scope.addingNode.step > 0)
- return true;
- return ($scope.mode == name);
- }
- $scope.selectMode = function(name) {
- if (name == "Add Router") {
- name = 'Diagram';
- if ($scope.addingNode.step > 0) {
- $scope.addingNode.step = 0;
- } else {
- // start adding node mode
- $scope.addingNode.step = 1;
- }
- } else {
- $scope.addingNode.step = 0;
- }
-
- $scope.mode = name;
- }
- $scope.$watch(function() { return $scope.addingNode.step }, function(newValue, oldValue) {
- if (newValue == 0 && oldValue != 0) {
- // we are cancelling the add
-
- // find the New node
- nodes.every(function(n, i) {
- // for the placeholder node, the key will be __internal__
- if (QDRService.nameFromId(n.key) == '__internal__') {
- var newLinks = links.filter(function(e, i) {
- return e.source.id == n.id || e.target.id == n.id;
- })
- // newLinks is an array of links to remove
- newLinks.map(function(e) {
- links.splice(links.indexOf(e), 1);
- })
- // i is the index of the node to remove
- nodes.splice(i, 1);
- force.nodes(nodes).links(links).start();
- restart(false);
- return false; // stop looping
- }
- return true;
- })
- updateForm(Object.keys(QDRService.topology.nodeInfo())[0], 'router', 0);
-
- } else if (newValue > 0) {
- // we are starting the add mode
- $scope.$broadcast('showAddForm')
-
- resetMouseVars();
- selected_node = null;
- selected_link = null;
- // add a new node
- var id = "amqp:/_topo/0/__internal__/$management";
- var x = radiusNormal * 4;
- var y = x;;
- if (newValue > 1) { // add at current mouse position
- var rm = relativeMouse()
- x = rm.left - rm.offset.left;
- y = rm.top - rm.offset.top;
- }
- QDRService.ensureAllEntities({entity: ".router"}, function () {
- NewRouterName = genNewName();
- nodes.push(aNode(id, NewRouterName, "inter-router", '', nodes.length, x, y, undefined, undefined, true));
- force.nodes(nodes).links(links).start();
- restart(false);
- })
- }
- })
$scope.isRight = function(mode) {
return mode.right;
}
- // for ng-grid that shows details for multiple consoles/clients
- // generate unique name for router and containerName
- var genNewName = function() {
- var nodeInfo = QDRService.topology.nodeInfo();
- var nameIndex = 1;
- var newName = "R." + nameIndex;
-
- var names = [];
- for (key in nodeInfo) {
- var node = nodeInfo[key];
- var router = node['.router'];
- var attrNames = router.attributeNames;
- var name = QDRService.valFor(attrNames, router.results[0], 'routerId')
- if (!name)
- name = QDRService.valFor(attrNames, router.results[0], 'name')
- names.push(name);
- }
-
- while (names.indexOf(newName) >= 0) {
- newName = "R." + nameIndex++;
- }
- return newName;
- }
-
- $scope.$watch(function() {
- return $scope.addingNode.trigger
- }, function(newValue, oldValue) {
- if (newValue == 'editNode') {
- $scope.addingNode.trigger = "";
- editNode();
- }
- })
-
- function editNode() {
- doAddDialog(NewRouterName);
- };
- $scope.reverseLink = function() {
- if (!mousedown_link)
- return;
- var d = mousedown_link;
- var tmp = d.left;
- d.left = d.right;;
- d.right = tmp;
- restart(false);
- tick();
- }
- $scope.removeLink = function() {
- if (!mousedown_link)
- return;
- var d = mousedown_link;
- links.every(function(l, i) {
- if (l.source.id == d.source.id && l.target.id == d.target.id) {
- links.splice(i, 1);
- force.links(links).start();
- return false; // exit the 'every' loop
- }
- return true;
- });
- restart(false);
- tick();
- }
var setNodesFixed = function (name, b) {
nodes.some(function (n) {
if (n.name === name) {
@@ -630,7 +475,7 @@ var QDR = (function(QDR) {
id: nodeIndex,
resultIndex: resultIndex,
fixed: !!+fixed,
- cls: name == NewRouterName ? 'temp' : '',
+ cls: '',
container: connectionContainer
};
};
@@ -714,7 +559,6 @@ var QDR = (function(QDR) {
yInit *= -1
}
nodes.push(aNode(id, name, "inter-router", nodeInfo, nodes.length, position.x, position.y, name, undefined, position.fixed));
- //QDR.log.debug("adding node " + nodes.length-1);
}
}
@@ -863,21 +707,6 @@ var QDR = (function(QDR) {
.attr("id", "SVG_ID")
.attr('width', width)
.attr('height', height)
- .on("contextmenu", function(d) {
- if (d3.event.defaultPrevented)
- return;
- d3.event.preventDefault();
-
- if ($scope.addingNode.step != 0)
- return;
- if (d3.select('#svg_context_menu').style('display') !== 'block')
- $(document).click();
- var rm = relativeMouse()
- d3.select('#svg_context_menu')
- .style('left', rm.left + "px")
- .style('top', (rm.top - rm.offset.top) + "px")
- .style('display', 'block');
- })
.on('click', function(d) {
removeCrosssection()
});
@@ -1307,9 +1136,6 @@ var QDR = (function(QDR) {
.classed('highlighted', function(d) {
return d.highlighted;
})
- .classed('temp', function(d) {
- return d.cls == 'temp';
- })
.attr('marker-start', function(d) {
var sel = d === selected_link ? '-selected' : (d.cls === 'small' ? '-small' : '');
if (d.highlighted)
@@ -1335,19 +1161,10 @@ var QDR = (function(QDR) {
var sel = d === selected_link ? '-selected' : (d.cls === 'small' ? '-small' : '');
return d.right ? 'url(' + urlPrefix + '#end-arrow' + sel + ')' : '';
})
- .classed('temp', function(d) {
- return d.cls == 'temp';
- })
.classed('small', function(d) {
return d.cls == 'small';
})
.on('mouseover', function(d) { // mouse over a path
- if ($scope.addingNode.step > 0) {
- if (d.cls == 'temp') {
- d3.select(this).classed('over', true);
- }
- return;
- }
//QDR.log.debug("showing connections form");
var resultIndex = 0; // the connection to use
var left = d.left ? d.target : d.source;
@@ -1382,29 +1199,10 @@ var QDR = (function(QDR) {
restart();
})
.on('mouseout', function(d) { // mouse out of a path
- if ($scope.addingNode.step > 0) {
- if (d.cls == 'temp') {
- d3.select(this).classed('over', false);
- }
- return;
- }
//QDR.log.debug("showing connections form");
selected_link = null;
restart();
})
- .on("contextmenu", function(d) { // right click a path
- $(document).click();
- d3.event.preventDefault();
- if (d.cls !== "temp")
- return;
-
- mousedown_link = d;
- var rm = relativeMouse()
- d3.select('#link_context_menu')
- .style('left', rm.left + "px")
- .style('top', (rm.top - rm.offset.top) + "px")
- .style('display', 'block');
- })
// left click a path
.on("click", function (d) {
var clickPos = d3.mouse(this);
@@ -1553,9 +1351,6 @@ var QDR = (function(QDR) {
.classed('fixed', function(d) {
return d.fixed & 1
})
- .classed('temp', function(d) {
- return QDRService.nameFromId(d.key) == '__internal__';
- })
.classed('normal', function(d) {
return d.nodeType == 'normal' || QDRService.isConsole(d)
})
@@ -1592,10 +1387,6 @@ var QDR = (function(QDR) {
}
appendCircle(g)
.on('mouseover', function(d) { // mouseover a circle
- if ($scope.addingNode.step > 0) {
- d3.select(this).attr('transform', 'scale(1.1)');
- return;
- }
if (!selected_node && !mousedown_node) {
if (d.nodeType === 'inter-router') {
//QDR.log.debug("showing general form");
@@ -1664,24 +1455,6 @@ var QDR = (function(QDR) {
return;
}
- // we didn't drag, we just clicked on the node
- if ($scope.addingNode.step > 0) {
- if (d.nodeType !== 'inter-router')
- return;
- if (QDRService.nameFromId(d.key) == '__internal__')
- return;
-
- // add a link from the clicked node to the new node
- getLink(d.id, nodes.length - 1, "in", "temp", "__internal__");
- $scope.addingNode.hasLink = true;
- if (!$scope.$$phase) $scope.$apply()
- // add new elements to the svg
- force.links(links).start();
- restart();
- return;
-
- }
-
// if this node was selected, unselect it
if (mousedown_node === selected_node) {
selected_node = null;
@@ -2095,8 +1868,6 @@ var QDR = (function(QDR) {
function hasChanged() {
// Don't update the underlying topology diagram if we are adding a new node.
// Once adding is completed, the topology will update automatically if it has changed
- if ($scope.addingNode.step > 0)
- return -2;
var nodeInfo = QDRService.topology.nodeInfo();
if (Object.keys(nodeInfo).length != Object.keys(savedKeys).length)
return Object.keys(nodeInfo).length > Object.keys(savedKeys).length ? 1 : -1;
@@ -2128,7 +1899,6 @@ var QDR = (function(QDR) {
$rootScope.$on('$locationChangeStart', function(event, newUrl, oldUrl) {
//QDR.log.debug("locationChangeStart");
savePositions()
- $scope.addingNode.step = 0;
});
// When the DOM element is removed from the page,
// AngularJS will trigger the $destroy event on
@@ -2199,48 +1969,6 @@ var QDR = (function(QDR) {
setupInitialUpdate();
QDRService.startUpdating();
- function doAddDialog(NewRouterName) {
- QDRService.ensureAllEntities({entity: ".listener"}, function () {
- var d = $uibModal.open({
- dialogClass: "modal dlg-large",
- backdrop: true,
- keyboard: true,
- backdropClick: true,
- controller: 'QDR.NodeDialogController',
- templateUrl: 'node-config-template.html',
- resolve: {
- newname: function() {
- return NewRouterName;
- }
- }
- });
- $timeout(function () {
- d.result.then(function(result) {
- if (result)
- doDownloadDialog(result);
- });
- })
- })
- };
-
- function doDownloadDialog(result) {
- d = $uibModal.open({
- backdrop: true,
- keyboard: true,
- backdropClick: true,
- controller: 'QDR.DownloadDialogController',
- templateUrl: 'download-dialog-template.html',
- resolve: {
- results: function() {
- return result;
- }
- }
- });
- d.result.then(function(result) {
- //QDR.log.debug("download dialog done")
- })
- if (!$scope.$$phase) $scope.$apply()
- };
}
]);
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org