mirror of
https://github.com/ansible/awx.git
synced 2026-01-16 12:20:45 -03:30
use record list to find orphan task records when toggling
This commit is contained in:
parent
ccd8a48617
commit
71f2388ec8
@ -1,4 +1,7 @@
|
||||
/* eslint camelcase: 0 */
|
||||
const EVENT_START_TASK = 'playbook_on_task_start';
|
||||
const EVENT_START_PLAY = 'playbook_on_play_start';
|
||||
|
||||
let $compile;
|
||||
let $q;
|
||||
let $scope;
|
||||
@ -142,8 +145,15 @@ function toggleMenuExpand () {
|
||||
if (scroll.isPaused()) return;
|
||||
|
||||
const recordList = Object.keys(render.record).map(key => render.record[key]);
|
||||
const playRecords = recordList.filter(({ name }) => name === EVENT_START_PLAY);
|
||||
const playIds = playRecords.map(({ uuid }) => uuid);
|
||||
|
||||
const toggled = recordList
|
||||
// get any task record that does not have a parent play record
|
||||
const orphanTaskRecords = recordList
|
||||
.filter(({ name }) => name === EVENT_START_TASK)
|
||||
.filter(({ parents }) => !parents.some(uuid => playIds.indexOf(uuid) >= 0));
|
||||
|
||||
const toggled = playRecords.concat(orphanTaskRecords)
|
||||
.map(({ uuid }) => getToggleElements(uuid))
|
||||
.filter(({ icon }) => icon.length > 0)
|
||||
.map(({ icon, lines }) => setExpanded(icon, lines, !vm.isMenuExpanded));
|
||||
|
||||
@ -119,6 +119,7 @@ function JobRenderService ($q, $sce, $window) {
|
||||
const info = {
|
||||
id: event.id,
|
||||
line: ln + 1,
|
||||
name: event.event,
|
||||
uuid: event.uuid,
|
||||
level: event.event_level,
|
||||
start: event.start_line,
|
||||
@ -210,13 +211,6 @@ function JobRenderService ($q, $sce, $window) {
|
||||
if (current.parents) {
|
||||
classList = current.parents.reduce((list, uuid) => `${list} child-of-${uuid}`, '');
|
||||
}
|
||||
// if a row has children, and has parent,
|
||||
// we grab all its children and append parent to its children
|
||||
if (id !== '' && current.parents) {
|
||||
const children = $(`.child-of-${current.uuid}`);
|
||||
const parentId = current.parents[0];
|
||||
children.addClass(`child-of-${parentId}`);
|
||||
}
|
||||
}
|
||||
|
||||
if (!tdEvent) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user