From b5ac18e452948cb0498ddfc821deaec180fcb9ba Mon Sep 17 00:00:00 2001 From: Keith Wall Date: Fri, 14 Nov 2014 14:36:21 +0000 Subject: QPID-6227: [Java Broker] Refactor ConsoleHelper.js to avoid the need to hardcode docbook urls by reading url from context git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1639650 13f79535-47bb-0310-9956-ffa450edef68 --- .../java/resources/js/qpid/common/ConsoleHelper.js | 29 +++++++++++----------- 1 file changed, 14 insertions(+), 15 deletions(-) (limited to 'qpid/java/broker-plugins/management-http/src') diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/ConsoleHelper.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/ConsoleHelper.js index 9ff8afeaa9..9cebf48ce6 100644 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/ConsoleHelper.js +++ b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/ConsoleHelper.js @@ -20,10 +20,8 @@ */ define(["dojo/_base/xhr", "dojo/domReady!"], function (xhr) { - var qpidHelpLocation = "http://qpid.apache.org/releases/qpid-"; var preferencesDialog = null; var helpURL = null; - var qpidVersion = null; return { showPreferencesDialog: function () { @@ -41,26 +39,27 @@ define(["dojo/_base/xhr", "dojo/domReady!"], function (xhr) { preferencesDialog.showDialog(); } }, - getVersion: function() + getHelpUrl: function() { - if (!qpidVersion) + if (!helpURL) { xhr.get({ sync: true, - url: "service/helper?action=version", + url: "api/latest/broker", + content: { "depth" : 1, "includeSysContext" : true }, handleAs: "json" - }).then(function(version) { - qpidVersion = version; + }).then(function(data) { + var broker = data[0]; + if ("context" in broker && "qpid.helpURL" in broker["context"] ) + { + helpURL = broker["context"]["qpid.helpURL"]; + } + else + { + helpURL = "http://qpid.apache.org/"; + } }); } - return qpidVersion; - }, - getHelpUrl: function() - { - if (!helpURL) - { - helpURL = qpidHelpLocation + this.getVersion() + "/java-broker/book/index.html"; - } return helpURL; }, showHelp: function() -- cgit v1.2.1