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 2015/07/13 19:25:11 UTC
[17/42] airavata-php-gateway git commit: Showing experiment details
in experiment statistics page
Showing experiment details in experiment statistics page
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/3993dc3f
Tree: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/tree/3993dc3f
Diff: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/diff/3993dc3f
Branch: refs/heads/airavata-php-gateway-0.15-release
Commit: 3993dc3f667956059fda553cf4b7541defb28dea
Parents: 7bf8663
Author: Supun Nakandala <sc...@apache.org>
Authored: Fri Jun 12 16:39:19 2015 +0530
Committer: Supun Nakandala <sc...@apache.org>
Committed: Fri Jun 12 16:39:19 2015 +0530
----------------------------------------------------------------------
app/controllers/AdminController.php | 16 ++-
app/libraries/AdminUtilities.php | 39 ++++++-
app/routes.php | 2 +
app/views/admin/experiment-statistics.blade.php | 116 +++++++++++++++++--
app/views/admin/manage-experiments.blade.php | 8 +-
app/views/experiment/search.blade.php | 95 +--------------
.../partials/experiment-container.blade.php | 92 +++++++++++++++
7 files changed, 258 insertions(+), 110 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/3993dc3f/app/controllers/AdminController.php
----------------------------------------------------------------------
diff --git a/app/controllers/AdminController.php b/app/controllers/AdminController.php
index d4f4dfc..3993838 100644
--- a/app/controllers/AdminController.php
+++ b/app/controllers/AdminController.php
@@ -116,9 +116,9 @@ class AdminController extends BaseController {
$inputs = Input::all();
- $gateway = AdminUtilities::addGateway(Input::all() );
+ $gateway = AdminUtilities::add_gateway(Input::all());
- $tm = WSIS::createTenant(1, $inputs["admin-username"], $inputs["admin-password"], $inputs["admin-email"],
+ $tm = WSIS::createTenant(1, $inputs["admin-username"], $inputs["admin-password"], $inputs["admin-email"],
$inputs["admin-firstname"], $inputs["admin-lastname"], $inputs["domain"]);
return $gateway;
@@ -129,9 +129,19 @@ class AdminController extends BaseController {
{
if (Request::ajax()) {
$inputs = Input::all();
- $expStatistics = AdminUtilities::getExperimentExecutionStatistics(strtotime($inputs['fromTime']) * 1000
+ $expStatistics = AdminUtilities::get_experiment_execution_statistics(strtotime($inputs['fromTime']) * 1000
, strtotime($inputs['toTime']) * 1000);
return View::make("admin/experiment-statistics", array("expStatistics" => $expStatistics));
}
}
+
+ public function getExperimentsOfTimeRange()
+ {
+ if (Request::ajax()) {
+ $inputs = Input::all();
+ $expContainer = AdminUtilities::get_experiments_of_time_range($inputs);
+ $expStates = ExperimentUtilities::getExpStates();
+ return View::make("partials/experiment-container", array("expContainer" => $expContainer, "expStates" => $expStates));
+ }
+ }
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/3993dc3f/app/libraries/AdminUtilities.php
----------------------------------------------------------------------
diff --git a/app/libraries/AdminUtilities.php b/app/libraries/AdminUtilities.php
index c859db8..95a8c42 100644
--- a/app/libraries/AdminUtilities.php
+++ b/app/libraries/AdminUtilities.php
@@ -10,7 +10,7 @@ class AdminUtilities
* @param $input
* @return string
*/
- public static function addGateway($input)
+ public static function add_gateway($input)
{
$gateway = new Gateway();
$gateway->gatewayId = $input["gatewayName"];
@@ -26,8 +26,43 @@ class AdminUtilities
* @param $toTime
* @return \Airavata\Model\Workspace\Experiment\ExperimentStatistics
*/
- public static function getExperimentExecutionStatistics($fromTime, $toTime)
+ public static function get_experiment_execution_statistics($fromTime, $toTime)
{
return Airavata::getExperimentStatistics(Config::get('pga_config.airavata')['gateway-id'], $fromTime, $toTime);
}
+
+ /**
+ * Method to get experiments of a particular time range
+ * @param $inputs
+ * @return array
+ */
+ public static function get_experiments_of_time_range($inputs)
+ {
+ $experimentStatistics = AdminUtilities::get_experiment_execution_statistics(
+ strtotime($inputs["from-date"]) * 1000,
+ strtotime($inputs["to-date"]) * 1000
+ );
+ $experiments = array();
+ if ($inputs["status-type"] == "ALL") {
+ $experiments = $experimentStatistics->allExperiments;
+ } else if ($inputs["status-type"] == "COMPLETED") {
+ $experiments = $experimentStatistics->completedExperiments;
+ } elseif ($inputs["status-type"] == "FAILED") {
+ $experiments = $experimentStatistics->failedExperiments;
+ } else if ($inputs["status-type"] == "CANCELED") {
+ $experiments = $experimentStatistics->cancelledExperiments;
+ }
+
+ $expContainer = array();
+ $expNum = 0;
+ foreach ($experiments as $experiment) {
+ $expValue = ExperimentUtilities::get_experiment_values($experiment, ProjectUtilities::get_project($experiment->projectID), true);
+ $expContainer[$expNum]['experiment'] = $experiment;
+ $expValue["editable"] = false;
+ $expContainer[$expNum]['expValue'] = $expValue;
+ $expNum++;
+ }
+
+ return $expContainer;
+ }
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/3993dc3f/app/routes.php
----------------------------------------------------------------------
diff --git a/app/routes.php b/app/routes.php
index da8e601..e6fb483 100755
--- a/app/routes.php
+++ b/app/routes.php
@@ -168,6 +168,8 @@ Route::get("admin/dashboard/roles", "AdminController@rolesView");
Route::get("admin/dashboard/experiments", "AdminController@experimentsView");
+Route::get("admin/dashboard/experimentsOfTimeRange", "AdminController@getExperimentsOfTimeRange");
+
Route::get("admin/dashboard/experimentStatistics", "AdminController@experimentStatistics");
Route::get("admin/dashboard/resources", "AdminController@resourcesView");
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/3993dc3f/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 88938c4..36cd5d5 100644
--- a/app/views/admin/experiment-statistics.blade.php
+++ b/app/views/admin/experiment-statistics.blade.php
@@ -13,8 +13,8 @@
</div>
</div>
</div>
- <a href="#">
- <div class="panel-footer">
+ <a id="getAllExperiments" href="#experiment-container">
+ <div class="panel-footer">
<span class="pull-left">View Details</span>
<span class="pull-right"><span class="glyphicon glyphicon-arrow-right"></span></span>
@@ -37,8 +37,8 @@
</div>
</div>
</div>
- <a href="#">
- <div class="panel-footer">
+ <a id="getCompletedExperiments" href="#experiment-container">
+ <div class="panel-footer">
<span class="pull-left">View Details</span>
<span class="pull-right"><span class="glyphicon glyphicon-arrow-right"></span></i></span>
@@ -61,8 +61,8 @@
</div>
</div>
</div>
- <a href="#">
- <div class="panel-footer">
+ <a id="getCancelledExperiments" href="#experiment-container">
+ <div class="panel-footer">
<span class="pull-left">View Details</span>
<span class="pull-right"><span class="glyphicon glyphicon-arrow-right"></span></i></span>
@@ -85,8 +85,8 @@
</div>
</div>
</div>
- <a href="#">
- <div class="panel-footer">
+ <a id="getFailedExperiments" href="#experiment-container">
+ <div class="panel-footer">
<span class="pull-left">View Details</span>
<span class="pull-right"><span class="glyphicon glyphicon-arrow-right"></span></span>
@@ -96,3 +96,103 @@
</div>
</div>
</div>
+
+<div id="experiment-container" style="margin: 20px" class="experiment-container"></div>
+
+<script>
+ $("#getAllExperiments").click(function () {
+ //These are coming from manage-experiments.blade.php
+ $fromTime = $("#datetimepicker9").find("input").val();
+ $toTime = $("#datetimepicker10").find("input").val();
+ if ($fromTime == '' || $toTime == '') {
+ alert("Please Select Valid Date Inputs!");
+ } else {
+ $.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);
+ }
+ });
+ }
+ });
+
+ $("#getCompletedExperiments").click(function () {
+ //These are coming from manage-experiments.blade.php
+ $fromTime = $("#datetimepicker9").find("input").val();
+ $toTime = $("#datetimepicker10").find("input").val();
+ if ($fromTime == '' || $toTime == '') {
+ alert("Please Select Valid Date Inputs!");
+ } else {
+ $.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);
+ }
+ });
+ }
+ });
+
+ $("#getCancelledExperiments").click(function () {
+ //These are coming from manage-experiments.blade.php
+ $fromTime = $("#datetimepicker9").find("input").val();
+ $toTime = $("#datetimepicker10").find("input").val();
+ if ($fromTime == '' || $toTime == '') {
+ alert("Please Select Valid Date Inputs!");
+ } else {
+ $.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);
+ }
+ });
+ }
+ });
+
+ $("#getFailedExperiments").click(function () {
+ //These are coming from manage-experiments.blade.php
+ $fromTime = $("#datetimepicker9").find("input").val();
+ $toTime = $("#datetimepicker10").find("input").val();
+ if ($fromTime == '' || $toTime == '') {
+ alert("Please Select Valid Date Inputs!");
+ } else {
+ $.ajax({
+ type: 'GET',
+ url: "{{URL::to('/')}}/admin/dashboard/experimentsOfTimeRange",
+ data: {
+ 'status-type': 'FAILED',
+ 'search-key': 'creation-time',
+ 'from-date': $fromTime,
+ 'to-date': $toTime
+ },
+ async: false,
+ success: function (data) {
+ $(".experiment-container").html(data);
+ }
+ });
+ }
+ });
+</script>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/3993dc3f/app/views/admin/manage-experiments.blade.php
----------------------------------------------------------------------
diff --git a/app/views/admin/manage-experiments.blade.php b/app/views/admin/manage-experiments.blade.php
index d1dfadf..deca14b 100644
--- a/app/views/admin/manage-experiments.blade.php
+++ b/app/views/admin/manage-experiments.blade.php
@@ -74,9 +74,9 @@
</div>
</div>
<div class="experiment-statistics"></div>
+ <div class="loading-img-statistics hide text-center"><img src="{{URL::to('/')}}/assets/ajax-loader.gif"/></div>
</div>
-
<!--<div class="row">-->
<!-- <div class="col-lg-12">-->
<!-- <div class="panel panel-primary">-->
@@ -377,14 +377,16 @@ to be uncommented when actually in use.
if ($fromTime == '' || $toTime == '') {
alert("Please Select Valid Date Inputs!");
} else {
+ $(".loading-img-statistics").removeClass("hide");
$.ajax({
url: 'experimentStatistics?fromTime=' + $fromTime + '&' + 'toTime=' + $toTime,
type: 'get',
success: function (data) {
$(".experiment-statistics").html(data);
-
}
- })
+ }).complete(function () {
+ $(".loading-img-statistics").addClass("hide");
+ });
}
});
</script>
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/3993dc3f/app/views/experiment/search.blade.php
----------------------------------------------------------------------
diff --git a/app/views/experiment/search.blade.php b/app/views/experiment/search.blade.php
index 926268e..672206e 100755
--- a/app/views/experiment/search.blade.php
+++ b/app/views/experiment/search.blade.php
@@ -106,101 +106,8 @@
?>
</form>
+ @include('partials/experiment-container')
-
-
- <?php
-
- if (isset($expContainer))
- {
- if (sizeof($expContainer) == 0)
- {
- if ($pageNo == 1) {
- CommonUtilities::print_warning_message('No results found. Please try again.');
- } else {
- CommonUtilities::print_warning_message('No more results found.');
- }
- }
- else
- {
- ?>
-
- <div id="re" class="table-responsive">
- <table class="table">
- <tr>
- <th>Name</th>
- <th>Application</th>
- <th>Description</th>
- <!--<th>Resource</th>-->
- <th>Creation Time</th>
- <th>Status</th>
- <!-- <select class="form-control select-status">-->
- <!-- <option value="ALL">Status</option>-->
- <!-- @foreach( $expStates as $index => $state)-->
- <!-- <option value="{{ $state }}">{{ $state }}</option>-->
- <!-- @endforeach-->
- <!-- </select>-->
- <!-- </th>-->
- </tr>
-
-
- <?php
- foreach ($expContainer as $experiment) {
- $description = $experiment['experiment']->description;
- if (strlen($description) > 17) // 17 is arbitrary
- {
- $description = substr($experiment['experiment']->description, 0, 17) . '<span class="text-muted">...</span>';
- }
-
- echo '<tr>';
- $addEditOption = "";
- if ($experiment['expValue']['editable'])
- $addEditOption = '<a href="' . URL::to('/') . '/experiment/edit?expId=' . $experiment['experiment']->experimentID . '" title="Edit"><span class="glyphicon glyphicon-pencil"></span></a>';
-
- echo '<td>' . $experiment['experiment']->name . $addEditOption . '</td>';
-
- echo '<td>' . $experiment['expValue']['applicationInterface']->applicationName . '</td>';
-
- echo '<td>' . $description . '</td>';
-
- //echo "<td>$computeResource->hostName</td>";
- echo '<td class="time" unix-time="' . $experiment['experiment']->creationTime / 1000 . '"></td>';
-
-
- 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="<?php echo $textClass; ?>"
- href="{{ URL::to('/') }}/experiment/summary?expId=<?php echo $experiment['experiment']->experimentID; ?>">
- <?php echo $experiment['expValue']['experimentStatusString']; ?>
- </a>
- </td>
-
- </tr>
-
- <?php
- }
- }
- }
- ?>
- </table>
- </div>
</div>
@stop
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/3993dc3f/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
new file mode 100644
index 0000000..eb5b31d
--- /dev/null
+++ b/app/views/partials/experiment-container.blade.php
@@ -0,0 +1,92 @@
+<?php
+
+if (isset($expContainer))
+{
+if (sizeof($expContainer) == 0)
+{
+ if (isset($pageNo) && $pageNo == 1) {
+ CommonUtilities::print_warning_message('No results found. Please try again.');
+ } else {
+ CommonUtilities::print_warning_message('No more results found.');
+ }
+}
+else
+{
+?>
+
+<div id="re" class="table-responsive">
+ <table class="table">
+ <tr>
+ <th>Name</th>
+ <th>Application</th>
+ <th>Description</th>
+ <!--<th>Resource</th>-->
+ <th>Creation Time</th>
+ <th>Status</th>
+ <!-- <select class="form-control select-status">-->
+ <!-- <option value="ALL">Status</option>-->
+ <!-- @foreach( $expStates as $index => $state)-->
+ <!-- <option value="{{ $state }}">{{ $state }}</option>-->
+ <!-- @endforeach-->
+ <!-- </select>-->
+ <!-- </th>-->
+ </tr>
+
+
+ <?php
+ foreach ($expContainer as $experiment) {
+ $description = $experiment['experiment']->description;
+ if (strlen($description) > 17) // 17 is arbitrary
+ {
+ $description = substr($experiment['experiment']->description, 0, 17) . '<span class="text-muted">...</span>';
+ }
+
+ echo '<tr>';
+ $addEditOption = "";
+ if ($experiment['expValue']['editable'])
+ $addEditOption = '<a href="' . URL::to('/') . '/experiment/edit?expId=' . $experiment['experiment']->experimentID . '" title="Edit"><span class="glyphicon glyphicon-pencil"></span></a>';
+
+ echo '<td>' . $experiment['experiment']->name . $addEditOption . '</td>';
+
+ echo '<td>' . $experiment['expValue']['applicationInterface']->applicationName . '</td>';
+
+ echo '<td>' . $description . '</td>';
+
+ //echo "<td>$computeResource->hostName</td>";
+ echo '<td class="time" unix-time="' . $experiment['experiment']->creationTime / 1000 . '"></td>';
+
+
+ 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="<?php echo $textClass; ?>"
+ href="{{ URL::to('/') }}/experiment/summary?expId=<?php echo $experiment['experiment']->experimentID; ?>">
+ <?php echo $experiment['expValue']['experimentStatusString']; ?>
+ </a>
+ </td>
+
+ </tr>
+
+ <?php
+ }
+ }
+ }
+ ?>
+ </table>
+</div>
\ No newline at end of file