Repository: qpid-dispatch Updated Branches: refs/heads/master a92102543 -> 39afec9c1
DISPATCH-490 Add logs to overview page Project: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/commit/39afec9c Tree: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/tree/39afec9c Diff: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/diff/39afec9c Branch: refs/heads/master Commit: 39afec9c143fa5662fee4d6035c6c46f43e0e649 Parents: a921025 Author: Ernest Allen <eal...@redhat.com> Authored: Tue Aug 30 18:33:13 2016 -0400 Committer: Ernest Allen <eal...@redhat.com> Committed: Tue Aug 30 18:33:13 2016 -0400 ---------------------------------------------------------------------- console/stand-alone/plugin/css/plugin.css | 3 + console/stand-alone/plugin/css/site-base.css | 18 +-- console/stand-alone/plugin/html/qdrList.html | 2 +- .../stand-alone/plugin/html/qdrOverview.html | 32 ++++- console/stand-alone/plugin/js/qdrOverview.js | 124 +++++++++++++++---- 5 files changed, 135 insertions(+), 44 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/39afec9c/console/stand-alone/plugin/css/plugin.css ---------------------------------------------------------------------- diff --git a/console/stand-alone/plugin/css/plugin.css b/console/stand-alone/plugin/css/plugin.css index fa239dd..a88bd50 100644 --- a/console/stand-alone/plugin/css/plugin.css +++ b/console/stand-alone/plugin/css/plugin.css @@ -282,6 +282,9 @@ div.qdr-attributes.pane, div.qdr-topology.pane { position: absolute; margin-left: 10px; } +div.qdr-overview.pane { + position: absolute; +} div.qdr-topology.pane.left { width: auto; } http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/39afec9c/console/stand-alone/plugin/css/site-base.css ---------------------------------------------------------------------- diff --git a/console/stand-alone/plugin/css/site-base.css b/console/stand-alone/plugin/css/site-base.css index 81619a6..1a89758 100644 --- a/console/stand-alone/plugin/css/site-base.css +++ b/console/stand-alone/plugin/css/site-base.css @@ -4277,11 +4277,11 @@ ul.dynatree-container { } .pane { - position: absolute; - bottom: 0; - top: 100px; - height: auto; - width: 300px; + position: absolute; + bottom: 0; + top: 70px; + height: auto; + width: 300px; } .pane > .pane-wrapper { @@ -4641,14 +4641,6 @@ div.treeContainer ul.dynatree-container { border: 0px; } -.pane { - position: fixed; - bottom: 0; - top: 70px; - height: auto; - width: 300px; -} - .pane>.pane-wrapper { position: relative; height: 100%; http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/39afec9c/console/stand-alone/plugin/html/qdrList.html ---------------------------------------------------------------------- diff --git a/console/stand-alone/plugin/html/qdrList.html b/console/stand-alone/plugin/html/qdrList.html index 0033675..e6f0d3c 100644 --- a/console/stand-alone/plugin/html/qdrList.html +++ b/console/stand-alone/plugin/html/qdrList.html @@ -34,7 +34,7 @@ under the License. <button class="btn btn-primary" ng-click="remove()">Delete</button> {{selectedRecordName}} </div> <div ng-hide="selectedRecordName !== selectedEntity"> - There are no {{selectedEntity}}s + There are no {{selectedEntity | safePlural}} </div> </div> <div class="operations" ng-show="currentMode.id === 'operations'"> http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/39afec9c/console/stand-alone/plugin/html/qdrOverview.html ---------------------------------------------------------------------- diff --git a/console/stand-alone/plugin/html/qdrOverview.html b/console/stand-alone/plugin/html/qdrOverview.html index a2430f0..fb10f31 100644 --- a/console/stand-alone/plugin/html/qdrOverview.html +++ b/console/stand-alone/plugin/html/qdrOverview.html @@ -87,10 +87,10 @@ under the License. <script type="text/ng-template" id="connections.html"> <div class="row-fluid"> - <h3>Connections</h3> - <div class="overview"> - <div class="gridStyle" ng-grid="allConnectionGrid"></div> - </div> + <h3>Connections</h3> + <div class="overview"> + <div class="gridStyle" ng-grid="allConnectionGrid"></div> + </div> </div> </script> <script type="text/ng-template" id="connection.html"> @@ -122,12 +122,32 @@ under the License. </script> <script type="text/ng-template" id="logs.html"> <div class="row-fluid"> - <h3>Logs</h3> + <h3>Recent log entries</h3> + <div class="overview"> + <div class="gridStyle" ng-grid="allLogGrid"></div> + </div> </div> </script> <script type="text/ng-template" id="log.html"> <div class="row-fluid"> - <h3>Log {{log.data.title}}</h3> + <h3>{{log.data.title}}</h3> + <div ng-if="logFields.length > 0"> + <table class="log-entry" ng-repeat="entry in logFields track by $index"> + <tr> + <td>Router</td><td>{{entry.nodeId}}</td> + </tr> + <tr> + <td align="left" colspan="2">{{entry.time}}</td> + </tr> + <tr> + <td>Source</td><td>{{entry.source}}:{{entry.line}}</td> + </tr> + <tr> + <td valign="middle">Message</td><td valign="middle"><pre>{{entry.message}}</pre></td> + </tr> + </table> + </div> + <div ng-if="logFields.length == 0">No log entries for {{log.data.title}}</div> </div> </script> http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/39afec9c/console/stand-alone/plugin/js/qdrOverview.js ---------------------------------------------------------------------- diff --git a/console/stand-alone/plugin/js/qdrOverview.js b/console/stand-alone/plugin/js/qdrOverview.js index 27976ca..6d50170 100644 --- a/console/stand-alone/plugin/js/qdrOverview.js +++ b/console/stand-alone/plugin/js/qdrOverview.js @@ -973,13 +973,96 @@ var QDR = (function (QDR) { loadColState($scope.connectionGrid); } + $scope.allLogFields = [] + $scope.allLogSelections = []; + $scope.allLogGrid = { + saveKey: 'allLogGrid', + data: 'allLogFields', + columnDefs: [ + { + field: 'module', + saveKey: 'allLogGrid', + displayName: 'Module' + }, + { + field: 'enable', + displayName: 'Enable' + }, + { + field: 'count', + displayName: 'Count' + } + ], + enableColumnResize: true, + multiSelect: false, + selectedItems: $scope.allLogSelections, + afterSelectionChange: function(data) { + if (data.selected) { + var selItem = $scope.allLogSelections[0] + var nodeId = selItem.module + // activate in the tree + $("#overtree").dynatree("getTree").activateKey(nodeId); + } + } + }; + // get info for a all logs + var allLogEntries = [] var allLogInfo = function () { + var nodeIds = QDRService.nodeIdList() + var expected = nodeIds.length; + var received = 0; + var logResults = [] + var gotLogInfo = function (nodeId, entity, response, context) { + var statusCode = context.message.application_properties.statusCode; + if (statusCode < 200 || statusCode >= 300) { + Core.notification('error', context.message.application_properties.statusDescription); + //QDR.log.debug(context.message.application_properties.statusDescription) + return; + } + var logFields = response.map( function (result) { + return { + nodeId: QDRService.nameFromId(nodeId), + name: result[0], + type: result[1], + message: result[2], + source: result[3], + line: result[4], + time: Date(result[5]).toString() + } + }) + logResults.push.apply(logResults, logFields) // append new array to existing + if (expected == ++received) { + logResults.sort( function (a, b) { + return b.name - a.name + }) + + $scope.allLogFields = []; + var logsRoot = $("#overtree").dynatree("getTree").getNodeByKey('Logs') + logsRoot.visit( function (logModule) { + $scope.allLogFields.push({module: logModule.data.key, + enable: logModule.data.enable, + count: logResults.filter( function (entry) { + return entry.name === logModule.data.key + }).length + }) + }) + allLogEntries = logResults + } + } + nodeIds.forEach( function (node) { + QDRService.sendMethod(node, undefined, {}, "GET-LOG", gotLogInfo) + }) + } // get info for a single log var logInfo = function (node) { $scope.log = node + $scope.logFields = allLogEntries.filter( function (log) { + return node.data.key === log.name + }) + $scope.$apply(); } var getExpandedList = function () { @@ -1240,8 +1323,6 @@ var QDR = (function (QDR) { var htmlReady = false; var dataReady = false; - var logsreceived = 0; - var logObj = {} var logs = new Folder("Logs") logs.type = "Logs" logs.info = allLogInfo @@ -1250,30 +1331,25 @@ var QDR = (function (QDR) { logs.clickFolderMode = 1 logs.key = "Logs" logs.parent = "Logs" - //topLevelChildren.push(logs) + topLevelChildren.push(logs) var nodeIds = QDRService.nodeIdList() - var expected = nodeIds.length; - nodeIds.forEach( function (nodeId) { - QDRService.getNodeInfo(nodeId, ".log", ["name"], function (nodeName, entity, response) { - response.results.forEach( function (result) { - logObj[result[0]] = 1 // use object to collapse duplicates - }) - ++logsreceived; - if (logsreceived == expected) { - var allLogs = Object.keys(logObj).sort() - allLogs.forEach(function (log) { - var l = new Folder(log) - l.type = "Log" - l.info = logInfo - l.key = log - l.parent = "Logs" - l.activate = lastKey === log - logs.children.push(l) - }) - dataReady = true; - initTreeAndGrid(); - } + QDRService.getNodeInfo(nodeIds[0], "log", ["module", "enable"], function (nodeName, entity, response) { + var moduleIndex = response.attributeNames.indexOf('module') + response.results.sort( function (a,b) {return a[moduleIndex] < b[moduleIndex] ? -1 : a[moduleIndex] > b[moduleIndex] ? 1 : 0}) + response.results.forEach( function (result) { + var entry = QDRService.flatten(response.attributeNames, result) + var l = new Folder(entry.module) + l.type = "Log" + l.info = logInfo + l.key = entry.module + l.parent = "Logs" + l.activate = lastKey === l.key + l.enable = entry.enable + l.addClass = "log" + logs.children.push(l) }) + dataReady = true; + initTreeAndGrid(); }) var initTreeAndGrid = function () { if (!htmlReady || !dataReady) --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org For additional commands, e-mail: commits-h...@qpid.apache.org