You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by sc...@apache.org on 2016/11/09 21:36:36 UTC

[1/3] airavata-php-gateway git commit: AIRAVATA-2196 Fix canceling experiment

Repository: airavata-php-gateway
Updated Branches:
  refs/heads/develop efde17967 -> 7fe660409


AIRAVATA-2196 Fix canceling experiment

Also changed <input> buttons to <button> buttons


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

Branch: refs/heads/develop
Commit: 50e91170dfac4a44bd35c3ede5f4591de1dbf8b8
Parents: 5f6e8e4
Author: Marcus Christie <ma...@iu.edu>
Authored: Wed Nov 9 10:18:15 2016 -0500
Committer: Marcus Christie <ma...@iu.edu>
Committed: Wed Nov 9 10:18:15 2016 -0500

----------------------------------------------------------------------
 app/controllers/ExperimentController.php     |  7 -------
 app/routes.php                               |  2 --
 app/views/partials/experiment-info.blade.php | 20 ++++++++++----------
 3 files changed, 10 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/50e91170/app/controllers/ExperimentController.php
----------------------------------------------------------------------
diff --git a/app/controllers/ExperimentController.php b/app/controllers/ExperimentController.php
index a27d02f..c36d3ed 100755
--- a/app/controllers/ExperimentController.php
+++ b/app/controllers/ExperimentController.php
@@ -197,13 +197,6 @@ class ExperimentController extends BaseController
         }
     }
 
-    public function expCancel()
-    {
-        ExperimentUtilities::cancel_experiment(Input::get("expId"));
-
-        return Redirect::to('experiment/summary?expId=' . Input::get("expId"));
-    }
-
     public function expChange()
     {
         //var_dump( Input::all() ); exit;

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/50e91170/app/routes.php
----------------------------------------------------------------------
diff --git a/app/routes.php b/app/routes.php
index 6fc817b..4136655 100755
--- a/app/routes.php
+++ b/app/routes.php
@@ -108,8 +108,6 @@ Route::get("experiment/edit", "ExperimentController@editView");
 
 Route::post("experiment/edit", "ExperimentController@editSubmit");
 
-Route::post("experiment/cancel", "ExperimentController@expCancel");
-
 Route::get("experiment/getQueueView", "ExperimentController@getQueueView");
 
 Route::get("experiment/browse", "ExperimentController@browseView");

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/50e91170/app/views/partials/experiment-info.blade.php
----------------------------------------------------------------------
diff --git a/app/views/partials/experiment-info.blade.php b/app/views/partials/experiment-info.blade.php
index bd13668..062a7f8 100644
--- a/app/views/partials/experiment-info.blade.php
+++ b/app/views/partials/experiment-info.blade.php
@@ -239,18 +239,19 @@
         @endif
         </div>
         <div class="btn-toolbar">
-            <input name="launch"
+            <button name="launch"
+                    type="submit"
+                    class="btn btn-success"
+                    title="Launch the experiment" @if ( !$expVal["editable"]) style="display: none" @endif>
+                    Launch
+            </button>
+            <button name="cancel"
                    type="submit"
-                   class="btn btn-success"
-                   value="Launch"
-                   title="Launch the experiment" @if ( !$expVal["editable"]) style="display: none" @endif>
-            <a id="cancel_exp_link" href="{{URL::to('/') }}/experiment/cancel?expId={{ $experiment->experimentId }}"
-               class="btn btn-default" onclick="return confirm('Are you sure you want to cancel this experiment?')"
-               role="button"
-               title="Cancel experiment" @if (!$expVal["cancelable"]) style="display: none" @endif>
+                   class="btn btn-default" onclick="return confirm('Are you sure you want to cancel this experiment?')"
+                   title="Cancel experiment" @if (!$expVal["cancelable"]) style="display: none" @endif>
                 <span class="glyphicon glyphicon-remove"></span>
                 Cancel
-            </a>
+            </button>
             <input type="hidden" name="expId" value="{{ Input::get('expId') }}"/>
             <a href="{{URL::to('/') }}/experiment/edit?expId={{ $experiment->experimentId }}&savedExp=true"
                class="btn btn-default"
@@ -263,7 +264,6 @@
             <button name="update-sharing"
                    type="submit"
                    class="btn btn-primary"
-                   value="Update Sharing"
                    title="Update sharing settings">
                 <span class="glyphicon glyphicon-share"></span>
                 Update Sharing


[2/3] airavata-php-gateway git commit: AIRAVATA-2196 Only owner can change experiment sharing

Posted by sc...@apache.org.
AIRAVATA-2196 Only owner can change experiment sharing


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

Branch: refs/heads/develop
Commit: 25808c53c31bf1e9184b8751671ec096866d927f
Parents: 50e9117
Author: Marcus Christie <ma...@iu.edu>
Authored: Wed Nov 9 15:58:46 2016 -0500
Committer: Marcus Christie <ma...@iu.edu>
Committed: Wed Nov 9 16:29:18 2016 -0500

----------------------------------------------------------------------
 app/controllers/ExperimentController.php       | 23 +++++++++++++++------
 app/libraries/ExperimentUtilities.php          |  2 +-
 app/views/partials/experiment-info.blade.php   | 15 ++++----------
 app/views/partials/experiment-inputs.blade.php |  2 +-
 4 files changed, 23 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/25808c53/app/controllers/ExperimentController.php
----------------------------------------------------------------------
diff --git a/app/controllers/ExperimentController.php b/app/controllers/ExperimentController.php
index c36d3ed..83586e0 100755
--- a/app/controllers/ExperimentController.php
+++ b/app/controllers/ExperimentController.php
@@ -77,7 +77,9 @@ class ExperimentController extends BaseController
                 $users = SharingUtilities::getProfilesForSharedUsers($_POST['project'], ResourceType::PROJECT);
                 $owner = array();
 
-                return View::make("experiment/create-complete", array("expInputs" => $experimentInputs, "users" => json_encode($users), "owner" => json_encode($owner)));
+                return View::make("experiment/create-complete", array("expInputs" => $experimentInputs,
+                    "users" => json_encode($users), "owner" => json_encode($owner),
+                    "canEditSharing" => true));
             }else{
                 return View::make("experiment/no-sharing-create-complete", array("expInputs" => $experimentInputs));
             }
@@ -160,17 +162,18 @@ class ExperimentController extends BaseController
                 $users = SharingUtilities::getProfilesForSharedUsers(Input::get("expId"), ResourceType::EXPERIMENT);
 
                 $owner = array();
-                $is_owner = false;
                 if (strcmp(Session::get("username"), $experiment->userName) !== 0) {
                     $owner[$experiment->userName] = $users[$experiment->userName];
                     $users = array_diff_key($users, $owner);
-                } else {
-                    $is_owner = true;
                 }
+                // Only allow editing sharing on the summary page if the owner
+                // and the experiment isn't editable. If the experiment is
+                // editable, the sharing can be edited on the edit page.
+                $canEditSharing = $this->isExperimentOwner($experiment, Session::get("username")) && !$expVal["editable"];
                 $data['can_write'] = SharingUtilities::userCanWrite(Session::get("username"), $experiment->experimentId, ResourceType::EXPERIMENT);
                 $data["users"] = json_encode($users);
                 $data["owner"] = json_encode($owner);
-                $data["is_owner"] = $is_owner;
+                $data["canEditSharing"] = $canEditSharing;
             }
 
             if( Input::has("dashboard"))
@@ -278,8 +281,11 @@ class ExperimentController extends BaseController
                     $owner[$experiment->userName] = $users[$experiment->userName];
                     $users = array_diff_key($users, $owner);
                 }
+                $canEditSharing = $this->isExperimentOwner($experiment, Session::get('username'));
 
-                return View::make("experiment/edit", array("expInputs" => $experimentInputs, "users" => json_encode($users), "owner" => json_encode($owner)));
+                return View::make("experiment/edit", array("expInputs" => $experimentInputs,
+                    "users" => json_encode($users), "owner" => json_encode($owner),
+                    "canEditSharing" => $canEditSharing));
             }
             else {
                 Redirect::to("experiment/summary?expId=" . $experiment->experimentId)->with("error", "You do not have permission to edit this experiment");
@@ -432,6 +438,11 @@ class ExperimentController extends BaseController
             return Response::json(array("error" => "Error: No experiment specified"));
         }
     }
+
+    private function isExperimentOwner($experiment, $username)
+    {
+        return strcmp($username, $experiment->userName) === 0;
+    }
 }
 
 ?>

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/25808c53/app/libraries/ExperimentUtilities.php
----------------------------------------------------------------------
diff --git a/app/libraries/ExperimentUtilities.php b/app/libraries/ExperimentUtilities.php
index 0f7a935..f629399 100755
--- a/app/libraries/ExperimentUtilities.php
+++ b/app/libraries/ExperimentUtilities.php
@@ -571,7 +571,7 @@ class ExperimentUtilities
                 '<p>AiravataSystemException: ' . $ase->getMessage() . '</p>');
         }
 
-        if(Config::get('pga_config.airavata')["data-sharing-enabled"]){
+        if(Config::get('pga_config.airavata')["data-sharing-enabled"] && isset($_POST['share-settings'])){
             $share = $_POST['share-settings'];
             ExperimentUtilities::share_experiment($expId, json_decode($share));
         }

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/25808c53/app/views/partials/experiment-info.blade.php
----------------------------------------------------------------------
diff --git a/app/views/partials/experiment-info.blade.php b/app/views/partials/experiment-info.blade.php
index 062a7f8..6ba71df 100644
--- a/app/views/partials/experiment-info.blade.php
+++ b/app/views/partials/experiment-info.blade.php
@@ -229,13 +229,8 @@
     <form id="experiment-form" action="{{URL::to('/') }}/experiment/summary" method="post" role="form">
 
         <div class="form-group">
-        @if(Config::get('pga_config.airavata')["data-sharing-enabled"])
-            @if($is_owner)
-            <!-- Only allow editing sharing here if the experiment isn't editable -->
-            @include('partials/sharing-display-body', array("form" => !$expVal["editable"]))
-            @else
-            @include('partials/sharing-display-body', array("form" => false))
-            @endif
+        @if(Config::get('pga_config.airavata')["data-sharing-enabled"] && isset($canEditSharing))
+            @include('partials/sharing-display-body', array("form" => $canEditSharing))
         @endif
         </div>
         <div class="btn-toolbar">
@@ -260,7 +255,7 @@
                 <span class="glyphicon glyphicon-pencil"></span>
                 Edit
             </a>
-            @if(Config::get('pga_config.airavata')["data-sharing-enabled"] && $is_owner && !$expVal["editable"])
+            @if(Config::get('pga_config.airavata')["data-sharing-enabled"] && isset($canEditSharing) && $canEditSharing)
             <button name="update-sharing"
                    type="submit"
                    class="btn btn-primary"
@@ -393,10 +388,8 @@
 </div>
 @endif
 
-@if(Config::get('pga_config.airavata')["data-sharing-enabled"] and isset($is_owner))
-    @if($is_owner)
+@if(Config::get('pga_config.airavata')["data-sharing-enabled"] and isset($canEditSharing) && $canEditSharing)
     @include('partials/sharing-form-modal')
-    @endif
 @endif
 @section('scripts')
 @parent

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/25808c53/app/views/partials/experiment-inputs.blade.php
----------------------------------------------------------------------
diff --git a/app/views/partials/experiment-inputs.blade.php b/app/views/partials/experiment-inputs.blade.php
index 69ae78c..b9ac2cf 100644
--- a/app/views/partials/experiment-inputs.blade.php
+++ b/app/views/partials/experiment-inputs.blade.php
@@ -26,7 +26,7 @@
 </div>
 
 <div class="form-group">
-    @include('partials/sharing-display-body', array("form" => true))
+    @include('partials/sharing-display-body', array("form" => $canEditSharing))
 </div>
 
 <div class="panel panel-default">


[3/3] airavata-php-gateway git commit: Merge branch 'AIRAVATA-2196-fix-experiment-sharing' of https://github.com/machristie/airavata-php-gateway into develop

Posted by sc...@apache.org.
Merge branch 'AIRAVATA-2196-fix-experiment-sharing' of https://github.com/machristie/airavata-php-gateway into develop


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

Branch: refs/heads/develop
Commit: 7fe66040923abf7d0e947ca946f4973b3d592fa1
Parents: efde179 25808c5
Author: scnakandala <su...@gmail.com>
Authored: Wed Nov 9 16:36:29 2016 -0500
Committer: scnakandala <su...@gmail.com>
Committed: Wed Nov 9 16:36:29 2016 -0500

----------------------------------------------------------------------
 app/controllers/ExperimentController.php       | 30 ++++++++++--------
 app/libraries/ExperimentUtilities.php          |  2 +-
 app/routes.php                                 |  2 --
 app/views/partials/experiment-info.blade.php   | 35 +++++++++------------
 app/views/partials/experiment-inputs.blade.php |  2 +-
 5 files changed, 33 insertions(+), 38 deletions(-)
----------------------------------------------------------------------