Giter Club home page Giter Club logo

Comments (5)

elmuerte avatar elmuerte commented on June 20, 2024

That is a really neat idea, but I do not have an idea how to achieve it.
It might be possible to do this using NodeJS. All the analysis is handled by jtdajs.js and then rendered with jtdajs.render.js. But the latter depends on some browser functionality and jQuery to find and handle the mustache templates.

The "frontend" basically does this:

var analysisConfig = new jtda.AnalysisConfig();
var renderConfig = new jtda.render.RenderConfig();
var analysis = new jtda.Analysis("someid", "some name", analysisConfig);
analysis.analyze("the thread dump content");
new jtda.render.Renderer(targetElement, renderConfig).render(analysis);

For the renderer jquery is only use to find the mustache template in the getTemplate() function. So that could easily be overwritten to provide an other way. On the targetElement it calls clear() and append() to set the rendered content, which could easily replaced by a non-jQuery object which allows the same.

But maybe it can be done even easier using jsdom which simply processes the index.html and injects the stacktrace in the input field, performs the analysis, en then writes the rendered result to a new file?

But it would be a nice feature to this to be able to do something like
jstack 1234 | jstack-review > results.html

from jstack-review.

elmuerte avatar elmuerte commented on June 20, 2024

A different approach, which is probably easier to achieve is to upload the thread dump to a webserver which is properly configured w.r.t. to CORS, and then link to this uploaded file.

For example, if the thread dump was uploaded to https://storage.example/threaddumps/0c2b13ed-7691-431b-b79b-71c4262c3374 then you could link to it like this:
https://interal.example/jstack-review/?https://storage.example/threaddumps/0c2b13ed-7691-431b-b79b-71c4262c3374

When a user then opens that link the provided URL will be downloaded and the analysis will be done at that spot. As long as the user has access to both URLs this will work.

from jstack-review.

nasr4 avatar nasr4 commented on June 20, 2024

I am able to get the TDA working in Chrome using my local index.html cloned from your repo with your jstack that I hosted off of gist. Here's the URL that I used in my browser: file:///Users/nsiddiq/jstack-review/index.html?https://gist.github.com/nasr4/614737e720305009a5f03c792392510a

I am trying to figure out how to curl this page in a manner that would preserve all of the elements on the page. I tried this:
curl file:///Users/nsiddiq/jstack-review/index.html?https://gist.github.com/nasr4/614737e720305009a5f03c792392510a > a.html

When I open a.html in my browser the TDA is not there at all. The page looks like this: https://www.dropbox.com/s/fnqfv4bx7hqkrm6/image%205-8-20%20at%2010.29%20am.jpeg?dl=0

Do you know how I can get this working? I am going to continue working at this and will let you know if I figure it out also.

from jstack-review.

nasr4 avatar nasr4 commented on June 20, 2024

@elmuerte : Hi Michiel,

I got this working using Puppeteer. Check it out: https://github.com/Maverick2318/save_javascript_webpage_as_html

Puppeteer is pretty slick :)

Feel free to close this issue. If I have any other questions I will open another issue.

Thanks for your help and detailed explanation about how jstack-review works!

from jstack-review.

elmuerte avatar elmuerte commented on June 20, 2024

That's quite neat.

from jstack-review.

Related Issues (11)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.