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 2016/12/02 16:12:36 UTC

qpid-dispatch git commit: DISPATCH-587 Load log entries after dialog is displayed to provide feedback

Repository: qpid-dispatch
Updated Branches:
  refs/heads/master 04cff4f04 -> 51134ba2d


DISPATCH-587 Load log entries after dialog is displayed to provide feedback


Project: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/commit/51134ba2
Tree: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/tree/51134ba2
Diff: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/diff/51134ba2

Branch: refs/heads/master
Commit: 51134ba2d0eef2bfd87f9adaaddd33c1d6a74e80
Parents: 04cff4f
Author: Ernest Allen <ea...@redhat.com>
Authored: Fri Dec 2 11:12:07 2016 -0500
Committer: Ernest Allen <ea...@redhat.com>
Committed: Fri Dec 2 11:12:07 2016 -0500

----------------------------------------------------------------------
 .../stand-alone/plugin/html/qdrOverview.html    | 37 +++++++++++---------
 console/stand-alone/plugin/js/qdrOverview.js    | 34 +++---------------
 .../plugin/js/qdrOverviewLogsController.js      | 34 ++++++++++++++++--
 3 files changed, 58 insertions(+), 47 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/51134ba2/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 993a4d5..93cdfe4 100644
--- a/console/stand-alone/plugin/html/qdrOverview.html
+++ b/console/stand-alone/plugin/html/qdrOverview.html
@@ -182,23 +182,28 @@ under the License.
         <h3 class="modal-title">Logs for {{nodeName}} {{module}}:{{level | humanify}}</h3>
     </div>
     <div class="modal-body">
-        <div class="log-details" 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 ng-if="loading == false">
+            <div class="log-details" 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</div>
+        </div>
+        <div ng-if="loading == true">
+            Loading...
         </div>
-        <div ng-if="logFields.length == 0">No log entries</div>
     </div>
     <div class="modal-footer">
         <button class="btn btn-primary" type="button" ng-click="ok()">Close</button>

http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/51134ba2/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 7ca0d21..4476772 100644
--- a/console/stand-alone/plugin/js/qdrOverview.js
+++ b/console/stand-alone/plugin/js/qdrOverview.js
@@ -1232,34 +1232,10 @@ QDR.log.debug("setting linkFields to [] in selectMode")
     }
 
     $scope.logInfoFor = function (row, col) {
-      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);
-        } else {
-          var levelLogs = response.filter( function (result) {
-            if (result[1] == null)
-              result[1] = "error"
-            return result[1].toUpperCase() === col.displayName.toUpperCase() && result[0] === row.entity.name
-          })
-          var logFields = levelLogs.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()
-            }
-          })
-          logDialog(row, col, logFields)
-        }
-      }
-      QDRService.sendMethod(row.entity.nodeId, undefined, {}, "GET-LOG", {module: row.entity.name}, gotLogInfo)
+      logDialog(row, col)
     }
 
-    function logDialog(row, col, logs) {
+    function logDialog(row, col) {
         var d = $dialog.dialog({
           backdrop: false,
           keyboard: true,
@@ -1267,9 +1243,6 @@ QDR.log.debug("setting linkFields to [] in selectMode")
           templateUrl: 'viewLogs.html',
           controller: "QDR.OverviewLogsController",
           resolve: {
-            logs: function() {
-              return logs
-            },
             nodeName: function () {
               return row.entity.nodeName
             },
@@ -1279,6 +1252,9 @@ QDR.log.debug("setting linkFields to [] in selectMode")
             level: function () {
               return col.displayName
             },
+            nodeId: function () {
+              return row.entity.nodeId
+            },
           }
         });
         d.open().then(function(result) { console.log("d.open().then"); });

http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/51134ba2/console/stand-alone/plugin/js/qdrOverviewLogsController.js
----------------------------------------------------------------------
diff --git a/console/stand-alone/plugin/js/qdrOverviewLogsController.js b/console/stand-alone/plugin/js/qdrOverviewLogsController.js
index bc93c22..fed1e3d 100644
--- a/console/stand-alone/plugin/js/qdrOverviewLogsController.js
+++ b/console/stand-alone/plugin/js/qdrOverviewLogsController.js
@@ -21,12 +21,42 @@ under the License.
  */
 var QDR = (function(QDR) {
 
-  QDR.module.controller('QDR.OverviewLogsController', function ($scope, dialog, logs, nodeName, module, level) {
+  QDR.module.controller('QDR.OverviewLogsController', function ($scope, dialog, QDRService, $timeout, nodeName, nodeId, module, level) {
 
+      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);
+        } else {
+          var levelLogs = response.filter( function (result) {
+            if (result[1] == null)
+              result[1] = "error"
+            return result[1].toUpperCase() === level.toUpperCase() && result[0] === module
+          })
+          var logFields = levelLogs.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()
+            }
+          })
+          $timeout(function () {
+            $scope.loading = false
+            $scope.logFields = logFields
+          })
+        }
+      }
+      QDRService.sendMethod(nodeId, undefined, {}, "GET-LOG", {module: module}, gotLogInfo)
+
+    $scope.loading = true
     $scope.module = module
     $scope.level = level
     $scope.nodeName = nodeName
-    $scope.logFields = logs
+    $scope.logFields = []
     $scope.ok = function () {
       dialog.close(true);
     };


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org