-
Notifications
You must be signed in to change notification settings - Fork 38
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
Shrink the raw report page size #146
Comments
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
Hello @Julian, all the problems I was having have been fixed, and the bowtie is now fully configured and running properly, thanks for your kind support! As you mentioned in the description itself that one of the ways to reduce the size of the generated HTML report would be to split the raw data from the DOM-related parts of the report, one of the ways to do this is by using |
Great glad to hear it! Will hide the above comments then so that they're not confusing this specific issue.
Compressing with Don't forget though that there's no web server here, it's a pre-generated HTML file (which of course can still run JS when it's opened) -- so there's nowhere to fetch from, but you still can certainly lookup elements in the DOM (i.e. the data we currently emit) and decompress them on the fly. Let me know if that helps, but sounds like you're indeed on the right track if you're saying you intend to give this issue a shot! |
That's cool! I've started working on it and will let you know if I require any help in between! |
Hi @Shrini3, could you share a bit more about the result you're getting? Btw, in order to keep this thread issue specific, these discussions would be best on Slack. Cheers!😃 |
Hi @Julian, Another thing is, in what way should the decompressed data be rendered in the HTML elements? Would it be a good choice to assign each element an id and render the data within it using JavaScript (by grabbing the id using |
Hey @AgniveshChaubey -- the PR looks like it may indeed be on the right track, though if I run it, I get an error:
does it run properly for you? You also probably will not be able to do things precisely as you have them because some things need to be available when rendering the template, rather than at page-load time -- if you're asking whether it's OK to reorder things there that's fine with me I think -- the main goal would be to get something identical to what we see right now but which is smaller -- so if you do want to instead dynamically render HTML by pulling elements out of the compressed blob and creating something dynamically using JS that sounds fine to me -- does that help at all? If not I can elaborate further! Thanks again for giving this a shot. |
Yes, it would be really helpful if you can elaborate a bit more!
Actually, I'm not sure how to run the tests in a development environment. But yes, I am getting the HTML report when running one of the following commands
. Edit: Please let me know how to test the changes locally to check if it works as expected. |
You might be running into the same thing another contributor was -- basically make sure Bowtie is installed in editable mode -- I added a note here: https://bowtie-json-schema.readthedocs.io/en/latest/contributing/#installation -- if you don't have Does that help perhaps? |
Hi @Julian, I have been working extremely hard for the past two days to anyhow reduce the HTML report size, but getting new challenges every time when one is resolved. After doing trial and error for an entire day, I finally came up with a solution to keep the raw data in a separate file. (The main problem was figuring out how to parse custom Python objects to json file bcoz only primitive object types are allowed for parsing and in order to parse objects with custom type, we need to create a custom serialization method). I also have successfully compressed the report data using As of now, I am having some questions:
|
Hey @AgniveshChaubey! First -- it's perfectly fine to shift to something else if things seem more challenging! There's certainly no issue with doing so, you may find it more fun to shift to making some purely UI-related cosmetic improvement and find that a bit smoother, and I can certainly help find something if you prefer to try that! Will respond to your comment though in case it helps -- and to be sure, I haven't fully thought through this issue (otherwise I likely would have implemented it :), so I am trying to give helpful breadcrumbs but they very well may lead you down dead ends!
I don't 100% follow what you mean here -- the data we build a report from is already valid JSON -- i.e. what is spit out by
Are you referring to reading (other) files from the local filesystem from the .HTML file? Just to make sure -- there are 2 ways someone may want to view the report:
I think the kind of permissions you're talking about probably apply more to the second than the first, yes? For the "hosted" HTML page, we could have it reach out to a JSON file which is hosted alongside the page (I mentioned something similar here in the context of JSON for badges -- I'm not 100% sure that works "easily" but I think it's very likely) -- in other words having the data external, retrieving it via client-side JS, and then dynamically rendering what we want, but here I think as you're pointing out that's easier for the hosted case than the local case (which I think is fine! we can probably concentrate on the hosted case for now, and if the local case requires someone to enable some extra permissions they can choose to do so).
I think the above is related here -- I would wonder whether if we produce a gzipped JSON file and then try to retrieve it from Javascript, does GitHub pages properly serve it with the right But again, there's still some things to check here so it's perfectly possible things are indeed not 100% straightforward! I hope some of the above at least helps a bit, but let me know what you think. |
I totally agree with you, but still I wanna work on this issue as I am learning a lot along the way. I have good experience with UI-related stuff, but this issue is quite new as well as challenging for me, and I am really getting more value working on it. If you are having some UI-related improvements in mind, do consider mentioning them, I'll surely check them out after this one!
below is the code to dump the data in a separate file....
inside report function
when running the tests with these changes, the following error occurs which I have mentioned here
Should I just use
to write into the new file? (but this would be in string formate)
I am referring to just reading the newly generated file json file from HTML file. |
What's the need for this new file? What does it do differently than what the output of |
This is the different way I was trying other than compress-decompress one This is the reason why I'm trying to create a new file.
I would like to know a bit more about how |
Yes but that's already what Right now, you run:
This spits out JSON data. If you pipe that into I agree it's good (both for compression and otherwise) to just leave all the data as JSON and render everything using some client-side JavaScript -- I'm again curious what you're proposing that isn't already just "leave the data exactly as it is currently emitted by I'm not saying it's perfect as-is, I could certainly imagine tweaking it -- but I don't understand what you'd want out of a new file -- that one already should be exactly the data you're trying to get, no?
On a daily (or manually triggered basis), we run |
If I am not wrong, when piping If the above steps can be done directly (with |
Right you're not wrong, we don't want to keep piping the output into bowtie report in this case -- but if you run e.g. Does that help? |
As per the suggestion, the json string (coming from Before compression, the json data was accessible with the following expression ( I have updated the PR, and have added some console logs for reference. Please have a look over it. |
Right now each HTML report when run on the suite is ~10MB, probably because of all the JSON blobs for schemas and instances that we write into each page.
A compressed zip of the site though is only a few MB total, so clearly stuff compresses well.
We likely anyhow should split the raw data from the DOM-related parts of the report (and have the latter read into the former from some simple client-side JS), but perhaps the above is a reason to even write the raw data out compressed and decompress bits of it client-side.
The text was updated successfully, but these errors were encountered: