airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From scnakand...@apache.org
Subject [3/4] airavata-php-gateway git commit: fixing AIRAVATA-1942
Date Wed, 30 Mar 2016 20:26:50 GMT
fixing AIRAVATA-1942


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

Branch: refs/heads/master
Commit: 29e1020b68dec59a297628eb37ec886f2b0d0b79
Parents: f7900df
Author: scnakandala <supun.nakandala@gmail.com>
Authored: Wed Mar 30 15:35:03 2016 -0400
Committer: scnakandala <supun.nakandala@gmail.com>
Committed: Wed Mar 30 15:35:03 2016 -0400

----------------------------------------------------------------------
 app/controllers/ExperimentController.php     |  3 -
 app/libraries/ExperimentUtilities.php        | 68 +++++++++++++++++++----
 app/views/partials/experiment-info.blade.php |  4 +-
 3 files changed, 59 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/29e1020b/app/controllers/ExperimentController.php
----------------------------------------------------------------------
diff --git a/app/controllers/ExperimentController.php b/app/controllers/ExperimentController.php
index dca8d53..07a3366 100755
--- a/app/controllers/ExperimentController.php
+++ b/app/controllers/ExperimentController.php
@@ -86,9 +86,6 @@ class ExperimentController extends BaseController
             $autoRefresh = false;
         }
         if ($experiment != null) {
-             $data = array(
-                "autoRefresh"=> $autoRefresh,
-            );
             //viewing experiments of other gateways is not allowed if user is not super admin
             if( $experiment->gatewayId != Session::get("gateway_id") && !Session::has("super-admin")){
                 Session::put("permissionDenied", true);

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/29e1020b/app/libraries/ExperimentUtilities.php
----------------------------------------------------------------------
diff --git a/app/libraries/ExperimentUtilities.php b/app/libraries/ExperimentUtilities.php
index d2b7298..ae5a94e 100644
--- a/app/libraries/ExperimentUtilities.php
+++ b/app/libraries/ExperimentUtilities.php
@@ -89,14 +89,68 @@ class ExperimentUtilities
                 if(!ExperimentUtilities::endsWith($dataRoot, "/"))
                     $dataRoot = $dataRoot . "/";
                 $filePath = str_replace($dataRoot, "", parse_url($currentInputPath, PHP_URL_PATH));
-                echo '<p>' . $input->name . '&nbsp;<a target="_blank" href="'
. URL::to("/") . '/download/?path=' . $filePath . '">' . basename($filePath) . ' <span
class="glyphicon glyphicon-new-window"></span></a></p>';
+                echo '<p>' . $input->name . ':&nbsp;<a target="_blank" href="'
. URL::to("/") . '/download/?path=' . $filePath . '">' . basename($filePath) . ' <span
class="glyphicon glyphicon-new-window"></span></a></p>';
             } elseif ($input->type == DataType::STRING || $input->type == DataType::INTEGER
                 || $input->type == DataType::FLOAT) {
+                echo '<p>' . $input->name . ':&nbsp;' . $input->value . '</p>';
+            }
+        }
+    }
+
+    /**
+     * List the process's input files
+     * @param $experiment
+     */
+    public static function list_process_input_files($processInputs)
+    {
+        $order = array();
+        foreach ($processInputs as $index => $input) {
+            $order[$index] = $input->inputOrder;
+        }
+        array_multisort($order, SORT_ASC, $processInputs);
+
+        foreach ($processInputs as $input) {
+            $matchingAppInput = null;
+
+            if ($input->type == DataType::URI) {
+                $dataRoot = Config::get("pga_config.airavata")["experiment-data-absolute-path"];
+                if(!ExperimentUtilities::endsWith($dataRoot, "/"))
+                    $dataRoot = $dataRoot . "/";
+                $filePath = str_replace($dataRoot, "", parse_url($input->value, PHP_URL_PATH));
+                echo '<p>' . $input->name . ':&nbsp;<a target="_blank" href="'
. URL::to("/")
+                    . '/download/?path=' . $filePath . '">' . basename($filePath) . '
<span class="glyphicon glyphicon-new-window"></span></a></p>';
+            }elseif ($input->type == DataType::STRING || $input->type == DataType::INTEGER
+                || $input->type == DataType::FLOAT) {
                 echo '<p>' . $input->name . ': ' . $input->value . '</p>';
             }
         }
     }
 
+    /**
+     * List the process's output files
+     * @param $experiment
+     */
+    public static function list_process_output_files($outputs, $status){
+        if ($status != ProcessState::COMPLETED)
+            echo "Process hasn't completed. Process Status is : " . ProcessState::$__names[
$status] . '<br/>';
+
+        foreach ((array)$outputs as $output) {
+            if ($output->type == DataType::URI || $output->type == DataType::STDOUT
|| $output->type == DataType::STDERR) {
+                $dataRoot = Config::get("pga_config.airavata")["experiment-data-absolute-path"];
+                if(!ExperimentUtilities::endsWith($dataRoot, "/"))
+                    $dataRoot = $dataRoot . "/";
+                $filePath = str_replace($dataRoot, "", parse_url($output->value, PHP_URL_PATH));
+                echo '<p>' . $output->name . ':&nbsp;<a target="_blank" href="'
. URL::to("/")
+                    . '/download/?path=' . $filePath . '">' . basename($filePath) . '
<span class="glyphicon glyphicon-new-window"></span></a></p>';
+            }
+            elseif ($output->type == DataType::STRING) {
+                echo '<p>' . $output->value . '</p>';
+            }
+            else
+                echo 'output : '. $output;
+        }
+    }
+
     private  static function endsWith($haystack, $needle) {
         // search forward starting from end minus needle length characters
         return $needle === "" || (($temp = strlen($haystack) - strlen($needle)) >= 0 &&
strpos($haystack, $needle, $temp) !== false);
@@ -666,16 +720,8 @@ class ExperimentUtilities
 
     public static function list_output_files($outputs, $status, $process)
     {
-        if( $process)
-        {
-            if ($status != ProcessState::COMPLETED)
-                echo "Process hasn't completed. Process Status is : " . ProcessState::$__names[
$status] . '<br/>';
-        }
-        else
-        {
-            if ( $status != ExperimentState::COMPLETED)
-                echo "Experiment hasn't completed. Experiment Status is : " .  ExperimentState::$__names[
$status] . '<br/>';
-        }
+        if ( $status != ExperimentState::COMPLETED)
+            echo "Experiment hasn't completed. Experiment Status is : " .  ExperimentState::$__names[
$status] . '<br/>';
 
         foreach ((array)$outputs as $output) {
             if ($output->type == DataType::URI || $output->type == DataType::STDOUT
|| $output->type == DataType::STDERR) {

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/29e1020b/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 40bd84a..83b0197 100644
--- a/app/views/partials/experiment-info.blade.php
+++ b/app/views/partials/experiment-info.blade.php
@@ -248,7 +248,7 @@
                         <li>
                             <span class="alert"><i class="icon-time"></i>
                                 <p>Inputs<br/>
-                                {{ ExperimentUtilities::list_input_files( $process->processInputs)
}}</p>
+                                {{ ExperimentUtilities::list_process_input_files( $process->processInputs)
}}</p>
                             </span>
                         </li>
                         <li>
@@ -282,7 +282,7 @@
                         <li>
                             <span class="alert"><i class="icon-time"></i>
                                 <p>Outputs<hr/>
-                                {{ ExperimentUtilities::list_output_files( $process->processOutputs,
$process->processStatus->state, true) }}</p>
+                                {{ ExperimentUtilities::list_process_output_files( $process->processOutputs,
$process->processStatus->state) }}</p>
                             </span>
                         </li>
                     </ul>


Mime
View raw message