refresh button for non live mode on job detail page and job stdout page

This commit is contained in:
Jared Tabor
2014-07-17 16:43:15 -04:00
parent a4851308b4
commit e17a9a9e1d
7 changed files with 39 additions and 22 deletions

View File

@@ -23,13 +23,14 @@ function Home($scope, $compile, $routeParams, $rootScope, $location, Wait, Dashb
refresh: { refresh: {
mode: 'all', mode: 'all',
awToolTip: "Refresh the page", awToolTip: "Refresh the page",
ngClick: "refresh()" ngClick: "refresh()",
}, ngShow:"socketStatus == 'error'"
stream: {
ngClick: "showActivity()",
awToolTip: "View Activity Stream",
mode: 'all'
} }
// stream: {
// ngClick: "showActivity()",
// awToolTip: "View Activity Stream",
// mode: 'all'
// }
}; };
html = Button({ html = Button({
@@ -38,11 +39,11 @@ function Home($scope, $compile, $routeParams, $rootScope, $location, Wait, Dashb
toolbar: true toolbar: true
}); });
html += Button({ // html += Button({
btn: buttons.stream, // btn: buttons.stream,
action: 'stream', // action: 'stream',
toolbar: true // toolbar: true
}); // });
e = angular.element(document.getElementById('home-list-actions')); e = angular.element(document.getElementById('home-list-actions'));
e.html(html); e.html(html);
@@ -75,7 +76,7 @@ function Home($scope, $compile, $routeParams, $rootScope, $location, Wait, Dashb
nv.dev=false; nv.dev=false;
var winHeight = $(window).height(), var winHeight = $(window).height(),
available_height = winHeight - $('#main-menu-container .navbar').outerHeight() - $('#count-container').outerHeight() - 80; available_height = winHeight - $('#main-menu-container .navbar').outerHeight() - $('#count-container').outerHeight() - 93;
$('.graph-container').height(available_height/2); $('.graph-container').height(available_height/2);
// chart.update(); // chart.update();
@@ -99,7 +100,7 @@ function Home($scope, $compile, $routeParams, $rootScope, $location, Wait, Dashb
}); });
} }
else{ else{
$('#dash-host-count-graph').replaceWith("<div id='dash-host-count-graph' class='left-side col-sm-12 col-xs-12'></div>"); $('#dash-host-count-graph').remove(); //replaceWith("<div id='dash-host-count-graph' class='left-side col-sm-12 col-xs-12'></div>");
} }

View File

@@ -105,7 +105,7 @@ function JobDetailController ($location, $rootScope, $scope, $compile, $routePar
if ($rootScope.jobDetailInterval) { if ($rootScope.jobDetailInterval) {
window.clearInterval($rootScope.jobDetailInterval); window.clearInterval($rootScope.jobDetailInterval);
} }
$scope.$emit('LoadJob'); $scope.$emit('LoadJob'); //this is what is used for the refresh
} }
} }
}); });
@@ -1135,6 +1135,9 @@ function JobDetailController ($location, $rootScope, $scope, $compile, $routePar
status: status status: status
}); });
}; };
scope.refresh = function(){
$scope.$emit('LoadJob');
};
scope.editHost = function(id) { scope.editHost = function(id) {
HostsEdit({ HostsEdit({

View File

@@ -68,7 +68,7 @@ function JobStdoutController ($log, $rootScope, $scope, $compile, $routeParams,
if (event_queue > 0) { if (event_queue > 0) {
// events happened since the last check // events happened since the last check
$log.debug('checking for stdout...'); $log.debug('checking for stdout...');
if (loaded_sections.length === 0) { if (loaded_sections.length === 0) { ////this if statement for refresh
$log.debug('calling LoadStdout'); $log.debug('calling LoadStdout');
$scope.$emit('LoadStdout'); $scope.$emit('LoadStdout');
} }
@@ -159,6 +159,16 @@ function JobStdoutController ($log, $rootScope, $scope, $compile, $routeParams,
msg: 'Failed to retrieve job: ' + job_id + '. GET returned: ' + status }); msg: 'Failed to retrieve job: ' + job_id + '. GET returned: ' + status });
}); });
$scope.refresh = function(){
if (loaded_sections.length === 0) { ////this if statement for refresh
$log.debug('calling LoadStdout');
$scope.$emit('LoadStdout');
}
else if (live_event_processing) {
$log.debug('calling getNextSection');
getNextSection();
}
};
$scope.stdOutScrollToTop = function() { $scope.stdOutScrollToTop = function() {
// scroll up or back in time toward the beginning of the file // scroll up or back in time toward the beginning of the file

View File

@@ -139,7 +139,7 @@ angular.module('JobStatusGraphWidget', ['RestServices', 'Utilities'])
; ;
chart.xAxis chart.xAxis
.axisLabel("Time").showMaxMin(true) .axisLabel("Time")//.showMaxMin(true)
.tickFormat(function(d) { .tickFormat(function(d) {
var dx = graphData[0].values[d] && graphData[0].values[d].x || 0; var dx = graphData[0].values[d] && graphData[0].values[d].x || 0;
return dx ? d3.time.format(timeFormat)(new Date(Number(dx+'000'))) : ''; return dx ? d3.time.format(timeFormat)(new Date(Number(dx+'000'))) : '';
@@ -159,7 +159,7 @@ angular.module('JobStatusGraphWidget', ['RestServices', 'Utilities'])
.datum(graphData).transition() .datum(graphData).transition()
.attr('width', width) .attr('width', width)
.attr('height', height) .attr('height', height)
.duration(500) .duration(1000)
.call(chart) .call(chart)
.style({ .style({
// 'width': width, // 'width': width,

View File

@@ -1,12 +1,12 @@
<div class="tab-pane" id="home"> <div class="tab-pane" id="home">
<div ng-cloak id="htmlTemplate" style="padding:10px"> <div ng-cloak id="htmlTemplate" style="padding:10px">
<!--<div id="refresh-row" class="row"> <div id="refresh-row" class="row">
<div class="col-lg-12"> <div class="col-lg-12">
<div id="home-list-actions" class="list-actions pull-right"></div> <div id="home-list-actions" class="list-actions pull-right">
<!-- <button type="button" class="btn btn-xs btn-primary ng-hide" ng-click="refreshJobs()" id="refresh_btn" aw-tool-tip="Refresh the page" data-placement="top" ng-show="socketStatus == 'error'" data-original-title="" title=""><i class="fa fa-refresh fa-lg"></i> </button></div> -->
</div> </div>
</div> </div>
-->
<div class="row"> <div class="row">
<div id="dash-counts" class="col-sm-12 col-xs-12"></div> <div id="dash-counts" class="col-sm-12 col-xs-12"></div>

View File

@@ -16,6 +16,7 @@
<div class="row"> <div class="row">
<div class="col-md-12 text-right"> <div class="col-md-12 text-right">
<a href="/#/jobs/{{ job_id }}/stdout" id="view-stdout-button" target="_blank" type="button" class="btn btn-primary btn-xs" aw-tool-tip="View standard out. Opens in new tab or window." data-placement="top"><i class="fa fa-external-link"></i></a> <a href="/#/jobs/{{ job_id }}/stdout" id="view-stdout-button" target="_blank" type="button" class="btn btn-primary btn-xs" aw-tool-tip="View standard out. Opens in new tab or window." data-placement="top"><i class="fa fa-external-link"></i></a>
<button type="button" class="btn btn-xs btn-primary ng-hide" ng-click="refresh()" id="refresh_btn" aw-tool-tip="Refresh the page" data-placement="top" ng-show="socketStatus == 'error'" data-original-title="" title=""><i class="fa fa-refresh fa-lg"></i> </button>
<a href="" ng-click="deleteJob()" id="cancel-job-button" ng-show="job_status.status == 'running'" type="button" class="btn btn-primary btn-xs" aw-tool-tip="Cancel" data-placement="top"><i class="fa fa-minus-circle"></i></a> <a href="" ng-click="deleteJob()" id="cancel-job-button" ng-show="job_status.status == 'running'" type="button" class="btn btn-primary btn-xs" aw-tool-tip="Cancel" data-placement="top"><i class="fa fa-minus-circle"></i></a>
<a href="" ng-click="deleteJob()" id="delete-job-button" ng-show="job_status.status != 'running'" type="button" class="btn btn-primary btn-xs" aw-tool-tip="Delete" data-placement="top"><i class="fa fa-trash-o"></i></a> <a href="" ng-click="deleteJob()" id="delete-job-button" ng-show="job_status.status != 'running'" type="button" class="btn btn-primary btn-xs" aw-tool-tip="Delete" data-placement="top"><i class="fa fa-trash-o"></i></a>
<a href="" ng-click="relaunchJob()" id="relaunch-job-button" type="button" class="btn btn-primary btn-xs" aw-tool-tip="Relaunch using the same parameters" data-placement="top"><i class="fa fa-rocket"></i></a> <a href="" ng-click="relaunchJob()" id="relaunch-job-button" type="button" class="btn btn-primary btn-xs" aw-tool-tip="Relaunch using the same parameters" data-placement="top"><i class="fa fa-rocket"></i></a>

View File

@@ -2,13 +2,15 @@
<div ng-cloak id="htmlTemplate"> <div ng-cloak id="htmlTemplate">
<div class="row"> <div class="row">
<div id="breadcrumb-container" class="col-md-12" style="position: relative;"> <div id="breadcrumb-container" class="col-md-6" style="position: relative;">
<ul class="ansible-breadcrumb" id="breadcrumb-list"> <ul class="ansible-breadcrumb" id="breadcrumb-list">
<li><a href="/#/jobs">Jobs</a></li> <li><a href="/#/jobs">Jobs</a></li>
<li><a href="/#/jobs/{{ job.id }}"><strong>{{ job.id }}</strong> - {{ job.name }}</a></li> <li><a href="/#/jobs/{{ job.id }}"><strong>{{ job.id }}</strong> - {{ job.name }}</a></li>
<li class="active"><a href="">Standard Out</a></li> <li class="active"><a href="">Standard Out</a></li>
</ul> </ul>
</div> </div>
<div id="home-list-actions" class="list-actions pull-right col-md-6">
<button type="button" class="btn btn-xs btn-primary ng-hide" ng-click="refresh()" id="refresh_btn" aw-tool-tip="Refresh the page" data-placement="top" ng-show="socketStatus == 'error'" data-original-title="" title=""><i class="fa fa-refresh fa-lg"></i> </button></div>
</div> </div>
</div> </div>