airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From scnakand...@apache.org
Subject [5/7] airavata-php-gateway git commit: AIRAVATA-2190 Handling errors when cloning
Date Fri, 04 Nov 2016 17:55:27 GMT
AIRAVATA-2190 Handling errors when cloning


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

Branch: refs/heads/develop
Commit: 61e36dd04d6fb28231103cc4ba5345b2fb1773ad
Parents: f76343d
Author: Marcus Christie <machrist@iu.edu>
Authored: Fri Nov 4 12:39:30 2016 -0400
Committer: Marcus Christie <machrist@iu.edu>
Committed: Fri Nov 4 12:39:30 2016 -0400

----------------------------------------------------------------------
 app/controllers/ExperimentController.php     | 12 ++++++++----
 app/views/partials/experiment-info.blade.php | 10 +++++++++-
 2 files changed, 17 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/61e36dd0/app/controllers/ExperimentController.php
----------------------------------------------------------------------
diff --git a/app/controllers/ExperimentController.php b/app/controllers/ExperimentController.php
index 7b8e101..004b27d 100755
--- a/app/controllers/ExperimentController.php
+++ b/app/controllers/ExperimentController.php
@@ -289,10 +289,14 @@ class ExperimentController extends BaseController
 
     public function cloneExperiment()
     {
-        // TODO: catch and handle errors when cloning fails
-        $cloneId = ExperimentUtilities::clone_experiment(Input::get('expId'), Input::get('projectId'));
-
-        return Redirect::to('experiment/edit?expId=' . $cloneId . "&clonedExp=true");
+        try{
+            $cloneId = ExperimentUtilities::clone_experiment(Input::get('expId'), Input::get('projectId'));
+            return Redirect::to('experiment/edit?expId=' . $cloneId . "&clonedExp=true");
+        }catch (Exception $ex){
+            // Redirect to summary page and scroll down to clone panel
+            return Redirect::to("experiment/summary?expId=" . Input::get('expId') . "#clone-panel")
+                ->with("cloning-error", "Failed to clone experiment: " . $ex->getMessage());
+        }
     }
 
     public function editSubmit()

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/61e36dd0/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 0d7b621..8856cc7 100644
--- a/app/views/partials/experiment-info.blade.php
+++ b/app/views/partials/experiment-info.blade.php
@@ -263,11 +263,19 @@
             @endif
         </div>
     </form>
-    <div class="panel panel-default">
+    <div id="clone-panel" class="panel panel-default">
         <div class="panel-heading">
             <h3 class="panel-title">Clone Experiment</h3>
         </div>
         <div class="panel-body">
+            @if( Session::has("cloning-error"))
+            <div class="alert alert-danger alert-dismissible" role="alert">
+                <button type="button" class="close" data-dismiss="alert"><span aria-hidden="true">&times;</span><span
+                        class="sr-only">Close</span></button>
+                {{{ Session::get("cloning-error") }}}
+            </div>
+            {{ Session::forget("cloning-error") }}
+            @endif
             <form class="form-inline" action="{{ URL::to('/') }}/experiment/clone" method="post">
                 <input type="hidden" name="expId" value="{{ Input::get('expId') }}"/>
                 <div class="form-group">


Mime
View raw message