airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ndo...@apache.org
Subject [1/3] airavata-php-gateway git commit: Code refactoring
Date Wed, 10 Feb 2016 19:31:29 GMT
Repository: airavata-php-gateway
Updated Branches:
  refs/heads/develop 667d07161 -> b57204671


Code refactoring


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

Branch: refs/heads/develop
Commit: 73f23e8c4eaf75785a1ef0559bcaba70e435d1b1
Parents: 67f8c16
Author: Nipurn Doshi <nipunhere@gmail.com>
Authored: Wed Feb 10 14:22:22 2016 -0500
Committer: Nipurn Doshi <nipunhere@gmail.com>
Committed: Wed Feb 10 14:22:22 2016 -0500

----------------------------------------------------------------------
 app/libraries/AdminUtilities.php                |   3 +-
 app/libraries/ExperimentUtilities.php           |  35 ++--
 app/views/admin/experiment-statistics.blade.php | 162 +++----------------
 .../partials/interface-output-block.blade.php   |   5 +-
 4 files changed, 44 insertions(+), 161 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/73f23e8c/app/libraries/AdminUtilities.php
----------------------------------------------------------------------
diff --git a/app/libraries/AdminUtilities.php b/app/libraries/AdminUtilities.php
index b8576c4..0c8e195 100644
--- a/app/libraries/AdminUtilities.php
+++ b/app/libraries/AdminUtilities.php
@@ -61,7 +61,8 @@ class AdminUtilities
         $expContainer = array();
         $expNum = 0;
         foreach ($experiments as $experiment) {
-            $expValue = ExperimentUtilities::get_experiment_summary_values($experiment, true);
+            //var_dump( $experiment); exit;
+            $expValue = ExperimentUtilities::get_experiment_values($experiment, true);
             $expContainer[$expNum]['experiment'] = $experiment;
             $expValue["editable"] = false;
             $expContainer[$expNum]['expValue'] = $expValue;

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/73f23e8c/app/libraries/ExperimentUtilities.php
----------------------------------------------------------------------
diff --git a/app/libraries/ExperimentUtilities.php b/app/libraries/ExperimentUtilities.php
index 9d9eebc..acd6822 100644
--- a/app/libraries/ExperimentUtilities.php
+++ b/app/libraries/ExperimentUtilities.php
@@ -668,6 +668,7 @@ class ExperimentUtilities
         }
     }
 
+    /*
     public static function get_experiment_summary_values($experimentSummary, $forSearch =
false)
     {
 //        var_dump( $experimentSummary); exit;
@@ -729,7 +730,7 @@ class ExperimentUtilities
         return $expVal;
 
     }
-
+    */
 
     public static function get_experiment_values($experiment, $project, $forSearch = false)
     {
@@ -744,7 +745,12 @@ class ExperimentUtilities
         $expVal["taskStates"] = TaskState::$__names;
         $expVal["taskTypes"] = TaskTypes::$__names;
 
-        $experimentStatusString = $expVal["experimentStates"][$experiment->experimentStatus->state];
+
+        if( is_object( $experiment->experimentStatus ) )
+            $experimentStatusString = $expVal["experimentStates"][$experiment->experimentStatus->state];
+        else
+            $experimentStatusString = $experiment->experimentStatus; 
+
         $expVal["experimentStatusString"] = $experimentStatusString;
         if ( $experimentStatusString == ExperimentState::FAILED)
             $expVal["editable"] = false;
@@ -757,18 +763,16 @@ class ExperimentUtilities
 
         if ($experiment->experimentStatus != null) {
             $experimentStatus = $experiment->experimentStatus;
-            /*
-            $experimentState = $experimentStatus->state;
-            $experimentStatusString = ExperimentState::$__names[$experimentState];
-            $expVal["experimentStatusString"] = $experimentStatusString;
-            */
-            $expVal["experimentTimeOfStateChange"] = $experimentStatus->timeOfStateChange
/ 1000; // divide by 1000 since timeOfStateChange is in ms
+
+            if( is_object( $experiment->experimentStatus ) )
+                $expVal["experimentTimeOfStateChange"] = $experimentStatus->timeOfStateChange
/ 1000; // divide by 1000 since timeOfStateChange is in ms
             $expVal["experimentCreationTime"] = $experiment->creationTime / 1000; // divide
by 1000 since creationTime is in ms
         }
 
-        if (!$forSearch) {
+        if (!$forSearch && is_object( $experiment->experimentStatus) ){
             $userConfigData = $experiment->userConfigurationData;
             $scheduling = $userConfigData->computationalResourceScheduling;
+
             $expVal['scheduling'] = $scheduling;
             try {
                 $expVal["computeResource"] = CRUtilities::get_compute_resource($scheduling->resourceHostId);
@@ -786,8 +790,8 @@ class ExperimentUtilities
             $expVal["applicationInterface"]->applicationName = substr($experiment->executionId,
-8);
         }
 
-
-        switch (ExperimentState::$__names[$experiment->experimentStatus->state]) {
+        //editable statuses
+        switch ( $experimentStatusString) {
             case 'CREATED':
             case 'VALIDATED':
             case 'SCHEDULED':
@@ -798,7 +802,8 @@ class ExperimentUtilities
                 break;
         }
 
-        switch (ExperimentState::$__names[$experiment->experimentStatus->state]) {
+        //cancelable statuses
+        switch ( $experimentStatusString) {
             case 'VALIDATED':
             case 'SCHEDULED':
             case 'LAUNCHED':
@@ -920,7 +925,7 @@ class ExperimentUtilities
         $expContainer = array();
         $expNum = 0;
         foreach ($experiments as $experiment) {
-            $expValue = ExperimentUtilities::get_experiment_summary_values($experiment, true);
+            $expValue = ExperimentUtilities::get_experiment_values($experiment, true);
             $expContainer[$expNum]['experiment'] = $experiment;
             if ($expValue["experimentStatusString"] == "FAILED")
                 $expValue["editable"] = false;
@@ -977,7 +982,7 @@ class ExperimentUtilities
         $expContainer = array();
         $expNum = 0;
         foreach ($experiments as $experiment) {
-            $expValue = ExperimentUtilities::get_experiment_search_values($experiment, ProjectUtilities::get_project($experiment->projectId),
true);
+            $expValue = ExperimentUtilities::get_experiment_values($experiment, ProjectUtilities::get_project($experiment->projectId),
true);
             $expContainer[$expNum]['experiment'] = $experiment;
             if ($expValue["experimentStatusString"] == "FAILED")
                 $expValue["editable"] = false;
@@ -1023,7 +1028,7 @@ class ExperimentUtilities
         $expContainer = array();
         $expNum = 0;
         foreach ($experiments as $experiment) {
-            $expValue = ExperimentUtilities::get_experiment_summary_values($experiment, true);
+            $expValue = ExperimentUtilities::get_experiment_values($experiment, true);
             $expContainer[$expNum]['experiment'] = $experiment;
             if ($expValue["experimentStatusString"] == "FAILED")
                 $expValue["editable"] = false;

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/73f23e8c/app/views/admin/experiment-statistics.blade.php
----------------------------------------------------------------------
diff --git a/app/views/admin/experiment-statistics.blade.php b/app/views/admin/experiment-statistics.blade.php
index 59a6cdb..86973de 100644
--- a/app/views/admin/experiment-statistics.blade.php
+++ b/app/views/admin/experiment-statistics.blade.php
@@ -147,163 +147,32 @@
 <script>
 
     $("#getAllExperiments").click(function () {
-        //These are coming from manage-experiments.blade.php
-        $fromTime = $("#datetimepicker9").find("input").val();
-        $fromTime = moment($fromTime).utc().format('MM/DD/YYYY hh:mm a');
-        $toTime = $("#datetimepicker10").find("input").val();
-        $toTime = moment($toTime).utc().format('MM/DD/YYYY hh:mm a');
-        if ($fromTime == '' || $toTime == '') {
-            alert("Please Select Valid Date Inputs!");
-        } else {
-            $(".loading-img-statistics").removeClass("hide");
-            $.ajax({
-                type: 'GET',
-                url: "{{URL::to('/')}}/admin/dashboard/experimentsOfTimeRange",
-                data: {
-                    'status-type': 'ALL',
-                    'search-key': 'creation-time',
-                    'from-date': $fromTime,
-                    'to-date': $toTime
-                },
-                async: false,
-                success: function (data) {
-                    $(".experiment-container").html(data);
-                    //from time-conversion.js
-                    updateTime();
-                }
-            }).complete(function () {
-                $(".loading-img-statistics").addClass("hide");
-            });
-        }
+        getExperimentsOfStatus( 'ALL');
     });
 
     $("#getCreatedExperiments").click(function () {
-        //These are coming from manage-experiments.blade.php
-        $fromTime = $("#datetimepicker9").find("input").val();
-        $fromTime = moment($fromTime).utc().format('MM/DD/YYYY hh:mm a');
-        $toTime = $("#datetimepicker10").find("input").val();
-        $toTime = moment($toTime).utc().format('MM/DD/YYYY hh:mm a');
-
-        if ($fromTime == '' || $toTime == '') {
-            alert("Please Select Valid Date Inputs!");
-        } else {
-            $(".loading-img-statistics").removeClass("hide");
-            $.ajax({
-                type: 'GET',
-                url: "{{URL::to('/')}}/admin/dashboard/experimentsOfTimeRange",
-                data: {
-                    'status-type': 'CREATED',
-                    'search-key': 'creation-time',
-                    'from-date': $fromTime,
-                    'to-date': $toTime
-                },
-                async: false,
-                success: function (data) {
-                    $(".experiment-container").html(data);
-                    //from time-conversion.js
-                    updateTime();
-                }
-            }).complete(function () {
-                $(".loading-img-statistics").addClass("hide");
-            });
-        }
+        getExperimentsOfStatus( 'CREATED');
     });
 
     $("#getRunningExperiments").click(function () {
-        //These are coming from manage-experiments.blade.php
-        $fromTime = $("#datetimepicker9").find("input").val();
-        $fromTime = moment($fromTime).utc().format('MM/DD/YYYY hh:mm a');
-        $toTime = $("#datetimepicker10").find("input").val();
-        $toTime = moment($toTime).utc().format('MM/DD/YYYY hh:mm a');
-        if ($fromTime == '' || $toTime == '') {
-            alert("Please Select Valid Date Inputs!");
-        } else {
-            $(".loading-img-statistics").removeClass("hide");
-            $.ajax({
-                type: 'GET',
-                url: "{{URL::to('/')}}/admin/dashboard/experimentsOfTimeRange",
-                data: {
-                    'status-type': 'RUNNING',
-                    'search-key': 'creation-time',
-                    'from-date': $fromTime,
-                    'to-date': $toTime
-                },
-                async: false,
-                success: function (data) {
-                    $(".experiment-container").html(data);
-                    //from time-conversion.js
-                    updateTime();
-                }
-            }).complete(function () {
-                $(".loading-img-statistics").addClass("hide");
-            });
-        }
+        getExperimentsOfStatus( 'RUNNING');
     });
 
     $("#getCompletedExperiments").click(function () {
-        //These are coming from manage-experiments.blade.php
-        $fromTime = $("#datetimepicker9").find("input").val();
-        $fromTime = moment($fromTime).utc().format('MM/DD/YYYY hh:mm a');
-        $toTime = $("#datetimepicker10").find("input").val();
-        $toTime = moment($toTime).utc().format('MM/DD/YYYY hh:mm a');
-        if ($fromTime == '' || $toTime == '') {
-            alert("Please Select Valid Date Inputs!");
-        } else {
-            $(".loading-img-statistics").removeClass("hide");
-            $.ajax({
-                type: 'GET',
-                url: "{{URL::to('/')}}/admin/dashboard/experimentsOfTimeRange",
-                data: {
-                    'status-type': 'COMPLETED',
-                    'search-key': 'creation-time',
-                    'from-date': $fromTime,
-                    'to-date': $toTime
-                },
-                async: false,
-                success: function (data) {
-                    $(".experiment-container").html(data);
-                    //from time-conversion.js
-                    updateTime();
-                }
-            }).complete(function () {
-                $(".loading-img-statistics").addClass("hide");
-            });
-        }
+        getExperimentsOfStatus( 'COMPLETED');
     });
 
     $("#getCancelledExperiments").click(function () {
-        //These are coming from manage-experiments.blade.php
-        $fromTime = $("#datetimepicker9").find("input").val();
-        $fromTime = moment($fromTime).utc().format('MM/DD/YYYY hh:mm a');
-        $toTime = $("#datetimepicker10").find("input").val();
-        $toTime = moment($toTime).utc().format('MM/DD/YYYY hh:mm a');
-        if ($fromTime == '' || $toTime == '') {
-            alert("Please Select Valid Date Inputs!");
-        } else {
-            $(".loading-img-statistics").removeClass("hide");
-            $.ajax({
-                type: 'GET',
-                url: "{{URL::to('/')}}/admin/dashboard/experimentsOfTimeRange",
-                data: {
-                    'status-type': 'CANCELED',
-                    'search-key': 'creation-time',
-                    'from-date': $fromTime,
-                    'to-date': $toTime
-                },
-                async: false,
-                success: function (data) {
-                    $(".experiment-container").html(data);
-                    //from time-conversion.js
-                    updateTime();
-                }
-            }).complete(function () {
-                $(".loading-img-statistics").addClass("hide");
-            });
-        }
+        getExperimentsOfStatus( 'CANCELED');
     });
 
     $("#getFailedExperiments").click(function () {
+        getExperimentsOfStatus( 'FAILED');
+    });
+
+    function getExperimentsOfStatus( status){
         //These are coming from manage-experiments.blade.php
+        $(".experiment-container").html( $(".loading-img").html() );
         $fromTime = $("#datetimepicker9").find("input").val();
         $fromTime = moment($fromTime).utc().format('MM/DD/YYYY hh:mm a');
         $toTime = $("#datetimepicker10").find("input").val();
@@ -316,7 +185,7 @@
                 type: 'GET',
                 url: "{{URL::to('/')}}/admin/dashboard/experimentsOfTimeRange",
                 data: {
-                    'status-type': 'FAILED',
+                    'status-type': status,
                     'search-key': 'creation-time',
                     'from-date': $fromTime,
                     'to-date': $toTime
@@ -331,5 +200,14 @@
                 $(".loading-img-statistics").addClass("hide");
             });
         }
+    }
+
+    $(".experiment-statistics").on("click", ".get-exp-stats", function(){
+        expId = $(this).data("expid");
+        $(".experimentId").val( expId);
+        $(".get-experiment").click();
+        $('html, body').animate({
+            scrollTop: $(".get-experiment").offset().top - 100
+        }, 1000);
     });
 </script>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/73f23e8c/app/views/partials/interface-output-block.blade.php
----------------------------------------------------------------------
diff --git a/app/views/partials/interface-output-block.blade.php b/app/views/partials/interface-output-block.blade.php
index b2bc5d5..329153b 100644
--- a/app/views/partials/interface-output-block.blade.php
+++ b/app/views/partials/interface-output-block.blade.php
@@ -46,11 +46,10 @@
 
         <div class="col-md-9">
             <select name="dataMovement[]" readonly class="form-control">
-                <option>select</option>
-                <option value="1"
-                @if( isset( $appOutputs) ) @if( $appOutputs->dataMovement == 1) selected
@endif @endif>True</option>
                 <option value="0"
                 @if( isset( $appOutputs) ) @if( $appOutputs->dataMovement == 0) selected
@endif @endif>False</option>
+                <option value="1"
+                @if( isset( $appOutputs) ) @if( $appOutputs->dataMovement == 1) selected
@endif @endif>True</option>
             </select>
         </div>
         <!--


Mime
View raw message