1- function extract_info ( cell , obj , tag , category ) {
1+ function extract_info ( cell , obj , tag , colorPolicies ) {
22 if ( ! Array . isArray ( obj ) ) {
33 obj = [ obj ] ;
44 }
55 if ( typeof obj [ 0 ] === "string" || typeof obj [ 0 ] == "number" || typeof obj [ 0 ] == "boolean" ) {
6- if ( obj [ 2 ] && obj [ 2 ] [ "conflict" ] == "Curation" ) {
6+ if ( obj [ 2 ] && obj [ 2 ] [ "conflict" ] ) {
77 const element = document . createElement ( "div" ) ;
8- element . className += " error" ;
8+ element . style . color = colorPolicies [ obj [ 2 ] [ "conflict" ] ] ;
99 element . appendChild ( document . createTextNode ( ` ${ obj [ 0 ] } ` ) ) ;
1010 cell . appendChild ( element ) ;
1111 } else {
@@ -16,7 +16,7 @@ function extract_info(cell, obj, tag, category){
1616 else if ( ! Array . isArray ( obj [ 0 ] ) && Object . keys ( obj [ 0 ] ) . includes ( "familyName" ) ) {
1717 obj . forEach ( e => {
1818 const element = document . createElement ( "div" ) ;
19- extract_person ( e , element , tag ) ;
19+ extract_person ( e , element , tag , colorPolicies ) ;
2020 cell . appendChild ( element ) ;
2121
2222 } ) }
@@ -37,7 +37,7 @@ function extract_info(cell, obj, tag, category){
3737 div . appendChild ( document . createTextNode ( `${ key } : ${ ( obj [ 0 ] [ key ] ) } ` ) ) ;
3838 } else {
3939 div . appendChild ( document . createTextNode ( `${ key } : ` ) ) ;
40- extract_info ( div , obj [ 0 ] [ key ] , tag , key ) ;
40+ extract_info ( div , obj [ 0 ] [ key ] , tag , colorPolicies ) ;
4141 }
4242 div . appendChild ( document . createElement ( "br" ) ) ;
4343 }
@@ -52,7 +52,7 @@ function extract_info(cell, obj, tag, category){
5252
5353 }
5454
55- function extract_person ( e , element , tag ) {
55+ function extract_person ( e , element , tag , colorPolicies ) {
5656 const tooltip = document . createElement ( "div" ) ;
5757 const tooltiptag = document . createElement ( "div" ) ;
5858 tooltip . classList . add ( "tooltip" ) ;
@@ -74,19 +74,23 @@ function extract_info(cell, obj, tag, category){
7474 const pair_in_list = document . createElement ( "p" ) ;
7575 names . push ( `${ k } :${ key } : ${ e [ k ] [ key ] [ 0 ] } ` ) ;
7676 pair_in_list . appendChild ( document . createTextNode ( `${ k } :${ key } : ${ e [ k ] [ key ] [ 0 ] } ` ) ) ;
77- if ( e [ k ] [ key ] [ 2 ] && e [ k ] [ key ] [ 2 ] [ "conflict" ] == "Curation" ) {
78- pair_in_list . className += " error" ;
79- tooltiptag . className += " error" ;
77+ if ( e [ k ] [ key ] [ 2 ] && e [ k ] [ key ] [ 2 ] [ "conflict" ] ) {
78+ pair_in_list . style . color = colorPolicies [ e [ k ] [ key ] [ 2 ] [ "conflict" ] ] ;
79+ tooltiptag . style . color = colorPolicies [ e [ k ] [ key ] [ 2 ] [ "conflict" ] ] ;
80+ /*pair_in_list.className += " error";
81+ tooltiptag.className += " error";*/
8082 }
8183 pair . appendChild ( pair_in_list ) ;
8284 }
8385 } else {
8486 names . push ( `${ k } : ${ e [ k ] [ 0 ] } ` ) ;
8587 pair . appendChild ( document . createTextNode ( `${ k } : ${ e [ k ] [ 0 ] } ` ) ) ;
8688
87- if ( e [ k ] [ 2 ] && e [ k ] [ 2 ] [ "conflict" ] == "Curation" ) {
88- pair . className += " error" ;
89- tooltiptag . className += " error" ;
89+ if ( e [ k ] [ 2 ] && e [ k ] [ 2 ] [ "conflict" ] ) {
90+ pair . style . color = colorPolicies [ e [ k ] [ 2 ] [ "conflict" ] ] ;
91+ tooltiptag . style . color = colorPolicies [ e [ k ] [ 2 ] [ "conflict" ] ] ;
92+ //pair.className += " error";
93+ //tooltiptag.className += " error";
9094 }
9195 }
9296 tooltiptext . appendChild ( pair ) ;
0 commit comments