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

This commit is contained in:
Tadayoshi Sato 2018-10-15 14:38:43 +09:00
parent 0d89eb3c30
commit fe971a7a97
1 changed files with 18 additions and 1 deletions

View File

@ -29,7 +29,7 @@ var ARTEMIS = (function(ARTEMIS) {
var objectType = "queue";
var method = 'listQueues(java.lang.String, int, int)';
var attributes = [
var defaultAttributes = [
{
field: 'manage',
displayName: 'manage',
@ -148,6 +148,23 @@ var ARTEMIS = (function(ARTEMIS) {
visible: false
}
];
ARTEMIS.log.debug('sessionStorage: queuesColumnDefs =', sessionStorage.getItem('queuesColumnDefs'));
var attributes = defaultAttributes;
if (sessionStorage.getItem('queuesColumnDefs')) {
attributes = JSON.parse(sessionStorage.getItem('queuesColumnDefs'));
}
$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('queuesColumnDefs', JSON.stringify(attributes));
});
$scope.filter = {
fieldOptions: [