Merge branch 'develop' into AIRAVATA-2270-special-chars-in-expid
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/98c74def Tree: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/tree/98c74def Diff: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/diff/98c74def Branch: refs/heads/develop Commit: 98c74defbc1a4c31b1071effc5717a74f4eaccf7 Parents: 71d4f7f 199c902 Author: Marcus Christie <[email protected]> Authored: Wed Dec 28 11:26:01 2016 -0500 Committer: Marcus Christie <[email protected]> Committed: Wed Dec 28 11:26:01 2016 -0500 ---------------------------------------------------------------------- app/controllers/ExperimentController.php | 31 ++-- app/views/admin/manage-experiments.blade.php | 21 ++- app/views/experiment/summary.blade.php | 163 +++++++++++----------- app/views/layout/basic.blade.php | 2 +- app/views/layout/fixed-scripts.blade.php | 69 +++++---- app/views/partials/experiment-info.blade.php | 81 ++++++----- 6 files changed, 191 insertions(+), 176 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/98c74def/app/controllers/ExperimentController.php ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/98c74def/app/views/admin/manage-experiments.blade.php ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/98c74def/app/views/experiment/summary.blade.php ---------------------------------------------------------------------- diff --cc app/views/experiment/summary.blade.php index cfb4fdf,9e3ad09..647d26c --- a/app/views/experiment/summary.blade.php +++ b/app/views/experiment/summary.blade.php @@@ -13,95 -13,98 +13,98 @@@ @section('scripts') @parent <script> - @if( isset( $autoRefresh) ) - var autoRefresh = true; - @else - var autoRefresh = false; - @endif - var isDialogOpen = false; - - var currentJobStatuses = {}; - @foreach( $expVal["jobDetails"] as $index => $jobDetail) - currentJobStatuses["{{$jobDetail->jobId}}"] = "{{ $jobDetail->jobStatuses[0]->jobStateName}}"; - @endforeach - - var isStatusChanged = function(experimentTimeOfStateChange, jobStatuses) { - - if ($.trim($("#lastModifiedTime").val()) != experimentTimeOfStateChange) { - return true; - } - for (var jobId in jobStatuses) { - if (jobId in currentJobStatuses) { - if (currentJobStatuses[jobId] !== jobStatuses[jobId]){ - return true; + @if(!isset( $invalidExperimentId ) ) + + @if( isset( $autoRefresh) ) + var autoRefresh = true; + @else + var autoRefresh = false; + @endif + var isDialogOpen = false; + + var currentJobStatuses = {}; + + @foreach( $expVal["jobDetails"] as $index => $jobDetail) + currentJobStatuses["{{$jobDetail->jobId}}"] = "{{ $jobDetail->jobStatuses[0]->jobStateName}}"; + @endforeach + + var isStatusChanged = function(experimentTimeOfStateChange, jobStatuses) { + + if ($.trim($("#lastModifiedTime").val()) != experimentTimeOfStateChange) { + return true; + } + for (var jobId in jobStatuses) { + if (jobId in currentJobStatuses) { + if (currentJobStatuses[jobId] !== jobStatuses[jobId]){ + return true; + } + } else { + return true; // if job not in currentJobStatuses } - } else { - return true; // if job not in currentJobStatuses } + return false; } - return false; - } - - // Check for a status change every 3 seconds - var statusChangeInterval = setInterval(function () { - if (($.trim($(".exp-status").html()) != "COMPLETED" && $.trim($(".exp-status").html()) != "FAILED" - && $.trim($(".exp-status").html()) != "CANCELLED") && autoRefresh) { - $.ajax({ - type: "GET", - url: "{{URL::to('/') }}/experiment/summary", - data: {expId: {{ json_encode(Input::get('expId')) }}, isAutoRefresh : autoRefresh }, - success: function (data) { - - // Don't refresh the page if a dialog is open - if (isDialogOpen) { - return; - } - data = $.parseJSON( data); + // Check for a status change every 3 seconds + var statusChangeInterval = setInterval(function () { + if (($.trim($(".exp-status").html()) != "COMPLETED" && $.trim($(".exp-status").html()) != "FAILED" + && $.trim($(".exp-status").html()) != "CANCELLED") && autoRefresh) { + $.ajax({ + type: "GET", + url: "{{URL::to('/') }}/experiment/summary", - data: {expId: "{{ Input::get('expId') }}", isAutoRefresh : autoRefresh }, ++ data: {expId: {{ json_encode(Input::get('expId')) }}, isAutoRefresh : autoRefresh }, + success: function (data) { + + // Don't refresh the page if a dialog is open + if (isDialogOpen) { + return; + } - // Convert jobDetails to a map of jobStatuses - var jobStatuses = {}; - var jobDetails = data["jobDetails"]; - for (var jobIndex in jobDetails){ - if (jobDetails.hasOwnProperty(jobIndex)) { - var jobDetail = jobDetails[jobIndex]; - // Assuming only one job status per job - jobStatuses[jobDetail["jobId"]] = jobDetail["jobStatuses"]["0"]["jobStateName"]; + data = $.parseJSON( data); + + // Convert jobDetails to a map of jobStatuses + var jobStatuses = {}; + var jobDetails = data["jobDetails"]; + for (var jobIndex in jobDetails){ + if (jobDetails.hasOwnProperty(jobIndex)) { + var jobDetail = jobDetails[jobIndex]; + // Assuming only one job status per job + jobStatuses[jobDetail["jobId"]] = jobDetail["jobStatuses"]["0"]["jobStateName"]; + } } - } - if (isStatusChanged(data.expVal["experimentTimeOfStateChange"], jobStatuses)) { - $(".refresh-exp").click(); - clearInterval(statusChangeInterval); + if (isStatusChanged(data.expVal["experimentTimeOfStateChange"], jobStatuses)) { + $(".refresh-exp").click(); + clearInterval(statusChangeInterval); + } } - } - }); - } - }, 3000); + }); + } + }, 3000); - $('.btn-toggle').click(function() { - if(autoRefresh){ - autoRefresh = false; - }else{ - autoRefresh = true; - } + $('.btn-toggle').click(function() { + if(autoRefresh){ + autoRefresh = false; + }else{ + autoRefresh = true; + } - $(this).find('.btn').toggleClass('active'); - if ($(this).find('.btn-primary').size()>0) { - $(this).find('.btn').toggleClass('btn-primary'); - } - $(this).find('.btn').toggleClass('btn-default'); - }); - - $('#refresh-experiment').click(function() { - console.log(autoRefresh); - window.location.replace("{{URL::to('/') }}/experiment/summary?expId={{ urlencode(Input::get('expId')) }}&isAutoRefresh=" + autoRefresh); - }); - - $('.modal, #share-box').on('show', function (e) { - isDialogOpen = true; - }).on('hide', function (e) { - isDialogOpen = false; - }); + $(this).find('.btn').toggleClass('active'); + if ($(this).find('.btn-primary').size()>0) { + $(this).find('.btn').toggleClass('btn-primary'); + } + $(this).find('.btn').toggleClass('btn-default'); + }); + + $('#refresh-experiment').click(function() { - window.location.replace("{{URL::to('/') }}/experiment/summary?" + "expId=" + "{{ Input::get('expId') }}"+"&"+ "isAutoRefresh=" + autoRefresh); ++ window.location.replace("{{URL::to('/') }}/experiment/summary?expId={{ urlencode(Input::get('expId')) }}&isAutoRefresh=" + autoRefresh); + }); + + $('.modal, #share-box').on('show', function (e) { + isDialogOpen = true; + }).on('hide', function (e) { + isDialogOpen = false; + }); + @endif //if(!isset( $invalidExperimentId ) ) </script> @stop http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/98c74def/app/views/partials/experiment-info.blade.php ---------------------------------------------------------------------- diff --cc app/views/partials/experiment-info.blade.php index 4a0e0f6,f9cbe89..a0b027e --- a/app/views/partials/experiment-info.blade.php +++ b/app/views/partials/experiment-info.blade.php @@@ -289,47 -289,42 +289,42 @@@ @endif <input type="hidden" id="lastModifiedTime" value="{{ $expVal['experimentTimeOfStateChange'] }}"/> - <!-- check of correct experiment Id ends here --> - @endif - - @endif - </div> + <div class="modal fade" id="clone-experiment-modal" tabindex="-1" role="dialog" aria-labelledby="clone-experiment-modal-title" + aria-hidden="true"> + <div class="modal-dialog"> + <div class="modal-content"> + <div class="modal-header"> + <h3 class="text-center" id="clone-experiment-modal-title">Clone experiment</h3> + </div> + <div class="modal-body"> + <form class="form-inline" action="{{ URL::to('/') }}/experiment/clone" method="post"> - <input type="hidden" name="expId" value="{{ Input::get('expId') }}"/> ++ <input type="hidden" name="expId" value="{{{ Input::get('expId') }}}"/> + <div class="form-group"> + <label for="projectId">Project</label> + <select class="form-control" name="projectId" required> + @foreach($writeableProjects as $project) + <option value="{{{ $project->projectID }}}" + @if( $project->projectID == $experiment->projectId) + selected + @endif + >{{{ $project->optionLabel }}}</option> + @endforeach + </select> + </div> - <div class="modal fade" id="clone-experiment-modal" tabindex="-1" role="dialog" aria-labelledby="clone-experiment-modal-title" - aria-hidden="true"> - <div class="modal-dialog"> - <div class="modal-content"> - <div class="modal-header"> - <h3 class="text-center" id="clone-experiment-modal-title">Clone experiment</h3> - </div> - <div class="modal-body"> - <form class="form-inline" action="{{ URL::to('/') }}/experiment/clone" method="post"> - <input type="hidden" name="expId" value="{{{ Input::get('expId') }}}"/> + <button type="submit" + class="btn btn-info" + role="button" + title="Create a clone of the experiment. Cloning is the only way to change an experiment's settings after it has been launched."> + <span class="glyphicon glyphicon-edit"></span> + Clone + </a> + </form> + </div> + <div class="modal-footer"> <div class="form-group"> - <label for="projectId">Project</label> - <select class="form-control" name="projectId" required> - @foreach($writeableProjects as $project) - <option value="{{{ $project->projectID }}}" - @if( $project->projectID == $experiment->projectId) - selected - @endif - >{{{ $project->optionLabel }}}</option> - @endforeach - </select> - </div> - - <button type="submit" - class="btn btn-info" - role="button" - title="Create a clone of the experiment. Cloning is the only way to change an experiment's settings after it has been launched."> - <span class="glyphicon glyphicon-edit"></span> - Clone - </a> - </form> - </div> - <div class="modal-footer"> - <div class="form-group"> - <input type="button" class="btn btn-default" data-dismiss="modal" value="Cancel"/> + <input type="button" class="btn btn-default" data-dismiss="modal" value="Cancel"/> + </div> </div> </div> </div>
