From 71f2388ec811929a273dd26a410f469d8b60ddde Mon Sep 17 00:00:00 2001 From: Jake McDermott Date: Mon, 25 Jun 2018 01:36:16 -0400 Subject: [PATCH] use record list to find orphan task records when toggling --- awx/ui/client/features/output/index.controller.js | 12 +++++++++++- awx/ui/client/features/output/render.service.js | 8 +------- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/awx/ui/client/features/output/index.controller.js b/awx/ui/client/features/output/index.controller.js index 3f99f9d77c..ae249b1210 100644 --- a/awx/ui/client/features/output/index.controller.js +++ b/awx/ui/client/features/output/index.controller.js @@ -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)); diff --git a/awx/ui/client/features/output/render.service.js b/awx/ui/client/features/output/render.service.js index bbae68f507..828d170edd 100644 --- a/awx/ui/client/features/output/render.service.js +++ b/awx/ui/client/features/output/render.service.js @@ -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) {