AIRAVATA-1792 App name and hostname filtering
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/60a8b48e Tree: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/tree/60a8b48e Diff: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/diff/60a8b48e Branch: refs/heads/develop Commit: 60a8b48e2716237f8a47a7f815352932987051bb Parents: 84032b4 Author: Marcus Christie <[email protected]> Authored: Tue Dec 13 10:27:10 2016 -0500 Committer: Marcus Christie <[email protected]> Committed: Tue Dec 13 10:27:10 2016 -0500 ---------------------------------------------------------------------- app/controllers/AdminController.php | 7 +++++-- app/libraries/AdminUtilities.php | 15 +++++++++++---- app/views/admin/experiment-statistics.blade.php | 12 ++++++------ app/views/admin/manage-experiments.blade.php | 17 +++++++++++------ 4 files changed, 33 insertions(+), 18 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/60a8b48e/app/controllers/AdminController.php ---------------------------------------------------------------------- diff --git a/app/controllers/AdminController.php b/app/controllers/AdminController.php index 7babeca..c2b547d 100644 --- a/app/controllers/AdminController.php +++ b/app/controllers/AdminController.php @@ -325,9 +325,12 @@ class AdminController extends BaseController { if (Request::ajax()) { $inputs = Input::all(); $username = Input::get('username'); + $appname = Input::get('appname'); + $hostname = Input::get('hostname'); $expStatistics = AdminUtilities::get_experiment_execution_statistics(strtotime($inputs['fromTime']) * 1000 - , strtotime($inputs['toTime']) * 1000, $username); - return View::make("admin/experiment-statistics", array("expStatistics" => $expStatistics, "username" => $username)); + , strtotime($inputs['toTime']) * 1000, $username, $appname, $hostname); + return View::make("admin/experiment-statistics", array("expStatistics" => $expStatistics, + "username" => $username, "appname" => $appname, "hostname" => $hostname)); } } http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/60a8b48e/app/libraries/AdminUtilities.php ---------------------------------------------------------------------- diff --git a/app/libraries/AdminUtilities.php b/app/libraries/AdminUtilities.php index a5ee37f..03d168b 100644 --- a/app/libraries/AdminUtilities.php +++ b/app/libraries/AdminUtilities.php @@ -125,14 +125,19 @@ class AdminUtilities * @param $toTime * @return \Airavata\Model\Experiment\ExperimentStatistics */ - public static function get_experiment_execution_statistics($fromTime, $toTime, $username) + public static function get_experiment_execution_statistics($fromTime, $toTime, $username, $appname, $hostname) { if (trim($username) == '') { $username = null; } - Log::debug("get_experiment_execution_statistics", array($fromTime, $toTime, $username)); + if (trim($appname) == '') { + $appname = null; + } + if (trim($hostname) == '') { + $hostname = null; + } return Airavata::getExperimentStatistics(Session::get('authz-token'), - Config::get('pga_config.airavata')['gateway-id'], $fromTime, $toTime, $username, null, null); + Config::get('pga_config.airavata')['gateway-id'], $fromTime, $toTime, $username, $appname, $hostname); } /** @@ -145,7 +150,9 @@ class AdminUtilities $experimentStatistics = AdminUtilities::get_experiment_execution_statistics( strtotime($inputs["from-date"]) * 1000, strtotime($inputs["to-date"]) * 1000, - $inputs['username'] + $inputs['username'], + $inputs['appname'], + $inputs['hostname'] ); $experiments = array(); if ($inputs["status-type"] == "ALL") { http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/60a8b48e/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 8339193..e4a5c86 100644 --- a/app/views/admin/experiment-statistics.blade.php +++ b/app/views/admin/experiment-statistics.blade.php @@ -145,11 +145,9 @@ <div id="experiment-container" style="margin: 20px" class="experiment-container"></div> <script> - @if ($username) - var username = "{{ $username }}"; - @else - var username = null; - @endif + var username = @if ($username) "{{ $username }}" @else null @endif; + var appname = @if ($appname) "{{ $appname }}" @else null @endif; + var hostname = @if ($hostname) "{{ $hostname }}" @else null @endif; $("#getAllExperiments").click(function () { getExperimentsOfStatus( 'ALL'); @@ -194,7 +192,9 @@ 'search-key': 'creation-time', 'from-date': $fromTime, 'to-date': $toTime, - 'username': username + 'username': username, + 'appname': appname, + 'hostname': hostname }, async: false, success: function (data) { http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/60a8b48e/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 e3fd4e6..09c0e4e 100644 --- a/app/views/admin/manage-experiments.blade.php +++ b/app/views/admin/manage-experiments.blade.php @@ -497,7 +497,7 @@ to be uncommented when actually in use. todayDate = moment(todayDate).utc().format('MM/DD/YYYY hh:mm a'); ydayDate = moment(ydayDate).utc().format('MM/DD/YYYY hh:mm a'); var msg = "Experiments statistics from last 24 hours"; - getExperiments( ydayDate, todayDate, null, msg); + getExperiments( ydayDate, todayDate, null, null, null, msg); }); $(".oneWeekExp").click( function(){ @@ -508,7 +508,7 @@ to be uncommented when actually in use. todayDate = moment(todayDate).utc().format('MM/DD/YYYY hh:mm a'); ydayDate = moment(ydayDate).utc().format('MM/DD/YYYY hh:mm a'); var msg = "Experiments statistics from last week"; - getExperiments( ydayDate, todayDate, null, msg); + getExperiments( ydayDate, todayDate, null, null, null, msg); }) $("#getStatistics").click(function () { @@ -517,11 +517,12 @@ to be uncommented when actually in use. $toTime = $("#datetimepicker10").find("input").val(); $toTime = moment($toTime).utc().format('MM/DD/YYYY hh:mm A'); var username = $('#username').val().trim(); - console.log("username", username); + var appname = $('#appname').val().trim(); + var hostname = $('#hostname').val().trim(); if ($fromTime == '' || $toTime == '') { alert("Please Select Valid Date Inputs!"); } else { - getExperiments( $fromTime, $toTime, username); + getExperiments( $fromTime, $toTime, username, appname, hostname); } }); @@ -578,12 +579,15 @@ to be uncommented when actually in use. // Load experiments from the last 24 hours on page load. $(".oneDayExp").click(); - function getExperiments( startTime, endTime, username, msg){ + function getExperiments( startTime, endTime, username, appname, hostname, msg){ $(".experiment-statistics").html(""); $(".loading-img-statistics").removeClass("hide"); $.ajax({ - url: 'experimentStatistics?fromTime=' + startTime + '&' + 'toTime=' + endTime + '&username=' + encodeURIComponent(username), + url: 'experimentStatistics?fromTime=' + startTime + '&' + 'toTime=' + endTime + + '&username=' + encodeURIComponent(username) + + '&appname=' + encodeURIComponent(appname) + + '&hostname=' + encodeURIComponent(hostname), type: 'get', success: function (data) { if( msg == null){ @@ -591,6 +595,7 @@ to be uncommented when actually in use. end = new Date(endTime + ' UTC'); msg = "Experiment Statistics from " + start.toLocaleTimeString() + " to " + end.toLocaleTimeString(); } + // TODO: update message to include username, appname and hostname? $(".experiment-statistics").html( "<h2 class='text-center'>" + msg + "</h2><hr/>" + data); } }).complete(function () {
