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', .factory('DigestEvent', ['$rootScope', '$log', 'UpdatePlayStatus', 'UpdateHostStatus', 'AddHostResult',
'GetElapsed', 'UpdateTaskStatus', 'JobIsFinished', 'AddNewTask', 'AddNewPlay', 'GetElapsed', 'UpdateTaskStatus', 'JobIsFinished', 'AddNewTask', 'AddNewPlay',
function($rootScope, $log, UpdatePlayStatus, UpdateHostStatus, AddHostResult, GetElapsed, function($rootScope, $log, UpdatePlayStatus, UpdateHostStatus, AddHostResult, GetElapsed,
UpdateTaskStatus, JobIsFinished, AddNewTask, AddNewPlay) { UpdateTaskStatus, JobIsFinished, AddNewTask, AddNewPlay, longDateFilter) {
return function(params) { return function(params) {
var scope = params.scope, var scope = params.scope,
@ -185,7 +185,7 @@ export default
}; };
}]) }])
.factory('GetElapsed', ['moment', function(moment) { .factory('GetElapsed', [function() {
return function(params) { return function(params) {
var start = params.start, var start = params.start,
end = params.end, 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) { return function(params) {
var scope = params.scope, var scope = params.scope,
failed = params.failed, failed = params.failed,
@ -363,10 +363,10 @@ export default
scope.job_status.status = 'failed'; scope.job_status.status = 'failed';
} }
if (JobIsFinished(scope) && !Empty(modified)) { 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)) { 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)) { if (!Empty(scope.job_status.finished) && !Empty(scope.job_status.started)) {
scope.job_status.elapsed = GetElapsed({ scope.job_status.elapsed = GetElapsed({
@ -913,7 +913,6 @@ export default
scope.tasks[idx].taskActiveClass = ''; scope.tasks[idx].taskActiveClass = '';
} }
}); });
// /api/v1/jobs/16/job_events/?parent=832&event__startswith=runner&page_size=200&order=host_name,counte
var params = { var params = {
parent: scope.selectedTask, parent: scope.selectedTask,
event__startswith: 'runner', 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.less";
@import "awx/ui/client/src/shared/branding/colors.default.less"; @import "awx/ui/client/src/shared/branding/colors.default.less";
.CodeMirror{ .HostEvents .CodeMirror{
border: none; border: none;
} }
.HostEvents .modal-footer{ .HostEvents .modal-footer{

View File

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

View File

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

View File

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

View File

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

View File

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