Skip to content
This repository has been archived by the owner on Feb 4, 2024. It is now read-only.

Commit

Permalink
Merge branch 'Adil-dev' of https://github.com/familytree365/nuxt into…
Browse files Browse the repository at this point in the history
… Adil-dev
  • Loading branch information
shahghasiadil committed Nov 6, 2021
2 parents 6a0844c + 90be057 commit a9d1a83
Showing 1 changed file with 26 additions and 10 deletions.
36 changes: 26 additions & 10 deletions pages/pedigree/show.vue
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,10 @@ export default {
let gedComdata = await this.$axios
.$get("/api/trees/show", {params})
this.data = gedComdata
if(!this.data.links.length) {
console.log('no data found');
return;
}
this.data.links = this.data.links
.map((item) => item.map(childItem => childItem.toString()))
Expand Down Expand Up @@ -223,7 +227,10 @@ export default {
})
// find root node and assign data
// TODO: [1] - fix find by n.id
let root = this.all_nodes.find(n => n.data.id === this.data.start)
//suman
//let root = this.all_nodes.find(n => n.data.id === this.data.start)
let root = this.all_nodes.find((n) => {
if(n.data){return n.data.id === this.data.start}})
root.visible = true
root.neighbors = []
root.neighbors = this.getNeighbors(root)
Expand Down Expand Up @@ -380,7 +387,10 @@ export default {
if (node.data.isUnion) return [];
let u_id = node.data.parent_union;
if (u_id) {
let union = this.all_nodes.find(n => n.data.id === u_id);
//let union = this.all_nodes.find(n => n.data.id === u_id);
//suman
let union = this.all_nodes.find((n) => {
if(n.data){return n.data.id === u_id}})
return [union].filter(u => u !== undefined);
} else return [];
},
Expand Down Expand Up @@ -456,22 +466,22 @@ export default {
getFullDisplayBirthYear(node) {
let birthYear = ''
if (node.data.birth_year) {
if (node.data && node.data.birth_year) {
return node.data.birth_year
}
if (node.data.birthday) {
if (node.data && node.data.birthday) {
return this.getBirthYear(node)
}
},
getFullDisplayDeathYear(node) {
let deathYear = ''
if (node.data.death_year) {
if (node.data && node.data.death_year) {
return node.data.death_year
}
if (node.data.deathday) {
if (node.data && node.data.deathday) {
return this.getDeathYear(node)
}
},
Expand Down Expand Up @@ -521,7 +531,9 @@ export default {
// Update the nodes...
let node = this.g.selectAll('g.node')
.data(nodes, (d) => {
return d.data.id || (d.data.id = ++i);
//return d.data.id || (d.data.id = ++i);
//suman
if(d.data){return d.data.id || (d.data.id = ++i);}
})
// Enter any new nodes at the parent's previous position.
Expand All @@ -547,15 +559,17 @@ export default {
.attr("dy", "-2")
.attr("x", 13)
.attr("text-anchor", "start")
.text(d => d.data.name);
.text((d) => {if(d.data){return d.data.name}});
//.text(d => d.data.name);
//suman
// add birth date and death date as labels
nodeEnter.append('text')
.attr("dy", "10")
.attr("x", 13)
.attr("text-anchor", "start")
.text(
(d) => {
if (d.data.isUnion) return;
if (d.data && d.data.isUnion) return;
return (this.getFullDisplayBirthYear(d) || "?") +
" - " +
(this.getFullDisplayDeathYear(d) || "?")
Expand All @@ -574,7 +588,9 @@ export default {
// Update the node attributes and style
nodeUpdate.select('circle.node')
.attr('r', d => 10 * !d.data.isUnion)
.attr('r', (d) => {if(d.data){10 * !d.data.isUnion}})
//.attr('r', d => 10 * !d.data.isUnion)
//suman
.style("fill", (d) => {
return this.is_extendable(d) ? "lightsteelblue" : "#fff";
})
Expand Down

0 comments on commit a9d1a83

Please sign in to comment.