feat: add person and org filters to network

Resolves #54
This commit is contained in:
James Graham
2021-04-22 21:16:39 +01:00
parent 5a2890ece1
commit 20812dfc40
4 changed files with 162 additions and 63 deletions

View File

@@ -88,14 +88,19 @@ function get_network() {
var relationship_set = JSON.parse(document.getElementById('relationship-set-data').textContent);
for (var relationship of relationship_set) {
cy.add({
group: 'edges',
data: {
id: 'relationship-' + relationship.pk.toString(),
source: 'person-' + relationship.source.pk.toString(),
target: 'person-' + relationship.target.pk.toString()
}
})
try {
cy.add({
group: 'edges',
data: {
id: 'relationship-' + relationship.pk.toString(),
source: 'person-' + relationship.source.pk.toString(),
target: 'person-' + relationship.target.pk.toString()
}
})
} catch {
// Exception thrown if a node in the relationship does not exist
// This is probably because it's been filtered out
}
}
// Optimise graph layout