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