From commits-return-48642-archive-asf-public=cust-asf.ponee.io@qpid.apache.org Mon Aug 5 17:12:33 2019 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [207.244.88.153]) by mx-eu-01.ponee.io (Postfix) with SMTP id BF0CB180675 for ; Mon, 5 Aug 2019 19:12:32 +0200 (CEST) Received: (qmail 26528 invoked by uid 500); 5 Aug 2019 17:12:32 -0000 Mailing-List: contact commits-help@qpid.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@qpid.apache.org Delivered-To: mailing list commits@qpid.apache.org Received: (qmail 26429 invoked by uid 99); 5 Aug 2019 17:12:32 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 05 Aug 2019 17:12:32 +0000 Received: by gitbox.apache.org (ASF Mail Server at gitbox.apache.org, from userid 33) id DE79E85EE9; Mon, 5 Aug 2019 17:12:31 +0000 (UTC) Date: Mon, 05 Aug 2019 17:12:33 +0000 To: "commits@qpid.apache.org" Subject: [qpid-dispatch] 02/02: DISPATCH-1376 Read product name from config file MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit From: eallen@apache.org In-Reply-To: <156502515159.17540.11268130465167249604@gitbox.apache.org> References: <156502515159.17540.11268130465167249604@gitbox.apache.org> X-Git-Host: gitbox.apache.org X-Git-Repo: qpid-dispatch X-Git-Refname: refs/heads/master X-Git-Reftype: branch X-Git-Rev: b6828b55256428ab5077727591fded82f6002504 X-Git-NotificationType: diff X-Git-Multimail-Version: 1.5.dev Auto-Submitted: auto-generated Message-Id: <20190805171231.DE79E85EE9@gitbox.apache.org> This is an automated email from the ASF dual-hosted git repository. eallen pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/qpid-dispatch.git commit b6828b55256428ab5077727591fded82f6002504 Author: Ernest Allen AuthorDate: Mon Aug 5 13:11:35 2019 -0400 DISPATCH-1376 Read product name from config file --- console/CMakeLists.txt | 1 + console/stand-alone/index.html | 4 +- console/stand-alone/main.js | 14 ++++- console/stand-alone/plugin/css/dispatch.css | 3 + console/stand-alone/plugin/js/qdrAbout.js | 89 +++++++++++++++++------------ console/stand-alone/plugin/js/qdrGlobals.js | 63 +++++++++++++++----- 6 files changed, 119 insertions(+), 55 deletions(-) diff --git a/console/CMakeLists.txt b/console/CMakeLists.txt index 7bdb481..efc4992 100644 --- a/console/CMakeLists.txt +++ b/console/CMakeLists.txt @@ -79,6 +79,7 @@ if(CONSOLE_INSTALL) ${CONSOLE_SOURCE_DIR}/index.html ${CONSOLE_SOURCE_DIR}/main.js ${CONSOLE_SOURCE_DIR}/favicon-32x32.png + ${CONSOLE_SOURCE_DIR}/console-config.json ) ## Files copied to the img/ dir set(IMAGES diff --git a/console/stand-alone/index.html b/console/stand-alone/index.html index c4fb2ab..6c7b50d 100644 --- a/console/stand-alone/index.html +++ b/console/stand-alone/index.html @@ -23,7 +23,7 @@ under the License. - Apache Qpid Dispatch Console + @@ -55,7 +55,7 @@ under the License. - +
diff --git a/console/stand-alone/main.js b/console/stand-alone/main.js index ce9759d..474349b 100644 --- a/console/stand-alone/main.js +++ b/console/stand-alone/main.js @@ -30,7 +30,9 @@ under the License. import { QDRLogger, QDRTemplatePath, - QDR_LAST_LOCATION + QDR_LAST_LOCATION, + QDR_CONSOLE_TITLE, + getConfigVars } from "./plugin/js/qdrGlobals.js"; import { QDRService } from "./plugin/js/qdrService.js"; import { QDRChartService } from "./plugin/js/qdrChartService.js"; @@ -276,8 +278,8 @@ import { posint } from "./plugin/js/posintDirective.js"; $scope.topLevelTabs = []; $scope.topLevelTabs.push({ id: "qdr", - content: "Qpid Dispatch Router Console", - title: "Dispatch Router Console", + content: document.title, + title: document.title, isValid: function() { return true; }, @@ -297,6 +299,12 @@ import { posint } from "./plugin/js/posintDirective.js"; $timeout, QDRService ) { + $scope.console_logo = ""; + getConfigVars().then(response => { + $timeout(function() { + $scope.console_logo = `${response.company} ${response.product} Console`; + }); + }); $scope.alerts = []; $scope.breadcrumb = {}; $scope.closeAlert = function(index) { diff --git a/console/stand-alone/plugin/css/dispatch.css b/console/stand-alone/plugin/css/dispatch.css index 0c79e1b..8e66859 100644 --- a/console/stand-alone/plugin/css/dispatch.css +++ b/console/stand-alone/plugin/css/dispatch.css @@ -1663,6 +1663,9 @@ svg { span.logo { letter-spacing: 2px; font-weight: bold; + color: white; + margin: 8px; + display: inline-block; } /* using fancytree instead of treeview */ diff --git a/console/stand-alone/plugin/js/qdrAbout.js b/console/stand-alone/plugin/js/qdrAbout.js index 9d72138..c81b2ab 100644 --- a/console/stand-alone/plugin/js/qdrAbout.js +++ b/console/stand-alone/plugin/js/qdrAbout.js @@ -17,54 +17,73 @@ specific language governing permissions and limitations under the License. */ +import { QDR_CONSOLE_TITLE, QDR_CONSOLE_COPYRIGHT } from "./qdrGlobals.js"; + export class AboutController { constructor($scope, QDRService, $timeout) { - this.controllerName = 'QDR.AboutController'; + this.controllerName = "QDR.AboutController"; - $scope.additionalInfo = "Console for the Apache Qpid dispatch router: A high-performance, lightweight AMQP 1.0 message router, written in C and built on Qpid Proton. It provides flexible and scalable interconnect between any AMQP endpoints, whether they be clients, brokers or other AMQP-enabled services."; - $scope.copyright = "Apache License, Version 2.0"; - $scope.imgAlt = "Qpid Dispatch Router Logo"; + $scope.additionalInfo = `Console for the ${QDR_CONSOLE_TITLE}: A high-performance, lightweight AMQP 1.0 message router, written in C and built on Qpid Proton. It provides flexible and scalable interconnect between any AMQP endpoints, whether they be clients, brokers or other AMQP-enabled services.`; + $scope.copyright = QDR_CONSOLE_COPYRIGHT; + $scope.imgAlt = QDR_CONSOLE_TITLE; $scope.imgSrc = "img/logo-alt.svg"; - $scope.title = "Apache Qpid Dispatch Router Console"; + $scope.title = QDR_CONSOLE_TITLE; $scope.productInfo = [ - { name: 'Version', value: '' }, - { name: 'Server Name', value: window.location.host }, - { name: 'User Name', value: '' }, - { name: 'User Role', value: 'Administrator' }]; - $scope.open = function () { + { name: "Version", value: "" }, + { name: "Server Name", value: window.location.host }, + { name: "User Name", value: "" }, + { name: "User Role", value: "Administrator" } + ]; + $scope.open = function() { if (QDRService.management.connection.is_connected()) { - let parts = QDRService.management.connection.getReceiverAddress().split("/"); + let parts = QDRService.management.connection + .getReceiverAddress() + .split("/"); parts[parts.length - 1] = "$management"; - let router = parts.join('/'); - QDRService.management.topology.fetchEntity(router, "router", ["version"], function (nodeId, entity, response) { - $timeout(function () { - let r = QDRService.utilities.flatten(response.attributeNames, response.results[0]); - $scope.productInfo[0].value = r.version; - }); - }); - QDRService.management.topology.fetchEntity(router, "connection", [], function (nodeId, entity, response) { - $timeout(function () { - let user = ''; - response.results.some(result => { - let c = QDRService.utilities.flatten(response.attributeNames, result); - if (QDRService.utilities.isConsole(c)) { - user = c.user; - return true; - } - return false; + let router = parts.join("/"); + QDRService.management.topology.fetchEntity( + router, + "router", + ["version"], + function(nodeId, entity, response) { + $timeout(function() { + let r = QDRService.utilities.flatten( + response.attributeNames, + response.results[0] + ); + $scope.productInfo[0].value = r.version; }); - $scope.productInfo[2].value = user; - }); - }); - + } + ); + QDRService.management.topology.fetchEntity( + router, + "connection", + [], + function(nodeId, entity, response) { + $timeout(function() { + let user = ""; + response.results.some(result => { + let c = QDRService.utilities.flatten( + response.attributeNames, + result + ); + if (QDRService.utilities.isConsole(c)) { + user = c.user; + return true; + } + return false; + }); + $scope.productInfo[2].value = user; + }); + } + ); } $scope.isOpen = true; }; - $scope.onClose = function () { + $scope.onClose = function() { $scope.isOpen = false; }; - } } -AboutController.$inject = ['$scope', 'QDRService', '$timeout']; +AboutController.$inject = ["$scope", "QDRService", "$timeout"]; diff --git a/console/stand-alone/plugin/js/qdrGlobals.js b/console/stand-alone/plugin/js/qdrGlobals.js index 42f5ee3..e599b6d 100644 --- a/console/stand-alone/plugin/js/qdrGlobals.js +++ b/console/stand-alone/plugin/js/qdrGlobals.js @@ -17,7 +17,8 @@ specific language governing permissions and limitations under the License. */ -export var QDRFolder = (function () { +/* globals Promise */ +export var QDRFolder = (function() { function Folder(title) { this.title = title; this.children = []; @@ -25,7 +26,7 @@ export var QDRFolder = (function () { } return Folder; })(); -export var QDRLeaf = (function () { +export var QDRLeaf = (function() { function Leaf(title) { this.title = title; } @@ -33,27 +34,59 @@ export var QDRLeaf = (function () { })(); export var QDRCore = { - notification: function (severity, msg) { + notification: function(severity, msg) { $.notify(msg, severity); } }; export class QDRLogger { constructor($log, source) { - this.log = function (msg) { $log.log(`QDR-${source}: ${msg}`); }; - this.debug = function (msg) { $log.debug(`QDR-${source}: ${msg}`); }; - this.error = function (msg) { $log.error(`QDR-${source}: ${msg}`); }; - this.info = function (msg) { $log.info(`QDR-${source}: ${msg}`); }; - this.warn = function (msg) { $log.warn(`QDR-${source}: ${msg}`); }; + this.log = function(msg) { + $log.log(`QDR-${source}: ${msg}`); + }; + this.debug = function(msg) { + $log.debug(`QDR-${source}: ${msg}`); + }; + this.error = function(msg) { + $log.error(`QDR-${source}: ${msg}`); + }; + this.info = function(msg) { + $log.info(`QDR-${source}: ${msg}`); + }; + this.warn = function(msg) { + $log.warn(`QDR-${source}: ${msg}`); + }; } } -export const QDRTemplatePath = 'html/'; -export const QDR_SETTINGS_KEY = 'QDRSettings'; -export const QDR_LAST_LOCATION = 'QDRLastLocation'; -export const QDR_INTERVAL = 'QDRInterval'; +export const QDRTemplatePath = "html/"; +export const QDR_SETTINGS_KEY = "QDRSettings"; +export const QDR_LAST_LOCATION = "QDRLastLocation"; +export const QDR_INTERVAL = "QDRInterval"; -export var QDRRedirectWhenConnected = function ($location, org) { - $location.path('/connect'); - $location.search('org', org); +export var QDRRedirectWhenConnected = function($location, org) { + $location.path("/connect"); + $location.search("org", org); }; + +export var QDR_CONSOLE_TITLE = "Console"; +export var QDR_ROUTER_NAME = "Router"; +export var QDR_CONSOLE_COPYRIGHT = "Copyright 2019"; + +export var getConfigVars = () => + new Promise((resolve, reject) => { + $.getJSON("console-config.json", function() {}).done(function(s) { + console.log( + `got x-stream text ${s.title} - ${s.router} - ${s.copyright}` + ); + document.title = s.title; + QDR_CONSOLE_TITLE = `${s.company} ${s.product} Console`; + QDR_ROUTER_NAME = `${s.company} ${s.product} Router`; + QDR_CONSOLE_COPYRIGHT = `Copyright 2019 ${s.company}`; + resolve(s); + }); + }); + +$(document).ready(function(e) { + getConfigVars(); +}); --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org For additional commands, e-mail: commits-help@qpid.apache.org