Skip to content

Commit

Permalink
- New delete "linked connection" options added to the "signature tabl…
Browse files Browse the repository at this point in the history
…e", closed exodus4d#803

- Fixed a bug where "signature reader" updates don´t respect changed sig. `groupId` changes, closed exodus4d#838
- Fixed some minor CSS glitches in "modals/popups"
- Upgraded "[_BootboxJS_](http://bootboxjs.com)" js lib `v4.4.0` → `v5.2.0`
- Upgraded "[_hoverIntent_](http://briancherne.github.io/jquery-hoverIntent/)" js lib `v1.9.0` → `v1.10.0`
  • Loading branch information
exodus4d committed Aug 12, 2019
1 parent a69c9f7 commit 70f7501
Show file tree
Hide file tree
Showing 47 changed files with 1,920 additions and 603 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ Mapping tool for [*EVE ONLINE*](https://www.eveonline.com)
- [wiki](https://github.com/exodus4d/pathfinder/wiki)
- Developer [Slack](https://slack.com) chat:
- https://pathfinder-eve-online.slack.com
- Please send me a mail for invite: [email protected]
- Join channel [pathfinder-eve-online.slack.com](https://join.slack.com/t/pathfinder-eve-online/shared_invite/enQtMzMyOTkyMjczMTA3LWI2NGE1OTY5ODBmNDZlMDY3MDIzYjk5ZTljM2JjZjIwNDRkNzMyMTEwMDUzOGQwM2E3ZjE1NGEwNThlMzYzY2Y)
- Can´t join? [email protected]

**Feel free to check the code for bugs and security issues.
Issues should be reported in the [Issue](https://github.com/exodus4d/pathfinder/issues) section.**
Expand Down Expand Up @@ -49,7 +50,7 @@ Issues should be reported in the [Issue](https://github.com/exodus4d/pathfinder/
|-- app.js --> require.js config (!required for production!)
|-- [0777] logs/ --> log files
|-- ...
| -- node_modules/ --> node.js modules (not used for production)
|-- node_modules/ --> node.js modules (not used for production)
|-- ...
|-- [0755] public/ --> frontend source
|-- css/ --> CSS dist/build folder (minified)
Expand Down
17 changes: 16 additions & 1 deletion app/main/controller/api/rest/signature.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public function post(\Base $f3){
$data['groupId'] == 5 ||
$data['typeId'] == 0
){
unset( $data['typeId'] );
unset($data['typeId']);
}

// "sig reader" should not overwrite signature group information
Expand All @@ -65,6 +65,7 @@ public function post(\Base $f3){
$signature->groupId > 0
){
unset($data['groupId']);
unset($data['typeId']);
}
}

Expand All @@ -78,13 +79,20 @@ public function post(\Base $f3){

// delete "old" signatures ----------------------------------------------------------------------------
if((bool)$requestData['deleteOld']){
// if linked ConnectionModels should be deleted as well
$deleteConnectionId = (bool)$requestData['deleteConnection'];

$updatedSignatureIds = array_column($signaturesData, 'id');
$signatures = $system->getSignatures();
foreach($signatures as $signature){
if(!in_array($signature->_id, $updatedSignatureIds)){
// set if potential linked ConnectionModel should be deleted as well
$signature->virtual('connectionIdDeleteCascade', $deleteConnectionId);
if($signature->delete()){
$updateSignaturesHistory = true;
}
// clear temp virtual field as well
$signature->clearVirtual('connectionIdDeleteCascade');
}
}
}
Expand Down Expand Up @@ -190,6 +198,9 @@ public function delete(\Base $f3, $params){
$system->getById($systemId);

if($system->hasAccess($activeCharacter)){
// if linked ConnectionModels should be deleted as well
$deleteConnectionId = (bool)$requestData['deleteConnection'];

// if there is any changed/deleted/updated signature
// -> we need to update signature history data for the system
$updateSignaturesHistory = false;
Expand All @@ -202,11 +213,15 @@ public function delete(\Base $f3, $params){
$signature->getById($signatureId);
// make sure signature belongs to main system (user has access)
if($signature->get('systemId', true) == $systemId){
// set if potential linked ConnectionModel should be deleted as well
$signature->virtual('connectionIdDeleteCascade', $deleteConnectionId);
if($signature->delete()){
$deletedSignatureIds[] = $signatureId;
$updateSignaturesHistory = true;
}
$signature->reset();
// clear temp virtual field as well
$signature->clearVirtual('connectionIdDeleteCascade');
}
}

Expand Down
7 changes: 7 additions & 0 deletions app/main/model/pathfinder/systemsignaturemodel.php
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,13 @@ public function afterUpdateEvent($self, $pkeys){
*/
public function afterEraseEvent($self, $pkeys){
$self->logActivity('signatureDelete');

if(
$self->connectionIdDeleteCascade === true &&
($connection = $self->getConnection())
){
$connection->erase();
}
}

/**
Expand Down
4 changes: 2 additions & 2 deletions js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@ requirejs.config({
xEditable: 'lib/bootstrap-editable.min', // v1.5.1 X-editable - in placed editing
morris: 'lib/morris.min', // v0.5.1 Morris.js - graphs and charts
raphael: 'lib/raphael.min', // v2.2.8 Raphaël - required for morris - https://dmitrybaranovskiy.github.io/raphael
bootbox: 'lib/bootbox.min', // v4.4.0 Bootbox.js - custom dialogs - http://bootboxjs.com
bootbox: 'lib/bootbox.min', // v5.2.0 Bootbox.js - custom dialogs - http://bootboxjs.com
easyPieChart: 'lib/jquery.easypiechart.min', // v2.1.6 Easy Pie Chart - HTML 5 pie charts - http://rendro.github.io/easy-pie-chart
peityInlineChart: 'lib/jquery.peity.min', // v3.2.1 Inline Chart - http://benpickles.github.io/peity/
dragToSelect: 'lib/jquery.dragToSelect', // v1.1 Drag to Select - http://andreaslagerkvist.com/jquery/drag-to-select
hoverIntent: 'lib/jquery.hoverIntent.min', // v1.9.0 Hover intention - http://cherne.net/brian/resources/jquery.hoverIntent.html
hoverIntent: 'lib/jquery.hoverIntent.min', // v1.10.0 Hover intention - http://cherne.net/brian/resources/jquery.hoverIntent.html
select2: 'lib/select2.min', // v4.0.3 Drop Down customization - https://select2.github.io
validator: 'lib/validator.min', // v0.10.1 Validator for Bootstrap 3 - https://github.com/1000hz/bootstrap-validator
lazylinepainter: 'lib/jquery.lazylinepainter-1.5.1.min', // v1.5.1 SVG line animation plugin - http://lazylinepainter.info
Expand Down
1 change: 1 addition & 0 deletions js/app/datatables.loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ define([
table.destroyTimestampCounter(true);
});

// Status Plugin ==============================================================================================
let StatusTable = function(settings){
let me = this;
me.statusContainer = $('<div>', {
Expand Down
7 changes: 3 additions & 4 deletions js/app/login.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,15 +141,14 @@ define([

// show Cookie accept hint on SSO login button
let confirmationSettings = {
container: 'body',
placement: 'bottom',
btnOkClass: 'btn btn-sm btn-default',
btnOkLabel: 'dismiss',
btnOkIcon: 'fas fa-fw fa-sign-in-alt',
title: 'Accept cookies',
btnCancelClass: 'btn btn-sm btn-success',
btnCancelLabel: 'accept',
btnCancelIcon: 'fas fa-fw fa-check',
btnOkClass: 'btn btn-sm btn-default',
btnOkLabel: 'dismiss',
btnOkIcon: 'fas fa-fw fa-sign-in-alt',
onCancel: function(e, target){
// "Accept cookies"
setAcceptCookie();
Expand Down
3 changes: 3 additions & 0 deletions js/app/mappage.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ define([
// set default dialog config
Util.initDefaultBootboxConfig();

// set default confirmation popover config
Util.initDefaultConfirmationConfig();

// set default select2 config
Util.initDefaultSelect2Config();

Expand Down
4 changes: 4 additions & 0 deletions js/app/page.js
Original file line number Diff line number Diff line change
Expand Up @@ -853,6 +853,10 @@ define([
let modalElement = $(e.target);
modalElement.destroyTimestampCounter(true);

// destroy all form validators
// -> does not work properly. validation functions still used (js error) after 'destroy'
//modalElement.find('form').filter((i, form) => $(form).data('bs.validator')).validator('destroy');

// destroy all popovers
modalElement.find('.' + Util.config.popoverTriggerClass).popover('destroy');

Expand Down
4 changes: 1 addition & 3 deletions js/app/summernote.loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,9 @@ define([

// show "discard" changes confirmation
let confirmationSettings = {
container: 'body',
placement: 'top',
btnCancelClass: 'btn btn-sm btn-default',
btnCancelLabel: 'cancel',
title: 'discard changes',
btnCancelIcon: '',
btnOkClass: 'btn btn-sm btn-warning',
btnOkLabel: 'discard',
btnOkIcon: 'fas fa-fw fa-ban',
Expand Down
117 changes: 58 additions & 59 deletions js/app/ui/dialog/map_info.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,18 +56,6 @@ define([
}
};

// confirmation dialog settings (e.g. delete row)
let confirmationSettings = {
container: 'body',
placement: 'left',
btnCancelClass: 'btn btn-sm btn-default',
btnCancelLabel: 'cancel',
btnCancelIcon: 'fas fa-fw fa-ban',
btnOkClass: 'btn btn-sm btn-danger',
btnOkLabel: 'delete',
btnOkIcon: 'fas fa-fw fa-times'
};

/**
* get icon that marks a table cell as clickable
* @returns {string}
Expand Down Expand Up @@ -456,44 +444,49 @@ define([
createdCell: function(cell, cellData, rowData, rowIndex, colIndex){
let tempTableElement = this;

let tempConfirmationSettings = confirmationSettings;
tempConfirmationSettings.title = 'Delete system';
tempConfirmationSettings.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'});
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(tempConfirmationSettings);

$(cell).confirmation(confirmationSettings);
}
}
],
Expand Down Expand Up @@ -652,23 +645,29 @@ define([
createdCell: function(cell, cellData, rowData, rowIndex, colIndex){
let tempTableElement = this;

let tempConfirmationSettings = confirmationSettings;
tempConfirmationSettings.title = 'Delete connection';
tempConfirmationSettings.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();
});
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(tempConfirmationSettings);
$(cell).confirmation(confirmationSettings);
}
}
],
Expand Down
14 changes: 5 additions & 9 deletions js/app/ui/module/connection_info.js
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ define([
html: '<i class="fas fa-fw fa-question-circle"></i>'
}),
$('<td>', {
text: scopeLabel.charAt(0).toUpperCase() + scopeLabel.slice(1)
text: scopeLabel.capitalize()
}),
$('<td>', {
class: ['text-right', config.connectionInfoTableCellConnectionClass].join(' ')
Expand Down Expand Up @@ -883,15 +883,11 @@ define([

if(rowData.active){
let confirmationSettings = {
container: 'body',
placement: 'left',
btnCancelClass: 'btn btn-sm btn-default',
btnCancelLabel: 'cancel',
btnCancelIcon: 'fas fa-fw fa-ban',
title: 'delete jump log',
btnOkClass: 'btn btn-sm btn-danger',
btnOkLabel: 'delete',
btnOkIcon: 'fas fa-fw fa-times',
template: Util.getConfirmationTemplate(null, {
size: 'small',
noTitle: true
}),
onConfirm : function(e, target){
// get current row data (important!)
// -> "rowData" param is not current state, values are "on createCell()" state
Expand Down
12 changes: 4 additions & 8 deletions js/app/ui/module/system_intel.js
Original file line number Diff line number Diff line change
Expand Up @@ -569,15 +569,11 @@ define([
$(cell).find('i').tooltip();
}else{
let confirmationSettings = {
container: 'body',
placement: 'left',
btnCancelClass: 'btn btn-sm btn-default',
btnCancelLabel: 'cancel',
btnCancelIcon: 'fas fa-fw fa-ban',
title: 'delete structure',
btnOkClass: 'btn btn-sm btn-danger',
btnOkLabel: 'delete',
btnOkIcon: 'fas fa-fw fa-times',
template: Util.getConfirmationTemplate(null, {
size: 'small',
noTitle: true
}),
onConfirm : function(e, target){
// get current row data (important!)
// -> "rowData" param is not current state, values are "on createCell()" state
Expand Down
Loading

0 comments on commit 70f7501

Please sign in to comment.