1
0
mirror of https://github.com/ansible/awx.git synced 2024-10-31 15:21:13 +03:00

feedback on PR #1467, resolves 1522 && 1512

This commit is contained in:
Leigh Johnson 2016-04-13 14:57:14 -04:00
parent b598fc41f5
commit bd806888b4
7 changed files with 38 additions and 44 deletions

View File

@ -42,7 +42,7 @@ export default
.factory('DigestEvent', ['$rootScope', '$log', 'UpdatePlayStatus', 'UpdateHostStatus', 'AddHostResult',
'GetElapsed', 'UpdateTaskStatus', 'JobIsFinished', 'AddNewTask', 'AddNewPlay',
function($rootScope, $log, UpdatePlayStatus, UpdateHostStatus, AddHostResult, GetElapsed,
UpdateTaskStatus, JobIsFinished, AddNewTask, AddNewPlay) {
UpdateTaskStatus, JobIsFinished, AddNewTask, AddNewPlay, longDateFilter) {
return function(params) {
var scope = params.scope,
@ -185,7 +185,7 @@ export default
};
}])
.factory('GetElapsed', ['moment', function(moment) {
.factory('GetElapsed', [function() {
return function(params) {
var start = params.start,
end = params.end,
@ -351,7 +351,7 @@ export default
};
}])
.factory('UpdateJobStatus', ['moment', 'GetElapsed', 'Empty', 'JobIsFinished', function(moment, GetElapsed, Empty, JobIsFinished) {
.factory('UpdateJobStatus', ['GetElapsed', 'Empty', 'JobIsFinished', function(GetElapsed, Empty, JobIsFinished) {
return function(params) {
var scope = params.scope,
failed = params.failed,
@ -363,10 +363,10 @@ export default
scope.job_status.status = 'failed';
}
if (JobIsFinished(scope) && !Empty(modified)) {
scope.job_status.finished = moment(modified).format('l');
scope.job_status.finished = longDateFilter(modified)
}
if (!Empty(started) && Empty(scope.job_status.started)) {
scope.job_status.started = moment(started).format('l');
scope.job_status.started = longDateFilter(modified)
}
if (!Empty(scope.job_status.finished) && !Empty(scope.job_status.started)) {
scope.job_status.elapsed = GetElapsed({
@ -913,7 +913,6 @@ export default
scope.tasks[idx].taskActiveClass = '';
}
});
// /api/v1/jobs/16/job_events/?parent=832&event__startswith=runner&page_size=200&order=host_name,counte
var params = {
parent: scope.selectedTask,
event__startswith: 'runner',

View File

@ -1,7 +1,7 @@
@import "awx/ui/client/src/shared/branding/colors.less";
@import "awx/ui/client/src/shared/branding/colors.default.less";
.CodeMirror{
.HostEvents .CodeMirror{
border: none;
}
.HostEvents .modal-footer{

View File

@ -194,7 +194,6 @@ export default
"<p><i class=\"fa fa-circle failed-hosts-color\"></i> Failed</p>\n";
function openSocket() {
$rootScope.event_socket.on("job_events-" + job_id, function(data) {
console.log(data)
if (api_complete && data.id > lastEventId) {
scope.waiting = false;
data.event = data.event_name;
@ -278,8 +277,8 @@ export default
};
JobDetailService.getRelatedJobEvents(scope.job.id, params)
.success(function(data) {
var idx, event, status, status_text, item, msg;
if (data.results.length > 0) {$
var event, status, status_text, item, msg;
if (data.results.length > 0) {
lastEventId = data.results[0].id;
}
scope.next_host_results = data.next;
@ -680,10 +679,6 @@ export default
$('#tasks-table-detail').height(120 + (height * 0.20));
$('#hosts-table-detail').height(150 + (height * 0.70));
}
// Summary table height adjusting.
height = ($('#job-detail-container').height() / 2) - $('#hosts-summary-section .JobDetail-searchHeaderRow').outerHeight() -
$('#hosts-summary-section .table-header').outerHeight() - 20;
//$('#hosts-summary-table').mCustomScrollbar("update");
scope.$emit('RefreshCompleted');
};

View File

@ -1,6 +1,6 @@
<div class="tab-pane" id="jobs-detail">
<div ng-cloak id="htmlTemplate" class="JobDetail">
<div ui-view class-""></div>
<div ui-view></div>
<!--beginning of job-detail-container (left side) -->
<div id="job-detail-container" class="JobDetail-leftSide" ng-class="{'JobDetail-stdoutActionButton--active': stdoutFullScreen}">
<!--beginning of results-->

View File

@ -27,7 +27,7 @@ export default
// remove ignored properties
Object.keys(result).forEach(function(key, index){
if (ignored.indexOf(key) > -1) {
delete result[key]
delete result[key];
}
});
@ -36,7 +36,7 @@ export default
result.event_data = {};
Object.keys(data.event_data.res).forEach(function(key, index){
if (ignored.indexOf(key) > -1) {
return
return;
}
else{
result.event_data[key] = data.event_data.res[key];
@ -45,7 +45,7 @@ export default
}
catch(err){result.event_data = undefined;}
return result
return result;
},
// Return Ansible's passed-through response msg on a job_event
processEventMsg: function(event){
@ -55,7 +55,7 @@ export default
processEventItem: function(event){
try{
var item = event.event_data.res.item;
return typeof item === 'object' ? JSON.stringify(item) : item
return typeof item === 'object' ? JSON.stringify(item) : item;
}
catch(err){return;}
},
@ -65,11 +65,11 @@ export default
// uses the API's runner events and convenience properties .failed .changed to determine status.
// see: job_event_callback.py for more filters to support
processEventStatus: function(event){
if (event.event == 'runner_on_unreachable'){
if (event.event === 'runner_on_unreachable'){
return {
class: 'HostEvents-status--unreachable',
status: 'unreachable'
}
};
}
// equiv to 'runner_on_error' && 'runner on failed'
if (event.failed){
@ -83,19 +83,19 @@ export default
return {
class: 'HostEvents-status--changed',
status: 'changed'
};
}
}
if (event.event == 'runner_on_ok' || event.event == 'runner_on_async_ok'){
if (event.event === 'runner_on_ok' || event.event === 'runner_on_async_ok'){
return {
class: 'HostEvents-status--ok',
status: 'ok'
};
}
}
if (event.event == 'runner_on_skipped'){
if (event.event === 'runner_on_skipped'){
return {
class: 'HostEvents-status--skipped',
status: 'skipped'
}
};
}
},
// Consumes a response from this.getRelatedJobEvents(id, params)
@ -138,7 +138,7 @@ export default
Rest.setUrl(url);
return Rest.get()
.success(function(data){
return data
return data;
})
.error(function(data, status) {
ProcessErrors($rootScope, data, status, null, { hdr: 'Error!',
@ -162,7 +162,7 @@ export default
// e.g. ?page_size=200&order=host_name
getJobHostSummaries: function(id, params){
var url = GetBasePath('jobs');
url = url + id + '/job_host_summaries/?'
url = url + id + '/job_host_summaries/?';
Object.keys(params).forEach(function(key, index) {
// the API is tolerant of extra ampersands
url = url + '&' + key + '=' + params[key];
@ -170,7 +170,7 @@ export default
Rest.setUrl(url);
return Rest.get()
.success(function(data){
return data
return data;
})
.error(function(data, status) {
ProcessErrors($rootScope, data, status, null, { hdr: 'Error!',
@ -189,7 +189,7 @@ export default
Rest.setUrl(url);
return Rest.get()
.success(function(data){
return data
return data;
})
.error(function(data, status) {
ProcessErrors($rootScope, data, status, null, { hdr: 'Error!',
@ -206,7 +206,7 @@ export default
Rest.setUrl(url);
return Rest.get()
.success(function(data){
return data
return data;
})
.error(function(data, status) {
ProcessErrors($rootScope, data, status, null, { hdr: 'Error!',
@ -219,7 +219,7 @@ export default
Rest.setUrl(url);
return Rest.get()
.success(function(data){
return data
return data;
})
.error(function(data, status) {
ProcessErrors($rootScope, data, status, null, { hdr: 'Error!',
@ -233,13 +233,12 @@ export default
Rest.setUrl(url);
return Rest.get()
.success(function(data){
return data
return data;
})
.error(function(data, status) {
ProcessErrors($rootScope, data, status, null, { hdr: 'Error!',
msg: 'Call to ' + url + '. GET returned: ' + status });
});
}
}
}
];
};
}];

View File

@ -9,7 +9,7 @@ export default
angular.module('AllJobsDefinition', ['sanitizeFilter', 'capitalizeFilter'])
.value( 'AllJobsList', {
name: 'all_jobs',
name: 'jobs',
basePath: 'unified_jobs',
iterator: 'all_job',
editTitle: 'All Jobs',
@ -18,8 +18,9 @@ export default
well: false,
fields: {
status: {
label: 'Status',
columnClass: 'List-staticColumn--smallStatus',
label: '',
searchLabel: 'Status',
columnClass: 'col-lg-1 col-md-1 col-sm-2 col-xs-2 List-staticColumn--smallStatus',
awToolTip: "{{ all_job.status_tip }}",
awTipPlacement: "right",
dataTitle: "{{ all_job.status_popover_title }}",
@ -30,13 +31,10 @@ export default
searchType: 'select',
nosort: true,
searchOptions: [
{ name: "Success", value: "successful" },
{ name: "Error", value: "error" },
{ name: "Failed", value: "failed" },
{ name: "Canceled", value: "canceled" }
]
},
id: {
key: true,
label: 'ID',
ngClick:"viewJobDetails(all_job)",
searchType: 'int',
@ -45,6 +43,7 @@ export default
dataPlacement: 'top'
},
name: {
key: true,
label: 'Name',
columnClass: 'col-lg-3 col-md-3 col-sm-4 col-xs-6',
ngClick: "viewJobDetails(all_job)",

View File

@ -36,7 +36,9 @@ angular.module('ApiLoader', ['Utilities'])
data.base = base;
$rootScope.defaultUrls = data;
// tiny hack to side-step api/v1/job_events not being a visible endpoint @ GET api/v1/
if (!$rootScope.defaultUrls['job_events']){
$rootScope.defaultUrls['job_events'] = '/api/v1/job_events/';
}
Store('api', data);
})
.error(function (data, status) {