mirror of
https://github.com/ansible/awx.git
synced 2026-01-17 04:31:21 -03:30
AC-175 All parent nodes are fully expanded when a job is views on the Job Events page. The user no longer has to manually expand each node. Also move the Status column over to the left side.
This commit is contained in:
parent
361c085ce5
commit
6deca2294d
@ -18,14 +18,15 @@ function JobEventsList ($scope, $rootScope, $location, $log, $routeParams, Rest,
|
||||
var list = JobEventList;
|
||||
list.base = $location.path();
|
||||
|
||||
var defaultUrl = GetBasePath('jobs') + $routeParams.id + '/job_events/?parent__isnull=1';
|
||||
var defaultUrl = GetBasePath('jobs') + $routeParams.id + '/job_events/?parent__isnull=1';
|
||||
|
||||
var view = GenerateList;
|
||||
var base = $location.path().replace(/^\//,'').split('/')[0];
|
||||
var scope = view.inject(list, { mode: 'edit' });
|
||||
$rootScope.flashMessage = null;
|
||||
scope.selected = [];
|
||||
|
||||
scope.expand = true; //on load, automatically expand all nodes
|
||||
|
||||
if (scope.RemovePostRefresh) {
|
||||
scope.RemovePostRefresh();
|
||||
}
|
||||
@ -43,6 +44,44 @@ function JobEventsList ($scope, $rootScope, $location, $log, $routeParams, Rest,
|
||||
}
|
||||
scope.jobevents[i].status = (scope.jobevents[i].failed) ? 'error' : 'success';
|
||||
}
|
||||
|
||||
// Expand all parent nodes
|
||||
if (scope.removeSetExpanded) {
|
||||
scope.removeSetExpanded();
|
||||
}
|
||||
scope.removeSetExpanded = scope.$on('setExpanded', function() {
|
||||
// After ToggleChildren completes, look for the next parent that needs to be expanded
|
||||
var found = false;
|
||||
for (var i=0; i < set.length && found == false && scope.expand; i++) {
|
||||
if (set[i]['related']['children'] && (set[i]['ngicon'] == undefined || set[i]['ngicon'] == 'icon-expand-alt')) {
|
||||
found = true;
|
||||
ToggleChildren({
|
||||
scope: scope,
|
||||
list: list,
|
||||
id: set[i].id,
|
||||
children: set[i]['related']['children']
|
||||
});
|
||||
}
|
||||
}
|
||||
if (found == false) {
|
||||
// After looping through all the nodes and finding nothing to expand, turn off
|
||||
// auto-expand. From now on user will manually collapse and expand nodes.
|
||||
scope.expand = false;
|
||||
}
|
||||
});
|
||||
// Start the auto expansion
|
||||
set = scope[list.name];
|
||||
for (var i=0; i < set.length; i++) {
|
||||
if (set[i]['related']['children'] && (set[i]['ngicon'] == undefined || set[i]['ngicon'] == 'icon-expand-alt')) {
|
||||
ToggleChildren({
|
||||
scope: scope,
|
||||
list: list,
|
||||
id: set[i].id,
|
||||
children: set[i]['related']['children']
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
SearchInit({ scope: scope, set: 'jobevents', list: list, url: defaultUrl });
|
||||
|
||||
@ -27,6 +27,12 @@ angular.module('JobEventFormDefinition', [])
|
||||
readonly: true,
|
||||
"class": 'span3'
|
||||
},
|
||||
status: {
|
||||
label: 'Status',
|
||||
type: 'text',
|
||||
"class": 'job-\{\{ event_status \}\}',
|
||||
readonly: true
|
||||
},
|
||||
host: {
|
||||
label: 'Host',
|
||||
type: 'text',
|
||||
|
||||
@ -59,7 +59,8 @@ angular.module('ChildrenHelper', ['RestServices', 'Utilities'])
|
||||
set.splice(clicked + 1, 0, data.results[j]);
|
||||
}
|
||||
clicked++;
|
||||
}
|
||||
}
|
||||
scope.$emit('setExpanded');
|
||||
})
|
||||
.error( function(data, status, headers, config) {
|
||||
ProcessErrors(scope, data, status, null,
|
||||
|
||||
@ -25,6 +25,16 @@ angular.module('JobEventsListDefinition', [])
|
||||
searchable: false,
|
||||
ngClick: "viewJobEvent(\{\{ jobevent.id \}\})",
|
||||
},
|
||||
status: {
|
||||
label: 'Status',
|
||||
icon: 'icon-circle',
|
||||
"class": 'job-\{\{ jobevent.status \}\}',
|
||||
searchField: 'failed',
|
||||
searchType: 'boolean',
|
||||
searchOptions: [{ name: "success", value: 0 }, { name: "error", value: 1 }],
|
||||
nosort: true,
|
||||
searchable: false,
|
||||
},
|
||||
event_display: {
|
||||
label: 'Event',
|
||||
hasChildren: true,
|
||||
@ -39,16 +49,6 @@ angular.module('JobEventsListDefinition', [])
|
||||
searchField: 'hosts__name',
|
||||
nosort: true,
|
||||
id: 'job-event-host-header'
|
||||
},
|
||||
status: {
|
||||
label: 'Status',
|
||||
icon: 'icon-circle',
|
||||
"class": 'job-\{\{ jobevent.status \}\}',
|
||||
searchField: 'failed',
|
||||
searchType: 'boolean',
|
||||
searchOptions: [{ name: "success", value: 0 }, { name: "error", value: 1 }],
|
||||
nosort: true,
|
||||
searchable: false,
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
@ -191,7 +191,9 @@ angular.module('ListGenerator', ['GeneratorHelpers'])
|
||||
html += "<tbody>\n";
|
||||
html += "<tr ";
|
||||
html += (options.mode == 'lookup' || options.mode == 'select') ? "ng-class=\"" + list.iterator + "_\{\{ " + list.iterator + ".id \}\}_class\" " : "";
|
||||
html += "class=\"" + list.iterator + "_class\" ng-repeat=\"" + list.iterator + " in " + list.name + "\"";
|
||||
html += "class=\"" + list.iterator + "_class\" ng-repeat=\"" + list.iterator + " in " + list.name;
|
||||
html += (list.orderBy) ? " | orderBy:'" + list.orderBy + "'" : "";
|
||||
html += "\"";
|
||||
html += (options.mode == 'lookup' || options.mode == 'select') ? " ng-click=\"toggle_" + list.iterator +"({{ " + list.iterator + ".id }})\"" : "";
|
||||
html += ">\n";
|
||||
if (list.index) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user