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/02/09 16:56:15 UTC

[47/50] [abbrv] airavata-php-gateway git commit: Improving Project Summary code + Interface

Improving Project Summary code + Interface


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

Branch: refs/heads/master
Commit: c886c46bb7620ae34a7f46fef8e0d9bdcb82ca5c
Parents: 7e14dd6
Author: Nipurn Doshi <ni...@gmail.com>
Authored: Fri Feb 5 15:14:33 2016 -0500
Committer: Nipurn Doshi <ni...@gmail.com>
Committed: Fri Feb 5 15:14:33 2016 -0500

----------------------------------------------------------------------
 app/libraries/ExperimentUtilities.php           |  25 ++-
 .../partials/experiment-container.blade.php     |  32 +--
 app/views/project/summary.blade.php             | 200 +++++++------------
 3 files changed, 107 insertions(+), 150 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/c886c46b/app/libraries/ExperimentUtilities.php
----------------------------------------------------------------------
diff --git a/app/libraries/ExperimentUtilities.php b/app/libraries/ExperimentUtilities.php
index 94dac15..9d9eebc 100644
--- a/app/libraries/ExperimentUtilities.php
+++ b/app/libraries/ExperimentUtilities.php
@@ -1050,7 +1050,6 @@ class ExperimentUtilities
         return $states;
     }
 
-
     public static function apply_changes_to_experiment($experiment, $input)
     {
         $experiment->experimentName = $input['experiment-name'];
@@ -1106,6 +1105,30 @@ class ExperimentUtilities
         }
     }
 
+    public static function get_status_color_class( $status)
+    {
+        switch ( $status) {
+            case 'CANCELING':
+            case 'CANCELED':
+            case 'UNKNOWN':
+                $statusClass = 'text-warning';
+                break;
+            case 'FAILED':
+                $statusClass = 'text-danger';
+                break;
+            case 'COMPLETED':
+                $statusClass = 'text-success';
+                break;
+            case 'COMPLETE':
+                $statusClass = 'text-success';
+                break;
+            default:
+                $statusClass = 'text-info';
+                break;
+        }
+        return $statusClass;
+    }
+
     public static function get_job_details($experimentId)
     {
         return Airavata::getJobDetails(Session::get('authz-token'), $experimentId);

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/c886c46b/app/views/partials/experiment-container.blade.php
----------------------------------------------------------------------
diff --git a/app/views/partials/experiment-container.blade.php b/app/views/partials/experiment-container.blade.php
index 71d6454..f128631 100644
--- a/app/views/partials/experiment-container.blade.php
+++ b/app/views/partials/experiment-container.blade.php
@@ -56,32 +56,12 @@
 
                     <td class="time" unix-time="{{ $experiment['experiment']->creationTime / 1000 }}"></td>
 
-                <?php
-
-                switch ($experiment['expValue']['experimentStatusString']) {
-                    case 'CANCELING':
-                    case 'CANCELED':
-                    case 'UNKNOWN':
-                        $textClass = 'text-warning';
-                        break;
-                    case 'FAILED':
-                        $textClass = 'text-danger';
-                        break;
-                    case 'COMPLETED':
-                        $textClass = 'text-success';
-                        break;
-                    default:
-                        $textClass = 'text-info';
-                        break;
-                }
-
-                ?>
-                <td>
-                    <a class="{{$textClass}}"
-                       href="{{ URL::to('/') }}/experiment/summary?expId={{$experiment['experiment']->experimentId }}">
-                        {{$experiment['expValue']['experimentStatusString'] }}
-                    </a>
-                </td>
+                    <td>
+                        <a class="{{ ExperimentUtilities::get_status_color_class( $experiment['expValue']['experimentStatusString'] ) }}"
+                           href="{{ URL::to('/') }}/experiment/summary?expId={{$experiment['experiment']->experimentId }}">
+                            {{$experiment['expValue']['experimentStatusString'] }}
+                        </a>
+                    </td>
 
                 </tr>
             @endforeach

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/c886c46b/app/views/project/summary.blade.php
----------------------------------------------------------------------
diff --git a/app/views/project/summary.blade.php b/app/views/project/summary.blade.php
index ad94095..13ea8b8 100755
--- a/app/views/project/summary.blade.php
+++ b/app/views/project/summary.blade.php
@@ -9,6 +9,7 @@
 <div class="container" style="max-width: 80%;">
     <?php
         $project = ProjectUtilities::get_project($_GET['projId']);
+        $experiments = ProjectUtilities::get_experiments_in_project($project->projectID);
     ?>
     <h1>Project Summary
         @if( !isset($dashboard))
@@ -16,130 +17,83 @@
                   title="Refresh"><span class="glyphicon glyphicon-refresh refresh-exp"></span></a></small>
         @endif
     </h1>
-    <?php
-
-    echo '<div>';
-
-    echo '<div>';
-    echo '<h3>' . $project->name . ' <a href="edit?projId=' .
-        $project->projectID .
-        '" title="Edit"><span class="glyphicon glyphicon-pencil"></span></a></h3>';
-    echo "<p>$project->description</p>";
-    echo '</div>';
-
-    $experiments = ProjectUtilities::get_experiments_in_project($project->projectID);
-
-    echo '<div class="table-responsive">';
-    echo '<table class="table">';
-
-    echo '<tr>';
-
-    echo '<th>Name</th>';
-    echo '<th>Application</th>';
-    echo '<th>Compute Resource</th>';
-    echo '<th>Last Modified Time</th>';
-    echo '<th>Experiment Status</th>';
-    echo '<th>Job Status</th>';
-
-    echo '</tr>';
-
-    foreach ($experiments as $experiment) {
-        $expValues = ExperimentUtilities::get_experiment_values($experiment, $project, true);
-        $expValues["jobState"] = ExperimentUtilities::get_job_status($experiment);
-        $applicationInterface = AppUtilities::get_application_interface($experiment->executionId);
-
-        switch ($expValues["experimentStatusString"]) {
-            case 'CANCELING':
-            case 'CANCELED':
-            case 'UNKNOWN':
-                $expStatustextClass = 'text-warning';
-                break;
-            case 'FAILED':
-                $expStatustextClass = 'text-danger';
-                break;
-            case 'COMPLETED':
-                $expStatustextClass = 'text-success';
-                break;
-            default:
-                $expStatustextClass = 'text-info';
-                break;
-        }
-        switch ($expValues["jobState"]) {
-            case 'CANCELING':
-            case 'CANCELED':
-            case 'UNKNOWN':
-                $jobStatustextClass = 'text-warning';
-                break;
-            case 'FAILED':
-                $jobStatustextClass = 'text-danger';
-                break;
-            case 'COMPLETED':
-                $jobStatustextClass = 'text-success';
-                break;
-            case 'COMPLETE':
-                $jobStatustextClass = 'text-success';
-                break;
-            default:
-                $jobStatustextClass = 'text-info';
-                break;
-        }
-
-        echo '<tr>';
-
-        echo '<td>';
-        switch ($expValues["experimentStatusString"]) {
-            case 'SCHEDULED':
-            case 'LAUNCHED':
-            case 'EXECUTING':
-            case 'CANCELING':
-            case 'COMPLETED':
-            case 'FAILED':
-                echo '<a href="' . URL::to('/') . '/experiment/summary?expId=' .
-                        $experiment->experimentId . '">' . $experiment->experimentName . '</a>';
-                break;
-            default:
-                echo '<a href="' . URL::to('/') . '/experiment/summary?expId=' .
-                        $experiment->experimentId . '">' . $experiment->experimentName . '</a>' .
-                        ' <a href="' . URL::to('/') . '/experiment/edit?expId=' .
-                        $experiment->experimentId .
-                        '" title="Edit"><span class="glyphicon glyphicon-pencil"></span></a>';
-                break;
-        }
-        echo '</td>';
-
-        echo "<td>$applicationInterface->applicationName</td>";
-
-        echo '<td>';
-        try {
-            $cr = CRUtilities::get_compute_resource($experiment->userConfigurationData
-                ->computationalResourceScheduling->resourceHostId);
-            if (!empty($cr)) {
-                echo $cr->hostName;
-            }
-        } catch (Exception $ex) {
-            //Error while retrieving the CR
-        }
-        echo '</td>';
-        echo '<td class="time" unix-time="' . $expValues["experimentTimeOfStateChange"] . '"></td>';
-
-
-        echo '<td><div class="' . $expStatustextClass . '">' . $expValues["experimentStatusString"] . '</div></td>';
-
-        if (isset($expValues["jobState"])) echo '
-            <td><div class="' . $jobStatustextClass . '">' . $expValues["jobState"] . '</div></td>';
-        else
-            echo '<td></td>';
-        echo '</tr>';
-    }
-
-    echo '</table>';
-    echo '</div>';
-    echo '</div>';
-
-    ?>
-
-
+    <div>
+        <div>
+            <h3>{{ $project->name }} 
+                <a href="edit?projId={{ $project->projectID }}" title="Edit">
+                    <span class="glyphicon glyphicon-pencil"></span>
+                </a>
+            </h3>
+            <p>{{ $project->description }}</p>
+        </div>
+        <div class="table-responsive">
+            <table class="table">
+                <tr>
+
+                    <th>Name</th>
+                    <th>Application</th>
+                    <th>Compute Resource</th>
+                    <th>Last Modified Time</th>
+                    <th>Experiment Status</th>
+                    <th>Job Status</th>
+
+                </tr>
+                <?php 
+
+                foreach ($experiments as $experiment) {
+                    $expValues = ExperimentUtilities::get_experiment_values($experiment, $project, true);
+                    $expValues["jobState"] = ExperimentUtilities::get_job_status($experiment);
+                    $applicationInterface = AppUtilities::get_application_interface($experiment->executionId);
+                    
+                    try {
+                        $cr = CRUtilities::get_compute_resource($experiment->userConfigurationData->computationalResourceScheduling->resourceHostId);
+                        if (!empty($cr)) {
+                            $resourceName = $cr->hostName;
+                        }
+                    } catch (Exception $ex) {
+                        $resourceName = 'Error while retrieving the CR';
+                    }
+                    ?>
+
+                <tr>
+                    <td> 
+                        {{ $experiment->experimentName }} 
+                        @if( $expValues['editable'])
+                            <a href="{{URL::to('/')}}/experiment/edit?expId={{$experiment->experimentId}}" title="Edit"><span class="glyphicon glyphicon-pencil"></span></a>
+                        @endif
+                    </td>
+                    <td>
+                        @if( $applicationInterface != null )
+                            {{ $applicationInterface->applicationName }}
+                        @else
+                            <span class='text-danger'>Removed</span>
+                        @endif
+                    </td>
+
+                    <td>{{ $resourceName }}</td>
+                    <td class="time" unix-time="{{$expValues["experimentTimeOfStateChange"]}}"></td>
+                    <td>
+                        <div class="{{ExperimentUtilities::get_status_color_class( $expValues["experimentStatusString"])}}">
+                            {{ $expValues["experimentStatusString"] }}
+                        </div>
+                    </td>
+
+                    <td>
+                    @if (isset($expValues["jobState"]) )
+                        <div class="{{ ExperimentUtilities::get_status_color_class( $expValues["jobState"]) }}">
+                            {{ $expValues["jobState"] }}
+                        </div>
+                    @endif
+                    </td>
+                </tr>
+                <?php
+                }
+                ?>
+            </table>
+        </div>
+    </div>
 </div>
+
 @stop
 @section('scripts')
 @parent