mirror of
https://github.com/ansible/awx.git
synced 2026-05-19 14:57:39 -02:30
fixed last of the grunt issues
This commit is contained in:
@@ -351,22 +351,23 @@ export default
|
|||||||
};
|
};
|
||||||
}])
|
}])
|
||||||
|
|
||||||
.factory('UpdateJobStatus', ['GetElapsed', 'Empty', 'JobIsFinished', function(GetElapsed, Empty, JobIsFinished) {
|
.factory('UpdateJobStatus', ['GetElapsed', 'Empty', 'JobIsFinished', 'longDateFilter', function(GetElapsed, Empty, JobIsFinished, longDateFilter) {
|
||||||
return function(params) {
|
return function(params) {
|
||||||
var scope = params.scope,
|
var scope = params.scope,
|
||||||
failed = params.failed,
|
failed = params.failed,
|
||||||
modified = params.modified,
|
modified = params.modified,
|
||||||
started = params.started;
|
started = params.started,
|
||||||
|
finished = params.finished;
|
||||||
|
|
||||||
if (failed && scope.job_status.status !== 'failed' && scope.job_status.status !== 'error' &&
|
if (failed && scope.job_status.status !== 'failed' && scope.job_status.status !== 'error' &&
|
||||||
scope.job_status.status !== 'canceled') {
|
scope.job_status.status !== 'canceled') {
|
||||||
scope.job_status.status = 'failed';
|
scope.job_status.status = 'failed';
|
||||||
}
|
}
|
||||||
if (JobIsFinished(scope) && !Empty(modified)) {
|
if (JobIsFinished(scope) && !Empty(modified)) {
|
||||||
scope.job_status.finished = longDateFilter(modified)
|
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 = longDateFilter(modified)
|
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({
|
||||||
@@ -900,8 +901,7 @@ export default
|
|||||||
.factory('SelectTask', ['JobDetailService', function(JobDetailService) {
|
.factory('SelectTask', ['JobDetailService', function(JobDetailService) {
|
||||||
return function(params) {
|
return function(params) {
|
||||||
var scope = params.scope,
|
var scope = params.scope,
|
||||||
id = params.id,
|
id = params.id;
|
||||||
callback = params.callback;
|
|
||||||
|
|
||||||
scope.selectedTask = id;
|
scope.selectedTask = id;
|
||||||
scope.tasks.forEach(function(task, idx) {
|
scope.tasks.forEach(function(task, idx) {
|
||||||
@@ -912,7 +912,7 @@ export default
|
|||||||
scope.tasks[idx].taskActiveClass = '';
|
scope.tasks[idx].taskActiveClass = '';
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
var params = {
|
params = {
|
||||||
parent: scope.selectedTask,
|
parent: scope.selectedTask,
|
||||||
event__startswith: 'runner',
|
event__startswith: 'runner',
|
||||||
page_size: scope.hostResultsMaxRows,
|
page_size: scope.hostResultsMaxRows,
|
||||||
|
|||||||
@@ -804,7 +804,7 @@ function($compile, Rest, GetBasePath, TextareaResize,CreateDialog, GenerateForm,
|
|||||||
if((scope.portalMode===false || scope.$parent.portalMode===false ) && Empty(data.system_job) ||
|
if((scope.portalMode===false || scope.$parent.portalMode===false ) && Empty(data.system_job) ||
|
||||||
(base === 'home')){
|
(base === 'home')){
|
||||||
// use $state.go with reload: true option to re-instantiate sockets in
|
// use $state.go with reload: true option to re-instantiate sockets in
|
||||||
$state.go('jobDetail', {id: job}, {reload: true})
|
$state.go('jobDetail', {id: job}, {reload: true});
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -60,14 +60,13 @@ function manageGroupsDirectiveController($filter, $location, $log,
|
|||||||
|
|
||||||
$scope.parseType = 'yaml';
|
$scope.parseType = 'yaml';
|
||||||
|
|
||||||
var form_scope =
|
generator.inject(GroupForm, {
|
||||||
generator.inject(GroupForm, {
|
mode: mode,
|
||||||
mode: mode,
|
id: 'properties-tab',
|
||||||
id: 'properties-tab',
|
related: false,
|
||||||
related: false,
|
scope: $scope,
|
||||||
scope: properties_scope,
|
cancelButton: false,
|
||||||
cancelButton: false,
|
});
|
||||||
});
|
|
||||||
|
|
||||||
generator.reset();
|
generator.reset();
|
||||||
|
|
||||||
|
|||||||
@@ -6,15 +6,15 @@
|
|||||||
|
|
||||||
|
|
||||||
export default
|
export default
|
||||||
['$stateParams', '$scope', '$state', 'Wait', 'JobDetailService', 'event',
|
['$stateParams', '$scope', '$state', 'Wait', 'JobDetailService', 'event', 'CodeMirror',
|
||||||
function($stateParams, $scope, $state, Wait, JobDetailService, event){
|
function($stateParams, $scope, $state, Wait, JobDetailService, event, CodeMirror){
|
||||||
|
|
||||||
$scope.processEventStatus = JobDetailService.processEventStatus;
|
$scope.processEventStatus = JobDetailService.processEventStatus;
|
||||||
$scope.hostResults = [];
|
$scope.hostResults = [];
|
||||||
// Avoid rendering objects in the details fieldset
|
// Avoid rendering objects in the details fieldset
|
||||||
// ng-if="processResults(value)" via host-event-details.partial.html
|
// ng-if="processResults(value)" via host-event-details.partial.html
|
||||||
$scope.processResults = function(value){
|
$scope.processResults = function(value){
|
||||||
if (typeof value == 'object'){return false;}
|
if (typeof value === 'object'){return false;}
|
||||||
else {return true;}
|
else {return true;}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -24,19 +24,19 @@
|
|||||||
lineNumbers: true,
|
lineNumbers: true,
|
||||||
mode: {name: "javascript", json: true}
|
mode: {name: "javascript", json: true}
|
||||||
});
|
});
|
||||||
editor.setSize("100%", 300)
|
editor.setSize("100%", 300);
|
||||||
editor.getDoc().setValue(JSON.stringify(json, null, 4));
|
editor.getDoc().setValue(JSON.stringify(json, null, 4));
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.getActiveHostIndex = function(){
|
$scope.getActiveHostIndex = function(){
|
||||||
var result = $scope.hostResults.filter(function( obj ) {
|
var result = $scope.hostResults.filter(function( obj ) {
|
||||||
return obj.id == $scope.event.id;
|
return obj.id === $scope.event.id;
|
||||||
});
|
});
|
||||||
return $scope.hostResults.indexOf(result[0]);
|
return $scope.hostResults.indexOf(result[0]);
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.showPrev = function(){
|
$scope.showPrev = function(){
|
||||||
return $scope.getActiveHostIndex() != 0;
|
return $scope.getActiveHostIndex() !== 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.showNext = function(){
|
$scope.showNext = function(){
|
||||||
@@ -61,12 +61,13 @@
|
|||||||
$scope.hostResults = res.results;
|
$scope.hostResults = res.results;
|
||||||
});
|
});
|
||||||
$scope.json = JobDetailService.processJson($scope.event);
|
$scope.json = JobDetailService.processJson($scope.event);
|
||||||
if ($state.current.name == 'jobDetail.host-event.json'){
|
if ($state.current.name === 'jobDetail.host-event.json'){
|
||||||
codeMirror('#HostEvent-json', $scope.json);
|
codeMirror('#HostEvent-json', $scope.json);
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
$scope.stdout = JobDetailService.processJson($scope.event.event_data.res)
|
$scope.stdout = JobDetailService
|
||||||
if ($state.current.name == 'jobDetail.host-event.stdout'){
|
.processJson($scope.event.event_data.res);
|
||||||
|
if ($state.current.name === 'jobDetail.host-event.stdout'){
|
||||||
codeMirror('#HostEvent-stdout', $scope.stdout);
|
codeMirror('#HostEvent-stdout', $scope.stdout);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -73,7 +73,6 @@
|
|||||||
return JobDetailService.getRelatedJobEvents($stateParams.id, {
|
return JobDetailService.getRelatedJobEvents($stateParams.id, {
|
||||||
host_name: $stateParams.hostName,
|
host_name: $stateParams.hostName,
|
||||||
or__field__event: 'runner_on_ok',
|
or__field__event: 'runner_on_ok',
|
||||||
or__field__event: 'runner_on_ok_async',
|
|
||||||
changed: false
|
changed: false
|
||||||
})
|
})
|
||||||
.success(function(res){
|
.success(function(res){
|
||||||
|
|||||||
@@ -12,6 +12,20 @@
|
|||||||
$scope.filter = 'all';
|
$scope.filter = 'all';
|
||||||
$scope.search = null;
|
$scope.search = null;
|
||||||
|
|
||||||
|
var init = function(){
|
||||||
|
Wait('start');
|
||||||
|
JobDetailService.getJobHostSummaries($stateParams.id, {page_size: page_size})
|
||||||
|
.success(function(res){
|
||||||
|
$scope.hosts = res.results;
|
||||||
|
$scope.next = res.next;
|
||||||
|
Wait('stop');
|
||||||
|
});
|
||||||
|
JobDetailService.getJob({id: $stateParams.id})
|
||||||
|
.success(function(res){
|
||||||
|
$scope.status = res.results[0].status;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
var buildGraph = function(hosts){
|
var buildGraph = function(hosts){
|
||||||
// status waterfall: unreachable > failed > changed > ok > skipped
|
// status waterfall: unreachable > failed > changed > ok > skipped
|
||||||
var count;
|
var count;
|
||||||
@@ -39,14 +53,14 @@
|
|||||||
// JobEvent.update_host_summary_from_stats() from /awx/main.models.jobs.py
|
// JobEvent.update_host_summary_from_stats() from /awx/main.models.jobs.py
|
||||||
jobSocket.on('summary_complete', function(data) {
|
jobSocket.on('summary_complete', function(data) {
|
||||||
// discard socket msgs we don't care about in this context
|
// discard socket msgs we don't care about in this context
|
||||||
if ($stateParams.id == data['unified_job_id']){
|
if ($stateParams.id === data.unified_job_id){
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
// UnifiedJob.def socketio_emit_status() from /awx/main.models.unified_jobs.py
|
// UnifiedJob.def socketio_emit_status() from /awx/main.models.unified_jobs.py
|
||||||
jobSocket.on('status_changed', function(data) {
|
jobSocket.on('status_changed', function(data) {
|
||||||
if ($stateParams.id == data['unified_job_id']){
|
if ($stateParams.id === data.unified_job_id){
|
||||||
$scope.status = data['status'];
|
$scope.status = data.status;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@@ -69,14 +83,14 @@
|
|||||||
text[key] = grammar(value.length, key);
|
text[key] = grammar(value.length, key);
|
||||||
});
|
});
|
||||||
*/
|
*/
|
||||||
return grammar(n, status)
|
return grammar(n, status);
|
||||||
};
|
};
|
||||||
$scope.getNextPage = function(){
|
$scope.getNextPage = function(){
|
||||||
if ($scope.next){
|
if ($scope.next){
|
||||||
JobDetailService.getNextPage($scope.next).success(function(res){
|
JobDetailService.getNextPage($scope.next).success(function(res){
|
||||||
res.results.forEach(function(key, index){
|
res.results.forEach(function(key, index){
|
||||||
$scope.hosts.push(res.results[index]);
|
$scope.hosts.push(res.results[index]);
|
||||||
})
|
});
|
||||||
$scope.hosts.push(res.results);
|
$scope.hosts.push(res.results);
|
||||||
$scope.next = res.next;
|
$scope.next = res.next;
|
||||||
});
|
});
|
||||||
@@ -91,7 +105,7 @@
|
|||||||
$scope.hosts = res.results;
|
$scope.hosts = res.results;
|
||||||
$scope.next = res.next;
|
$scope.next = res.next;
|
||||||
Wait('stop');
|
Wait('stop');
|
||||||
})
|
});
|
||||||
};
|
};
|
||||||
$scope.setFilter = function(filter){
|
$scope.setFilter = function(filter){
|
||||||
$scope.filter = filter;
|
$scope.filter = filter;
|
||||||
@@ -100,7 +114,7 @@
|
|||||||
JobDetailService.getJobHostSummaries($stateParams.id, {
|
JobDetailService.getJobHostSummaries($stateParams.id, {
|
||||||
page_size: page_size
|
page_size: page_size
|
||||||
}).success(function(res){
|
}).success(function(res){
|
||||||
Wait('stop')
|
Wait('stop');
|
||||||
$scope.hosts = res.results;
|
$scope.hosts = res.results;
|
||||||
$scope.next = res.next;
|
$scope.next = res.next;
|
||||||
});
|
});
|
||||||
@@ -111,32 +125,18 @@
|
|||||||
page_size: page_size,
|
page_size: page_size,
|
||||||
failed: true
|
failed: true
|
||||||
}).success(function(res){
|
}).success(function(res){
|
||||||
Wait('stop')
|
Wait('stop');
|
||||||
$scope.hosts = res.results;
|
$scope.hosts = res.results;
|
||||||
$scope.next = res.next;
|
$scope.next = res.next;
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
var get = filter == 'all' ? getAll() : getFailed();
|
$scope.get = filter === 'all' ? getAll() : getFailed();
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.$watchCollection('hosts', function(curr, prev){
|
$scope.$watchCollection('hosts', function(curr){
|
||||||
$scope.count = buildGraph(curr);
|
$scope.count = buildGraph(curr);
|
||||||
DrawGraph({count: $scope.count, resize:true});
|
DrawGraph({count: $scope.count, resize:true});
|
||||||
});
|
});
|
||||||
|
|
||||||
var init = function(){
|
|
||||||
Wait('start');
|
|
||||||
JobDetailService.getJobHostSummaries($stateParams.id, {page_size: page_size})
|
|
||||||
.success(function(res){
|
|
||||||
$scope.hosts = res.results;
|
|
||||||
$scope.next = res.next;
|
|
||||||
Wait('stop');
|
|
||||||
});
|
|
||||||
JobDetailService.getJob({id: $stateParams.id})
|
|
||||||
.success(function(res){
|
|
||||||
$scope.status = res.results[0].status;
|
|
||||||
});
|
|
||||||
};
|
|
||||||
socketListener();
|
socketListener();
|
||||||
init();
|
init();
|
||||||
}];
|
}];
|
||||||
@@ -243,7 +243,7 @@ export default
|
|||||||
event: 'playbook_on_stats'
|
event: 'playbook_on_stats'
|
||||||
};
|
};
|
||||||
JobDetailService.getRelatedJobEvents(scope.job.id, params)
|
JobDetailService.getRelatedJobEvents(scope.job.id, params)
|
||||||
.success(function(data) {
|
.success(function() {
|
||||||
UpdateDOM({ scope: scope });
|
UpdateDOM({ scope: scope });
|
||||||
})
|
})
|
||||||
.error(function(data, status) {
|
.error(function(data, status) {
|
||||||
@@ -278,7 +278,6 @@ export default
|
|||||||
};
|
};
|
||||||
JobDetailService.getRelatedJobEvents(scope.job.id, params)
|
JobDetailService.getRelatedJobEvents(scope.job.id, params)
|
||||||
.success(function(data) {
|
.success(function(data) {
|
||||||
var event, status, item, msg;
|
|
||||||
if (data.results.length > 0) {
|
if (data.results.length > 0) {
|
||||||
lastEventId = data.results[0].id;
|
lastEventId = data.results[0].id;
|
||||||
}
|
}
|
||||||
@@ -802,6 +801,7 @@ export default
|
|||||||
};
|
};
|
||||||
|
|
||||||
scope.searchTasks = function() {
|
scope.searchTasks = function() {
|
||||||
|
var params;
|
||||||
if (scope.search_task_name) {
|
if (scope.search_task_name) {
|
||||||
scope.searchTasksEnabled = false;
|
scope.searchTasksEnabled = false;
|
||||||
}
|
}
|
||||||
@@ -826,6 +826,7 @@ export default
|
|||||||
};
|
};
|
||||||
|
|
||||||
scope.searchHosts = function() {
|
scope.searchHosts = function() {
|
||||||
|
var params;
|
||||||
if (scope.search_host_name) {
|
if (scope.search_host_name) {
|
||||||
scope.searchHostsEnabled = false;
|
scope.searchHostsEnabled = false;
|
||||||
}
|
}
|
||||||
@@ -834,7 +835,7 @@ export default
|
|||||||
}
|
}
|
||||||
if (!scope.liveEventProcessing || scope.pauseLiveEvents) {
|
if (!scope.liveEventProcessing || scope.pauseLiveEvents) {
|
||||||
scope.hostResultsLoading = true;
|
scope.hostResultsLoading = true;
|
||||||
var params = {
|
params = {
|
||||||
parent: scope.selectedTask,
|
parent: scope.selectedTask,
|
||||||
event__startswith: 'runner',
|
event__startswith: 'runner',
|
||||||
page_size: scope.hostResultsMaxRows,
|
page_size: scope.hostResultsMaxRows,
|
||||||
|
|||||||
@@ -5,7 +5,6 @@
|
|||||||
*************************************************/
|
*************************************************/
|
||||||
|
|
||||||
import {templateUrl} from '../shared/template-url/template-url.factory';
|
import {templateUrl} from '../shared/template-url/template-url.factory';
|
||||||
import HostSummaryController from './host-summary/host-summary.controller';
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'jobDetail',
|
name: 'jobDetail',
|
||||||
|
|||||||
@@ -3,7 +3,8 @@ export default
|
|||||||
return {
|
return {
|
||||||
stringifyParams: function(params){
|
stringifyParams: function(params){
|
||||||
return _.reduce(params, (result, value, key) => {
|
return _.reduce(params, (result, value, key) => {
|
||||||
return result + key + '=' + value + '&'}, '');
|
return result + key + '=' + value + '&';
|
||||||
|
}, '');
|
||||||
},
|
},
|
||||||
|
|
||||||
// the the API passes through Ansible's event_data response
|
// the the API passes through Ansible's event_data response
|
||||||
@@ -72,7 +73,7 @@ export default
|
|||||||
return {
|
return {
|
||||||
class: 'HostEvents-status--failed',
|
class: 'HostEvents-status--failed',
|
||||||
status: 'failed'
|
status: 'failed'
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
// catch the changed case before ok, because both can be true
|
// catch the changed case before ok, because both can be true
|
||||||
if (event.changed){
|
if (event.changed){
|
||||||
@@ -142,7 +143,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!',
|
||||||
|
|||||||
@@ -165,7 +165,7 @@ export default
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.submitJob = function (id, name, card) {
|
$scope.submitJob = function (id, name) {
|
||||||
Wait('start');
|
Wait('start');
|
||||||
defaultUrl = GetBasePath('system_job_templates')+id+'/launch/';
|
defaultUrl = GetBasePath('system_job_templates')+id+'/launch/';
|
||||||
CreateDialog({
|
CreateDialog({
|
||||||
|
|||||||
@@ -36,8 +36,8 @@ 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/
|
||||||
if (!$rootScope.defaultUrls['job_events']){
|
if (!$rootScope.defaultUrls.job_events){
|
||||||
$rootScope.defaultUrls['job_events'] = '/api/v1/job_events/';
|
$rootScope.defaultUrls.job_events = '/api/v1/job_events/';
|
||||||
}
|
}
|
||||||
Store('api', data);
|
Store('api', data);
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user