From 3933e01dd14dee4d045d8463a0116dff466685d6 Mon Sep 17 00:00:00 2001 From: Haokun-Chen Date: Fri, 22 Jun 2018 09:33:23 -0400 Subject: [PATCH] fix toggle menu when scroll up --- .../client/features/output/render.service.js | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/awx/ui/client/features/output/render.service.js b/awx/ui/client/features/output/render.service.js index 64947f4a54..bbae68f507 100644 --- a/awx/ui/client/features/output/render.service.js +++ b/awx/ui/client/features/output/render.service.js @@ -170,13 +170,11 @@ function JobRenderService ($q, $sce, $window) { this.getParentEvents = (uuid, list) => { list = list || []; - - if (this.record[uuid]) { - list.push(uuid); - - if (this.record[uuid].parents) { - list = list.concat(this.record[uuid].parents); - } + // always push its parent if exists + list.push(uuid); + // if we can get grandparent in current visible lines, we also push it + if (this.record[uuid] && this.record[uuid].parents) { + list = list.concat(this.record[uuid].parents); } return list; @@ -212,6 +210,13 @@ 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) {