You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by mi...@apache.org on 2018/11/08 23:49:56 UTC

[2/2] activemq-artemis git commit: ARTEMIS-2125 Tabs preference changes to display columns not persistent through page refresh

ARTEMIS-2125 Tabs preference changes to display columns not persistent through page refresh


Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/a65e711f
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/a65e711f
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/a65e711f

Branch: refs/heads/master
Commit: a65e711fbcca19d7da043ac1f7151722ca99190f
Parents: 51ba9bc
Author: feuillemorte <it...@me.fmorte.org>
Authored: Fri Nov 2 13:53:43 2018 +0100
Committer: Michael Andre Pearce <mi...@me.com>
Committed: Thu Nov 8 23:50:08 2018 +0000

----------------------------------------------------------------------
 .../src/main/webapp/plugin/js/browse.js         | 106 +++++++++++--------
 1 file changed, 62 insertions(+), 44 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/a65e711f/artemis-hawtio/artemis-plugin/src/main/webapp/plugin/js/browse.js
----------------------------------------------------------------------
diff --git a/artemis-hawtio/artemis-plugin/src/main/webapp/plugin/js/browse.js b/artemis-hawtio/artemis-plugin/src/main/webapp/plugin/js/browse.js
index 807122f..5d7989b 100644
--- a/artemis-hawtio/artemis-plugin/src/main/webapp/plugin/js/browse.js
+++ b/artemis-hawtio/artemis-plugin/src/main/webapp/plugin/js/browse.js
@@ -20,6 +20,67 @@
 var ARTEMIS = (function(ARTEMIS) {
 
     ARTEMIS.BrowseQueueController = function ($scope, workspace, ARTEMISService, jolokia, localStorage, artemisMessage, $location, $timeout) {
+
+    var defaultAttributes = [
+      {
+         field: 'messageID',
+         displayName: 'Message ID',
+         cellTemplate: '<div class="ngCellText"><a ng-click="openMessageDialog(row)">{{row.entity.messageID}}</a></div>',
+         // for ng-grid
+         width: '10%'
+      },
+      {
+         field: 'userID',
+         displayName: 'User ID',
+         width: '10%'
+      },
+      {
+         field: 'type',
+         displayName: 'Type',
+         width: '10%'
+      },
+      {
+         field: 'durable',
+         displayName: 'Durable',
+         width: '10%'
+      },
+      {
+         field: 'priority',
+         displayName: 'Priority',
+         width: '7%'
+      },
+      {
+         field: 'timestamp',
+         displayName: 'Timestamp',
+         width: '19%'
+      },
+      {
+         field: 'expiration',
+         displayName: 'Expires',
+         width: '10%'
+      },
+      {
+         field: 'redelivered',
+         displayName: 'Redelivered',
+         width: '10%'
+      }
+    ];
+   var attributes = defaultAttributes;
+   if (sessionStorage.getItem('browseColumnDefs')) {
+      attributes = JSON.parse(sessionStorage.getItem('browseColumnDefs'));
+   }
+   $scope.$on('ngGridEventColumns', function (newColumns) {
+      ARTEMIS.log.debug('ngGridEventColumns:', newColumns);
+      var visibles = newColumns.targetScope.columns.reduce(function (visibles, column) {
+          visibles[column.field] = column.visible;
+          return visibles;
+      }, {});
+      ARTEMIS.log.debug('ngGridEventColumns: visibles =', visibles);
+      attributes.forEach(function (attribute) {
+          attribute.visible = visibles[attribute.field];
+      });
+      sessionStorage.setItem('browseColumnDefs', JSON.stringify(attributes));
+   });
     $scope.pagingOptions = {
           pageSizes: [50, 100, 200],
           pageSize: 100,
@@ -53,50 +114,7 @@ var ARTEMIS = (function(ARTEMIS) {
           selectWithCheckboxOnly: true,
           showSelectionCheckbox: true,
           maintainColumnRatios: false,
-          columnDefs: [
-             {
-                field: 'messageID',
-                displayName: 'Message ID',
-                cellTemplate: '<div class="ngCellText"><a ng-click="openMessageDialog(row)">{{row.entity.messageID}}</a></div>',
-                // for ng-grid
-                width: '10%'
-             },
-             {
-                field: 'userID',
-                displayName: 'User ID',
-                width: '10%'
-             },
-             {
-                field: 'type',
-                displayName: 'Type',
-                width: '10%'
-             },
-             {
-                field: 'durable',
-                displayName: 'Durable',
-                width: '10%'
-             },
-             {
-                field: 'priority',
-                displayName: 'Priority',
-                width: '7%'
-             },
-             {
-                field: 'timestamp',
-                displayName: 'Timestamp',
-                width: '19%'
-             },
-             {
-                field: 'expiration',
-                displayName: 'Expires',
-                width: '10%'
-             },
-              {
-                 field: 'redelivered',
-                 displayName: 'Redelivered',
-                 width: '10%'
-              }
-          ],
+          columnDefs: attributes,
           afterSelectionChange: afterSelectionChange
        };
        $scope.showMessageDetails = false;