Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Graph is not getting plotted #3

Open
DragonPulse opened this issue Feb 20, 2019 · 3 comments
Open

Graph is not getting plotted #3

DragonPulse opened this issue Feb 20, 2019 · 3 comments

Comments

@DragonPulse
Copy link

The Graph is not getting plotted. the issue is in index.html
var beans = typeFilter != ''
? json[0].beans.filter(function(b){ return beanTypeContains(b, typeFilter)})
: json[0].beans;

json[o].beans is undefined.

but the app.js line 41 res.send(body) is able to send the response. Seems like some issue with parsing the json form server

@j75
Copy link

j75 commented Dec 13, 2019

I also have the same problem using Docker -> a page with 2 inputs ("Filter beans" and "Highlight beans") is displayed, as well as a message Loading data next to the Redraw button, but nothing is displayed...
In the console docker displays Beans info located on: http://user:[email protected]:8080/actuator/beans and effectively if I click on the link a JSON is displayed.
I also think that in the README should be added the docker option -p 3000:3000 otherwise is not easy to see anything...

@j75
Copy link

j75 commented Dec 16, 2019

Finally I've got my graph by modifying index.html as shown below:

var beans = typeFilter != ''
                ? json.contexts.application.beans.filter(function(b) { return beanTypeContains(b, typeFilter)})
                : json.contexts.application.beans;
        var beansArray = Object.keys(beans).map((bean) => ({
          bean,
          ...beans[bean],
        }));
        var beanNodes = beansArray.map(function (b) {
      return {
        name: b.bean,
        group: 1,
        isHighlighted: beanTypeContains(b, highlightBeans)
      }
    });
...
   var beanLinks = beansArray.flatMap(beanToLinks); 

@hexi03
Copy link

hexi03 commented Aug 15, 2024

IDK, but it is not worked for me :(
My solution:

 var beans = typeFilter != ''
                ? json.contexts.application.beans.filter(function(b) { return beanTypeContains(b, typeFilter)})
                : json.contexts.application.beans;
        var beansArray = Object.keys(beans).map((bean) => ({
          bean,
          ...beans[bean],
        }));
        var beanNodes = beansArray.map(function (b) {
      return {
        name: b.bean,
        group: 1,
        isHighlighted: beanTypeContains(b, highlightBeans)
      }
    });

    beans = Object.entries(beans).map(function ([k,v],_){
      v.bean = k;
      return v;
    });
    var beanNodes = beans.map(function (b){
      return {
        name: b.bean,
        group: 1,
        isHighlighted: beanTypeContains(b, highlightBeans)
      }
    });

    var beanNodesHash = {};
    beanNodes.forEach(function (n, index){ beanNodesHash[n.name] = index; })

    function nameToId(name) {
      return beanNodesHash[name];
    }

    function beanToLinks(bean) {
      return bean.dependencies.map(function (reference) {
        return {
          source: nameToId(reference),
          target: nameToId(bean.bean),
          value: 1
        };
      }).filter(function (link){
        return link.source != undefined && link.target != undefined;
      });
    }

    var beanLinks = beansArray.flatMap(beanToLinks);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants