Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 35 additions & 12 deletions apps/port/export.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
slideList = slideList.replace(/\s+/g, '');
slideList = slideList.split(',');
for (let id of slideList) {
let slide = await store.getSlide(id);
//next line is for testing only

Check failure on line 15 in apps/port/export.js

View workflow job for this annotation

GitHub Actions / test

Expected space or tab after '//' in comment
let slide = [{ _id: { "$oid": id }, name: "Mock Slide", type: "slide" }];

Check failure on line 16 in apps/port/export.js

View workflow job for this annotation

GitHub Actions / test

There should be no space after '{'

Check failure on line 16 in apps/port/export.js

View workflow job for this annotation

GitHub Actions / test

There should be no space after '{'

Check failure on line 16 in apps/port/export.js

View workflow job for this annotation

GitHub Actions / test

Strings must use singlequote

Check failure on line 16 in apps/port/export.js

View workflow job for this annotation

GitHub Actions / test

There should be no space before '}'

Check failure on line 16 in apps/port/export.js

View workflow job for this annotation

GitHub Actions / test

Strings must use singlequote

Check failure on line 16 in apps/port/export.js

View workflow job for this annotation

GitHub Actions / test

Strings must use singlequote

Check failure on line 16 in apps/port/export.js

View workflow job for this annotation

GitHub Actions / test

There should be no space before '}'
slide = slide[0];
if (slide && slide['_id']) {
let s = {'id': slide['_id']['$oid'], 'name': slide['name'], 'type': 'slide', 'raw': slide};
Expand All @@ -34,7 +35,19 @@
'name': a['provenance']['analysis']['execution_id'], 'type': 'heatmap'});
}
results[slide['_id']['$oid']] = r;
}

document.querySelectorAll('.slide-checkbox').forEach(parentCheckbox => {

Check failure on line 39 in apps/port/export.js

View workflow job for this annotation

GitHub Actions / test

Expected parentheses around arrow function argument
parentCheckbox.addEventListener('change', function() {
let slideId = this.getAttribute('data-id');

Check failure on line 41 in apps/port/export.js

View workflow job for this annotation

GitHub Actions / test

Expected indentation of 10 spaces but found 12
let childCheckboxes = document.querySelectorAll(`.result[data-target="${slideId}"]`);

childCheckboxes.forEach(childCheckbox => {
childCheckbox.checked = parentCheckbox.checked;
});
});
});

}
}

let headers = ['name', 'id', 'type'];
Expand Down Expand Up @@ -68,11 +81,18 @@
}
parent.appendChild(d);
}
// add special checkbox
parentCheck = document.createElement('input');
parentCheck.classList.add('form-check-input');

// Add special checkbox for parent row
let parentCheck = document.createElement('input');
parentCheck.classList.add('form-check-input', 'slide-checkbox');
parentCheck.type = 'checkbox';
parentCheck.indeterminate = true; // cool!
parentCheck.setAttribute('data-id', x.id);

// Append checkbox to the parent row
let parentTd = document.createElement('td');
parentTd.appendChild(parentCheck);
parent.appendChild(parentTd);

// TODO -- finish this. you'd want to add logic that sets this checkbox to true, false or indeterminate
// depending on children selection. also select/deselect all children on change of this.
// parent.appendChild(parentCheck);
Expand All @@ -91,18 +111,21 @@
}
child.appendChild(d);
}
// special checkbox
childCheck = document.createElement('input');
// Add checkbox for child row
let childCheck = document.createElement('input');
childCheck.type = 'checkbox';
childCheck.classList.add('form-check-input');
childCheck.classList.add('result');
childCheck.classList.add('form-check-input', 'result');
childCheck.setAttribute('data-target', x.id);
childCheck.setAttribute('data-self', y.id);
childCheck.setAttribute('data-slideInfo', JSON.stringify(x.raw));
childCheck.setAttribute('data-type', y.type);
childCheck.checked = true;
child.appendChild(childCheck);
table.appendChild(child);

// Append checkbox to the child row
let childTd = document.createElement('td');
childTd.appendChild(childCheck);
child.appendChild(childTd);

}
}
t.appendChild(table);
Expand Down
Loading