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 2018/02/01 13:44:16 UTC
[2/3] qpid-dispatch git commit: DISPATCH-923 ESLint clean up
DISPATCH-923 ESLint clean up
Project: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/commit/684a8b46
Tree: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/tree/684a8b46
Diff: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/diff/684a8b46
Branch: refs/heads/master
Commit: 684a8b46f29f0e391f99b9dc00143fd20a30eef4
Parents: 2d63fc8
Author: Ernest Allen <ea...@redhat.com>
Authored: Thu Feb 1 08:42:32 2018 -0500
Committer: Ernest Allen <ea...@redhat.com>
Committed: Thu Feb 1 08:42:32 2018 -0500
----------------------------------------------------------------------
console/stand-alone/README.txt | 28 ---
console/stand-alone/index.html | 1 +
console/stand-alone/plugin/js/dispatchPlugin.js | 213 +++++++++----------
console/stand-alone/plugin/js/navbar.js | 119 ++++++-----
4 files changed, 159 insertions(+), 202 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/684a8b46/console/stand-alone/README.txt
----------------------------------------------------------------------
diff --git a/console/stand-alone/README.txt b/console/stand-alone/README.txt
deleted file mode 100644
index e72f840..0000000
--- a/console/stand-alone/README.txt
+++ /dev/null
@@ -1,28 +0,0 @@
-# dispatch-standalone
-The stand-alone qpid dispatch console is an html web site that monitors and controls a qpid dispatch router
-
-To install the console:
-- After a build, the console files are normally installed under /usr/share/qpid-dispatch/console/stand-alone
-- Install 3rd party libraries:
- - cd /usr/share/qpid-dispatch/console/stand-alone
- - npm install
-
-Note: An internet connection is required during the npm install to retrieve the 3rd party javascript / css files.
-
-To run the web console:
-- Ensure one of the routers in your network is configured with a normal listener with http: true
-listener {
- role: normal
- host: 0.0.0.0
- port: 5673
- http: true
- saslMechanisms: ANONYMOUS
-}
-- start the router
-- in a browser, navigate to http://localhost:5673/
-
-The router will serve the console's html/js/css from the install directory.
-The cosole will automatically connect to the router at localhost:5673
-
-
-
http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/684a8b46/console/stand-alone/index.html
----------------------------------------------------------------------
diff --git a/console/stand-alone/index.html b/console/stand-alone/index.html
index 698a058..f3894fb 100644
--- a/console/stand-alone/index.html
+++ b/console/stand-alone/index.html
@@ -117,6 +117,7 @@ under the License.
<script type="text/javascript" src="node_modules/dispatch-management/dist/dispatch-management.js"></script>
<script type="text/javascript" src="plugin/js/dispatchPlugin.js"></script>
<script type="text/javascript" src="plugin/js/navbar.js"></script>
+<script type="text/javascript" src="node_modules/dispatch-console-pages/dist/js/qdrGlobals.js"></script>
<script type="text/javascript" src="node_modules/dispatch-console-pages/dist/js/qdrOverview.js"></script>
<script type="text/javascript" src="node_modules/dispatch-console-pages/dist/js/qdrOverviewLogsController.js"></script>
<script type="text/javascript" src="node_modules/dispatch-console-pages/dist/js/qdrOverviewChartsController.js"></script>
http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/684a8b46/console/stand-alone/plugin/js/dispatchPlugin.js
----------------------------------------------------------------------
diff --git a/console/stand-alone/plugin/js/dispatchPlugin.js b/console/stand-alone/plugin/js/dispatchPlugin.js
index 12bf784..f5df9c4 100644
--- a/console/stand-alone/plugin/js/dispatchPlugin.js
+++ b/console/stand-alone/plugin/js/dispatchPlugin.js
@@ -16,6 +16,9 @@ KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
*/
+'use strict';
+/* global angular d3 */
+
/**
* @module QDR
* @main QDR
@@ -31,8 +34,8 @@ var QDR = (function(QDR) {
*
* The name of this plugin
*/
- QDR.pluginName = "QDR";
- QDR.pluginRoot = "";
+ QDR.pluginName = 'QDR';
+ QDR.pluginRoot = '';
QDR.isStandalone = true;
/**
@@ -48,8 +51,8 @@ var QDR = (function(QDR) {
*
* The top level path to this plugin's partials
*/
- QDR.srcBase = "node_modules/dispatch-console-pages/dist/";
- QDR.templatePath = QDR.srcBase + "html/";
+ QDR.srcBase = 'node_modules/dispatch-console-pages/dist/';
+ QDR.templatePath = QDR.srcBase + 'html/';
/**
* @property SETTINGS_KEY
* @type {string}
@@ -57,12 +60,12 @@ var QDR = (function(QDR) {
* The key used to fetch our settings from local storage
*/
QDR.SETTINGS_KEY = 'QDRSettings';
- QDR.LAST_LOCATION = "QDRLastLocation";
+ QDR.LAST_LOCATION = 'QDRLastLocation';
QDR.redirectWhenConnected = function ($location, org) {
- $location.path(QDR.pluginRoot + "/connect")
+ $location.path(QDR.pluginRoot + '/connect');
$location.search('org', org);
- }
+ };
/**
* @property module
@@ -71,54 +74,48 @@ var QDR = (function(QDR) {
* This plugin's angularjs module instance
*/
QDR.module = angular.module(QDR.pluginName, ['ngRoute', 'ngSanitize', 'ngResource', 'ui.bootstrap',
- 'ui.grid', 'ui.grid.selection', 'ui.grid.autoResize', 'ui.grid.resizeColumns', 'ui.grid.saveState', 'ui.slider']);
-
- Core = {
- notification: function (severity, msg) {
- $.notify(msg, severity);
- }
- }
+ 'ui.grid', 'ui.grid.selection', 'ui.grid.autoResize', 'ui.grid.resizeColumns', 'ui.grid.saveState', 'ui.slider']);
// set up the routing for this plugin
QDR.module.config(function($routeProvider) {
$routeProvider
.when('/', {
templateUrl: QDR.templatePath + 'qdrOverview.html'
- })
+ })
.when('/overview', {
- templateUrl: QDR.templatePath + 'qdrOverview.html'
- })
+ templateUrl: QDR.templatePath + 'qdrOverview.html'
+ })
.when('/topology', {
- templateUrl: QDR.templatePath + 'qdrTopology.html'
- })
+ templateUrl: QDR.templatePath + 'qdrTopology.html'
+ })
.when('/list', {
- templateUrl: QDR.templatePath + 'qdrList.html'
- })
+ templateUrl: QDR.templatePath + 'qdrList.html'
+ })
.when('/schema', {
- templateUrl: QDR.templatePath + 'qdrSchema.html'
- })
+ templateUrl: QDR.templatePath + 'qdrSchema.html'
+ })
.when('/charts', {
- templateUrl: QDR.templatePath + 'qdrCharts.html'
- })
+ templateUrl: QDR.templatePath + 'qdrCharts.html'
+ })
.when('/connect', {
- templateUrl: QDR.templatePath + 'qdrConnect.html'
- })
+ templateUrl: QDR.templatePath + 'qdrConnect.html'
+ });
});
QDR.module.config(function ($compileProvider) {
$compileProvider.aHrefSanitizationWhitelist(/^\s*(https?|ftp|mailto|chrome-extension|file|blob):/);
$compileProvider.imgSrcSanitizationWhitelist(/^\s*(https?|ftp|mailto|chrome-extension):/);
-/* var cur = $compileProvider.urlSanitizationWhitelist();
+ /* var cur = $compileProvider.urlSanitizationWhitelist();
$compileProvider.urlSanitizationWhitelist(/^\s*(https?|ftp|mailto|file|blob):/);
cur = $compileProvider.urlSanitizationWhitelist();
*/
- })
+ });
QDR.module.filter('to_trusted', ['$sce', function($sce){
- return function(text) {
- return $sce.trustAsHtml(text);
- };
- }]);
+ return function(text) {
+ return $sce.trustAsHtml(text);
+ };
+ }]);
QDR.module.filter('humanify', function (QDRService) {
return function (input) {
@@ -129,158 +126,142 @@ var QDR = (function(QDR) {
QDR.module.filter('Pascalcase', function () {
return function (str) {
if (!str)
- return "";
+ return '';
return str.replace(/(\w)(\w*)/g,
- function(g0,g1,g2){return g1.toUpperCase() + g2.toLowerCase();});
- }
- })
+ function(g0,g1,g2){return g1.toUpperCase() + g2.toLowerCase();});
+ };
+ });
QDR.module.filter('safePlural', function () {
return function (str) {
- var es = ['x', 'ch', 'ss', 'sh']
+ var es = ['x', 'ch', 'ss', 'sh'];
for (var i=0; i<es.length; ++i) {
if (str.endsWith(es[i]))
- return str + 'es'
+ return str + 'es';
}
if (str.endsWith('y'))
- return str.substr(0, str.length-2) + 'ies'
+ return str.substr(0, str.length-2) + 'ies';
if (str.endsWith('s'))
return str;
- return str + 's'
- }
- })
+ return str + 's';
+ };
+ });
QDR.module.filter('pretty', function () {
return function (str) {
- var formatComma = d3.format(",");
+ var formatComma = d3.format(',');
if (!isNaN(parseFloat(str)) && isFinite(str))
return formatComma(str);
return str;
- }
- })
+ };
+ });
QDR.logger = function ($log) {
var log = $log;
- this.debug = function (msg) { msg = "QDR: " + msg; log.debug(msg)};
- this.error = function (msg) {msg = "QDR: " + msg; log.error(msg)}
- this.info = function (msg) {msg = "QDR: " + msg; log.info(msg)}
- this.warn = function (msg) {msg = "QDR: " + msg; log.warn(msg)}
+ this.debug = function (msg) { msg = 'QDR: ' + msg; log.debug(msg);};
+ this.error = function (msg) {msg = 'QDR: ' + msg; log.error(msg);};
+ this.info = function (msg) {msg = 'QDR: ' + msg; log.info(msg);};
+ this.warn = function (msg) {msg = 'QDR: ' + msg; log.warn(msg);};
return this;
- }
- // one-time initialization happens in the run function
- // of our module
- QDR.module.run( ["$rootScope", '$route', '$timeout', "$location", "$log", "QDRService", "QDRChartService", function ($rootScope, $route, $timeout, $location, $log, QDRService, QDRChartService) {
+ };
+ // one-time initialization happens in the run function
+ // of our module
+ QDR.module.run( ['$rootScope', '$route', '$timeout', '$location', '$log', 'QDRService', 'QDRChartService', function ($rootScope, $route, $timeout, $location, $log, QDRService, QDRChartService) {
QDR.log = new QDR.logger($log);
- QDR.log.info("************* creating Dispatch Console ************");
- var curPath = $location.path()
- var org = curPath.substr(1)
- if (org && org.length > 0 && org !== "connect") {
- $location.search('org', org)
+ QDR.log.info('************* creating Dispatch Console ************');
+ var curPath = $location.path();
+ var org = curPath.substr(1);
+ if (org && org.length > 0 && org !== 'connect') {
+ $location.search('org', org);
} else {
- $location.search('org', null)
+ $location.search('org', null);
}
QDR.queue = d3.queue;
if (!QDRService.management.connection.is_connected()) {
// attempt to connect to the host:port that served this page
- var protocol = $location.protocol()
- var host = $location.host()
- var port = $location.port()
- var search = $location.search()
+ var host = $location.host();
+ var port = $location.port();
+ var search = $location.search();
if (search.org) {
if (search.org === 'connect')
- $location.search("org", "overview")
+ $location.search('org', 'overview');
}
- var connectOptions = {address: host, port: port}
- QDR.log.info("Attempting AMQP over websockets connection using address:port of browser ("+host+':'+port+")")
+ var connectOptions = {address: host, port: port};
+ QDR.log.info('Attempting AMQP over websockets connection using address:port of browser ('+host+':'+port+')');
QDRService.management.connection.testConnect(connectOptions)
- .then( function (r) {
+ .then( function () {
// We didn't connect with reconnect: true flag.
// The reason being that if we used reconnect:true and the connection failed, rhea would keep trying. There
// doesn't appear to be a way to tell it to stop trying to reconnect.
- QDRService.disconnect()
- QDR.log.info("Connect succeeded. Using address:port of browser")
- connectOptions.reconnect = true
+ QDRService.disconnect();
+ QDR.log.info('Connect succeeded. Using address:port of browser');
+ connectOptions.reconnect = true;
// complete the connection (create the sender/receiver)
QDRService.connect(connectOptions)
- .then( function (r) {
+ .then( function () {
// register a callback for when the node list is available (needed for loading saved charts)
- QDRService.management.topology.addUpdatedAction("initChartService", function() {
- QDRService.management.topology.delUpdatedAction("initChartService")
+ QDRService.management.topology.addUpdatedAction('initChartService', function() {
+ QDRService.management.topology.delUpdatedAction('initChartService');
QDRChartService.init(); // initialize charting service after we are connected
});
// get the list of nodes
QDRService.management.topology.startUpdating(false);
- })
- }, function (e) {
- QDR.log.info("failed to auto-connect to " + host + ":" + port)
- QDR.log.info("redirecting to connect page")
+ });
+ }, function () {
+ QDR.log.info('failed to auto-connect to ' + host + ':' + port);
+ QDR.log.info('redirecting to connect page');
$timeout(function () {
- $location.path('/connect')
- $location.search('org', org)
- $location.replace()
- })
- })
+ $location.path('/connect');
+ $location.search('org', org);
+ $location.replace();
+ });
+ });
}
- $rootScope.$on('$routeChangeSuccess', function(event, next, current) {
+ $rootScope.$on('$routeChangeSuccess', function() {
var path = $location.path();
- if (path !== "/connect") {
+ if (path !== '/connect') {
localStorage[QDR.LAST_LOCATION] = path;
}
});
}]);
- QDR.module.controller ("QDR.MainController", ['$scope', '$location', function ($scope, $location) {
- QDR.log.debug("started QDR.MainController with location.url: " + $location.url());
- QDR.log.debug("started QDR.MainController with window.location.pathname : " + window.location.pathname);
+ QDR.module.controller ('QDR.MainController', ['$scope', '$location', function ($scope, $location) {
+ QDR.log.debug('started QDR.MainController with location.url: ' + $location.url());
+ QDR.log.debug('started QDR.MainController with window.location.pathname : ' + window.location.pathname);
$scope.topLevelTabs = [];
$scope.topLevelTabs.push({
- id: "qdr",
- content: "Qpid Dispatch Router Console",
- title: "Dispatch Router Console",
+ id: 'qdr',
+ content: 'Qpid Dispatch Router Console',
+ title: 'Dispatch Router Console',
isValid: function() { return true; },
- href: function() { return "#connect"; },
+ href: function() { return '#connect'; },
isActive: function() { return true; }
});
- }])
+ }]);
- QDR.module.controller ("QDR.Core", function ($scope, $rootScope) {
+ QDR.module.controller ('QDR.Core', function ($scope) {
$scope.alerts = [];
$scope.breadcrumb = {};
$scope.closeAlert = function(index) {
- $scope.alerts.splice(index, 1);
- };
+ $scope.alerts.splice(index, 1);
+ };
$scope.$on('setCrumb', function(event, data) {
- $scope.breadcrumb = data
- })
+ $scope.breadcrumb = data;
+ });
$scope.$on('newAlert', function(event, data) {
$scope.alerts.push(data);
$scope.$apply();
});
- $scope.$on("clearAlerts", function () {
+ $scope.$on('clearAlerts', function () {
$scope.alerts = [];
$scope.$apply();
- })
+ });
- })
+ });
return QDR;
}(QDR || {}));
-
-var Folder = (function () {
- function Folder(title) {
- this.title = title;
- this.children = [];
- this.folder = true;
- }
- return Folder;
-})();
-var Leaf = (function () {
- function Leaf(title) {
- this.title = title;
- }
- return Leaf;
-})();
http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/684a8b46/console/stand-alone/plugin/js/navbar.js
----------------------------------------------------------------------
diff --git a/console/stand-alone/plugin/js/navbar.js b/console/stand-alone/plugin/js/navbar.js
index 1829352..24dcbc6 100644
--- a/console/stand-alone/plugin/js/navbar.js
+++ b/console/stand-alone/plugin/js/navbar.js
@@ -16,6 +16,9 @@ KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
*/
+'use strict';
+/* global angular */
+
/**
* @module QDR
*/
@@ -23,48 +26,48 @@ var QDR = (function (QDR) {
QDR.breadcrumbs = [
{
- content: '<i class="icon-cogs"></i> Connect',
- title: "Connect to a router",
- isValid: function () { return true; },
- href: "#/connect",
- name: "Connect"
+ content: '<i class="icon-cogs"></i> Connect',
+ title: 'Connect to a router',
+ isValid: function () { return true; },
+ href: '#/connect',
+ name: 'Connect'
},
{
- content: '<i class="pficon-home"></i> Overview',
- title: "View router overview",
- isValid: function (QDRService) {return QDRService.management.connection.is_connected() },
- href: "#/overview",
- name: "Overview"
- },
+ content: '<i class="pficon-home"></i> Overview',
+ title: 'View router overview',
+ isValid: function (QDRService) {return QDRService.management.connection.is_connected(); },
+ href: '#/overview',
+ name: 'Overview'
+ },
{
- content: '<i class="icon-list "></i> Entities',
- title: "View the attributes of the router entities",
- isValid: function (QDRService) { return QDRService.management.connection.is_connected() },
- href: "#/list",
- name: "Entities"
- },
+ content: '<i class="icon-list "></i> Entities',
+ title: 'View the attributes of the router entities',
+ isValid: function (QDRService) { return QDRService.management.connection.is_connected(); },
+ href: '#/list',
+ name: 'Entities'
+ },
{
- content: '<i class="icon-star-empty"></i> Topology',
- title: "View router network topology",
- isValid: function (QDRService) { return QDRService.management.connection.is_connected() },
- href: "#/topology",
- name: "Topology"
- },
+ content: '<i class="icon-star-empty"></i> Topology',
+ title: 'View router network topology',
+ isValid: function (QDRService) { return QDRService.management.connection.is_connected(); },
+ href: '#/topology',
+ name: 'Topology'
+ },
{
- content: '<i class="icon-bar-chart"></i> Charts',
- title: "View charts",
- isValid: function (QDRService, $location) { return QDRService.management.connection.is_connected() },
- href: "#/charts",
- name: "Charts"
+ content: '<i class="icon-bar-chart"></i> Charts',
+ title: 'View charts',
+ isValid: function (QDRService) { return QDRService.management.connection.is_connected(); },
+ href: '#/charts',
+ name: 'Charts'
},
{
- content: '<i class="icon-align-left"></i> Schema',
- title: "View dispatch schema",
- isValid: function (QDRService) { return QDRService.management.connection.is_connected() },
- href: "#/schema",
- right: true,
- name: "Schema"
- }
+ content: '<i class="icon-align-left"></i> Schema',
+ title: 'View dispatch schema',
+ isValid: function (QDRService) { return QDRService.management.connection.is_connected(); },
+ href: '#/schema',
+ right: true,
+ name: 'Schema'
+ }
];
/**
* @function NavBarController
@@ -75,44 +78,44 @@ var QDR = (function (QDR) {
* The controller for this plugin's navigation bar
*
*/
- QDR.module.controller("QDR.NavBarController", ['$rootScope', '$scope', 'QDRService', 'QDRChartService', '$routeParams', '$location', function($rootScope, $scope, QDRService, QDRChartService, $routeParams, $location) {
+ QDR.module.controller('QDR.NavBarController', ['$rootScope', '$scope', 'QDRService', 'QDRChartService', '$routeParams', '$location', function($rootScope, $scope, QDRService, QDRChartService, $routeParams, $location) {
$scope.breadcrumbs = QDR.breadcrumbs;
$scope.isValid = function(link) {
return link.isValid(QDRService, $location);
};
$scope.isActive = function(href) {
- return href.split("#")[1] === $location.path();
+ return href.split('#')[1] === $location.path();
};
$scope.isRight = function (link) {
- return angular.isDefined(link.right);
+ return angular.isDefined(link.right);
};
$scope.hasChart = function (link) {
- if (link.href == "#/charts") {
- return QDRChartService.charts.some(function (c) { return c.dashboard });
- }
- }
+ if (link.href == '#/charts') {
+ return QDRChartService.charts.some(function (c) { return c.dashboard; });
+ }
+ };
- $scope.isDashboardable = function () {
- return ($location.path().indexOf("schema") < 0 && $location.path().indexOf("connect") < 0);
- }
+ $scope.isDashboardable = function () {
+ return ($location.path().indexOf('schema') < 0 && $location.path().indexOf('connect') < 0);
+ };
- $scope.addToDashboardLink = function () {
- var href = "#" + $location.path();
- var size = angular.toJson({
- size_x: 2,
- size_y: 2
- });
+ $scope.addToDashboardLink = function () {
+ var href = '#' + $location.path();
+ var size = angular.toJson({
+ size_x: 2,
+ size_y: 2
+ });
- var routeParams = angular.toJson($routeParams);
- var title = "Dispatch Router";
- return "/hawtio/#/dashboard/add?tab=dashboard" +
- "&href=" + encodeURIComponent(href) +
- "&routeParams=" + encodeURIComponent(routeParams) +
- "&title=" + encodeURIComponent(title) +
- "&size=" + encodeURIComponent(size);
+ var routeParams = angular.toJson($routeParams);
+ var title = 'Dispatch Router';
+ return '/hawtio/#/dashboard/add?tab=dashboard' +
+ '&href=' + encodeURIComponent(href) +
+ '&routeParams=' + encodeURIComponent(routeParams) +
+ '&title=' + encodeURIComponent(title) +
+ '&size=' + encodeURIComponent(size);
};
}]);
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org