ARTEMIS-2125 Tabs pref changes to display columns not persisted through page refresh

This commit is contained in:
Francesco Nigro 2018-10-16 13:28:14 +02:00
parent fe971a7a97
commit c4dd09cb8d
5 changed files with 90 additions and 5 deletions

View File

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

View File

@ -29,7 +29,7 @@ var ARTEMIS = (function(ARTEMIS) {
var objectType = "connection" var objectType = "connection"
var method = 'listConnections(java.lang.String, int, int)'; var method = 'listConnections(java.lang.String, int, int)';
var attributes = [ var defaultAttributes = [
{ {
field: 'connectionID', field: 'connectionID',
displayName: 'ID', displayName: 'ID',
@ -73,6 +73,23 @@ var ARTEMIS = (function(ARTEMIS) {
width: '*' width: '*'
} }
]; ];
ARTEMIS.log.debug('sessionStorage: connectionsColumnDefs =', sessionStorage.getItem('connectionsColumnDefs'));
var attributes = defaultAttributes;
if (sessionStorage.getItem('connectionsColumnDefs')) {
attributes = JSON.parse(sessionStorage.getItem('connectionsColumnDefs'));
}
$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('connectionsColumnDefs', JSON.stringify(attributes));
});
$scope.filter = { $scope.filter = {
fieldOptions: [ fieldOptions: [
{id: 'CONNECTION_ID', name: 'Connection ID'}, {id: 'CONNECTION_ID', name: 'Connection ID'},

View File

@ -29,7 +29,7 @@ var ARTEMIS = (function(ARTEMIS) {
var objectType = "consumer"; var objectType = "consumer";
var method = 'listConsumers(java.lang.String, int, int)'; var method = 'listConsumers(java.lang.String, int, int)';
var attributes = [ var defaultAttributes = [
{ {
field: 'id', field: 'id',
displayName: 'ID', displayName: 'ID',
@ -84,6 +84,23 @@ var ARTEMIS = (function(ARTEMIS) {
width: '*' width: '*'
} }
]; ];
ARTEMIS.log.debug('sessionStorage: consumersColumnDefs =', sessionStorage.getItem('consumersColumnDefs'));
var attributes = defaultAttributes;
if (sessionStorage.getItem('consumersColumnDefs')) {
attributes = JSON.parse(sessionStorage.getItem('consumersColumnDefs'));
}
$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('consumersColumnDefs', JSON.stringify(attributes));
});
$scope.filter = { $scope.filter = {
fieldOptions: [ fieldOptions: [
{id: 'ID', name: 'ID'}, {id: 'ID', name: 'ID'},

View File

@ -29,7 +29,7 @@ var ARTEMIS = (function(ARTEMIS) {
var objectType = "producer"; var objectType = "producer";
var method = 'listProducers(java.lang.String, int, int)'; var method = 'listProducers(java.lang.String, int, int)';
var attributes = [ var defaultAttributes = [
{ {
field: 'id', field: 'id',
displayName: 'ID', displayName: 'ID',
@ -79,6 +79,23 @@ var ARTEMIS = (function(ARTEMIS) {
sortable: false sortable: false
} }
]; ];
ARTEMIS.log.debug('sessionStorage: producersColumnDefs =', sessionStorage.getItem('producersColumnDefs'));
var attributes = defaultAttributes;
if (sessionStorage.getItem('producersColumnDefs')) {
attributes = JSON.parse(sessionStorage.getItem('producersColumnDefs'));
}
$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('producersColumnDefs', JSON.stringify(attributes));
});
$scope.filter = { $scope.filter = {
fieldOptions: [ fieldOptions: [
{id: 'ID', name: 'ID'}, {id: 'ID', name: 'ID'},

View File

@ -29,7 +29,7 @@ var ARTEMIS = (function(ARTEMIS) {
var objectType = "sessions" var objectType = "sessions"
var method = 'listSessions(java.lang.String, int, int)'; var method = 'listSessions(java.lang.String, int, int)';
var attributes = [ var defaultAttributes = [
{ {
field: 'id', field: 'id',
displayName: 'ID', displayName: 'ID',
@ -64,6 +64,23 @@ var ARTEMIS = (function(ARTEMIS) {
width: '*' width: '*'
}, },
]; ];
ARTEMIS.log.debug('sessionStorage: sessionsColumnDefs =', sessionStorage.getItem('sessionsColumnDefs'));
var attributes = defaultAttributes;
if (sessionStorage.getItem('sessionsColumnDefs')) {
attributes = JSON.parse(sessionStorage.getItem('sessionsColumnDefs'));
}
$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('sessionsColumnDefs', JSON.stringify(attributes));
});
$scope.filter = { $scope.filter = {
fieldOptions: [ fieldOptions: [
{id: 'ID', name: 'ID'}, {id: 'ID', name: 'ID'},