mirror of
https://github.com/ansible/awx.git
synced 2026-05-10 19:07:36 -02:30
use record list to find orphan task records when toggling
This commit is contained in:
@@ -1,4 +1,7 @@
|
|||||||
/* eslint camelcase: 0 */
|
/* eslint camelcase: 0 */
|
||||||
|
const EVENT_START_TASK = 'playbook_on_task_start';
|
||||||
|
const EVENT_START_PLAY = 'playbook_on_play_start';
|
||||||
|
|
||||||
let $compile;
|
let $compile;
|
||||||
let $q;
|
let $q;
|
||||||
let $scope;
|
let $scope;
|
||||||
@@ -142,8 +145,15 @@ function toggleMenuExpand () {
|
|||||||
if (scroll.isPaused()) return;
|
if (scroll.isPaused()) return;
|
||||||
|
|
||||||
const recordList = Object.keys(render.record).map(key => render.record[key]);
|
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))
|
.map(({ uuid }) => getToggleElements(uuid))
|
||||||
.filter(({ icon }) => icon.length > 0)
|
.filter(({ icon }) => icon.length > 0)
|
||||||
.map(({ icon, lines }) => setExpanded(icon, lines, !vm.isMenuExpanded));
|
.map(({ icon, lines }) => setExpanded(icon, lines, !vm.isMenuExpanded));
|
||||||
|
|||||||
@@ -119,6 +119,7 @@ function JobRenderService ($q, $sce, $window) {
|
|||||||
const info = {
|
const info = {
|
||||||
id: event.id,
|
id: event.id,
|
||||||
line: ln + 1,
|
line: ln + 1,
|
||||||
|
name: event.event,
|
||||||
uuid: event.uuid,
|
uuid: event.uuid,
|
||||||
level: event.event_level,
|
level: event.event_level,
|
||||||
start: event.start_line,
|
start: event.start_line,
|
||||||
@@ -210,13 +211,6 @@ function JobRenderService ($q, $sce, $window) {
|
|||||||
if (current.parents) {
|
if (current.parents) {
|
||||||
classList = current.parents.reduce((list, uuid) => `${list} child-of-${uuid}`, '');
|
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) {
|
if (!tdEvent) {
|
||||||
|
|||||||
Reference in New Issue
Block a user