mirror of
https://github.com/ansible/awx.git
synced 2026-05-08 01:47:35 -02:30
Fixed scrolling issues and page resizing issues. When page resizes the number of visible rows in each table expands.
This commit is contained in:
@@ -17,7 +17,8 @@ function JobDetailController ($scope, $compile, $routeParams, ClearScope, Breadc
|
|||||||
event_queue = [],
|
event_queue = [],
|
||||||
processed_events = [],
|
processed_events = [],
|
||||||
scope = $scope,
|
scope = $scope,
|
||||||
api_complete = false;
|
api_complete = false,
|
||||||
|
refresh_count = 0;
|
||||||
|
|
||||||
scope.plays = [];
|
scope.plays = [];
|
||||||
scope.tasks = [];
|
scope.tasks = [];
|
||||||
@@ -28,6 +29,8 @@ function JobDetailController ($scope, $compile, $routeParams, ClearScope, Breadc
|
|||||||
scope.auto_scroll = false;
|
scope.auto_scroll = false;
|
||||||
scope.searchTaskHostsEnabled = true;
|
scope.searchTaskHostsEnabled = true;
|
||||||
scope.searchSummaryHostsEnabled = true;
|
scope.searchSummaryHostsEnabled = true;
|
||||||
|
scope.hostTableRows = 120;
|
||||||
|
scope.hostSummaryTableRows = 120;
|
||||||
|
|
||||||
event_socket = Socket({
|
event_socket = Socket({
|
||||||
scope: scope,
|
scope: scope,
|
||||||
@@ -177,79 +180,69 @@ function JobDetailController ($scope, $compile, $routeParams, ClearScope, Breadc
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Wait('start');
|
|
||||||
|
|
||||||
// Load the job record
|
if (scope.removeLoadJob) {
|
||||||
Rest.setUrl(GetBasePath('jobs') + job_id + '/');
|
scope.removeLoadJob();
|
||||||
Rest.get()
|
}
|
||||||
.success(function(data) {
|
scope.removeLoadJobRow = scope.$on('LoadJob', function() {
|
||||||
job = data;
|
Wait('start');
|
||||||
scope.job_template_name = data.name;
|
// Load the job record
|
||||||
scope.project_name = (data.summary_fields.project) ? data.summary_fields.project.name : '';
|
Rest.setUrl(GetBasePath('jobs') + job_id + '/');
|
||||||
scope.inventory_name = (data.summary_fields.inventory) ? data.summary_fields.inventory.name : '';
|
Rest.get()
|
||||||
scope.job_template_url = '/#/job_templates/' + data.unified_job_template;
|
.success(function(data) {
|
||||||
scope.inventory_url = (scope.inventory_name && data.inventory) ? '/#/inventories/' + data.inventory : '';
|
job = data;
|
||||||
scope.project_url = (scope.project_name && data.project) ? '/#/projects/' + data.project : '';
|
scope.job_template_name = data.name;
|
||||||
scope.job_type = data.job_type;
|
scope.project_name = (data.summary_fields.project) ? data.summary_fields.project.name : '';
|
||||||
scope.playbook = data.playbook;
|
scope.inventory_name = (data.summary_fields.inventory) ? data.summary_fields.inventory.name : '';
|
||||||
scope.credential = data.credential;
|
scope.job_template_url = '/#/job_templates/' + data.unified_job_template;
|
||||||
scope.cloud_credential = data.cloud_credential;
|
scope.inventory_url = (scope.inventory_name && data.inventory) ? '/#/inventories/' + data.inventory : '';
|
||||||
scope.forks = data.forks;
|
scope.project_url = (scope.project_name && data.project) ? '/#/projects/' + data.project : '';
|
||||||
scope.limit = data.limit;
|
scope.job_type = data.job_type;
|
||||||
scope.verbosity = data.verbosity;
|
scope.playbook = data.playbook;
|
||||||
scope.job_tags = data.job_tags;
|
scope.credential = data.credential;
|
||||||
|
scope.cloud_credential = data.cloud_credential;
|
||||||
|
scope.forks = data.forks;
|
||||||
|
scope.limit = data.limit;
|
||||||
|
scope.verbosity = data.verbosity;
|
||||||
|
scope.job_tags = data.job_tags;
|
||||||
|
|
||||||
// In the case that the job is already completed, or an error already happened,
|
// In the case that the job is already completed, or an error already happened,
|
||||||
// populate scope.job_status info
|
// populate scope.job_status info
|
||||||
scope.job_status.status = data.status;
|
scope.job_status.status = data.status;
|
||||||
scope.job_status.started = data.started;
|
scope.job_status.started = data.started;
|
||||||
scope.job_status.status_class = ((data.status === 'error' || data.status === 'failed') && data.job_explanation) ? "alert alert-danger" : "";
|
scope.job_status.status_class = ((data.status === 'error' || data.status === 'failed') && data.job_explanation) ? "alert alert-danger" : "";
|
||||||
scope.job_status.finished = data.finished;
|
scope.job_status.finished = data.finished;
|
||||||
scope.job_status.explanation = data.job_explanation;
|
scope.job_status.explanation = data.job_explanation;
|
||||||
if (data.started && data.finished) {
|
if (data.started && data.finished) {
|
||||||
scope.job_status.elapsed = GetElapsed({
|
scope.job_status.elapsed = GetElapsed({
|
||||||
start: data.started,
|
start: data.started,
|
||||||
end: data.finished
|
end: data.finished
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
scope.job_status.elapsed = '00:00:00';
|
scope.job_status.elapsed = '00:00:00';
|
||||||
}
|
}
|
||||||
|
|
||||||
scope.$emit('JobReady', data.related.job_events + '?page_size=50&order_by=id');
|
scope.$emit('JobReady', data.related.job_events + '?page_size=50&order_by=id');
|
||||||
scope.$emit('GetCredentialNames', data);
|
scope.$emit('GetCredentialNames', data);
|
||||||
})
|
})
|
||||||
.error(function(data, status) {
|
.error(function(data, status) {
|
||||||
ProcessErrors(scope, data, status, null, { hdr: 'Error!',
|
ProcessErrors(scope, data, status, null, { hdr: 'Error!',
|
||||||
msg: 'Failed to retrieve job: ' + $routeParams.id + '. GET returned: ' + status });
|
msg: 'Failed to retrieve job: ' + $routeParams.id + '. GET returned: ' + status });
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
|
||||||
scope.selectPlay = function(id) {
|
if (scope.removeRefreshCompleted) {
|
||||||
SelectPlay({
|
scope.removeRefreshCompleted();
|
||||||
scope: scope,
|
}
|
||||||
id: id
|
scope.removeRefreshCompleted = scope.$on('RefreshCompleted', function() {
|
||||||
});
|
refresh_count++;
|
||||||
};
|
if (refresh_count === 2) {
|
||||||
|
scope.$emit('LoadJob');
|
||||||
scope.selectTask = function(id) {
|
|
||||||
SelectTask({
|
|
||||||
scope: scope,
|
|
||||||
id: id
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
$("#hosts-slider-vertical").slider({
|
|
||||||
orientation: "vertical",
|
|
||||||
range: "min",
|
|
||||||
min: 0,
|
|
||||||
max: 100,
|
|
||||||
value: 60,
|
|
||||||
slide: function( event, ui ) {
|
|
||||||
$( "#amount" ).val( ui.value );
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
function adjustSize() {
|
scope.adjustSize = function() {
|
||||||
var height, ww = $(window).width();
|
var height, ww = $(window).width();
|
||||||
if (ww < 1240) {
|
if (ww < 1240) {
|
||||||
$('#job-summary-container').hide();
|
$('#job-summary-container').hide();
|
||||||
@@ -268,32 +261,144 @@ function JobDetailController ($scope, $compile, $routeParams, ClearScope, Breadc
|
|||||||
$('#job-summary-container').css({ "width": "41.66666667%", "padding-right": "15px", "z-index": 0 }).show();
|
$('#job-summary-container').css({ "width": "41.66666667%", "padding-right": "15px", "z-index": 0 }).show();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Adjust page height
|
// Detail table height adjusting. First, put page height back to 'normal'.
|
||||||
$('#plays-table-detail').height(150);
|
$('#plays-table-detail').height(150);
|
||||||
$('#plays-table-detail').mCustomScrollbar("update");
|
|
||||||
$('#tasks-table-detail').height(150);
|
$('#tasks-table-detail').height(150);
|
||||||
$('#tasks-table-detail').mCustomScrollbar("update");
|
|
||||||
$('#hosts-table-detail').height(150);
|
$('#hosts-table-detail').height(150);
|
||||||
$('#hosts-table-detail').mCustomScrollbar("update");
|
scope.hostTableRows = 120;
|
||||||
height = ($('#wrap').height() - $('.site-footer').height()) - $('.main-container').height() - 22;
|
height = $('#wrap').height() - $('.site-footer').outerHeight() - $('.main-container').height();
|
||||||
if (height > 15) {
|
if (height > 15) {
|
||||||
|
// there's a bunch of white space at the bottom, let's use it
|
||||||
$('#plays-table-detail').height(150 + (height / 3));
|
$('#plays-table-detail').height(150 + (height / 3));
|
||||||
$('#plays-table-detail').mCustomScrollbar("update");
|
//$('#plays-table-detail').mCustomScrollbar("update");
|
||||||
$('#tasks-table-detail').height(150 + (height / 3));
|
$('#tasks-table-detail').height(150 + (height / 3));
|
||||||
$('#tasks-table-detail').mCustomScrollbar("update");
|
// Host details
|
||||||
$('#hosts-table-detail').height(150 + (height / 3));
|
$('#hosts-table-detail').height(150 + (height / 3));
|
||||||
|
scope.hostTableRows = Math.max(Math.ceil((150 + (height / 3)) / 20) * 3, 120);
|
||||||
|
}
|
||||||
|
refreshHostRows();
|
||||||
|
|
||||||
|
// Summary table height adjusting.
|
||||||
|
height = ($('#job-detail-container').height() / 2) - $('#hosts-summary-section .header').outerHeight() - $('#hosts-summary-section .table-header').outerHeight() - 20;
|
||||||
|
scope.hostSummaryTableRows = Math.max(Math.ceil(height / 20), 120);
|
||||||
|
$('#hosts-summary-table').height(height);
|
||||||
|
refreshSummaryHostRows();
|
||||||
|
};
|
||||||
|
|
||||||
|
function refreshHostRows() {
|
||||||
|
var url;
|
||||||
|
if (scope.activeTask) {
|
||||||
|
scope.hostResults = [];
|
||||||
|
scope.auto_scroll = true;
|
||||||
|
url = GetBasePath('jobs') + job_id + '/job_events/?parent=' + scope.activeTask + '&';
|
||||||
|
url += (scope.task_host_name) ? 'host__name__icontains=' + scope.task_host_name + '&' : '';
|
||||||
|
url += 'host__isnull=false&page_size=' + scope.hostTableRows + '&order_by=host__name';
|
||||||
|
Wait('start');
|
||||||
|
Rest.setUrl(url);
|
||||||
|
Rest.get()
|
||||||
|
.success(function(data) {
|
||||||
|
data.results.forEach(function(row) {
|
||||||
|
scope.hostResults.push({
|
||||||
|
id: row.id,
|
||||||
|
status: ( (row.failed) ? 'failed': (row.changed) ? 'changed' : 'successful' ),
|
||||||
|
host_id: row.host,
|
||||||
|
task_id: row.parent,
|
||||||
|
name: row.event_data.host,
|
||||||
|
created: row.created,
|
||||||
|
msg: ( (row.event_data && row.event_data.res) ? row.event_data.res.msg : '' )
|
||||||
|
});
|
||||||
|
});
|
||||||
|
$('#hosts-table-detail').mCustomScrollbar("update");
|
||||||
|
setTimeout( function() { $('#hosts-table-detail').mCustomScrollbar("scrollTo", "bottom"); }, 700);
|
||||||
|
Wait('stop');
|
||||||
|
scope.$emit('RefreshCompleted');
|
||||||
|
})
|
||||||
|
.error(function(data, status) {
|
||||||
|
ProcessErrors(scope, data, status, null, { hdr: 'Error!',
|
||||||
|
msg: 'Call to ' + url + '. GET returned: ' + status });
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else {
|
||||||
$('#hosts-table-detail').mCustomScrollbar("update");
|
$('#hosts-table-detail').mCustomScrollbar("update");
|
||||||
|
scope.$emit('RefreshCompleted');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$(document).ready(function() {
|
|
||||||
adjustSize();
|
function refreshSummaryHostRows() {
|
||||||
});
|
if (scope.hosts.length < scope.hostSummaryTableRows) {
|
||||||
|
var url = GetBasePath('jobs') + job_id + '/job_host_summaries/?';
|
||||||
|
url += (scope.summary_host_name) ? 'host__name__icontains=' + scope.summary_host_name + '&': '';
|
||||||
|
url += '&page_size=' + scope.hostSummaryTableRows + '&order_by=host__name';
|
||||||
|
Wait('start');
|
||||||
|
Rest.setUrl(url);
|
||||||
|
Rest.get()
|
||||||
|
.success(function(data) {
|
||||||
|
data.results.forEach(function(row) {
|
||||||
|
var found = false;
|
||||||
|
scope.hosts.every(function(host) {
|
||||||
|
if (host.id === row.host) {
|
||||||
|
found = true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
if (!found) {
|
||||||
|
scope.hosts.push({
|
||||||
|
id: row.host,
|
||||||
|
name: row.summary_fields.host.name,
|
||||||
|
ok: row.ok,
|
||||||
|
changed: row.changed,
|
||||||
|
unreachable: row.dark,
|
||||||
|
failed: row.failures
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
scope.hosts.sort(function(a,b) {
|
||||||
|
if (a.name < b.name) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
if (a.name > b.name) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
});
|
||||||
|
$('#hosts-summary-table').mCustomScrollbar("update");
|
||||||
|
setTimeout( function() { $('#hosts-summary-table').mCustomScrollbar("scrollTo", "bottom"); }, 700);
|
||||||
|
Wait('stop');
|
||||||
|
scope.$emit('RefreshCompleted');
|
||||||
|
})
|
||||||
|
.error(function(data, status) {
|
||||||
|
ProcessErrors(scope, data, status, null, { hdr: 'Error!',
|
||||||
|
msg: 'Call to ' + url + '. GET returned: ' + status });
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$('#hosts-table-detail').mCustomScrollbar("update");
|
||||||
|
scope.$emit('RefreshCompleted');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
setTimeout(function() { scope.adjustSize(); }, 500);
|
||||||
|
|
||||||
// Use debounce for the underscore library to adjust after user resizes window.
|
// Use debounce for the underscore library to adjust after user resizes window.
|
||||||
$(window).resize(_.debounce(function(){
|
$(window).resize(_.debounce(function(){
|
||||||
adjustSize();
|
scope.adjustSize();
|
||||||
}, 500));
|
}, 500));
|
||||||
|
|
||||||
|
$scope.selectPlay = function(id) {
|
||||||
|
SelectPlay({
|
||||||
|
scope: scope,
|
||||||
|
id: id
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
$scope.selectTask = function(id) {
|
||||||
|
SelectTask({
|
||||||
|
scope: scope,
|
||||||
|
id: id
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
$scope.toggleSummary = function(hide) {
|
$scope.toggleSummary = function(hide) {
|
||||||
var docw, doch, height = $('#job-detail-container').height(), slide_width;
|
var docw, doch, height = $('#job-detail-container').height(), slide_width;
|
||||||
if (!hide) {
|
if (!hide) {
|
||||||
@@ -325,56 +430,64 @@ function JobDetailController ($scope, $compile, $routeParams, ClearScope, Breadc
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.HostDetailOnTotalScroll = function(mcs) {
|
$scope.HostDetailOnTotalScroll = _.debounce(function() {
|
||||||
var url = GetBasePath('jobs') + job_id + '/job_events/?parent=' + scope.activeTask;
|
// Called when user scrolls down (or forward in time). Using _.debounce
|
||||||
url += '&host__name__gt=' + scope.hostResults[scope.hostResults.length - 1].name + '&host__isnull=false&page_size=5&order_by=host__name';
|
var url, mcs = arguments[0];
|
||||||
if (!scope.auto_scroll) {
|
scope.$apply(function() {
|
||||||
Wait('start');
|
if (!scope.auto_scroll && scope.activeTask && scope.hostResults) {
|
||||||
Rest.setUrl(url);
|
scope.auto_scroll = true;
|
||||||
Rest.get()
|
url = GetBasePath('jobs') + job_id + '/job_events/?parent=' + scope.activeTask + '&';
|
||||||
.success(function(data) {
|
url += (scope.task_host_name) ? 'host__name__icontains=' + scope.task_host_name + '&' : '';
|
||||||
setTimeout(function() {
|
url += 'host__name__gt=' + scope.hostResults[scope.hostResults.length - 1].name + '&host__isnull=false&page_size=' + (scope.hostTableRows / 3) + '&order_by=host__name';
|
||||||
scope.$apply(function() {
|
Wait('start');
|
||||||
data.results.forEach(function(row) {
|
Rest.setUrl(url);
|
||||||
scope.hostResults.push({
|
Rest.get()
|
||||||
id: row.id,
|
.success(function(data) {
|
||||||
status: ( (row.failed) ? 'failed': (row.changed) ? 'changed' : 'successful' ),
|
data.results.forEach(function(row) {
|
||||||
host_id: row.host,
|
scope.hostResults.push({
|
||||||
task_id: row.parent,
|
id: row.id,
|
||||||
name: row.event_data.host,
|
status: ( (row.failed) ? 'failed': (row.changed) ? 'changed' : 'successful' ),
|
||||||
created: row.created,
|
host_id: row.host,
|
||||||
msg: ( (row.event_data && row.event_data.res) ? row.event_data.res.msg : '' )
|
task_id: row.parent,
|
||||||
});
|
name: row.event_data.host,
|
||||||
if (scope.hostResults.length > 10) {
|
created: row.created,
|
||||||
scope.hostResults.splice(0,1);
|
msg: ( (row.event_data && row.event_data.res) ? row.event_data.res.msg : '' )
|
||||||
}
|
|
||||||
});
|
});
|
||||||
//$('#hosts-table-detail').mCustomScrollbar("update");
|
if (scope.hostResults.length > scope.hostTableRows) {
|
||||||
if (data.next) {
|
scope.hostResults.splice(0,1);
|
||||||
// there are more rows. move dragger up, letting user know.
|
|
||||||
setTimeout(function() { $('#hosts-table-detail .mCSB_dragger').css({ top: (mcs.draggerTop - 10) + 'px'}); }, 700);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}, 100);
|
if (data.next) {
|
||||||
Wait('stop');
|
// there are more rows. move dragger up, letting user know.
|
||||||
})
|
setTimeout(function() { $('#hosts-table-detail .mCSB_dragger').css({ top: (mcs.draggerTop - 15) + 'px'}); }, 700);
|
||||||
.error(function(data, status) {
|
}
|
||||||
ProcessErrors(scope, data, status, null, { hdr: 'Error!',
|
scope.auto_scroll = false;
|
||||||
msg: 'Call to ' + url + '. GET returned: ' + status });
|
Wait('stop');
|
||||||
});
|
})
|
||||||
}
|
.error(function(data, status) {
|
||||||
scope.auto_scroll = false;
|
ProcessErrors(scope, data, status, null, { hdr: 'Error!',
|
||||||
};
|
msg: 'Call to ' + url + '. GET returned: ' + status });
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
scope.auto_scroll = false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}, 300);
|
||||||
|
|
||||||
$scope.HostDetailOnTotalScrollBack = function(mcs) {
|
$scope.HostDetailOnTotalScrollBack = _.debounce(function() {
|
||||||
var url = GetBasePath('jobs') + job_id + '/job_events/?parent=' + scope.activeTask;
|
// Called when user scrolls up (or back in time)
|
||||||
Wait('start');
|
var url, mcs = arguments[0];
|
||||||
url += '&host__name__lt=' + scope.hostResults[0].name + '&host__isnull=false&page_size=5&order_by=-host__name';
|
scope.$apply(function() {
|
||||||
Rest.setUrl(url);
|
if (!scope.auto_scroll && scope.activeTask && scope.hostResults) {
|
||||||
Rest.get()
|
scope.auto_scroll = true;
|
||||||
.success(function(data) {
|
url = GetBasePath('jobs') + job_id + '/job_events/?parent=' + scope.activeTask + '&';
|
||||||
setTimeout(function() {
|
url += (scope.task_host_name) ? 'host__name__icontains=' + scope.task_host_name + '&' : '';
|
||||||
scope.$apply(function() {
|
url += 'host__name__lt=' + scope.hostResults[0].name + '&host__isnull=false&page_size=' + (scope.hostTableRows / 3) + '&order_by=-host__name';
|
||||||
|
Wait('start');
|
||||||
|
Rest.setUrl(url);
|
||||||
|
Rest.get()
|
||||||
|
.success(function(data) {
|
||||||
data.results.forEach(function(row) {
|
data.results.forEach(function(row) {
|
||||||
scope.hostResults.unshift({
|
scope.hostResults.unshift({
|
||||||
id: row.id,
|
id: row.id,
|
||||||
@@ -385,29 +498,34 @@ function JobDetailController ($scope, $compile, $routeParams, ClearScope, Breadc
|
|||||||
created: row.created,
|
created: row.created,
|
||||||
msg: ( (row.event_data && row.event_data.res) ? row.event_data.res.msg : '' )
|
msg: ( (row.event_data && row.event_data.res) ? row.event_data.res.msg : '' )
|
||||||
});
|
});
|
||||||
if (scope.hostResults.length > 10) {
|
if (scope.hostResults.length > scope.hostTableRows) {
|
||||||
scope.hostResults.pop();
|
scope.hostResults.pop();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
$('#hosts-table-detail').mCustomScrollbar("update");
|
|
||||||
if (data.next) {
|
if (data.next) {
|
||||||
// there are more rows. move dragger down, letting user know.
|
// there are more rows. move dragger down, letting user know.
|
||||||
setTimeout(function() { $('#hosts-table-detail .mCSB_dragger').css({ top: (mcs.draggerTop + 10) + 'px' }); }, 700);
|
setTimeout(function() { $('#hosts-table-detail .mCSB_dragger').css({ top: (mcs.draggerTop + 15) + 'px' }); }, 700);
|
||||||
}
|
}
|
||||||
|
Wait('stop');
|
||||||
|
scope.auto_scroll = false;
|
||||||
|
})
|
||||||
|
.error(function(data, status) {
|
||||||
|
ProcessErrors(scope, data, status, null, { hdr: 'Error!',
|
||||||
|
msg: 'Call to ' + url + '. GET returned: ' + status });
|
||||||
});
|
});
|
||||||
}, 100);
|
}
|
||||||
Wait('stop');
|
else {
|
||||||
})
|
scope.auto_scroll = false;
|
||||||
.error(function(data, status) {
|
}
|
||||||
ProcessErrors(scope, data, status, null, { hdr: 'Error!',
|
});
|
||||||
msg: 'Call to ' + url + '. GET returned: ' + status });
|
}, 300);
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
$scope.HostSummaryOnTotalScroll = function(mcs) {
|
$scope.HostSummaryOnTotalScroll = function(mcs) {
|
||||||
var url = GetBasePath('jobs') + job_id + '/job_host_summaries/';
|
var url;
|
||||||
url += '?host__name__gt=' + scope.hosts[scope.hosts.length - 1].name + '&page_size=5&order_by=host__name';
|
if (!scope.auto_scroll && scope.hosts) {
|
||||||
if (!scope.auto_scroll) {
|
url = GetBasePath('jobs') + job_id + '/job_host_summaries/?';
|
||||||
|
url += (scope.summary_host_name) ? 'host__name__icontains=' + scope.summary_host_name + '&': '';
|
||||||
|
url += 'host__name__gt=' + scope.hosts[scope.hosts.length - 1].name + '&page_size=' + (scope.hostSummaryTableRows / 3) + '&order_by=host__name';
|
||||||
Wait('start');
|
Wait('start');
|
||||||
Rest.setUrl(url);
|
Rest.setUrl(url);
|
||||||
Rest.get()
|
Rest.get()
|
||||||
@@ -423,14 +541,13 @@ function JobDetailController ($scope, $compile, $routeParams, ClearScope, Breadc
|
|||||||
unreachable: row.dark,
|
unreachable: row.dark,
|
||||||
failed: row.failures
|
failed: row.failures
|
||||||
});
|
});
|
||||||
if (scope.hosts.length > 10) {
|
if (scope.hosts.length > scope.hostSummaryTableRows) {
|
||||||
scope.hosts.splice(0,1);
|
scope.hosts.splice(0,1);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
//$('#hosts-summary-table').mCustomScrollbar("update");
|
|
||||||
if (data.next) {
|
if (data.next) {
|
||||||
// there are more rows. move dragger up, letting user know.
|
// there are more rows. move dragger up, letting user know.
|
||||||
setTimeout(function() { $('#hosts-summary-table .mCSB_dragger').css({ top: (mcs.draggerTop - 10) + 'px'}); }, 700);
|
setTimeout(function() { $('#hosts-summary-table .mCSB_dragger').css({ top: (mcs.draggerTop - 15) + 'px'}); }, 700);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}, 100);
|
}, 100);
|
||||||
@@ -445,40 +562,43 @@ function JobDetailController ($scope, $compile, $routeParams, ClearScope, Breadc
|
|||||||
};
|
};
|
||||||
|
|
||||||
$scope.HostSummaryOnTotalScrollBack = function(mcs) {
|
$scope.HostSummaryOnTotalScrollBack = function(mcs) {
|
||||||
var url = GetBasePath('jobs') + job_id + '/job_host_summaries/';
|
var url;
|
||||||
Wait('start');
|
if (!scope.auto_scroll && scope.hosts) {
|
||||||
url += '?host__name__lt=' + scope.hosts[0].name + '&page_size=5&order_by=-host__name';
|
url = GetBasePath('jobs') + job_id + '/job_host_summaries/?';
|
||||||
Rest.setUrl(url);
|
url += (scope.summary_host_name) ? 'host__name__icontains=' + scope.summary_host_name + '&': '';
|
||||||
Rest.get()
|
url += 'host__name__lt=' + scope.hosts[0].name + '&page_size=' + (scope.hostSummaryTableRows / 3) + '&order_by=-host__name';
|
||||||
.success(function(data) {
|
Wait('start');
|
||||||
setTimeout(function() {
|
Rest.setUrl(url);
|
||||||
scope.$apply(function() {
|
Rest.get()
|
||||||
data.results.forEach(function(row) {
|
.success(function(data) {
|
||||||
scope.hosts.unshift({
|
setTimeout(function() {
|
||||||
id: row.host,
|
scope.$apply(function() {
|
||||||
name: row.summary_fields.host.name,
|
data.results.forEach(function(row) {
|
||||||
ok: row.ok,
|
scope.hosts.unshift({
|
||||||
changed: row.changed,
|
id: row.host,
|
||||||
unreachable: row.dark,
|
name: row.summary_fields.host.name,
|
||||||
failed: row.failures
|
ok: row.ok,
|
||||||
|
changed: row.changed,
|
||||||
|
unreachable: row.dark,
|
||||||
|
failed: row.failures
|
||||||
|
});
|
||||||
|
if (scope.hosts.length > scope.hostSummaryTableRows) {
|
||||||
|
scope.hosts.pop();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
if (scope.hosts.length > 10) {
|
if (data.next) {
|
||||||
scope.hosts.pop();
|
// there are more rows. move dragger down, letting user know.
|
||||||
|
setTimeout(function() { $('#hosts-summary-table .mCSB_dragger').css({ top: (mcs.draggerTop + 15) + 'px' }); }, 700);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
$('#hosts-summary-table').mCustomScrollbar("update");
|
}, 100);
|
||||||
if (data.next) {
|
Wait('stop');
|
||||||
// there are more rows. move dragger down, letting user know.
|
})
|
||||||
setTimeout(function() { $('#hosts-summary-table .mCSB_dragger').css({ top: (mcs.draggerTop + 10) + 'px' }); }, 700);
|
.error(function(data, status) {
|
||||||
}
|
ProcessErrors(scope, data, status, null, { hdr: 'Error!',
|
||||||
});
|
msg: 'Call to ' + url + '. GET returned: ' + status });
|
||||||
}, 100);
|
});
|
||||||
Wait('stop');
|
}
|
||||||
})
|
|
||||||
.error(function(data, status) {
|
|
||||||
ProcessErrors(scope, data, status, null, { hdr: 'Error!',
|
|
||||||
msg: 'Call to ' + url + '. GET returned: ' + status });
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.searchTaskHosts = function() {
|
$scope.searchTaskHosts = function() {
|
||||||
@@ -487,7 +607,7 @@ function JobDetailController ($scope, $compile, $routeParams, ClearScope, Breadc
|
|||||||
scope.hostResults = [];
|
scope.hostResults = [];
|
||||||
url = GetBasePath('jobs') + $routeParams.id + '/job_events/?parent=' + scope.activeTask;
|
url = GetBasePath('jobs') + $routeParams.id + '/job_events/?parent=' + scope.activeTask;
|
||||||
url += (scope.task_host_name) ? '&host__name__icontains=' + scope.task_host_name : '';
|
url += (scope.task_host_name) ? '&host__name__icontains=' + scope.task_host_name : '';
|
||||||
url += '&host__name__isnull=false&page_size=10&order_by=host__name';
|
url += '&host__name__isnull=false&page_size=' + scope.hostTableRows + '&order_by=host__name';
|
||||||
Rest.setUrl(url);
|
Rest.setUrl(url);
|
||||||
Rest.get()
|
Rest.get()
|
||||||
.success(function(data) {
|
.success(function(data) {
|
||||||
@@ -530,7 +650,7 @@ function JobDetailController ($scope, $compile, $routeParams, ClearScope, Breadc
|
|||||||
scope.hosts = [];
|
scope.hosts = [];
|
||||||
url = GetBasePath('jobs') + $routeParams.id + '/job_host_summaries/?';
|
url = GetBasePath('jobs') + $routeParams.id + '/job_host_summaries/?';
|
||||||
url += (scope.summary_host_name) ? 'host__name__icontains=' + scope.summary_host_name + '&': '';
|
url += (scope.summary_host_name) ? 'host__name__icontains=' + scope.summary_host_name + '&': '';
|
||||||
url += 'page_size=10&order_by=host__name';
|
url += 'page_size=' + scope.hostSummaryTableRows + '&order_by=host__name';
|
||||||
Rest.setUrl(url);
|
Rest.setUrl(url);
|
||||||
Rest.get()
|
Rest.get()
|
||||||
.success(function(data) {
|
.success(function(data) {
|
||||||
|
|||||||
@@ -499,7 +499,7 @@ function(UpdatePlayStatus, UpdateHostStatus, UpdatePlayChild, AddHostResult, Sel
|
|||||||
return 0;
|
return 0;
|
||||||
});
|
});
|
||||||
// Only keep 10 hosts
|
// Only keep 10 hosts
|
||||||
if (scope.hosts.length > 10) {
|
if (scope.hosts.length > scope.hostSummaryTableRows) {
|
||||||
scope.hosts.splice(0,1);
|
scope.hosts.splice(0,1);
|
||||||
}
|
}
|
||||||
scope.auto_scroll = true;
|
scope.auto_scroll = true;
|
||||||
@@ -564,8 +564,8 @@ function(UpdatePlayStatus, UpdateHostStatus, UpdatePlayChild, AddHostResult, Sel
|
|||||||
return 0;
|
return 0;
|
||||||
});
|
});
|
||||||
|
|
||||||
// Keep the list pruned to 10 hosts
|
// Keep the list pruned to a limited # of hosts
|
||||||
if (scope.hostResults.length === 10) {
|
if (scope.hostResults.length === scope.hostTableRows) {
|
||||||
scope.hostResults.splice(0,1);
|
scope.hostResults.splice(0,1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -695,25 +695,23 @@ function(UpdatePlayStatus, UpdateHostStatus, UpdatePlayChild, AddHostResult, Sel
|
|||||||
}
|
}
|
||||||
Wait('start');
|
Wait('start');
|
||||||
scope.hostResults = [];
|
scope.hostResults = [];
|
||||||
url = GetBasePath('jobs') + $routeParams.id + '/job_events/?parent=' + id +
|
url = GetBasePath('jobs') + $routeParams.id + '/job_events/?parent=' + id + '&';
|
||||||
'&host__isnull=false&page_size=10&order_by=-host__name';
|
url += (scope.task_host_name) ? 'host__name__icontains=' + scope.task_host_name + '&' : '';
|
||||||
|
url += 'host__isnull=false&page_size=' + scope.hostTableRows + '&order_by=host__name';
|
||||||
Rest.setUrl(url);
|
Rest.setUrl(url);
|
||||||
Rest.get()
|
Rest.get()
|
||||||
.success(function(data) {
|
.success(function(data) {
|
||||||
var i;
|
data.results.forEach(function(row) {
|
||||||
if (data.results.length > 0) {
|
scope.hostResults.push({
|
||||||
for (i = data.results.length - 1; i >=0; i--) {
|
id: row.id,
|
||||||
scope.hostResults.push({
|
status: ( (row.failed) ? 'failed' : (row.changed) ? 'changed' : 'successful' ),
|
||||||
id: data.results[i].id,
|
host_id: row.host,
|
||||||
status: ( (data.results[i].failed) ? 'failed' : (data.results[i].changed) ? 'changed' : 'successful' ),
|
task_id: row.parent,
|
||||||
host_id: data.results[i].host,
|
name: row.event_data.host,
|
||||||
task_id: data.results[i].parent,
|
created: row.created,
|
||||||
name: data.results[i].event_data.host,
|
msg: ( (row.event_data && row.event_data.res) ? row.event_data.res.msg : '' )
|
||||||
created: data.results[i].created,
|
});
|
||||||
msg: ( (data.results[i].event_data && data.results[i].event_data.res) ? data.results[i].event_data.res.msg : '' )
|
});
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Wait('stop');
|
Wait('stop');
|
||||||
SelectHost({ scope: scope });
|
SelectHost({ scope: scope });
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -727,15 +727,16 @@ angular.module('AWDirectives', ['RestServices', 'Utilities', 'AuthService', 'Job
|
|||||||
updateOnContentResize: true
|
updateOnContentResize: true
|
||||||
},
|
},
|
||||||
scrollButtons: {
|
scrollButtons: {
|
||||||
enable: true,
|
enable: true
|
||||||
scrollType: 'continuous'
|
|
||||||
},
|
},
|
||||||
theme: 'dark-thick',
|
theme: 'dark-thick',
|
||||||
mouseWheel: true,
|
mouseWheel: true,
|
||||||
scrollInertia: 0,
|
scrollInertia: 300,
|
||||||
callbacks: {
|
callbacks: {
|
||||||
onTotalScroll: scope[attrs.onTotalScroll],
|
onTotalScroll: scope[attrs.onTotalScroll],
|
||||||
|
onTotalScrollOfset: attrs.onTotalScrollOffset,
|
||||||
onTotalScrollBack: scope[attrs.onTotalScrollBack],
|
onTotalScrollBack: scope[attrs.onTotalScrollBack],
|
||||||
|
onTotalScrollBackOffset: attrs.onTotlaScrollBackOffset
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user