Skip to content

Commit

Permalink
Merge pull request #305 from noduslabs/new-branch
Browse files Browse the repository at this point in the history
Fixed top_nodes selection bug #302
  • Loading branch information
deemeetree authored Nov 27, 2019
2 parents 613bae8 + 2a47f91 commit 04f0341
Show file tree
Hide file tree
Showing 4 changed files with 114 additions and 9 deletions.
2 changes: 1 addition & 1 deletion views/components/common/index.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@
cell.className += " " + css_class;
}
else if (key == 'node') {
cell.className += " top_nodes";
cell.className += " stats_nodes";
}
}
}
Expand Down
113 changes: 109 additions & 4 deletions views/components/entries/Analytics/AnalyticsPaneLogic.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -226,10 +226,115 @@ function AnalyticsPanel() {
}
});
$('.lda_nodes').each(function(){
if (pinnedNodes.indexOf($(this).text()) > -1) {
$(this).attr('style','color: #0089e0 !important; text-decoration: underline !important;');
}
else {
$(this).removeAttr('style');
}
});
$('.stats_nodes').each(function(){
if (pinnedNodes.indexOf($(this).text()) > -1) {
$(this).attr('style','color: #0089e0 !important; text-decoration: underline !important;');
}
else {
$(this).removeAttr('style');
}
});
$('.entry_nodes').each(function(){
if (pinnedNodes.indexOf($(this).text()) > -1) {
$(this).attr('style','color: #0089e0 !important; text-decoration: underline !important;');
}
else {
$(this).removeAttr('style');
}
});
}
this.activateTopEntryNodes = function() {
// What happens when we click on top nodes on the Analytics panel?
$('.entry_nodes').click(function(){
let nodeLabel = $(this).text();
if (graphFactory.checkIfPinned(nodeLabel) == false) {
graphFactory.addToPinnedNodes(nodeLabel);
}
else {
if (graphFactory.checkIfPinned(nodeLabel) == true) {
graphFactory.removeFromPinnedNodes(nodeLabel);
}
}
return false;
});
}
this.activateTopLDANodes = function() {
// What happens when we click on top nodes on the Analytics panel?
$('.lda_nodes').click(function(){
let nodeLabel = $(this).text();
if (graphFactory.checkIfPinned(nodeLabel) == false) {
graphFactory.addToPinnedNodes(nodeLabel);
}
else {
if (graphFactory.checkIfPinned(nodeLabel) == true) {
graphFactory.removeFromPinnedNodes(nodeLabel);
}
}
return false;
});
}
this.activateTopStatsNodes = function() {
// What happens when we click on top nodes on the Analytics panel?
$('.stats_nodes').click(function(){
let nodeLabel = $(this).text();
if (graphFactory.checkIfPinned(nodeLabel) == false) {
graphFactory.addToPinnedNodes(nodeLabel);
}
else {
if (graphFactory.checkIfPinned(nodeLabel) == true) {
graphFactory.removeFromPinnedNodes(nodeLabel);
}
}
return false;
});
}
this.activateTopNodes = function() {
// What happens when we click on top nodes on the Analytics panel?
$('.top_nodes').click(function(){
Expand Down Expand Up @@ -328,7 +433,7 @@ function AnalyticsPanel() {
generateTable(table, nodes_list, "numeric");
// Add click events on each node name
analyticsPanel.activateTopNodes();
analyticsPanel.activateTopStatsNodes();
// Table sorting function
Expand Down Expand Up @@ -387,7 +492,7 @@ function AnalyticsPanel() {
for (var j = 0; j < data[i].length; j++) {
//console.log(nodeIDs[data[i][j].term]);
items.push('<div class="inlinesquare ' + louvain_communities[nodeIDs[data[i][j].term]] + '"></div> <a href="#" class="top_nodes">' + data[i][j].term + '</a> &nbsp;');
items.push('<div class="inlinesquare ' + louvain_communities[nodeIDs[data[i][j].term]] + '"></div> <a href="#" class="lda_nodes">' + data[i][j].term + '</a> &nbsp;');
if (j == (data[i].length - 1)) {
items.push('<br>')
}
Expand All @@ -404,7 +509,7 @@ function AnalyticsPanel() {
for (var i = 0; i < data.length; i++) {
for (var j = 0; j < data[i].length; j++) {
//console.log(nodeIDs[data[i][j].term]);
items.push('<div class="inlinesquare ' + louvain_communities[nodeIDs[data[i][j].term]] + '"></div> <a href="#" class="top_nodes">' + data[i][j].term + '</a> &nbsp;');
items.push('<div class="inlinesquare ' + louvain_communities[nodeIDs[data[i][j].term]] + '"></div> <a href="#" class="lda_nodes">' + data[i][j].term + '</a> &nbsp;');
if (j == (data[i].length - 1)) {
items.push('<br>')
}
Expand All @@ -422,7 +527,7 @@ function AnalyticsPanel() {
}
}
}
analyticsPanel.activateTopNodes();
analyticsPanel.activateTopLDANodes();
});
Expand Down
2 changes: 1 addition & 1 deletion views/components/entries/Graph/GraphUpdate.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ socket.on('node add', function(msg){
// This is for collaboration only
socket.on('node click', function(msg){
graphFactory.initPinnedNodes(msg.pinnedNodes);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -388,10 +388,10 @@
summary_helper += ', '
}
if (entries_keywords[currentDiv][l].label) {
summary_helper += '<a href="#" class="top_nodes">' + entries_keywords[currentDiv][l].label + '</a>';
summary_helper += '<a href="#" class="entry_nodes">' + entries_keywords[currentDiv][l].label + '</a>';
}
else if (entries_keywords[currentDiv][l].name) {
summary_helper += '<a href="#" class="community_node" community="' + graphFactory.getCommunityOfNode(entries_keywords[currentDiv][l].name) + '">' + entries_keywords[currentDiv][l].name + '</a>';
summary_helper += '<a href="#" class="entry_nodes" community="' + graphFactory.getCommunityOfNode(entries_keywords[currentDiv][l].name) + '">' + entries_keywords[currentDiv][l].name + '</a>';
}
}
Expand All @@ -410,7 +410,7 @@
document.getElementById('entries').scrollTop = 0;
analyticsPanel.activateTopNodes();
analyticsPanel.activateTopEntryNodes();
console.log('top info');
console.log(top_community_words);
Expand Down

0 comments on commit 04f0341

Please sign in to comment.