- performance optimizations for "/api/signature/save" endpoint
- upgraded "jQuery" JS lib `v3.1.1` -> `v3.3.1`
This commit is contained in:
@@ -56,8 +56,10 @@ class Connection extends Controller\AccessController {
|
||||
$connection = Model\BasicModel::getNew('ConnectionModel');
|
||||
$connection->getById( (int)$connectionData['id'] );
|
||||
|
||||
$connectionData['mapId'] = $map;
|
||||
$connection->setData($connectionData);
|
||||
$connection->mapId = $map;
|
||||
$connection->source = $source;
|
||||
$connection->target = $target;
|
||||
$connection->copyfrom($connectionData, ['scope', 'type']);
|
||||
|
||||
// change the default type for the new connection
|
||||
$connection->setDefaultTypeData();
|
||||
|
||||
@@ -774,7 +774,7 @@ class Map extends Controller\AccessController {
|
||||
// check if the current connection belongs to the current map
|
||||
$map->filter('connections', ['id = ?', $connectionData['id'] ]);
|
||||
$filteredMap = $map->find(
|
||||
['id = ?', $map->id ],
|
||||
['id = ?', $map->_id ],
|
||||
['limit' => 1]
|
||||
);
|
||||
|
||||
@@ -789,7 +789,7 @@ class Map extends Controller\AccessController {
|
||||
* @var $connection Model\ConnectionModel
|
||||
*/
|
||||
$connection = $filteredMap->connections->current();
|
||||
$connection->setData($connectionData);
|
||||
$connection->copyfrom($connectionData, ['scope', 'type']);
|
||||
|
||||
if($connection->save($activeCharacter)){
|
||||
$mapChanged = true;
|
||||
|
||||
@@ -86,9 +86,6 @@ class Signature extends Controller\AccessController {
|
||||
|
||||
// update/add all submitted signatures
|
||||
foreach($signatureData as $data){
|
||||
// this key should not be saved (it is an obj)
|
||||
unset($data['updated']);
|
||||
|
||||
$system->getById( (int)$data['systemId'], 0);
|
||||
|
||||
if( !$system->dry() ){
|
||||
@@ -106,16 +103,14 @@ class Signature extends Controller\AccessController {
|
||||
}
|
||||
|
||||
if( is_null($signature) ){
|
||||
$signature = Model\BasicModel::getNew('SystemSignatureModel');
|
||||
$signature = $system->rel('signatures');
|
||||
}
|
||||
|
||||
if($signature->dry()){
|
||||
// new signature
|
||||
$signature->systemId = $system;
|
||||
$signature->setData($data);
|
||||
$signature->copyfrom($data, ['name', 'groupId', 'typeId', 'description', 'connectionId']);
|
||||
}else{
|
||||
// update signature
|
||||
|
||||
if(
|
||||
isset($data['name']) &&
|
||||
isset($data['value'])
|
||||
@@ -141,9 +136,6 @@ class Signature extends Controller\AccessController {
|
||||
}else{
|
||||
// update complete signature (signature reader dialog)
|
||||
|
||||
// systemId should not be updated
|
||||
unset( $data['systemId'] );
|
||||
|
||||
// description should not overwrite existing description
|
||||
if( !empty($signature->description) ){
|
||||
unset( $data['description'] );
|
||||
@@ -171,23 +163,14 @@ class Signature extends Controller\AccessController {
|
||||
}
|
||||
|
||||
if( $signature->hasChanged($newData) ){
|
||||
$signature->setData($newData);
|
||||
$signature->copyfrom($newData, ['name', 'groupId', 'typeId', 'description', 'connectionId']);
|
||||
}
|
||||
}
|
||||
|
||||
$signature->save($activeCharacter);
|
||||
$updatedSignatureIds[] = $signature->id;
|
||||
$system->saveSignature($signature, $activeCharacter);
|
||||
|
||||
// get a fresh signature object with the new data. This is a bad work around!
|
||||
// but i could not figure out what the problem was when using the signature model, saved above :(
|
||||
// -> some caching problems
|
||||
/**
|
||||
* @var $newSignature Model\SystemSignatureModel
|
||||
*/
|
||||
$newSignature = Model\BasicModel::getNew('SystemSignatureModel');
|
||||
$newSignature->getById( $signature->id, 0);
|
||||
|
||||
$return->signatures[] = $newSignature->getData();
|
||||
$updatedSignatureIds[] = $signature->_id;
|
||||
$return->signatures[] = $signature->getData();
|
||||
|
||||
$signature->reset();
|
||||
}
|
||||
@@ -207,13 +190,11 @@ class Signature extends Controller\AccessController {
|
||||
){
|
||||
$allSignatures = $system->getSignatures();
|
||||
foreach($allSignatures as $tempSignature){
|
||||
if( !in_array($tempSignature->id, $updatedSignatureIds)){
|
||||
if( !in_array($tempSignature->_id, $updatedSignatureIds)){
|
||||
$tempSignature->delete( $activeCharacter );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -80,29 +80,6 @@ class ConnectionModel extends AbstractMapTrackingModel {
|
||||
]
|
||||
];
|
||||
|
||||
/**
|
||||
* set an array with all data for a system
|
||||
* @param array $data
|
||||
*/
|
||||
public function setData($data){
|
||||
unset($data['id']);
|
||||
unset($data['created']);
|
||||
unset($data['updated']);
|
||||
unset($data['createdCharacterId']);
|
||||
unset($data['updatedCharacterId']);
|
||||
|
||||
foreach((array)$data as $key => $value){
|
||||
if( !is_array($value) ){
|
||||
if( $this->exists($key) ){
|
||||
$this->$key = $value;
|
||||
}
|
||||
}elseif($key == 'type'){
|
||||
// json field
|
||||
$this->$key = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* get connection data
|
||||
* @param bool $addSignatureData
|
||||
|
||||
@@ -1259,7 +1259,7 @@ class MapModel extends AbstractMapTrackingModel {
|
||||
* @param int $posY
|
||||
* @return false|ConnectionModel
|
||||
*/
|
||||
public function saveSystem( SystemModel $system, CharacterModel $character, $posX = 10, $posY = 0){
|
||||
public function saveSystem(SystemModel $system, CharacterModel $character, $posX = 10, $posY = 0){
|
||||
$system->setActive(true);
|
||||
$system->mapId = $this->id;
|
||||
$system->posX = $posX;
|
||||
|
||||
@@ -119,42 +119,6 @@ class SystemModel extends AbstractMapTrackingModel {
|
||||
]
|
||||
];
|
||||
|
||||
/**
|
||||
* set an array with all data for a system
|
||||
* @param array $data
|
||||
*/
|
||||
public function setData($data){
|
||||
unset($data['id']);
|
||||
unset($data['created']);
|
||||
unset($data['updated']);
|
||||
unset($data['createdCharacterId']);
|
||||
unset($data['updatedCharacterId']);
|
||||
|
||||
foreach((array)$data as $key => $value){
|
||||
if(!is_array($value)){
|
||||
if($this->exists($key)){
|
||||
$this->$key = $value;
|
||||
}
|
||||
}else{
|
||||
// special array data
|
||||
if($key == 'constellation'){
|
||||
$this->constellationId = (int)$value['id'];
|
||||
$this->constellation = $value['name'];
|
||||
}elseif($key == 'region'){
|
||||
$this->regionId = (int)$value['id'];
|
||||
$this->region = $value['name'];
|
||||
}elseif($key == 'type'){
|
||||
$this->typeId = (int)$value['id'];
|
||||
}elseif($key == 'status'){
|
||||
$this->statusId = (int)$value['id'];
|
||||
}elseif($key == 'position'){
|
||||
$this->posX = (int)$value['x'];
|
||||
$this->posY = (int)$value['y'];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* get map data as object
|
||||
* @return \stdClass
|
||||
@@ -720,6 +684,17 @@ class SystemModel extends AbstractMapTrackingModel {
|
||||
$this->typeId = $type;
|
||||
}
|
||||
|
||||
/**
|
||||
* save signature for this system
|
||||
* @param SystemSignatureModel $signature
|
||||
* @param CharacterModel $character
|
||||
* @return false|ConnectionModel
|
||||
*/
|
||||
public function saveSignature(SystemSignatureModel $signature, CharacterModel $character){
|
||||
$signature->systemId = $this;
|
||||
return $signature->save($character);
|
||||
}
|
||||
|
||||
/**
|
||||
* get object relevant data for model log
|
||||
* @param bool $fullData
|
||||
|
||||
@@ -207,10 +207,10 @@ class SystemSignatureModel extends AbstractMapTrackingModel {
|
||||
/**
|
||||
* compares a new data set (array) with the current values
|
||||
* and checks if something has changed
|
||||
* @param $signatureData
|
||||
* @param array $signatureData
|
||||
* @return bool
|
||||
*/
|
||||
public function hasChanged($signatureData){
|
||||
public function hasChanged(array $signatureData) : bool {
|
||||
$hasChanged = false;
|
||||
|
||||
foreach((array)$signatureData as $key => $value){
|
||||
|
||||
@@ -46,20 +46,6 @@ class UserCharacterModel extends BasicModel {
|
||||
]
|
||||
];
|
||||
|
||||
/**
|
||||
* set an array with all data for a character
|
||||
* @param $characterData
|
||||
*/
|
||||
public function setData($characterData){
|
||||
foreach((array)$characterData as $key => $value){
|
||||
if(!is_array($value)){
|
||||
if($this->exists($key)){
|
||||
$this->$key = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* event "Hook"
|
||||
* -> remove user if there are no other characters bound to this user
|
||||
|
||||
@@ -25,7 +25,7 @@ requirejs.config({
|
||||
admin: './app/admin', // initial start "admin page" view
|
||||
notification: './app/notification', // "notification" view
|
||||
|
||||
jquery: 'lib/jquery-3.1.1.min', // v3.1.1 jQuery
|
||||
jquery: 'lib/jquery-3.3.1.min', // v3.3.1 jQuery
|
||||
bootstrap: 'lib/bootstrap.min', // v3.3.0 Bootstrap js code - http://getbootstrap.com/javascript
|
||||
text: 'lib/requirejs/text', // v2.0.12 A RequireJS/AMD loader plugin for loading text resources.
|
||||
mustache: 'lib/mustache.min', // v1.0.0 Javascript template engine - http://mustache.github.io
|
||||
|
||||
4
js/lib/jquery-3.1.1.min.js
vendored
4
js/lib/jquery-3.1.1.min.js
vendored
File diff suppressed because one or more lines are too long
2
js/lib/jquery-3.3.1.min.js
vendored
Normal file
2
js/lib/jquery-3.3.1.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -25,7 +25,7 @@ requirejs.config({
|
||||
admin: './app/admin', // initial start "admin page" view
|
||||
notification: './app/notification', // "notification" view
|
||||
|
||||
jquery: 'lib/jquery-3.1.1.min', // v3.1.1 jQuery
|
||||
jquery: 'lib/jquery-3.3.1.min', // v3.3.1 jQuery
|
||||
bootstrap: 'lib/bootstrap.min', // v3.3.0 Bootstrap js code - http://getbootstrap.com/javascript
|
||||
text: 'lib/requirejs/text', // v2.0.12 A RequireJS/AMD loader plugin for loading text resources.
|
||||
mustache: 'lib/mustache.min', // v1.0.0 Javascript template engine - http://mustache.github.io
|
||||
|
||||
2
public/js/v1.3.6/lib/jquery-3.3.1.min.js
vendored
Normal file
2
public/js/v1.3.6/lib/jquery-3.3.1.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
@@ -406,7 +406,7 @@
|
||||
</div>
|
||||
{{/hasRightMapExport}}
|
||||
|
||||
<h4 class="pf-dynamic-area">Map Import</h4>
|
||||
<h4 class="pf-dynamic-area">Map import</h4>
|
||||
{{#hasRightMapImport}}
|
||||
<form role="form" class="form-horizontal" id="{{dialogMapImportFormId}}">
|
||||
<div class="form-group">
|
||||
|
||||
@@ -171,11 +171,11 @@
|
||||
padding-bottom: 10px;
|
||||
border-bottom: 1px solid $gray-darker;
|
||||
|
||||
li{
|
||||
& > li{
|
||||
margin-left: 0;
|
||||
overflow: visible;
|
||||
min-height: 50px;
|
||||
will-change: margin-left;
|
||||
will-change: transform, opacity, margin-left;
|
||||
@include transition( margin-left 0.12s cubic-bezier(0.30, 0.80, 0.80, 1.70));
|
||||
|
||||
// character headline
|
||||
|
||||
Reference in New Issue
Block a user