diff --git a/app/main/controller/api/system.php b/app/main/controller/api/system.php index 503ca8500..0f14b896a 100644 --- a/app/main/controller/api/system.php +++ b/app/main/controller/api/system.php @@ -7,6 +7,7 @@ */ namespace Controller\Api; +use Controller\Ccp\Sso; use Data\Mapper as Mapper; use Model; @@ -318,10 +319,9 @@ public function constellationData(\Base $f3, $params){ $return->error = []; $return->systemData = []; - $constellationId = 0; - $activeCharacter = $this->getCharacter(); + if( $activeCharacter = $this->getCharacter() ){ + $constellationId = 0; - if($activeCharacter){ // check for search parameter if( isset($params['arg1']) ){ $constellationId = (int)$params['arg1']; @@ -346,12 +346,51 @@ public function constellationData(\Base $f3, $params){ echo json_encode($return); } + /** + * set destination for specific systemIds + * @param \Base $f3 + */ + public function setDestination(\Base $f3){ + $postData = (array)$f3->get('POST'); + + $return = (object) []; + $return->error = []; + $return->systemData = []; + + if( + ($activeCharacter = $this->getCharacter()) && + !empty($postData['systemData']) + ){ + $return->clearOtherWaypoints = (bool)$postData['clearOtherWaypoints']; + $return->first = (bool)$postData['first']; + + /** + * @var Sso $ssoController + */ + $ssoController = self::getController('Sso'); + foreach($postData['systemData'] as $systemData){ + $waypointData = $ssoController->setWaypoint($activeCharacter, $systemData['systemId'], [ + 'clearOtherWaypoints' => $return->clearOtherWaypoints, + 'first' => $return->first, + ]); + if($waypointData['systemId']){ + $return->systemData[] = $systemData; + }elseif( isset($waypointData['error']) ){ + $return->error[] = $waypointData['error']; + } + } + } + + echo json_encode($return); + } + + /** * delete systems and all its connections * @param \Base $f3 */ public function delete(\Base $f3){ - $systemIds = $f3->get('POST.systemIds'); + $systemIds = (array)$f3->get('POST.systemIds'); if($activeCharacter = $this->getCharacter()){ /** diff --git a/app/main/controller/ccp/sso.php b/app/main/controller/ccp/sso.php index 87a6598e0..7a05acaf5 100644 --- a/app/main/controller/ccp/sso.php +++ b/app/main/controller/ccp/sso.php @@ -653,6 +653,67 @@ public function getCharacterLocationData($accessToken, $ttl = 10, $additionalOpt return $locationData; } + /** + * set new ingame waypoint + * @param Model\CharacterModel $character + * @param int $systemId + * @param array $options + * @return array + */ + public function setWaypoint( Model\CharacterModel $character, $systemId, $options = []){ + $crestUrlParts = parse_url( self::getCrestEndpoint() ); + $waypointData = []; + + if( $crestUrlParts ){ + $endpointUrl = self::getCrestEndpoint() . '/characters/' . $character->_id . '/navigation/waypoints/'; + $systemEndpoint = self::getCrestEndpoint() . '/solarsystems/' . $systemId . '/'; + + // request body + $content = [ + 'clearOtherWaypoints' => (bool)$options['clearOtherWaypoints'], + 'first' => (bool)$options['first'], + 'solarSystem' => [ + 'href' => $systemEndpoint, + 'id' => (int)$systemId + ] + ]; + + $requestOptions = [ + 'timeout' => self::CREST_TIMEOUT, + 'method' => 'POST', + 'user_agent' => $this->getUserAgent(), + 'header' => [ + 'Scope: characterNavigationWrite', + 'Authorization: Bearer ' . $character->getAccessToken(), + 'Host: ' . $crestUrlParts['host'], + 'Content-Type: application/vnd.ccp.eve.PostWaypoint-v1+json;charset=utf-8', + ], + 'content' => json_encode($content, JSON_UNESCAPED_SLASHES) + ]; + + $apiResponse = Lib\Web::instance()->request($endpointUrl, $requestOptions); + + if( isset($apiResponse['body']) ){ + $responseData = json_decode($apiResponse['body']); + + if( empty($responseData) ){ + $waypointData['systemId'] = (int)$systemId; + }elseif( + isset($responseData->message) && + isset($responseData->key) + ){ + // waypoint could not be set... + $error = (object) []; + $error->type = 'error'; + $error->message = $responseData->key; + $waypointData['error'] = $error; + } + } + } + + return $waypointData; + } + /** * update character * @param $characterData diff --git a/app/main/controller/controller.php b/app/main/controller/controller.php index 1d370af12..2796e0d95 100644 --- a/app/main/controller/controller.php +++ b/app/main/controller/controller.php @@ -8,7 +8,7 @@ namespace Controller; use Controller\Api as Api; -use Controller\Ccp\Sso; +use Controller\Ccp\Sso as Sso; use Model; use DB; @@ -445,6 +445,158 @@ public function getEveServerStatus(\Base $f3){ echo json_encode($return); } + + + /** + * get error object is a user is not found/logged of + * @return \stdClass + */ + protected function getLogoutError(){ + $userError = (object) []; + $userError->type = 'error'; + $userError->message = 'User not found'; + return $userError; + } + + /** + * get a program URL by alias + * -> if no $alias given -> get "default" route (index.php) + * @param null $alias + * @return bool|string + */ + protected function getRouteUrl($alias = null){ + $url = false; + + if(!empty($alias)){ + // check given alias is a valid (registered) route + if(array_key_exists($alias, $this->getF3()->get('ALIASES'))){ + $url = $this->getF3()->alias($alias); + } + }elseif($this->getF3()->get('ALIAS')){ + // get current URL + $url = $this->getF3()->alias( $this->getF3()->get('ALIAS') ); + }else{ + // get main (index.php) URL + $url = $this->getF3()->alias('login'); + } + + return $url; + } + + /** + * get a custom userAgent string for API calls + * @return string + */ + protected function getUserAgent(){ + $userAgent = ''; + $userAgent .= $this->getF3()->get('PATHFINDER.NAME'); + $userAgent .= ' - ' . $this->getF3()->get('PATHFINDER.VERSION'); + $userAgent .= ' | ' . $this->getF3()->get('PATHFINDER.CONTACT'); + $userAgent .= ' (' . $_SERVER['SERVER_NAME'] . ')'; + + return $userAgent; + } + + /** + * onError() callback function + * -> on AJAX request -> return JSON with error information + * -> on HTTP request -> render error page + * @param \Base $f3 + */ + public function showError(\Base $f3){ + // set HTTP status + $errorCode = $f3->get('ERROR.code'); + if(!empty($errorCode)){ + $f3->status($errorCode); + } + + // collect error info --------------------------------------- + $return = (object) []; + $error = (object) []; + $error->type = 'error'; + $error->code = $errorCode; + $error->status = $f3->get('ERROR.status'); + $error->message = $f3->get('ERROR.text'); + + // append stack trace for greater debug level + if( $f3->get('DEBUG') === 3){ + $error->trace = $f3->get('ERROR.trace'); + } + + // check if error is a PDO Exception + if(strpos(strtolower( $f3->get('ERROR.text') ), 'duplicate') !== false){ + preg_match_all('/\'([^\']+)\'/', $f3->get('ERROR.text'), $matches, PREG_SET_ORDER); + + if(count($matches) === 2){ + $error->field = $matches[1][1]; + $error->message = 'Value "' . $matches[0][1] . '" already exists'; + } + } + $return->error[] = $error; + + // return error information --------------------------------- + if($f3->get('AJAX')){ + header('Content-type: application/json'); + echo json_encode($return); + die(); + }else{ + // set error data for template rendering + $error->redirectUrl = $this->getRouteUrl(); + $f3->set('errorData', $error); + + if( preg_match('/^4[0-9]{2}$/', $error->code) ){ + // 4xx error -> render error page + $f3->set('pageContent', $f3->get('PATHFINDER.STATUS.4XX')); + }elseif( preg_match('/^5[0-9]{2}$/', $error->code) ){ + $f3->set('pageContent', $f3->get('PATHFINDER.STATUS.5XX')); + } + + echo \Template::instance()->render( $f3->get('PATHFINDER.VIEW.INDEX') ); + die(); + } + } + + /** + * Callback for framework "unload" + * check -> config.ini + * @param \Base $f3 + * @return bool + */ + public function unload(\Base $f3){ + return true; + } + + /** + * get controller by class name + * -> controller class is searched within all controller directories + * @param $className + * @return null|\Controller\ + * @throws \Exception + */ + static function getController($className){ + $controller = null; + // add subNamespaces for controller classes + $subNamespaces = ['Api', 'Ccp']; + + for($i = 0; $i <= count($subNamespaces); $i++){ + $path = [__NAMESPACE__]; + $path[] = ( isset($subNamespaces[$i - 1]) ) ? $subNamespaces[$i - 1] : ''; + $path[] = $className; + $classPath = implode('\\', array_filter($path)); + + if(class_exists($classPath)){ + $controller = new $classPath(); + break; + } + } + + if( is_null($controller) ){ + throw new \Exception( sprintf('Controller class "%s" not found!', $className) ); + } + + return $controller; + } + /** * check weather the page is IGB trusted or not * @return boolean @@ -513,7 +665,7 @@ function_exists('apache_request_headers') && } } } - + return $headers; } @@ -574,17 +726,6 @@ static function isIGB(){ return $isIGB; } - /** - * get error object is a user is not found/logged of - * @return \stdClass - */ - protected function getLogoutError(){ - $userError = (object) []; - $userError->type = 'error'; - $userError->message = 'User not found'; - return $userError; - } - /** * get the current registration status * 0=registration stop |1=new registration allowed @@ -664,112 +805,4 @@ static function getRequiredMySqlVariables($key){ return $data; } - /** - * get a program URL by alias - * -> if no $alias given -> get "default" route (index.php) - * @param null $alias - * @return bool|string - */ - protected function getRouteUrl($alias = null){ - $url = false; - - if(!empty($alias)){ - // check given alias is a valid (registered) route - if(array_key_exists($alias, $this->getF3()->get('ALIASES'))){ - $url = $this->getF3()->alias($alias); - } - }elseif($this->getF3()->get('ALIAS')){ - // get current URL - $url = $this->getF3()->alias( $this->getF3()->get('ALIAS') ); - }else{ - // get main (index.php) URL - $url = $this->getF3()->alias('login'); - } - - return $url; - } - - /** - * get a custom userAgent string for API calls - * @return string - */ - protected function getUserAgent(){ - $userAgent = ''; - $userAgent .= $this->getF3()->get('PATHFINDER.NAME'); - $userAgent .= ' - ' . $this->getF3()->get('PATHFINDER.VERSION'); - $userAgent .= ' | ' . $this->getF3()->get('PATHFINDER.CONTACT'); - $userAgent .= ' (' . $_SERVER['SERVER_NAME'] . ')'; - - return $userAgent; - } - - /** - * onError() callback function - * -> on AJAX request -> return JSON with error information - * -> on HTTP request -> render error page - * @param \Base $f3 - */ - public function showError(\Base $f3){ - // set HTTP status - $errorCode = $f3->get('ERROR.code'); - if(!empty($errorCode)){ - $f3->status($errorCode); - } - - // collect error info --------------------------------------- - $return = (object) []; - $error = (object) []; - $error->type = 'error'; - $error->code = $errorCode; - $error->status = $f3->get('ERROR.status'); - $error->message = $f3->get('ERROR.text'); - - // append stack trace for greater debug level - if( $f3->get('DEBUG') === 3){ - $error->trace = $f3->get('ERROR.trace'); - } - - // check if error is a PDO Exception - if(strpos(strtolower( $f3->get('ERROR.text') ), 'duplicate') !== false){ - preg_match_all('/\'([^\']+)\'/', $f3->get('ERROR.text'), $matches, PREG_SET_ORDER); - - if(count($matches) === 2){ - $error->field = $matches[1][1]; - $error->message = 'Value "' . $matches[0][1] . '" already exists'; - } - } - $return->error[] = $error; - - // return error information --------------------------------- - if($f3->get('AJAX')){ - header('Content-type: application/json'); - echo json_encode($return); - die(); - }else{ - // set error data for template rendering - $error->redirectUrl = $this->getRouteUrl(); - $f3->set('errorData', $error); - - if( preg_match('/^4[0-9]{2}$/', $error->code) ){ - // 4xx error -> render error page - $f3->set('pageContent', $f3->get('PATHFINDER.STATUS.4XX')); - }elseif( preg_match('/^5[0-9]{2}$/', $error->code) ){ - $f3->set('pageContent', $f3->get('PATHFINDER.STATUS.5XX')); - } - - echo \Template::instance()->render( $f3->get('PATHFINDER.VIEW.INDEX') ); - die(); - } - } - - /** - * Callback for framework "unload" - * check -> config.ini - * @param \Base $f3 - * @return bool - */ - public function unload(\Base $f3){ - return true; - } - } \ No newline at end of file diff --git a/app/main/lib/web.php b/app/main/lib/web.php index 0985c2cd8..86a0b4b02 100644 --- a/app/main/lib/web.php +++ b/app/main/lib/web.php @@ -105,7 +105,6 @@ public function request($url,array $options = null, $additionalOptions = [], $re $f3 = \Base::instance(); if( !$f3->exists( $hash = $this->getCacheKey($url, $options) ) ){ - // retry same request until request limit is reached $retry = false; diff --git a/js/app/init.js b/js/app/init.js index 059d331a3..9679ab39c 100644 --- a/js/app/init.js +++ b/js/app/init.js @@ -1,4 +1,4 @@ -/** +6/** * Init */ @@ -35,6 +35,7 @@ define(['jquery'], function($) { deleteSystem: 'api/system/delete', // ajax URL - delete system from map getSystemGraphData: 'api/system/graphData', // ajax URL - get all system graph data getConstellationData: 'api/system/constellationData', // ajax URL - get system constellation data + setDestination: 'api/system/setDestination', // ajax URL - set destination // connection API saveConnection: 'api/connection/save', // ajax URL - save new connection to map diff --git a/js/app/map/map.js b/js/app/map/map.js index e28b9abbf..abf8234cc 100644 --- a/js/app/map/map.js +++ b/js/app/map/map.js @@ -1683,12 +1683,15 @@ define([ {icon: 'fa-lock', action: 'lock_system', text: 'lock system'}, {icon: 'fa-users', action: 'set_rally', text: 'set rally point'}, {icon: 'fa-tags', text: 'set status', subitems: systemStatus}, + {icon: 'fa-reply fa-rotate-180', text: 'waypoints', subitems: [ + {subIcon: 'fa-flag-checkered', subAction: 'set_destination', subText: 'set destination'}, + {subDivider: true, action: ''}, + {subIcon: 'fa-step-backward', subAction: 'add_first_waypoint', subText: 'add new [start]'}, + {subIcon: 'fa-step-forward', subAction: 'add_last_waypoint', subText: 'add new [end]'} + ]}, {divider: true, action: 'ingame'}, - {icon: 'fa-reply fa-rotate-180', action: 'ingame', text: 'ingame actions', subitems: [ - {subIcon: 'fa-info', subAction: 'ingame_show_info', subText: 'show info'}, - {subDivider: true, action: 'ingame'}, - {subIcon: 'fa-flag', subAction: 'ingame_add_waypoint', subText: 'add waypoint'}, - {subIcon: 'fa-flag-checkered', subAction: 'ingame_set_destination', subText: 'set destination'} + {icon: 'fa-reply fa-rotate-180', action: 'ingame', text: 'ingame', subitems: [ + {subIcon: 'fa-info', subAction: 'ingame_show_info', subText: 'show info'} ]}, {divider: true, action: 'delete_system'}, {icon: 'fa-eraser', action: 'delete_system', text: 'delete system'} @@ -2009,15 +2012,11 @@ define([ CCPEVE.showInfo(5, systemData.systemId ); break; - case 'ingame_set_destination': + case 'set_destination': + case 'add_first_waypoint': + case 'add_last_waypoint': systemData = system.getSystemData(); - - CCPEVE.setDestination( systemData.systemId ); - break; - case 'ingame_add_waypoint': - systemData = system.getSystemData(); - - CCPEVE.addWaypoint( systemData.systemId ); + setDestination(systemData, action); break; } } @@ -2069,6 +2068,68 @@ define([ system.singleDoubleClick(single, double); }; + + /** + * set new destination for a system + * -> CREST request + * @param systemData + * @param type + */ + var setDestination = function(systemData, type){ + + var description = ''; + switch(type){ + case 'set_destination': + description = 'Set destination'; + break; + case 'add_first_waypoint': + description = 'Set first waypoint'; + break; + case 'add_last_waypoint': + description = 'Set new waypoint'; + break; + } + + $.ajax({ + type: 'POST', + url: Init.path.setDestination, + data: { + clearOtherWaypoints: (type === 'set_destination') ? 1 : 0, + first: (type === 'add_last_waypoint') ? 0 : 1, + systemData: [{ + systemId: systemData.systemId, + name: systemData.name + }] + }, + context: { + description: description + }, + dataType: 'json' + }).done(function(responseData){ + if( + responseData.systemData && + responseData.systemData.length > 0 + ){ + for (var j = 0; j < responseData.systemData.length; j++) { + Util.showNotify({title: this.description, text: 'System: ' + responseData.systemData[j].name, type: 'success'}); + } + } + + if( + responseData.error && + responseData.error.length > 0 + ){ + for(var i = 0; i < responseData.error.length; i++){ + Util.showNotify({title: this.description + ' error', text: 'System: ' + responseData.error[i].message, type: 'error'}); + } + } + + }).fail(function( jqXHR, status, error) { + var reason = status + ' ' + error; + Util.showNotify({title: jqXHR.status + ': ' + this.description, text: reason, type: 'warning'}); + }); + }; + /** * mark a dom element (map, system, connection) as changed */ diff --git a/public/js/v1.0.0RC3/app/init.js b/public/js/v1.0.0RC3/app/init.js index 3bae74c8d..9679ab39c 100644 --- a/public/js/v1.0.0RC3/app/init.js +++ b/public/js/v1.0.0RC3/app/init.js @@ -1,4 +1,4 @@ -/** +6/** * Init */ @@ -35,6 +35,7 @@ define(['jquery'], function($) { deleteSystem: 'api/system/delete', // ajax URL - delete system from map getSystemGraphData: 'api/system/graphData', // ajax URL - get all system graph data getConstellationData: 'api/system/constellationData', // ajax URL - get system constellation data + setDestination: 'api/system/setDestination', // ajax URL - set destination // connection API saveConnection: 'api/connection/save', // ajax URL - save new connection to map @@ -126,7 +127,7 @@ define(['jquery'], function($) { }, redGiant: { class: 'pf-system-effect-redgiant', - name: 'red gaint' + name: 'red giant' }, pulsar: { class: 'pf-system-effect-pulsar', @@ -330,34 +331,58 @@ define(['jquery'], function($) { // frigate wormholes frigateWormholes: { 1: { // C1 - + 1: 'E004 - C1', + 2: 'L005 - C2', + 3: 'Z006 - C3', + 4: 'M001 - C4', + 5: 'C008 - C5', + 6: 'G008 - C6', + 7: 'Q003 - 0.0' }, 2: { // C2 - 1: 'L005 - C2', - 2: 'C008 - C5', - 3: 'Q003 - 0.0' + 1: 'E004 - C1', + 2: 'L005 - C2', + 3: 'Z006 - C3', + 4: 'M001 - C4', + 5: 'C008 - C5', + 6: 'G008 - C6', + 7: 'Q003 - 0.0' }, 3: { // C3 1: 'E004 - C1', 2: 'L005 - C2', - 3: 'M001 - C4' + 3: 'Z006 - C3', + 4: 'M001 - C4', + 5: 'C008 - C5', + 6: 'G008 - C6', + 7: 'Q003 - 0.0' }, 4: { // C4 - 1: 'L005 - C2', - 2: 'G008 - C6', - 3: 'Q003 - 0.0' - }, + 1: 'E004 - C1', + 2: 'L005 - C2', + 3: 'Z006 - C3', + 4: 'M001 - C4', + 5: 'C008 - C5', + 6: 'G008 - C6', + 7: 'Q003 - 0.0' + }, 5: { // C5 1: 'E004 - C1', 2: 'L005 - C2', 3: 'Z006 - C3', - 4: 'C008 - C5', - 5: 'Q003 - 0.0' + 4: 'M001 - C4', + 5: 'C008 - C5', + 6: 'G008 - C6', + 7: 'Q003 - 0.0' }, 6: { // C6 1: 'E004 - C1', - 2: 'Z006 - C3', - 5: 'Q003 - 0.0' + 2: 'L005 - C2', + 3: 'Z006 - C3', + 4: 'M001 - C4', + 5: 'C008 - C5', + 6: 'G008 - C6', + 7: 'Q003 - 0.0' }, 13: { // Shattered Wormholes (some of them are static) 1: 'E004 - C1', @@ -366,8 +391,7 @@ define(['jquery'], function($) { 4: 'M001 - C4', 5: 'C008 - C5', 6: 'G008 - C6', - 7: 'Q003 - C7' - + 7: 'Q003 - 0.0' } }, // incoming wormholes @@ -383,4 +407,4 @@ define(['jquery'], function($) { }; return Config; -}); \ No newline at end of file +}); diff --git a/public/js/v1.0.0RC3/app/map/map.js b/public/js/v1.0.0RC3/app/map/map.js index e28b9abbf..abf8234cc 100644 --- a/public/js/v1.0.0RC3/app/map/map.js +++ b/public/js/v1.0.0RC3/app/map/map.js @@ -1683,12 +1683,15 @@ define([ {icon: 'fa-lock', action: 'lock_system', text: 'lock system'}, {icon: 'fa-users', action: 'set_rally', text: 'set rally point'}, {icon: 'fa-tags', text: 'set status', subitems: systemStatus}, + {icon: 'fa-reply fa-rotate-180', text: 'waypoints', subitems: [ + {subIcon: 'fa-flag-checkered', subAction: 'set_destination', subText: 'set destination'}, + {subDivider: true, action: ''}, + {subIcon: 'fa-step-backward', subAction: 'add_first_waypoint', subText: 'add new [start]'}, + {subIcon: 'fa-step-forward', subAction: 'add_last_waypoint', subText: 'add new [end]'} + ]}, {divider: true, action: 'ingame'}, - {icon: 'fa-reply fa-rotate-180', action: 'ingame', text: 'ingame actions', subitems: [ - {subIcon: 'fa-info', subAction: 'ingame_show_info', subText: 'show info'}, - {subDivider: true, action: 'ingame'}, - {subIcon: 'fa-flag', subAction: 'ingame_add_waypoint', subText: 'add waypoint'}, - {subIcon: 'fa-flag-checkered', subAction: 'ingame_set_destination', subText: 'set destination'} + {icon: 'fa-reply fa-rotate-180', action: 'ingame', text: 'ingame', subitems: [ + {subIcon: 'fa-info', subAction: 'ingame_show_info', subText: 'show info'} ]}, {divider: true, action: 'delete_system'}, {icon: 'fa-eraser', action: 'delete_system', text: 'delete system'} @@ -2009,15 +2012,11 @@ define([ CCPEVE.showInfo(5, systemData.systemId ); break; - case 'ingame_set_destination': + case 'set_destination': + case 'add_first_waypoint': + case 'add_last_waypoint': systemData = system.getSystemData(); - - CCPEVE.setDestination( systemData.systemId ); - break; - case 'ingame_add_waypoint': - systemData = system.getSystemData(); - - CCPEVE.addWaypoint( systemData.systemId ); + setDestination(systemData, action); break; } } @@ -2069,6 +2068,68 @@ define([ system.singleDoubleClick(single, double); }; + + /** + * set new destination for a system + * -> CREST request + * @param systemData + * @param type + */ + var setDestination = function(systemData, type){ + + var description = ''; + switch(type){ + case 'set_destination': + description = 'Set destination'; + break; + case 'add_first_waypoint': + description = 'Set first waypoint'; + break; + case 'add_last_waypoint': + description = 'Set new waypoint'; + break; + } + + $.ajax({ + type: 'POST', + url: Init.path.setDestination, + data: { + clearOtherWaypoints: (type === 'set_destination') ? 1 : 0, + first: (type === 'add_last_waypoint') ? 0 : 1, + systemData: [{ + systemId: systemData.systemId, + name: systemData.name + }] + }, + context: { + description: description + }, + dataType: 'json' + }).done(function(responseData){ + if( + responseData.systemData && + responseData.systemData.length > 0 + ){ + for (var j = 0; j < responseData.systemData.length; j++) { + Util.showNotify({title: this.description, text: 'System: ' + responseData.systemData[j].name, type: 'success'}); + } + } + + if( + responseData.error && + responseData.error.length > 0 + ){ + for(var i = 0; i < responseData.error.length; i++){ + Util.showNotify({title: this.description + ' error', text: 'System: ' + responseData.error[i].message, type: 'error'}); + } + } + + }).fail(function( jqXHR, status, error) { + var reason = status + ' ' + error; + Util.showNotify({title: jqXHR.status + ': ' + this.description, text: reason, type: 'warning'}); + }); + }; + /** * mark a dom element (map, system, connection) as changed */ diff --git a/public/js/v1.0.0RC3/app/ui/system_graph.js b/public/js/v1.0.0RC3/app/ui/system_graph.js index 1a845c4ec..134c266b6 100644 --- a/public/js/v1.0.0RC3/app/ui/system_graph.js +++ b/public/js/v1.0.0RC3/app/ui/system_graph.js @@ -150,7 +150,7 @@ define([ dataType: 'json' }).done(function(systemGraphsData){ - if(systemGraphsData.length > 0){ + if( !$.isEmptyObject(systemGraphsData) ){ // create new (hidden) module container var moduleElement = $('