airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From scnakand...@apache.org
Subject [07/20] airavata-php-gateway git commit: user lists load asynchronously
Date Wed, 17 Aug 2016 15:32:54 GMT
user lists load asynchronously


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/bb852b70
Tree: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/tree/bb852b70
Diff: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/diff/bb852b70

Branch: refs/heads/develop
Commit: bb852b70bb77258eab39a6e229fc7aca1f823838
Parents: 7206631
Author: Jeff Kinnison <jeffdkinnison@gmail.com>
Authored: Mon Aug 15 10:45:56 2016 -0400
Committer: Jeff Kinnison <jeffdkinnison@gmail.com>
Committed: Mon Aug 15 10:45:56 2016 -0400

----------------------------------------------------------------------
 app/controllers/ExperimentController.php       |  8 ++++----
 app/controllers/ProjectController.php          | 10 +++++-----
 app/libraries/ExperimentUtilities.php          | 21 +++++++++++----------
 app/libraries/ProjectUtilities.php             |  7 ++++++-
 app/views/experiment/create-complete.blade.php |  2 +-
 app/views/experiment/edit.blade.php            |  2 +-
 app/views/project/summary.blade.php            |  2 +-
 public/js/sharing/share.js                     | 13 ++++++-------
 8 files changed, 35 insertions(+), 30 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/bb852b70/app/controllers/ExperimentController.php
----------------------------------------------------------------------
diff --git a/app/controllers/ExperimentController.php b/app/controllers/ExperimentController.php
index ada4824..0b48605 100755
--- a/app/controllers/ExperimentController.php
+++ b/app/controllers/ExperimentController.php
@@ -323,8 +323,8 @@ class ExperimentController extends BaseController
      */
     public function sharedUsers()
     {
-        if (array_key_exists('projId', $_POST)) {
-            return Response::json(SharingUtilities::getProfilesForSharedUsers());
+        if (array_key_exists('resourceId', $_GET)) {
+            return Response::json(SharingUtilities::getProfilesForSharedUsers($_GET['resourceId'],
ResourceType::EXPERIMENT));
         }
         else {
             return Response::json(array("error" => "Error: No project specified"));
@@ -333,8 +333,8 @@ class ExperimentController extends BaseController
 
     public function unsharedUsers()
     {
-        if (array_key_exists('projId', $_POST)) {
-            return Response::json(SharingUtilities::getProfilesForUnsharedUsers());
+        if (array_key_exists('resourceId', $_POST)) {
+            return Response::json(SharingUtilities::getProfilesForUnsharedUsers($_GET['resourceId'],
ResourceType::EXPERIMENT));
         }
         else {
             return Response::json(array("error" => "Error: No project specified"));

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/bb852b70/app/controllers/ProjectController.php
----------------------------------------------------------------------
diff --git a/app/controllers/ProjectController.php b/app/controllers/ProjectController.php
index bcd763e..3bf91d5 100755
--- a/app/controllers/ProjectController.php
+++ b/app/controllers/ProjectController.php
@@ -55,7 +55,7 @@ class ProjectController extends BaseController
     public function editView()
     {
         if (Input::has("projId")) {
-            $users = SharingUtilities::getAllUserProfiles(Input::get('projId'), ResourceType::PROJECT);
+            $users = SharingUtilities::getProfilesForSharedUsers(Input::get('projId'), ResourceType::PROJECT);
 
             return View::make("project/edit",
                 array("projectId" => Input::get("projId"),
@@ -119,8 +119,8 @@ class ProjectController extends BaseController
      */
     public function sharedUsers()
     {
-        if (array_key_exists('expId', $_POST)) {
-            return Response::json(SharingUtilities::getProfilesForSharedUsers());
+        if (array_key_exists('resourceId', $_GET)) {
+            return Response::json(SharingUtilities::getProfilesForSharedUsers($_GET['resourceId'],
ResourceType::PROJECT));
         }
         else {
             return Response::json(array("error" => "Error: No project specified"));
@@ -129,8 +129,8 @@ class ProjectController extends BaseController
 
     public function unsharedUsers()
     {
-        if (array_key_exists('expId', $_POST)) {
-            return Response::json(SharingUtilities::getProfilesForUnsharedUsers());
+        if (array_key_exists('resourceId', $_GET)) {
+            return Response::json(SharingUtilities::getProfilesForUnsharedUsers($_GET['resourceId'],
ResourceType::PROJECT));
         }
         else {
             return Response::json(array("error" => "Error: No project specified"));

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/bb852b70/app/libraries/ExperimentUtilities.php
----------------------------------------------------------------------
diff --git a/app/libraries/ExperimentUtilities.php b/app/libraries/ExperimentUtilities.php
old mode 100644
new mode 100755
index e081e3b..e5da839
--- a/app/libraries/ExperimentUtilities.php
+++ b/app/libraries/ExperimentUtilities.php
@@ -634,10 +634,9 @@ class ExperimentUtilities
             Airavata::updateExperiment(Session::get('authz-token'), $cloneId, $experiment);
 
             $share = SharingUtilities::getAllUserPermissions($expId, ResourceType::EXPERIMENT);
-            $share[Session::get("username")] = array("read" => true, "write" => true);
-            foreach ($share as $uid => $perms) {
-                $share[$uid] = (object) $perms;
-            }
+            $share->{Session::get('username')} = new stdClass();
+            $share->{Session::get('username')}->read = true;
+            $share->{Session::get('username')}->write = true;
             ExperimentUtilities::share_experiment($cloneId, $share);
 
             return $cloneId;
@@ -1132,12 +1131,14 @@ class ExperimentUtilities
         $expContainer = array();
         $expNum = 0;
         foreach ($experiments as $experiment) {
-            $expValue = ExperimentUtilities::get_experiment_values($experiment, true);
-            $expContainer[$expNum]['experiment'] = $experiment;
-            if ($expValue["experimentStatusString"] == "FAILED")
-                $expValue["editable"] = false;
-            $expContainer[$expNum]['expValue'] = $expValue;
-            $expNum++;
+            if (SharingUtilities::userCanRead(Session::get('username'), $experiment, ResourceType::EXPERIMENT))
{
+                $expValue = ExperimentUtilities::get_experiment_values($experiment, true);
+                $expContainer[$expNum]['experiment'] = $experiment;
+                if ($expValue["experimentStatusString"] == "FAILED")
+                    $expValue["editable"] = false;
+                $expContainer[$expNum]['expValue'] = $expValue;
+                $expNum++;
+            }
         }
 
         return $expContainer;

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/bb852b70/app/libraries/ProjectUtilities.php
----------------------------------------------------------------------
diff --git a/app/libraries/ProjectUtilities.php b/app/libraries/ProjectUtilities.php
old mode 100644
new mode 100755
index c75867f..476f94d
--- a/app/libraries/ProjectUtilities.php
+++ b/app/libraries/ProjectUtilities.php
@@ -211,7 +211,12 @@ class ProjectUtilities
             CommonUtilities::print_error_message('AiravataSystemException!<br><br>'
. $ase->getMessage());
         }
 
-        ProjectUtilities::share_project($projectId, json_decode($share));
+        $share = json_decode($share);
+        $share->{Session::get('username')} = new stdClass();
+        $share->{Session::get('username')}->read = true;
+        $share->{Session::get('username')}->write = true;
+
+        ProjectUtilities::share_project($projectId, $share);
     }
 
 

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/bb852b70/app/views/experiment/create-complete.blade.php
----------------------------------------------------------------------
diff --git a/app/views/experiment/create-complete.blade.php b/app/views/experiment/create-complete.blade.php
index a297694..ef76bcd 100755
--- a/app/views/experiment/create-complete.blade.php
+++ b/app/views/experiment/create-complete.blade.php
@@ -46,7 +46,7 @@
 @parent
 <script>
     var users = {{ $users }};
-    $('#experiment-share').data({url: "{{URL::to('/')}}/project/unshared-users", resourceId:
"{{$expInputs['project']}}"})
+    $('#project-share').data({url: "{{URL::to('/')}}/project/unshared-users", resourceId:
"{{$expInputs['project']}}"})
 </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/bb852b70/app/views/experiment/edit.blade.php
----------------------------------------------------------------------
diff --git a/app/views/experiment/edit.blade.php b/app/views/experiment/edit.blade.php
index ef630b0..75a6c5d 100755
--- a/app/views/experiment/edit.blade.php
+++ b/app/views/experiment/edit.blade.php
@@ -54,7 +54,7 @@
 @parent
 <script>
     var users = {{ $users }};
-    $('#experiment-share').data({url: "{{URL::to('/')}}/experiment/unshared-users", resourceId:
"{{Input::get('expId')}}"})
+    $('#project-share').data({url: "{{URL::to('/')}}/experiment/unshared-users", resourceId:
"{{Input::get('expId')}}"})
 </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/bb852b70/app/views/project/summary.blade.php
----------------------------------------------------------------------
diff --git a/app/views/project/summary.blade.php b/app/views/project/summary.blade.php
index 1b59d28..9e7adce 100755
--- a/app/views/project/summary.blade.php
+++ b/app/views/project/summary.blade.php
@@ -110,7 +110,7 @@
 {{ HTML::script('js/time-conversion.js')}}
 <script>
     var users = {{ $users }};
-    console.log(users);
+    //console.log(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/bb852b70/public/js/sharing/share.js
----------------------------------------------------------------------
diff --git a/public/js/sharing/share.js b/public/js/sharing/share.js
index 7b21297..ee4885e 100755
--- a/public/js/sharing/share.js
+++ b/public/js/sharing/share.js
@@ -29,7 +29,7 @@ $(function() {
                 var data = users[user];
                 var access = access_enum.NONE;
                 if (data.hasOwnProperty("access")) {
-                    console.log("Found access parameter");
+                    //console.log("Found access parameter");
                     if (data.access.write) {
                         access = access_enum.WRITE;
                     }
@@ -47,7 +47,7 @@ $(function() {
                     $users.append($user);
                 }
                 else {
-                    console.log("adding shared user");
+                    //console.log("adding shared user");
                     $user.addClass('share-box-share-item sharing-updated');
                     share_settings[user] = data.access;
                     $share.append($user);
@@ -96,9 +96,11 @@ $(function() {
         if ($('#share-box-users').find('.user-thumbnail').length === 0) {
             ajax_data = $(e.target).data();
 
+            $('#share-box-users').addClass('text-align-center').text('Loading user list');
+
             $.ajax({
                 url: ajax_data.url,
-                method: 'post',
+                method: 'get',
                 data: {resourceId: ajax_data.resourceId},
                 dataType: "json",
                 error: function(xhr, status, error) {
@@ -109,7 +111,7 @@ $(function() {
 
                     $users = $('#share-box-users');
                     $users.empty().removeClass('text-align-center');
-
+                    console.log(data);
                     for (user in data) {
                         if (data.hasOwnProperty(user)) {
                             $user = createThumbnail(user, data.firstname, data.lastname,
data.email, access_enum.NONE, true);
@@ -124,10 +126,7 @@ $(function() {
             });
         }
 
-        $('#share-box-users').addClass('text-align-center').text('Loading user list');
-
         $share_list = $('#shared-users').children();
-
         if ($share_list.filter('.sharing-thumbnail').length > 0) {
             $share_list.sort(comparator);
             $share_list.each(function(index, element) {


Mime
View raw message