- some UI performance improvements
This commit is contained in:
@@ -126,7 +126,35 @@ define([
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* init global timestamp counter or DataTable for specific columns
|
||||
* @param tableElement
|
||||
* @param columnSelector
|
||||
* @param round
|
||||
*/
|
||||
let initTableCounter = (tableElement, columnSelector, round) => {
|
||||
let tableApi = tableElement.api();
|
||||
|
||||
// mark as init
|
||||
tableElement.attr('data-counter', 'init');
|
||||
let refreshIntervalId = window.setInterval(() => {
|
||||
tableApi.cells(null, columnSelector).every(function(rowIndex, colIndex, tableLoopCount, cellLoopCount){
|
||||
let cell = this;
|
||||
let node = cell.node();
|
||||
let data = cell.data();
|
||||
if(data && Number.isInteger(data) && !node.classList.contains('stopCounter')){
|
||||
// timestamp expected int > 0
|
||||
let date = new Date(data * 1000);
|
||||
updateDateDiff( cell.nodes().to$(), date, round);
|
||||
}
|
||||
});
|
||||
}, 500);
|
||||
|
||||
tableElement.data('interval', refreshIntervalId);
|
||||
};
|
||||
|
||||
return {
|
||||
updateDateDiff: updateDateDiff
|
||||
updateDateDiff: updateDateDiff,
|
||||
initTableCounter: initTableCounter
|
||||
};
|
||||
});
|
||||
|
||||
@@ -15,6 +15,12 @@ define([
|
||||
group: 'signatures',
|
||||
label: 'Select multiple rows',
|
||||
keyNames: ['CONTROL', 'CLICK']
|
||||
},
|
||||
signatureNavigate: {
|
||||
group: 'signatures',
|
||||
label: 'Table navigation',
|
||||
keyNames: ['UP', 'RIGHT', 'DOWN', 'LEFT'],
|
||||
list: true
|
||||
}
|
||||
};
|
||||
|
||||
@@ -434,7 +440,8 @@ define([
|
||||
|
||||
let newEventData = {
|
||||
label: data.label,
|
||||
keyNames: keyNames
|
||||
keyNames: keyNames,
|
||||
list: data.list
|
||||
};
|
||||
|
||||
if( result[data.group].events ){
|
||||
|
||||
@@ -8,8 +8,9 @@ define([
|
||||
'app/util',
|
||||
'app/render',
|
||||
'bootbox',
|
||||
'app/counter',
|
||||
'app/map/util'
|
||||
], function($, Init, Util, Render, bootbox, MapUtil) {
|
||||
], function($, Init, Util, Render, bootbox, Counter, MapUtil) {
|
||||
|
||||
'use strict';
|
||||
|
||||
@@ -477,6 +478,7 @@ define([
|
||||
},
|
||||
columns: [
|
||||
{
|
||||
name: 'type',
|
||||
title: 'type',
|
||||
width: '25px',
|
||||
className: ['min-screen-l'].join(' '),
|
||||
@@ -486,6 +488,7 @@ define([
|
||||
sort: 'type_sort'
|
||||
}
|
||||
},{
|
||||
name: 'security',
|
||||
title: '',
|
||||
width: '1px',
|
||||
searchable: false,
|
||||
@@ -495,6 +498,7 @@ define([
|
||||
sort: 'security_sort'
|
||||
}
|
||||
},{
|
||||
name: 'trueSec',
|
||||
title: 'sec',
|
||||
width: '18px',
|
||||
className: ['text-center', 'min-screen-l'].join(' '),
|
||||
@@ -505,6 +509,7 @@ define([
|
||||
sort: 'trueSec_sort'
|
||||
}
|
||||
},{
|
||||
name: 'shattered',
|
||||
title: '<i class="fas fa-skull" title="shattered" data-toggle="tooltip"></i>',
|
||||
width: '10px',
|
||||
className: ['text-center', 'min-screen-l'].join(' '),
|
||||
@@ -515,6 +520,7 @@ define([
|
||||
sort: 'shattered_sort'
|
||||
}
|
||||
},{
|
||||
name: 'name',
|
||||
title: 'system',
|
||||
data: 'name',
|
||||
className: [config.tableCellLinkClass].join(' '),
|
||||
@@ -525,12 +531,15 @@ define([
|
||||
});
|
||||
}
|
||||
},{
|
||||
name: 'alias',
|
||||
title: 'alias',
|
||||
data: 'alias'
|
||||
},{
|
||||
name: 'region',
|
||||
title: 'region',
|
||||
data: 'region'
|
||||
},{
|
||||
name: 'status',
|
||||
title: '<i class="far fa-square" title="system status" data-toggle="tooltip"></i>',
|
||||
width: '10px',
|
||||
className: 'text-center',
|
||||
@@ -541,6 +550,7 @@ define([
|
||||
sort: 'status_sort'
|
||||
}
|
||||
},{
|
||||
name: 'effect',
|
||||
title: '<i class="fas fa-square" title="system effect" data-toggle="tooltip"></i>',
|
||||
width: '10px',
|
||||
className: 'text-center',
|
||||
@@ -551,10 +561,12 @@ define([
|
||||
sort: 'effect_sort'
|
||||
}
|
||||
},{
|
||||
name: 'static',
|
||||
title: 'static',
|
||||
width: '30px',
|
||||
data: 'static'
|
||||
},{
|
||||
name: 'position',
|
||||
title: '<i class="fas fa-map-marker-alt" title="your position" data-toggle="tooltip"></i>',
|
||||
width: '8px',
|
||||
className: 'text-center',
|
||||
@@ -565,12 +577,14 @@ define([
|
||||
sort: 'position_sort'
|
||||
}
|
||||
},{
|
||||
name: 'userCount',
|
||||
title: '<i class="fas fa-plane" title="active pilots" data-toggle="tooltip"></i>',
|
||||
width: '12px',
|
||||
className: 'text-center',
|
||||
searchable: false,
|
||||
data: 'userCount'
|
||||
},{
|
||||
name: 'locked',
|
||||
title: '<i class="fas fa-lock" title="system locked" data-toggle="tooltip"></i>',
|
||||
width: '10px',
|
||||
className: 'text-center',
|
||||
@@ -581,15 +595,14 @@ define([
|
||||
sort: 'locked_sort'
|
||||
}
|
||||
},{
|
||||
name: 'updated',
|
||||
title: 'updated',
|
||||
width: '80px',
|
||||
searchable: false,
|
||||
className: ['text-right', config.tableCellCounterClass, 'min-screen-l'].join(' '),
|
||||
data: 'updated',
|
||||
createdCell: function(cell, cellData, rowData, rowIndex, colIndex){
|
||||
$(cell).initTimestampCounter();
|
||||
}
|
||||
data: 'updated'
|
||||
},{
|
||||
name: 'action',
|
||||
title: '',
|
||||
orderable: false,
|
||||
searchable: false,
|
||||
@@ -639,7 +652,10 @@ define([
|
||||
|
||||
}
|
||||
}
|
||||
]
|
||||
],
|
||||
initComplete: function(settings){
|
||||
Counter.initTableCounter(this, ['updated:name']);
|
||||
}
|
||||
});
|
||||
|
||||
};
|
||||
@@ -719,6 +735,7 @@ define([
|
||||
},
|
||||
columns: [
|
||||
{
|
||||
name: 'scope',
|
||||
title: 'scope',
|
||||
width: '50px',
|
||||
orderable: true,
|
||||
@@ -728,6 +745,7 @@ define([
|
||||
sort: 'scope_sort'
|
||||
}
|
||||
},{
|
||||
name: 'sourceName',
|
||||
title: 'source system',
|
||||
data: 'source.name',
|
||||
className: [config.tableCellLinkClass].join(' '),
|
||||
@@ -738,6 +756,7 @@ define([
|
||||
});
|
||||
}
|
||||
},{
|
||||
name: 'connection',
|
||||
title: 'connection',
|
||||
width: '80px',
|
||||
className: 'text-center',
|
||||
@@ -755,14 +774,13 @@ define([
|
||||
});
|
||||
}
|
||||
},{
|
||||
name: 'updated',
|
||||
title: 'updated',
|
||||
width: '80px',
|
||||
searchable: false,
|
||||
className: ['text-right', config.tableCellCounterClass].join(' '),
|
||||
data: 'updated',
|
||||
createdCell: function(cell, cellData, rowData, rowIndex, colIndex){
|
||||
$(cell).initTimestampCounter();
|
||||
|
||||
if(rowData.scope.scope_sort === 'wh'){
|
||||
// highlight cell
|
||||
let diff = new Date().getTime() - cellData * 1000;
|
||||
@@ -773,6 +791,7 @@ define([
|
||||
}
|
||||
}
|
||||
},{
|
||||
name: 'action',
|
||||
title: '',
|
||||
orderable: false,
|
||||
searchable: false,
|
||||
@@ -801,7 +820,10 @@ define([
|
||||
$(cell).confirmation(tempConfirmationSettings);
|
||||
}
|
||||
}
|
||||
]
|
||||
],
|
||||
initComplete: function(settings){
|
||||
Counter.initTableCounter(this, ['updated:name']);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@@ -357,6 +357,7 @@ define([
|
||||
planetsInfoClass: config.systemInfoPlanetsClass,
|
||||
wormholePrefixClass: config.systemInfoWormholeClass,
|
||||
statusInfoClass: config.systemInfoStatusLabelClass,
|
||||
popoverTriggerClass: Util.config.popoverTriggerClass,
|
||||
|
||||
systemTypeName: MapUtil.getSystemTypeInfo(systemData.type.id, 'name'),
|
||||
systemIsWormhole: MapUtil.getSystemTypeInfo(systemData.type.id, 'name') === 'w-space',
|
||||
@@ -405,6 +406,8 @@ define([
|
||||
// remove xEditable description textarea
|
||||
let descriptionTextareaElement = moduleElement.find('.' + config.descriptionTextareaElementClass);
|
||||
descriptionTextareaElement.editable('destroy');
|
||||
|
||||
moduleElement.destroyPopover(true);
|
||||
};
|
||||
|
||||
return {
|
||||
|
||||
@@ -6,8 +6,9 @@ define([
|
||||
'jquery',
|
||||
'app/init',
|
||||
'app/util',
|
||||
'bootbox'
|
||||
], ($, Init, Util, bootbox) => {
|
||||
'bootbox',
|
||||
'app/counter'
|
||||
], ($, Init, Util, bootbox, Counter) => {
|
||||
'use strict';
|
||||
|
||||
let config = {
|
||||
@@ -113,7 +114,6 @@ define([
|
||||
if(rowData.updated.updated !== structureData.updated.updated){
|
||||
// row data changed -> update
|
||||
api.data(structureData);
|
||||
api.nodes().to$().data('animationStatus', 'changed').destroyTimestampCounter();
|
||||
notificationCounter.changed++;
|
||||
}
|
||||
|
||||
@@ -138,7 +138,13 @@ define([
|
||||
api.remove();
|
||||
}
|
||||
|
||||
context.tableApi.draw();
|
||||
if(
|
||||
notificationCounter.added > 0 ||
|
||||
notificationCounter.changed > 0 ||
|
||||
notificationCounter.deleted > 0
|
||||
){
|
||||
context.tableApi.draw();
|
||||
}
|
||||
|
||||
// show notification ------------------------------------------------------------------------------------------
|
||||
let notification = '';
|
||||
@@ -434,7 +440,7 @@ define([
|
||||
});
|
||||
moduleElement.append(table);
|
||||
|
||||
let structureTable = table.DataTable({
|
||||
let tableApi = table.DataTable({
|
||||
paging: false,
|
||||
lengthChange: false,
|
||||
ordering: true,
|
||||
@@ -456,6 +462,7 @@ define([
|
||||
columnDefs: [
|
||||
{
|
||||
targets: 0,
|
||||
name: 'status',
|
||||
title: '',
|
||||
width: 2,
|
||||
class: 'text-center',
|
||||
@@ -469,6 +476,7 @@ define([
|
||||
}
|
||||
},{
|
||||
targets: 1,
|
||||
name: 'structureImage',
|
||||
title: '',
|
||||
width: 26,
|
||||
orderable: false,
|
||||
@@ -486,6 +494,7 @@ define([
|
||||
}
|
||||
},{
|
||||
targets: 2,
|
||||
name: 'structureType',
|
||||
title: 'type',
|
||||
width: 30,
|
||||
className: [config.tableCellEllipsisClass].join(' '),
|
||||
@@ -493,12 +502,14 @@ define([
|
||||
defaultContent: '<i class="fas fa-question txt-color txt-color-orangeDark"></i>',
|
||||
},{
|
||||
targets: 3,
|
||||
name: 'name',
|
||||
title: 'name',
|
||||
width: 60,
|
||||
className: [config.tableCellEllipsisClass].join(' '),
|
||||
data: 'name'
|
||||
},{
|
||||
targets: 4,
|
||||
name: 'ownerImage',
|
||||
title: '',
|
||||
width: 26,
|
||||
orderable: false,
|
||||
@@ -518,6 +529,7 @@ define([
|
||||
}
|
||||
},{
|
||||
targets: 5,
|
||||
name: 'ownerName',
|
||||
title: 'owner',
|
||||
width: 50,
|
||||
className: [config.tableCellEllipsisClass].join(' '),
|
||||
@@ -525,17 +537,20 @@ define([
|
||||
defaultContent: '<i class="fas fa-question txt-color txt-color-orangeDark"></i>',
|
||||
},{
|
||||
targets: 6,
|
||||
name: 'note',
|
||||
title: 'note',
|
||||
className: [config.tableCellEllipsisClass].join(' '),
|
||||
data: 'description'
|
||||
},{
|
||||
targets: 7,
|
||||
name: 'updated',
|
||||
title: 'updated',
|
||||
width: 60,
|
||||
className: ['text-right', config.tableCellCounterClass].join(' '),
|
||||
className: ['text-right', config.tableCellCounterClass, 'not-screen-l'].join(' '),
|
||||
data: 'updated.updated'
|
||||
},{
|
||||
targets: 8,
|
||||
name: 'edit',
|
||||
title: '',
|
||||
orderable: false,
|
||||
width: 10,
|
||||
@@ -566,6 +581,7 @@ define([
|
||||
}
|
||||
},{
|
||||
targets: 9,
|
||||
name: 'delete',
|
||||
title: '',
|
||||
orderable: false,
|
||||
width: 10,
|
||||
@@ -650,8 +666,6 @@ define([
|
||||
}
|
||||
});
|
||||
|
||||
rows.to$().find('.' + config.tableCellCounterClass + ':not([data-counter])').initTimestampCounter('d');
|
||||
|
||||
let animationRows = rows.to$().filter(function() {
|
||||
return (
|
||||
$(this).data('animationStatus') ||
|
||||
@@ -668,11 +682,20 @@ define([
|
||||
initComplete: function(settings){
|
||||
// table data is load in updateModule() method
|
||||
// -> no need to trigger additional ajax call here for data
|
||||
// -> in case table update failed -> each if this initComplete() function finished before table updata
|
||||
// -> in case table update failed -> each if this initComplete() function finished before table updated
|
||||
// e.g. return now promise in getModule() function
|
||||
|
||||
Counter.initTableCounter(this, ['updated:name'], 'd');
|
||||
}
|
||||
});
|
||||
|
||||
new $.fn.dataTable.Responsive(tableApi);
|
||||
|
||||
tableApi.on('responsive-resize', function(e, tableApi, columns){
|
||||
// rowGroup length changes as well -> trigger draw() updates rowGroup length (see drawCallback())
|
||||
tableApi.draw();
|
||||
});
|
||||
|
||||
// init tooltips for this module
|
||||
let tooltipElements = moduleElement.find('[data-toggle="tooltip"]');
|
||||
tooltipElements.tooltip({
|
||||
|
||||
@@ -1766,9 +1766,9 @@ define([
|
||||
cellIndex[0] = 0; // first column
|
||||
}
|
||||
if(cellIndex[1] < 0){
|
||||
cellIndex[1] = tableApi.row(':last').nodes().to$().index(); // last row
|
||||
cellIndex[1] = tableApi.row(':last', {search: 'applied'}).nodes().to$().index(); // last row
|
||||
}
|
||||
if(cellIndex[1] > tableApi.row(':last').nodes().to$().index()){
|
||||
if(cellIndex[1] > tableApi.row(':last', {search: 'applied'}).nodes().to$().index()){
|
||||
cellIndex[1] = 0; // first row
|
||||
}
|
||||
return cellIndex;
|
||||
@@ -1792,7 +1792,7 @@ define([
|
||||
newCellIndex = checkIndex(tableApi, newCellIndex);
|
||||
|
||||
//let cell = tableApi.cell(newCellIndex[1], newCellIndex[0]);
|
||||
let cell = tableApi.cell(':eq(' + newCellIndex[1] + ')', ':eq(' + newCellIndex[0] + ')');
|
||||
let cell = tableApi.cell(':eq(' + newCellIndex[1] + ')', ':eq(' + newCellIndex[0] + ')', {search: 'applied'});
|
||||
let node = cell.node();
|
||||
|
||||
if(
|
||||
@@ -2008,22 +2008,7 @@ define([
|
||||
keyNavigation(tableApi, e);
|
||||
});
|
||||
|
||||
// init update counter for timestamp columns
|
||||
// mark as init
|
||||
this.attr('data-counter', 'init');
|
||||
let refreshIntervalId = window.setInterval(() => {
|
||||
tableApi.cells(null, ['created:name', 'updated:name']).every(function(rowIndex, colIndex, tableLoopCount, cellLoopCount){
|
||||
let cell = this;
|
||||
let node = cell.node();
|
||||
let data = cell.data();
|
||||
if(data && Number.isInteger(data) && !node.classList.contains('stopCounter')){
|
||||
// timestamp expected int > 0
|
||||
let date = new Date(data * 1000);
|
||||
Counter.updateDateDiff( cell.nodes().to$(), date);
|
||||
}
|
||||
});
|
||||
}, 500);
|
||||
this.data('interval', refreshIntervalId);
|
||||
Counter.initTableCounter(this, ['created:name', 'updated:name']);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -126,7 +126,35 @@ define([
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* init global timestamp counter or DataTable for specific columns
|
||||
* @param tableElement
|
||||
* @param columnSelector
|
||||
* @param round
|
||||
*/
|
||||
let initTableCounter = (tableElement, columnSelector, round) => {
|
||||
let tableApi = tableElement.api();
|
||||
|
||||
// mark as init
|
||||
tableElement.attr('data-counter', 'init');
|
||||
let refreshIntervalId = window.setInterval(() => {
|
||||
tableApi.cells(null, columnSelector).every(function(rowIndex, colIndex, tableLoopCount, cellLoopCount){
|
||||
let cell = this;
|
||||
let node = cell.node();
|
||||
let data = cell.data();
|
||||
if(data && Number.isInteger(data) && !node.classList.contains('stopCounter')){
|
||||
// timestamp expected int > 0
|
||||
let date = new Date(data * 1000);
|
||||
updateDateDiff( cell.nodes().to$(), date, round);
|
||||
}
|
||||
});
|
||||
}, 500);
|
||||
|
||||
tableElement.data('interval', refreshIntervalId);
|
||||
};
|
||||
|
||||
return {
|
||||
updateDateDiff: updateDateDiff
|
||||
updateDateDiff: updateDateDiff,
|
||||
initTableCounter: initTableCounter
|
||||
};
|
||||
});
|
||||
|
||||
@@ -15,6 +15,12 @@ define([
|
||||
group: 'signatures',
|
||||
label: 'Select multiple rows',
|
||||
keyNames: ['CONTROL', 'CLICK']
|
||||
},
|
||||
signatureNavigate: {
|
||||
group: 'signatures',
|
||||
label: 'Table navigation',
|
||||
keyNames: ['UP', 'RIGHT', 'DOWN', 'LEFT'],
|
||||
list: true
|
||||
}
|
||||
};
|
||||
|
||||
@@ -434,7 +440,8 @@ define([
|
||||
|
||||
let newEventData = {
|
||||
label: data.label,
|
||||
keyNames: keyNames
|
||||
keyNames: keyNames,
|
||||
list: data.list
|
||||
};
|
||||
|
||||
if( result[data.group].events ){
|
||||
|
||||
@@ -8,8 +8,9 @@ define([
|
||||
'app/util',
|
||||
'app/render',
|
||||
'bootbox',
|
||||
'app/counter',
|
||||
'app/map/util'
|
||||
], function($, Init, Util, Render, bootbox, MapUtil) {
|
||||
], function($, Init, Util, Render, bootbox, Counter, MapUtil) {
|
||||
|
||||
'use strict';
|
||||
|
||||
@@ -477,6 +478,7 @@ define([
|
||||
},
|
||||
columns: [
|
||||
{
|
||||
name: 'type',
|
||||
title: 'type',
|
||||
width: '25px',
|
||||
className: ['min-screen-l'].join(' '),
|
||||
@@ -486,6 +488,7 @@ define([
|
||||
sort: 'type_sort'
|
||||
}
|
||||
},{
|
||||
name: 'security',
|
||||
title: '',
|
||||
width: '1px',
|
||||
searchable: false,
|
||||
@@ -495,6 +498,7 @@ define([
|
||||
sort: 'security_sort'
|
||||
}
|
||||
},{
|
||||
name: 'trueSec',
|
||||
title: 'sec',
|
||||
width: '18px',
|
||||
className: ['text-center', 'min-screen-l'].join(' '),
|
||||
@@ -505,6 +509,7 @@ define([
|
||||
sort: 'trueSec_sort'
|
||||
}
|
||||
},{
|
||||
name: 'shattered',
|
||||
title: '<i class="fas fa-skull" title="shattered" data-toggle="tooltip"></i>',
|
||||
width: '10px',
|
||||
className: ['text-center', 'min-screen-l'].join(' '),
|
||||
@@ -515,6 +520,7 @@ define([
|
||||
sort: 'shattered_sort'
|
||||
}
|
||||
},{
|
||||
name: 'name',
|
||||
title: 'system',
|
||||
data: 'name',
|
||||
className: [config.tableCellLinkClass].join(' '),
|
||||
@@ -525,12 +531,15 @@ define([
|
||||
});
|
||||
}
|
||||
},{
|
||||
name: 'alias',
|
||||
title: 'alias',
|
||||
data: 'alias'
|
||||
},{
|
||||
name: 'region',
|
||||
title: 'region',
|
||||
data: 'region'
|
||||
},{
|
||||
name: 'status',
|
||||
title: '<i class="far fa-square" title="system status" data-toggle="tooltip"></i>',
|
||||
width: '10px',
|
||||
className: 'text-center',
|
||||
@@ -541,6 +550,7 @@ define([
|
||||
sort: 'status_sort'
|
||||
}
|
||||
},{
|
||||
name: 'effect',
|
||||
title: '<i class="fas fa-square" title="system effect" data-toggle="tooltip"></i>',
|
||||
width: '10px',
|
||||
className: 'text-center',
|
||||
@@ -551,10 +561,12 @@ define([
|
||||
sort: 'effect_sort'
|
||||
}
|
||||
},{
|
||||
name: 'static',
|
||||
title: 'static',
|
||||
width: '30px',
|
||||
data: 'static'
|
||||
},{
|
||||
name: 'position',
|
||||
title: '<i class="fas fa-map-marker-alt" title="your position" data-toggle="tooltip"></i>',
|
||||
width: '8px',
|
||||
className: 'text-center',
|
||||
@@ -565,12 +577,14 @@ define([
|
||||
sort: 'position_sort'
|
||||
}
|
||||
},{
|
||||
name: 'userCount',
|
||||
title: '<i class="fas fa-plane" title="active pilots" data-toggle="tooltip"></i>',
|
||||
width: '12px',
|
||||
className: 'text-center',
|
||||
searchable: false,
|
||||
data: 'userCount'
|
||||
},{
|
||||
name: 'locked',
|
||||
title: '<i class="fas fa-lock" title="system locked" data-toggle="tooltip"></i>',
|
||||
width: '10px',
|
||||
className: 'text-center',
|
||||
@@ -581,15 +595,14 @@ define([
|
||||
sort: 'locked_sort'
|
||||
}
|
||||
},{
|
||||
name: 'updated',
|
||||
title: 'updated',
|
||||
width: '80px',
|
||||
searchable: false,
|
||||
className: ['text-right', config.tableCellCounterClass, 'min-screen-l'].join(' '),
|
||||
data: 'updated',
|
||||
createdCell: function(cell, cellData, rowData, rowIndex, colIndex){
|
||||
$(cell).initTimestampCounter();
|
||||
}
|
||||
data: 'updated'
|
||||
},{
|
||||
name: 'action',
|
||||
title: '',
|
||||
orderable: false,
|
||||
searchable: false,
|
||||
@@ -639,7 +652,10 @@ define([
|
||||
|
||||
}
|
||||
}
|
||||
]
|
||||
],
|
||||
initComplete: function(settings){
|
||||
Counter.initTableCounter(this, ['updated:name']);
|
||||
}
|
||||
});
|
||||
|
||||
};
|
||||
@@ -719,6 +735,7 @@ define([
|
||||
},
|
||||
columns: [
|
||||
{
|
||||
name: 'scope',
|
||||
title: 'scope',
|
||||
width: '50px',
|
||||
orderable: true,
|
||||
@@ -728,6 +745,7 @@ define([
|
||||
sort: 'scope_sort'
|
||||
}
|
||||
},{
|
||||
name: 'sourceName',
|
||||
title: 'source system',
|
||||
data: 'source.name',
|
||||
className: [config.tableCellLinkClass].join(' '),
|
||||
@@ -738,6 +756,7 @@ define([
|
||||
});
|
||||
}
|
||||
},{
|
||||
name: 'connection',
|
||||
title: 'connection',
|
||||
width: '80px',
|
||||
className: 'text-center',
|
||||
@@ -755,14 +774,13 @@ define([
|
||||
});
|
||||
}
|
||||
},{
|
||||
name: 'updated',
|
||||
title: 'updated',
|
||||
width: '80px',
|
||||
searchable: false,
|
||||
className: ['text-right', config.tableCellCounterClass].join(' '),
|
||||
data: 'updated',
|
||||
createdCell: function(cell, cellData, rowData, rowIndex, colIndex){
|
||||
$(cell).initTimestampCounter();
|
||||
|
||||
if(rowData.scope.scope_sort === 'wh'){
|
||||
// highlight cell
|
||||
let diff = new Date().getTime() - cellData * 1000;
|
||||
@@ -773,6 +791,7 @@ define([
|
||||
}
|
||||
}
|
||||
},{
|
||||
name: 'action',
|
||||
title: '',
|
||||
orderable: false,
|
||||
searchable: false,
|
||||
@@ -801,7 +820,10 @@ define([
|
||||
$(cell).confirmation(tempConfirmationSettings);
|
||||
}
|
||||
}
|
||||
]
|
||||
],
|
||||
initComplete: function(settings){
|
||||
Counter.initTableCounter(this, ['updated:name']);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@@ -357,6 +357,7 @@ define([
|
||||
planetsInfoClass: config.systemInfoPlanetsClass,
|
||||
wormholePrefixClass: config.systemInfoWormholeClass,
|
||||
statusInfoClass: config.systemInfoStatusLabelClass,
|
||||
popoverTriggerClass: Util.config.popoverTriggerClass,
|
||||
|
||||
systemTypeName: MapUtil.getSystemTypeInfo(systemData.type.id, 'name'),
|
||||
systemIsWormhole: MapUtil.getSystemTypeInfo(systemData.type.id, 'name') === 'w-space',
|
||||
@@ -405,6 +406,8 @@ define([
|
||||
// remove xEditable description textarea
|
||||
let descriptionTextareaElement = moduleElement.find('.' + config.descriptionTextareaElementClass);
|
||||
descriptionTextareaElement.editable('destroy');
|
||||
|
||||
moduleElement.destroyPopover(true);
|
||||
};
|
||||
|
||||
return {
|
||||
|
||||
@@ -6,8 +6,9 @@ define([
|
||||
'jquery',
|
||||
'app/init',
|
||||
'app/util',
|
||||
'bootbox'
|
||||
], ($, Init, Util, bootbox) => {
|
||||
'bootbox',
|
||||
'app/counter'
|
||||
], ($, Init, Util, bootbox, Counter) => {
|
||||
'use strict';
|
||||
|
||||
let config = {
|
||||
@@ -113,7 +114,6 @@ define([
|
||||
if(rowData.updated.updated !== structureData.updated.updated){
|
||||
// row data changed -> update
|
||||
api.data(structureData);
|
||||
api.nodes().to$().data('animationStatus', 'changed').destroyTimestampCounter();
|
||||
notificationCounter.changed++;
|
||||
}
|
||||
|
||||
@@ -138,7 +138,13 @@ define([
|
||||
api.remove();
|
||||
}
|
||||
|
||||
context.tableApi.draw();
|
||||
if(
|
||||
notificationCounter.added > 0 ||
|
||||
notificationCounter.changed > 0 ||
|
||||
notificationCounter.deleted > 0
|
||||
){
|
||||
context.tableApi.draw();
|
||||
}
|
||||
|
||||
// show notification ------------------------------------------------------------------------------------------
|
||||
let notification = '';
|
||||
@@ -434,7 +440,7 @@ define([
|
||||
});
|
||||
moduleElement.append(table);
|
||||
|
||||
let structureTable = table.DataTable({
|
||||
let tableApi = table.DataTable({
|
||||
paging: false,
|
||||
lengthChange: false,
|
||||
ordering: true,
|
||||
@@ -456,6 +462,7 @@ define([
|
||||
columnDefs: [
|
||||
{
|
||||
targets: 0,
|
||||
name: 'status',
|
||||
title: '',
|
||||
width: 2,
|
||||
class: 'text-center',
|
||||
@@ -469,6 +476,7 @@ define([
|
||||
}
|
||||
},{
|
||||
targets: 1,
|
||||
name: 'structureImage',
|
||||
title: '',
|
||||
width: 26,
|
||||
orderable: false,
|
||||
@@ -486,6 +494,7 @@ define([
|
||||
}
|
||||
},{
|
||||
targets: 2,
|
||||
name: 'structureType',
|
||||
title: 'type',
|
||||
width: 30,
|
||||
className: [config.tableCellEllipsisClass].join(' '),
|
||||
@@ -493,12 +502,14 @@ define([
|
||||
defaultContent: '<i class="fas fa-question txt-color txt-color-orangeDark"></i>',
|
||||
},{
|
||||
targets: 3,
|
||||
name: 'name',
|
||||
title: 'name',
|
||||
width: 60,
|
||||
className: [config.tableCellEllipsisClass].join(' '),
|
||||
data: 'name'
|
||||
},{
|
||||
targets: 4,
|
||||
name: 'ownerImage',
|
||||
title: '',
|
||||
width: 26,
|
||||
orderable: false,
|
||||
@@ -518,6 +529,7 @@ define([
|
||||
}
|
||||
},{
|
||||
targets: 5,
|
||||
name: 'ownerName',
|
||||
title: 'owner',
|
||||
width: 50,
|
||||
className: [config.tableCellEllipsisClass].join(' '),
|
||||
@@ -525,17 +537,20 @@ define([
|
||||
defaultContent: '<i class="fas fa-question txt-color txt-color-orangeDark"></i>',
|
||||
},{
|
||||
targets: 6,
|
||||
name: 'note',
|
||||
title: 'note',
|
||||
className: [config.tableCellEllipsisClass].join(' '),
|
||||
data: 'description'
|
||||
},{
|
||||
targets: 7,
|
||||
name: 'updated',
|
||||
title: 'updated',
|
||||
width: 60,
|
||||
className: ['text-right', config.tableCellCounterClass].join(' '),
|
||||
className: ['text-right', config.tableCellCounterClass, 'not-screen-l'].join(' '),
|
||||
data: 'updated.updated'
|
||||
},{
|
||||
targets: 8,
|
||||
name: 'edit',
|
||||
title: '',
|
||||
orderable: false,
|
||||
width: 10,
|
||||
@@ -566,6 +581,7 @@ define([
|
||||
}
|
||||
},{
|
||||
targets: 9,
|
||||
name: 'delete',
|
||||
title: '',
|
||||
orderable: false,
|
||||
width: 10,
|
||||
@@ -650,8 +666,6 @@ define([
|
||||
}
|
||||
});
|
||||
|
||||
rows.to$().find('.' + config.tableCellCounterClass + ':not([data-counter])').initTimestampCounter('d');
|
||||
|
||||
let animationRows = rows.to$().filter(function() {
|
||||
return (
|
||||
$(this).data('animationStatus') ||
|
||||
@@ -668,11 +682,20 @@ define([
|
||||
initComplete: function(settings){
|
||||
// table data is load in updateModule() method
|
||||
// -> no need to trigger additional ajax call here for data
|
||||
// -> in case table update failed -> each if this initComplete() function finished before table updata
|
||||
// -> in case table update failed -> each if this initComplete() function finished before table updated
|
||||
// e.g. return now promise in getModule() function
|
||||
|
||||
Counter.initTableCounter(this, ['updated:name'], 'd');
|
||||
}
|
||||
});
|
||||
|
||||
new $.fn.dataTable.Responsive(tableApi);
|
||||
|
||||
tableApi.on('responsive-resize', function(e, tableApi, columns){
|
||||
// rowGroup length changes as well -> trigger draw() updates rowGroup length (see drawCallback())
|
||||
tableApi.draw();
|
||||
});
|
||||
|
||||
// init tooltips for this module
|
||||
let tooltipElements = moduleElement.find('[data-toggle="tooltip"]');
|
||||
tooltipElements.tooltip({
|
||||
|
||||
@@ -1766,9 +1766,9 @@ define([
|
||||
cellIndex[0] = 0; // first column
|
||||
}
|
||||
if(cellIndex[1] < 0){
|
||||
cellIndex[1] = tableApi.row(':last').nodes().to$().index(); // last row
|
||||
cellIndex[1] = tableApi.row(':last', {search: 'applied'}).nodes().to$().index(); // last row
|
||||
}
|
||||
if(cellIndex[1] > tableApi.row(':last').nodes().to$().index()){
|
||||
if(cellIndex[1] > tableApi.row(':last', {search: 'applied'}).nodes().to$().index()){
|
||||
cellIndex[1] = 0; // first row
|
||||
}
|
||||
return cellIndex;
|
||||
@@ -1792,7 +1792,7 @@ define([
|
||||
newCellIndex = checkIndex(tableApi, newCellIndex);
|
||||
|
||||
//let cell = tableApi.cell(newCellIndex[1], newCellIndex[0]);
|
||||
let cell = tableApi.cell(':eq(' + newCellIndex[1] + ')', ':eq(' + newCellIndex[0] + ')');
|
||||
let cell = tableApi.cell(':eq(' + newCellIndex[1] + ')', ':eq(' + newCellIndex[0] + ')', {search: 'applied'});
|
||||
let node = cell.node();
|
||||
|
||||
if(
|
||||
@@ -2008,22 +2008,7 @@ define([
|
||||
keyNavigation(tableApi, e);
|
||||
});
|
||||
|
||||
// init update counter for timestamp columns
|
||||
// mark as init
|
||||
this.attr('data-counter', 'init');
|
||||
let refreshIntervalId = window.setInterval(() => {
|
||||
tableApi.cells(null, ['created:name', 'updated:name']).every(function(rowIndex, colIndex, tableLoopCount, cellLoopCount){
|
||||
let cell = this;
|
||||
let node = cell.node();
|
||||
let data = cell.data();
|
||||
if(data && Number.isInteger(data) && !node.classList.contains('stopCounter')){
|
||||
// timestamp expected int > 0
|
||||
let date = new Date(data * 1000);
|
||||
Counter.updateDateDiff( cell.nodes().to$(), date);
|
||||
}
|
||||
});
|
||||
}, 500);
|
||||
this.data('interval', refreshIntervalId);
|
||||
Counter.initTableCounter(this, ['created:name', 'updated:name']);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -1051,9 +1051,9 @@ define([
|
||||
preventDefault: true
|
||||
},
|
||||
keyboard: {
|
||||
enable: true,
|
||||
enable: false,
|
||||
scrollType: 'stepless',
|
||||
scrollAmount: 20
|
||||
scrollAmount: 'auto'
|
||||
},
|
||||
scrollbarPosition: 'inside',
|
||||
autoDraggerLength: true,
|
||||
|
||||
@@ -10,7 +10,8 @@
|
||||
<td>{{label}}</td>
|
||||
<td class="text-right">
|
||||
{{#keyNames}}
|
||||
<kbd>{{.}}</kbd> <i class="fas fa-fw fa-plus"></i>
|
||||
<kbd>{{.}}</kbd>
|
||||
{{^list}}<i class="fas fa-fw fa-plus"></i>{{/list}}
|
||||
{{/keyNames}}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
<h5><span class="{{systemTypeLinkClass}}" data-toggle="tooltip" data-placement="top" data-container="body" title="type">{{systemTypeName}}</span> <i class="fas fa-fw fa-angle-double-right"></i></h5>
|
||||
<h5><span class="{{systemRegionLinkClass}} {{#systemNameClass}}{{system.security}}{{/systemNameClass}}" data-toggle="tooltip" data-placement="top" data-container="body" title="region">{{system.region.name}}</span> <i class="fas fa-fw fa-angle-double-right"></i></h5>
|
||||
<h5><a href="javascript:void(0);" data-url="{{ajaxConstellationInfoUrl}}/{{system.constellation.id}}" class="{{systemConstellationLinkClass}} popup-ajax {{#systemNameClass}}{{system.security}}{{/systemNameClass}}" title="constellation">{{system.constellation.name}}</a> <i class="fas fa-fw fa-angle-double-right"></i></h5>
|
||||
<h5><a href="javascript:void(0);" data-url="{{ajaxConstellationInfoUrl}}/{{system.constellation.id}}" class="{{systemConstellationLinkClass}} popup-ajax {{popoverTriggerClass}} {{#systemNameClass}}{{system.security}}{{/systemNameClass}}" title="constellation">{{system.constellation.name}}</a> <i class="fas fa-fw fa-angle-double-right"></i></h5>
|
||||
<h5>
|
||||
<span data-toggle="tooltip" data-placement="top" data-container="body" title="system" class="{{#systemNameClass}}{{system.security}}{{/systemNameClass}}">{{system.name}}</span>
|
||||
{{#system.locked}}
|
||||
|
||||
@@ -177,8 +177,11 @@
|
||||
|
||||
// shortcuts dialog ===========================================================
|
||||
#pf-shortcuts-dialog{
|
||||
td kbd:last-of-type{
|
||||
td kbd{
|
||||
& + i {
|
||||
width: 16px;
|
||||
}
|
||||
&:last-of-type + i{
|
||||
display: none
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user