AIRAVATA-2364 Deferring loading sharing users until button clicked
Project: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/repo Commit: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/commit/f06927dd Tree: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/tree/f06927dd Diff: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/diff/f06927dd Branch: refs/heads/dreg-gateway Commit: f06927dd612b2f86cdd7b78e105fb94e611fa1f5 Parents: 975cfa6 Author: Marcus Christie <[email protected]> Authored: Wed Apr 19 12:44:44 2017 -0400 Committer: Marcus Christie <[email protected]> Committed: Wed Apr 19 12:44:44 2017 -0400 ---------------------------------------------------------------------- app/controllers/ProjectController.php | 8 ++++++-- app/routes.php | 2 ++ app/views/project/create.blade.php | 1 + public/js/sharing/share.js | 2 +- 4 files changed, 10 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/f06927dd/app/controllers/ProjectController.php ---------------------------------------------------------------------- diff --git a/app/controllers/ProjectController.php b/app/controllers/ProjectController.php index 7651b25..ea6efd3 100755 --- a/app/controllers/ProjectController.php +++ b/app/controllers/ProjectController.php @@ -26,8 +26,7 @@ class ProjectController extends BaseController public function createView() { if (Config::get('pga_config.airavata')["data-sharing-enabled"]){ - $users = SharingUtilities::getAllUserProfiles(); - return View::make("project/create", array("users" => json_encode($users), "owner" => json_encode(array()))); + return View::make("project/create", array("users" => json_encode(array()), "owner" => json_encode(array()))); }else{ return View::make("project/no-sharing-create"); } @@ -242,6 +241,11 @@ class ProjectController extends BaseController return Response::json(array("error" => "Error: No project specified")); } } + + public function allUsers() + { + return Response::json(SharingUtilities::getAllUserProfiles()); + } } ?> http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/f06927dd/app/routes.php ---------------------------------------------------------------------- diff --git a/app/routes.php b/app/routes.php index 70bdc88..7c86629 100755 --- a/app/routes.php +++ b/app/routes.php @@ -91,6 +91,8 @@ Route::get("project/shared-users", "ProjectController@sharedUsers"); Route::get("project/unshared-users", "ProjectController@unsharedUsers"); +Route::get("project/all-users", "ProjectController@allUsers"); + /* * Experiment Routes */ http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/f06927dd/app/views/project/create.blade.php ---------------------------------------------------------------------- diff --git a/app/views/project/create.blade.php b/app/views/project/create.blade.php index 54d615c..759ca71 100755 --- a/app/views/project/create.blade.php +++ b/app/views/project/create.blade.php @@ -50,6 +50,7 @@ }); var users = {{ $users }}; var owner = {{ $owner }}; + $('#entity-share').data({url: "{{URL::to('/')}}/project/all-users"}); </script> {{ HTML::script('js/sharing/sharing_utils.js') }} {{ HTML::script('js/sharing/share.js') }} http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/f06927dd/public/js/sharing/share.js ---------------------------------------------------------------------- diff --git a/public/js/sharing/share.js b/public/js/sharing/share.js index bbea0d9..d36ff22 100755 --- a/public/js/sharing/share.js +++ b/public/js/sharing/share.js @@ -120,7 +120,7 @@ $(function() { $.ajax({ url: ajax_data.url, method: 'get', - data: {resourceId: ajax_data.resourceId}, + data: ajax_data.resourceId ? {resourceId: ajax_data.resourceId} : null, dataType: "json", error: function(xhr, status, error) { $('#shared-users').addClass('text-align-center').text("Unable to load users from Airavata server.");
