- Fixed some _PHP_ autoloading issues
This commit is contained in:
@@ -202,315 +202,322 @@ define([
|
||||
* @param mapData
|
||||
*/
|
||||
$.fn.initSystemInfoTable = function(mapData){
|
||||
let systemsElement = $(this).empty();
|
||||
let tableApi = Util.getDataTableInstance(config.tableId, mapData.config.id, '', 'systems');
|
||||
|
||||
let systemTable = $('<table>', {
|
||||
id: Util.getTableId(config.tableId, 'systems', mapData.config.id, ''),
|
||||
class: ['compact', 'stripe', 'order-column', 'row-border'].join(' ')
|
||||
});
|
||||
systemsElement.append(systemTable);
|
||||
if(tableApi){
|
||||
tableApi.clear();
|
||||
tableApi.rows.add(mapData.data.systems);
|
||||
tableApi.draw();
|
||||
}else{
|
||||
let systemsElement = $(this);
|
||||
|
||||
systemsElement.showLoadingAnimation(config.loadingOptions);
|
||||
let systemTable = $('<table>', {
|
||||
id: Util.getTableId(config.tableId, 'systems', mapData.config.id, ''),
|
||||
class: ['compact', 'stripe', 'order-column', 'row-border'].join(' ')
|
||||
});
|
||||
systemsElement.append(systemTable);
|
||||
|
||||
systemTable.on('init.dt', function(){
|
||||
systemsElement.hideLoadingAnimation();
|
||||
systemsElement.showLoadingAnimation(config.loadingOptions);
|
||||
|
||||
// init table tooltips
|
||||
let tooltipElements = systemsElement.find('[data-toggle="tooltip"]');
|
||||
tooltipElements.tooltip();
|
||||
});
|
||||
systemTable.on('init.dt', function(){
|
||||
systemsElement.hideLoadingAnimation();
|
||||
|
||||
let systemsDataTable = systemTable.DataTable({
|
||||
pageLength: 20,
|
||||
paging: true,
|
||||
lengthMenu: [[5, 10, 20, 50, -1], [5, 10, 20, 50, 'All']],
|
||||
ordering: true,
|
||||
order: [15, 'desc'],
|
||||
hover: false,
|
||||
data: mapData.data.systems,
|
||||
columnDefs: [],
|
||||
language: {
|
||||
emptyTable: 'Map is empty',
|
||||
zeroRecords: 'No systems found',
|
||||
lengthMenu: 'Show _MENU_ systems',
|
||||
info: 'Showing _START_ to _END_ of _TOTAL_ systems'
|
||||
},
|
||||
columns: [
|
||||
{
|
||||
name: 'type',
|
||||
title: 'type',
|
||||
width: 25,
|
||||
className: ['min-screen-l'].join(' '),
|
||||
data: 'type',
|
||||
render: {
|
||||
_: (cellData, type, rowData, meta) => {
|
||||
return MapUtil.getSystemTypeInfo(cellData.id, 'name');
|
||||
}
|
||||
}
|
||||
},{
|
||||
name: 'security',
|
||||
title: '',
|
||||
width: 1,
|
||||
data: 'security',
|
||||
render: {
|
||||
display: (cellData, type, rowData, meta) => {
|
||||
let securityClass = Util.getSecurityClassForSystem(cellData);
|
||||
return '<span class="' + securityClass + '">' + cellData + '</span>';
|
||||
}
|
||||
}
|
||||
},{
|
||||
name: 'trueSec',
|
||||
title: 'sec',
|
||||
width: 18,
|
||||
className: ['text-center', 'min-screen-l'].join(' '),
|
||||
searchable: false,
|
||||
data: 'trueSec',
|
||||
render: {
|
||||
display: (cellData, type, rowData, meta) => {
|
||||
let systemTrueSecClass = Util.getTrueSecClassForSystem(cellData);
|
||||
return '<span class="' + systemTrueSecClass + '">' + cellData.toFixed(1) + '</span>';
|
||||
}
|
||||
}
|
||||
},{
|
||||
name: 'shattered',
|
||||
title: '<i class="fas fa-chart-pie" title="shattered" data-toggle="tooltip"></i>',
|
||||
width: 10,
|
||||
className: ['text-center', 'min-screen-l'].join(' '),
|
||||
searchable: false,
|
||||
data: 'shattered',
|
||||
render: {
|
||||
display: (cellData, type, rowData, meta) => {
|
||||
let value = '';
|
||||
if(cellData){
|
||||
value = '<i class="fas fa-chart-pie fa-fw ' + Util.getSecurityClassForSystem('SH') + '"></i>';
|
||||
// init table tooltips
|
||||
let tooltipElements = systemsElement.find('[data-toggle="tooltip"]');
|
||||
tooltipElements.tooltip();
|
||||
});
|
||||
|
||||
let systemsDataTable = systemTable.DataTable({
|
||||
pageLength: 20,
|
||||
paging: true,
|
||||
lengthMenu: [[5, 10, 20, 50, -1], [5, 10, 20, 50, 'All']],
|
||||
ordering: true,
|
||||
order: [15, 'desc'],
|
||||
hover: false,
|
||||
data: mapData.data.systems,
|
||||
columnDefs: [],
|
||||
language: {
|
||||
emptyTable: 'Map is empty',
|
||||
zeroRecords: 'No systems found',
|
||||
lengthMenu: 'Show _MENU_ systems',
|
||||
info: 'Showing _START_ to _END_ of _TOTAL_ systems'
|
||||
},
|
||||
columns: [
|
||||
{
|
||||
name: 'type',
|
||||
title: 'type',
|
||||
width: 25,
|
||||
className: ['min-screen-l'].join(' '),
|
||||
data: 'type',
|
||||
render: {
|
||||
_: (cellData, type, rowData, meta) => {
|
||||
return MapUtil.getSystemTypeInfo(cellData.id, 'name');
|
||||
}
|
||||
return value;
|
||||
}
|
||||
}
|
||||
},{
|
||||
name: 'name',
|
||||
title: 'system',
|
||||
data: 'name',
|
||||
className: [config.tableCellLinkClass].join(' '),
|
||||
createdCell: function(cell, cellData, rowData, rowIndex, colIndex){
|
||||
// select system
|
||||
$(cell).on('click', function(e){
|
||||
Util.triggerMenuAction(Util.getMapModule().getActiveMap(), 'SelectSystem', {systemId: rowData.id});
|
||||
});
|
||||
}
|
||||
},{
|
||||
name: 'alias',
|
||||
title: 'alias',
|
||||
data: 'alias',
|
||||
render: {
|
||||
_: (cellData, type, rowData, meta) => {
|
||||
return (cellData === rowData.name) ? '' : cellData;
|
||||
}
|
||||
}
|
||||
},{
|
||||
name: 'region',
|
||||
title: 'region',
|
||||
data: 'region.name',
|
||||
className: 'min-screen-l',
|
||||
},{
|
||||
name: 'sovereignty',
|
||||
title: 'sov.',
|
||||
width: 30,
|
||||
className: 'text-center',
|
||||
data: 'sovereignty.alliance.ticker',
|
||||
defaultContent: '',
|
||||
render: {
|
||||
display: (cellData, type, rowData, meta) => {
|
||||
let value = '';
|
||||
if(cellData){
|
||||
value = '<' + cellData + '>';
|
||||
},{
|
||||
name: 'security',
|
||||
title: '',
|
||||
width: 1,
|
||||
data: 'security',
|
||||
render: {
|
||||
display: (cellData, type, rowData, meta) => {
|
||||
let securityClass = Util.getSecurityClassForSystem(cellData);
|
||||
return '<span class="' + securityClass + '">' + cellData + '</span>';
|
||||
}
|
||||
return value;
|
||||
}
|
||||
}
|
||||
},{
|
||||
name: 'planets',
|
||||
title: '<i class="fas fa-circle" title="planets" data-toggle="tooltip"></i>',
|
||||
width: 10,
|
||||
className: ['text-right', config.systemInfoPlanetsClass, Util.config.helpDefaultClass, Util.config.popoverTriggerClass].join(' '),
|
||||
searchable: false,
|
||||
orderSequence: ['desc', 'asc'],
|
||||
data: 'planets',
|
||||
render: {
|
||||
_: (cellData, type, rowData, meta) => {
|
||||
return cellData.length;
|
||||
}
|
||||
}
|
||||
},{
|
||||
name: 'status',
|
||||
title: '<i class="far fa-square" title="system status" data-toggle="tooltip"></i>',
|
||||
width: 10,
|
||||
className: 'text-center',
|
||||
searchable: false,
|
||||
data: 'status.id',
|
||||
render: {
|
||||
display: (cellData, type, rowData, meta) => {
|
||||
let value = '';
|
||||
let systemStatusClass = Util.getStatusInfoForSystem(cellData, 'class');
|
||||
if(systemStatusClass !== ''){
|
||||
value = '<i class="far fa-square fa-fw ' + systemStatusClass + '"></i>';
|
||||
},{
|
||||
name: 'trueSec',
|
||||
title: 'sec',
|
||||
width: 18,
|
||||
className: ['text-center', 'min-screen-l'].join(' '),
|
||||
searchable: false,
|
||||
data: 'trueSec',
|
||||
render: {
|
||||
display: (cellData, type, rowData, meta) => {
|
||||
let systemTrueSecClass = Util.getTrueSecClassForSystem(cellData);
|
||||
return '<span class="' + systemTrueSecClass + '">' + cellData.toFixed(1) + '</span>';
|
||||
}
|
||||
return value;
|
||||
}
|
||||
}
|
||||
},{
|
||||
name: 'effect',
|
||||
title: '<i class="fas fa-square" title="system effect" data-toggle="tooltip"></i>',
|
||||
width: 10,
|
||||
className: 'text-center',
|
||||
searchable: false,
|
||||
data: 'effect',
|
||||
render: {
|
||||
display: (cellData, type, rowData, meta) => {
|
||||
let value = '';
|
||||
let systemEffectClass = MapUtil.getEffectInfoForSystem(cellData, 'class');
|
||||
if(systemEffectClass !== ''){
|
||||
value = '<i class="fas fa-square fa-fw ' + systemEffectClass + '"></i>';
|
||||
}
|
||||
return value;
|
||||
}
|
||||
}
|
||||
},{
|
||||
name: 'statics',
|
||||
title: 'statics',
|
||||
width: 30,
|
||||
searchable: false,
|
||||
data: 'statics',
|
||||
render: {
|
||||
_: (cellData, type, rowData, meta) => {
|
||||
let statics = [];
|
||||
for(let wormholeName of cellData){
|
||||
let wormholeData = Object.assign({}, Init.wormholes[wormholeName]);
|
||||
statics.push('<span class="' + wormholeData.class + '">' + wormholeData.security + '</span>');
|
||||
}
|
||||
return statics.join(' ');
|
||||
}
|
||||
}
|
||||
},{
|
||||
name: 'position',
|
||||
title: '<i class="fas fa-map-marker-alt" title="your position" data-toggle="tooltip"></i>',
|
||||
width: 8,
|
||||
className: 'text-center',
|
||||
searchable: false,
|
||||
data: 'currentUser',
|
||||
defaultContent: false,
|
||||
render: {
|
||||
display: (cellData, type, rowData, meta) => {
|
||||
let value = '';
|
||||
if(cellData === true){
|
||||
value = '<i class="fas fa-map-marker-alt fa-fw"></i>';
|
||||
}
|
||||
return value;
|
||||
}
|
||||
}
|
||||
},{
|
||||
name: 'userCount',
|
||||
title: '<i class="fas fa-plane" title="active pilots" data-toggle="tooltip"></i>',
|
||||
width: 12,
|
||||
className: 'text-center',
|
||||
searchable: false,
|
||||
data: 'userCount',
|
||||
render: {
|
||||
display: (cellData, type, rowData, meta) => {
|
||||
let value = '';
|
||||
if(cellData > 0){
|
||||
value = cellData;
|
||||
}
|
||||
return value;
|
||||
}
|
||||
}
|
||||
},{
|
||||
name: 'locked',
|
||||
title: '<i class="fas fa-lock" title="system locked" data-toggle="tooltip"></i>',
|
||||
width: 10,
|
||||
className: 'text-center',
|
||||
searchable: false,
|
||||
data: 'locked',
|
||||
render: {
|
||||
display: (cellData, type, rowData, meta) => {
|
||||
let value = '';
|
||||
if(cellData === 1){
|
||||
value = '<i class="fas fa-lock fa-fw"></i>';
|
||||
}
|
||||
return value;
|
||||
}
|
||||
}
|
||||
},{
|
||||
name: 'updated',
|
||||
title: 'updated',
|
||||
width: 80,
|
||||
searchable: false,
|
||||
className: ['text-right', config.tableCellCounterClass].join(' '),
|
||||
data: 'updated.updated',
|
||||
defaultContent: '',
|
||||
},{
|
||||
name: 'action',
|
||||
title: '',
|
||||
orderable: false,
|
||||
searchable: false,
|
||||
width: 10,
|
||||
className: ['text-center', config.tableCellActionClass].join(' '),
|
||||
data: null,
|
||||
defaultContent: '<i class="fas fa-times txt-color txt-color-redDark"></i>',
|
||||
createdCell: function(cell, cellData, rowData, rowIndex, colIndex){
|
||||
let tempTableElement = this;
|
||||
|
||||
let confirmationSettings = {
|
||||
placement: 'left',
|
||||
title: 'Delete system',
|
||||
template: Util.getConfirmationTemplate(null, {
|
||||
size: 'small',
|
||||
noTitle: true
|
||||
}),
|
||||
onConfirm: function(e, target){
|
||||
let deleteRowElement = $(target).parents('tr');
|
||||
|
||||
let activeMap = Util.getMapModule().getActiveMap();
|
||||
let systemElement = $('#' + MapUtil.getSystemId(mapData.config.id, rowData.id) );
|
||||
|
||||
if(systemElement.length){
|
||||
// trigger system delete event
|
||||
activeMap.trigger('pf:deleteSystems', [{
|
||||
systems: [systemElement[0]],
|
||||
callback: function(deletedSystems){
|
||||
// callback function after ajax "delete" success
|
||||
// check if system was deleted
|
||||
if(deletedSystems.length === 1){
|
||||
// remove table row
|
||||
tempTableElement.DataTable().rows(deleteRowElement).remove().draw();
|
||||
|
||||
Util.showNotify({title: 'System deleted', text: rowData.name, type: 'success'});
|
||||
|
||||
// refresh connection table (connections might have changed) --------------
|
||||
let connectionsElement = $('#' + config.mapInfoConnectionsId);
|
||||
let mapDataNew = activeMap.getMapDataFromClient(['hasId']);
|
||||
|
||||
connectionsElement.initConnectionInfoTable(mapDataNew);
|
||||
}else{
|
||||
// error
|
||||
Util.showNotify({title: 'Failed to delete system', text: rowData.name, type: 'error'});
|
||||
}
|
||||
}
|
||||
}]);
|
||||
},{
|
||||
name: 'shattered',
|
||||
title: '<i class="fas fa-chart-pie" title="shattered" data-toggle="tooltip"></i>',
|
||||
width: 10,
|
||||
className: ['text-center', 'min-screen-l'].join(' '),
|
||||
searchable: false,
|
||||
data: 'shattered',
|
||||
render: {
|
||||
display: (cellData, type, rowData, meta) => {
|
||||
let value = '';
|
||||
if(cellData){
|
||||
value = '<i class="fas fa-chart-pie fa-fw ' + Util.getSecurityClassForSystem('SH') + '"></i>';
|
||||
}
|
||||
return value;
|
||||
}
|
||||
};
|
||||
}
|
||||
},{
|
||||
name: 'name',
|
||||
title: 'system',
|
||||
data: 'name',
|
||||
className: [config.tableCellLinkClass].join(' '),
|
||||
createdCell: function(cell, cellData, rowData, rowIndex, colIndex){
|
||||
// select system
|
||||
$(cell).on('click', function(e){
|
||||
Util.triggerMenuAction(Util.getMapModule().getActiveMap(), 'SelectSystem', {systemId: rowData.id});
|
||||
});
|
||||
}
|
||||
},{
|
||||
name: 'alias',
|
||||
title: 'alias',
|
||||
data: 'alias',
|
||||
render: {
|
||||
_: (cellData, type, rowData, meta) => {
|
||||
return (cellData === rowData.name) ? '' : cellData;
|
||||
}
|
||||
}
|
||||
},{
|
||||
name: 'region',
|
||||
title: 'region',
|
||||
data: 'region.name',
|
||||
className: 'min-screen-l',
|
||||
},{
|
||||
name: 'sovereignty',
|
||||
title: 'sov.',
|
||||
width: 30,
|
||||
className: 'text-center',
|
||||
data: 'sovereignty.alliance.ticker',
|
||||
defaultContent: '',
|
||||
render: {
|
||||
display: (cellData, type, rowData, meta) => {
|
||||
let value = '';
|
||||
if(cellData){
|
||||
value = '<' + cellData + '>';
|
||||
}
|
||||
return value;
|
||||
}
|
||||
}
|
||||
},{
|
||||
name: 'planets',
|
||||
title: '<i class="fas fa-circle" title="planets" data-toggle="tooltip"></i>',
|
||||
width: 10,
|
||||
className: ['text-right', config.systemInfoPlanetsClass, Util.config.helpDefaultClass, Util.config.popoverTriggerClass].join(' '),
|
||||
searchable: false,
|
||||
orderSequence: ['desc', 'asc'],
|
||||
data: 'planets',
|
||||
render: {
|
||||
_: (cellData, type, rowData, meta) => {
|
||||
return cellData.length;
|
||||
}
|
||||
}
|
||||
},{
|
||||
name: 'status',
|
||||
title: '<i class="far fa-square" title="system status" data-toggle="tooltip"></i>',
|
||||
width: 10,
|
||||
className: 'text-center',
|
||||
searchable: false,
|
||||
data: 'status.id',
|
||||
render: {
|
||||
display: (cellData, type, rowData, meta) => {
|
||||
let value = '';
|
||||
let systemStatusClass = Util.getStatusInfoForSystem(cellData, 'class');
|
||||
if(systemStatusClass !== ''){
|
||||
value = '<i class="far fa-square fa-fw ' + systemStatusClass + '"></i>';
|
||||
}
|
||||
return value;
|
||||
}
|
||||
}
|
||||
},{
|
||||
name: 'effect',
|
||||
title: '<i class="fas fa-square" title="system effect" data-toggle="tooltip"></i>',
|
||||
width: 10,
|
||||
className: 'text-center',
|
||||
searchable: false,
|
||||
data: 'effect',
|
||||
render: {
|
||||
display: (cellData, type, rowData, meta) => {
|
||||
let value = '';
|
||||
let systemEffectClass = MapUtil.getEffectInfoForSystem(cellData, 'class');
|
||||
if(systemEffectClass !== ''){
|
||||
value = '<i class="fas fa-square fa-fw ' + systemEffectClass + '"></i>';
|
||||
}
|
||||
return value;
|
||||
}
|
||||
}
|
||||
},{
|
||||
name: 'statics',
|
||||
title: 'statics',
|
||||
width: 30,
|
||||
searchable: false,
|
||||
data: 'statics',
|
||||
render: {
|
||||
_: (cellData, type, rowData, meta) => {
|
||||
let statics = [];
|
||||
for(let wormholeName of cellData){
|
||||
let wormholeData = Object.assign({}, Init.wormholes[wormholeName]);
|
||||
statics.push('<span class="' + wormholeData.class + '">' + wormholeData.security + '</span>');
|
||||
}
|
||||
return statics.join(' ');
|
||||
}
|
||||
}
|
||||
},{
|
||||
name: 'position',
|
||||
title: '<i class="fas fa-map-marker-alt" title="your position" data-toggle="tooltip"></i>',
|
||||
width: 8,
|
||||
className: 'text-center',
|
||||
searchable: false,
|
||||
data: 'currentUser',
|
||||
defaultContent: false,
|
||||
render: {
|
||||
display: (cellData, type, rowData, meta) => {
|
||||
let value = '';
|
||||
if(cellData === true){
|
||||
value = '<i class="fas fa-map-marker-alt fa-fw"></i>';
|
||||
}
|
||||
return value;
|
||||
}
|
||||
}
|
||||
},{
|
||||
name: 'userCount',
|
||||
title: '<i class="fas fa-plane" title="active pilots" data-toggle="tooltip"></i>',
|
||||
width: 12,
|
||||
className: 'text-center',
|
||||
searchable: false,
|
||||
data: 'userCount',
|
||||
render: {
|
||||
display: (cellData, type, rowData, meta) => {
|
||||
let value = '';
|
||||
if(cellData > 0){
|
||||
value = cellData;
|
||||
}
|
||||
return value;
|
||||
}
|
||||
}
|
||||
},{
|
||||
name: 'locked',
|
||||
title: '<i class="fas fa-lock" title="system locked" data-toggle="tooltip"></i>',
|
||||
width: 10,
|
||||
className: 'text-center',
|
||||
searchable: false,
|
||||
data: 'locked',
|
||||
render: {
|
||||
display: (cellData, type, rowData, meta) => {
|
||||
let value = '';
|
||||
if(cellData === 1){
|
||||
value = '<i class="fas fa-lock fa-fw"></i>';
|
||||
}
|
||||
return value;
|
||||
}
|
||||
}
|
||||
},{
|
||||
name: 'updated',
|
||||
title: 'updated',
|
||||
width: 80,
|
||||
searchable: false,
|
||||
className: ['text-right', config.tableCellCounterClass].join(' '),
|
||||
data: 'updated.updated',
|
||||
defaultContent: '',
|
||||
},{
|
||||
name: 'action',
|
||||
title: '',
|
||||
orderable: false,
|
||||
searchable: false,
|
||||
width: 10,
|
||||
className: ['text-center', config.tableCellActionClass].join(' '),
|
||||
data: null,
|
||||
defaultContent: '<i class="fas fa-times txt-color txt-color-redDark"></i>',
|
||||
createdCell: function(cell, cellData, rowData, rowIndex, colIndex){
|
||||
let tempTableElement = this;
|
||||
|
||||
// init confirmation dialog
|
||||
$(cell).confirmation(confirmationSettings);
|
||||
let confirmationSettings = {
|
||||
placement: 'left',
|
||||
title: 'Delete system',
|
||||
template: Util.getConfirmationTemplate(null, {
|
||||
size: 'small',
|
||||
noTitle: true
|
||||
}),
|
||||
onConfirm: function(e, target){
|
||||
let deleteRowElement = $(target).parents('tr');
|
||||
|
||||
let activeMap = Util.getMapModule().getActiveMap();
|
||||
let systemElement = $('#' + MapUtil.getSystemId(mapData.config.id, rowData.id) );
|
||||
|
||||
if(systemElement.length){
|
||||
// trigger system delete event
|
||||
activeMap.trigger('pf:deleteSystems', [{
|
||||
systems: [systemElement[0]],
|
||||
callback: function(deletedSystems){
|
||||
// callback function after ajax "delete" success
|
||||
// check if system was deleted
|
||||
if(deletedSystems.length === 1){
|
||||
// remove table row
|
||||
tempTableElement.DataTable().rows(deleteRowElement).remove().draw();
|
||||
|
||||
Util.showNotify({title: 'System deleted', text: rowData.name, type: 'success'});
|
||||
|
||||
// refresh connection table (connections might have changed) --------------
|
||||
let connectionsElement = $('#' + config.mapInfoConnectionsId);
|
||||
let mapDataNew = activeMap.getMapDataFromClient(['hasId']);
|
||||
|
||||
connectionsElement.initConnectionInfoTable(mapDataNew);
|
||||
}else{
|
||||
// error
|
||||
Util.showNotify({title: 'Failed to delete system', text: rowData.name, type: 'error'});
|
||||
}
|
||||
}
|
||||
}]);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// init confirmation dialog
|
||||
$(cell).confirmation(confirmationSettings);
|
||||
}
|
||||
}
|
||||
],
|
||||
initComplete: function(settings){
|
||||
Counter.initTableCounter(this, ['updated:name']);
|
||||
}
|
||||
],
|
||||
initComplete: function(settings){
|
||||
Counter.initTableCounter(this, ['updated:name']);
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -518,179 +525,188 @@ define([
|
||||
* @param mapData
|
||||
*/
|
||||
$.fn.initConnectionInfoTable = function(mapData){
|
||||
let connectionsElement = $(this).empty();
|
||||
let tableApi = Util.getDataTableInstance(config.tableId, mapData.config.id, '', 'connections');
|
||||
|
||||
let connectionTable = $('<table>', {
|
||||
class: ['compact', 'stripe', 'order-column', 'row-border'].join(' ')
|
||||
});
|
||||
connectionsElement.append(connectionTable);
|
||||
if(tableApi){
|
||||
tableApi.clear();
|
||||
tableApi.rows.add(mapData.data.connections);
|
||||
tableApi.draw();
|
||||
}else{
|
||||
let connectionsElement = $(this);
|
||||
|
||||
connectionsElement.showLoadingAnimation(config.loadingOptions);
|
||||
let connectionTable = $('<table>', {
|
||||
id: Util.getTableId(config.tableId, 'connections', mapData.config.id, ''),
|
||||
class: ['compact', 'stripe', 'order-column', 'row-border'].join(' ')
|
||||
});
|
||||
connectionsElement.append(connectionTable);
|
||||
|
||||
// table init complete
|
||||
connectionTable.on('init.dt', function(){
|
||||
connectionsElement.hideLoadingAnimation();
|
||||
connectionsElement.showLoadingAnimation(config.loadingOptions);
|
||||
|
||||
// init table tooltips
|
||||
let tooltipElements = connectionsElement.find('[data-toggle="tooltip"]');
|
||||
tooltipElements.tooltip();
|
||||
});
|
||||
// table init complete
|
||||
connectionTable.on('init.dt', function(){
|
||||
connectionsElement.hideLoadingAnimation();
|
||||
|
||||
// connections table ------------------------------------------------------------------------------------------
|
||||
let connectionDataTable = connectionTable.dataTable({
|
||||
pageLength: 20,
|
||||
paging: true,
|
||||
lengthMenu: [[5, 10, 20, 50, -1], [5, 10, 20, 50, 'All']],
|
||||
ordering: true,
|
||||
order: [ 6, 'desc' ],
|
||||
autoWidth: false,
|
||||
hover: false,
|
||||
data: mapData.data.connections,
|
||||
columnDefs: [],
|
||||
language: {
|
||||
emptyTable: 'No connections',
|
||||
zeroRecords: 'No connections found',
|
||||
lengthMenu: 'Show _MENU_ connections',
|
||||
info: 'Showing _START_ to _END_ of _TOTAL_ connections'
|
||||
},
|
||||
columns: [
|
||||
{
|
||||
name: 'scope',
|
||||
title: 'scope',
|
||||
width: 50,
|
||||
orderable: true,
|
||||
data: 'scope',
|
||||
render: {
|
||||
display: (cellData, type, rowData, meta) => {
|
||||
return MapUtil.getScopeInfoForConnection(cellData, 'label');
|
||||
}
|
||||
}
|
||||
},{
|
||||
name: 'sourceName',
|
||||
title: 'source system',
|
||||
data: 'sourceName',
|
||||
className: [config.tableCellLinkClass].join(' '),
|
||||
createdCell: function(cell, cellData, rowData, rowIndex, colIndex){
|
||||
// select system
|
||||
$(cell).on('click', function(e){
|
||||
Util.triggerMenuAction(Util.getMapModule().getActiveMap(), 'SelectSystem', {systemId: rowData.source});
|
||||
});
|
||||
}
|
||||
},{
|
||||
name: 'sourceBubble',
|
||||
title: '<i class="fas fa-globe" title="bubbled" data-toggle="tooltip"></i>',
|
||||
width: 10,
|
||||
data: 'endpoints.source',
|
||||
className: 'text-right',
|
||||
render: {
|
||||
display: (cellData, type, rowData, meta) => {
|
||||
let value = '';
|
||||
if(cellData.types.includes('bubble')){
|
||||
value = '<span class="pf-endpoint-bubble"></span>';
|
||||
}
|
||||
return value;
|
||||
}
|
||||
}
|
||||
},{
|
||||
name: 'connection',
|
||||
title: 'connection',
|
||||
width: 80,
|
||||
className: 'text-center',
|
||||
orderable: false,
|
||||
searchable: false,
|
||||
data: 'type',
|
||||
render: {
|
||||
display: (cellData, type, rowData, meta) => {
|
||||
let connectionClasses = MapUtil.getConnectionFakeClassesByTypes(cellData);
|
||||
connectionClasses = connectionClasses.join(' ');
|
||||
return '<div class="' + connectionClasses + '"></div>';
|
||||
}
|
||||
}
|
||||
},{
|
||||
name: 'targetBubble',
|
||||
title: '<i class="fas fa-globe" title="bubbled" data-toggle="tooltip"></i>',
|
||||
width: 10,
|
||||
data: 'endpoints.target',
|
||||
className: 'text-left',
|
||||
render: {
|
||||
display: (cellData, type, rowData, meta) => {
|
||||
let value = '';
|
||||
if(cellData.types.includes('bubble')){
|
||||
value = '<span class="pf-endpoint-bubble"></span>';
|
||||
}
|
||||
return value;
|
||||
}
|
||||
}
|
||||
},{
|
||||
name: 'targetName',
|
||||
title: 'target system',
|
||||
data: 'targetName',
|
||||
className: [config.tableCellLinkClass].join(' '),
|
||||
createdCell: function(cell, cellData, rowData, rowIndex, colIndex){
|
||||
// select system
|
||||
$(cell).on('click', function(e){
|
||||
Util.triggerMenuAction(Util.getMapModule().getActiveMap(), 'SelectSystem', {systemId: rowData.target});
|
||||
});
|
||||
}
|
||||
},{
|
||||
name: 'updated',
|
||||
title: 'updated',
|
||||
width: 80,
|
||||
searchable: false,
|
||||
className: ['text-right', config.tableCellCounterClass].join(' '),
|
||||
data: 'updated',
|
||||
createdCell: function(cell, cellData, rowData, rowIndex, colIndex){
|
||||
if(rowData.scope.scope_sort === 'wh'){
|
||||
// highlight cell
|
||||
let diff = new Date().getTime() - cellData * 1000;
|
||||
let dateDiff = new Date(diff);
|
||||
if(dateDiff.getUTCDate() > 1){
|
||||
$(cell).addClass('txt-color txt-color-warning');
|
||||
// init table tooltips
|
||||
let tooltipElements = connectionsElement.find('[data-toggle="tooltip"]');
|
||||
tooltipElements.tooltip();
|
||||
});
|
||||
|
||||
// connections table ------------------------------------------------------------------------------------------
|
||||
let connectionDataTable = connectionTable.dataTable({
|
||||
pageLength: 20,
|
||||
paging: true,
|
||||
lengthMenu: [[5, 10, 20, 50, -1], [5, 10, 20, 50, 'All']],
|
||||
ordering: true,
|
||||
order: [ 6, 'desc' ],
|
||||
autoWidth: false,
|
||||
hover: false,
|
||||
data: mapData.data.connections,
|
||||
columnDefs: [],
|
||||
language: {
|
||||
emptyTable: 'No connections',
|
||||
zeroRecords: 'No connections found',
|
||||
lengthMenu: 'Show _MENU_ connections',
|
||||
info: 'Showing _START_ to _END_ of _TOTAL_ connections'
|
||||
},
|
||||
columns: [
|
||||
{
|
||||
name: 'scope',
|
||||
title: 'scope',
|
||||
width: 50,
|
||||
orderable: true,
|
||||
data: 'scope',
|
||||
render: {
|
||||
display: (cellData, type, rowData, meta) => {
|
||||
return MapUtil.getScopeInfoForConnection(cellData, 'label');
|
||||
}
|
||||
}
|
||||
}
|
||||
},{
|
||||
name: 'action',
|
||||
title: '',
|
||||
orderable: false,
|
||||
searchable: false,
|
||||
width: 10,
|
||||
className: ['text-center', config.tableCellActionClass].join(' '),
|
||||
data: null,
|
||||
defaultContent: '<i class="fas fa-times txt-color txt-color-redDark"></i>',
|
||||
createdCell: function(cell, cellData, rowData, rowIndex, colIndex){
|
||||
let tempTableElement = this;
|
||||
|
||||
let confirmationSettings = {
|
||||
placement: 'left',
|
||||
title: 'Delete connection',
|
||||
template: Util.getConfirmationTemplate(null, {
|
||||
size: 'small',
|
||||
noTitle: true
|
||||
}),
|
||||
onConfirm: function(e, target){
|
||||
let deleteRowElement = $(target).parents('tr');
|
||||
|
||||
// deleteSignatures(row);
|
||||
let connection = $().getConnectionById(mapData.config.id, rowData.id);
|
||||
|
||||
MapUtil.deleteConnections([connection], () => {
|
||||
// callback function after ajax "delete" success
|
||||
// remove table row
|
||||
tempTableElement.DataTable().rows(deleteRowElement).remove().draw();
|
||||
});
|
||||
},{
|
||||
name: 'sourceName',
|
||||
title: 'source system',
|
||||
data: 'sourceName',
|
||||
className: [config.tableCellLinkClass].join(' '),
|
||||
createdCell: function(cell, cellData, rowData, rowIndex, colIndex){
|
||||
// select system
|
||||
$(cell).on('click', function(e){
|
||||
Util.triggerMenuAction(Util.getMapModule().getActiveMap(), 'SelectSystem', {systemId: rowData.source});
|
||||
});
|
||||
}
|
||||
},{
|
||||
name: 'sourceBubble',
|
||||
title: '<i class="fas fa-globe" title="bubbled" data-toggle="tooltip"></i>',
|
||||
width: 10,
|
||||
data: 'endpoints.source',
|
||||
className: 'text-right',
|
||||
render: {
|
||||
display: (cellData, type, rowData, meta) => {
|
||||
let value = '';
|
||||
if(cellData.types.includes('bubble')){
|
||||
value = '<span class="pf-endpoint-bubble"></span>';
|
||||
}
|
||||
return value;
|
||||
}
|
||||
};
|
||||
}
|
||||
},{
|
||||
name: 'connection',
|
||||
title: 'connection',
|
||||
width: 80,
|
||||
className: 'text-center',
|
||||
orderable: false,
|
||||
searchable: false,
|
||||
data: 'type',
|
||||
render: {
|
||||
display: (cellData, type, rowData, meta) => {
|
||||
let connectionClasses = MapUtil.getConnectionFakeClassesByTypes(cellData);
|
||||
connectionClasses = connectionClasses.join(' ');
|
||||
return '<div class="' + connectionClasses + '"></div>';
|
||||
}
|
||||
}
|
||||
},{
|
||||
name: 'targetBubble',
|
||||
title: '<i class="fas fa-globe" title="bubbled" data-toggle="tooltip"></i>',
|
||||
width: 10,
|
||||
data: 'endpoints.target',
|
||||
className: 'text-left',
|
||||
render: {
|
||||
display: (cellData, type, rowData, meta) => {
|
||||
let value = '';
|
||||
if(cellData.types.includes('bubble')){
|
||||
value = '<span class="pf-endpoint-bubble"></span>';
|
||||
}
|
||||
return value;
|
||||
}
|
||||
}
|
||||
},{
|
||||
name: 'targetName',
|
||||
title: 'target system',
|
||||
data: 'targetName',
|
||||
className: [config.tableCellLinkClass].join(' '),
|
||||
createdCell: function(cell, cellData, rowData, rowIndex, colIndex){
|
||||
// select system
|
||||
$(cell).on('click', function(e){
|
||||
Util.triggerMenuAction(Util.getMapModule().getActiveMap(), 'SelectSystem', {systemId: rowData.target});
|
||||
});
|
||||
}
|
||||
},{
|
||||
name: 'updated',
|
||||
title: 'updated',
|
||||
width: 80,
|
||||
searchable: false,
|
||||
className: ['text-right', config.tableCellCounterClass].join(' '),
|
||||
data: 'updated',
|
||||
createdCell: function(cell, cellData, rowData, rowIndex, colIndex){
|
||||
if(rowData.scope.scope_sort === 'wh'){
|
||||
// highlight cell
|
||||
let diff = new Date().getTime() - cellData * 1000;
|
||||
let dateDiff = new Date(diff);
|
||||
if(dateDiff.getUTCDate() > 1){
|
||||
$(cell).addClass('txt-color txt-color-warning');
|
||||
}
|
||||
}
|
||||
}
|
||||
},{
|
||||
name: 'action',
|
||||
title: '',
|
||||
orderable: false,
|
||||
searchable: false,
|
||||
width: 10,
|
||||
className: ['text-center', config.tableCellActionClass].join(' '),
|
||||
data: null,
|
||||
defaultContent: '<i class="fas fa-times txt-color txt-color-redDark"></i>',
|
||||
createdCell: function(cell, cellData, rowData, rowIndex, colIndex){
|
||||
let tempTableElement = this;
|
||||
|
||||
// init confirmation dialog
|
||||
$(cell).confirmation(confirmationSettings);
|
||||
let confirmationSettings = {
|
||||
placement: 'left',
|
||||
title: 'Delete connection',
|
||||
template: Util.getConfirmationTemplate(null, {
|
||||
size: 'small',
|
||||
noTitle: true
|
||||
}),
|
||||
onConfirm: function(e, target){
|
||||
let deleteRowElement = $(target).parents('tr');
|
||||
|
||||
// deleteSignatures(row);
|
||||
let connection = $().getConnectionById(mapData.config.id, rowData.id);
|
||||
|
||||
MapUtil.deleteConnections([connection], () => {
|
||||
// callback function after ajax "delete" success
|
||||
// remove table row
|
||||
tempTableElement.DataTable().rows(deleteRowElement).remove().draw();
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
// init confirmation dialog
|
||||
$(cell).confirmation(confirmationSettings);
|
||||
}
|
||||
}
|
||||
],
|
||||
initComplete: function(settings){
|
||||
Counter.initTableCounter(this, ['updated:name']);
|
||||
}
|
||||
],
|
||||
initComplete: function(settings){
|
||||
Counter.initTableCounter(this, ['updated:name']);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -22,11 +22,13 @@ define([
|
||||
dialogMapDownloadContainerId: 'pf-map-dialog-download', // id for the "download" container
|
||||
|
||||
// new map form
|
||||
newNameInputId: 'pf-map-dialog-new-name-input', // id for "name" input
|
||||
newIconSelectId: 'pf-map-dialog-new-icon-select', // id for "icon" select
|
||||
newScopeSelectId: 'pf-map-dialog-new-scope-select', // id for "scope" select
|
||||
newTypeSelectId: 'pf-map-dialog-new-type-select', // id for "type" select
|
||||
|
||||
// edit map form
|
||||
editNameInputId: 'pf-map-dialog-edit-name-input', // id for "name" input
|
||||
editIconSelectId: 'pf-map-dialog-edit-icon-select', // id for "icon" select
|
||||
editScopeSelectId: 'pf-map-dialog-edit-scope-select', // id for "scope" select
|
||||
editTypeSelectId: 'pf-map-dialog-edit-type-select', // id for "type" select
|
||||
@@ -136,6 +138,7 @@ define([
|
||||
// render "new map" tab content -----------------------------------------------------------------------
|
||||
let mapFormDataNew = $.extend({}, mapFormData, {
|
||||
hasRightMapForm: hasRightMapCreate,
|
||||
nameInputId: config.newNameInputId,
|
||||
iconSelectId: config.newIconSelectId,
|
||||
scopeSelectId: config.newScopeSelectId,
|
||||
typeSelectId: config.newTypeSelectId
|
||||
@@ -145,6 +148,7 @@ define([
|
||||
// render "edit map" tab content ----------------------------------------------------------------------
|
||||
let mapFormDataEdit = $.extend({}, mapFormData, {
|
||||
hasRightMapForm: hasRightMapUpdate,
|
||||
nameInputId: config.editNameInputId,
|
||||
iconSelectId: config.editIconSelectId,
|
||||
scopeSelectId: config.editScopeSelectId,
|
||||
typeSelectId: config.editTypeSelectId
|
||||
|
||||
Reference in New Issue
Block a user